package com.wymessi.controller;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import com.alibaba.druid.util.StringUtils;
import com.wymessi.exception.CustomException;
import com.wymessi.param.GenerateApplyParam;
import com.wymessi.param.ProjectListParam;
import com.wymessi.po.Allocate;
import com.wymessi.po.Group;
import com.wymessi.po.Project;
import com.wymessi.po.SysUser;
import com.wymessi.service.AllocateService;
import com.wymessi.service.GroupService;
import com.wymessi.service.ProjectService;
import com.wymessi.service.UserService;
import com.wymessi.utils.CustomDateUtils;
import com.wymessi.utils.Md5Utils;
import com.wymessi.utils.Result;
import com.wymessi.utils.UUIDUtils;
@Controller
@RequestMapping("/project")
public class ProjectController {
@Autowired
private ProjectService projectService;
@Autowired
private UserService userService;
@Autowired
private GroupService groupService;
@Autowired
private AllocateService allocateService;
/**
* 项目申请页面
*
* @return
* @throws Exception
*/
@RequestMapping("/uploadPage")
public String uploadPage(HttpSession session) throws Exception {
if (session.getAttribute("user") == null) {
throw new CustomException("未登录,请先登录", "/prs/");
}
session.setAttribute("token", UUIDUtils.generateUUIDString());
return "applicant/upload";
}
/**
* 用户管理页面
*
* @return
* @throws Exception
*/
@RequestMapping("/userPage")
public String userPage(HttpSession session, HttpServletRequest request) throws Exception {
if (session.getAttribute("user") == null) {
throw new CustomException("未登录,请先登录", "/prs/");
}
String role = request.getParameter("role");
String path = null;
switch (role) {
case "1":
path = "system/userManage/applicant";
break;
case "2":
path = "system/userManage/expert";
break;
case "3":
path = "system/userManage/system";
break;
default:
break;
}
return path;
}
/**
* 添加用户页面
*
* @return
* @throws Exception
*/
@RequestMapping("/addUserPage")
public String addUserPage(HttpSession session, Model model, String roleId) throws Exception {
if (session.getAttribute("user") == null) {
throw new CustomException("未登录,请先登录", "/prs/");
}
model.addAttribute("roleId", roleId);
session.setAttribute("token", UUIDUtils.generateUUIDString());
return "system/userManage/addUser";
}
/**
* 添加用户
*
* @return
* @throws Exception
*/
@RequestMapping("/addUser")
public String addUser(HttpSession session, Model model, String role, SysUser user, String token) throws Exception {
if (session.getAttribute("user") == null) {
throw new CustomException("未登录,请先登录", "/prs/");
}
String path = null;
switch (role) {
case "1":
path = "system/userManage/applicant";
break;
case "2":
path = "system/userManage/expert";
break;
case "3":
path = "system/userManage/system";
break;
default:
break;
}
if (session.getAttribute("token") == null) {
model.addAttribute("message", "请勿重复提交表单");
return path;
}
if (session.getAttribute("token").equals(token)) {
String md5Password = Md5Utils.md5(user.getPassword()); // 密码采用MD5加密
user.setPassword(md5Password);
userService.register(user);
model.addAttribute("message", "添加成功");
session.removeAttribute("token");
}
return path;
}
/**
* 项目分配管理页面
*
* @return
* @throws Exception
*/
@RequestMapping("/allocateManagePage")
public String allocateManagePage(HttpSession session) throws Exception {
if (session.getAttribute("user") == null) {
throw new CustomException("未登录,请先登录", "/prs/");
}
return "system/allocateManage/allocateManage";
}
/**
* 项目分配页面
*
* @return
* @throws Exception
*/
@RequestMapping("/allocatePage")
public String allocatePage(Model model, HttpSession session,Long id) throws Exception {
if (session.getAttribute("user") == null) {
throw new CustomException("未登录,请先登录", "/prs/");
}
session.setAttribute("groupId", id);
return "system/allocateManage/allocate";
}
/**
* 项目管理页面
*
* @return
* @throws Exception
*/
@RequestMapping("/managePage")
public String managePage(HttpSession session, HttpServletRequest request) throws Exception {
if (session.getAttribute("user") == null) {
throw new CustomException("未登录,请先登录", "/prs/");
}
return "system/projectManage/manage";
}
/**
* 处理上传请求
*
* @param model
* @param file
* @param session
* @param project
* @param tagsinput
* @param token 防止表单重复重复
* 领域标签用逗号隔开
* @return
*/
@RequestMapping("/upload")
public String upload(Model model, MultipartFile file, HttpSession session, Project project, String tagsinput, String token) {
SysUser user = (SysUser) session.getAttribute("user");
if (user == null) {
throw new CustomException("未登录,请先登录", "/prs/");
}
if (session.getAttribute("token") == null) {
model.addAttribute("message", "请勿重复提交表单");
return "applicant/upload";
}
if (session.getAttribute("token").equals(token)) {
// 生成申请记录
GenerateApplyParam param = new GenerateApplyParam();
param.setModel(model);
param.setFile(file);
param.setProject(project);
param.setSysUser(user);
param.setTagsinput(tagsinput);
projectService.generateApply(param);
session.removeAttribute("token");
}
return "applicant/upload";
}
/**
* 删除项目申请记录
* @param session
* @param id
*/
@RequestMapping("/delete")
public void delete(HttpSession session, Long id) {
SysUser user = (SysUser) session.getAttribute("user");
if (user == null) {
throw new CustomException("未登录,请先登录", "/prs/");
}
// 删除记录
projectService.deleteById(id);
}
/**
* 更新申请记录接口
*
* @param model
* @param session
* @param project
* @return
*/
@ResponseBody
@RequestMapping("/update")
public Result<String> update(Model model, HttpSession session, Project project) {
SysUser user = (SysUser) session.getAttribute("user");
if (user == null) {
throw new CustomException("未登录,请先登录", "/prs/");
}
Result<String> result = new Result<String>();
Project p = projectService.getProjectById(project.getId());
if (p == null) {
result.setData("该申请记录不存在,请刷新页面重新查看");
return result;
}
p.setProjectName(project.getProjectName());
p.setDescription(project.getDescription());
// 更新申请记录
p.setLastUpdateTime(new Date());
int rows = projectService.update(p); // 返回影响的行数
if (rows > 0) {
result.setData("修改成功");
} else {
result.setData("修改失败");
}
return result;
}
/**
* 查询项目申请记录接口,以json的形式返回
*
* @param session
* @param request
* @return
*/
@ResponseBody
@RequestMapping("/projects.json")
public Map<String, Object>
没有合适的资源?快使用搜索试试~ 我知道了~
基于springboot+mybatis+thymleaf的科研项目评审系统+源代码+文档说明
共303个文件
gif:75个
java:67个
html:25个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 201 浏览量
2023-11-28
16:05:36
上传
评论
收藏 2.23MB ZIP 举报
温馨提示
- ## 项目备注 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用! 2、本项目适合计算机相关专业(如计科、人工智能、通信工程、自动化、电子信息等)的在校学生、老师或者企业员工下载学习,也适合小白学习进阶,当然也可作为毕设项目、课程设计、作业、项目初期立项演示等。 3、如果基础还行,也可在此代码基础上进行修改,以实现其他功能,也可用于毕设、课设、作业等。 下载后请首先打开README.md文件(如有),仅供学习参考, 切勿用于商业用途。
资源推荐
资源详情
资源评论
收起资源包目录
基于springboot+mybatis+thymleaf的科研项目评审系统+源代码+文档说明 (303个子文件)
org.eclipse.wst.common.component 650B
org.eclipse.wst.jsdt.ui.superType.container 49B
flat-ui.css 151KB
flat-ui.min.css 128KB
bootstrap.min.css 107KB
layui.css 58KB
layer.css 14KB
layui.mobile.css 10KB
laydate.css 7KB
code.css 1KB
upload.css 1013B
login.css 688B
register.css 632B
applyinfo.css 358B
allocate.css 207B
baseinfo.css 133B
iconfont.eot 38KB
lato-bold.eot 31KB
lato-regular.eot 30KB
lato-black.eot 30KB
lato-bolditalic.eot 30KB
lato-light.eot 29KB
lato-italic.eot 29KB
flat-ui-icons-regular.eot 25KB
glyphicons-halflings-regular.eot 20KB
59.gif 10KB
22.gif 10KB
24.gif 8KB
13.gif 7KB
16.gif 7KB
39.gif 6KB
64.gif 6KB
63.gif 6KB
50.gif 6KB
loading-0.gif 6KB
4.gif 6KB
1.gif 5KB
42.gif 5KB
71.gif 5KB
21.gif 5KB
20.gif 5KB
29.gif 5KB
70.gif 4KB
5.gif 4KB
17.gif 4KB
27.gif 4KB
9.gif 4KB
44.gif 4KB
11.gif 4KB
8.gif 4KB
3.gif 4KB
23.gif 4KB
34.gif 4KB
41.gif 4KB
38.gif 4KB
65.gif 3KB
32.gif 3KB
45.gif 3KB
7.gif 3KB
12.gif 3KB
26.gif 3KB
60.gif 3KB
2.gif 3KB
40.gif 3KB
25.gif 3KB
19.gif 3KB
66.gif 3KB
18.gif 3KB
46.gif 3KB
10.gif 3KB
28.gif 3KB
51.gif 3KB
57.gif 3KB
67.gif 3KB
0.gif 3KB
48.gif 3KB
43.gif 3KB
30.gif 2KB
61.gif 2KB
33.gif 2KB
69.gif 2KB
14.gif 2KB
47.gif 2KB
36.gif 2KB
49.gif 2KB
58.gif 2KB
6.gif 2KB
54.gif 2KB
53.gif 2KB
56.gif 2KB
62.gif 2KB
31.gif 2KB
55.gif 2KB
35.gif 2KB
15.gif 2KB
loading-2.gif 2KB
37.gif 1KB
68.gif 1KB
52.gif 777B
loading-1.gif 701B
共 303 条
- 1
- 2
- 3
- 4
资源评论
奋斗奋斗再奋斗的ajie
- 粉丝: 231
- 资源: 2166
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- HTML+CSS制作的个人博客网页.zip
- IMG_20240521_094903.jpg
- 基于htmlde 爱心代码,但HTML网页源码.zip
- 51单片机实现LED流水灯
- 基于Python的obEspoir分布式游戏框架设计源码
- 基于python的机械设计实用计算器,可计算电动机,传动装置,V带轮,齿轮,轴,轴承的几何或者力,运动学参数数值+源码+开发文档
- 基于HTML +JavaScript的元旦倒计时代码.docx
- 【Unity资源免费分享】孩子益智小游戏unity 5x系列Baby Doll House Cleaning
- 【资源免费分享】集市游戏(uniyt案例)
- 数据整理结果 2023-12-7 192544 6.dta
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功