GlobalAward保存成功发送站内信,根据url可跳转且召回已填写资料
This commit is contained in:
@@ -161,6 +161,7 @@ public class GlobalAwardServiceImpl implements GlobalAwardService {
|
||||
.build();
|
||||
contestantMapper.insert(toInsert);
|
||||
resp.put("success", true);
|
||||
sendSiteMsg(toInsert.getId(), toInsert.getEmail());
|
||||
return resp;
|
||||
} else {
|
||||
// update existing contestant
|
||||
@@ -184,18 +185,16 @@ public class GlobalAwardServiceImpl implements GlobalAwardService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ContestantDTO getContestantByEmail(String email) {
|
||||
if (email == null) {
|
||||
throw new BusinessException("Email is required.");
|
||||
public ContestantDTO getContestantByID(String id) {
|
||||
if (id == null) {
|
||||
throw new BusinessException("id is required.");
|
||||
}
|
||||
QueryWrapper<Contestant> qw = new QueryWrapper<>();
|
||||
qw.eq("email", email);
|
||||
Contestant existing = contestantMapper.selectOne(qw);
|
||||
Contestant existing = contestantMapper.selectById(id);
|
||||
if (existing == null) {
|
||||
return null;
|
||||
}
|
||||
ContestantDTO dto = new ContestantDTO();
|
||||
dto.setEmail(existing.getEmail());
|
||||
// dto.setEmail(existing.getEmail());
|
||||
dto.setFirstName(existing.getFirstName());
|
||||
dto.setLastName(existing.getLastName());
|
||||
dto.setGender(existing.getGender());
|
||||
@@ -251,7 +250,7 @@ public class GlobalAwardServiceImpl implements GlobalAwardService {
|
||||
String secureToken = UUID.randomUUID().toString().replace("-", "");
|
||||
redisUtil.addToString(tokenCacheKey + email, secureToken, 3 * 24 * 60 * 60L);
|
||||
|
||||
return new CheckOTPVO(secureToken, getContestantByEmail(email));
|
||||
return new CheckOTPVO(secureToken, getContestantByID(email));
|
||||
} else {
|
||||
throw new BusinessException("Verification code is incorrect. Please try again.");
|
||||
}
|
||||
@@ -275,7 +274,16 @@ public class GlobalAwardServiceImpl implements GlobalAwardService {
|
||||
}
|
||||
|
||||
// 发送站内信
|
||||
public void sendSiteMsg(String applicationId, Long userId) {
|
||||
public void sendSiteMsg(String applicationId, String email) {
|
||||
Long userId;
|
||||
QueryWrapper<Account> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(Account::getUserEmail, email);
|
||||
List<Account> accounts = accountMapper.selectList(queryWrapper);
|
||||
if (accounts.isEmpty()) {
|
||||
throw new BusinessException("Please register and subscribe to AiDA, then resubmit your application.");
|
||||
}else {
|
||||
userId = accounts.get(0).getId();
|
||||
}
|
||||
PublishSysNotificationDTO sysNotificationDTO = new PublishSysNotificationDTO();
|
||||
Notification notification = new Notification();
|
||||
notification.setType("system");
|
||||
|
||||
Reference in New Issue
Block a user