增加文件前缀和后缀的设置,修缮部分代码规范

This commit is contained in:
2018-04-25 21:09:10 +08:00
parent ea9aa04a20
commit 53989d5502
18 changed files with 251 additions and 184 deletions

View File

@@ -5,7 +5,7 @@
<groupId>com.fjy</groupId> <groupId>com.fjy</groupId>
<artifactId>spring</artifactId> <artifactId>spring</artifactId>
<version>V2.6.8</version> <version>V2.7</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>spring</name> <name>spring</name>

View File

@@ -127,6 +127,7 @@ public class DataController {
/** /**
* 存储密保问题 * 存储密保问题
*
* @param userque * @param userque
* @return * @return
*/ */
@@ -139,6 +140,7 @@ public class DataController {
/** /**
* 判断密保问题是否正确正确返回true错误返回false其余反馈异常对象 * 判断密保问题是否正确正确返回true错误返回false其余反馈异常对象
*
* @param name * @param name
* @param question * @param question
* @param answer * @param answer
@@ -153,10 +155,11 @@ public class DataController {
if (!userque.isPresent()) { if (!userque.isPresent()) {
throw new UserException(ResultEnum.EMPTY_QUESTION); throw new UserException(ResultEnum.EMPTY_QUESTION);
} else if (question.equals(userque.get().getQuestion())) { } else if (question.equals(userque.get().getQuestion())) {
if(new BigInteger(CodingUtil.encryptSHA(answer.getBytes())).toString(32).equals(userque.get().getAnswer())) if (new BigInteger(CodingUtil.encryptSHA(answer.getBytes())).toString(32).equals(userque.get().getAnswer())) {
return true; return true;
else } else {
return false; return false;
}
} else { } else {
throw new UserException(ResultEnum.QUESTION_ERROR); throw new UserException(ResultEnum.QUESTION_ERROR);
} }
@@ -195,9 +198,9 @@ public class DataController {
notice.setIssueTime(dateNowStr); notice.setIssueTime(dateNowStr);
notice.setNoticeContent(content); notice.setNoticeContent(content);
return noticeService.addOne(notice) != null; return noticeService.addOne(notice) != null;
}else } else {
return false; return false;
}
} }
@PostMapping("/home/admin/addoneversion") @PostMapping("/home/admin/addoneversion")

View File

@@ -46,8 +46,9 @@ public class DownLoadController {
@ResponseBody @ResponseBody
public List<TbFile> toDownloadAll() { public List<TbFile> toDownloadAll() {
List<TbFile> files = fileService.findAllFile();//此处做空指针判断并抛出错误 List<TbFile> files = fileService.findAllFile();//此处做空指针判断并抛出错误
if (files != null) if (files != null) {
return files; return files;
}
new UserException(ResultEnum.EMPTY_DATA); new UserException(ResultEnum.EMPTY_DATA);
return null; return null;
} }
@@ -59,8 +60,9 @@ public class DownLoadController {
//log.info(user.toString()); //log.info(user.toString());
List<TbFile> files = fileService.findByColuserid(user.getColuserid()); List<TbFile> files = fileService.findByColuserid(user.getColuserid());
//此处做空指针判断并抛出错误 //此处做空指针判断并抛出错误
if (files != null) if (files != null) {
return files; return files;
}
new UserException(ResultEnum.EMPTY_DATA); new UserException(ResultEnum.EMPTY_DATA);
return null; return null;
} }
@@ -103,14 +105,15 @@ public class DownLoadController {
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} finally { } finally {
if (bis != null) if (bis != null) {
try { try {
bis.close(); bis.close();
} catch (IOException e) { } catch (IOException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} }
if (bos != null) }
if (bos != null) {
try { try {
bos.close(); bos.close();
} catch (IOException e) { } catch (IOException e) {
@@ -118,6 +121,7 @@ public class DownLoadController {
e.printStackTrace(); e.printStackTrace();
} }
} }
}
return null; return null;
} }
@@ -184,9 +188,15 @@ public class DownLoadController {
} finally { } finally {
//关闭流 //关闭流
try { try {
if (null != bufferStream) bufferStream.close(); if (null != bufferStream) {
if (null != zipStream) zipStream.close(); bufferStream.close();
if (null != zipSource) zipSource.close(); }
if (null != zipStream) {
zipStream.close();
}
if (null != zipSource) {
zipSource.close();
}
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
@@ -209,14 +219,15 @@ public class DownLoadController {
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} finally { } finally {
if (bis != null) if (bis != null) {
try { try {
bis.close(); bis.close();
} catch (IOException e) { } catch (IOException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} }
if (bos != null) }
if (bos != null) {
try { try {
bos.close(); bos.close();
} catch (IOException e) { } catch (IOException e) {
@@ -225,6 +236,7 @@ public class DownLoadController {
} }
} }
} }
}
/** /**
* 获取目录下所有文件的路径 * 获取目录下所有文件的路径

View File

@@ -63,8 +63,9 @@ public class RegisterController {
@ResponseBody @ResponseBody
public boolean doCheckStudentNo(@RequestParam(value = "studentno") String studentno){ public boolean doCheckStudentNo(@RequestParam(value = "studentno") String studentno){
TbStudentlist studentlist = studentService.findStudentByNo(studentno); TbStudentlist studentlist = studentService.findStudentByNo(studentno);
if (studentlist!=null) if (studentlist!=null) {
return true; return true;
}
return false; return false;
} }
@@ -73,8 +74,9 @@ public class RegisterController {
public boolean doCheckStudent(@RequestParam(value = "studentno") String studentno, public boolean doCheckStudent(@RequestParam(value = "studentno") String studentno,
@RequestParam(value = "realname") String realname){ @RequestParam(value = "realname") String realname){
TbStudentlist studentlist = studentService.findByColstudentnoAndColrealname(studentno,realname); TbStudentlist studentlist = studentService.findByColstudentnoAndColrealname(studentno,realname);
if (studentlist!=null&&studentlist.getRegistered()!= RegisteredEnum.REGISTERED.getCode()) if (studentlist!=null&&studentlist.getRegistered()!= RegisteredEnum.REGISTERED.getCode()) {
return true; return true;
}
return false; return false;
} }
@@ -87,8 +89,9 @@ public class RegisterController {
@ResponseBody @ResponseBody
public boolean doUserName(@RequestParam(value = "name") String name){ public boolean doUserName(@RequestParam(value = "name") String name){
Optional<TbUser> user = userService.findByColname(name); Optional<TbUser> user = userService.findByColname(name);
if (user.isPresent()) if (user.isPresent()) {
return false; return false;
}
return true; return true;
} }

View File

@@ -1,11 +1,13 @@
package com.fjy.spring.controller; package com.fjy.spring.controller;
import com.fjy.spring.constant.GlobalConstant; import com.fjy.spring.constant.GlobalConstant;
import com.fjy.spring.domain.Homework;
import com.fjy.spring.domain.TbFile; import com.fjy.spring.domain.TbFile;
import com.fjy.spring.domain.TbLog; import com.fjy.spring.domain.TbLog;
import com.fjy.spring.domain.TbUser; import com.fjy.spring.domain.TbUser;
import com.fjy.spring.properties.ServerProperties; import com.fjy.spring.properties.ServerProperties;
import com.fjy.spring.service.FileService; import com.fjy.spring.service.FileService;
import com.fjy.spring.service.HomeworkService;
import com.fjy.spring.service.LogService; import com.fjy.spring.service.LogService;
import com.fjy.spring.untils.FormatFileSizeUtil; import com.fjy.spring.untils.FormatFileSizeUtil;
import com.fjy.spring.untils.GetIPAddrUtil; import com.fjy.spring.untils.GetIPAddrUtil;
@@ -31,11 +33,20 @@ import java.util.Map;
@Slf4j @Slf4j
public class UpLoadController { public class UpLoadController {
/**
* 服务器配置信息
*/
@Autowired @Autowired
private ServerProperties serverProperties;//服务器配置信息 private ServerProperties serverProperties;
/**
* 文件相关数据库操作
*/
@Autowired
private FileService fileService;
@Autowired @Autowired
private FileService fileService;//文件相关数据库操作 private HomeworkService homeworkService;
@Autowired @Autowired
private LogService logService; private LogService logService;
@@ -79,20 +90,22 @@ public class UpLoadController {
* 存储文件信息 * 存储文件信息
*/ */
TbFile file = new TbFile(); TbFile file = new TbFile();
file.setColfilesize(new FormatFileSizeUtil().GetFileSize(imageFile.getSize())); file.setColfilesize(FormatFileSizeUtil.GetFileSize(imageFile.getSize()));
file.setColfilename(filename); file.setColfilename(filename);
file.setColfilepath(uploadUrl + filename); file.setColfilepath(uploadUrl + filename);
file.setColip(request.getRemoteAddr()); file.setColip(request.getRemoteAddr());
file.setColuserid(user.getColuserid()); file.setColuserid(user.getColuserid());
if (fileService.addFile(file)) if (fileService.addFile(file)) {
log.info("记录写入数据库成功"); log.info("记录写入数据库成功");
}
//System.out.println("记录写入数据库成功"); //System.out.println("记录写入数据库成功");
else else {
log.error("记录写入数据库失败"); log.error("记录写入数据库失败");
}
//System.out.println("记录写入数据库失败"); //System.out.println("记录写入数据库失败");
log.info("文件上传到: " + uploadUrl + filename); log.info("文件上传到: " + uploadUrl + filename);
log.info("文件大小: " + new FormatFileSizeUtil().GetFileSize(imageFile.getSize())); log.info("文件大小: " + FormatFileSizeUtil.GetFileSize(imageFile.getSize()));
log.info("文件名: " + filename); log.info("文件名: " + filename);
File targetFile = new File(uploadUrl + filename); File targetFile = new File(uploadUrl + filename);
@@ -130,6 +143,7 @@ public class UpLoadController {
public void moreUpload(HttpServletRequest request, public void moreUpload(HttpServletRequest request,
@RequestParam(value = "courseName", required = false) String courseName, @RequestParam(value = "courseName", required = false) String courseName,
@RequestParam(value = "folder", required = false) String folder, @RequestParam(value = "folder", required = false) String folder,
@RequestParam(value = "workid") Integer workId,
@RequestParam(value = "rename", required = true) boolean rename) { @RequestParam(value = "rename", required = true) boolean rename) {
MultipartHttpServletRequest multipartHttpServletRequest = (MultipartHttpServletRequest) request; MultipartHttpServletRequest multipartHttpServletRequest = (MultipartHttpServletRequest) request;
@@ -158,13 +172,21 @@ public class UpLoadController {
List<String> fileList = new ArrayList<String>(); List<String> fileList = new ArrayList<String>();
for (MultipartFile file : files.values()) { for (MultipartFile file : files.values()) {
Homework homework = homeworkService.findById(workId);
String filePrefix = homework.getFilePrefix();
String fileSuffix = homework.getFileSuffix();
String filename = file.getOriginalFilename(); String filename = file.getOriginalFilename();
String suffix = "." + filename.substring(filename.lastIndexOf(".") + 1);//获取文件后缀
//获取文件后缀
String suffix = "." + filename.substring(filename.lastIndexOf(".") + 1);
TbFile tbFile = new TbFile(); TbFile tbFile = new TbFile();
String pathname; String pathname;
//文件重命名
if (rename) { if (rename) {
pathname = uploadUrl + user.getColstudentno() + user.getColrealname() + suffix; pathname = uploadUrl + filePrefix + user.getColstudentno() + user.getColrealname() + fileSuffix + suffix;
tbFile.setColfilename(user.getColstudentno() + user.getColrealname() + suffix); tbFile.setColfilename(filePrefix + user.getColstudentno() + user.getColrealname() + fileSuffix + suffix);
} else { } else {
pathname = uploadUrl + filename; pathname = uploadUrl + filename;
tbFile.setColfilename(filename); tbFile.setColfilename(filename);
@@ -183,10 +205,11 @@ public class UpLoadController {
TbFile file1 = fileService.findByFilepath(pathname); TbFile file1 = fileService.findByFilepath(pathname);
file1.setColfilepath(bakpathname + "." + dateNowStr2 + ".bak"); file1.setColfilepath(bakpathname + "." + dateNowStr2 + ".bak");
file1.setColfilename(file1.getColfilename() + "." + dateNowStr2 + ".bak"); file1.setColfilename(file1.getColfilename() + "." + dateNowStr2 + ".bak");
if (fileService.addFile(file1)) if (fileService.addFile(file1)) {
log.info("重命名文件数据库更新成功"); log.info("重命名文件数据库更新成功");
else } else {
log.error("重命名文件数据库更新失败"); log.error("重命名文件数据库更新失败");
}
File mvfile = new File(bakpathname + "." + dateNowStr2 + ".bak"); File mvfile = new File(bakpathname + "." + dateNowStr2 + ".bak");
try { try {
FileUtils.moveFile(targetFile, mvfile); FileUtils.moveFile(targetFile, mvfile);
@@ -197,14 +220,15 @@ public class UpLoadController {
} }
log.info("文件上传到: " + uploadUrl + filename); log.info("文件上传到: " + uploadUrl + filename);
log.info("文件大小: " + new FormatFileSizeUtil().GetFileSize(file.getSize())); log.info("文件大小: " + FormatFileSizeUtil.GetFileSize(file.getSize()));
log.info("文件名: " + filename); log.info("文件名: " + filename);
tbFile.setColfilesize(new FormatFileSizeUtil().GetFileSize(file.getSize())); tbFile.setColfilesize(FormatFileSizeUtil.GetFileSize(file.getSize()));
tbFile.setColtime(dateNowStr); tbFile.setColtime(dateNowStr);
tbFile.setColrealname(filename); tbFile.setColrealname(filename);
tbFile.setColfilepath(pathname);//文件自动学号+姓名命名 //文件自动学号+姓名命名
tbFile.setColfilepath(pathname);
tbFile.setColip(request.getRemoteAddr()); tbFile.setColip(request.getRemoteAddr());
tbFile.setColuserid(user.getColuserid()); tbFile.setColuserid(user.getColuserid());
tbFile.setCourseName(courseName); tbFile.setCourseName(courseName);
@@ -217,10 +241,11 @@ public class UpLoadController {
logs.setColheader(user.getColname() + "上传了'" + filename + "'文件"); logs.setColheader(user.getColname() + "上传了'" + filename + "'文件");
logService.addLogRec(logs); logService.addLogRec(logs);
if (fileService.addFile(tbFile)) if (fileService.addFile(tbFile)) {
log.info("记录写入数据库成功"); log.info("记录写入数据库成功");
else } else {
log.error("记录写入数据库失败"); log.error("记录写入数据库失败");
}
if (!targetFile.exists()) { if (!targetFile.exists()) {
try { try {

View File

@@ -30,4 +30,10 @@ public class Homework {
@Column(name = "workremark") @Column(name = "workremark")
private String Remark; private String Remark;
@Column(name = "pre")
private String filePrefix;
@Column(name = "suf")
private String fileSuffix;
} }

View File

@@ -24,7 +24,8 @@ public class AdminInterceptor implements HandlerInterceptor {
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
TbUser user = (TbUser)request.getSession().getAttribute(GlobalConstant.USER_SESSION_KEY); TbUser user = (TbUser)request.getSession().getAttribute(GlobalConstant.USER_SESSION_KEY);
//log.info(user.getColuserid()+""); //log.info(user.getColuserid()+"");
if (adminService == null) {//解决service为null无法注入问题 //解决service为null无法注入问题
if (adminService == null) {
BeanFactory factory = WebApplicationContextUtils.getRequiredWebApplicationContext(request.getServletContext()); BeanFactory factory = WebApplicationContextUtils.getRequiredWebApplicationContext(request.getServletContext());
adminService = (AdminService) factory.getBean("adminService"); adminService = (AdminService) factory.getBean("adminService");
} }
@@ -33,8 +34,9 @@ public class AdminInterceptor implements HandlerInterceptor {
if (!admin.isPresent()){ if (!admin.isPresent()){
response.sendRedirect("/cms/home"); response.sendRedirect("/cms/home");
return false; return false;
}else }else {
return true; return true;
} }
}
} }

View File

@@ -15,15 +15,17 @@ public class FileService {
public boolean addFile(TbFile tbFile) { public boolean addFile(TbFile tbFile) {
TbFile file = tbFileRepository.save(tbFile); TbFile file = tbFileRepository.save(tbFile);
if (file != null) if (file != null) {
return true; return true;
}
return false; return false;
} }
public List<TbFile> findFile(TbFile tbFile){ public List<TbFile> findFile(TbFile tbFile){
List<TbFile> files = tbFileRepository.findByColfilename(tbFile.getColfilename()); List<TbFile> files = tbFileRepository.findByColfilename(tbFile.getColfilename());
if (files!=null) if (files!=null) {
return files; return files;
}
return null; return null;
} }

View File

@@ -2,13 +2,13 @@ package com.fjy.spring.service;
import com.fjy.spring.domain.Homework; import com.fjy.spring.domain.Homework;
import com.fjy.spring.domain.VHomework; import com.fjy.spring.domain.VHomework;
import com.fjy.spring.domain.VWorkDetail;
import com.fjy.spring.repository.HomeworkRepository; import com.fjy.spring.repository.HomeworkRepository;
import com.fjy.spring.repository.VHomeworkRepository; import com.fjy.spring.repository.VHomeworkRepository;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
import java.util.Optional;
@Service @Service
public class HomeworkService { public class HomeworkService {
@@ -25,4 +25,12 @@ public class HomeworkService {
public List<VHomework> findAllVHomework(){ public List<VHomework> findAllVHomework(){
return vHomeworkRepository.findAll(); return vHomeworkRepository.findAll();
} }
public Homework findById(Integer id){
Optional<Homework> homework = homeworkRepository.findById(id);
if (homework.isPresent()){
return (Homework)homework.get();
}
return null;
}
} }

View File

@@ -81,8 +81,9 @@ public class UserService {
public boolean addUserQue(TbUserque userque) { public boolean addUserQue(TbUserque userque) {
TbUserque tbUserque = userqueRepository.save(userque); TbUserque tbUserque = userqueRepository.save(userque);
if (tbUserque != null) if (tbUserque != null) {
return true; return true;
}
return false; return false;
} }

View File

@@ -1,4 +1,4 @@
#控制配置文件调用 #控制配置文件调用
spring: spring:
profiles: profiles:
active: prod active: dev

View File

@@ -25,8 +25,8 @@
<!--滚动策略--> <!--滚动策略-->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!--路径文件名,文件名包含时间--> <!--路径文件名,文件名包含时间-->
<!--<fileNamePattern>F:\JAVA Workspace\Temp\log\%d\info.%d.log</fileNamePattern>--> <fileNamePattern>F:\JAVA Workspace\Temp\log\%d\info.%d.log</fileNamePattern>
<fileNamePattern>/www/cmsfile/%d/info.%d.log</fileNamePattern> <!--<fileNamePattern>/www/cmsfile/%d/info.%d.log</fileNamePattern>-->
</rollingPolicy> </rollingPolicy>
</appender> </appender>
@@ -44,8 +44,8 @@
<!--滚动策略--> <!--滚动策略-->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!--路径文件名,文件名包含时间--> <!--路径文件名,文件名包含时间-->
<!--<fileNamePattern>F:\JAVA Workspace\Temp\log\error.%d.log</fileNamePattern>--> <fileNamePattern>F:\JAVA Workspace\Temp\log\error.%d.log</fileNamePattern>
<fileNamePattern>/www/cmsfile/%d/error.%d.log</fileNamePattern> <!--<fileNamePattern>/www/cmsfile/%d/error.%d.log</fileNamePattern>-->
</rollingPolicy> </rollingPolicy>
</appender> </appender>

View File

@@ -3,6 +3,7 @@ var month = dt.getMonth() + 1;
var day = dt.getDate(); var day = dt.getDate();
var year = dt.getFullYear(); var year = dt.getFullYear();
var cur = year + '-' + month + '-' + day; var cur = year + '-' + month + '-' + day;
function DateDiff(sDate1, sDate2) { //sDate1和sDate2是2002-12-18格式 function DateDiff(sDate1, sDate2) { //sDate1和sDate2是2002-12-18格式
var aDate, oDate1, oDate2, iDays var aDate, oDate1, oDate2, iDays
aDate = sDate1.split("-") aDate = sDate1.split("-")
@@ -12,9 +13,11 @@ function DateDiff(sDate1, sDate2) { //sDate1和sDate2是2002-12-18格式
iDays = parseInt(Math.abs(oDate1 - oDate2) / 1000 / 60 / 60 / 24) //把相差的毫秒数转换为天数 iDays = parseInt(Math.abs(oDate1 - oDate2) / 1000 / 60 / 60 / 24) //把相差的毫秒数转换为天数
return iDays return iDays
} }
function displayStyle(id, type) { function displayStyle(id, type) {
document.getElementById(id).style.display = type; document.getElementById(id).style.display = type;
} }
var Main = { var Main = {
data() { data() {
var checkName = (rule, value, callback) => { var checkName = (rule, value, callback) => {
@@ -232,7 +235,7 @@ var Main = {
}); });
}, },
uploadURL(row) { uploadURL(row) {
return getRootPath_web()+"/home/moreUpload?courseName=" + row.coursename + "&folder=" + row.workfolder+"&rename=true"; return getRootPath_web() + "/home/moreUpload?courseName=" + row.coursename + "&folder=" + row.workfolder + "&workid=" + row.workid + "&rename=true";
}, },
limitTime(row) { limitTime(row) {
@@ -293,7 +296,9 @@ var Main = {
let that = this; let that = this;
this.$refs.upload.submit(); this.$refs.upload.submit();
this.openNotiSuccess("成功", "文件上传成功!"); this.openNotiSuccess("成功", "文件上传成功!");
setTimeout(function () {that.getFileList();},1000); setTimeout(function () {
that.getFileList();
}, 1000);
}, },
handleRemove(file, fileList) { handleRemove(file, fileList) {
console.log(file, fileList); console.log(file, fileList);

View File

@@ -6,7 +6,7 @@ import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.junit4.SpringRunner;
/*
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@SpringBootTest @SpringBootTest
@Slf4j @Slf4j
@@ -22,4 +22,4 @@ public class LoggerTest {
log.error("error..."); log.error("error...");
} }
} }
*/

View File

@@ -12,7 +12,7 @@ import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
import javax.transaction.Transactional; import javax.transaction.Transactional;
/*
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@SpringBootTest @SpringBootTest
@AutoConfigureMockMvc @AutoConfigureMockMvc
@@ -21,11 +21,11 @@ public class DataControllerTest {
@Autowired @Autowired
private MockMvc mvc; private MockMvc mvc;
*/
/** /**
* 使用此单元测试前要注销拦截器,否则测试不通过 * 使用此单元测试前要注销拦截器,否则测试不通过
* @throws Exception * @throws Exception
*//* */
@Test @Test
@Transactional @Transactional
@@ -37,11 +37,11 @@ public class DataControllerTest {
.andExpect(MockMvcResultMatchers.content().string("true")); .andExpect(MockMvcResultMatchers.content().string("true"));
} }
*/
/** /**
* 测试找回密码 * 测试找回密码
* @throws Exception * @throws Exception
*//* */
@Test @Test
public void findUserQue() throws Exception { public void findUserQue() throws Exception {
@@ -82,11 +82,11 @@ public class DataControllerTest {
"}")); "}"));
} }
*/
/**
* 测试忘记密码操作 /* * 测试忘记密码操作
* @throws Exception * @throws Exception
*//* */
@Test @Test
@Transactional @Transactional
@@ -98,4 +98,4 @@ public class DataControllerTest {
.param("password", "admin")) .param("password", "admin"))
.andExpect(MockMvcResultMatchers.content().string("true")); .andExpect(MockMvcResultMatchers.content().string("true"));
} }
}*/ }

View File

@@ -12,7 +12,7 @@ import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
import static org.junit.Assert.*; import static org.junit.Assert.*;
/*
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@SpringBootTest @SpringBootTest
@AutoConfigureMockMvc @AutoConfigureMockMvc
@@ -40,4 +40,4 @@ public class LoginControllerTest {
" \"data\": null\n" + " \"data\": null\n" +
"}")); "}"));
} }
}*/ }

View File

@@ -12,7 +12,7 @@ import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
import static org.junit.Assert.*; import static org.junit.Assert.*;
/*
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@SpringBootTest @SpringBootTest
@AutoConfigureMockMvc @AutoConfigureMockMvc
@@ -74,4 +74,4 @@ public class RegisterControllerTest {
.param("name","root1")) .param("name","root1"))
.andExpect(MockMvcResultMatchers.content().string("true")); .andExpect(MockMvcResultMatchers.content().string("true"));
} }
}*/ }

View File

@@ -11,7 +11,7 @@ import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import org.springframework.test.web.servlet.result.MockMvcResultMatchers; import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
import static org.junit.Assert.*; import static org.junit.Assert.*;
/*
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@SpringBootTest @SpringBootTest
@AutoConfigureMockMvc @AutoConfigureMockMvc
@@ -39,4 +39,4 @@ public class TestControllerTest {
mvc.perform(MockMvcRequestBuilders.get("/test/id/1")) mvc.perform(MockMvcRequestBuilders.get("/test/id/1"))
.andExpect(MockMvcResultMatchers.status().isOk()); .andExpect(MockMvcResultMatchers.status().isOk());
} }
}*/ }