add some documents

DEV
PeterAlbus 3 years ago
parent ff7c0f4f60
commit 6ba5f7875e

@ -1,2 +1,17 @@
# socialPractiseManagementSys # socialPractiseManagementSys
a course of SSM's homework a course of SSM's homework
一份SSM课程的期末大作业
是一个学生信息管理系统
运行时需要自行将jdbcConfig.sample.properties重命名为jdbcConfig.properties
同时使用maven导入pom.xml中指定的包
自行修改其中连接数据库的账号和密码并且使用sql文件夹中的sql语句创建数据库
项目使用Spring+SpringMVC+Mybatis-plus+shiro作为框架前后端不分离选择了原始的jsp并在jsp中使用了vue.js以进行一部分mvvm架构的页面设计
德鲁伊后台的密码在web.xml中进行配置
前段样式基本采用element-ui

@ -2,11 +2,9 @@ package com.peteralbus.config;
import com.peteralbus.entity.User; import com.peteralbus.entity.User;
import com.peteralbus.service.UserService; import com.peteralbus.service.UserService;
import com.peteralbus.util.Md5Util;
import org.apache.shiro.authc.*; import org.apache.shiro.authc.*;
import org.apache.shiro.authz.AuthorizationInfo; import org.apache.shiro.authz.AuthorizationInfo;
import org.apache.shiro.authz.SimpleAuthorizationInfo; import org.apache.shiro.authz.SimpleAuthorizationInfo;
import org.apache.shiro.realm.AuthenticatingRealm;
import org.apache.shiro.realm.AuthorizingRealm; import org.apache.shiro.realm.AuthorizingRealm;
import org.apache.shiro.subject.PrincipalCollection; import org.apache.shiro.subject.PrincipalCollection;
import org.apache.shiro.util.ByteSource; import org.apache.shiro.util.ByteSource;
@ -18,11 +16,15 @@ import java.util.Set;
/** /**
* The type Custom realm. * The type Custom realm.
*
* @author PeterAlbus * @author PeterAlbus
*/ */
@Component @Component
public class CustomRealm extends AuthorizingRealm public class CustomRealm extends AuthorizingRealm
{ {
/**
* The User service.
*/
@Autowired @Autowired
UserService userService; UserService userService;
@Override @Override
@ -53,21 +55,14 @@ public class CustomRealm extends AuthorizingRealm
@Override @Override
protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException
{ {
// token是用户输入的用户名和密码
// 第一步从token中取出用户名
String principal = (String) token.getPrincipal(); String principal = (String) token.getPrincipal();
User user=userService.queryByUsername(principal); User user=userService.queryByUsername(principal);
// 第二步根据用户输入的userCode从数据库查询用户信息
if(user==null) if(user==null)
{ {
throw new UnknownAccountException("用户名不存在!"); throw new UnknownAccountException("用户名不存在!");
} }
// 从数据库查询到密码
String credentials = user.getPassword(); String credentials = user.getPassword();
//盐
String salt = user.getUserSalt(); String salt = user.getUserSalt();
// 如果查询到,返回认证信息AuthenticationInfo
return new SimpleAuthenticationInfo(user,credentials,ByteSource.Util.bytes(salt),getName()); return new SimpleAuthenticationInfo(user,credentials,ByteSource.Util.bytes(salt),getName());
} }

@ -7,6 +7,7 @@ import org.apache.shiro.web.filter.authz.AuthorizationFilter;
/** /**
* The type Custom roles authorization filter. * The type Custom roles authorization filter.
*
* @author chen1218chen(csdn) * @author chen1218chen(csdn)
*/ */
public class CustomRolesAuthorizationFilter extends AuthorizationFilter public class CustomRolesAuthorizationFilter extends AuthorizationFilter

@ -14,6 +14,7 @@ import javax.servlet.http.HttpSession;
/** /**
* The type Account controller. * The type Account controller.
*
* @author PeterAlbus * @author PeterAlbus
*/ */
@Controller @Controller
@ -22,6 +23,7 @@ public class AccountController
/** /**
* Login model and view. * Login model and view.
* *
* @param session the session
* @return the model and view * @return the model and view
*/ */
@RequestMapping("/login") @RequestMapping("/login")
@ -37,6 +39,11 @@ public class AccountController
return modelAndView; return modelAndView;
} }
/**
* Register model and view.
*
* @return the model and view
*/
@RequestMapping("/register") @RequestMapping("/register")
public ModelAndView register() public ModelAndView register()
{ {
@ -45,6 +52,11 @@ public class AccountController
return modelAndView; return modelAndView;
} }
/**
* Refuse model and view.
*
* @return the model and view
*/
@RequiresAuthentication @RequiresAuthentication
@RequestMapping("/refuse") @RequestMapping("/refuse")
public ModelAndView refuse() public ModelAndView refuse()

