diff --git a/server/.idea/workspace.xml b/server/.idea/workspace.xml
index a846d08b..0528177c 100644
--- a/server/.idea/workspace.xml
+++ b/server/.idea/workspace.xml
@@ -145,7 +145,7 @@
-
+
diff --git a/server/src/main/java/self/cases/teams/controller/ClubshenqingController.java b/server/src/main/java/self/cases/teams/controller/ClubshenqingController.java
new file mode 100644
index 00000000..40b44c6e
--- /dev/null
+++ b/server/src/main/java/self/cases/teams/controller/ClubshenqingController.java
@@ -0,0 +1,124 @@
+package self.cases.teams.controller;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.*;
+import self.cases.teams.entity.Clubshenqing;
+import self.cases.teams.msg.R;
+
+import java.util.List;
+
+@Controller
+@RequestMapping("/clubshenqing")
+public class ClubshenqingController {
+
+ protected static final Logger Log = LoggerFactory.getLogger(ClubshenqingController.class);
+
+ @Autowired
+ private ClubshenqingService clubshenqingService;
+
+ @PostMapping("/create")
+ @ResponseBody
+ public R createActivity(@RequestBody Clubshenqing activity) {
+ // 验证活动名称是否已存在
+ if (clubshenqingService.isActivityNameExists(activity.getActivityName())) {
+ return R.error("活动名称已存在");
+ }
+
+ // 创建活动
+ Clubshenqing createdActivity = clubshenqingService.createActivity(activity);
+ Log.info("新活动创建成功,ID:{}", createdActivity.getId());
+
+ return R.successData(createdActivity);
+ }
+
+ @PutMapping("/update")
+ @ResponseBody
+ public R updateActivity(@RequestBody Clubshenqing activity) {
+ // 验证活动是否存在
+ Clubshenqing existingActivity = clubshenqingService.getActivityById(activity.getId());
+ if (existingActivity == null) {
+ return R.error("活动不存在");
+ }
+
+ // 更新活动
+ Clubshenqing updatedActivity = clubshenqingService.updateActivity(activity);
+ Log.info("活动更新成功,ID:{}", updatedActivity.getId());
+
+ return R.successData(updatedActivity);
+ }
+
+ @GetMapping("/get/{id}")
+ @ResponseBody
+ public R getActivityById(@PathVariable String id) {
+ Clubshenqing activity = clubshenqingService.getActivityById(id);
+ if (activity == null) {
+ return R.error("活动不存在");
+ }
+
+ return R.successData(activity);
+ }
+
+ @GetMapping("/getAll")
+ @ResponseBody
+ public R getAllActivities() {
+ List activities = clubshenqingService.getAllActivities();
+ return R.successData(activities);
+ }
+
+ @DeleteMapping("/delete/{id}")
+ @ResponseBody
+ public R deleteActivity(@PathVariable String id) {
+ clubshenqingService.deleteActivity(id);
+ Log.info("活动删除成功,ID:{}", id);
+
+ return R.success();
+ }
+
+ @GetMapping("/getByClubName/{clubName}")
+ @ResponseBody
+ public R getActivitiesByClubName(@PathVariable String clubName) {
+ List activities = clubshenqingService.getActivitiesByClubName(clubName);
+ return R.successData(activities);
+ }
+
+ @GetMapping("/getApproved")
+ @ResponseBody
+ public R getApprovedActivities() {
+ List activities = clubshenqingService.getApprovedActivities();
+ return R.successData(activities);
+ }
+
+ @GetMapping("/getPending")
+ @ResponseBody
+ public R getPendingActivities() {
+ List activities = clubshenqingService.getPendingActivities();
+ return R.successData(activities);
+ }
+
+ @PutMapping("/approve/{id}")
+ @ResponseBody
+ public R approveActivity(@PathVariable String id) {
+ Clubshenqing activity = clubshenqingService.approveActivity(id);
+ if (activity == null) {
+ return R.error("活动不存在");
+ }
+
+ Log.info("活动审批成功,ID:{}", id);
+ return R.successData(activity);
+ }
+
+ @PutMapping("/reject/{id}")
+ @ResponseBody
+ public R rejectActivity(@PathVariable String id) {
+ Clubshenqing activity = clubshenqingService.rejectActivity(id);
+ if (activity == null) {
+ return R.error("活动不存在");
+ }
+
+ Log.info("活动拒绝成功,ID:{}", id);
+ return R.successData(activity);
+ }
+}
diff --git a/server/src/main/java/self/cases/teams/entity/Clubshenqing.java b/server/src/main/java/self/cases/teams/entity/Clubshenqing.java
new file mode 100644
index 00000000..43e66206
--- /dev/null
+++ b/server/src/main/java/self/cases/teams/entity/Clubshenqing.java
@@ -0,0 +1,135 @@
+package self.cases.teams.entity;
+
+
+import java.util.Date;
+
+public class Clubshenqing {
+ private String id;
+ private String clubName;
+ private String activityName;
+ private String description;
+ private Date startDate;
+ private Date endDate;
+ private String location;
+ private int maxParticipants;
+ private String contactPerson;
+ private String contactEmail;
+ private String contactPhone;
+ private boolean approved;
+ private Date createdAt;
+ private Date updatedAt;
+
+ // Getters and Setters
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getClubName() {
+ return clubName;
+ }
+
+ public void setClubName(String clubName) {
+ this.clubName = clubName;
+ }
+
+ public String getActivityName() {
+ return activityName;
+ }
+
+ public void setActivityName(String activityName) {
+ this.activityName = activityName;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public Date getStartDate() {
+ return startDate;
+ }
+
+ public void setStartDate(Date startDate) {
+ this.startDate = startDate;
+ }
+
+ public Date getEndDate() {
+ return endDate;
+ }
+
+ public void setEndDate(Date endDate) {
+ this.endDate = endDate;
+ }
+
+ public String getLocation() {
+ return location;
+ }
+
+ public void setLocation(String location) {
+ this.location = location;
+ }
+
+ public int getMaxParticipants() {
+ return maxParticipants;
+ }
+
+ public void setMaxParticipants(int maxParticipants) {
+ this.maxParticipants = maxParticipants;
+ }
+
+ public String getContactPerson() {
+ return contactPerson;
+ }
+
+ public void setContactPerson(String contactPerson) {
+ this.contactPerson = contactPerson;
+ }
+
+ public String getContactEmail() {
+ return contactEmail;
+ }
+
+ public void setContactEmail(String contactEmail) {
+ this.contactEmail = contactEmail;
+ }
+
+ public String getContactPhone() {
+ return contactPhone;
+ }
+
+ public void setContactPhone(String contactPhone) {
+ this.contactPhone = contactPhone;
+ }
+
+ public boolean isApproved() {
+ return approved;
+ }
+
+ public void setApproved(boolean approved) {
+ this.approved = approved;
+ }
+
+ public Date getCreatedAt() {
+ return createdAt;
+ }
+
+ public void setCreatedAt(Date createdAt) {
+ this.createdAt = createdAt;
+ }
+
+ public Date getUpdatedAt() {
+ return updatedAt;
+ }
+
+ public void setUpdatedAt(Date updatedAt) {
+ this.updatedAt = updatedAt;
+ }
+}
+
diff --git a/server/src/main/java/self/cases/teams/msg/R.java b/server/src/main/java/self/cases/teams/msg/R.java
index 5a1570ed..ebf1ae93 100644
--- a/server/src/main/java/self/cases/teams/msg/R.java
+++ b/server/src/main/java/self/cases/teams/msg/R.java
@@ -7,6 +7,8 @@ import java.util.HashMap;
*/
public class R extends HashMap {
+
+
/** 处理成功,响应码 */
public static final Integer SUCCESS_CODE = 0;
diff --git a/server/src/main/java/self/cases/teams/teaa/SheYuan.java b/server/src/main/java/self/cases/teams/teaa/SheYuan.java
new file mode 100644
index 00000000..850fde27
--- /dev/null
+++ b/server/src/main/java/self/cases/teams/teaa/SheYuan.java
@@ -0,0 +1,380 @@
+package self.cases.teams.teaa;
+
+import java.time.Instant;
+import java.util.*;
+import java.time.LocalDate;
+import java.util.stream.Collectors;
+
+public class SheYuan {
+
+ private Map members;
+
+ public SheYuan() {
+ members = new HashMap<>();
+ }
+
+ // Inner class to represent a Member
+ public static class Member {
+ private int memberId;
+ private String name;
+ private String email;
+ private String password;
+ private LocalDate dateOfBirth;
+ private String address;
+ private String phoneNumber;
+ private boolean isActive;
+ private String groupName;
+ private List friendIds;
+
+ public Member(int memberId, String name, String email, String password, LocalDate dateOfBirth, String address, String phoneNumber) {
+ this.memberId = memberId;
+ this.name = name;
+ this.email = email;
+ this.password = password;
+ this.dateOfBirth = dateOfBirth;
+ this.address = address;
+ this.phoneNumber = phoneNumber;
+ this.isActive = true;
+ this.friendIds = new ArrayList<>();
+ }
+
+ public int getMemberId() {
+ return memberId;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getEmail() {
+ return email;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public LocalDate getDateOfBirth() {
+ return dateOfBirth;
+ }
+
+ public String getAddress() {
+ return address;
+ }
+
+ public String getPhoneNumber() {
+ return phoneNumber;
+ }
+
+ public boolean isActive() {
+ return isActive;
+ }
+
+ public void deactivate() {
+ this.isActive = false;
+ }
+
+ public String getGroupName() {
+ return groupName;
+ }
+
+ public void setGroupName(String groupName) {
+ this.groupName = groupName;
+ }
+
+ public List getFriendIds() {
+ return friendIds;
+ }
+
+ public void addFriend(int friendId) {
+ friendIds.add(friendId);
+ }
+
+ public void removeFriend(int friendId) {
+ friendIds.remove((Integer) friendId);
+ }
+
+ @Override
+ public String toString() {
+ return "Member{" +
+ "memberId=" + memberId +
+ ", name='" + name + '\\' +
+ ", email='" + email + '\\' +
+ ", password='" + password + '\\' +
+ ", dateOfBirth=" + dateOfBirth +
+ ", address='" + address + '\\' +
+ ", phoneNumber='" + phoneNumber + '\\' +
+ ", isActive=" + isActive +
+ ", groupName='" + groupName + '\\' +
+ ", friendIds=" + friendIds +
+ '}';
+ }
+
+ public void setName(String newName) {
+ }
+
+ public void setEmail(String newEmail) {
+ }
+
+ public void setPassword(String newPassword) {
+ }
+
+ public void setDateOfBirth(LocalDate newDateOfBirth) {
+ }
+
+ public void setAddress(String newAddress) {
+ }
+
+ public void setPhoneNumber(String newPhoneNumber) {
+ }
+
+ public Instant getLastLoginDate() {
+ return null;
+ }
+ }
+
+ // Method to add a member
+ public void addMember(int memberId, String name, String email, String password, LocalDate dateOfBirth, String address, String phoneNumber) {
+ if (members.containsKey(memberId)) {
+ throw new IllegalArgumentException("Member already exists");
+ }
+ members.put(memberId, new Member(memberId, name, email, password, dateOfBirth, address, phoneNumber));
+ }
+
+ // Method to remove a member
+ public void removeMember(int memberId) {
+ if (!members.containsKey(memberId)) {
+ throw new IllegalArgumentException("Member not found");
+ }
+ members.remove(memberId);
+ }
+
+ // Method to list all members
+ public List listAllMembers() {
+ return new ArrayList<>(members.values());
+ }
+
+ // Method to find a member by ID
+ public Member findMemberById(int memberId) {
+ return members.get(memberId);
+ }
+
+ // Method to deactivate a member
+ public void deactivateMember(int memberId) {
+ Member member = members.get(memberId);
+ if (member == null) {
+ throw new IllegalArgumentException("Member not found");
+ }
+ member.deactivate();
+ }
+
+ // Method to update member information
+ public void updateMember(int memberId, String newName, String newEmail, String newPassword, LocalDate newDateOfBirth, String newAddress, String newPhoneNumber) {
+ Member member = members.get(memberId);
+ if (member == null) {
+ throw new IllegalArgumentException("Member not found");
+ }
+ member.setName(newName);
+ member.setEmail(newEmail);
+ member.setPassword(newPassword);
+ member.setDateOfBirth(newDateOfBirth);
+ member.setAddress(newAddress);
+ member.setPhoneNumber(newPhoneNumber);
+ }
+
+ // Method to search for members by email
+ public List searchMembersByEmail(String email) {
+ return members.values().stream()
+ .filter(m -> m.getEmail().toLowerCase().contains(email.toLowerCase()))
+ .collect(Collectors.toList());
+ }
+
+ // Method to search for members by phone number
+ public List searchMembersByPhoneNumber(String phoneNumber) {
+ return members.values().stream()
+ .filter(m -> m.getPhoneNumber().equals(phoneNumber))
+ .collect(Collectors.toList());
+ }
+
+ // Method to search for members by date of birth
+ public List searchMembersByDateOfBirth(LocalDate dateOfBirth) {
+ return members.values().stream()
+ .filter(m -> m.getDateOfBirth().equals(dateOfBirth))
+ .collect(Collectors.toList());
+ }
+
+ // Method to search for members by address
+ public List searchMembersByAddress(String address) {
+ return members.values().stream()
+ .filter(m -> m.getAddress().toLowerCase().contains(address.toLowerCase()))
+ .collect(Collectors.toList());
+ }
+
+ // Method to search for members by active status
+ public List searchMembersByActiveStatus(boolean isActive) {
+ return members.values().stream()
+ .filter(m -> m.isActive() == isActive)
+ .collect(Collectors.toList());
+ }
+
+ // Method to assign a member to a group
+ public void assignMemberToGroup(int memberId, String groupName) {
+ Member member = members.get(memberId);
+ if (member == null) {
+ throw new IllegalArgumentException("Member not found");
+ }
+ member.setGroupName(groupName);
+ }
+
+ // Method to unassign a member from a group
+ public void unassignMemberFromGroup(int memberId) {
+ Member member = members.get(memberId);
+ if (member == null) {
+ throw new IllegalArgumentException("Member not found");
+ }
+ member.setGroupName(null);
+ }
+
+ // Method to list all members assigned to a group
+ public List listMembersAssignedToGroup(String groupName) {
+ return members.values().stream()
+ .filter(m -> m.getGroupName() != null && m.getGroupName().equals(groupName))
+ .collect(Collectors.toList());
+ }
+
+ // Method to list all groups a member is assigned to
+ public List listGroupsForMember(int memberId) {
+ Member member = members.get(memberId);
+ if (member == null) {
+ throw new IllegalArgumentException("Member not found");
+ }
+ return Collections.singletonList(member.getGroupName());
+ }
+
+ // Method to list all members with more than 10 active friends
+ public List listMembersWithMoreThanTenActiveFriends() {
+ return members.values().stream()
+ .filter(m -> m.getFriendIds().size() > 10)
+ .collect(Collectors.toList());
+ }
+
+ // Method to list all members who are active in any group
+ public List listActiveMembersInAnyGroup() {
+ return members.values().stream()
+ .filter(Member::isActive)
+ .collect(Collectors.toList());
+ }
+
+ // Method to list all members that have been registered within the last month
+ public List listRecentRegistrations() {
+ LocalDate oneMonthAgo = LocalDate.now().minusMonths(1);
+ return members.values().stream()
+ .filter(m -> !m.getDateOfBirth().isBefore(oneMonthAgo))
+ .collect(Collectors.toList());
+ }
+
+ // Method to list all members who have logged in within the last year
+ public List listMembersLoggedInInLastYear() {
+ LocalDate oneYearAgo = LocalDate.now().minusYears(1);
+ return members.values().stream()
+ .filter(m -> m.getLastLoginDate().isAfter(Instant.from(oneYearAgo)))
+ .collect(Collectors.toList());
+ }
+
+ // Method to list all members who have logged in within the last month and have more than 10 active friends
+ public List listMembersLoggedInInLastMonthWithMoreThanTenActiveFriends() {
+ LocalDate oneMonthAgo = LocalDate.now().minusMonths(1);
+ return members.values().stream()
+ .filter(m -> m.getLastLoginDate().isAfter(Instant.from(oneMonthAgo)) && m.getFriendIds().size() > 10)
+ .collect(Collectors.toList());
+ }
+
+ // Method to list all members who have logged in within the last year and have more than 10 active friends
+ public List listMembersLoggedInInLastYearWithMoreThanTenActiveFriends() {
+ LocalDate oneYearAgo = LocalDate.now().minusYears(1);
+ return members.values().stream()
+ .filter(m -> m.getLastLoginDate().isAfter(Instant.from(oneYearAgo)) && m.getFriendIds().size() > 10)
+ .collect(Collectors.toList());
+ }
+
+ // Method to list all members who have logged in within the last year and have more than 10 active friends in a specific group
+ public List listMembersLoggedInInLastYearWithMoreThanTenActiveFriendsInGroup(String groupName) {
+ LocalDate oneYearAgo = LocalDate.now().minusYears(1);
+ return members.values().stream()
+ .filter(m -> m.getLastLoginDate().isAfter(Instant.from(oneYearAgo)) && m.getFriendIds().size() > 10 && m.getGroupName().equals(groupName))
+ .collect(Collectors.toList());
+ }
+
+ // Method to list all members who have logged in within the last year and have more than 10 active friends in a specific group and have a specific address
+ public List listMembersLoggedInInLastYearWithMoreThanTenActiveFriendsInGroupAndSpecificAddress(String groupName, String address) {
+ LocalDate oneYearAgo = LocalDate.now().minusYears(1);
+ return members.values().stream()
+ .filter(m -> m.getLastLoginDate().isAfter(Instant.from(oneYearAgo)) && m.getFriendIds().size() > 10 && m.getGroupName().equals(groupName) && m.getAddress().equals(address))
+ .collect(Collectors.toList());
+ }
+
+ // Method to list all members who have logged in within the last year and have more than 10 active friends in a specific group and have a specific address and phone number
+ public List listMembersLoggedInInLastYearWithMoreThanTenActiveFriendsInGroupAndSpecificAddressAndPhoneNumber(String groupName, String address, String phoneNumber) {
+ LocalDate oneYearAgo = LocalDate.now().minusYears(1);
+ return members.values().stream()
+ .filter(m -> m.getLastLoginDate().isAfter(Instant.from(oneYearAgo)) && m.getFriendIds().size() > 10 && m.getGroupName().equals(groupName) && m.getAddress().equals(address) && m.getPhoneNumber().equals(phoneNumber))
+ .collect(Collectors.toList());
+ }
+
+ // Method to list all members who have logged in within the last year and have more than 10 active friends in a specific group and have a specific address and phone number and are active
+ public List listMembersLoggedInInLastYearWithMoreThanTenActiveFriendsInGroupAndSpecificAddressAndPhoneNumberAndActive(String groupName, String address, String phoneNumber) {
+ LocalDate oneYearAgo = LocalDate.now().minusYears(1);
+ return members.values().stream()
+ .filter(m -> m.getLastLoginDate().isAfter(Instant.from(oneYearAgo)) && m.getFriendIds().size() > 10 && m.getGroupName().equals(groupName) && m.getAddress().equals(address) && m.getPhoneNumber().equals(phoneNumber) && m.isActive())
+ .collect(Collectors.toList());
+ }
+
+ // Method to list all members who have logged in within the last year and have more than 10 active friends in a specific group and have a specific address and phone number and are active and have a specific name
+ public List listMembersLoggedInInLastYearWithMoreThanTenActiveFriendsInGroupAndSpecificAddressAndPhoneNumberAndActiveAndSpecificName(String groupName, String address, String phoneNumber, String name) {
+ LocalDate oneYearAgo = LocalDate.now().minusYears(1);
+ return members.values().stream()
+ .filter(m -> m.getLastLoginDate().isAfter(Instant.from(oneYearAgo)) && m.getFriendIds().size() > 10 && m.getGroupName().equals(groupName) && m.getAddress().equals(address) && m.getPhoneNumber().equals(phoneNumber) && m.isActive() && m.getName().equals(name))
+ .collect(Collectors.toList());
+ }
+
+ // Method to list all members who have logged in within the last year and have more than 10 active friends in a specific group and have a specific address and phone number and are active and have a specific name and email
+ public List listMembersLoggedInInLastYearWithMoreThanTenActiveFriendsInGroupAndSpecificAddressAndPhoneNumberAndActiveAndSpecificNameAndEmail(String groupName, String address, String phoneNumber, String name, String email) {
+ LocalDate oneYearAgo = LocalDate.now().minusYears(1);
+ return members.values().stream()
+ .filter(m -> m.getLastLoginDate().isAfter(Instant.from(oneYearAgo)) && m.getFriendIds().size() > 10 && m.getGroupName().equals(groupName) && m.getAddress().equals(address) && m.getPhoneNumber().equals(phoneNumber) && m.isActive() && m.getName().equals(name) && m.getEmail().equals(email))
+ .collect(Collectors.toList());
+ }
+
+ // Method to list all members who have logged in within the last year and have more than 10 active friends in a specific group and have a specific address and phone number and are active and have a specific name and email and password
+ public List listMembersLoggedInInLastYearWithMoreThanTenActiveFriendsInGroupAndSpecificAddressAndPhoneNumberAndActiveAndSpecificNameAndEmailAndPassword(String groupName, String address, String phoneNumber, String name, String email, String password) {
+ LocalDate oneYearAgo = LocalDate.now().minusYears(1);
+ return members.values().stream()
+ .filter(m -> m.getLastLoginDate().isAfter(Instant.from(oneYearAgo)) && m.getFriendIds().size() > 10 && m.getGroupName().equals(groupName) && m.getAddress().equals(address) && m.getPhoneNumber().equals(phoneNumber) && m.isActive() && m.getName().equals(name) && m.getEmail().equals(email) && m.getPassword().equals(password))
+ .collect(Collectors.toList());
+ }
+
+ // Method to list all members who have logged in within the last year and have more than 10 active friends in a specific group and have a specific address and phone number and are active and have a specific name and email and password and date of birth
+ public List listMembersLoggedInInLastYearWithMoreThanTenActiveFriendsInGroupAndSpecificAddressAndPhoneNumberAndActiveAndSpecificNameAndEmailAndPasswordAndDateOfBirth(String groupName, String address, String phoneNumber, String name, String email, String password, LocalDate dateOfBirth) {
+ LocalDate oneYearAgo = LocalDate.now().minusYears(1);
+ return members.values().stream()
+ .filter(m -> m.getLastLoginDate().isAfter(Instant.from(oneYearAgo)) && m.getFriendIds().size() > 10 && m.getGroupName().equals(groupName) && m.getAddress().equals(address) && m.getPhoneNumber().equals(phoneNumber) && m.isActive() && m.getName().equals(name) && m.getEmail().equals(email) && m.getPassword().equals(password) && m.getDateOfBirth().equals(dateOfBirth))
+ .collect(Collectors.toList());
+ }
+
+ // Method to list all members who have logged in within the last year and have more than 10 active friends in a specific group and have a specific address and phone number and are active and have a specific name and email and password and date of birth and address
+ public List listMembersLoggedInInLastYearWithMoreThanTenActiveFriendsInGroupAndSpecificAddressAndPhoneNumberAndActiveAndSpecificNameAndEmailAndPasswordAndDateOfBirthAndAddress(String groupName, String address, String phoneNumber, String name, String email, String password, LocalDate dateOfBirth, String addressDetail) {
+ LocalDate oneYearAgo = LocalDate.now().minusYears(1);
+ return members.values().stream()
+ .filter(m -> m.getLastLoginDate().isAfter(Instant.from(oneYearAgo)) && m.getFriendIds().size() > 10 && m.getGroupName().equals(groupName) && m.getAddress().equals(address) && m.getPhoneNumber().equals(phoneNumber) && m.isActive() && m.getName().equals(name) && m.getEmail().equals(email) && m.getPassword().equals(password) && m.getDateOfBirth().equals(dateOfBirth) && m.getAddress().equals(addressDetail))
+ .collect(Collectors.toList());
+ }
+
+ // Method to list all members who have logged in within the last year and have more than 10 active friends in a specific group and have a specific address and phone number and are active and have a specific name and email and password and date of birth and address and phone number
+ public List listMembersLoggedInInLastYearWithMoreThanTenActiveFriendsInGroupAndSpecificAddressAndPhoneNumberAndActiveAndSpecificNameAndEmailAndPasswordAndDateOfBirthAndAddressAndPhoneNumber(String groupName, String address, String phoneNumber, String name, String email, String password, LocalDate dateOfBirth, String addressDetail, String phoneNumberDetail) {
+ LocalDate oneYearAgo = LocalDate.now().minusYears(1);
+ return members.values().stream()
+ .filter(m -> m.getLastLoginDate().isAfter(Instant.from(oneYearAgo)) && m.getFriendIds().size() > 10 && m.getGroupName().equals(groupName) && m.getAddress().equals(address) && m.getPhoneNumber().equals(phoneNumber) && m.isActive() && m.getName().equals(name) && m.getEmail().equals(email) && m.getPassword().equals(password) && m.getDateOfBirth().equals(dateOfBirth) && m.getAddress().equals(addressDetail) && m.getPhoneNumber().equals(phoneNumberDetail))
+ .collect(Collectors.toList());
+ }
+
+}
diff --git a/server/src/main/java/self/cases/teams/teaa/SheZhangManage.java b/server/src/main/java/self/cases/teams/teaa/SheZhangManage.java
new file mode 100644
index 00000000..a9fc2423
--- /dev/null
+++ b/server/src/main/java/self/cases/teams/teaa/SheZhangManage.java
@@ -0,0 +1,380 @@
+package self.cases.teams.teaa;
+
+import java.time.Instant;
+import java.util.*;
+import java.time.LocalDate;
+import java.util.stream.Collectors;
+
+public class SheZhangManage {
+
+ private Map members;
+
+ public SheZhangManage() {
+ members = new HashMap<>();
+ }
+
+ // Inner class to represent a Member
+ public static class Member {
+ private int memberId;
+ private String name;
+ private String email;
+ private String password;
+ private LocalDate dateOfBirth;
+ private String address;
+ private String phoneNumber;
+ private boolean isActive;
+ private String groupName;
+ private List friendIds;
+
+ public Member(int memberId, String name, String email, String password, LocalDate dateOfBirth, String address, String phoneNumber) {
+ this.memberId = memberId;
+ this.name = name;
+ this.email = email;
+ this.password = password;
+ this.dateOfBirth = dateOfBirth;
+ this.address = address;
+ this.phoneNumber = phoneNumber;
+ this.isActive = true;
+ this.friendIds = new ArrayList<>();
+ }
+
+ public int getMemberId() {
+ return memberId;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getEmail() {
+ return email;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public LocalDate getDateOfBirth() {
+ return dateOfBirth;
+ }
+
+ public String getAddress() {
+ return address;
+ }
+
+ public String getPhoneNumber() {
+ return phoneNumber;
+ }
+
+ public boolean isActive() {
+ return isActive;
+ }
+
+ public void deactivate() {
+ this.isActive = false;
+ }
+
+ public String getGroupName() {
+ return groupName;
+ }
+
+ public void setGroupName(String groupName) {
+ this.groupName = groupName;
+ }
+
+ public List getFriendIds() {
+ return friendIds;
+ }
+
+ public void addFriend(int friendId) {
+ friendIds.add(friendId);
+ }
+
+ public void removeFriend(int friendId) {
+ friendIds.remove((Integer) friendId);
+ }
+
+ @Override
+ public String toString() {
+ return "Member{" +
+ "memberId=" + memberId +
+ ", name='" + name + '\\' +
+ ", email='" + email + '\\' +
+ ", password='" + password + '\\' +
+ ", dateOfBirth=" + dateOfBirth +
+ ", address='" + address + '\\' +
+ ", phoneNumber='" + phoneNumber + '\\' +
+ ", isActive=" + isActive +
+ ", groupName='" + groupName + '\\' +
+ ", friendIds=" + friendIds +
+ '}';
+ }
+
+ public void setName(String newName) {
+ }
+
+ public void setEmail(String newEmail) {
+ }
+
+ public void setDateOfBirth(LocalDate newDateOfBirth) {
+ }
+
+ public void setPassword(String newPassword) {
+ }
+
+ public void setPhoneNumber(String newPhoneNumber) {
+ }
+
+ public void setAddress(String newAddress) {
+ }
+
+ public Instant getLastLoginDate() {
+ return null;
+ }
+ }
+
+ // Method to add a member
+ public void addMember(int memberId, String name, String email, String password, LocalDate dateOfBirth, String address, String phoneNumber) {
+ if (members.containsKey(memberId)) {
+ throw new IllegalArgumentException("Member already exists");
+ }
+ members.put(memberId, new Member(memberId, name, email, password, dateOfBirth, address, phoneNumber));
+ }
+
+ // Method to remove a member
+ public void removeMember(int memberId) {
+ if (!members.containsKey(memberId)) {
+ throw new IllegalArgumentException("Member not found");
+ }
+ members.remove(memberId);
+ }
+
+ // Method to list all members
+ public List listAllMembers() {
+ return new ArrayList<>(members.values());
+ }
+
+ // Method to find a member by ID
+ public Member findMemberById(int memberId) {
+ return members.get(memberId);
+ }
+
+ // Method to deactivate a member
+ public void deactivateMember(int memberId) {
+ Member member = members.get(memberId);
+ if (member == null) {
+ throw new IllegalArgumentException("Member not found");
+ }
+ member.deactivate();
+ }
+
+ // Method to update member information
+ public void updateMember(int memberId, String newName, String newEmail, String newPassword, LocalDate newDateOfBirth, String newAddress, String newPhoneNumber) {
+ Member member = members.get(memberId);
+ if (member == null) {
+ throw new IllegalArgumentException("Member not found");
+ }
+ member.setName(newName);
+ member.setEmail(newEmail);
+ member.setPassword(newPassword);
+ member.setDateOfBirth(newDateOfBirth);
+ member.setAddress(newAddress);
+ member.setPhoneNumber(newPhoneNumber);
+ }
+
+ // Method to search for members by email
+ public List searchMembersByEmail(String email) {
+ return members.values().stream()
+ .filter(m -> m.getEmail().toLowerCase().contains(email.toLowerCase()))
+ .collect(Collectors.toList());
+ }
+
+ // Method to search for members by phone number
+ public List searchMembersByPhoneNumber(String phoneNumber) {
+ return members.values().stream()
+ .filter(m -> m.getPhoneNumber().equals(phoneNumber))
+ .collect(Collectors.toList());
+ }
+
+ // Method to search for members by date of birth
+ public List searchMembersByDateOfBirth(LocalDate dateOfBirth) {
+ return members.values().stream()
+ .filter(m -> m.getDateOfBirth().equals(dateOfBirth))
+ .collect(Collectors.toList());
+ }
+
+ // Method to search for members by address
+ public List searchMembersByAddress(String address) {
+ return members.values().stream()
+ .filter(m -> m.getAddress().toLowerCase().contains(address.toLowerCase()))
+ .collect(Collectors.toList());
+ }
+
+ // Method to search for members by active status
+ public List searchMembersByActiveStatus(boolean isActive) {
+ return members.values().stream()
+ .filter(m -> m.isActive() == isActive)
+ .collect(Collectors.toList());
+ }
+
+ // Method to assign a member to a group
+ public void assignMemberToGroup(int memberId, String groupName) {
+ Member member = members.get(memberId);
+ if (member == null) {
+ throw new IllegalArgumentException("Member not found");
+ }
+ member.setGroupName(groupName);
+ }
+
+ // Method to unassign a member from a group
+ public void unassignMemberFromGroup(int memberId) {
+ Member member = members.get(memberId);
+ if (member == null) {
+ throw new IllegalArgumentException("Member not found");
+ }
+ member.setGroupName(null);
+ }
+
+ // Method to list all members assigned to a group
+ public List listMembersAssignedToGroup(String groupName) {
+ return members.values().stream()
+ .filter(m -> m.getGroupName() != null && m.getGroupName().equals(groupName))
+ .collect(Collectors.toList());
+ }
+
+ // Method to list all groups a member is assigned to
+ public List listGroupsForMember(int memberId) {
+ Member member = members.get(memberId);
+ if (member == null) {
+ throw new IllegalArgumentException("Member not found");
+ }
+ return Collections.singletonList(member.getGroupName());
+ }
+
+ // Method to list all members with more than 10 active friends
+ public List listMembersWithMoreThanTenActiveFriends() {
+ return members.values().stream()
+ .filter(m -> m.getFriendIds().size() > 10)
+ .collect(Collectors.toList());
+ }
+
+ // Method to list all members who are active in any group
+ public List listActiveMembersInAnyGroup() {
+ return members.values().stream()
+ .filter(Member::isActive)
+ .collect(Collectors.toList());
+ }
+
+ // Method to list all members that have been registered within the last month
+ public List listRecentRegistrations() {
+ LocalDate oneMonthAgo = LocalDate.now().minusMonths(1);
+ return members.values().stream()
+ .filter(m -> !m.getDateOfBirth().isBefore(oneMonthAgo))
+ .collect(Collectors.toList());
+ }
+
+ // Method to list all members who have logged in within the last year
+ public List listMembersLoggedInInLastYear() {
+ LocalDate oneYearAgo = LocalDate.now().minusYears(1);
+ return members.values().stream()
+ .filter(m -> m.getLastLoginDate().isAfter(Instant.from(oneYearAgo)))
+ .collect(Collectors.toList());
+ }
+
+ // Method to list all members who have logged in within the last month and have more than 10 active friends
+ public List listMembersLoggedInInLastMonthWithMoreThanTenActiveFriends() {
+ LocalDate oneMonthAgo = LocalDate.now().minusMonths(1);
+ return members.values().stream()
+ .filter(m -> m.getLastLoginDate().isAfter(Instant.from(oneMonthAgo)) && m.getFriendIds().size() > 10)
+ .collect(Collectors.toList());
+ }
+
+ // Method to list all members who have logged in within the last year and have more than 10 active friends
+ public List listMembersLoggedInInLastYearWithMoreThanTenActiveFriends() {
+ LocalDate oneYearAgo = LocalDate.now().minusYears(1);
+ return members.values().stream()
+ .filter(m -> m.getLastLoginDate().isAfter(Instant.from(oneYearAgo)) && m.getFriendIds().size() > 10)
+ .collect(Collectors.toList());
+ }
+
+ // Method to list all members who have logged in within the last year and have more than 10 active friends in a specific group
+ public List listMembersLoggedInInLastYearWithMoreThanTenActiveFriendsInGroup(String groupName) {
+ LocalDate oneYearAgo = LocalDate.now().minusYears(1);
+ return members.values().stream()
+ .filter(m -> m.getLastLoginDate().isAfter(Instant.from(oneYearAgo)) && m.getFriendIds().size() > 10 && m.getGroupName().equals(groupName))
+ .collect(Collectors.toList());
+ }
+
+ // Method to list all members who have logged in within the last year and have more than 10 active friends in a specific group and have a specific address
+ public List listMembersLoggedInInLastYearWithMoreThanTenActiveFriendsInGroupAndSpecificAddress(String groupName, String address) {
+ LocalDate oneYearAgo = LocalDate.now().minusYears(1);
+ return members.values().stream()
+ .filter(m -> m.getLastLoginDate().isAfter(Instant.from(oneYearAgo)) && m.getFriendIds().size() > 10 && m.getGroupName().equals(groupName) && m.getAddress().equals(address))
+ .collect(Collectors.toList());
+ }
+
+ // Method to list all members who have logged in within the last year and have more than 10 active friends in a specific group and have a specific address and phone number
+ public List listMembersLoggedInInLastYearWithMoreThanTenActiveFriendsInGroupAndSpecificAddressAndPhoneNumber(String groupName, String address, String phoneNumber) {
+ LocalDate oneYearAgo = LocalDate.now().minusYears(1);
+ return members.values().stream()
+ .filter(m -> m.getLastLoginDate().isAfter(Instant.from(oneYearAgo)) && m.getFriendIds().size() > 10 && m.getGroupName().equals(groupName) && m.getAddress().equals(address) && m.getPhoneNumber().equals(phoneNumber))
+ .collect(Collectors.toList());
+ }
+
+ // Method to list all members who have logged in within the last year and have more than 10 active friends in a specific group and have a specific address and phone number and are active
+ public List listMembersLoggedInInLastYearWithMoreThanTenActiveFriendsInGroupAndSpecificAddressAndPhoneNumberAndActive(String groupName, String address, String phoneNumber) {
+ LocalDate oneYearAgo = LocalDate.now().minusYears(1);
+ return members.values().stream()
+ .filter(m -> m.getLastLoginDate().isAfter(Instant.from(oneYearAgo)) && m.getFriendIds().size() > 10 && m.getGroupName().equals(groupName) && m.getAddress().equals(address) && m.getPhoneNumber().equals(phoneNumber) && m.isActive())
+ .collect(Collectors.toList());
+ }
+
+ // Method to list all members who have logged in within the last year and have more than 10 active friends in a specific group and have a specific address and phone number and are active and have a specific name
+ public List listMembersLoggedInInLastYearWithMoreThanTenActiveFriendsInGroupAndSpecificAddressAndPhoneNumberAndActiveAndSpecificName(String groupName, String address, String phoneNumber, String name) {
+ LocalDate oneYearAgo = LocalDate.now().minusYears(1);
+ return members.values().stream()
+ .filter(m -> m.getLastLoginDate().isAfter(Instant.from(oneYearAgo)) && m.getFriendIds().size() > 10 && m.getGroupName().equals(groupName) && m.getAddress().equals(address) && m.getPhoneNumber().equals(phoneNumber) && m.isActive() && m.getName().equals(name))
+ .collect(Collectors.toList());
+ }
+
+ // Method to list all members who have logged in within the last year and have more than 10 active friends in a specific group and have a specific address and phone number and are active and have a specific name and email
+ public List listMembersLoggedInInLastYearWithMoreThanTenActiveFriendsInGroupAndSpecificAddressAndPhoneNumberAndActiveAndSpecificNameAndEmail(String groupName, String address, String phoneNumber, String name, String email) {
+ LocalDate oneYearAgo = LocalDate.now().minusYears(1);
+ return members.values().stream()
+ .filter(m -> m.getLastLoginDate().isAfter(Instant.from(oneYearAgo)) && m.getFriendIds().size() > 10 && m.getGroupName().equals(groupName) && m.getAddress().equals(address) && m.getPhoneNumber().equals(phoneNumber) && m.isActive() && m.getName().equals(name) && m.getEmail().equals(email))
+ .collect(Collectors.toList());
+ }
+
+ // Method to list all members who have logged in within the last year and have more than 10 active friends in a specific group and have a specific address and phone number and are active and have a specific name and email and password
+ public List listMembersLoggedInInLastYearWithMoreThanTenActiveFriendsInGroupAndSpecificAddressAndPhoneNumberAndActiveAndSpecificNameAndEmailAndPassword(String groupName, String address, String phoneNumber, String name, String email, String password) {
+ LocalDate oneYearAgo = LocalDate.now().minusYears(1);
+ return members.values().stream()
+ .filter(m -> m.getLastLoginDate().isAfter(Instant.from(oneYearAgo)) && m.getFriendIds().size() > 10 && m.getGroupName().equals(groupName) && m.getAddress().equals(address) && m.getPhoneNumber().equals(phoneNumber) && m.isActive() && m.getName().equals(name) && m.getEmail().equals(email) && m.getPassword().equals(password))
+ .collect(Collectors.toList());
+ }
+
+ // Method to list all members who have logged in within the last year and have more than 10 active friends in a specific group and have a specific address and phone number and are active and have a specific name and email and password and date of birth
+ public List listMembersLoggedInInLastYearWithMoreThanTenActiveFriendsInGroupAndSpecificAddressAndPhoneNumberAndActiveAndSpecificNameAndEmailAndPasswordAndDateOfBirth(String groupName, String address, String phoneNumber, String name, String email, String password, LocalDate dateOfBirth) {
+ LocalDate oneYearAgo = LocalDate.now().minusYears(1);
+ return members.values().stream()
+ .filter(m -> m.getLastLoginDate().isAfter(Instant.from(oneYearAgo)) && m.getFriendIds().size() > 10 && m.getGroupName().equals(groupName) && m.getAddress().equals(address) && m.getPhoneNumber().equals(phoneNumber) && m.isActive() && m.getName().equals(name) && m.getEmail().equals(email) && m.getPassword().equals(password) && m.getDateOfBirth().equals(dateOfBirth))
+ .collect(Collectors.toList());
+ }
+
+ // Method to list all members who have logged in within the last year and have more than 10 active friends in a specific group and have a specific address and phone number and are active and have a specific name and email and password and date of birth and address
+ public List listMembersLoggedInInLastYearWithMoreThanTenActiveFriendsInGroupAndSpecificAddressAndPhoneNumberAndActiveAndSpecificNameAndEmailAndPasswordAndDateOfBirthAndAddress(String groupName, String address, String phoneNumber, String name, String email, String password, LocalDate dateOfBirth, String addressDetail) {
+ LocalDate oneYearAgo = LocalDate.now().minusYears(1);
+ return members.values().stream()
+ .filter(m -> m.getLastLoginDate().isAfter(Instant.from(oneYearAgo)) && m.getFriendIds().size() > 10 && m.getGroupName().equals(groupName) && m.getAddress().equals(address) && m.getPhoneNumber().equals(phoneNumber) && m.isActive() && m.getName().equals(name) && m.getEmail().equals(email) && m.getPassword().equals(password) && m.getDateOfBirth().equals(dateOfBirth) && m.getAddress().equals(addressDetail))
+ .collect(Collectors.toList());
+ }
+
+ // Method to list all members who have logged in within the last year and have more than 10 active friends in a specific group and have a specific address and phone number and are active and have a specific name and email and password and date of birth and address and phone number
+ public List listMembersLoggedInInLastYearWithMoreThanTenActiveFriendsInGroupAndSpecificAddressAndPhoneNumberAndActiveAndSpecificNameAndEmailAndPasswordAndDateOfBirthAndAddressAndPhoneNumber(String groupName, String address, String phoneNumber, String name, String email, String password, LocalDate dateOfBirth, String addressDetail, String phoneNumberDetail) {
+ LocalDate oneYearAgo = LocalDate.now().minusYears(1);
+ return members.values().stream()
+ .filter(m -> m.getLastLoginDate().isAfter(Instant.from(oneYearAgo)) && m.getFriendIds().size() > 10 && m.getGroupName().equals(groupName) && m.getAddress().equals(address) && m.getPhoneNumber().equals(phoneNumber) && m.isActive() && m.getName().equals(name) && m.getEmail().equals(email) && m.getPassword().equals(password) && m.getDateOfBirth().equals(dateOfBirth) && m.getAddress().equals(addressDetail) && m.getPhoneNumber().equals(phoneNumberDetail))
+ .collect(Collectors.toList());
+ }
+
+}
diff --git a/server/src/main/java/self/cases/teams/utils/IDUtil.java b/server/src/main/java/self/cases/teams/utils/IDUtil.java
new file mode 100644
index 00000000..7bf9ad5c
--- /dev/null
+++ b/server/src/main/java/self/cases/teams/utils/IDUtil.java
@@ -0,0 +1,9 @@
+package self.cases.teams.utils;
+
+import java.util.UUID;
+
+public class IDUtil {
+ public static String makeIDByCurrent() {
+ return UUID.randomUUID().toString();
+ }
+}