package com.gtms.gtms.controller;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.gtms.gtms.entity.*;
import com.gtms.gtms.service.*;
import com.gtms.gtms.util.MailUtils;
import com.gtms.gtms.util.ResultUtil;
import com.gtms.gtms.vo.DataAnalysis;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.mail.MailException;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;
/**
* @Author: 84644
* @Date: 2019/4/10 9:15
* @Description:
**/
@RequestMapping("/studentTeacherRelation")
@Controller
public class StudentTeacherRelationController {
private static final Logger LOG = LoggerFactory.getLogger(StudentTeacherRelationController.class);
@Autowired
private StudentTeacherRelationService studentTeacherRelationService;
@Autowired
private StudentInfoService studentInfoService;
@Autowired
private InitService initService;
@Autowired
private ThesisInfoService thesisInfoService;
@Autowired
private TeacherInfoService teacherInfoService;
@Autowired
private NoPassThesisService noPassThesisService;
@Autowired
private MailUtils mailUtils;
private final String AGREE = "1";
private final String DISAGREE = "2";
private final String MAIL_TITLE = "论文选题教师处理结果";
@Value("${mail.from.account}")
private String mailFromAccount;
/**
* 学生选题
*
* @param thesisId
* @param request
* @return
*/
@RequestMapping("/getStudentSelectThesisResult")
@ResponseBody
@Transactional
public Object getInfoByStudentNo(String thesisId, HttpServletRequest request) {
User u = (User) request.getSession().getAttribute("user");
int studentNum;
try {
Init init = initService.getInitData();
studentNum = init.getStudentNum();
StudentInfo studentInfo = studentInfoService.getInfo(u.getId());
LOG.info("==================开始根据学生学号查询学生选题信息,学生学号:{}==================", studentInfo.getStudentNo());
List<StudentTeacherRelation> res = studentTeacherRelationService.getInfoByStudentNo(studentInfo.getStudentNo());
LOG.info("==================根据学生学号查询学生选题信息完成,数据:{}==================", res);
// 选题数量达到了系统设定值
if (res.size() >= studentNum) {
return ResultUtil.success("选题数已经达到最大值,不能再选!");
}
ThesisInfo thesisInfo = thesisInfoService.selectById(thesisId);
if (thesisInfo.getSelectNum() != 0) {
return ResultUtil.success("该选题已经被选,不能选择该选题!");
}
StudentTeacherRelation studentTeacherRelation = new StudentTeacherRelation();
studentTeacherRelation.setStudentName(studentInfo.getStudentName());
studentTeacherRelation.setStudentNo(studentInfo.getStudentNo());
studentTeacherRelation.setStudentClass(studentInfo.getStudentClass());
studentTeacherRelation.setTeacherName(thesisInfo.getTeacherName());
studentTeacherRelation.setTeacherNo(thesisInfo.getTeacherNo());
studentTeacherRelation.setThesisNo(thesisInfo.getId().toString());
studentTeacherRelation.setThesisTitle(thesisInfo.getThesisTitle());
studentTeacherRelationService.insert(studentTeacherRelation);
LOG.info("==================选题成功==================");
// 选题成功,论文被选择数累加
thesisInfo.setSelectNum(thesisInfo.getSelectNum() + 1);
thesisInfoService.updateById(thesisInfo);
return ResultUtil.success("选题成功");
} catch (Exception e) {
LOG.error("==================根据学生学号查询学生选题信息异常,e={}==================", e);
return ResultUtil.error("根据学生学号查询学生选题信息异常");
}
}
/**
* 根据学号查询学生选题信息
*/
@RequestMapping("/getStudentSelectThesisByStudentNo")
@ResponseBody
public Object getStudentSelectThesisByStudentNo(HttpServletRequest request) {
User u = (User) request.getSession().getAttribute("user");
try {
StudentInfo studentInfo = studentInfoService.getInfo(u.getId());
LOG.info("==================开始根据学号查询学生选题信息,学号:{}==================", studentInfo.getStudentNo());
List<StudentTeacherRelation> res = studentTeacherRelationService.getInfoByStudentNo(studentInfo.getStudentNo());
res.forEach(item -> {
item.setOpinionFlagStr(item.getOpinionFlag() == null ? "未审核" : (item.getOpinionFlag() == 1 ? "同意" : "未审核"));
item.setTeacherOpinion(item.getTeacherOpinion() == null ? "" : item.getTeacherOpinion());
});
LOG.info("==================根据学号查询学生选题信息完成,选题信息:{}==================", res);
return ResultUtil.success(res);
} catch (Exception e) {
LOG.error("==================查询学生选题信息异常==================");
return ResultUtil.error("查询学生选题信息异常");
}
}
/**
* 根据教师id查询
*
* @param page
* @param rows
* @param request
* @return
*/
@RequestMapping("/getStudentSelectThesisByTeacherNo")
@ResponseBody
public Object getStudentSelectThesisByTeacherNo(int page, int rows, HttpServletRequest request) {
User user = (User) request.getSession().getAttribute("user");
TeacherInfo teacherInfo = teacherInfoService.getInfo(user.getId());
try {
LOG.info("==================开始根据教师编号查询学生选题信息==================");
Map<String, Object> res = studentTeacherRelationService.getInfoByTeacherNo(page, rows, teacherInfo.getTeacherNo());
LOG.info("==================根据教师id查询学生选题信息完成,信息:{}==================", res);
return res;
} catch (Exception e) {
LOG.error("==================根据教师id查询学生选题信息失败,e={}==================", e);
return ResultUtil.dataGridEmptyResult();
}
}
/**
* @param opinionFlag 意见标识1:同意,2:不同意
* @param teacherOpinion 老师意见
* @param thesisNo 论文id
* @return
*/
@RequestMapping("/operate")
@ResponseBody
@Transactional
public Object operate(String opinionFlag, String teacherOpinion, String thesisNo) {
LOG.info("==================开始处理论文意见==================");
StudentTeacherRelation studentTeacherRelation = studentTeacherRelationService.getInfoByThesisNo(thesisNo);
StringBuilder sb = new StringBuilder();
try {
// 教师同意选题
if (AGREE.equals(opinionFlag)) {
// 根据论文id更新关系表
studentTeacherRelationService.updateByThesisNo(thesisNo, opinionFlag, teacherOpinion);
// 发送邮件通知学生
try {
mailUtils.sendEmail(mailFromAccount, studentTeacherRelation.getStudentEmail(), MAIL_TITLE,
"�
没有合适的资源?快使用搜索试试~ 我知道了~
SpringBoot+druid+mysql毕业设计管理系统.zip
共738个文件
png:220个
xml:118个
gif:118个
需积分: 5 0 下载量 111 浏览量
2024-08-14
10:12:56
上传
评论
收藏 7.16MB ZIP 举报
温馨提示
项目工程资源经过严格测试可直接运行成功且功能正常的情况才上传,可轻松copy复刻,拿到资料包后可轻松复现出一样的项目,本人系统开发经验充足(全栈开发),有任何使用问题欢迎随时与我联系,我会及时为您解惑,提供帮助 【资源内容】:项目具体内容可查看/点击本页面下方的*资源详情*,包含完整源码+工程文件+说明(若有)等。【若无积分,此资源可私信获取】 【本人专注IT领域】:有任何使用问题欢迎随时与我联系,我会及时解答,第一时间为您提供帮助 【附带帮助】:若还需要相关开发工具、学习资料等,我会提供帮助,提供资料,鼓励学习进步 【适合场景】:相关项目设计中,皆可应用在项目开发、毕业设计、课程设计、期末/期中/大作业、工程实训、大创等学科竞赛比赛、初期项目立项、学习/练手等方面中 可借鉴此优质项目实现复刻,也可基于此项目来扩展开发出更多功能 #注 1. 本资源仅用于开源学习和技术交流。不可商用等,一切后果由使用者承担 2. 部分字体及插图等来自网络,若是侵权请联系删除,本人不对所涉及的版权问题或内容负法律责任。收取的费用仅用于收集和整理资料耗费时间的酬劳
资源推荐
资源详情
资源评论
收起资源包目录
SpringBoot+druid+mysql毕业设计管理系统.zip (738个子文件)
StudentTeacherRelationController.class 13KB
StudentTeacherRelation.class 13KB
StudentTeacherRelationServiceImpl.class 9KB
ThesisInfoController.class 8KB
FileHandleController.class 7KB
FTPUtil.class 7KB
StudentInfo.class 6KB
NoPassThesis.class 6KB
ThesisInfo.class 6KB
UserController.class 5KB
TeacherInfo.class 5KB
ThesisInfoDetailVo.class 5KB
Menu.class 4KB
PersonInfoController.class 4KB
MenuController.class 4KB
LoginController.class 4KB
User.class 3KB
ModifyPwdVo.class 3KB
Init.class 3KB
ResultVo.class 3KB
ThesisInfoServiceImpl.class 3KB
InitController.class 2KB
ModifyInfoVo.class 2KB
MenuServiceImpl.class 2KB
StudentTeacherRelationMapper.class 2KB
LoginIntercepter.class 2KB
WebConfig.class 2KB
StudentTeacherRelationService.class 2KB
DataAnalysis.class 2KB
ResultUtil.class 2KB
ResultCodeEnum.class 2KB
UserServiceImpl.class 2KB
MailUtils.class 1KB
MybatisConfig.class 1KB
GtmsApplication.class 1KB
TeacherInfoServiceImpl.class 1KB
StudentInfoServiceImpl.class 1KB
UserType.class 1KB
ThesisInfoMapper.class 975B
InitServiceImpl.class 963B
MenuMapper.class 882B
NoPassThesisServiceImpl.class 722B
MenuService.class 683B
NopassThesisMapper.class 680B
ThesisInfoService.class 660B
UserMapper.class 623B
GtmsApplicationTests.class 616B
TeacherInfoMapper.class 614B
StudentInfoMapper.class 614B
UserService.class 585B
TeacherInfoService.class 507B
StudentInfoService.class 507B
InitService.class 341B
InitMapper.class 340B
NoPassThesisService.class 311B
mvnw.cmd 6KB
style.css 19KB
style.css 19KB
dialog.css 9KB
dialog.css 9KB
tinymce.css 9KB
tinymce.css 9KB
default.css 9KB
default.css 9KB
select.css 2KB
select.css 2KB
switch.css 869B
switch.css 869B
editor.css 605B
editor.css 605B
centos+ftp.docx 1.71MB
毕业论文.docx 1.12MB
tinymce.gif 12KB
tinymce.gif 12KB
default.gif 7KB
default.gif 7KB
etc_24.gif 1KB
etc_24.gif 1KB
etc_33.gif 1KB
etc_33.gif 1KB
etc_32.gif 1KB
etc_32.gif 1KB
etc_36.gif 1KB
etc_36.gif 1KB
etc_31.gif 1KB
etc_31.gif 1KB
etc_30.gif 1KB
etc_30.gif 1KB
etc_25.gif 1KB
etc_25.gif 1KB
etc_26.gif 1012B
etc_26.gif 1012B
etc_34.gif 992B
etc_34.gif 992B
etc_35.gif 989B
etc_35.gif 989B
etc_27.gif 978B
etc_27.gif 978B
etc_02.gif 687B
etc_12.gif 687B
共 738 条
- 1
- 2
- 3
- 4
- 5
- 6
- 8
资源评论
热爱技术。
- 粉丝: 2648
- 资源: 7860
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功