基于Java(SpringBoot)+MySQL+Vue实现的平行志愿录取系统

devtools/2025/2/7 23:08:14/

基于spring boot+vue实现的平行志愿录取系统

1.项目简介

这两天干上高考出成绩,有不少亲戚家的孩子今年高考,和我询问关于报志愿的问题。老家河北今年是采用所谓的平行志愿。我看了很多的资料才明白什么叫所谓的“平行志愿”。

整个流程好像很是复杂。我突发奇想,心想何不自己编写一个程序来模拟一下这个所谓的录取过程呢。

考生成绩和志愿是机密类的数据,向我们这样的平头百姓向那倒是不太可能的事情,那么就只能自己写个程序生成一份模拟的成绩和志愿数据。

成绩比较好办,因为有个参考,那就是省教育考试院放出的“一分一段成绩统计表”。这个东西提供了我们模拟成绩数据的很多信息:一是考生的人数,每个分数下的人数都写得很清楚;二是成绩的分布情况,即在不同成绩段的考生人数都十分详细的列出。

2.思路分析

高考填报志愿非常重要,关于志愿填报及院校录取规则,我们看完院校投档原理就明白了。

假如甲同学610分乙同学609分。甲报考的志愿,第一个是北邮,第二个是北林;乙同学,第一个报北林,第二个报了北京工业大学。那么问题来了,如果考生甲没有被他的第一志愿北京邮电大学提档,那么对于北京林业大学来说,会优先检索谁的志愿呢?当然是甲同学的,因为平行志愿的录取规则是分数优先,遵循志愿。那什么叫分数优先,甲乙高考分数,谁的分数高,甲同学高。那么,甲同学的就会优先被他所在省份的教育考试院的电脑检索系统检索。那在检索的时候,考生乙的档案是属于停滞状态的。先看甲同学报的所有志愿,然后再看乙同学报的志愿。所以通过这个案例,我们就知道分数优先,遵循志愿。按照每个考生他所报的志愿从第一个到第二个都是按照这种平行的顺序依次进行提档。那么被提档之后,这名考生等同于他的提档机会就没有了。

那再看第二个问题,如果说考生甲被第一志愿提档了,但是报专业的时候因为一些因素被退档了。那么考生甲被退档之后,它还能再向北京林业大学继续投档吗?答案是否定的。因为一轮投档就一次机会,如果北京邮电大学被退了,那么我们就会去一批征集志愿,或者是二批次。如果是整个本科批次合并的,就会一退到底,直接到专科或者复读。很多省份在2019年是最后一届文理分科。那么对于2020年之后,我们都是新高考选科,那么您想复读的话可能不符合复读,或者再报考的要求。所以今年对于2019年高三的家长来说,今年压力比往年都要大,我们必须要保证我们孩子报考的志愿一次性成功,不能复读。

3.项目开发

3.1技术栈

  • JDK8
  • MySQL5.7
  • springboot2.3
  • maven3.6.3(需要安装,否则没有依赖)
  • vue2.0(前端开发环境,并不必需)
  • vue-cli3(前端开发环境,并不必需)

3.2环境配置

  • 打开Mysql,创建数据库
CREATE DATABASE `<你的数据库名>` CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_general_ci';
-- 例如:CREATE DATABASE `db_enroll` CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_general_ci';
  • 进入数据库,运行sql文件,在sql文件夹下,可以把sql放在一个没有中文路径的地方,否则有可能出错
-- 进入刚刚创建的数据库
use db_enroll;
-- 运行路径下的sql文件
source /path/to/sql/db_enroll.sql
  • 修改springboot配置文件application.yml,找到下面配置
enroll:login:# 登录用户名adminName: admin# 登录密码adminPass: 123456# 改为自己的数据库名database: DATABASE_NAME# 改为自己的数据库密码(账号默认root)dbpass: MYSQL_PASSWORD

3.3项目配置