@ -26,10 +26,19 @@ import java.util.List;
@RequestMapping("/admin") @RequestMapping("/admin")
public class AdminController public class AdminController
{ {
/**
* The Message service.
*/
@Autowired @Autowired
MessageService messageService; MessageService messageService;
/**
* The Activity service.
*/
@Autowired @Autowired
ActivityService activityService; ActivityService activityService;
/**
* The User service.
*/
@Autowired @Autowired
UserService userService; UserService userService;
private ModelAndView basicModelAndView() private ModelAndView basicModelAndView()
@ -39,6 +48,12 @@ public class AdminController
modelAndView.addObject("newMessageList",messageService.getNewMessage()); modelAndView.addObject("newMessageList",messageService.getNewMessage());
return modelAndView; return modelAndView;
} }
/**
* Activities model and view.
*
* @return the model and view
*/
@RequestMapping("/activities") @RequestMapping("/activities")
public ModelAndView activities() public ModelAndView activities()
{ {
@ -48,6 +63,12 @@ public class AdminController
modelAndView.setViewName("/jsp/admin/activities.jsp"); modelAndView.setViewName("/jsp/admin/activities.jsp");
return modelAndView; return modelAndView;
} }
/**
* Users model and view.
*
* @return the model and view
*/
@RequestMapping("/users") @RequestMapping("/users")
public ModelAndView users() public ModelAndView users()
{ {
@ -57,6 +78,13 @@ public class AdminController
modelAndView.setViewName("/jsp/admin/users.jsp"); modelAndView.setViewName("/jsp/admin/users.jsp");
return modelAndView; return modelAndView;
} }
/**
* Restore activity string.
*
* @param activityId the activity id
* @return the string
*/
@ResponseBody @ResponseBody
@RequestMapping("/restoreActivity") @RequestMapping("/restoreActivity")
public String restoreActivity(Long activityId) public String restoreActivity(Long activityId)
@ -67,6 +95,13 @@ public class AdminController
} }
return "error"; return "error";
} }
/**
* Reset password string.
*
* @param userId the user id
* @return the string
*/
@ResponseBody @ResponseBody
@RequestMapping("/resetPassword") @RequestMapping("/resetPassword")
public String resetPassword(Long userId) public String resetPassword(Long userId)
@ -79,6 +114,13 @@ public class AdminController
} }
return "error"; return "error";
} }
/**
* Sets admin.
*
* @param userId the user id
* @return the admin
*/
@ResponseBody @ResponseBody
@RequestMapping("/setAdmin") @RequestMapping("/setAdmin")
public String setAdmin(Long userId) public String setAdmin(Long userId)

