package com.manage.Controller.Table;
import com.manage.Pojo.*;
import com.manage.Service.SearchService;
import com.manage.Service.UpdataService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.web.ServerProperties;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpSession;
import java.io.File;
import java.io.IOException;
import java.util.*;
/**
* @Author qinsicheng
* @Description 内容:学生页面控制器
* @Date 17/12/2021 09:42
*/
@Slf4j
@Controller
public class studentPageController {
@Autowired
com.manage.Service.loginService loginService;
@Autowired
SearchService searchService;
@Autowired
UpdataService updataService;
@Autowired
RedisTemplate<String,String> redisTemplate;
//进入学生主页面
@GetMapping("/studentPage")
public String toStudentPage(Model model, HttpSession session) {
stu_login loginUser = (stu_login)session.getAttribute("loginUser");
if (loginUser == null) {
session.setAttribute("returnEx", "请先进行登录");
return "redirect:/StuLogin";
}
//获取登录者详细信息
stu_message loginStu = searchService.getStuMessageById(loginUser.getStuId());
//获取所有人的成绩单
List<mainPoint> allMainPoint = searchService.getAllMainPoint();
int size = allMainPoint.size();
//遍历成绩单
for (int i = size-1; i >= 0 ; i--) {
stu_message stuMessageById = searchService.getStuMessageById(allMainPoint.get(i).getStuId());
//判断是否是与登录者相同专业的学生,如果不是进行剔除
if (!loginStu.getStuMajor().equals(stuMessageById.getStuMajor())) {
allMainPoint.remove(i);
continue;
}
//新建一个Hash表,存储展示的数据
HashMap<String, Integer> hashMap = new HashMap<>();
//新建一个记录类别分的Hash表
HashMap<String, Integer> ClaHashMap = new HashMap<>();
int singularPoint = 0;
//通过学生id,查询所有的获取荣誉
List<additional_record> allClaRecordById = searchService.getAllClaRecordById(allMainPoint.get(i).getStuId());
//递归荣誉,放入到hash表中去除同名项目,取最高分
for (additional_record additional_record : allClaRecordById) {
//获取该对象所属类别的详细信息
Additional_Classification addClaByClaName = searchService.getAddClaByClaName(additional_record.getClaName());
//如果是只能添加一项的 特殊处理
if (addClaByClaName.getClaCeiling().equals("只能添加一项")) {
//如果新添加的比较大 则替换
if (singularPoint<additional_record.getProjectScore()) {
//赋值
singularPoint = additional_record.getProjectScore();
//放入
ClaHashMap.put(additional_record.getClaName(),singularPoint);
//挑出该层
continue;
} else {
continue;
}
}
//如果新加入的项目已经存在 判断分数是否大于新加入的同名项目,如果新的分数高,则进行替换
//如果当前项目 hash表中已存在 并且 数据还小于新的同名项目 则不添加新的数据
if (hashMap.get(additional_record.getProjectName()) != null
&&
additional_record.getProjectScore() < hashMap.get(additional_record.getProjectName())) {
} else {
//当hash中不存在该项目时候,或者存在但是我新来得比你大
hashMap.put(additional_record.getProjectName(), additional_record.getProjectScore());
//添加到 类别 表中 = 原先数据 + 现在数据
Integer integer = ClaHashMap.get(addClaByClaName.getClaName());
ClaHashMap.put(addClaByClaName.getClaName(), (integer==null?0:integer) +
additional_record.getProjectScore());
}
}
int allPoint = 0;
int addEdu= 0;
//新加部分
int addEdu1 = 0;
Set<Map.Entry<String, Integer>> entries = ClaHashMap.entrySet();
for (Map.Entry<String, Integer> entry : entries) {
Additional_Classification addClaByClaName = searchService.getAddClaByClaName(entry.getKey());
String claCeiling = addClaByClaName.getClaCeiling();
try {
int claScore = Integer.parseInt(claCeiling);
if (entry.getValue()>claScore) {
addEdu1 = addEdu1+=claScore;
} else {
addEdu1 = addEdu1+=entry.getValue();
}
} catch (NumberFormatException e) {
//如果捕捉到异常 说明规则不是数字 只能添加一项
if (claCeiling.equals("只能添加一项")) {
addEdu1 += entry.getValue();
}
}
}
//限制附加分不大于10
if (addEdu1>10) {
addEdu1 = 10;
}
allMainPoint.get(i).setAdditionEdu(addEdu1);
allMainPoint.get(i).setStuMessage(stuMessageById);
allPoint = allMainPoint.get(i).getLearnEdu()+ allMainPoint.get(i).getSportEdu()+ allMainPoint.get(i).getMoralEdu()+ allMainPoint.get(i).getAdditionEdu();
stuMessageById.setTotalPoint(allPoint);
}
model.addAttribute("allMainPoint", allMainPoint);
return "studentPage/studentPage";
}
//进入学生登录界面
@GetMapping({"/StuLogin"})
public String toLogin(HttpSession session) {
session.removeAttribute("loginUser");
return "studentPage/Stulogin";
}
//进入学生主页面
@PostMapping("/studentPage")
public String toIndex(stu_login stuLogin, HttpSession session) {
stu_login stu_login = loginService.testLogin(stuLogin.getStuId());
if (stu_login == null || !(stuLogin.getPassword().equals(stu_login.getPassword()))) {
session.setAttribute("returnEx", "输入错误");
return "redirect:/StuLogin";
} else {
//记录学生登录信息
ValueOperations<String, String> ops = redisTemplate.opsForValue();
ops.increment("logeing");
session.setAttribute("loginUser", stuLogin);
return "redirect:/studentPage";
}
}
//跳转目标客户的综测加分成绩页面
//GetMapping 标注自己能操作的地址
@GetMapping("/stuClaRecord/{stu_id}")
public String toStuClaRecord(Model model,
//将地址里的 stu_id 封装为一个stuid使用
@PathVariable("stu_id") Integer stuId) {
//1.调用searchService获取自己的荣誉信息
List<additional_record> allCla = searchService.getAllClaRecordById(stuId);
//1.1请求各个项目类别的总分
HashMap
没有合适的资源?快使用搜索试试~ 我知道了~
JAVA学生成绩管理系统(源码+数据库)

共319个文件
js:83个
png:80个
css:52个

1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉

温馨提示
JAVA学生成绩管理系统(源码+数据库)。这是个人98分大作业项目,主要针对计算机相关专业的正在做课程设计和期末大作业的学生和需要项目实战练习的学习者。包含全部项目源码、该项目可以直接使用、项目都经过严格调试,下载即用确保可以运行! JAVA学生成绩管理系统(源码+数据库)JAVA学生成绩管理系统(源码+数据库)JAVA学生成绩管理系统(源码+数据库)JAVA学生成绩管理系统(源码+数据库)JAVA学生成绩管理系统(源码+数据库)JAVA学生成绩管理系统(源码+数据库)JAVA学生成绩管理系统(源码+数据库)JAVA学生成绩管理系统(源码+数据库)JAVA学生成绩管理系统(源码+数据库)JAVA学生成绩管理系统(源码+数据库)JAVA学生成绩管理系统(源码+数据库)JAVA学生成绩管理系统(源码+数据库)JAVA学生成绩管理系统(源码+数据库)JAVA学生成绩管理系统(源码+数据库)JAVA学生成绩管理系统(源码+数据库)JAVA学生成绩管理系统(源码+数据库这是个人98分大作业项目,主要针对计算机相关专业的正在做课程设计和期末大作业的学生和需要项目实战练习的学习者。包含全部项目源码
资源推荐
资源详情
资源评论

























收起资源包目录





































































































共 319 条
- 1
- 2
- 3
- 4

程序员张小妍
- 粉丝: 2w+
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助


最新资源
- 机械制造与自动化专业毕业论文(1).docx
- AutoCAD操作教程2010中文版教程.pptx
- 浅析软件项目中的质量管理.doc
- 软件公司薪酬制度(7)(1).doc
- 软件技术方案教学案例.doc
- 软件公司实习实训报告.doc
- 2022网络研修培训心得体会.docx
- 第6章二端口网络.pptx
- YD_T_2507.3-2013_2GHz_TD-SCDMA_数字蜂窝移动通信网增强型高速分组接入(HSPA+)lub_接口技术要求_第3部分_信令传输(1).pdf
- C++程序设计(上)练习-答案.doc
- DB23_T_2780_2020_根用芥菜栽培技术规程.pdf
- 2023年电大计算机实验报告.doc
- 25理想汽车用户体验设计师岗位面试题集及参考答案39道
- Q JJSP 0001 S-2020 半固态调味料.pdf
- access数据库知识点总结.docx
- c课设报告项目管理系统.doc
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈



安全验证
文档复制为VIP权益,开通VIP直接复制

- 1
- 2
- 3
- 4
- 5
- 6
前往页