spring:datasource:username: rootpassword: ${enroll.dbpass}url: jdbc:mysql://localhost:3306/${enroll.database}?serverTimezone=GMT%2B8&allowMultiQueries=truedriver-class-name: com.mysql.cj.jdbc.Drivertype: com.alibaba.druid.pool.DruidDataSourcedruid:# 连接池的配置信息# 初始化大小,最小,最大initial-size: 5min-idle: 5maxActive: 20# 配置获取连接等待超时的时间maxWait: 60000# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒timeBetweenEvictionRunsMillis: 60000# 配置一个连接在池中最小生存的时间,单位是毫秒minEvictableIdleTimeMillis: 300000validationQuery: SELECT 1testWhileIdle: truetestOnBorrow: falsetestOnReturn: false# 打开PSCache,并且指定每个连接上PSCache的大小poolPreparedStatements: truemaxPoolPreparedStatementPerConnectionSize: 20# 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙filters: stat,slf4j# 通过connectProperties属性来打开mergeSql功能;慢SQL记录connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000# 配置DruidStatFilterweb-stat-filter:enabled: trueurl-pattern: "/*"exclusions: "*.js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/*"# 配置DruidStatViewServletstat-view-servlet:url-pattern: "/druid/*"# IP白名单(没有配置或者为空,则允许所有访问)allow: 127.0.0.1,192.168.163.1# IP黑名单 (存在共同时,deny优先于allow)reset-enable: false# 登录名login-username: admin# 登录密码login-password: 123456filter:wall:config:multi-statement-allow: trueinitialization-mode: ALWAYSschema:- classpath:sql/schema.sqlinitialize: truedevtools:restart:enabled: truejackson:time-zone: GMT+8date-format: yyyy-MM-dd HH:mm:ss
mybatis:configuration:map-underscore-to-camel-case: truemapper-locations:- classpath:mybatis/mapper/*.xmltype-aliases-package: org.enroll.pojoenroll:login:adminName: adminadminPass: 123456database: db_enrolldbpass: 15975867048

3.4配置类

全局异常捕捉

package org.enroll.configuration;import org.enroll.interceptor.LoginInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.Resource;
import org.springframework.jdbc.datasource.init.DataSourceInitializer;
import org.springframework.jdbc.datasource.init.DatabasePopulator;
import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;import javax.sql.DataSource;
import java.util.HashMap;@Configuration
public class EnrollConfig implements WebMvcConfigurer {@AutowiredLoginInterceptor interceptor;@Value("classpath:sql/schema.sql")private Resource dataScript;@Overridepublic void addInterceptors(InterceptorRegistry registry) {InterceptorRegistration registration = registry.addInterceptor(interceptor);registration.addPathPatterns("/**");registration.excludePathPatterns("/login/doLogin");}@Overridepublic void addCorsMappings(CorsRegistry registry) {registry.addMapping("/**").allowedOrigins("http://localhost:8000").allowedMethods("GET","HEAD","POST","PUT","DELETE","OPTIONS").allowedHeaders("*").allowCredentials(true).maxAge(3600).allowedHeaders("*");}@Beanpublic HashMap<String, Object> globalStorage(){return new HashMap<>();}@Beanpublic DataSourceInitializer dataSourceInitializer(final DataSource dataSource) {final DataSourceInitializer initializer = new DataSourceInitializer();initializer.setDataSource(dataSource);initializer.setDatabasePopulator(databasePopulator());initializer.afterPropertiesSet();return initializer;}private DatabasePopulator databasePopulator() {final ResourceDatabasePopulator populator = new ResourceDatabasePopulator();populator.addScript(dataScript);return populator;}
}

登陆信息类

package org.enroll.configuration;import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;@Data
@Component
@ConfigurationProperties(prefix = "enroll.login")
public class LoginProperties {private String adminName;private String adminPass;
}

拦截器


@Component
public class LoginInterceptor implements HandlerInterceptor {@Resource(name = "globalStorage")Map<String, Object> storage;public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
//        if(request.getSession().equals(storage.get("authSession")))
//            return true;
//        response.setCharacterEncoding("UTF-8");
//        response.setContentType("application/json");
//        response.getWriter().println("{\"code\":\"010\",\"data\":null,\"message\":\"未登录\"}");
//        return false;return true;}
}

3.5常用工具类

查询结果集

@Data
public class QueryResultOption {private Integer rank;private Integer departmentId;private String majorId;}

json常量

@Getter
@Setter
@AllArgsConstructor
public class JsonResponse {public static final String OK = "000";public static final String SYSTEM_ERROR = "100";public static final String INVALID_REQUEST = "001";public static final String AUTH_ERR = "010";private String code;private Object data;private String message;}

3.6业务代码

@RestController
@RequestMapping("/student")
public class StudentController {@AutowiredIStudentService studentService;@RequestMapping("/getStudentRaw")public JsonResponse getStudentRaw(@RequestParam(required = false, defaultValue = "1") Integer currentPage){if(currentPage == null || currentPage<=0)return new JsonResponse(JsonResponse.INVALID_REQUEST,null, null);return new JsonResponse(JsonResponse.OK, studentService.getStudentRaw(currentPage), null);}@RequestMapping("/getAdjustStudentRaw")public JsonResponse getAdjustStudentRaw(@RequestParam(required = false, defaultValue = "1") int currentPage){return new JsonResponse(JsonResponse.OK, studentService.getAdjustStudentRaw(currentPage), null);}@RequestMapping("/getExitStudentRaw")public JsonResponse getExitStudentRaw(@RequestParam(required = false, defaultValue = "1") int currentPage){return new JsonResponse(JsonResponse.OK, studentService.getExitStudentRaw(currentPage), null);}@RequestMapping("/doEnroll")public JsonResponse doEnroll(){studentService.doEnroll();return new JsonResponse(JsonResponse.OK, null, null);}@RequestMapping("/doAdjust")public JsonResponse doAdjust(){studentService.doAdjust();return new JsonResponse(JsonResponse.OK, null, null);}//    StatisticsResult getResult(int currentPage, boolean desc);@RequestMapping("/getResult")public JsonResponse getResult(@RequestParam(required = false, defaultValue = "1") int currentPage,@RequestParam(required = false, defaultValue = "false") boolean desc,QueryResultOption option){return new JsonResponse(JsonResponse.OK, studentService.getResult(currentPage, desc, option), null);}
//    StatisticsResult getResultByDepartment( int departmentId, int currentPage, boolean desc);/*** @description t通过学院、专业、排名查询已弃用,请使用上面的getResult* @author 李宏鑫* @param null* @return* @updateTime 2021/1/7 20:53* @throws*/@RequestMapping("/getResultByDepartment")@Deprecatedpublic JsonResponse getResultByDepartment(int departmentId, @RequestParam(required = false, defaultValue = "1") int currentPage, @RequestParam(required = false, defaultValue = "false") boolean desc){return new JsonResponse(JsonResponse.OK, studentService.getResultByDepartment(departmentId, currentPage, desc), null);}
//    StatisticsResult getResultByMajor( String majorId, int currentPage, boolean desc);@RequestMapping("/getResultByMajor")@Deprecatedpublic JsonResponse getResultByMajor(String majorId, @RequestParam(required = false, defaultValue = "1") int currentPage, @RequestParam(required = false, defaultValue = "false") boolean desc){return new JsonResponse(JsonResponse.OK, studentService.getResultByMajor(majorId, currentPage, desc), null);}@RequestMapping("/searchStudent")@Deprecatedpublic JsonResponse searchStudent(@RequestParam(required = false, defaultValue = "1") int currentPage,String keyword){return new JsonResponse(JsonResponse.OK, studentService.searchStudent(currentPage,keyword), null);}@RequestMapping("/searchStudentByCandidate")public JsonResponse searchStudentByCandidate(@RequestParam(required = false, defaultValue = "1") int currentPage,String keyword){return new JsonResponse(JsonResponse.OK, studentService.searchStudentByCandidate(currentPage,keyword), null);}@RequestMapping("/getStudentBeforeRank")public JsonResponse getStudentBeforeRank(@RequestParam(required = false, defaultValue = "1") int currentPage, int rank){return new JsonResponse(JsonResponse.OK, studentService.getStudentBeforeRank(currentPage, rank), null);}@RequestMapping("/getStatisticsResult")public JsonResponse getStatisticsResult(){return new JsonResponse(JsonResponse.OK, studentService.getStatisticsResult(), null);}
//    List<Map<String, Object>> getResultInDepartment(int departmentId);@RequestMapping("/getStatisticsResultInDepartment")public JsonResponse getStatisticsResultInDepartment(){return new JsonResponse(JsonResponse.OK, studentService.getStatisticsResultInDepartment(), null);}
//    List<Map<String, Object>> getResultInMajor(String majorId);@RequestMapping("/getStatisticsResultInMajor")public JsonResponse getStatisticsResultInMajor(){return new JsonResponse(JsonResponse.OK, studentService.getStatisticsResultInMajor(), null);}//    Map<String, Integer> getDistribute();@RequestMapping("/getDistribute")public JsonResponse getDistribute(){return new JsonResponse(JsonResponse.OK, studentService.getDistribute(), null);}//    Map<String, Integer> getDistributeInProvince(String province);@RequestMapping("/getDistributeInProvince")public JsonResponse getDistributeInProvince(String province){return new JsonResponse(JsonResponse.OK, studentService.getDistributeInProvince(province), null);}//    Map<String, Integer> getGradeDistribute();@RequestMapping("/getGradeDistribute")public JsonResponse getGradeDistribute(){return new JsonResponse(JsonResponse.OK, studentService.getGradeDistribute(), null);}//    Map<String, Integer> getGradeDistributeByDepartment( int departmentId);@RequestMapping("/getGradeDistributeByDepartment")public JsonResponse getGradeDistributeByDepartment(int departmentId){return new JsonResponse(JsonResponse.OK, studentService.getGradeDistributeByDepartment(departmentId), null);}//    Map<String, Integer> getGradeDistributeByMajor(String majorId);@RequestMapping("/getGradeDistributeByMajor")public JsonResponse getGradeDistributeByMajor(String majorId){return new JsonResponse(JsonResponse.OK, studentService.getGradeDistributeByMajor(majorId), null);}//    Map<String, Integer> getCountDistributeInDepartment();@RequestMapping("/getCountDistributeInDepartment")public JsonResponse getCountDistributeInDepartment(){return new JsonResponse(JsonResponse.OK, studentService.getCountDistributeInDepartment(), null);}//    Map<String, Integer> getCountDistributeInMajor();@RequestMapping("/getCountDistributeInMajor")public JsonResponse getCountDistributeInMajor(){return new JsonResponse(JsonResponse.OK, studentService.getCountDistributeInMajor(), null);}//    Map<String, Integer> getCountDistributeInMajorByDepartment(int departmentId);@RequestMapping("/getCountDistributeInMajorByDepartment")public JsonResponse getCountDistributeInMajorByDepartment(int departmentId){return new JsonResponse(JsonResponse.OK, studentService.getCountDistributeInMajorByDepartment(departmentId), null);}@RequestMapping("/reset")@Deprecatedpublic JsonResponse reset(){studentService.reset();return new JsonResponse(JsonResponse.OK, null, null);}@RequestMapping("/formalReady")@Deprecatedpublic JsonResponse formalReady(){studentService.formallyReady();return new JsonResponse(JsonResponse.OK, null, null);}
}

