From 080f7ddc7b97b4f8192f163e4b9f86f94b3fc797 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=B2=85?= <907037276@qq.com> Date: Tue, 24 Oct 2023 14:04:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E5=A4=96=E5=BC=80=E6=94=BE=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ibeetl/jlw/dao/SchoolClassDao.java | 1 + .../java/com/ibeetl/jlw/dao/StudentDao.java | 4 + .../ibeetl/jlw/service/StudentService.java | 687 ++++++++++-------- .../com/ibeetl/jlw/web/AccountController.java | 26 + web/src/main/resources/sql/jlw/student.md | 39 +- 5 files changed, 439 insertions(+), 318 deletions(-) diff --git a/web/src/main/java/com/ibeetl/jlw/dao/SchoolClassDao.java b/web/src/main/java/com/ibeetl/jlw/dao/SchoolClassDao.java index 41f9e163..b50ec5fb 100644 --- a/web/src/main/java/com/ibeetl/jlw/dao/SchoolClassDao.java +++ b/web/src/main/java/com/ibeetl/jlw/dao/SchoolClassDao.java @@ -37,4 +37,5 @@ public interface SchoolClassDao extends BaseMapper { List> getClassListByMajorId(String majorId); + } \ No newline at end of file diff --git a/web/src/main/java/com/ibeetl/jlw/dao/StudentDao.java b/web/src/main/java/com/ibeetl/jlw/dao/StudentDao.java index 8194844f..7f8e3beb 100644 --- a/web/src/main/java/com/ibeetl/jlw/dao/StudentDao.java +++ b/web/src/main/java/com/ibeetl/jlw/dao/StudentDao.java @@ -117,4 +117,8 @@ public interface StudentDao extends BaseMapper{ List>getStudentInfoByClassId(String classIds); + List>getStudentInfoByKeyword(String keyword,Long schoolId); + + PageQuery> pagedListStudentInfoByClassId(PageQuery query); + } \ No newline at end of file diff --git a/web/src/main/java/com/ibeetl/jlw/service/StudentService.java b/web/src/main/java/com/ibeetl/jlw/service/StudentService.java index 97a38ba6..e0e8bb63 100644 --- a/web/src/main/java/com/ibeetl/jlw/service/StudentService.java +++ b/web/src/main/java/com/ibeetl/jlw/service/StudentService.java @@ -73,53 +73,81 @@ import static com.ibeetl.jlw.web.IpAddressController.ipAddressMap; @Service @Validated @Transactional -public class StudentService extends CoreBaseService{ +public class StudentService extends CoreBaseService { - @Autowired private StudentDao studentDao; - @Autowired private SchoolClassDao schoolClassDao; - @Autowired private CoreUserRoleDao coreUserRoleDao; - @Autowired private StudentQuestionLogService studentQuestionLogService; - @Autowired private StudentQuestionLogInfoService studentQuestionLogInfoService; - @Autowired private StudentQuestionLogAnswerService studentQuestionLogAnswerService; - @Autowired private WrongQuestionService wrongQuestionService; + @Autowired + private StudentDao studentDao; + @Autowired + private SchoolClassDao schoolClassDao; + @Autowired + private CoreUserRoleDao coreUserRoleDao; + @Autowired + private StudentQuestionLogService studentQuestionLogService; + @Autowired + private StudentQuestionLogInfoService studentQuestionLogInfoService; + @Autowired + private StudentQuestionLogAnswerService studentQuestionLogAnswerService; + @Autowired + private WrongQuestionService wrongQuestionService; - @Autowired CorePlatformService platformService; + @Autowired + CorePlatformService platformService; - @Autowired UserConsoleService userConsoleService; + @Autowired + UserConsoleService userConsoleService; - @Autowired SchoolClassService schoolClassService; + @Autowired + SchoolClassService schoolClassService; - @Autowired private CompetitionService competitionService; - @Autowired private CompetitionStudentsService competitionStudentsService; - @Autowired private CompetitionTaskOneQuestionService competitionTaskOneQuestionService; - @Autowired private CompetitionTaskSecondQuestionService competitionTaskSecondQuestionService; - @Autowired private CompetitionTaskSecondQuestionStepService competitionTaskSecondQuestionStepService; + @Autowired + private CompetitionService competitionService; + @Autowired + private CompetitionStudentsService competitionStudentsService; + @Autowired + private CompetitionTaskOneQuestionService competitionTaskOneQuestionService; + @Autowired + private CompetitionTaskSecondQuestionService competitionTaskSecondQuestionService; + @Autowired + private CompetitionTaskSecondQuestionStepService competitionTaskSecondQuestionStepService; - @Autowired private ExamService examService; - @Autowired private ExamStudentsService examStudentsService; - @Autowired private ExamTaskOneQuestionService examTaskOneQuestionService; - @Autowired private ExamTaskSecondQuestionService examTaskSecondQuestionService; - @Autowired private ExamTaskSecondQuestionStepService examTaskSecondQuestionStepService; - @Autowired private ExamTaskThreeQuestionService examTaskThreeQuestionService; - @Autowired private ExamTaskThreeQuestionStepService examTaskThreeQuestionStepService; + @Autowired + private ExamService examService; + @Autowired + private ExamStudentsService examStudentsService; + @Autowired + private ExamTaskOneQuestionService examTaskOneQuestionService; + @Autowired + private ExamTaskSecondQuestionService examTaskSecondQuestionService; + @Autowired + private ExamTaskSecondQuestionStepService examTaskSecondQuestionStepService; + @Autowired + private ExamTaskThreeQuestionService examTaskThreeQuestionService; + @Autowired + private ExamTaskThreeQuestionStepService examTaskThreeQuestionStepService; - @Autowired private ResourcesQuestionService resourcesQuestionService; + @Autowired + private ResourcesQuestionService resourcesQuestionService; - @Autowired private CourseInfoService courseInfoService; + @Autowired + private CourseInfoService courseInfoService; - @Autowired private StudentDefenceLogService studentDefenceLogService; - @Autowired private StudentDefenceLogInfoService studentDefenceLogInfoService; - @Autowired private StudentDefenceLogNoteService studentDefenceLogNoteService; + @Autowired + private StudentDefenceLogService studentDefenceLogService; + @Autowired + private StudentDefenceLogInfoService studentDefenceLogInfoService; + @Autowired + private StudentDefenceLogNoteService studentDefenceLogNoteService; - @Autowired private StudentAccountAssetAllocationService studentAccountAssetAllocationService; + @Autowired + private StudentAccountAssetAllocationService studentAccountAssetAllocationService; private final ExecutorService pool = Executors.newCachedThreadPool(); @Autowired private WebPlatformService webPlatformService; - public PageQueryqueryByCondition(PageQuery query) { - PageQuery ret = studentDao.queryByCondition(query); + public PageQuery queryByCondition(PageQuery query) { + PageQuery ret = studentDao.queryByCondition(query); List list = ret.getList(); CollectionUtil.emptyIfNull(list).forEach(item -> { item.setStudentPassword(null); @@ -129,15 +157,15 @@ public class StudentService extends CoreBaseService{ } - /** * 查询学生日志 * 操作日志,Mock + * * @param query * @return */ - public PageQuery queryLogByCondition(PageQuery query){ - PageQuery ret = studentDao.queryByCondition(query); + public PageQuery queryLogByCondition(PageQuery query) { + PageQuery ret = studentDao.queryByCondition(query); List studentList = ret.getList(); queryListAfter(studentList); @@ -149,25 +177,25 @@ public class StudentService extends CoreBaseService{ Map> groupByStudentId = CacheLogJob.studentLogMap; - if(ObjectUtil.isAllNotEmpty(studentIds) && ObjectUtil.isEmpty(groupByStudentId)){ + if (ObjectUtil.isAllNotEmpty(studentIds) && ObjectUtil.isEmpty(groupByStudentId)) { StudentQuery studentQuery = new StudentQuery(); studentQuery.setStudentIds(studentIds); List studentLogList = defaultIfNull(getStudentLog(studentQuery), Collections.emptyList()); groupByStudentId = studentLogList.stream().collect(Collectors.groupingBy(e -> e.get("platform") + "" + e.getStudentId())); } - if(null != groupByStudentId){ + if (null != groupByStudentId) { for (Student student : studentList) { String key = student.get("platform") + "" + student.getStudentId(); List studentLogList = groupByStudentId.get(key); - if(null != studentLogList && studentLogList.size()>0){ + if (null != studentLogList && studentLogList.size() > 0) { Student studentLog = studentLogList.get(0); student.set("lastLoginTime", studentLog.get("lastLoginTime")); - student.set("onlineDuration",TimeTool.diffTime(studentLog.get("lastLoginTime"),studentLog.get("lastOperateTime"))); - student.set("ip",studentLog.get("ip")); - IpAddress ipAddress = null != studentLog.get("ip") && StringUtils.isNotBlank(studentLog.get("ip").toString())?ipAddressMap.get(studentLog.get("ip").toString()):null; - student.set("ipAddress",null != ipAddress?(ipAddress.getProvince()+ipAddress.getCity()+ipAddress.getDistrict()):null);//IP地址 - }else { + student.set("onlineDuration", TimeTool.diffTime(studentLog.get("lastLoginTime"), studentLog.get("lastOperateTime"))); + student.set("ip", studentLog.get("ip")); + IpAddress ipAddress = null != studentLog.get("ip") && StringUtils.isNotBlank(studentLog.get("ip").toString()) ? ipAddressMap.get(studentLog.get("ip").toString()) : null; + student.set("ipAddress", null != ipAddress ? (ipAddress.getProvince() + ipAddress.getCity() + ipAddress.getDistrict()) : null);//IP地址 + } else { student.set("lastLoginTime", RandomUtil.randomDay(-20, -1)); student.set("onlineDuration", RandomUtil.randomNumber()); student.set("ip", "127.0.0.1"); @@ -175,7 +203,7 @@ public class StudentService extends CoreBaseService{ } } if (CollectionUtils.isNotEmpty(studentList)) { - studentList = studentList.stream().sorted(Comparator.comparing(v -> (Date)v.get("lastLoginTime"))).collect(Collectors.toList()); + studentList = studentList.stream().sorted(Comparator.comparing(v -> (Date) v.get("lastLoginTime"))).collect(Collectors.toList()); Collections.reverse(studentList); ret.setList(studentList); } @@ -194,6 +222,7 @@ public class StudentService extends CoreBaseService{ /** * 登录日志 + * * @param query * @return */ @@ -209,17 +238,18 @@ public class StudentService extends CoreBaseService{ /** * 查询学生日志 * 操作日志,真实数据 - * + *

* 返回值: * lastLoginTime 最后登录时间 * onlineDuration 在线时长 * ip 登录IP * ipAddress (IP转换成省市区) * 等等 + * * @param query * @return */ - public PageQuery queryStudentUseLogByCondition(PageQuery query){ + public PageQuery queryStudentUseLogByCondition(PageQuery query) { UniversitiesColleges uniAdmin = getUniAdmin(); if (null != uniAdmin) { @@ -231,6 +261,7 @@ public class StudentService extends CoreBaseService{ /** * 行为日志分析 + * * @param query * @return */ @@ -245,6 +276,7 @@ public class StudentService extends CoreBaseService{ /** * 统计报表-总人数统计 + * * @param query * @return */ @@ -257,36 +289,36 @@ public class StudentService extends CoreBaseService{ return studentDao.queryStatisticalStatementNumberPeopleByCondition(query); } - public PageQueryqueryPracticePerformanceStatistic(PageQuery query){ - PageQuery ret = studentDao.getPracticePerformanceStatistic(query); + public PageQuery queryPracticePerformanceStatistic(PageQuery query) { + PageQuery ret = studentDao.getPracticePerformanceStatistic(query); queryListAfter(ret.getList()); return ret; } - public List getPracticePerformanceStatisticInfoList(StudentQuery studentQuery){ + public List getPracticePerformanceStatisticInfoList(StudentQuery studentQuery) { String courseInfoIds = ""; List courseInfoList = new ArrayList<>(); CourseInfo courseInfo = courseInfoService.getTreeById(studentQuery.getCourseInfoId()); List childrenList = courseInfo.takeChildren(); - for(int i=0;null != childrenList && i childrenChildrenList = childrenList.get(i).takeChildren(); - for(int j=0;j childrenChildrenChildrenList = childrenChildrenList.get(j).takeChildren(); - for(int k=0;k childrenChildrenChildrenChildrenList = childrenChildrenChildrenList.get(k).takeChildren(); - for(int l=0;l{ Map> groupByCourseInfoId = null; - if(StringUtils.isNotBlank(courseInfoIds)){ + if (StringUtils.isNotBlank(courseInfoIds)) { StudentQuery query = new StudentQuery(); query.setCourseInfoIds(courseInfoIds); query.setStudentId(studentQuery.getStudentId()); query.setOrgId(studentQuery.getOrgId()); List studentLogList = getPracticePerformanceStatisticInfo(query); - try{ - groupByCourseInfoId = studentLogList.stream().collect(Collectors.groupingBy(e -> Long.parseLong(null != e.get("courseInfoId")?e.get("courseInfoId").toString():"-1"))); - }catch (Exception e){} + try { + groupByCourseInfoId = studentLogList.stream().collect(Collectors.groupingBy(e -> Long.parseLong(null != e.get("courseInfoId") ? e.get("courseInfoId").toString() : "-1"))); + } catch (Exception e) { + } } - if(null != groupByCourseInfoId){ - for(int i=0;i studentLogList = groupByCourseInfoId.get(childrenList.get(i).getCourseInfoId()); - if(null != studentLogList && studentLogList.size()>0){ + if (null != studentLogList && studentLogList.size() > 0) { Student studentLog = studentLogList.get(0); - childrenList.get(i).set("resourcesQuestionNum",studentLog.get("resourcesQuestionNum")); - childrenList.get(i).set("resourcesCompetitionNum",studentLog.get("resourcesCompetitionNum")); - childrenList.get(i).set("resourcesTrainingNum",studentLog.get("resourcesTrainingNum")); - childrenList.get(i).set("resourcesQuestionProportion",studentLog.get("resourcesQuestionProportion")); - childrenList.get(i).set("resourcesCompetitionProportion",studentLog.get("resourcesCompetitionProportion")); - childrenList.get(i).set("resourcesTrainingProportion",studentLog.get("resourcesTrainingProportion")); - }else { - childrenList.get(i).set("resourcesQuestionNum",null); - childrenList.get(i).set("resourcesCompetitionNum",null); - childrenList.get(i).set("resourcesTrainingNum",null); - childrenList.get(i).set("resourcesQuestionProportion",null); - childrenList.get(i).set("resourcesCompetitionProportion",null); - childrenList.get(i).set("resourcesTrainingProportion",null); + childrenList.get(i).set("resourcesQuestionNum", studentLog.get("resourcesQuestionNum")); + childrenList.get(i).set("resourcesCompetitionNum", studentLog.get("resourcesCompetitionNum")); + childrenList.get(i).set("resourcesTrainingNum", studentLog.get("resourcesTrainingNum")); + childrenList.get(i).set("resourcesQuestionProportion", studentLog.get("resourcesQuestionProportion")); + childrenList.get(i).set("resourcesCompetitionProportion", studentLog.get("resourcesCompetitionProportion")); + childrenList.get(i).set("resourcesTrainingProportion", studentLog.get("resourcesTrainingProportion")); + } else { + childrenList.get(i).set("resourcesQuestionNum", null); + childrenList.get(i).set("resourcesCompetitionNum", null); + childrenList.get(i).set("resourcesTrainingNum", null); + childrenList.get(i).set("resourcesQuestionProportion", null); + childrenList.get(i).set("resourcesCompetitionProportion", null); + childrenList.get(i).set("resourcesTrainingProportion", null); } } } @@ -332,30 +365,30 @@ public class StudentService extends CoreBaseService{ } - public List getPracticeProgressList(StudentQuery studentQuery){ + public List getPracticeProgressList(StudentQuery studentQuery) { String courseInfoIds = ""; List courseInfoList = new ArrayList<>(); CourseInfo courseInfo = courseInfoService.getTreeById(studentQuery.getCourseInfoId()); List childrenList = courseInfo.takeChildren(); - for(int i=0;null != childrenList && i childrenChildrenList = childrenList.get(i).takeChildren(); - for(int j=0;j childrenChildrenChildrenList = childrenChildrenList.get(j).takeChildren(); - for(int k=0;k childrenChildrenChildrenChildrenList = childrenChildrenChildrenList.get(k).takeChildren(); - for(int l=0;l{ Map> groupByCourseInfoId = null; - if(StringUtils.isNotBlank(courseInfoIds)){ + if (StringUtils.isNotBlank(courseInfoIds)) { StudentQuery query = new StudentQuery(); query.setCourseInfoIds(courseInfoIds); query.setStudentId(studentQuery.getStudentId()); query.setClassId(studentQuery.getClassId()); query.setOrgId(studentQuery.getOrgId()); List studentLogList = getPracticeProgress(query); - try{ - groupByCourseInfoId = studentLogList.stream().collect(Collectors.groupingBy(e -> Long.parseLong(null != e.get("courseInfoId")?e.get("courseInfoId").toString():"-1"))); - }catch (Exception e){} + try { + groupByCourseInfoId = studentLogList.stream().collect(Collectors.groupingBy(e -> Long.parseLong(null != e.get("courseInfoId") ? e.get("courseInfoId").toString() : "-1"))); + } catch (Exception e) { + } } - if(null != groupByCourseInfoId){ - for(int i=0;i studentLogList = groupByCourseInfoId.get(childrenList.get(i).getCourseInfoId()); - if(null != studentLogList && studentLogList.size()>0){ + if (null != studentLogList && studentLogList.size() > 0) { Student studentLog = studentLogList.get(0); - childrenList.get(i).set("resourcesQuestionNum",studentLog.get("resourcesQuestionNum")); - childrenList.get(i).set("resourcesCompetitionNum",studentLog.get("resourcesCompetitionNum")); - childrenList.get(i).set("resourcesTrainingNum",studentLog.get("resourcesTrainingNum")); - childrenList.get(i).set("resourcesQuestionProportion",studentLog.get("resourcesQuestionProportion")); - childrenList.get(i).set("resourcesCompetitionProportion",studentLog.get("resourcesCompetitionProportion")); - childrenList.get(i).set("resourcesTrainingProportion",studentLog.get("resourcesTrainingProportion")); - }else { - childrenList.get(i).set("resourcesQuestionNum",null); - childrenList.get(i).set("resourcesCompetitionNum",null); - childrenList.get(i).set("resourcesTrainingNum",null); - childrenList.get(i).set("resourcesQuestionProportion",null); - childrenList.get(i).set("resourcesCompetitionProportion",null); - childrenList.get(i).set("resourcesTrainingProportion",null); + childrenList.get(i).set("resourcesQuestionNum", studentLog.get("resourcesQuestionNum")); + childrenList.get(i).set("resourcesCompetitionNum", studentLog.get("resourcesCompetitionNum")); + childrenList.get(i).set("resourcesTrainingNum", studentLog.get("resourcesTrainingNum")); + childrenList.get(i).set("resourcesQuestionProportion", studentLog.get("resourcesQuestionProportion")); + childrenList.get(i).set("resourcesCompetitionProportion", studentLog.get("resourcesCompetitionProportion")); + childrenList.get(i).set("resourcesTrainingProportion", studentLog.get("resourcesTrainingProportion")); + } else { + childrenList.get(i).set("resourcesQuestionNum", null); + childrenList.get(i).set("resourcesCompetitionNum", null); + childrenList.get(i).set("resourcesTrainingNum", null); + childrenList.get(i).set("resourcesQuestionProportion", null); + childrenList.get(i).set("resourcesCompetitionProportion", null); + childrenList.get(i).set("resourcesTrainingProportion", null); } } } @@ -402,36 +436,35 @@ public class StudentService extends CoreBaseService{ } - - public PageQueryqueryByCondition2Student(PageQuery query){ - PageQuery ret = studentDao.queryByCondition2Student(query); + public PageQuery queryByCondition2Student(PageQuery query) { + PageQuery ret = studentDao.queryByCondition2Student(query); queryListAfter(ret.getList()); return ret; } - public List getStudentLog (StudentQuery studentQuery){ + public List getStudentLog(StudentQuery studentQuery) { return studentDao.getStudentLog(studentQuery); } - public List getPracticePerformanceStatisticInfo (StudentQuery studentQuery){ + public List getPracticePerformanceStatisticInfo(StudentQuery studentQuery) { return studentDao.getPracticePerformanceStatisticInfo(studentQuery); } - public List getPracticeProgress (StudentQuery studentQuery){ + public List getPracticeProgress(StudentQuery studentQuery) { return studentDao.getPracticeProgress(studentQuery); } - public PageQuery getErrorStatistics (PageQuery query){ - PageQuery ret = studentDao.getErrorStatistics(query); + public PageQuery getErrorStatistics(PageQuery query) { + PageQuery ret = studentDao.getErrorStatistics(query); queryListAfter(ret.getList()); return ret; } - public void deleteStudent(String ids){ + public void deleteStudent(String ids) { String userIds = ""; List studentList = studentDao.getByIds(ids); - for(int i=0;i{ studentDao.deleteStudentByIds(ids); } - public void deleteByList(List list){ + public void deleteByList(List list) { String ids = ""; - for(int i=0;null != list &&i{ s.setOrgId(orgId); //新建学生用户资金总表 - studentAccountAssetAllocationService.createFundAccountWithUserCreated(student.getStudentId(),orgId); + studentAccountAssetAllocationService.createFundAccountWithUserCreated(student.getStudentId(), orgId); this.updateTemplate(s); @@ -493,14 +526,14 @@ public class StudentService extends CoreBaseService{ return jsonResult; } - public Boolean edit(Student student){ + public Boolean edit(Student student) { SchoolClass schoolClass = schoolClassService.queryById(student.getClassId()); student.setOrgId(schoolClass.getOrgId()); this.updateTemplate(student); student = this.queryById(student.getStudentId()); String code = student.createCode();//TODO 可改规则 - if (!platformService.isAllowUserCode(student.getUserId(),code)) { + if (!platformService.isAllowUserCode(student.getUserId(), code)) { throw new PlatformException("不允许的注册账号 " + code); } CoreUser coreUser = new CoreUser(); @@ -516,7 +549,7 @@ public class StudentService extends CoreBaseService{ } - public Boolean initPassword(Student student){ + public Boolean initPassword(Student student) { Student s = this.queryById(student.getStudentId()); CoreUser coreUser = new CoreUser(); @@ -528,18 +561,18 @@ public class StudentService extends CoreBaseService{ return true; } - public JsonResult importTemplate(FileEntity fileEntity,ListdelList,List list){ - if(null != fileEntity){ + public JsonResult importTemplate(FileEntity fileEntity, List delList, List list) { + if (null != fileEntity) { File file = new File(fileEntity.getAbsoluteUrl()); - if(file.exists() && file.isFile() && file.canRead() && ToolUtils.findInSet("xls,xlsx",fileEntity.getFormat())){ + if (file.exists() && file.isFile() && file.canRead() && ToolUtils.findInSet("xls,xlsx", fileEntity.getFormat())) { Workbook wb = null; InputStream is = null; try { is = new FileInputStream(fileEntity.getAbsoluteUrl()); - if("xls".equals(fileEntity.getFormat())){ + if ("xls".equals(fileEntity.getFormat())) { wb = new HSSFWorkbook(is); - }else if("xlsx".equals(fileEntity.getFormat())){ + } else if ("xlsx".equals(fileEntity.getFormat())) { wb = new XSSFWorkbook(is); } } catch (FileNotFoundException e) { @@ -548,16 +581,16 @@ public class StudentService extends CoreBaseService{ e.printStackTrace(); } try { - if(null != is){ + if (null != is) { is.close(); } - }catch (Exception e){ + } catch (Exception e) { e.printStackTrace(); } - if(wb != null){ + if (wb != null) { List errMsg = new ArrayList<>(); - String msg =""; + String msg = ""; //获取Sheet1 Sheet sheet = wb.getSheet("Sheet1"); @@ -568,28 +601,28 @@ public class StudentService extends CoreBaseService{ //获取最大列数 int colNum = firstRow.getPhysicalNumberOfCells(); - String[] columns = {"院校名称","班级名称","学生姓名","学号","电话","邮箱"}; + String[] columns = {"院校名称", "班级名称", "学生姓名", "学号", "电话", "邮箱"}; - Map map = new HashMap<>();//获取需要的表头的列 + Map map = new HashMap<>();//获取需要的表头的列 //从第一列找到需要的表头 - for (int i=0; i{ Date date = new Date(); - for (int i = 1; i"; - errMsg.add(new String[]{"第"+(i+1)+"数据为空"}); + errMsg.add(new String[]{"第" + (i + 1) + "数据为空"}); continue; } @@ -611,23 +644,23 @@ public class StudentService extends CoreBaseService{ String studentMobile = getCellFormatValue(row.getCell(map.get(columns[4]))); String studentEmail = getCellFormatValue(row.getCell(map.get(columns[5]))); - if(StringUtils.isBlank(className)){ + if (StringUtils.isBlank(className)) { // msg += "第"+ToolUtils.numberToLetter(map.get(columns[1])+1)+"列,第"+(i+1)+"行班级名称为空
"; - errMsg.add(new String[]{"第"+ToolUtils.numberToLetter(map.get(columns[1])+1)+"列,第"+(i+1)+"行班级名称为空"}); + errMsg.add(new String[]{"第" + ToolUtils.numberToLetter(map.get(columns[1]) + 1) + "列,第" + (i + 1) + "行班级名称为空"}); continue; - }else if(StringUtils.isBlank(studentName)){ + } else if (StringUtils.isBlank(studentName)) { // msg += "第"+ToolUtils.numberToLetter(map.get(columns[2])+1)+"列,第"+(i+1)+"行学生姓名为空
"; - errMsg.add(new String[]{"第"+ToolUtils.numberToLetter(map.get(columns[2])+1)+"列,第"+(i+1)+"行学生姓名为空"}); + errMsg.add(new String[]{"第" + ToolUtils.numberToLetter(map.get(columns[2]) + 1) + "列,第" + (i + 1) + "行学生姓名为空"}); continue; - }else if(StringUtils.isBlank(studentSn)){ + } else if (StringUtils.isBlank(studentSn)) { // msg += "第"+ToolUtils.numberToLetter(map.get(columns[3])+1)+"列,第"+(i+1)+"行学号为空
"; - errMsg.add(new String[]{"第"+ToolUtils.numberToLetter(map.get(columns[3])+1)+"列,第"+(i+1)+"行学号为空"}); + errMsg.add(new String[]{"第" + ToolUtils.numberToLetter(map.get(columns[3]) + 1) + "列,第" + (i + 1) + "行学号为空"}); continue; // }else if(className.split("_").length != 2){ //// msg += "第"+ToolUtils.numberToLetter(map.get(columns[1])+1)+"列,第"+(i+1)+"行班级ID丢失
"; // errMsg.add(new String[]{"第"+ToolUtils.numberToLetter(map.get(columns[1])+1)+"列,第"+(i+1)+"行班级ID丢失"}); // continue; - }else { + } else { String schoolClassId = ""; // 通过名字查询院校信息,如果查询不到就告诉前台需要先去添加院校 @@ -640,7 +673,7 @@ public class StudentService extends CoreBaseService{ Assert.notEmpty(schoolClass, "未查询到班级:{},请先添加班级信息!", className); // 通过名字没查询到院校的时候 - if(ObjectUtil.isEmpty(schoolClass)) { + if (ObjectUtil.isEmpty(schoolClass)) { // 正则取院校ID schoolClassId = classSplit[1]; Assert.notBlank(schoolClassId, "请先添加班级信息:{}!", className); @@ -668,15 +701,15 @@ public class StudentService extends CoreBaseService{ if (!platformService.isAllowUserCode(code)) { delList.add(pojo.getStudentId()); // msg += "第"+(i+1)+"行不允许的注册账号 "+code+"
"; - errMsg.add(new String[]{"第"+(i+1)+"行不允许的注册账号 "+code}); - }else { + errMsg.add(new String[]{"第" + (i + 1) + "行不允许的注册账号 " + code}); + } else { { Student s = new Student(); s.setClassId(Long.parseLong(schoolClassId)); s.setStudentName(studentName); - if(studentDao.template(s).size()>1){ - errMsg.add(new String[]{"第"+(i+1)+"行存在同名同姓的学生,姓名 "+studentName+" 是否删除",pojo.getStudentId().toString()}); + if (studentDao.template(s).size() > 1) { + errMsg.add(new String[]{"第" + (i + 1) + "行存在同名同姓的学生,姓名 " + studentName + " 是否删除", pojo.getStudentId().toString()}); } } @@ -707,41 +740,41 @@ public class StudentService extends CoreBaseService{ this.updateTemplate(s); - if(list.size()==0){ - list.add(s.getStudentId()+","); - }else { - String str = list.get(0) + s.getStudentId()+","; + if (list.size() == 0) { + list.add(s.getStudentId() + ","); + } else { + String str = list.get(0) + s.getStudentId() + ","; list.add(str); list.remove(0); } - count ++; + count++; } } } - if(count>0){ + if (count > 0) { JsonResult jsonResult = new JsonResult(); jsonResult.setCode(JsonReturnCode.SUCCESS.getCode()); jsonResult.setData(errMsg); - jsonResult.setMsg("导入成功,共导入"+count+"条"+(StringUtils.isNotBlank(msg)?"
"+msg:"")); + jsonResult.setMsg("导入成功,共导入" + count + "条" + (StringUtils.isNotBlank(msg) ? "
" + msg : "")); return jsonResult; - }else { + } else { return JsonResult.failMessage("导入失败").setData(errMsg); } } return JsonResult.failMessage("导入失败"); - }else { + } else { return JsonResult.failMessage("上传失败"); } - }else { + } else { return JsonResult.failMessage("上传失败"); } } public String getCellFormatValue(Cell cell) { String value = null; - if (cell != null){ + if (cell != null) { switch (cell.getCellTypeEnum()) { case STRING: value = cell.getRichStringCellValue().getString(); @@ -769,31 +802,31 @@ public class StudentService extends CoreBaseService{ return value; } - public List> getExcelValues2Competition (StudentQuery studentQuery){ + public List> getExcelValues2Competition(StudentQuery studentQuery) { return studentDao.getExcelValues2Competition(studentQuery); } - public List> getExcelValues (StudentQuery studentQuery){ + public List> getExcelValues(StudentQuery studentQuery) { return studentDao.getExcelValues(studentQuery); } - public Student getByUserId(Long userId){ + public Student getByUserId(Long userId) { return studentDao.getByUserId(userId); } - public Student getByAccount(String account){ + public Student getByAccount(String account) { return studentDao.getByAccount(account); } - public List getByIds (String studentIds){ + public List getByIds(String studentIds) { return studentDao.getByIds(studentIds); } - public List getValues (Object paras){ + public List getValues(Object paras) { return sqlManager.select(SqlId.of("jlw.student.getStudentValues"), Student.class, paras); } - public List getValuesByQuery (StudentQuery studentQuery){ + public List getValuesByQuery(StudentQuery studentQuery) { List valuesByQuery = studentDao.getValuesByQuery(studentQuery); queryListAfter(valuesByQuery); return valuesByQuery; @@ -803,7 +836,7 @@ public class StudentService extends CoreBaseService{ * 获取学生的关系信息 * 班级-专业-院系-院校 * - * @param studentIds 学生ID集合 + * @param studentIds 学生ID集合 * @return */ public StudentExtendSchoolInfo getStudentExtendSchoolInfo(@NotBlank(message = "学生ID集合不能为空!") String studentIds) { @@ -815,7 +848,7 @@ public class StudentService extends CoreBaseService{ * 获取学生的关系信息 * 班级-专业-院系-院校 * - * @param studentIds 学生ID集合 + * @param studentIds 学生ID集合 * @return */ public List getStudentExtendSchoolInfoList(@NotBlank(message = "学生ID集合不能为空!") String studentIds) { @@ -826,7 +859,7 @@ public class StudentService extends CoreBaseService{ * 通过用户ID获取学生的关系信息 * 班级-专业-院系-院校 * - * @param userIds 用户ID集合 + * @param userIds 用户ID集合 * @return */ public List getStudentExtendSchoolInfoListByUserIds(@NotBlank(message = "用户ID集合不能为空!") String userIds) { @@ -837,7 +870,7 @@ public class StudentService extends CoreBaseService{ * 通过用户ID获取学生的关系信息 * 班级-专业-院系-院校 * - * @param userIds 用户ID集合 + * @param userIds 用户ID集合 * @return */ public StudentExtendSchoolInfo getStudentExtendSchoolInfoByUserIds(@NotBlank(message = "用户ID集合不能为空!") String userIds) { @@ -846,11 +879,11 @@ public class StudentService extends CoreBaseService{ } //大赛任务一答卷 - public JsonResult updateCT1QuestionAnswer(CompetitionTaskOneQuestionQuery condition,Student student){ - if(null == condition.getCompetitionId()){ + public JsonResult updateCT1QuestionAnswer(CompetitionTaskOneQuestionQuery condition, Student student) { + if (null == condition.getCompetitionId()) { return JsonResult.failMessage("参数丢失"); } - if(null == student){ + if (null == student) { return JsonResult.failMessage("请登录后再操作"); } Competition competition = competitionService.getById(condition.getCompetitionId()); @@ -861,11 +894,11 @@ public class StudentService extends CoreBaseService{ cs = competitionStudentsService.getValues(cs).get(0); //对于交卷 加1分钟做缓冲 - if(((Integer)1).equals(condition.getBeSubmitted()) && null != competition && competition.getCompetitionTaskOneEndTime().getTime() < System.currentTimeMillis() - 60000 ){ + if (((Integer) 1).equals(condition.getBeSubmitted()) && null != competition && competition.getCompetitionTaskOneEndTime().getTime() < System.currentTimeMillis() - 60000) { return JsonResult.failMessage("提交失败,大赛任务一已结束"); - }else if(!((Integer)1).equals(condition.getBeSubmitted()) && null != cs && cs.getCompetitionTaskOneFinishTime() != null && cs.getCompetitionTaskOneFinishTime().getTime() < System.currentTimeMillis()){ + } else if (!((Integer) 1).equals(condition.getBeSubmitted()) && null != cs && cs.getCompetitionTaskOneFinishTime() != null && cs.getCompetitionTaskOneFinishTime().getTime() < System.currentTimeMillis()) { return JsonResult.failMessage("提交失败,已交卷"); - }else if(!((Integer)1).equals(condition.getBeSubmitted()) && null != competition && competition.getCompetitionTaskOneEndTime().getTime() < System.currentTimeMillis()){ + } else if (!((Integer) 1).equals(condition.getBeSubmitted()) && null != competition && competition.getCompetitionTaskOneEndTime().getTime() < System.currentTimeMillis()) { return JsonResult.failMessage("提交失败,大赛任务一已结束"); } @@ -874,42 +907,44 @@ public class StudentService extends CoreBaseService{ ct1QQuery.setStudentsId(student.getStudentId()); List oldCT1QuestionList = competitionTaskOneQuestionService.getValuesByQuery(ct1QQuery); Map> groupByCT1QId = null; - try{ + try { groupByCT1QId = oldCT1QuestionList.stream().collect(Collectors.groupingBy(e -> e.getCompetitionTaskOneQuestionId())); - }catch (Exception e){} - if(null == groupByCT1QId){ + } catch (Exception e) { + } + if (null == groupByCT1QId) { return JsonResult.failMessage("数据有误,请联系管理员"); } - if(StringUtils.isNotBlank(condition.getCT1QuestionMapJson())){ - Map cT1QuestionMap = new HashMap<>(); + if (StringUtils.isNotBlank(condition.getCT1QuestionMapJson())) { + Map cT1QuestionMap = new HashMap<>(); try { cT1QuestionMap = (JSONObject.parseObject(condition.getCT1QuestionMapJson(), HashMap.class)); - } catch (Exception e) {} - ListcompetitionTaskOneQuestionList = new ArrayList<>(); + } catch (Exception e) { + } + List competitionTaskOneQuestionList = new ArrayList<>(); - for(Map.Entry entry:cT1QuestionMap.entrySet()){ - CompetitionTaskOneQuestionQuery ct1qq = JSONObject.toJavaObject(entry.getValue(),CompetitionTaskOneQuestionQuery.class); - if(null != ct1qq && StringUtils.isNotBlank(ct1qq.getStudentAnswer()) && StringUtils.isNotBlank(ct1qq.getAddTime())){ - if(TimeTool.getTime(ct1qq.getAddTime()).getTime() <= competition.getCompetitionTaskOneEndTime().getTime()){ + for (Map.Entry entry : cT1QuestionMap.entrySet()) { + CompetitionTaskOneQuestionQuery ct1qq = JSONObject.toJavaObject(entry.getValue(), CompetitionTaskOneQuestionQuery.class); + if (null != ct1qq && StringUtils.isNotBlank(ct1qq.getStudentAnswer()) && StringUtils.isNotBlank(ct1qq.getAddTime())) { + if (TimeTool.getTime(ct1qq.getAddTime()).getTime() <= competition.getCompetitionTaskOneEndTime().getTime()) { CompetitionTaskOneQuestion competitionTaskOneQuestion = new CompetitionTaskOneQuestion(); - if(null == groupByCT1QId.get(Long.parseLong(entry.getKey()))){//判断答案和提交学员是否统一 + if (null == groupByCT1QId.get(Long.parseLong(entry.getKey()))) {//判断答案和提交学员是否统一 continue; } competitionTaskOneQuestion.setCompetitionTaskOneQuestionId(ct1qq.getCompetitionTaskOneQuestionId()); - competitionTaskOneQuestion.setStudentAnswer(resourcesQuestionService.answerFormat(groupByCT1QId.get(Long.parseLong(entry.getKey())).get(0).getQuestionType(),ct1qq.getStudentAnswer())); + competitionTaskOneQuestion.setStudentAnswer(resourcesQuestionService.answerFormat(groupByCT1QId.get(Long.parseLong(entry.getKey())).get(0).getQuestionType(), ct1qq.getStudentAnswer())); competitionTaskOneQuestionList.add(competitionTaskOneQuestion); } } } - if(competitionTaskOneQuestionList.size()>0){ + if (competitionTaskOneQuestionList.size() > 0) { competitionTaskOneQuestionService.updateBatchTemplate(competitionTaskOneQuestionList); } - }else { - if(null != condition.getCompetitionTaskOneQuestionId() && StringUtils.isNotBlank(condition.getStudentAnswer()) && StringUtils.isNotBlank(condition.getAddTime())){ - if(TimeTool.getTime(condition.getAddTime()).getTime() <= competition.getCompetitionTaskOneEndTime().getTime()){ + } else { + if (null != condition.getCompetitionTaskOneQuestionId() && StringUtils.isNotBlank(condition.getStudentAnswer()) && StringUtils.isNotBlank(condition.getAddTime())) { + if (TimeTool.getTime(condition.getAddTime()).getTime() <= competition.getCompetitionTaskOneEndTime().getTime()) { CompetitionTaskOneQuestion competitionTaskOneQuestion = new CompetitionTaskOneQuestion(); - if(null != groupByCT1QId.get(condition.getCompetitionTaskOneQuestionId())){//判断答案和提交学员是否统一 + if (null != groupByCT1QId.get(condition.getCompetitionTaskOneQuestionId())) {//判断答案和提交学员是否统一 competitionTaskOneQuestion.setCompetitionTaskOneQuestionId(condition.getCompetitionTaskOneQuestionId()); competitionTaskOneQuestion.setStudentAnswer(condition.getStudentAnswer()); competitionTaskOneQuestionService.updateTemplate(competitionTaskOneQuestion); @@ -929,18 +964,18 @@ public class StudentService extends CoreBaseService{ competitionStudents.setCompetitionId(condition.getCompetitionId()); competitionStudents.setStudentsId(student.getStudentId()); competitionStudents.setCompetitionTaskOneFraction(totalScore); - competitionStudents.setCompetitionTaskOneFinishTime(((Integer)1).equals(condition.getBeSubmitted())?new Date():null);//判断是否是交卷 + competitionStudents.setCompetitionTaskOneFinishTime(((Integer) 1).equals(condition.getBeSubmitted()) ? new Date() : null);//判断是否是交卷 competitionStudentsService.updateTotalScore(competitionStudents); return JsonResult.success(); } //大赛任务二答卷 - public JsonResult updateCT2QuestionAnswer(CompetitionTaskSecondQuestionStepQuery condition, Student student){ - if(null == condition.getCompetitionTaskSecondQuestionStepId()){ + public JsonResult updateCT2QuestionAnswer(CompetitionTaskSecondQuestionStepQuery condition, Student student) { + if (null == condition.getCompetitionTaskSecondQuestionStepId()) { return JsonResult.failMessage("参数丢失"); } - if(null == student){ + if (null == student) { return JsonResult.failMessage("请登录后再操作"); } @@ -952,23 +987,23 @@ public class StudentService extends CoreBaseService{ condition.setAddTime(TimeTool.getNowTime()); //对于交卷 加1分钟做缓冲 - if(((Integer)1).equals(condition.getBeSubmitted()) && null != competition && competition.getCompetitionTaskSecondEndTime().getTime() < System.currentTimeMillis() - 60000 ){ + if (((Integer) 1).equals(condition.getBeSubmitted()) && null != competition && competition.getCompetitionTaskSecondEndTime().getTime() < System.currentTimeMillis() - 60000) { return JsonResult.failMessage("提交失败,大赛任务二已结束"); - }else if(!((Integer)1).equals(condition.getBeSubmitted()) && null != competitionStudents && competitionStudents.getCompetitionTaskSecondFinishTime() !=null && competitionStudents.getCompetitionTaskSecondFinishTime().getTime() < System.currentTimeMillis()){ + } else if (!((Integer) 1).equals(condition.getBeSubmitted()) && null != competitionStudents && competitionStudents.getCompetitionTaskSecondFinishTime() != null && competitionStudents.getCompetitionTaskSecondFinishTime().getTime() < System.currentTimeMillis()) { return JsonResult.failMessage("提交失败,已交卷"); - }else if(!((Integer)1).equals(condition.getBeSubmitted()) && null != competition && competition.getCompetitionTaskSecondEndTime().getTime() < System.currentTimeMillis()){ + } else if (!((Integer) 1).equals(condition.getBeSubmitted()) && null != competition && competition.getCompetitionTaskSecondEndTime().getTime() < System.currentTimeMillis()) { return JsonResult.failMessage("提交失败,大赛任务二已结束"); } List> results = new ArrayList<>(); - results.add(pool.submit(new TaskCallableForCT2Q(condition, student,competition,competitionTaskSecondQuestion,competitionTaskSecondQuestionStep))); + results.add(pool.submit(new TaskCallableForCT2Q(condition, student, competition, competitionTaskSecondQuestion, competitionTaskSecondQuestionStep))); return JsonResult.success(); } - public PageQueryqueryByConditionQuery(PageQuery query){ + public PageQuery queryByConditionQuery(PageQuery query) { - PageQuery ret = studentDao.queryByConditionQuery(query); + PageQuery ret = studentDao.queryByConditionQuery(query); queryListAfter(ret.getList()); return ret; } @@ -998,7 +1033,7 @@ public class StudentService extends CoreBaseService{ List select = lambdaQuery.andEq(Student::getStudentStatus, 1).select(); Set collect = select.stream().map(Student::getClassId).collect(Collectors.toSet()); List select1 = new ArrayList(); - if(collect.size() > 0){ + if (collect.size() > 0) { select1 = schoolClassDao.createLambdaQuery().andIn(SchoolClass::getClassId, collect).select(); } Set collect1 = select1.stream().map(SchoolClass::getClassId).collect(Collectors.toSet()); @@ -1027,7 +1062,7 @@ public class StudentService extends CoreBaseService{ // 查询库里已经存在的编号 List existsList = studentDao.createLambdaQuery() .andIsNotNull(Student::getStudentSn) - .andIn(Student::getStudentSn, studentSnList).select(String.class,"student_sn"); + .andIn(Student::getStudentSn, studentSnList).select(String.class, "student_sn"); for (String duplicateElement : existsList) { int errorRowIndex = studentSnList.indexOf(duplicateElement); @@ -1046,7 +1081,7 @@ public class StudentService extends CoreBaseService{ CompetitionTaskSecondQuestion competitionTaskSecondQuestion; CompetitionTaskSecondQuestionStep competitionTaskSecondQuestionStep; - public TaskCallableForCT2Q(CompetitionTaskSecondQuestionStepQuery condition, Student student,Competition competition,CompetitionTaskSecondQuestion competitionTaskSecondQuestion,CompetitionTaskSecondQuestionStep competitionTaskSecondQuestionStep) { + public TaskCallableForCT2Q(CompetitionTaskSecondQuestionStepQuery condition, Student student, Competition competition, CompetitionTaskSecondQuestion competitionTaskSecondQuestion, CompetitionTaskSecondQuestionStep competitionTaskSecondQuestionStep) { this.condition = condition; this.student = student; this.competition = competition; @@ -1062,8 +1097,8 @@ public class StudentService extends CoreBaseService{ competitionStudents.setCompetitionStudentsId(competitionTaskSecondQuestion.getCompetitionStudentsId()); List competitionStudentsList = competitionStudentsService.getValues(competitionStudents); - if(null != competitionStudentsList && competitionStudentsList.size()>0) {//判断答案和提交学员是否统一 - if(TimeTool.getTime(condition.getAddTime()).getTime() <= competition.getCompetitionTaskSecondEndTime().getTime()){ + if (null != competitionStudentsList && competitionStudentsList.size() > 0) {//判断答案和提交学员是否统一 + if (TimeTool.getTime(condition.getAddTime()).getTime() <= competition.getCompetitionTaskSecondEndTime().getTime()) { BigDecimal score = BigDecimal.ZERO; String competitionTaskSecondQuestionStepAnswer = competitionTaskSecondQuestionStep.getCompetitionTaskSecondQuestionStepAnswer(); @@ -1074,18 +1109,19 @@ public class StudentService extends CoreBaseService{ } catch (Exception e) { try { studentAnswerList.add(JSONObject.parseObject(condition.getStudentAnswer(), String.class)); - } catch (Exception e1) {} + } catch (Exception e1) { + } } //将学生答案替换到题目中 String studentAnswer = competitionTaskSecondQuestionStep.getCompetitionTaskSecondQuestionStepQuestion(); - for(int i=0;null != studentAnswerList && i{ competitionStudents.setCompetitionId(competition.getCompetitionId()); competitionStudents.setStudentsId(student.getStudentId()); competitionStudents.setCompetitionTaskSecondFraction(totalScore); - competitionStudents.setCompetitionTaskSecondFinishTime(((Integer)1).equals(condition.getBeSubmitted())?new Date():null);//判断是否是交卷 + competitionStudents.setCompetitionTaskSecondFinishTime(((Integer) 1).equals(condition.getBeSubmitted()) ? new Date() : null);//判断是否是交卷 competitionStudentsService.updateTotalScore(competitionStudents); return true; @@ -1116,11 +1152,11 @@ public class StudentService extends CoreBaseService{ } //考试任务一答卷 - public JsonResult updateET1QuestionAnswer(ExamTaskOneQuestionQuery condition,Student student){ - if(null == condition.getExamId()){ + public JsonResult updateET1QuestionAnswer(ExamTaskOneQuestionQuery condition, Student student) { + if (null == condition.getExamId()) { return JsonResult.failMessage("参数丢失"); } - if(null == student){ + if (null == student) { return JsonResult.failMessage("请登录后再操作"); } Exam exam = examService.queryById(condition.getExamId()); @@ -1131,11 +1167,11 @@ public class StudentService extends CoreBaseService{ es = examStudentsService.getValues(es).get(0); //对于交卷 加1分钟做缓冲 - if(((Integer)1).equals(condition.getBeSubmitted()) && null != exam && exam.getExamTaskOneEndTime().getTime() < System.currentTimeMillis() - 60000 ){ + if (((Integer) 1).equals(condition.getBeSubmitted()) && null != exam && exam.getExamTaskOneEndTime().getTime() < System.currentTimeMillis() - 60000) { return JsonResult.failMessage("提交失败,考试任务一已结束"); - }else if(!((Integer)1).equals(condition.getBeSubmitted()) && null != es && es.getExamTaskOneFinishTime() != null && es.getExamTaskOneFinishTime().getTime() < System.currentTimeMillis()){ + } else if (!((Integer) 1).equals(condition.getBeSubmitted()) && null != es && es.getExamTaskOneFinishTime() != null && es.getExamTaskOneFinishTime().getTime() < System.currentTimeMillis()) { return JsonResult.failMessage("提交失败,已交卷"); - }else if(!((Integer)1).equals(condition.getBeSubmitted()) && null != exam && exam.getExamTaskOneEndTime().getTime() < System.currentTimeMillis()){ + } else if (!((Integer) 1).equals(condition.getBeSubmitted()) && null != exam && exam.getExamTaskOneEndTime().getTime() < System.currentTimeMillis()) { return JsonResult.failMessage("提交失败,考试任务一已结束"); } @@ -1144,44 +1180,46 @@ public class StudentService extends CoreBaseService{ et1QQuery.setStudentsId(student.getStudentId()); List oldET1QuestionList = examTaskOneQuestionService.getValuesByQuery(et1QQuery); Map> groupByET1QId = null; - try{ + try { groupByET1QId = oldET1QuestionList.stream().collect(Collectors.groupingBy(e -> e.getExamTaskOneQuestionId())); - }catch (Exception e){} - if(null == groupByET1QId){ + } catch (Exception e) { + } + if (null == groupByET1QId) { return JsonResult.failMessage("数据有误,请联系管理员"); } - if(StringUtils.isNotBlank(condition.getET1QuestionMapJson())){ - Map eT1QuestionMap = new HashMap<>(); + if (StringUtils.isNotBlank(condition.getET1QuestionMapJson())) { + Map eT1QuestionMap = new HashMap<>(); try { eT1QuestionMap = (JSONObject.parseObject(condition.getET1QuestionMapJson(), HashMap.class)); - } catch (Exception e) {} - ListexamTaskOneQuestionList = new ArrayList<>(); + } catch (Exception e) { + } + List examTaskOneQuestionList = new ArrayList<>(); - for(Map.Entry entry:eT1QuestionMap.entrySet()){ + for (Map.Entry entry : eT1QuestionMap.entrySet()) { - ExamTaskOneQuestionQuery et1qq = JSONObject.toJavaObject(entry.getValue(),ExamTaskOneQuestionQuery.class); + ExamTaskOneQuestionQuery et1qq = JSONObject.toJavaObject(entry.getValue(), ExamTaskOneQuestionQuery.class); - if(null != entry.getValue() && StringUtils.isNotBlank(et1qq.getStudentAnswer()) && StringUtils.isNotBlank(et1qq.getAddTime())){ - if(TimeTool.getTime(et1qq.getAddTime()).getTime() <= exam.getExamTaskOneEndTime().getTime()){ + if (null != entry.getValue() && StringUtils.isNotBlank(et1qq.getStudentAnswer()) && StringUtils.isNotBlank(et1qq.getAddTime())) { + if (TimeTool.getTime(et1qq.getAddTime()).getTime() <= exam.getExamTaskOneEndTime().getTime()) { ExamTaskOneQuestion examTaskOneQuestion = new ExamTaskOneQuestion(); - if(null == groupByET1QId.get(Long.parseLong(entry.getKey()))){//判断答案和提交学员是否统一 + if (null == groupByET1QId.get(Long.parseLong(entry.getKey()))) {//判断答案和提交学员是否统一 continue; } examTaskOneQuestion.setExamTaskOneQuestionId(et1qq.getExamTaskOneQuestionId()); - examTaskOneQuestion.setStudentAnswer(resourcesQuestionService.answerFormat(groupByET1QId.get(Long.parseLong(entry.getKey())).get(0).getQuestionType(),et1qq.getStudentAnswer())); + examTaskOneQuestion.setStudentAnswer(resourcesQuestionService.answerFormat(groupByET1QId.get(Long.parseLong(entry.getKey())).get(0).getQuestionType(), et1qq.getStudentAnswer())); examTaskOneQuestionList.add(examTaskOneQuestion); } } } - if(examTaskOneQuestionList.size()>0){ + if (examTaskOneQuestionList.size() > 0) { examTaskOneQuestionService.updateBatchTemplate(examTaskOneQuestionList); } - }else { - if(null != condition.getExamTaskOneQuestionId() && StringUtils.isNotBlank(condition.getStudentAnswer()) && StringUtils.isNotBlank(condition.getAddTime())){ - if(TimeTool.getTime(condition.getAddTime()).getTime() <= exam.getExamTaskOneEndTime().getTime()){ + } else { + if (null != condition.getExamTaskOneQuestionId() && StringUtils.isNotBlank(condition.getStudentAnswer()) && StringUtils.isNotBlank(condition.getAddTime())) { + if (TimeTool.getTime(condition.getAddTime()).getTime() <= exam.getExamTaskOneEndTime().getTime()) { ExamTaskOneQuestion examTaskOneQuestion = new ExamTaskOneQuestion(); - if(null != groupByET1QId.get(condition.getExamTaskOneQuestionId())){//判断答案和提交学员是否统一 + if (null != groupByET1QId.get(condition.getExamTaskOneQuestionId())) {//判断答案和提交学员是否统一 examTaskOneQuestion.setExamTaskOneQuestionId(condition.getExamTaskOneQuestionId()); examTaskOneQuestion.setStudentAnswer(condition.getStudentAnswer()); examTaskOneQuestionService.updateTemplate(examTaskOneQuestion); @@ -1201,18 +1239,18 @@ public class StudentService extends CoreBaseService{ examStudents.setExamId(condition.getExamId()); examStudents.setStudentsId(student.getStudentId()); examStudents.setExamTaskOneFraction(totalScore); - examStudents.setExamTaskOneFinishTime(((Integer)1).equals(condition.getBeSubmitted())?new Date():null);//判断是否是交卷; + examStudents.setExamTaskOneFinishTime(((Integer) 1).equals(condition.getBeSubmitted()) ? new Date() : null);//判断是否是交卷; examStudentsService.updateTotalScore(examStudents); return JsonResult.success(); } //考试任务二答卷 - public JsonResult updateET2QuestionAnswer(ExamTaskSecondQuestionStepQuery condition, Student student){ - if(null == condition.getExamTaskSecondQuestionStepId()){ + public JsonResult updateET2QuestionAnswer(ExamTaskSecondQuestionStepQuery condition, Student student) { + if (null == condition.getExamTaskSecondQuestionStepId()) { return JsonResult.failMessage("参数丢失"); } - if(null == student){ + if (null == student) { return JsonResult.failMessage("请登录后再操作"); } @@ -1224,16 +1262,16 @@ public class StudentService extends CoreBaseService{ condition.setAddTime(TimeTool.getNowTime()); //对于交卷 加1分钟做缓冲 - if(((Integer)1).equals(condition.getBeSubmitted()) && null != exam && exam.getExamTaskSecondEndTime().getTime() < System.currentTimeMillis() - 60000 ){ + if (((Integer) 1).equals(condition.getBeSubmitted()) && null != exam && exam.getExamTaskSecondEndTime().getTime() < System.currentTimeMillis() - 60000) { return JsonResult.failMessage("提交失败,考试任务二已结束"); - }else if(!((Integer)1).equals(condition.getBeSubmitted()) && null != examStudents && examStudents.getExamTaskSecondFinishTime()!=null && examStudents.getExamTaskSecondFinishTime().getTime() < System.currentTimeMillis()){ + } else if (!((Integer) 1).equals(condition.getBeSubmitted()) && null != examStudents && examStudents.getExamTaskSecondFinishTime() != null && examStudents.getExamTaskSecondFinishTime().getTime() < System.currentTimeMillis()) { return JsonResult.failMessage("提交失败,已交卷"); - }else if(!((Integer)1).equals(condition.getBeSubmitted()) && null != exam && exam.getExamTaskSecondEndTime().getTime() < System.currentTimeMillis()){ + } else if (!((Integer) 1).equals(condition.getBeSubmitted()) && null != exam && exam.getExamTaskSecondEndTime().getTime() < System.currentTimeMillis()) { return JsonResult.failMessage("提交失败,考试任务二已结束"); } List> results = new ArrayList<>(); - results.add(pool.submit(new TaskCallableForET2Q(condition, student, exam, examTaskSecondQuestion,examTaskSecondQuestionStep))); + results.add(pool.submit(new TaskCallableForET2Q(condition, student, exam, examTaskSecondQuestion, examTaskSecondQuestionStep))); return JsonResult.success(); @@ -1248,7 +1286,7 @@ public class StudentService extends CoreBaseService{ ExamTaskSecondQuestion examTaskSecondQuestion; ExamTaskSecondQuestionStep examTaskSecondQuestionStep; - public TaskCallableForET2Q(ExamTaskSecondQuestionStepQuery condition, Student student,Exam exam,ExamTaskSecondQuestion examTaskSecondQuestion,ExamTaskSecondQuestionStep examTaskSecondQuestionStep) { + public TaskCallableForET2Q(ExamTaskSecondQuestionStepQuery condition, Student student, Exam exam, ExamTaskSecondQuestion examTaskSecondQuestion, ExamTaskSecondQuestionStep examTaskSecondQuestionStep) { this.condition = condition; this.student = student; this.exam = exam; @@ -1264,8 +1302,8 @@ public class StudentService extends CoreBaseService{ examStudents.setExamStudentsId(examTaskSecondQuestion.getExamStudentsId()); List examStudentsList = examStudentsService.getValues(examStudents); - if(null != examStudentsList && examStudentsList.size()>0) {//判断答案和提交学员是否统一 - if(TimeTool.getTime(condition.getAddTime()).getTime() <= exam.getExamTaskSecondEndTime().getTime()){ + if (null != examStudentsList && examStudentsList.size() > 0) {//判断答案和提交学员是否统一 + if (TimeTool.getTime(condition.getAddTime()).getTime() <= exam.getExamTaskSecondEndTime().getTime()) { BigDecimal score = BigDecimal.ZERO; String competitionTaskSecondQuestionStepAnswer = examTaskSecondQuestionStep.getExamTaskSecondQuestionStepAnswer(); @@ -1276,18 +1314,19 @@ public class StudentService extends CoreBaseService{ } catch (Exception e) { try { studentAnswerList.add(JSONObject.parseObject(condition.getStudentAnswer(), String.class)); - } catch (Exception e1) {} + } catch (Exception e1) { + } } //将学生答案替换到题目中 String studentAnswer = examTaskSecondQuestionStep.getExamTaskSecondQuestionStepQuestion(); - for(int i=0;null != studentAnswerList && i{ examStudents.setExamId(exam.getExamId()); examStudents.setStudentsId(student.getStudentId()); examStudents.setExamTaskSecondFraction(totalScore); - examStudents.setExamTaskSecondFinishTime(((Integer)1).equals(condition.getBeSubmitted())?new Date():null);//判断是否是交卷; + examStudents.setExamTaskSecondFinishTime(((Integer) 1).equals(condition.getBeSubmitted()) ? new Date() : null);//判断是否是交卷; examStudentsService.updateTotalScore(examStudents); return true; @@ -1319,11 +1358,11 @@ public class StudentService extends CoreBaseService{ //考试任务三答卷 - public JsonResult updateET3QuestionAnswer(ExamTaskThreeQuestionStepQuery condition, Student student){ - if(null == condition.getExamTaskThreeQuestionStepId()){ + public JsonResult updateET3QuestionAnswer(ExamTaskThreeQuestionStepQuery condition, Student student) { + if (null == condition.getExamTaskThreeQuestionStepId()) { return JsonResult.failMessage("参数丢失"); } - if(null == student){ + if (null == student) { return JsonResult.failMessage("请登录后再操作"); } @@ -1335,16 +1374,16 @@ public class StudentService extends CoreBaseService{ condition.setAddTime(TimeTool.getNowTime()); //对于交卷 加1分钟做缓冲 - if(((Integer)1).equals(condition.getBeSubmitted()) && null != exam && exam.getExamTaskThreeEndTime().getTime() < System.currentTimeMillis() - 60000 ){ + if (((Integer) 1).equals(condition.getBeSubmitted()) && null != exam && exam.getExamTaskThreeEndTime().getTime() < System.currentTimeMillis() - 60000) { return JsonResult.failMessage("提交失败,考试任务三已结束"); - }else if(!((Integer)1).equals(condition.getBeSubmitted()) && null != examStudents && examStudents.getExamTaskThreeFinishTime() !=null && examStudents.getExamTaskThreeFinishTime().getTime() < System.currentTimeMillis()){ + } else if (!((Integer) 1).equals(condition.getBeSubmitted()) && null != examStudents && examStudents.getExamTaskThreeFinishTime() != null && examStudents.getExamTaskThreeFinishTime().getTime() < System.currentTimeMillis()) { return JsonResult.failMessage("提交失败,已交卷"); - }else if(!((Integer)1).equals(condition.getBeSubmitted()) && null != exam && exam.getExamTaskThreeEndTime().getTime() < System.currentTimeMillis()){ + } else if (!((Integer) 1).equals(condition.getBeSubmitted()) && null != exam && exam.getExamTaskThreeEndTime().getTime() < System.currentTimeMillis()) { return JsonResult.failMessage("提交失败,考试任务三已结束"); } List> results = new ArrayList<>(); - results.add(pool.submit(new TaskCallableForET3Q(condition, student, exam, examTaskThreeQuestion,examTaskThreeQuestionStep))); + results.add(pool.submit(new TaskCallableForET3Q(condition, student, exam, examTaskThreeQuestion, examTaskThreeQuestionStep))); return JsonResult.success(); @@ -1358,7 +1397,7 @@ public class StudentService extends CoreBaseService{ ExamTaskThreeQuestion examTaskThreeQuestion; ExamTaskThreeQuestionStep examTaskThreeQuestionStep; - public TaskCallableForET3Q(ExamTaskThreeQuestionStepQuery condition, Student student,Exam exam,ExamTaskThreeQuestion examTaskThreeQuestion,ExamTaskThreeQuestionStep examTaskThreeQuestionStep) { + public TaskCallableForET3Q(ExamTaskThreeQuestionStepQuery condition, Student student, Exam exam, ExamTaskThreeQuestion examTaskThreeQuestion, ExamTaskThreeQuestionStep examTaskThreeQuestionStep) { this.condition = condition; this.student = student; this.exam = exam; @@ -1374,8 +1413,8 @@ public class StudentService extends CoreBaseService{ examStudents.setExamStudentsId(examTaskThreeQuestion.getExamStudentsId()); List examStudentsList = examStudentsService.getValues(examStudents); - if(null != examStudentsList && examStudentsList.size()>0) {//判断答案和提交学员是否统一 - if(TimeTool.getTime(condition.getAddTime()).getTime() <= exam.getExamTaskThreeEndTime().getTime()){ + if (null != examStudentsList && examStudentsList.size() > 0) {//判断答案和提交学员是否统一 + if (TimeTool.getTime(condition.getAddTime()).getTime() <= exam.getExamTaskThreeEndTime().getTime()) { BigDecimal score = BigDecimal.ZERO; String competitionTaskThreeQuestionStepAnswer = examTaskThreeQuestionStep.getExamTaskThreeQuestionStepAnswer(); @@ -1387,18 +1426,19 @@ public class StudentService extends CoreBaseService{ } catch (Exception e) { try { studentAnswerList.add(JSONObject.parseObject(condition.getStudentAnswer(), String.class)); - } catch (Exception e1) {} + } catch (Exception e1) { + } } //将学生答案替换到题目中 String studentAnswer = examTaskThreeQuestionStep.getExamTaskThreeQuestionStepQuestion(); - for(int i=0;null != studentAnswerList && i{ examStudents.setExamId(exam.getExamId()); examStudents.setStudentsId(student.getStudentId()); examStudents.setExamTaskThreeFraction(totalScore); - examStudents.setExamTaskThreeFinishTime(((Integer)1).equals(condition.getBeSubmitted())?new Date():null);//判断是否是交卷; + examStudents.setExamTaskThreeFinishTime(((Integer) 1).equals(condition.getBeSubmitted()) ? new Date() : null);//判断是否是交卷; examStudentsService.updateTotalScore(examStudents); return true; @@ -1430,11 +1470,11 @@ public class StudentService extends CoreBaseService{ //练习实训 答题记录 - public JsonResult setStudentQuestionLog(StudentQuestionLogQuery studentQuestionLogQuery){ - if(null == studentQuestionLogQuery.getResourcesQuestionId() && null == studentQuestionLogQuery.getResourcesCompetitionStepId() && null == studentQuestionLogQuery.getResourcesTrainingStepId()){ + public JsonResult setStudentQuestionLog(StudentQuestionLogQuery studentQuestionLogQuery) { + if (null == studentQuestionLogQuery.getResourcesQuestionId() && null == studentQuestionLogQuery.getResourcesCompetitionStepId() && null == studentQuestionLogQuery.getResourcesTrainingStepId()) { return JsonResult.failMessage("参数丢失"); } - if(null == studentQuestionLogQuery.getStudentId()){ + if (null == studentQuestionLogQuery.getStudentId()) { return JsonResult.failMessage("请登录后再操作"); } studentQuestionLogQuery.setStudentQuestionLogAddTime(new Date()); @@ -1461,10 +1501,10 @@ public class StudentService extends CoreBaseService{ studentQuestionLogQuery.setStudentQuestionLogId(null); StudentQuestionLog studentQuestionLog = studentQuestionLogQuery.pojo(); - ListstudentQuestionLogList = studentQuestionLogService.getValues(studentQuestionLog); - if(null != studentQuestionLogList && studentQuestionLogList.size()>0){ + List studentQuestionLogList = studentQuestionLogService.getValues(studentQuestionLog); + if (null != studentQuestionLogList && studentQuestionLogList.size() > 0) { studentQuestionLog = studentQuestionLogList.get(0); - }else { + } else { studentQuestionLogService.insert(studentQuestionLog); } @@ -1482,16 +1522,16 @@ public class StudentService extends CoreBaseService{ studentQuestionLogInfoService.save(studentQuestionLogInfo); //错题数据 - if(studentQuestionLogQuery.getQuestionFraction().equals(studentQuestionLogQuery.getStudentFraction())){ + if (studentQuestionLogQuery.getQuestionFraction().equals(studentQuestionLogQuery.getStudentFraction())) { //查出错题,看看没有搞头 WrongQuestion wrongQuestion = studentQuestionLogQuery.pojo2WrongQuestion(); - ListwrongQuestionList = wrongQuestionService.getValues(wrongQuestion); - if(null != wrongQuestionList && wrongQuestionList.size()>0){ + List wrongQuestionList = wrongQuestionService.getValues(wrongQuestion); + if (null != wrongQuestionList && wrongQuestionList.size() > 0) { //做对了,删除 wrongQuestionService.deleteWrongQuestion(wrongQuestionList.get(0).getStudentQuestionLogId().toString()); } - }else{ + } else { WrongQuestion wrongQuestion = studentQuestionLogQuery.pojo2WrongQuestion(); wrongQuestionService.save(wrongQuestion); } @@ -1502,21 +1542,21 @@ public class StudentService extends CoreBaseService{ //记录答辩数据 - public JsonResult updateDefenceData(StudentDefenceLogQuery studentDefenceLogQuery,FileEntity fileEntity){ - if(null == fileEntity){ + public JsonResult updateDefenceData(StudentDefenceLogQuery studentDefenceLogQuery, FileEntity fileEntity) { + if (null == fileEntity) { return JsonResult.failMessage("请上传文件"); } - if(null == studentDefenceLogQuery.getResourcesTrainingId()){ + if (null == studentDefenceLogQuery.getResourcesTrainingId()) { return JsonResult.failMessage("参数丢失"); } studentDefenceLogQuery.setStudentDefenceLogId(null); StudentDefenceLog studentDefenceLog = studentDefenceLogQuery.pojo(); - ListstudentDefenceLogList = studentDefenceLogService.getValues(studentDefenceLog); - if(null != studentDefenceLogList && studentDefenceLogList.size()>0){ + List studentDefenceLogList = studentDefenceLogService.getValues(studentDefenceLog); + if (null != studentDefenceLogList && studentDefenceLogList.size() > 0) { studentDefenceLog = studentDefenceLogList.get(0); - }else { + } else { studentDefenceLogService.insert(studentDefenceLog); } @@ -1530,32 +1570,32 @@ public class StudentService extends CoreBaseService{ } - public JsonResult updateDefenceNote(StudentDefenceLogQuery studentDefenceLogQuery){ - if(null == studentDefenceLogQuery.getResourcesTrainingId()){ + public JsonResult updateDefenceNote(StudentDefenceLogQuery studentDefenceLogQuery) { + if (null == studentDefenceLogQuery.getResourcesTrainingId()) { return JsonResult.failMessage("参数丢失"); } studentDefenceLogQuery.setStudentDefenceLogId(null); StudentDefenceLog studentDefenceLog = studentDefenceLogQuery.pojo(); - ListstudentDefenceLogList = studentDefenceLogService.getValues(studentDefenceLog); - if(null != studentDefenceLogList && studentDefenceLogList.size()>0){ + List studentDefenceLogList = studentDefenceLogService.getValues(studentDefenceLog); + if (null != studentDefenceLogList && studentDefenceLogList.size() > 0) { studentDefenceLog = studentDefenceLogList.get(0); - }else { + } else { studentDefenceLogService.insert(studentDefenceLog); } StudentDefenceLogNote studentDefenceLogNote = new StudentDefenceLogNote(); studentDefenceLogNote.setStudentDefenceLogId(studentDefenceLog.getStudentDefenceLogId()); - ListstudentDefenceLogNoteList = studentDefenceLogNoteService.getValues(studentDefenceLogNote); - if(null != studentDefenceLogNoteList && studentDefenceLogNoteList.size()>0){ + List studentDefenceLogNoteList = studentDefenceLogNoteService.getValues(studentDefenceLogNote); + if (null != studentDefenceLogNoteList && studentDefenceLogNoteList.size() > 0) { studentDefenceLogNote.setStudentDefenceLogNoteId(studentDefenceLogNoteList.get(0).getStudentDefenceLogNoteId()); studentDefenceLogNote.setNoteComment(studentDefenceLogQuery.getNoteComment()); studentDefenceLogNote.setNoteCommentOriginal(studentDefenceLogQuery.getNoteCommentOriginal()); studentDefenceLogNote.setNoteAddTime(new Date()); studentDefenceLogNoteService.updateTemplate(studentDefenceLogNote); - }else { + } else { studentDefenceLogNote.setNoteComment(studentDefenceLogQuery.getNoteComment()); studentDefenceLogNote.setNoteCommentOriginal(studentDefenceLogQuery.getNoteCommentOriginal()); studentDefenceLogNote.setNoteAddTime(new Date()); @@ -1567,15 +1607,28 @@ public class StudentService extends CoreBaseService{ } - public List> getStudentInfoByClassId(String classId){ - //逗号分隔classid并转换成数据 + public List> getStudentInfoByClassId(String classId) { + //逗号分隔classid并转换成数据 String[] split = classId.split(","); List classIds = new ArrayList<>(); for (String s : split) { classIds.add(Integer.parseInt(s)); } - return studentDao.getStudentInfoByClassId(classId); + return studentDao.getStudentInfoByClassId(classId); } + public List> getStudentInfoByKeyword(String keyword, Long schoolId) { + return studentDao.getStudentInfoByKeyword(keyword, schoolId); + } + + public PageQuery> pagedListStudentInfoByClassId(String classIds,Integer pageNo, Integer pageSize) { + PageQuery pageQuery = new PageQuery(); + pageQuery.setPageSize(pageSize); + pageQuery.setPageNumber(pageNo); + Map map = new HashMap<>(); + map.put("classIds",classIds); + pageQuery.setParas(map); + return studentDao.pagedListStudentInfoByClassId(pageQuery); + } } \ No newline at end of file diff --git a/web/src/main/java/com/ibeetl/jlw/web/AccountController.java b/web/src/main/java/com/ibeetl/jlw/web/AccountController.java index 5de777b1..a5bb7bf7 100644 --- a/web/src/main/java/com/ibeetl/jlw/web/AccountController.java +++ b/web/src/main/java/com/ibeetl/jlw/web/AccountController.java @@ -11,6 +11,7 @@ import com.ibeetl.jlw.web.query.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import javafx.beans.binding.DoubleExpression; +import org.beetl.sql.core.engine.PageQuery; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; @@ -19,6 +20,7 @@ import org.springframework.web.bind.annotation.RestController; import java.math.BigDecimal; import java.sql.*; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -796,4 +798,28 @@ public class AccountController { public JsonResult>> getClassListByMajorId(String majorId){ return JsonResult.success(schoolClassService.getClassListByMajorId(majorId)); } + + @ApiOperation("根据关键字查询学生信息") + @GetMapping("getStudentByKeyword.json") + public JsonResult>> getStudentByKeyword(String keyword,Integer schoolId){ + return JsonResult.success(studentService.getStudentInfoByKeyword(keyword,Long.valueOf(schoolId))); + } + + @ApiOperation("根据班级id分页展示学生数据") + @GetMapping("pagedListStudentByClassId.json") + public Map pagedListStudentByClassId(String classList,Integer page,Integer size){ + if(page==null||page<1){ + page=1; + } + if(size==null){ + size=10; + } + PageQuery> mapPageQuery = studentService.pagedListStudentInfoByClassId(classList,page,size); + Map map = new HashMap<>(); + map.put("code",0); + map.put("msg","成功"); + map.put("count",mapPageQuery.getTotalRow()); + map.put("content",mapPageQuery); + return map; + } } diff --git a/web/src/main/resources/sql/jlw/student.md b/web/src/main/resources/sql/jlw/student.md index d740e2b6..020fd1af 100644 --- a/web/src/main/resources/sql/jlw/student.md +++ b/web/src/main/resources/sql/jlw/student.md @@ -2162,4 +2162,41 @@ getStudentInfoByClassId JOIN school_class ON student.class_id = school_class.class_id JOIN universities_colleges on school_class.universities_colleges_id = universities_colleges.universities_colleges_id WHERE - student.class_id IN (#classIds#) \ No newline at end of file + student.class_id IN (#classIds#) + + +getStudentInfoByKeyword +=== + SELECT + student.user_id AS userid, + student_id as studentid, + student_name AS NAME, + student.class_id AS classId, + school_class.class_name AS className, + student_sn AS studentNo, + universities_colleges_name as schoolName + FROM + student + JOIN school_class ON student.class_id = school_class.class_id + JOIN universities_colleges on school_class.universities_colleges_id = universities_colleges.universities_colleges_id + WHERE student.student_name like #keyword+'%'# and universities_colleges.universities_colleges_id=#schoolId# + + +pagedListStudentInfoByClassId +=== + SELECT + @pageTag(){ + student.user_id AS userid, + student_id as studentid, + student_name AS NAME, + student.class_id AS classId, + school_class.class_name AS className, + student_sn AS studentNo, + universities_colleges_name as schoolName @} + FROM + student + JOIN school_class ON student.class_id = school_class.class_id + JOIN universities_colleges on school_class.universities_colleges_id = universities_colleges.universities_colleges_id + WHERE 1=1 @if(!isEmpty(classIds)){ + and find_in_set(student.class_id ,#classIds#) + @} \ No newline at end of file