系统设计与数据库系统 大作业(下)

简介: 系统设计与数据库系统 大作业(下)

Now we can read excel file:

public void ReadMajorExcel(MultipartFile file) throws IOException {  
     Integer status = statusMapper.getStatus();  
     majorMapper.resetTable();  
     studentMapper.resetStudent();  
     if (status != null && (status == EnrollStatus.PRE_ENROLL.ordinal() || status >= EnrollStatus.READY.ordinal())){  
         throw new RuntimeException("现在不能导入文件");  
     }  
     EasyExcel.read(file.getInputStream(), ExcelMajor.class, new ReadMajorListener(majorMapper, departmentMapper)).sheet().doRead();  
     if (status == null){  
         statusMapper.addLog("导入专业招生计划文件", EnrollStatus.WITHOUT_STUDENT.ordinal());  
     } else if (status == EnrollStatus.WITHOUT_MAJOR.ordinal()){  
         statusMapper.addLog("导入专业招生计划文件", EnrollStatus.FILE_READY.ordinal());  
     } else if (status == EnrollStatus.WITHOUT_STUDENT.ordinal()){  
         statusMapper.addLog("重新导入专业招生计划文件", EnrollStatus.WITHOUT_STUDENT.ordinal());  
     } else {  
         statusMapper.addLog("重新导入专业招生计划文件", EnrollStatus.FILE_READY.ordinal());  
     }  
 }  

Then the data is loaded into ExcelMajor.class

public class ExcelMajor {  
 @ExcelProperty("专业代号")  
 private String majorId;  
 @ExcelProperty("专业代码")  
 private String majorCode;  
 private int departmentId;  
 @ExcelProperty("学院")  
 private String departmentName;  
 @ExcelProperty("专业名称")  
 private String majorName;  
 @ExcelProperty("备注")  
 private String comment;  
 @ExcelProperty("学制年限")  
 private int period;  
 @ExcelProperty("招生计划数")  
 private int planStudentCount;  
 private int realisticStudentCount;  
 public String getMajorId() {  
     return majorId;  
 }  
 public int getPlanStudentCount() {  
     return planStudentCount;  
 }  
 public int getRealisticStudentCount() {  
     return realisticStudentCount;  
 }  
 public void setRealisticStudentCount(int realisticStudentCount) {  
     this.realisticStudentCount = realisticStudentCount;  
 }  

Then we map the data from two excel file

List<ExcelMajor> majors = majorMapper.getMajorPlanForEnroll();  
     Map<String,ExcelMajor> map = new HashMap<>();  
     for (ExcelMajor major : majors) {  
         map.put(major.getMajorId(),major);  
     } 

Now we can run the enrollment code

int current = 0, size = 200;  
     while(true){  
         List<ExcelStudent> students = studentMapper.getStudentRawForEnroll(current, size);  
         if (students.size() == 0)  
             break;  
         for (ExcelStudent student : students) {  
             if(doEnroll(map.get(student.getWill1()))){  
                 student.setAcceptedType(1);  
                 student.setAcceptedMajorId(student.getWill1());  
             } else if(doEnroll(map.get(student.getWill2()))){  
                 student.setAcceptedType(2);  
                 student.setAcceptedMajorId(student.getWill2());  
             } else if(doEnroll(map.get(student.getWill3()))){  
                 student.setAcceptedType(3);  
                 student.setAcceptedMajorId(student.getWill3());  
             }else if(doEnroll(map.get(student.getWill4()))){  
                 student.setAcceptedType(4);  
                 student.setAcceptedMajorId(student.getWill4());  
             }else if(doEnroll(map.get(student.getWill5()))){  
                 student.setAcceptedType(5);  
                 student.setAcceptedMajorId(student.getWill5());  
             }else if(doEnroll(map.get(student.getWill6()))){  
                 student.setAcceptedType(6);  
                 student.setAcceptedMajorId(student.getWill6());  
             } else {  
                 if(student.getAdjust() != 1)  
                     student.setAcceptedType(-1);  
                 else {  
                     student.setAcceptedType(0);  
                 }  
             }  
         }  
         studentMapper.updateAccepted(students);  
         current = current + size;  
     }  
     majorMapper.updateStudentCount(majors);  
     if (status == EnrollStatus.FILE_READY.ordinal()){  
         statusMapper.addLog("预录取完成", EnrollStatus.PRE_ENROLL.ordinal());  
     } else {  
         statusMapper.addLog("录取完成", EnrollStatus.ENROLLED.ordinal());  
     } 

If a student’s application can’t be fulfilled, doAdjust() will be in action

public void doAdjust(){  
     Integer status = statusMapper.getStatus();  
     if (status == null || status != EnrollStatus.PRE_ENROLL.ordinal() && status != EnrollStatus.ENROLLED.ordinal()){  
         throw new RuntimeException("这个状态不能调剂");  
     }  
     List<ExcelMajor> majors = majorMapper.getMajorPlanForAdjust();  
     int start = 0, size = 100, index = 0;  
     while(true){  
         List<ExcelStudent> students = studentMapper.getStudentRawForAdjust(start, size);  
         if(students.size() == 0)  
             break;  
         for (int i = 0;i<students.size();) {  
             ExcelStudent student = students.get(i);  
             if(index < majors.size()){  
                 ExcelMajor major = majors.get(index);  
                 if (major.getRealisticStudentCount() < major.getPlanStudentCount()){  
                     student.setAcceptedType(7);  
                     student.setAcceptedMajorId(major.getMajorId());  
                     major.setRealisticStudentCount(major.getRealisticStudentCount()+1);  
                     i++;  
                 } else {  
                     index++;  
                 }  
             } else {  
                 student.setAcceptedType(-1);  
                 i++;  
             }  
         }  
         studentMapper.updateAdjust(students);  
         //不能改变start  
     }  
     majorMapper.updateStudentCount(majors);  
     if (status == EnrollStatus.PRE_ENROLL.ordinal()){  
         statusMapper.addLog("预调剂完成", EnrollStatus.PRE_ADJUST.ordinal());  
     } else {  
         statusMapper.addLog("调剂完成", EnrollStatus.ADJUSTED.ordinal());  
     }  
 }  


4.项目效果图:(项目出来的效果,功能,以及其他相关图片,数据等)


Project demonstration:


