Skip to content

Commit

Permalink
Merge pull request #59 from cheng521521/main
Browse files Browse the repository at this point in the history
fix: 修改成员退出团队在加入的逻辑
  • Loading branch information
yanyanho authored Nov 9, 2023
2 parents 3ffa991 + a8cf101 commit 3af0a11
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/main/java/com/dl/officialsite/team/TeamService.java
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,28 @@ public void join(TeamMemberJoinVO teamMember) {
BeanUtils.copyProperties(teamMember, teamMember1);
teamMember1.setStatus(Constants.REQUEST_TEAM);
teamMemberRepository.save(teamMember1);
//发送邮件
Team team = teamRepository.findById(teamMember.getTeamId()).get();
String administratorAddress = team.getAdministrator();
if (!ObjectUtils.isEmpty(administratorAddress) || !"".equals(administratorAddress)) {
Optional<Member> admin = memberRepository.findByAddress(administratorAddress);
if (admin.isPresent()) {
Member member1 = admin.get();
String email = member1.getEmail();
String subject = team.getTeamName() + "团队新成员加入申请";
List<String> mailAddress = new ArrayList<>();
mailAddress.add(email);
log.info("发送邮件给管理员:{},接收地址{}", email, mailAddress);
emailService.memberJoinTeam(mailAddress, subject, subject);
} else {
throw new BizException(CodeEnums.TEAM_ADMIN_NOT_EXIST.getCode(),
CodeEnums.TEAM_ADMIN_NOT_EXIST.getMsg());
}

} else {
throw new BizException(CodeEnums.TEAM_ADMIN_NOT_EXIST.getCode(),
CodeEnums.TEAM_ADMIN_NOT_EXIST.getMsg());
}
}

}
Expand Down

0 comments on commit 3af0a11

Please sign in to comment.