GlobalAward保存成功发送站内信,根据url可跳转且召回已填写资料
This commit is contained in:
@@ -145,12 +145,12 @@ public class GlobalAwardController {
|
|||||||
return Response.success(globalAwardService.saveContestant(request));
|
return Response.success(globalAwardService.saveContestant(request));
|
||||||
}
|
}
|
||||||
|
|
||||||
// @GetMapping("/contestants/by-email")
|
@GetMapping("/contestants/{id}")
|
||||||
// @ApiOperation(value = "根据邮箱查询参赛者", notes = "根据邮箱地址获取参赛者信息")
|
@ApiOperation(value = "根据id查询参赛者", notes = "根据id获取参赛者信息")
|
||||||
// public Response<ContestantDTO> getContestantByEmail(@ApiParam(value = "参赛者邮箱地址", required = true) @RequestParam("email") String email) {
|
public Response<ContestantDTO> getContestantByID(@ApiParam(value = "参赛者id", required = true) @PathVariable("id") String id) {
|
||||||
// ContestantDTO dto = globalAwardService.getContestantByEmail(email);
|
ContestantDTO dto = globalAwardService.getContestantByID(id);
|
||||||
// return Response.success(dto);
|
return Response.success(dto);
|
||||||
// }
|
}
|
||||||
|
|
||||||
@GetMapping("/checkEmail")
|
@GetMapping("/checkEmail")
|
||||||
public Response<String> checkEmail(@RequestParam("email") String email) {
|
public Response<String> checkEmail(@RequestParam("email") String email) {
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ public interface GlobalAwardService {
|
|||||||
|
|
||||||
Map<String, Object> saveContestant(ContestantDTO request);
|
Map<String, Object> saveContestant(ContestantDTO request);
|
||||||
|
|
||||||
com.ai.da.model.dto.ContestantDTO getContestantByEmail(String email);
|
com.ai.da.model.dto.ContestantDTO getContestantByID(String email);
|
||||||
|
|
||||||
void checkEmail(String email);
|
void checkEmail(String email);
|
||||||
|
|
||||||
|
|||||||
@@ -161,6 +161,7 @@ public class GlobalAwardServiceImpl implements GlobalAwardService {
|
|||||||
.build();
|
.build();
|
||||||
contestantMapper.insert(toInsert);
|
contestantMapper.insert(toInsert);
|
||||||
resp.put("success", true);
|
resp.put("success", true);
|
||||||
|
sendSiteMsg(toInsert.getId(), toInsert.getEmail());
|
||||||
return resp;
|
return resp;
|
||||||
} else {
|
} else {
|
||||||
// update existing contestant
|
// update existing contestant
|
||||||
@@ -184,18 +185,16 @@ public class GlobalAwardServiceImpl implements GlobalAwardService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ContestantDTO getContestantByEmail(String email) {
|
public ContestantDTO getContestantByID(String id) {
|
||||||
if (email == null) {
|
if (id == null) {
|
||||||
throw new BusinessException("Email is required.");
|
throw new BusinessException("id is required.");
|
||||||
}
|
}
|
||||||
QueryWrapper<Contestant> qw = new QueryWrapper<>();
|
Contestant existing = contestantMapper.selectById(id);
|
||||||
qw.eq("email", email);
|
|
||||||
Contestant existing = contestantMapper.selectOne(qw);
|
|
||||||
if (existing == null) {
|
if (existing == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
ContestantDTO dto = new ContestantDTO();
|
ContestantDTO dto = new ContestantDTO();
|
||||||
dto.setEmail(existing.getEmail());
|
// dto.setEmail(existing.getEmail());
|
||||||
dto.setFirstName(existing.getFirstName());
|
dto.setFirstName(existing.getFirstName());
|
||||||
dto.setLastName(existing.getLastName());
|
dto.setLastName(existing.getLastName());
|
||||||
dto.setGender(existing.getGender());
|
dto.setGender(existing.getGender());
|
||||||
@@ -251,7 +250,7 @@ public class GlobalAwardServiceImpl implements GlobalAwardService {
|
|||||||
String secureToken = UUID.randomUUID().toString().replace("-", "");
|
String secureToken = UUID.randomUUID().toString().replace("-", "");
|
||||||
redisUtil.addToString(tokenCacheKey + email, secureToken, 3 * 24 * 60 * 60L);
|
redisUtil.addToString(tokenCacheKey + email, secureToken, 3 * 24 * 60 * 60L);
|
||||||
|
|
||||||
return new CheckOTPVO(secureToken, getContestantByEmail(email));
|
return new CheckOTPVO(secureToken, getContestantByID(email));
|
||||||
} else {
|
} else {
|
||||||
throw new BusinessException("Verification code is incorrect. Please try again.");
|
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();
|
PublishSysNotificationDTO sysNotificationDTO = new PublishSysNotificationDTO();
|
||||||
Notification notification = new Notification();
|
Notification notification = new Notification();
|
||||||
notification.setType("system");
|
notification.setType("system");
|
||||||
|
|||||||
@@ -181,4 +181,4 @@ file.upload.max.size.video=104857600
|
|||||||
# 上传任务过期时间(小时)
|
# 上传任务过期时间(小时)
|
||||||
file.upload.task.expiry.hours=24
|
file.upload.task.expiry.hours=24
|
||||||
|
|
||||||
global.award.link=https://develop.aida.com.hk/
|
global.award.link=https://develop.aida.com.hk/contestants/
|
||||||
@@ -179,4 +179,4 @@ file.upload.max.size.video=104857600
|
|||||||
# 上传任务过期时间(小时)
|
# 上传任务过期时间(小时)
|
||||||
file.upload.task.expiry.hours=24
|
file.upload.task.expiry.hours=24
|
||||||
|
|
||||||
global.award.link=https://www.aida.com.hk/
|
global.award.link=https://www.aida.com.hk/contestants/
|
||||||
Reference in New Issue
Block a user