@ -23,15 +23,25 @@ import java.util.TreeMap;
/** /**
* The type Page controller. * The type Page controller.
*
* @author PeterAlbus * @author PeterAlbus
*/ */
@Controller @Controller
public class PageController public class PageController
{ {
/**
* The User service.
*/
@Autowired @Autowired
UserService userService; UserService userService;
/**
* The Message service.
*/
@Autowired @Autowired
MessageService messageService; MessageService messageService;
/**
* The Activity service.
*/
@Autowired @Autowired
ActivityService activityService; ActivityService activityService;
/** /**
@ -46,6 +56,12 @@ public class PageController
modelAndView.addObject("newMessageList",messageService.getNewMessage()); modelAndView.addObject("newMessageList",messageService.getNewMessage());
return modelAndView; return modelAndView;
} }
/**
* Home page model and view.
*
* @return the model and view
*/
@RequestMapping("/index") @RequestMapping("/index")
public ModelAndView homePage() public ModelAndView homePage()
{ {
@ -71,6 +87,13 @@ public class PageController
modelAndView.setViewName("/jsp/home.jsp"); modelAndView.setViewName("/jsp/home.jsp");
return modelAndView; return modelAndView;
} }
/**
* User detail model and view.
*
* @param userId the user id
* @return the model and view
*/
@RequestMapping("/user") @RequestMapping("/user")
public ModelAndView userDetail(Long userId) public ModelAndView userDetail(Long userId)
{ {
@ -92,6 +115,13 @@ public class PageController
modelAndView.setViewName("/jsp/account/user.jsp"); modelAndView.setViewName("/jsp/account/user.jsp");
return modelAndView; return modelAndView;
} }
/**
* User center model and view.
*
* @param session the session
* @return the model and view
*/
@RequestMapping("/userCenter") @RequestMapping("/userCenter")
public ModelAndView userCenter(HttpSession session) public ModelAndView userCenter(HttpSession session)
{ {
@ -104,6 +134,12 @@ public class PageController
modelAndView.setViewName("/jsp/account/userCenter.jsp"); modelAndView.setViewName("/jsp/account/userCenter.jsp");
return modelAndView; return modelAndView;
} }
/**
* Message list model and view.
*
* @return the model and view
*/
@RequestMapping("/messageList") @RequestMapping("/messageList")
public ModelAndView messageList() public ModelAndView messageList()
{ {
@ -112,6 +148,13 @@ public class PageController
modelAndView.setViewName("/jsp/message/messageList.jsp"); modelAndView.setViewName("/jsp/message/messageList.jsp");
return modelAndView; return modelAndView;
} }
/**
* Message model and view.
*
* @param messageId the message id
* @return the model and view
*/
@RequestMapping("/message") @RequestMapping("/message")
public ModelAndView message(Long messageId) public ModelAndView message(Long messageId)
{ {
@ -119,6 +162,13 @@ public class PageController
modelAndView.setViewName("/jsp/message/message.jsp"); modelAndView.setViewName("/jsp/message/message.jsp");
return modelAndView; return modelAndView;
} }
/**
* Read message string.
*
* @param messageId the message id
* @return the string
*/
@ResponseBody @ResponseBody
@RequestMapping("/readMessage") @RequestMapping("/readMessage")
public String readMessage(Long messageId) public String readMessage(Long messageId)

@ -19,6 +19,7 @@ import java.util.Map;
/** /**
* The type Student controller. * The type Student controller.
*
* @author peteralbus * @author peteralbus
*/ */
@Controller @Controller
@ -26,14 +27,29 @@ import java.util.Map;
@RequestMapping("/student") @RequestMapping("/student")
public class StudentController public class StudentController
{ {
/**
* The Message service.
*/
@Autowired @Autowired
MessageService messageService; MessageService messageService;
/**
* The Activity service.
*/
@Autowired @Autowired
ActivityService activityService; ActivityService activityService;
/**
* The Group service.
*/
@Autowired @Autowired
GroupService groupService; GroupService groupService;
/**
* The Participate service.
*/
@Autowired @Autowired
ParticipateService participateService; ParticipateService participateService;
/**
* The Record service.
*/
@Autowired @Autowired
RecordService recordService; RecordService recordService;
private ModelAndView basicModelAndView() private ModelAndView basicModelAndView()
@ -43,6 +59,12 @@ public class StudentController
modelAndView.addObject("newMessageList",messageService.getNewMessage()); modelAndView.addObject("newMessageList",messageService.getNewMessage());
return modelAndView; return modelAndView;
} }
/**
* Activities model and view.
*
* @return the model and view
*/
@RequestMapping("/activities") @RequestMapping("/activities")
public ModelAndView activities() public ModelAndView activities()
{ {
@ -56,6 +78,13 @@ public class StudentController
modelAndView.setViewName("/jsp/student/activities.jsp"); modelAndView.setViewName("/jsp/student/activities.jsp");
return modelAndView; return modelAndView;
} }
/**
* Apply activity model and view.
*
* @param activityId the activity id
* @return the model and view
*/
@RequestMapping("/applyActivity") @RequestMapping("/applyActivity")
public ModelAndView applyActivity(Long activityId) public ModelAndView applyActivity(Long activityId)
{ {
@ -74,6 +103,13 @@ public class StudentController
modelAndView.setViewName("/jsp/student/applyActivity.jsp"); modelAndView.setViewName("/jsp/student/applyActivity.jsp");
return modelAndView; return modelAndView;
} }
/**
* Manage activity model and view.
*
* @param activityId the activity id
* @return the model and view
*/
@RequestMapping("/manageActivity") @RequestMapping("/manageActivity")
public ModelAndView manageActivity(Long activityId) public ModelAndView manageActivity(Long activityId)
{ {
@ -120,6 +156,13 @@ public class StudentController
modelAndView.addObject("activity",activity); modelAndView.addObject("activity",activity);
return modelAndView; return modelAndView;
} }
/**
* Insert record string.
*
* @param record the record
* @return the string
*/
@ResponseBody @ResponseBody
@RequestMapping("/insertRecord") @RequestMapping("/insertRecord")
public String insertRecord(Record record) public String insertRecord(Record record)
@ -139,6 +182,13 @@ public class StudentController
} }
return "success"; return "success";
} }
/**
* Accept join string.
*
* @param participateId the participate id
* @return the string
*/
@ResponseBody @ResponseBody
@RequestMapping("/acceptJoin") @RequestMapping("/acceptJoin")
public String acceptJoin(Long participateId) public String acceptJoin(Long participateId)
@ -153,6 +203,13 @@ public class StudentController
"小组申请通过通知","先前申请社会实践小组的申请通过了快去看看活动id"+participate.getActivityId()+""); "小组申请通过通知","先前申请社会实践小组的申请通过了快去看看活动id"+participate.getActivityId()+"");
return "success"; return "success";
} }
/**
* Refuse join string.
*
* @param participateId the participate id
* @return the string
*/
@ResponseBody @ResponseBody
@RequestMapping("/refuseJoin") @RequestMapping("/refuseJoin")
public String refuseJoin(Long participateId) public String refuseJoin(Long participateId)
@ -167,6 +224,13 @@ public class StudentController
"小组申请拒绝通知","很遗憾你加入小组的申请被组长拒绝了活动id"+participate.getActivityId()+""); "小组申请拒绝通知","很遗憾你加入小组的申请被组长拒绝了活动id"+participate.getActivityId()+"");
return "success"; return "success";
} }
/**
* Participate with new group string.
*
* @param group the group
* @return the string
*/
@ResponseBody @ResponseBody
@RequestMapping("/participateWithNewGroup") @RequestMapping("/participateWithNewGroup")
public String participateWithNewGroup(Group group) public String participateWithNewGroup(Group group)
@ -181,6 +245,13 @@ public class StudentController
return "error"; return "error";
} }
} }
/**
* Participate with old group string.
*
* @param groupId the group id
* @return the string
*/
@ResponseBody @ResponseBody
@RequestMapping("/participateWithOldGroup") @RequestMapping("/participateWithOldGroup")
public String participateWithOldGroup(Long groupId) public String participateWithOldGroup(Long groupId)
@ -206,6 +277,13 @@ public class StudentController
return "error"; return "error";
} }
} }
/**
* Delete activity string.
*
* @param participationId the participation id
* @return the string
*/
@ResponseBody @ResponseBody
@RequestMapping("/deleteParticipate") @RequestMapping("/deleteParticipate")
public String deleteActivity(Long participationId) public String deleteActivity(Long participationId)

