diff --git a/src/main/java/com/codesdream/ase/component/activity/ActivityConverter.java b/src/main/java/com/codesdream/ase/component/activity/ActivityConverter.java index 38b079a..5d2783f 100644 --- a/src/main/java/com/codesdream/ase/component/activity/ActivityConverter.java +++ b/src/main/java/com/codesdream/ase/component/activity/ActivityConverter.java @@ -17,7 +17,9 @@ import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.*; -//将合法的JSON对象转化为Activity对象 +/** + * JSONObject-Activity转化类 + */ @Component public class ActivityConverter { @@ -30,6 +32,10 @@ public class ActivityConverter { @Resource AttendanceService attendanceService; + /** + * @param json 一个Optional的json对象,用以转化为Activity对象,此过程中进行值的合法校验 + * @return 一个可以被直接存储在数据库中的合法的Activity对象 + */ public Activity convertToActivity(Optional json) { if (!json.isPresent()) { throw new NullPointerException(); @@ -37,10 +43,12 @@ public class ActivityConverter { Activity activity = new Activity(); JSONObject jsonObject = json.get(); + //设置活动创建人 int userId = (int) jsonObject.get("creator"); Optional creator = userService.findUserById(userId); activity.setCreator(creator.get()); + //设置参与人员 List participateGroupFromJson = (List) jsonObject.get("participate-group"); Set participateGroup = new HashSet<>(); for (int id : participateGroupFromJson) { @@ -49,13 +57,16 @@ public class ActivityConverter { } activity.setParticipateGroup(participateGroup); + //设置活动标题 String title = (String) jsonObject.get("title"); activity.setTitle(title); + //设置主要负责人 int chiefManagerId = (int) jsonObject.get("chief-manager"); Optional chiefManager = userService.findUserById(chiefManagerId); activity.setChiefManager(chiefManager.get()); + //设置次要负责人 List assistManagersFromJSON = (List) jsonObject.get("assist-managers"); Set assistManager = new HashSet<>(); for (int id : assistManagersFromJSON) { @@ -64,9 +75,11 @@ public class ActivityConverter { } activity.setAssistManagers(assistManager); + //设置活动类型 String type = (String) jsonObject.get("type"); activity.setType(type); + //设置 String startTimeFromJSON = (String) jsonObject.get("start-time"); String endTimeFromJSON = (String) jsonObject.get("end-time"); LocalDateTime startTime = LocalDateTime.parse(startTimeFromJSON, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); @@ -152,9 +165,7 @@ public class ActivityConverter { Attendance attendance = new Attendance(); attendance.setClockInPeriods(periods); attendance.setOnline(attendanceOnLine); - /** - * 二维码模块未完成 - */ + attendance = attendanceService.save(attendance); activity.setAttendance(attendance); diff --git a/src/main/java/com/codesdream/ase/component/activity/QrCodeUtils.java b/src/main/java/com/codesdream/ase/component/activity/QrCodeUtils.java index 4389f67..e18de65 100644 --- a/src/main/java/com/codesdream/ase/component/activity/QrCodeUtils.java +++ b/src/main/java/com/codesdream/ase/component/activity/QrCodeUtils.java @@ -5,11 +5,9 @@ import com.google.zxing.EncodeHintType; import com.google.zxing.MultiFormatWriter; import com.google.zxing.common.BitMatrix; import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel; -import jdk.internal.util.xml.impl.Input; import org.springframework.stereotype.Component; import javax.imageio.ImageIO; -import javax.imageio.stream.ImageOutputStream; import java.awt.*; import java.awt.geom.RoundRectangle2D; import java.awt.image.BufferedImage; diff --git a/src/main/java/com/codesdream/ase/controller/activity/ActivityAttendanceController.java b/src/main/java/com/codesdream/ase/controller/activity/ActivityAttendanceController.java index 29d8d83..568e2cb 100644 --- a/src/main/java/com/codesdream/ase/controller/activity/ActivityAttendanceController.java +++ b/src/main/java/com/codesdream/ase/controller/activity/ActivityAttendanceController.java @@ -2,10 +2,15 @@ package com.codesdream.ase.controller.activity; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; import javax.annotation.Resource; @Controller +@RequestMapping("/act") public class ActivityAttendanceController { + private final String url = "/forget"; + + } diff --git a/src/main/java/com/codesdream/ase/controller/activity/ActivityCreatorController.java b/src/main/java/com/codesdream/ase/controller/activity/ActivityCreatorController.java index 35b4743..a1ea1e2 100644 --- a/src/main/java/com/codesdream/ase/controller/activity/ActivityCreatorController.java +++ b/src/main/java/com/codesdream/ase/controller/activity/ActivityCreatorController.java @@ -22,6 +22,7 @@ import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; @@ -31,6 +32,7 @@ import java.util.List; import java.util.Optional; @Controller +@RequestMapping("/forget/act") public class ActivityCreatorController { @Resource @@ -66,41 +68,40 @@ public class ActivityCreatorController { @Resource ActivityConverter activityConverter; - private final String url = "/forget/activity"; - - @PostMapping(value = url + "/activity_creator") + @PostMapping(value = "/creator") @ResponseBody @ApiOperation(value = "创建活动", notes = "所有有关用户的数据传递均使用id,类型为int") @ApiImplicitParams({ - @ApiImplicitParam(name = "title", value = "活动标题", required = true), - @ApiImplicitParam(name = "type", value = "活动类型", required = true), + @ApiImplicitParam(name = "title", value = "活动标题", dataType = "String", required = true), + @ApiImplicitParam(name = "type", value = "活动类型", dataType = "String", required = true), @ApiImplicitParam(name = "start-time", value = "活动开始时间,格式为yyyy-MM-dd HH:mm:ss", required = true), @ApiImplicitParam(name = "end-time", value = "活动结束时间,格式为yyyy-MM-dd HH:mm:ss", required = true), - @ApiImplicitParam(name = "chief-manager", value = "主要负责人", required = true), - @ApiImplicitParam(name = "assist-managers", value = "次要负责人"), - @ApiImplicitParam(name = "description", value = "活动描述"), - @ApiImplicitParam(name = "cycle", value = "活动周期,格式为阿拉伯数字数字+单位,0表示无周期"), + @ApiImplicitParam(name = "chief-manager", dataType = "int", value = "主要负责人", required = true), + @ApiImplicitParam(name = "assist-managers", dataType = "int", value = "次要负责人"), + @ApiImplicitParam(name = "description", dataType = "String", value = "活动描述"), + @ApiImplicitParam(name = "cycle", dataType = "String", value = "活动周期,格式为阿拉伯数字数字+单位,0表示无周期"), @ApiImplicitParam(name = "participate-group", value = "预定参与人员"), - @ApiImplicitParam(name = "sign-group", value = "可参与人员"), - @ApiImplicitParam(name = "inform-group", value = "通知人群,若为空,则默认为预定参与人员和可报名人员的并集"), - @ApiImplicitParam(name = "visible-group", value = "活动可见人群,若为空,则默认为负责人、活动创建者预定参和可报名人员以及通知人员的并集"), - @ApiImplicitParam(name = "remind-time", defaultValue = "30m", value = "活动提醒时间,格式为数字+单位,可接受的单位从大到小有:w,d,h,m,s"), + @ApiImplicitParam(name = "sign-group", dataType = "List", value = "可参与人员"), + @ApiImplicitParam(name = "inform-group", dataType = "List", value = "通知人群,若为空,则默认为预定参与人员和可报名人员的并集"), + @ApiImplicitParam(name = "visible-group", dataType = "List", value = "活动可见人群,若为空,则默认为负责人、活动创建者预定参和可报名人员以及通知人员的并集"), + @ApiImplicitParam(name = "remind-time", dataType = "String", defaultValue = "30m", value = "活动提醒时间,格式为数字+单位,可接受的单位从大到小有:w,d,h,m,s"), }) String activityCreator(HttpServletRequest request) throws InvalidFormFormatException, NoSuchMethodException, IllegalAccessException, InvocationTargetException { JSONObject error = new JSONObject(); aseSpringUtil = new ASESpringUtil(); + //判断是否为JSON对象 Optional json = jsonParameter.getJSONByRequest(request); if (!json.isPresent()) return jsonParameter.getJSONString(new JSONStandardFailedRespond()); List formatCheckResult = jsonFormValidator.check(activityFormConfigure.getStdActivityForm(), json.get()); + //检验JSON格式是否有误 if (!formatCheckResult.isEmpty()) { error.put("error", formatCheckResult); - return error.toJSONString(); + throw new InvalidFormFormatException(error.toJSONString()); } - // 需要检查JSON是否合法 Activity activity = activityConverter.convertToActivity(json); List nullValues = nullValueValidator.checkNullValues(activity); @@ -136,7 +137,7 @@ public class ActivityCreatorController { String username = json.get().get("creator").toString(); Optional user = userService.findUserByUsername(username); UserActivity userActivity = userActivityRepository.findByUser(user.get()); - userActivity.getCreatedActivities().add(activity); + userActivity.getCreatedActs().add(activity); userActivityRepository.save(userActivity); } } @@ -146,7 +147,8 @@ public class ActivityCreatorController { nullParameters.put("null_values",nullValueAttributes.getNullValueAttributes()); return nullParameters.toJSONString(); } - return url + "/act_created"; + JSONObject jsonObject = (JSONObject) JSONObject.toJSON(activity); + return jsonObject.toJSONString(); } } diff --git a/src/main/java/com/codesdream/ase/controller/activity/ActivityViewerController.java b/src/main/java/com/codesdream/ase/controller/activity/ActivityViewerController.java index 7068097..27ffa82 100644 --- a/src/main/java/com/codesdream/ase/controller/activity/ActivityViewerController.java +++ b/src/main/java/com/codesdream/ase/controller/activity/ActivityViewerController.java @@ -1,37 +1,94 @@ package com.codesdream.ase.controller.activity; -import com.codesdream.ase.component.ASESpringUtil; -import com.codesdream.ase.component.datamanager.JSONParameter; +import com.alibaba.fastjson.JSONObject; import com.codesdream.ase.model.activity.Activity; -import com.codesdream.ase.repository.activity.ActivityRepository; +import com.codesdream.ase.model.permission.User; import com.codesdream.ase.service.ActivityService; +import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; -import java.security.Principal; +import java.util.List; @Controller +@RequestMapping("/forget/act") public class ActivityViewerController { - private final String url = "/forget/activity"; @Resource ActivityService activityService; - @Resource - ActivityRepository activityRepository; + @GetMapping("/created_acts") + String showCreated() { - @RequestMapping(value = url + "/my/participated", method = RequestMethod.GET) - String showParticipated(Model model, HttpServletRequest request){ - Principal principal = request.getUserPrincipal(); - String username = principal.getName(); - ASESpringUtil aseSpringUtil = new ASESpringUtil(); - activityRepository = aseSpringUtil.getBean(ActivityRepository.class); - //List participatedActivities = activityRepository.findc - return "/my/participated"; + User user = (User) SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + List activities = activityService.findCreatedActs(user); + return JSONObject.toJSONString(activities); + } + + @GetMapping("/parting_acts") + String showParticipate(HttpServletRequest request) { + + User user = (User) SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + List activities = activityService.findParticipatingActs(user); + return JSONObject.toJSONString(activities); + } + + @GetMapping("/parted_acts") + String showParticipated() { + + User user = (User) SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + List activities = activityService.findParticipatedActs(user); + return JSONObject.toJSONString(activities); + } + + @GetMapping("/sign_acts") + String showSign() { + + User user = (User) SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + List activities = activityService.findSignActs(user); + return JSONObject.toJSONString(activities); + } + + @GetMapping("/vis_acts") + String showVisible() { + + User user = (User) SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + List activities = activityService.findVisibleActs(user); + return JSONObject.toJSONString(activities); + } + + @GetMapping("/all") + String showAll() { + + User user = (User) SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + List activities = activityService.findAll(user); + return JSONObject.toJSONString(activities); + } + + @GetMapping("/main_responsible_acts") + String showMainResponsible() { + + User user = (User) SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + List activities = activityService.findMainResponsibleActs(user); + return JSONObject.toJSONString(activities); + } + + @GetMapping("/sec_responsible_acts") + String showSecondaryResponsible() { + + User user = (User) SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + List activities = activityService.findSecondaryResponsibleActs(user); + return JSONObject.toJSONString(activities); + } + + @GetMapping("/acts_by_type") + String showInType(@RequestParam(defaultValue = "考勤", name = "type") String type) { + + User user = (User) SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + List activities = activityService.findActivityByType(user, type); + return JSONObject.toJSONString(activities); } } diff --git a/src/main/java/com/codesdream/ase/exception/LackOfActivityInformation.java b/src/main/java/com/codesdream/ase/exception/LackOfActivityInformation.java deleted file mode 100644 index 9b6425a..0000000 --- a/src/main/java/com/codesdream/ase/exception/LackOfActivityInformation.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.codesdream.ase.exception; - -import lombok.Data; -import lombok.EqualsAndHashCode; - -@EqualsAndHashCode(callSuper = true) -@Data -public class LackOfActivityInformation extends Throwable { - private String message = ""; - - public LackOfActivityInformation(){super();} - - public LackOfActivityInformation(String message){this.message = message;} -} diff --git a/src/main/java/com/codesdream/ase/exception/LackOfActivityInformationException.java b/src/main/java/com/codesdream/ase/exception/LackOfActivityInformationException.java new file mode 100644 index 0000000..656d2ca --- /dev/null +++ b/src/main/java/com/codesdream/ase/exception/LackOfActivityInformationException.java @@ -0,0 +1,18 @@ +package com.codesdream.ase.exception; + +import lombok.Data; +import lombok.EqualsAndHashCode; + +@EqualsAndHashCode(callSuper = true) +@Data +public class LackOfActivityInformationException extends Throwable { + private String message = ""; + + public LackOfActivityInformationException() { + super(); + } + + public LackOfActivityInformationException(String message) { + this.message = message; + } +} diff --git a/src/main/java/com/codesdream/ase/model/activity/UserActivity.java b/src/main/java/com/codesdream/ase/model/activity/UserActivity.java index 01add89..7e54c53 100644 --- a/src/main/java/com/codesdream/ase/model/activity/UserActivity.java +++ b/src/main/java/com/codesdream/ase/model/activity/UserActivity.java @@ -23,33 +23,33 @@ public class UserActivity { //主要负责的活动 @OneToMany(cascade = {CascadeType.MERGE, CascadeType.DETACH, CascadeType.PERSIST}, fetch = FetchType.LAZY) - private List manageActivities; + private List mainResponsibleActs; //次要负责的活动 @ManyToMany(cascade = {CascadeType.MERGE, CascadeType.DETACH, CascadeType.PERSIST}, fetch = FetchType.LAZY) - private List assistActivities; + private List secondaryResponsibleActs; //可见的活动 @OneToMany(cascade = {CascadeType.MERGE, CascadeType.DETACH, CascadeType.PERSIST}, fetch = FetchType.LAZY) - private List visibleActivities; + private List visibleActs; //创建的活动 @OneToMany(cascade = {CascadeType.MERGE, CascadeType.DETACH, CascadeType.PERSIST}, fetch = FetchType.LAZY) - private List createdActivities; + private List createdActs; //可报名的活动 @OneToMany(cascade = {CascadeType.MERGE, CascadeType.DETACH, CascadeType.PERSIST}, fetch = FetchType.LAZY) - private List signUpActivities; + private List signUpActs; //已经参与的活动 @OneToMany(cascade = {CascadeType.MERGE, CascadeType.DETACH, CascadeType.PERSIST}, fetch = FetchType.LAZY) - private List participatedActivities; + private List participatedActs; //正在(将要)参与的活动 @OneToMany(cascade = {CascadeType.MERGE, CascadeType.DETACH, CascadeType.PERSIST}, fetch = FetchType.LAZY) - private List participatingActivities; + private List participatingActs; //打卡签到活动 @OneToMany(cascade = {CascadeType.MERGE, CascadeType.DETACH, CascadeType.PERSIST}, fetch = FetchType.LAZY) - private List clockIn; + private List clockIns; } diff --git a/src/main/java/com/codesdream/ase/repository/activity/ActivityRepository.java b/src/main/java/com/codesdream/ase/repository/activity/ActivityRepository.java index 77c49bd..6700258 100644 --- a/src/main/java/com/codesdream/ase/repository/activity/ActivityRepository.java +++ b/src/main/java/com/codesdream/ase/repository/activity/ActivityRepository.java @@ -1,16 +1,23 @@ package com.codesdream.ase.repository.activity; import com.codesdream.ase.model.activity.Activity; +import com.codesdream.ase.model.permission.User; +import org.springframework.data.domain.Sort; +import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.query.Param; import org.springframework.stereotype.Repository; +import java.util.List; import java.util.Optional; @Repository -public interface ActivityRepository extends CrudRepository { +public interface ActivityRepository extends JpaRepository { Optional findByTitle(String Title); Optional findByCreator(String creatorName); + List findByUserAndType(User user, String type); + } \ No newline at end of file diff --git a/src/main/java/com/codesdream/ase/repository/activity/UserActivityRepository.java b/src/main/java/com/codesdream/ase/repository/activity/UserActivityRepository.java index 80ff99c..dbbef67 100644 --- a/src/main/java/com/codesdream/ase/repository/activity/UserActivityRepository.java +++ b/src/main/java/com/codesdream/ase/repository/activity/UserActivityRepository.java @@ -1,14 +1,17 @@ package com.codesdream.ase.repository.activity; +import com.codesdream.ase.model.activity.Activity; import com.codesdream.ase.model.activity.UserActivity; import com.codesdream.ase.model.permission.User; import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; +import java.util.List; import java.util.Optional; @Repository public interface UserActivityRepository extends CrudRepository { UserActivity findByUser(User user); + } diff --git a/src/main/java/com/codesdream/ase/service/ActivityService.java b/src/main/java/com/codesdream/ase/service/ActivityService.java index 1c683b8..899acf3 100644 --- a/src/main/java/com/codesdream/ase/service/ActivityService.java +++ b/src/main/java/com/codesdream/ase/service/ActivityService.java @@ -1,13 +1,17 @@ package com.codesdream.ase.service; import com.codesdream.ase.model.activity.Activity; +import com.codesdream.ase.model.activity.Period; import com.codesdream.ase.model.activity.Report; +import com.codesdream.ase.model.activity.UserActivity; import com.codesdream.ase.model.permission.User; import com.codesdream.ase.repository.activity.ActivityRepository; +import com.codesdream.ase.repository.activity.UserActivityRepository; import org.springframework.stereotype.Service; import javax.annotation.Resource; -import java.util.Optional; +import java.time.LocalDateTime; +import java.util.*; @Service public class ActivityService implements IActivityService { @@ -15,6 +19,9 @@ public class ActivityService implements IActivityService { @Resource private ActivityRepository activityRepository; + @Resource + private UserActivityRepository userActivityRepository; + @Override public Optional findActivityByTitle(String title) { return activityRepository.findByTitle(title); @@ -25,6 +32,12 @@ public class ActivityService implements IActivityService { return activityRepository.findByCreator(creatorName); } + + @Override + public List findActivityByType(User user, String type) { + return activityRepository.findByUserAndType(user, type); + } + @Override public Activity save(Activity activity) { return activityRepository.save(activity); @@ -51,9 +64,109 @@ public class ActivityService implements IActivityService { return activityRepository.save(activity); } - /*@Override - public Activity findActivitiesInTheCharge(User user) { + @Override + public List findMainResponsibleActs(User user) { + + UserActivity userActivity = userActivityRepository.findByUser(user); + List acts = userActivity.getMainResponsibleActs(); + Collections.sort(acts, new ActivityComparator()); + return acts; + } + + @Override + public List findSecondaryResponsibleActs(User user) { + + UserActivity userActivity = userActivityRepository.findByUser(user); + List acts = userActivity.getSecondaryResponsibleActs(); + Collections.sort(acts, new ActivityComparator()); + return acts; + } + + @Override + public List findVisibleActs(User user) { + + UserActivity userActivity = userActivityRepository.findByUser(user); + List acts = userActivity.getVisibleActs(); + Collections.sort(acts, new ActivityComparator()); + return acts; + } + + @Override + public List findSignActs(User user) { + + UserActivity userActivity = userActivityRepository.findByUser(user); + List acts = userActivity.getSignUpActs(); + Collections.sort(acts, new ActivityComparator()); + return acts; + } + + @Override + public List findParticipatedActs(User user) { + + UserActivity userActivity = userActivityRepository.findByUser(user); + List acts = userActivity.getParticipatedActs(); + Collections.sort(acts, new ActivityComparator()); + return acts; + } + + @Override + public List findParticipatingActs(User user) { + + UserActivity userActivity = userActivityRepository.findByUser(user); + List acts = userActivity.getParticipatingActs(); + Collections.sort(acts, new ActivityComparator()); + return acts; + } + + @Override + public List findCreatedActs(User user) { + + UserActivity userActivity = userActivityRepository.findByUser(user); + List acts = userActivity.getCreatedActs(); + Collections.sort(acts, new ActivityComparator()); + return acts; + } + + @Override + public List findAll(User user) { + + List activities = findCreatedActs(user); + List activities1 = findMainResponsibleActs(user); + List activities2 = findSecondaryResponsibleActs(user); + List activities3 = findParticipatingActs(user); + List activities4 = findParticipatedActs(user); + List activities5 = findParticipatingActs(user); + List activities6 = findSignActs(user); + List activities7 = findVisibleActs(user); + Set activitySet = new HashSet<>(); + activitySet.addAll(activities); + activitySet.addAll(activities1); + activitySet.addAll(activities2); + activitySet.addAll(activities3); + activitySet.addAll(activities4); + activitySet.addAll(activities5); + activitySet.addAll(activities6); + activitySet.addAll(activities7); + List res = new ArrayList<>(activitySet); + Collections.sort(res, new ActivityComparator()); + return res; + } - }*/ } + +class ActivityComparator implements Comparator { + + + @Override + public int compare(Activity o1, Activity o2) { + + Period p1 = o1.getRealPeriod(); + Period p2 = o2.getRealPeriod(); + LocalDateTime s1 = p1.getStartTime(); + LocalDateTime s2 = p2.getStartTime(); + if (s1.isBefore(s2)) return -1; + else if (s1.isAfter(s2)) return 1; + else return 0; + } +} \ No newline at end of file diff --git a/src/main/java/com/codesdream/ase/service/IActivityService.java b/src/main/java/com/codesdream/ase/service/IActivityService.java index 1e9ba3e..0e85465 100644 --- a/src/main/java/com/codesdream/ase/service/IActivityService.java +++ b/src/main/java/com/codesdream/ase/service/IActivityService.java @@ -4,6 +4,7 @@ import com.codesdream.ase.model.activity.Activity; import com.codesdream.ase.model.activity.Report; import com.codesdream.ase.model.permission.User; +import java.util.List; import java.util.Optional; public interface IActivityService { @@ -13,6 +14,9 @@ public interface IActivityService { //通过创建人姓名查找活动 Optional findActivityByCreator(String creatorName); + //通过活动类型查找活动 + List findActivityByType(User user, String type); + //活动持久化 Activity save(Activity activity); @@ -29,6 +33,27 @@ public interface IActivityService { Activity createActivity(Activity activity); //查询主要负责的活动 - //Activity findActivitiesInTheCharge(User user); + List findMainResponsibleActs(User user); + + //查询次要负责的活动 + List findSecondaryResponsibleActs(User user); + + //查询所有可见活动(即可报名活动、主次要负责的活动、参与过的活动等等之外却仍然可见的活动并集) + List findVisibleActs(User user); + + //查找可报名的活动 + List findSignActs(User user); + + //查询参与过的活动 + List findParticipatedActs(User user); + + //查询将要参与的活动 + List findParticipatingActs(User user); + + //查询创建的活动 + List findCreatedActs(User user); + + //查询所有活动(权限内) + List findAll(User user); }