package cn.jsj.gratuatepager.service.impl;
import cn.jsj.gratuatepager.dao.IPaperDao;
import cn.jsj.gratuatepager.dao.ITitleEntityDao;
import cn.jsj.gratuatepager.dao.IUserEntityDao;
import cn.jsj.gratuatepager.exceptions.children.RuntimeProcessException;
import cn.jsj.gratuatepager.interceptor.censor.TokenCensor;
import cn.jsj.gratuatepager.pojo.*;
import cn.jsj.gratuatepager.service.IIOservice;
import cn.jsj.gratuatepager.service.IUserservice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
import static org.springframework.transaction.annotation.Isolation.REPEATABLE_READ;
@Service
public class CUserService implements IUserservice {
@Value("${securitycodetime}")
private Integer securitysecond;
@Value("${login-available-time}")
private Integer loginAvailableTime;//设置无操作登录有效时长
@Autowired
private IPaperDao paperDao;
@Autowired
private RedisTemplate<String, Serializable> redisTemplate;
@Autowired
private IUserEntityDao iUserEntityDao;
@Autowired
private ITitleEntityDao titleEntityDao;
@Autowired
private IIOservice iiOservice;
@Override
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED, isolation = REPEATABLE_READ)
public CStudent getOneStudentByID(Integer id) {
CStudent student = this.iUserEntityDao.getStudentById(id);
return student;
}
@Override
public CStudent getOneStudentByNumber(String number) {
CStudent student = this.iUserEntityDao.getStudentByNumber(number);
return student;
}
@Override
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED, isolation = REPEATABLE_READ)
public CTeacher getOneTeacherByNumber(String account) {
CTeacher teacher = this.iUserEntityDao.getTeacherByWorkNumber(account);
return teacher;
}
@Override
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED, isolation = REPEATABLE_READ)
public List<CProfess> getProfessByDepartId(Integer departid) {
List<CProfess> storage = this.iUserEntityDao.getProfessByDepartId(departid);
return storage;
}
@Override
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED, isolation = REPEATABLE_READ)
public Map<String,String> registerOneStudent(String studentNumber,String password,String email,String phoneNumber,String name,Integer departid,String code, Integer professid) {
CStudent student = new CStudent(0,name.trim(),departid+"","",email.trim(),phoneNumber.trim(),studentNumber.trim(),professid+"");
boolean ready = false;
ready = this.checkResistorCode(student.getAccount(), code.trim());
if (ready == false) {
throw new RuntimeProcessException("验证码错误");
}
CStudent studenttest = null;
studenttest = this.iUserEntityDao.getStudentByPhoneNumber(student.getPhone());
if(studenttest != null) {
throw new RuntimeProcessException("手机号已注册");
}
studenttest = this.iUserEntityDao.getStudentByEmail(student.getEmail());
if(studenttest != null) {
throw new RuntimeProcessException("邮箱已经注册");
}
Integer flag = this.iUserEntityDao.getUserIDByNumber(student.getAccount());
if (flag != null && flag > 0) {
throw new RuntimeProcessException("学号已注册");
}
int tem = Integer.parseInt(student.getDepartName());
CDepart depart = this.iUserEntityDao.getDepartById(tem);
if(depart == null) {
throw new RuntimeProcessException("注册信息有误");
}
this.iUserEntityDao.insertOneStudentToUser(student);
this.iUserEntityDao.insertIntoSecurity(student.getAccount(), password.trim(),0, student.getId());
CProfess profess = this.iUserEntityDao.getProfessById(Integer.parseInt(student.getProfessName()));
if(profess == null) {
throw new RuntimeProcessException("注册信息有误");
}
this.iUserEntityDao.insertProfessInformationByStudentId(student.getId(),Integer.parseInt(student.getProfessName()));
Map<String,String> storage = this.login(student.getAccount(),password.trim());
return storage;
}
@Override
public List<CDepart> getDeparts() {
return this.iUserEntityDao.getdepartList();
}
@Override
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED, isolation = REPEATABLE_READ)
public CTitle getCheckedTitleOfStudent(String studentAccount) {
CStudent student = this.iUserEntityDao.getStudentByNumber(studentAccount.trim());
Integer titleID = this.iUserEntityDao.getCheckedTitle(student.getId());
if(titleID == 0) {
return null;
}
CTitle title = this.titleEntityDao.getOneTitleById(titleID);
return title;
}
@Override
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED, isolation = REPEATABLE_READ)
public void cancelTitleCheck(String studentAccount) {
CTitle title = this.getCheckedTitleOfStudent(studentAccount.trim());
if(title == null) {
throw new RuntimeProcessException("用户尚未选题");
}
CStudent student = this.iUserEntityDao.getStudentByNumber(studentAccount.trim());
this.titleEntityDao.cancelTitle(student.getId());
this.titleEntityDao.deleteTItleCheckInformationOfOneStudent(title.getTitleId(),student.getId());
this.titleEntityDao.cutDownTheNumberOfTitleChecked(title.getTitleId());
}
@Override
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED, isolation = REPEATABLE_READ)
public void teacherCancelStudentTitleCheck(String teacherAccount, String studentAccount) {
CStudent student = this.iUserEntityDao.getStudentByNumber(studentAccount.trim());
if(student == null) {
throw new RuntimeProcessException("用户信息有误");
}
CTitle title = this.titleEntityDao.getTitleByStudentID(student.getId());
if(title == null) {
throw new RuntimeProcessException("用户信息有误");
}
CPaper paper = this.paperDao.getOneRandomPaperByStudentID(student.getId());
if(paper != null) {
throw new RuntimeProcessException("该同学已经开始本题目,无法强制退选");
}
if(title.getGuideTeacher().getAccount().equals(teacherAccount.trim())) {
this.cancelTitleCheck(student.getAccount());
this.iiOservice.postEmail("强制退选通知","您的选题:"+title.getTitleName()+" 已经被指导教师强制退选,请重新选题",student.getEmail());
}else{
throw new RuntimeProcessException("用户信息有误");
}
}
@Override
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED, isolation = REPEATABLE_READ)
public void checkTitle(String studentAccount, Integer titleID) {
CStudent student = this.iUserEntityDao.getStudentByNumber(studentAccount.trim());
CTitle title = this.titleEntityDao.getOneTitleById(titleID);
if(student == null || title == null) {
throw new RuntimeProcessException("信息有误");
}
Integer titlestate = this.iUserEntityDao.getCheckedTitle(student.getId());
if(titlestate
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
基于springboot的毕业论文管理系统:前端 html、jquery、easyui,后端 maven、springmvc、spring、mybatis,角色分为学生、老师;集成选题、专业选择、论文提交、评审记录等功能于一体的系统。.zip 适合学习/练手、毕业设计、课程设计、期末/期中/大作业、工程实训、相关项目/竞赛学习等。 项目具有较高的学习借鉴价值,也可直接拿来修改复现。可以在这些基础上学习借鉴进行修改和扩展,实现其它功能。 【无积分此资源可私信博主有偿获取】 可放心下载学习借鉴,你会有所收获。 —— 对于学习和实践,选择合适的项目和资源确实是一种有效的方式。 在进行毕业设计、课程设计或大作业时,选择具备学习借鉴价值的项目可以帮助你理解和应用所学知识,同时也可以通过修改和扩展来实现其他功能。 通过参与实际项目,你可以应用所学的理论知识,深入了解软件开发或其他领域的实践流程和技术要求。 可放心下载学习借鉴,你会有所收获。 【无积分此资源可私信博主有偿获取】 # 注意 1. 本资源仅用于开源学习和技术交流。不可商用等,一切后果由使用者承担。 2. 部分字体以及插图等来自网络,若是侵权请联系删除。
资源推荐
资源详情
资源评论
收起资源包目录
基于springboot的毕业论文管理系统 (634个子文件)
easyui.css 71KB
easyui.css 70KB
easyui.css 70KB
easyui.css 70KB
easyui.css 70KB
easyui.css 68KB
easyui.css 67KB
react.css 10KB
angular.css 10KB
vue.css 10KB
tabs.css 9KB
tabs.css 9KB
tabs.css 9KB
tabs.css 9KB
tabs.css 7KB
tabs.css 7KB
tabs.css 7KB
mobile.css 6KB
color.css 6KB
datagrid.css 6KB
datagrid.css 6KB
datagrid.css 6KB
datagrid.css 6KB
panel.css 6KB
panel.css 6KB
panel.css 6KB
panel.css 6KB
datagrid.css 5KB
datagrid.css 5KB
datagrid.css 5KB
panel.css 5KB
panel.css 5KB
panel.css 5KB
linkbutton.css 4KB
linkbutton.css 4KB
linkbutton.css 4KB
linkbutton.css 4KB
linkbutton.css 4KB
window.css 4KB
window.css 4KB
window.css 4KB
window.css 4KB
calendar.css 4KB
calendar.css 4KB
calendar.css 4KB
calendar.css 4KB
calendar.css 4KB
calendar.css 4KB
calendar.css 4KB
window.css 4KB
window.css 4KB
window.css 4KB
linkbutton.css 3KB
linkbutton.css 3KB
tree.css 3KB
tree.css 3KB
tree.css 3KB
tree.css 3KB
tree.css 3KB
tree.css 3KB
tree.css 3KB
layout.css 3KB
layout.css 3KB
layout.css 3KB
layout.css 3KB
layout.css 3KB
layout.css 3KB
layout.css 3KB
textbox.css 3KB
textbox.css 3KB
textbox.css 3KB
textbox.css 3KB
textbox.css 3KB
textbox.css 3KB
textbox.css 3KB
spinner.css 3KB
spinner.css 3KB
spinner.css 3KB
spinner.css 3KB
spinner.css 3KB
spinner.css 3KB
spinner.css 3KB
icon.css 2KB
menu.css 2KB
menu.css 2KB
menu.css 2KB
accordion.css 2KB
menu.css 2KB
accordion.css 2KB
accordion.css 2KB
menu.css 2KB
accordion.css 2KB
menu.css 2KB
accordion.css 2KB
menu.css 2KB
accordion.css 2KB
accordion.css 2KB
tooltip.css 2KB
tooltip.css 2KB
tooltip.css 2KB
共 634 条
- 1
- 2
- 3
- 4
- 5
- 6
- 7
资源评论
阿齐Archie
- 粉丝: 1w+
- 资源: 2303
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功