@ -20,6 +20,7 @@ import java.util.Map;
/** /**
* The type Teacher controller. * The type Teacher controller.
*
* @author PeterAlbus * @author PeterAlbus
*/ */
@Controller @Controller
@ -27,20 +28,44 @@ import java.util.Map;
@RequestMapping("/teacher") @RequestMapping("/teacher")
public class TeacherController public class TeacherController
{ {
/**
* The Activity service.
*/
@Autowired @Autowired
ActivityService activityService; ActivityService activityService;
/**
* The User service.
*/
@Autowired @Autowired
UserService userService; UserService userService;
/**
* The Group service.
*/
@Autowired @Autowired
GroupService groupService; GroupService groupService;
/**
* The Record service.
*/
@Autowired @Autowired
RecordService recordService; RecordService recordService;
/**
* The Score group service.
*/
@Autowired @Autowired
ScoreGroupService scoreGroupService; ScoreGroupService scoreGroupService;
/**
* The Score stu service.
*/
@Autowired @Autowired
ScoreStuService scoreStuService; ScoreStuService scoreStuService;
/**
* The Message service.
*/
@Autowired @Autowired
MessageService messageService; MessageService messageService;
/**
* The Participate service.
*/
@Autowired @Autowired
ParticipateService participateService; ParticipateService participateService;
private ModelAndView basicModelAndView() private ModelAndView basicModelAndView()
@ -50,6 +75,12 @@ public class TeacherController
modelAndView.addObject("newMessageList",messageService.getNewMessage()); modelAndView.addObject("newMessageList",messageService.getNewMessage());
return modelAndView; return modelAndView;
} }
/**
* Activities model and view.
*
* @return the model and view
*/
@RequestMapping("/activities") @RequestMapping("/activities")
public ModelAndView activities() public ModelAndView activities()
{ {
@ -63,6 +94,13 @@ public class TeacherController
modelAndView.setViewName("/jsp/teacher/activity.jsp"); modelAndView.setViewName("/jsp/teacher/activity.jsp");
return modelAndView; return modelAndView;
} }
/**
* Activity detail model and view.
*
* @param activityId the activity id
* @return the model and view
*/
@RequestMapping("/activityDetail") @RequestMapping("/activityDetail")
public ModelAndView activityDetail(Long activityId) public ModelAndView activityDetail(Long activityId)
{ {
@ -72,6 +110,13 @@ public class TeacherController
modelAndView.setViewName("/jsp/teacher/activityDetail.jsp"); modelAndView.setViewName("/jsp/teacher/activityDetail.jsp");
return modelAndView; return modelAndView;
} }
/**
* Modify activity model and view.
*
* @param activityId the activity id
* @return the model and view
*/
@RequestMapping("/modifyActivity") @RequestMapping("/modifyActivity")
public ModelAndView modifyActivity(Long activityId) public ModelAndView modifyActivity(Long activityId)
{ {
@ -91,6 +136,13 @@ public class TeacherController
modelAndView.setViewName("/jsp/teacher/modifyActivity.jsp"); modelAndView.setViewName("/jsp/teacher/modifyActivity.jsp");
return modelAndView; return modelAndView;
} }
/**
* Manage group model and view.
*
* @param groupId the group id
* @return the model and view
*/
@RequestMapping("/manageGroup") @RequestMapping("/manageGroup")
public ModelAndView manageGroup(Long groupId) public ModelAndView manageGroup(Long groupId)
{ {
@ -112,6 +164,13 @@ public class TeacherController
modelAndView.setViewName("/jsp/teacher/manageGroup.jsp"); modelAndView.setViewName("/jsp/teacher/manageGroup.jsp");
return modelAndView; return modelAndView;
} }
/**
* Add activity string.
*
* @param activity the activity
* @return the string
*/
@ResponseBody @ResponseBody
@RequestMapping("/addActivity") @RequestMapping("/addActivity")
public String addActivity(Activity activity) public String addActivity(Activity activity)
@ -133,6 +192,13 @@ public class TeacherController
return "error:"+e.getMessage(); return "error:"+e.getMessage();
} }
} }
/**
* Update activity string.
*
* @param activity the activity
* @return the string
*/
@ResponseBody @ResponseBody
@RequestMapping("/updateActivity") @RequestMapping("/updateActivity")
public String updateActivity(Activity activity) public String updateActivity(Activity activity)
@ -154,6 +220,13 @@ public class TeacherController
return "error:"+e.getMessage(); return "error:"+e.getMessage();
} }
} }
/**
* Delete activity string.
*
* @param activityId the activity id
* @return the string
*/
@ResponseBody @ResponseBody
@RequestMapping("/deleteActivity") @RequestMapping("/deleteActivity")
public String deleteActivity(Long activityId) public String deleteActivity(Long activityId)
@ -175,6 +248,14 @@ public class TeacherController
return "error:"+e.getMessage(); return "error:"+e.getMessage();
} }
} }
/**
* Add teacher to activity string.
*
* @param userId the user id
* @param activityId the activity id
* @return the string
*/
@ResponseBody @ResponseBody
@RequestMapping("/addTeacherToActivity") @RequestMapping("/addTeacherToActivity")
public String addTeacherToActivity(Long userId,Long activityId) public String addTeacherToActivity(Long userId,Long activityId)
@ -192,6 +273,13 @@ public class TeacherController
} }
return "error"; return "error";
} }
/**
* Sets read.
*
* @param recordId the record id
* @return the read
*/
@ResponseBody @ResponseBody
@RequestMapping("/setRead") @RequestMapping("/setRead")
public String setRead(Long recordId) public String setRead(Long recordId)
@ -203,6 +291,13 @@ public class TeacherController
} }
return "error"; return "error";
} }
/**
* Score stu string.
*
* @param scoreStu the score stu
* @return the string
*/
@ResponseBody @ResponseBody
@RequestMapping("/scoreStu") @RequestMapping("/scoreStu")
public String scoreStu(ScoreStu scoreStu) public String scoreStu(ScoreStu scoreStu)
@ -217,6 +312,13 @@ public class TeacherController
} }
return "error"; return "error";
} }
/**
* Score group string.
*
* @param scoreGroup the score group
* @return the string
*/
@ResponseBody @ResponseBody
@RequestMapping("/scoreGroup") @RequestMapping("/scoreGroup")
public String scoreGroup(ScoreGroup scoreGroup) public String scoreGroup(ScoreGroup scoreGroup)

