package com.xupt.controller_admin;
import com.xupt.service_admin.AdminTestAnswerService;
import com.xupt.service_admin.AdminTestPaperService;
import com.xupt.service_admin.AdminTestTitleService;
import com.xupt.util.*;
import com.xupt.vo_admin.*;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartRequest;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;
@Controller
@RequestMapping("/mapis/test")
public class AdminTestPaperController {
@Resource
AdminTestPaperService adminTestPaperService;
@Resource
AdminTestTitleService adminTestTitleService;
@Resource
AdminTestAnswerService adminTestAnswerService;
@RequestMapping(path = "/getTestList",method = RequestMethod.POST)
@ResponseBody
public AdminTestPapersState getTestList(HttpServletRequest request){
String jsonString = Utils.getRequestBody(request);
JSONObject obj = JSONObject.fromObject(jsonString);
AdminTestPapersState adminTestPapersState = new AdminTestPapersState();
AdminPageBean adminPageBean = new AdminPageBean(Integer.parseInt(obj.getString("page")),10);
List<AdminTestPaper> testPapers = adminTestPaperService.getTestList(adminPageBean);
if(testPapers != null){
adminTestPapersState.setState(1);
adminTestPapersState.setMsg("成功");
adminTestPapersState.setList(testPapers);
}else{
adminTestPapersState.setState(0);
adminTestPapersState.setMsg("失败");
adminTestPapersState.setList(null);
}
return adminTestPapersState;
}
@RequestMapping(path = "/getTestById",method = RequestMethod.POST)
@ResponseBody
public AdminTestPaperState getTestById(HttpServletRequest request){
String jsonString = Utils.getRequestBody(request);
JSONObject obj = JSONObject.fromObject(jsonString);
AdminTestPaperState adminTestPaperState = new AdminTestPaperState();
AdminTestPaper2 adminTestPaper2 = adminTestPaperService.getTestById(Integer.parseInt(obj.getString("testId")));
if(adminTestPaper2 != null){
adminTestPaperState.setState(1);
adminTestPaperState.setMsg("成功");
adminTestPaperState.setList(adminTestPaper2);
}else{
adminTestPaperState.setState(0);
adminTestPaperState.setMsg("失败");
adminTestPaperState.setList(null);
}
return adminTestPaperState;
}
@RequestMapping(path = "/addTestPaper",method = RequestMethod.POST)
@ResponseBody
public AdminAddTeatPaperState addTestPaper(HttpServletRequest request){
AdminTestPaper2 paper = new AdminTestPaper2();
paper.setTypeId(Utils.getParameter(request,"typeId",Integer.class));
paper.setTest_name(Utils.getParameter(request,"test_name",String.class));
MultipartRequest req = (MultipartRequest)request;
MultipartFile mfile = req.getFile("picture_addr");
if(mfile != null){
String fileName = Utils.getFileId(mfile.getOriginalFilename());
String picture_addr = QiNiuUtils.uploadFile(mfile,fileName,0);
paper.setPicture_addr(picture_addr);
}
AdminAddTeatPaperState adminAddTeatPaperState = new AdminAddTeatPaperState();
Integer num = adminTestPaperService.addTestPaper(paper);
if (num != null) {
adminAddTeatPaperState.setState(1);
adminAddTeatPaperState.setMsg("成功");
adminAddTeatPaperState.setTestId(paper.getTest_id());
} else {
adminAddTeatPaperState.setState(0);
adminAddTeatPaperState.setMsg("失败");
adminAddTeatPaperState.setTestId(null);
}
return adminAddTeatPaperState;
}
@RequestMapping(path = "/editTestPaper",method = RequestMethod.POST)
@ResponseBody
public State editTestPaper(HttpServletRequest request){
AdminTestPaper2 paper = new AdminTestPaper2();
paper.setTest_id(Utils.getParameter(request,"test_id",Integer.class));
paper.setTypeId(Utils.getParameter(request,"typeId",Integer.class));
paper.setTest_name(Utils.getParameter(request,"test_name",String.class));
paper.setPicture_addr(Utils.getParameter(request,"picture_addr",String.class));
MultipartRequest req = (MultipartRequest)request;
MultipartFile mfile = req.getFile("picture_addr");
if(mfile != null){
String fileName = Utils.getFileId(mfile.getOriginalFilename());
String picture_addr = QiNiuUtils.uploadFile(mfile,fileName,0);
paper.setPicture_addr(picture_addr);
}
State state = new State();
Integer num = adminTestPaperService.editTestPaper(paper);
if(num != null){
state.setState(1);
state.setMsg("成功");
}else{
state.setState(0);
state.setMsg("失败");
}
return state;
}
@RequestMapping(path = "/getQuestions",method = RequestMethod.POST)
@ResponseBody
public AdminTestTitlesState getQuestions(HttpServletRequest request){
String jsonString = Utils.getRequestBody(request);
JSONObject obj = JSONObject.fromObject(jsonString);
AdminTestTitlesState adminTestTitlesState = new AdminTestTitlesState();
List<AdminTestTitle> titles = adminTestTitleService.getQuestions(Integer.parseInt(obj.getString("testId")));
if(titles != null){
adminTestTitlesState.setState(1);
adminTestTitlesState.setMsg("成功");
adminTestTitlesState.setList(titles);
}else{
adminTestTitlesState.setState(0);
adminTestTitlesState.setMsg("失败");
adminTestTitlesState.setList(null);
}
return adminTestTitlesState;
}
@RequestMapping(path = "/addQuestions",method = RequestMethod.POST)
@ResponseBody
@Transactional
public State addQuestions(HttpServletRequest request){
String jsonString = Utils.getRequestBody(request);
JSONObject obj = JSONObject.fromObject(jsonString);
State state = new State();
AdminTestTitle adminTestTitle = null;
JSONArray arr = obj.getJSONArray("questions");
if(arr != null){
Integer testId = Integer.parseInt(obj.getString("testId"));
for (int i=0;i<arr.size();i++){
adminTestTitle = new AdminTestTitle();
adminTestTitle.setTest_id(testId);
adminTestTitle.setTitle_name(arr.getJSONObject(i).getString("title_name"));
adminTestTitle.setChoose_one(arr.getJSONObject(i).getString("choose_one"));
adminTestTitle.setChoose_two(arr.getJSONObject(i).getString("choose_two"));
adminTestTitle.setChoose_three(arr.getJSONObject(i).getString("choose_three"));
adminTestTitle.setChoose_four(arr.getJSONObject(i).getString("choose_four"));
Integer num = adminTestTitleService.addQuestions(adminTestTitle);
if(num != null){
state.setState(1);
state.setMsg("成功");
}else{
state.setState(0);
state.setMsg("失败");
break;
}
}
}else{
state.setState(0);
state.setMsg("失败");
}
retu
没有合适的资源?快使用搜索试试~ 我知道了~
毕设:心理健康管理子系统(SSM+Tomcat+Vue.js+七牛云服务).zip
共221个文件
java:95个
xml:75个
js:28个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 155 浏览量
2023-10-20
18:05:47
上传
评论 1
收藏 11.88MB ZIP 举报
温馨提示
毕设:心理健康管理子系统(SSM+Tomcat+Vue.js+七牛云服务).zip 1、该资源内项目代码经过严格调试,下载即用确保可以运行! 2、该资源适合计算机相关专业(如计科、人工智能、大数据、数学、电子信息等)正在做课程设计、期末大作业和毕设项目的学生、或者相关技术学习者作为学习资料参考使用。 3、该资源包括全部源码,需要具备一定基础才能看懂并调试代码。 毕设:心理健康管理子系统(SSM+Tomcat+Vue.js+七牛云服务).zip 1、该资源内项目代码经过严格调试,下载即用确保可以运行! 2、该资源适合计算机相关专业(如计科、人工智能、大数据、数学、电子信息等)正在做课程设计、期末大作业和毕设项目的学生、或者相关技术学习者作为学习资料参考使用。 3、该资源包括全部源码,需要具备一定基础才能看懂并调试代码。 毕设:心理健康管理子系统(SSM+Tomcat+Vue.js+七牛云服务).zip 1、该资源内项目代码经过严格调试,下载即用确保可以运行! 2、该资源适合计算机相关专业(如计科、人工智能、大数据、数学、电子信息等)正在做课程设计、期末大作业和毕设项目的学生、或者相关
资源推荐
资源详情
资源评论
收起资源包目录
毕设:心理健康管理子系统(SSM+Tomcat+Vue.js+七牛云服务).zip (221个子文件)
app.260fd38757c8d00ad9ef739ca97bb2c9.css 140KB
index.css 124KB
datasource.css 4KB
main.css 2KB
color-green.css 673B
color-dark.css 247B
index.html 583B
heart_admin.iml 7KB
AdminTestPaperController.java 18KB
AdminArticleController.java 13KB
AdminMusicController.java 10KB
AdminForumController.java 9KB
Utils.java 4KB
QiNiuUtils.java 4KB
AdminUserController.java 3KB
AdminTestRecordController.java 2KB
AdminArticle2.java 2KB
AdminMusic.java 2KB
AdminArticle3.java 2KB
AdminMusic3.java 2KB
AdminArticle.java 2KB
AdminMusic2.java 2KB
AdminController.java 2KB
AdminTestPaperServiceImpl.java 2KB
AdminForum.java 2KB
AdminArticleServiceImpl.java 2KB
AdminTestTitle.java 2KB
AdminTestPaperService.java 1KB
AdminTestPaperDao.java 1KB
AdminMusicServiceImpl.java 1KB
AdminArticleService.java 1KB
AdminArticleDao.java 1KB
AdminMusicService.java 1KB
AdminMusicDao.java 1KB
AdminUser.java 1KB
AdminFmlComment.java 1KB
AdminAmlComment.java 1KB
AdminForumServiceImpl.java 1KB
AdminTestAnswer.java 1KB
AdminTestPaper.java 1KB
AdminForumService.java 1KB
AdminForumDao.java 1KB
AdminAnswer.java 1KB
AdminUserTestRecord.java 1KB
AdminTestPaper2.java 999B
AdminTestTitleServiceImpl.java 945B
AdminPageBean.java 865B
AdminArticleComment.java 842B
AdminForumComment.java 840B
AdminTestPaperType.java 839B
AdminTestAnswerServiceImpl.java 817B
AdminArticleType.java 806B
AdminTestPapersState.java 803B
Admin.java 785B
AdminForumsState.java 784B
AdminMusicsState.java 784B
AdminMusicType.java 783B
AdminForumType.java 783B
AdminUsersState.java 778B
AdminArticleCommentServiceImpl.java 761B
AdminTestTitleService.java 740B
AdminForumCommentServiceImpl.java 737B
AdminTestTitleDao.java 732B
AdminArticlesState.java 720B
AdminAmlCommentServiceImpl.java 716B
AdminTestRecordServiceImpl.java 712B
AdminUserServiceImpl.java 712B
AdminFmlCommentServiceImpl.java 712B
AdminUserDao.java 696B
AdminArticleCommentState.java 662B
AdminTestRecordsState.java 659B
AdminTestPaperTypesState.java 658B
AdminMoreLevelArticleComState.java 651B
AdminForumCommsState.java 651B
AdminArticleTypesState.java 648B
AdminMLFmlCommentState.java 644B
AdminTestTitlesState.java 639B
AdminMusicTypesState.java 638B
AdminForumTypesState.java 638B
AdminTestAnswerService.java 625B
AdminTestAnswerDao.java 616B
AdminTestAnswersState.java 602B
AdminTestPaperState.java 599B
AdminArticleState.java 585B
AdminMusicState.java 579B
AdminAddArticleState.java 568B
AdminMusicAddState.java 552B
AdminAddTeatPaperState.java 549B
AdminArticleCommentService.java 498B
AdminAmlCommentService.java 491B
AdminFmlCommentService.java 489B
AdminArticleCommentDao.java 488B
AdminForumCommentService.java 484B
AdminAmlCommentDao.java 483B
AdminFmlCommentDao.java 479B
AdminTestRecordService.java 476B
AdminForumCommentDao.java 475B
AdminTestRecordDao.java 468B
AdminUserService.java 463B
AdminServiceImpl.java 456B
共 221 条
- 1
- 2
- 3
资源评论
辣椒种子
- 粉丝: 4138
- 资源: 5738
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- MATLAB 图像处理:自动检测黑白像素比例的多功能代码(支持灰度和二值图像)
- windows平台下终端工具-tabby
- STM32和ucosii系统温度监控系统keil5工程
- HIVE-14706.01.patch
- C# WInForm IrisSkin2皮肤控件
- svn cleanup 失败怎么办
- Spring Boot集成Spring Security,HTTP请求授权配置:包含匿名访问、允许访问、禁止访问配置
- 易语言-画曲线模块及应用例程
- 电子元件行业知名厂商官网(TI/NXP/ST/Infineon/ADI/Microchip/Qualcomm/Diodes/Panasonic/TDK/TE/Vishay/Molex等)数据样例
- Cytoscape-3-10-0-windows-64bit.exe
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功