增加文件前缀和后缀的设置,修缮部分代码规范
This commit is contained in:
@@ -56,82 +56,83 @@ public class DataController {
|
||||
private HttpServletRequest httpServletRequest;
|
||||
|
||||
@GetMapping("/home/findAllHomework")
|
||||
public List<VWorkDetail> findAllHomework(){
|
||||
public List<VWorkDetail> findAllHomework() {
|
||||
List<VWorkDetail> homeworks = workDetailService.findAll();
|
||||
if (homeworks!=null){
|
||||
if (homeworks != null) {
|
||||
return homeworks;
|
||||
}
|
||||
throw new UserException(ResultEnum.EMPTY_DATA);
|
||||
}
|
||||
|
||||
@GetMapping("/home/findvlog")
|
||||
public List<VLog> findlog(){
|
||||
public List<VLog> findlog() {
|
||||
List<VLog> vlogs = logService.findvlog();
|
||||
if (vlogs!=null){
|
||||
if (vlogs != null) {
|
||||
return vlogs;
|
||||
}
|
||||
throw new UserException(ResultEnum.EMPTY_DATA);
|
||||
}
|
||||
|
||||
@GetMapping("/home/admin/findvfeedback")
|
||||
public List<VFeedBack> findAllVFeedback(){
|
||||
public List<VFeedBack> findAllVFeedback() {
|
||||
List<VFeedBack> feedBacks = feedBackService.findAllVFeedback();
|
||||
if (feedBacks!=null){
|
||||
if (feedBacks != null) {
|
||||
return feedBacks;
|
||||
}
|
||||
throw new UserException(ResultEnum.EMPTY_DATA);
|
||||
}
|
||||
|
||||
@GetMapping("/home/findvcourse")
|
||||
public List<VCourse> findVCourse(){
|
||||
public List<VCourse> findVCourse() {
|
||||
List<VCourse> vCourses = courseService.findAllVCourse();
|
||||
if (vCourses!=null){
|
||||
if (vCourses != null) {
|
||||
return vCourses;
|
||||
}
|
||||
throw new UserException(ResultEnum.EMPTY_DATA);
|
||||
}
|
||||
|
||||
@GetMapping("/home/admin/findalluser")
|
||||
public List<TbUser> findAllUser(){
|
||||
public List<TbUser> findAllUser() {
|
||||
List<TbUser> users = userService.findAllUser();
|
||||
if (users!=null){
|
||||
if (users != null) {
|
||||
return users;
|
||||
}
|
||||
throw new UserException(ResultEnum.EMPTY_DATA);
|
||||
}
|
||||
|
||||
@GetMapping("/home/findallvhomework")
|
||||
public List<VHomework> findAllVHomework(){
|
||||
public List<VHomework> findAllVHomework() {
|
||||
List<VHomework> vHomeworks = homeworkService.findAllVHomework();
|
||||
if (vHomeworks!=null){
|
||||
if (vHomeworks != null) {
|
||||
return vHomeworks;
|
||||
}
|
||||
throw new UserException(ResultEnum.EMPTY_DATA);
|
||||
}
|
||||
|
||||
@GetMapping("/home/admin/findStudentInCourseFile")
|
||||
public List<TbStudentlist> findStudentInCourseFile(
|
||||
@RequestParam(value = "Folder") String Folder,@RequestParam(value = "CourseName") String CourseName){
|
||||
List<TbStudentlist> files = vUserfileService.findStudentNoByWorkFolderAndCourseName(Folder,CourseName);
|
||||
if (files!=null){
|
||||
public List<TbStudentlist> findStudentInCourseFile(
|
||||
@RequestParam(value = "Folder") String Folder, @RequestParam(value = "CourseName") String CourseName) {
|
||||
List<TbStudentlist> files = vUserfileService.findStudentNoByWorkFolderAndCourseName(Folder, CourseName);
|
||||
if (files != null) {
|
||||
return files;
|
||||
}
|
||||
throw new UserException(ResultEnum.EMPTY_DATA);
|
||||
}
|
||||
|
||||
@GetMapping("/home/userinfo")
|
||||
public VUserinfo findUserInfo(){
|
||||
TbUser user= (TbUser)httpServletRequest.getSession().getAttribute(USER_SESSION_KEY);
|
||||
public VUserinfo findUserInfo() {
|
||||
TbUser user = (TbUser) httpServletRequest.getSession().getAttribute(USER_SESSION_KEY);
|
||||
return userService.findUserInfo(user.getColuserid());
|
||||
}
|
||||
|
||||
/**
|
||||
* 存储密保问题
|
||||
*
|
||||
* @param userque
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/home/adduserque")
|
||||
public boolean adduserque(TbUserque userque)throws Exception{
|
||||
public boolean adduserque(TbUserque userque) throws Exception {
|
||||
//对密保问题加密存储
|
||||
userque.setAnswer(new BigInteger(CodingUtil.encryptSHA(userque.getAnswer().getBytes())).toString(32));
|
||||
return userService.addUserQue(userque);
|
||||
@@ -139,6 +140,7 @@ public class DataController {
|
||||
|
||||
/**
|
||||
* 判断密保问题是否正确,正确返回true,错误返回false,其余反馈异常对象
|
||||
*
|
||||
* @param name
|
||||
* @param question
|
||||
* @param answer
|
||||
@@ -146,18 +148,19 @@ public class DataController {
|
||||
* @throws Exception
|
||||
*/
|
||||
@GetMapping("/finduserque")
|
||||
public boolean findUserQue(@RequestParam(value = "name")String name
|
||||
,@RequestParam(value = "question")String question
|
||||
,@RequestParam(value = "answer")String answer)throws Exception{
|
||||
public boolean findUserQue(@RequestParam(value = "name") String name
|
||||
, @RequestParam(value = "question") String question
|
||||
, @RequestParam(value = "answer") String answer) throws Exception {
|
||||
Optional<VUserque> userque = userService.findUserQueByName(name);
|
||||
if (!userque.isPresent()){
|
||||
if (!userque.isPresent()) {
|
||||
throw new UserException(ResultEnum.EMPTY_QUESTION);
|
||||
}else if(question.equals(userque.get().getQuestion())){
|
||||
if(new BigInteger(CodingUtil.encryptSHA(answer.getBytes())).toString(32).equals(userque.get().getAnswer()))
|
||||
} else if (question.equals(userque.get().getQuestion())) {
|
||||
if (new BigInteger(CodingUtil.encryptSHA(answer.getBytes())).toString(32).equals(userque.get().getAnswer())) {
|
||||
return true;
|
||||
else
|
||||
} else {
|
||||
return false;
|
||||
}else{
|
||||
}
|
||||
} else {
|
||||
throw new UserException(ResultEnum.QUESTION_ERROR);
|
||||
}
|
||||
}
|
||||
@@ -165,53 +168,53 @@ public class DataController {
|
||||
@PostMapping("/resetPass")
|
||||
public boolean resetPass(@RequestParam(value = "name") String name
|
||||
, @RequestParam(value = "password") String password,
|
||||
@RequestParam(value = "question") String question
|
||||
@RequestParam(value = "question") String question
|
||||
, @RequestParam(value = "answer") String answer) throws Exception {
|
||||
//log.info("name:{}, password:{}, question:{}, answer:{}",name,password,question,answer);
|
||||
if (findUserQue(name,question,answer)){
|
||||
if (findUserQue(name, question, answer)) {
|
||||
//service方法内含有对密码加密的操作
|
||||
return userService.updateColpasswordByColname(password,name);
|
||||
}else {
|
||||
return userService.updateColpasswordByColname(password, name);
|
||||
} else {
|
||||
throw new UserException(ResultEnum.ILLEGAL_ACCESS);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/home/findAllNotice")
|
||||
public List<TbNotice> findAllNotice(){
|
||||
public List<TbNotice> findAllNotice() {
|
||||
return noticeService.findAll();
|
||||
}
|
||||
|
||||
@PostMapping("/home/admin/addNotice")
|
||||
public boolean addNotice(String content){
|
||||
TbUser user= (TbUser)httpServletRequest.getSession().getAttribute(USER_SESSION_KEY);
|
||||
public boolean addNotice(String content) {
|
||||
TbUser user = (TbUser) httpServletRequest.getSession().getAttribute(USER_SESSION_KEY);
|
||||
TbNotice notice = new TbNotice();
|
||||
Date date = new Date();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
String dateNowStr = sdf.format(date);
|
||||
Optional<VAdmin> vAdmin = adminService.findAdminByUserId(user.getColuserid());
|
||||
if (vAdmin.isPresent()){
|
||||
if (vAdmin.isPresent()) {
|
||||
VAdmin admin = vAdmin.get();
|
||||
notice.setAdminid(admin.getAdminid());
|
||||
notice.setIssueTime(dateNowStr);
|
||||
notice.setNoticeContent(content);
|
||||
return noticeService.addOne(notice)!=null;
|
||||
}else
|
||||
return noticeService.addOne(notice) != null;
|
||||
} else {
|
||||
return false;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/home/admin/addoneversion")
|
||||
public boolean addOneVersion(TbVersion version){
|
||||
return versionService.addOneVersion(version)!=null;
|
||||
public boolean addOneVersion(TbVersion version) {
|
||||
return versionService.addOneVersion(version) != null;
|
||||
}
|
||||
|
||||
@PostMapping("/home/admin/addversion")
|
||||
public boolean addVersion(@RequestBody List<TbVersion> versions){
|
||||
return versionService.addAllVersion(versions)!=null;
|
||||
public boolean addVersion(@RequestBody List<TbVersion> versions) {
|
||||
return versionService.addAllVersion(versions) != null;
|
||||
}
|
||||
|
||||
@GetMapping("/home/findallversion")
|
||||
public List<TbVersion> findAllVersion(){
|
||||
public List<TbVersion> findAllVersion() {
|
||||
return versionService.findAll();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user