@ -34,8 +34,14 @@ import java.util.List;
@RequestMapping("/user") @RequestMapping("/user")
public class UserController public class UserController
{ {
/**
* The User service.
*/
@Autowired @Autowired
UserService userService; UserService userService;
/**
* The Message service.
*/
@Autowired @Autowired
MessageService messageService; MessageService messageService;
@ -46,11 +52,13 @@ public class UserController
modelAndView.addObject("newMessageList",messageService.getNewMessage()); modelAndView.addObject("newMessageList",messageService.getNewMessage());
return modelAndView; return modelAndView;
} }
/** /**
* Login string. * Login string.
* *
* @param username the username * @param username the username
* @param password the password * @param password the password
* @param rememberMe the remember me
* @return the string * @return the string
*/ */
@ResponseBody @ResponseBody
@ -73,6 +81,13 @@ public class UserController
} }
return "success"; return "success";
} }
/**
* Register string.
*
* @param user the user
* @return the string
*/
@ResponseBody @ResponseBody
@RequestMapping("/register") @RequestMapping("/register")
public String register(User user) public String register(User user)
@ -102,6 +117,13 @@ public class UserController
return "注册失败:"+e.getMessage(); return "注册失败:"+e.getMessage();
} }
} }
/**
* Update user string.
*
* @param user the user
* @return the string
*/
@ResponseBody @ResponseBody
@RequestMapping("/updateUser") @RequestMapping("/updateUser")
public String updateUser(User user) public String updateUser(User user)
@ -121,6 +143,15 @@ public class UserController
return "error"; return "error";
} }
} }
/**
* Change password model and view.
*
* @param oldPassword the old password
* @param newPassword the new password
* @param session the session
* @return the model and view
*/
@RequestMapping("/changePassword") @RequestMapping("/changePassword")
public ModelAndView changePassword(String oldPassword, String newPassword, HttpSession session) public ModelAndView changePassword(String oldPassword, String newPassword, HttpSession session)
{ {
@ -156,6 +187,12 @@ public class UserController
} }
return modelAndView; return modelAndView;
} }
/**
* Delete user model and view.
*
* @return the model and view
*/
@RequestMapping("/deleteUser") @RequestMapping("/deleteUser")
public ModelAndView deleteUser() public ModelAndView deleteUser()
{ {

@ -7,6 +7,7 @@ import java.time.LocalDateTime;
/** /**
* The type My meta-object handler. * The type My meta-object handler.
*
* @author PeterAlbus * @author PeterAlbus
*/ */
public class MyMetaObjectHandler implements MetaObjectHandler public class MyMetaObjectHandler implements MetaObjectHandler

@ -162,6 +162,12 @@ public class ActivityService
return activityList; return activityList;
} }
/**
* Gets teacher list.
*
* @param activityId the activity id
* @return the teacher list
*/
public List<User> getTeacherList(Long activityId) public List<User> getTeacherList(Long activityId)
{ {
return activityDao.getTeacherList(activityId); return activityDao.getTeacherList(activityId);
@ -177,6 +183,12 @@ public class ActivityService
return activityDao.getCount(); return activityDao.getCount();
} }
/**
* Delete activity int.
*
* @param activityId the activity id
* @return the int
*/
public int deleteActivity(Long activityId) public int deleteActivity(Long activityId)
{ {
int result=0; int result=0;
@ -200,11 +212,22 @@ public class ActivityService
return result; return result;
} }
/**
* Admin activity list list.
*
* @return the list
*/
public List<Activity> adminActivityList() public List<Activity> adminActivityList()
{ {
return activityDao.adminActivityList(); return activityDao.adminActivityList();
} }
/**
* Restore int.
*
* @param activityId the activity id
* @return the int
*/
public int restore(Long activityId) public int restore(Long activityId)
{ {
int result=0; int result=0;
@ -222,6 +245,12 @@ public class ActivityService
return result; return result;
} }
/**
* Gets user stat.
*
* @param user the user
* @return the user stat
*/
public Map<String,Long> getUserStat(User user) public Map<String,Long> getUserStat(User user)
{ {
Map<String,Long> stat=new TreeMap<>(); Map<String,Long> stat=new TreeMap<>();

@ -36,9 +36,15 @@ public class GroupService
@Autowired @Autowired
ParticipateDao participateDao; ParticipateDao participateDao;
/**
* The Score group dao.
*/
@Autowired @Autowired
ScoreGroupDao scoreGroupDao; ScoreGroupDao scoreGroupDao;
/**
* The Score stu dao.
*/
@Autowired @Autowired
ScoreStuDao scoreStuDao; ScoreStuDao scoreStuDao;
@ -115,6 +121,12 @@ public class GroupService
return memberList; return memberList;
} }
/**
* Gets score.
*
* @param groupId the group id
* @return the score
*/
public Map<String,Double> getScore(Long groupId) public Map<String,Double> getScore(Long groupId)
{ {
Map<String,Double> map=new HashMap<>(); Map<String,Double> map=new HashMap<>();

@ -13,13 +13,23 @@ import java.util.List;
/** /**
* The type Message service. * The type Message service.
*
* @author peteralbus * @author peteralbus
*/ */
@Service @Service
public class MessageService public class MessageService
{ {
/**
* The Message dao.
*/
@Autowired @Autowired
MessageDao messageDao; MessageDao messageDao;
/**
* Gets message.
*
* @return the message
*/
public List<Message> getMessage() public List<Message> getMessage()
{ {
Subject subject = SecurityUtils.getSubject(); Subject subject = SecurityUtils.getSubject();
@ -28,6 +38,12 @@ public class MessageService
queryWrapper.eq("message_receiver",user.getUserId()); queryWrapper.eq("message_receiver",user.getUserId());
return messageDao.selectList(queryWrapper); return messageDao.selectList(queryWrapper);
} }
/**
* Gets new message.
*
* @return the new message
*/
public List<Message> getNewMessage() public List<Message> getNewMessage()
{ {
Subject subject = SecurityUtils.getSubject(); Subject subject = SecurityUtils.getSubject();
@ -37,6 +53,12 @@ public class MessageService
queryWrapper.eq("is_read",false); queryWrapper.eq("is_read",false);
return messageDao.selectList(queryWrapper); return messageDao.selectList(queryWrapper);
} }
/**
* Gets new message count.
*
* @return the new message count
*/
public Long getNewMessageCount() public Long getNewMessageCount()
{ {
Subject subject = SecurityUtils.getSubject(); Subject subject = SecurityUtils.getSubject();
@ -46,6 +68,16 @@ public class MessageService
queryWrapper.eq("is_read",false); queryWrapper.eq("is_read",false);
return messageDao.selectCount(queryWrapper); return messageDao.selectCount(queryWrapper);
} }
/**
* Send message int.
*
* @param targetId the target id
* @param sender the sender
* @param title the title
* @param content the content
* @return the int
*/
public int sendMessage(Long targetId,String sender,String title,String content) public int sendMessage(Long targetId,String sender,String title,String content)
{ {
Message message=new Message(); Message message=new Message();
@ -56,6 +88,13 @@ public class MessageService
message.setRead(false); message.setRead(false);
return messageDao.insert(message); return messageDao.insert(message);
} }
/**
* Read message int.
*
* @param messageId the message id
* @return the int
*/
public int readMessage(Long messageId) public int readMessage(Long messageId)
{ {
Message message=messageDao.selectById(messageId); Message message=messageDao.selectById(messageId);

@ -18,6 +18,7 @@ import java.util.List;
/** /**
* The type Participate service. * The type Participate service.
*
* @author peteralbus * @author peteralbus
*/ */
@Service @Service
@ -34,6 +35,9 @@ public class ParticipateService
@Autowired @Autowired
GroupDao groupDao; GroupDao groupDao;
/**
* The Record dao.
*/
@Autowired @Autowired
RecordDao recordDao; RecordDao recordDao;
@ -150,6 +154,12 @@ public class ParticipateService
} }
} }
/**
* Delete participate int.
*
* @param participationId the participation id
* @return the int
*/
public int deleteParticipate(Long participationId) public int deleteParticipate(Long participationId)
{ {
Participate participate=participateDao.selectById(participationId); Participate participate=participateDao.selectById(participationId);
@ -172,6 +182,12 @@ public class ParticipateService
return participateDao.deleteById(participationId); return participateDao.deleteById(participationId);
} }
/**
* Gets by id.
*
* @param participationId the participation id
* @return the by id
*/
public Participate getById(Long participationId) public Participate getById(Long participationId)
{ {
return participateDao.selectById(participationId); return participateDao.selectById(participationId);

@ -27,10 +27,19 @@ public class RecordService
*/ */
@Autowired @Autowired
RecordDao recordDao; RecordDao recordDao;
/**
* The Group dao.
*/
@Autowired @Autowired
GroupDao groupDao; GroupDao groupDao;
/**
* The Participate dao.
*/
@Autowired @Autowired
ParticipateDao participateDao; ParticipateDao participateDao;
/**
* The User dao.
*/
@Autowired @Autowired
UserDao userDao; UserDao userDao;
@ -58,6 +67,12 @@ public class RecordService
return recordDao.selectList(queryWrapper); return recordDao.selectList(queryWrapper);
} }
/**
* Select by group list.
*
* @param groupId the group id
* @return the list
*/
public List<Record> selectByGroup(Long groupId) public List<Record> selectByGroup(Long groupId)
{ {
Group group= groupDao.selectById(groupId); Group group= groupDao.selectById(groupId);
@ -77,6 +92,12 @@ public class RecordService
return recordList; return recordList;
} }
/**
* Sets read.
*
* @param recordId the record id
* @return the read
*/
public int setRead(Long recordId) public int setRead(Long recordId)
{ {
Record record=recordDao.selectById(recordId); Record record=recordDao.selectById(recordId);

@ -8,17 +8,36 @@ import org.springframework.stereotype.Service;
/** /**
* The type Score group service. * The type Score group service.
*
* @author peteralbus * @author peteralbus
*/ */
@Service @Service
public class ScoreGroupService public class ScoreGroupService
{ {
/**
* The Score group dao.
*/
@Autowired @Autowired
ScoreGroupDao scoreGroupDao; ScoreGroupDao scoreGroupDao;
/**
* Insert int.
*
* @param scoreGroup the score group
* @return the int
*/
public int insert(ScoreGroup scoreGroup) public int insert(ScoreGroup scoreGroup)
{ {
return scoreGroupDao.insert(scoreGroup); return scoreGroupDao.insert(scoreGroup);
} }
/**
* Gets scored.
*
* @param teacherId the teacher id
* @param groupId the group id
* @return the scored
*/
public Boolean getScored(Long teacherId,Long groupId) public Boolean getScored(Long teacherId,Long groupId)
{ {
QueryWrapper<ScoreGroup> queryWrapper=new QueryWrapper<>(); QueryWrapper<ScoreGroup> queryWrapper=new QueryWrapper<>();

@ -9,15 +9,29 @@ import org.springframework.stereotype.Service;
/** /**
* The type Score stu service. * The type Score stu service.
*
* @author peteralbus * @author peteralbus
*/ */
@Service @Service
public class ScoreStuService public class ScoreStuService
{ {
/**
* The Score stu dao.
*/
@Autowired @Autowired
ScoreStuDao scoreStuDao; ScoreStuDao scoreStuDao;
/**
* The Participate dao.
*/
@Autowired @Autowired
ParticipateDao participateDao; ParticipateDao participateDao;
/**
* Insert int.
*
* @param scoreStu the score stu
* @return the int
*/
public int insert(ScoreStu scoreStu) public int insert(ScoreStu scoreStu)
{ {
if(scoreStuDao.insert(scoreStu)>0) if(scoreStuDao.insert(scoreStu)>0)

@ -35,10 +35,17 @@ public class UserService
return userDao.insert(user); return userDao.insert(user);
} }
/**
* Update user int.
*
* @param user the user
* @return the int
*/
public int updateUser(User user) public int updateUser(User user)
{ {
return userDao.updateById(user); return userDao.updateById(user);
} }
/** /**
* Query by username user. * Query by username user.
* *
@ -77,6 +84,11 @@ public class UserService
return userDao.deleteById(user); return userDao.deleteById(user);
} }
/**
* Gets teacher list.
*
* @return the teacher list
*/
public List<User> getTeacherList() public List<User> getTeacherList()
{ {
QueryWrapper<User> queryWrapper=new QueryWrapper<>(); QueryWrapper<User> queryWrapper=new QueryWrapper<>();
@ -84,16 +96,33 @@ public class UserService
return userDao.selectList(queryWrapper); return userDao.selectList(queryWrapper);
} }
/**
* Gets user list.
*
* @return the user list
*/
public List<User> getUserList() public List<User> getUserList()
{ {
return userDao.selectList(null); return userDao.selectList(null);
} }
/**
* Query by id user.
*
* @param userId the user id
* @return the user
*/
public User queryById(Long userId) public User queryById(Long userId)
{ {
return userDao.selectById(userId); return userDao.selectById(userId);
} }
/**
* Sets admin.
*
* @param userId the user id
* @return the admin
*/
public int setAdmin(Long userId) public int setAdmin(Long userId)
{ {
User user=userDao.selectById(userId); User user=userDao.selectById(userId);

@ -7,16 +7,31 @@ import java.util.Random;
/** /**
* The type Md 5 util. * The type Md 5 util.
*
* @author PeterAlbus * @author PeterAlbus
*/ */
public class Md5Util public class Md5Util
{ {
/**
* Md 5 hash string.
*
* @param credentials the credentials
* @param salt the salt
* @return the string
*/
public static String md5Hash(String credentials, String salt) public static String md5Hash(String credentials, String salt)
{ {
String hashAlgorithmName="MD5"; String hashAlgorithmName="MD5";
int hashIterations=1; int hashIterations=1;
return new SimpleHash(hashAlgorithmName, credentials, ByteSource.Util.bytes(salt),hashIterations).toHex(); return new SimpleHash(hashAlgorithmName, credentials, ByteSource.Util.bytes(salt),hashIterations).toHex();
} }
/**
* Get salt string.
*
* @param n the n
* @return the string
*/
public static String getSalt(int n){ public static String getSalt(int n){
char[] chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz~!@#$%^&*()_+".toCharArray(); char[] chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz~!@#$%^&*()_+".toCharArray();
int length = chars.length; int length = chars.length;

@ -14,6 +14,7 @@ import java.util.List;
/** /**
* The type Principal util. * The type Principal util.
*
* @author peteralbus * @author peteralbus
*/ */
@Component @Component

Loading…
Cancel
Save