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 1、该资源内项目代码经过严格调试,下载即用确保可以运行! 2、该资源适合计算机相关专业(如计科、人工智能、大数据、数学、电子信息等)正在做课程设计、期末大作业和毕设项目的学生、或者相关技术学习者作为学习资料参考使用。 3、该资源包括全部源码,需要具备一定基础才能看懂并调试代码。 SpringBoot+druid+mysql毕业设计管理系统.zip 1、该资源内项目代码经过严格调试,下载即用确保可以运行! 2、该资源适合计算机相关专业(如计科、人工智能、大数据、数学、电子信息等)正在做课程设计、期末大作业和毕设项目的学生、或者相关技术学习者作为学习资料参考使用。 3、该资源包括全部源码,需要具备一定基础才能看懂并调试代码。 SpringBoot+druid+mysql毕业设计管理系统.zip 1、该资源内项目代码经过严格调试,下载即用确保可以运行! 2、该资源适合计算机相关专业(如计科、人工智能、大数据、数学、电子信息等)正在做课程设计、期末大作业和毕设项目的学生、或者相关技术学习者作为学习资料参考使用。 3、该资
资源推荐
资源详情
资源评论
收起资源包目录
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
资源评论
- m0_744170332024-03-04超级好的资源,很值得参考学习,对我启发很大,支持!
辣椒种子
- 粉丝: 4122
- 资源: 5737
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- OpenEuler22.03TLS-SP3系统ssh漏洞官方升级包
- Jmeter实现同一线程组内接口并行执行
- MySQL的安装与配置PDF
- python007-django疫情数据可视化分析系统(LW+PPT).zip
- python006-django基于python技术的学生管理系统的设计与开发.zip
- python005-基于Python爬虫的网络小说数据分析系统的设计与实现.zip
- vs2015 udp 广播 demo
- 创维42L20HW(8DA6)软件数据.rar
- gcc15交叉编译工具链windows版,用于编译龙芯应用,gcc version 15.0.0 20241119 (experimental) (GCC)
- python004-基于python的抑郁症患者看护系统.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功