3.7前端代码

<template><div id="back-stage-student-info"><empty-data v-if="studentInfo == null || studentInfo.length === 0"/><div id="student-plan-info" v-else><table-row-count :count="total"></table-row-count><el-table:data="studentInfo"stripestyle="width: 100%"><el-table-columnprop="candidate"label="准考证号"width="110"></el-table-column><el-table-columnprop="studentName"label="姓名"></el-table-column><el-table-columnprop="totalGrade"label="总分"></el-table-column><el-table-columnprop="rank"label="排名"></el-table-column><el-table-columnprop="will1"label="志愿1"></el-table-column><el-table-columnprop="will2"label="志愿2"></el-table-column><el-table-columnprop="will3"label="志愿3"></el-table-column><el-table-columnprop="will4"label="志愿4"></el-table-column><el-table-columnprop="will5"label="志愿5"></el-table-column><el-table-columnprop="will6"label="志愿6"></el-table-column><el-table-columnprop="province"label="省份"></el-table-column><el-table-columnprop="city"label="城市"></el-table-column><el-table-columnprop="subjectType"label="科类"></el-table-column></el-table><div class="page-bar" ><el-paginationlayout="prev, pager, next, jumper"@current-change="changePage":page-size="50":current-page.sync="currentPage"hide-on-single-page:total="total"></el-pagination></div></div></div>
</template><script>import {request} from "../../network/request";import EmptyData from "./EmptyData"import TableRowCount from './TableRowCount'export default {name: "StudentInfo",data() {return {studentInfo: null,currentPage: 1,total: 0,loading: null}},methods: {changePage(){this.loadStudentInfo();},loadStudentInfo(){this.setLoading();request({url: 'student/getStudentRaw',params: {currentPage: this.currentPage}}) .then( res => {if (res.code === '000'){this.studentInfo = res.data.list;this.total = res.data.total;} else {this.$message.error(res.message)}}).catch( err => {this.$message.error('系统错误')}).finally( () => {this.setUnloading();})},setLoading(){this.loading = this.$loading({lock: true,text: 'Loading',spinner: 'el-icon-loading',background: 'rgba(0, 0, 0, 0.7)'});},setUnloading(){this.loading.close();}},created(){this.loadStudentInfo();},components: {EmptyData,TableRowCount}}
</script><style scoped lang="less">.page-bar{width: 500px;margin: 30px auto;}
</style>