  • Login Page


05b643b3aac04346802340378136f56d.png


After entering the system

94e5d6aebabf4c4f85e9905c95277ab6.png

If we take a look at the database now, we can find that the database is empty.

454f8534933c47a2975508e317231db8.png

Now we upload the data stored in excel files

d4490595250545a3ad07d57cfa0fecfa.png

Upload success and we can now either reupload the data or just run the pre-enrollment.

4183b0655a9a43b2a40749555e72235e.png

9d845fc265b3443cb143fea5ed47117a.png

6340cb22c07b43199c36d0c237ff3eee.png

Run pre enrollment

e715483bd85445368fc1731071be4750.png

7e462bb6182e40289fbc2c9615d27ba7.png

Run pre adjust, we can reset the enrollment plan is needed or continue the enrollment process.

9d1695f774c74c0bb12ba969d5550f0b.png

82f2ef2e22a94e0c88dfd2d28feb8dc6.png

Start the enrollment (may takes some time)

f43afc2583c64e229007c940132b47ec.png

6ab9855026cc4f348e78faecb12b0e79.png

Start adjust

1176603aab7b4385905ef8a79b921947.png

Now we can take a look at the data analysis page, all the data is sorted and be listed in different graphs

17b0bb20ffe2423c80cd17242a2a8a4b.png

9042e72555da44bda8ea042dc9984a02.png

3560c801d57149c7801914e40ac67a70.png

5a434a67b74949cdb60f19840a0bfb4c.png





相关文章
|
8月前
|
JavaScript Java 测试技术
大学生体质测试|基于Springboot+vue的大学生体质测试管理系统设计与实现(源码+数据库+文档)
大学生体质测试|基于Springboot+vue的大学生体质测试管理系统设计与实现(源码+数据库+文档)
126 0
|
5月前
|
SQL 关系型数据库 数据库
【python】python社交交友平台系统设计与实现(源码+数据库)【独一无二】
【python】python社交交友平台系统设计与实现(源码+数据库)【独一无二】
184 10
|
8月前
|
JavaScript Java 关系型数据库
大学生就业招聘|基于Springboot和vue的大学生就业招聘系统设计与实现(源码+数据库+文档)
大学生就业招聘|基于Springboot和vue的大学生就业招聘系统设计与实现(源码+数据库+文档)
121 1
|
7月前
|
关系型数据库 MySQL 数据库
MySQL数据库作业设计之豆瓣音乐
MySQL数据库作业设计之豆瓣音乐
39 0
|
7月前
|
关系型数据库 MySQL 项目管理
数据库大作业——基于qt开发的图书管理系统(四)项目目录的整理与绘制登录页面
数据库大作业——基于qt开发的图书管理系统(四)项目目录的整理与绘制登录页面
|
7月前
|
SQL 关系型数据库 MySQL
数据库大作业——基于qt开发的图书管理系统(三)Qt连接Mysql数据库
数据库大作业——基于qt开发的图书管理系统(三)Qt连接Mysql数据库
168 0
|
7月前
|
SQL 数据可视化 关系型数据库
数据库大作业——基于qt开发的图书管理系统(二) 相关表结构的设计
数据库大作业——基于qt开发的图书管理系统(二) 相关表结构的设计
|
7月前
|
安全 BI 数据库
数据库大作业——基于qt开发的图书管理系统 (一)环境的配置与项目需求的分析
数据库大作业——基于qt开发的图书管理系统 (一)环境的配置与项目需求的分析
123 0
|
8月前
|
JavaScript 小程序 Java
医药垃圾分类管理系统|基于SSM医药垃圾分类管理系统的系统设计与实现(源码+数据库+文档)
医药垃圾分类管理系统|基于SSM医药垃圾分类管理系统的系统设计与实现(源码+数据库+文档)
75 0
|
8月前
|
小程序 JavaScript Java
马拉松|基于SSM的马拉松报名系统微信小程序的系统设计与实现(源码+数据库+文档)
马拉松|基于SSM的马拉松报名系统微信小程序的系统设计与实现(源码+数据库+文档)
86 0