4.项目演示

4.1登录

4.2导入(测试文件在excel文件夹下,数据为随机模拟)

表格信息

4.3统计信息

4.4生源地分布

4.5导出结果

5.总结

广东工业大学课程设计 数据库课程设计 平行志愿录取系统(后端代码,广东工业大学数据库大作业) 基于java、spring、MySQL数据库、vue.js的课程设计


http://www.ppmy.cn/devtools/156952.html

相关文章

AI开发模式:ideal或vscode + 插件continue+DeepSeek R1

如何在 VSCode 中结合插件 Continue 和 DeepSeek 构建智能货柜AI开发环境的详细指南,涵盖环境配置、算法开发与模型优化全流程: 1. 环境搭建与工具选型 核心工具 工具/插件用途推荐配置VSCode主开发环境,支持多语言与插件扩展安装Python/C++/CUDA扩展ContinueAI代码助手(类…

Gateway路由匹配规则详解

在微服务架构中&#xff0c;Gateway作为请求的入口&#xff0c;扮演着至关重要的角色。它不仅负责路由转发&#xff0c;还具备安全、监控、限流等多种功能。其中&#xff0c;路由匹配规则是Gateway的核心功能之一&#xff0c;它决定了请求如何被正确地转发到目标服务。本文将详…

自由学习记录(34)

服务端相对特殊处理一下&#xff0c;因为是多线程处理&#xff0c;而客户端的断开连接会造成socket容器里socket数量减少 这样的处理方式有很多问题&#xff0c;但解决的话甚至要从根本上修改&#xff0c;所以&#xff0c;在这更多是知识点的演示 客户端是正常的模式 VS的服务端…

计算机视觉:解锁智能时代的钥匙与实战案例

计算机视觉&#xff1a;解锁智能时代的钥匙与实战案例 在人工智能的浩瀚星空中&#xff0c;计算机视觉无疑是最为璀璨的星辰之一。它不仅让机器拥有了“看”的能力&#xff0c;更是推动了自动驾驶、安防监控、医疗影像分析、智能制造等多个领域的革新。本文将深入探讨计算机视…

Linux 内核模块 | 加载 / 添加 / 删除 / 优先级

注&#xff1a;本文为 “Linux 内核模块加载 / 添加 / 删除 / 优先级” 相关文章合辑。 机翻&#xff0c;未校。 未整理去重。 How Linux Kernel Boots? Linux 内核如何启动&#xff1f; Last Updated: 26 Apr, 2023 Many processes are running in the background when …

计算机网络之数据链路层(数据链路层的功能)

帧同步&#xff1a; 数据链路层将网络层传下来的数据报封装成帧&#xff0c;为了区分不同的帧&#xff0c;需要在每个帧的开头和结尾添加特殊的标记&#xff0c;以实现帧的定界和同步。这样&#xff0c;接收方就能准确地识别出一个帧的开始和结束。 差错控制&#xff1a; 在…

Hangfire.NET:.NET任务调度

引言&#xff1a;为何选择 Hangfire&#xff1f; 在开发.NET 应用程序时&#xff0c;我们常常会遇到这样的场景&#xff1a;应用程序需要定期发送报告&#xff0c;像财务报表&#xff0c;每日业务数据汇总报告等&#xff0c;这些报告需要定时生成并发送给相关人员&#xff1b;…

【戒抖音系列】短视频戒除-1-对推荐算法进行干扰

如今推荐算法已经渗透到人们生活的方方面面&#xff0c;尤其是抖音等短视频核心就是推荐算法。 【短视频的危害】 1> 会让人变笨&#xff0c;慢慢让人丧失注意力与专注力 2> 让人丧失阅读长文的能力 3> 让人沉浸在一个又一个快感与嗨点当中。当我们刷短视频时&#x…