BUGFIX:试用订单邮件 订单更新时间判断;

This commit is contained in:
shahaibo
2025-02-11 11:27:08 +08:00
parent aff870fba7
commit 297391d57e
6 changed files with 53 additions and 23 deletions

View File

@@ -343,10 +343,9 @@ public class AccountController {
return Response.success(accountService.unbindGoogle());
}
@GetMapping("/updateUserInfo")
@PostMapping("/updateUserInfo")
@ApiOperation(value = "更新用户国家、职业信息")
public Response<String> updateUserInfo(@RequestParam(value = "country", required = false) String country, @RequestParam(value = "occupation", required = false) String occupation) {
accountService.updateUserInfo(country, occupation);
return Response.success();
public Response<Boolean> updateUserInfo(UpdateUserInfoDTO updateUserInfoDTO) {
return Response.success(accountService.updateUserInfo(updateUserInfoDTO));
}
}

View File

@@ -127,12 +127,12 @@ public class Account implements Serializable {
private String invitationCode;
// @ApiModelProperty("title")
// private String title;
//
// @ApiModelProperty("surname")
// private String surname;
//
// @ApiModelProperty("givenName")
// private String givenName;
@ApiModelProperty("title")
private String title;
@ApiModelProperty("surname")
private String surname;
@ApiModelProperty("givenName")
private String givenName;
}

View File

@@ -28,6 +28,9 @@ public class EmailSendDTO {
@ApiModelProperty("职业")
private String occupation;
private String title;
private String surname;
private String givenName;
}

View File

@@ -0,0 +1,13 @@
package com.ai.da.model.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class UpdateUserInfoDTO {
private String country;
private String occupation;
private String title;
private String surname;
private String givenName;
}

View File

@@ -224,5 +224,5 @@ public interface AccountService extends IService<Account> {
void updateUserRoleAndCredits(Long accountId, String type);
void updateUserInfo(String country, String occupation);
Boolean updateUserInfo(UpdateUserInfoDTO updateUserInfoDTO);
}

View File

@@ -485,11 +485,16 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
SendEmailUtil.CHANGE_MAILBOX_TEMPLATE_ID, randomVerifyCode);
break;
case UPDATE_USERINFO:
if (!StringUtil.isNullOrEmpty(emailSendDTO.getCountry()) || !StringUtil.isNullOrEmpty(emailSendDTO.getOccupation())){
if (!StringUtil.isNullOrEmpty(emailSendDTO.getCountry()) || !StringUtil.isNullOrEmpty(emailSendDTO.getOccupation())
|| StringUtils.isEmpty(emailSendDTO.getSurname()) || StringUtils.isNotEmpty(emailSendDTO.getTitle())
|| StringUtils.isNotEmpty(emailSendDTO.getGivenName())){
Long accountId = UserContext.getUserHolder().getId();
Account account = baseMapper.selectById(accountId);
account.setCountry(emailSendDTO.getCountry());
account.setOccupation(emailSendDTO.getOccupation());
account.setTitle(emailSendDTO.getTitle());
account.setSurname(emailSendDTO.getSurname());
account.setGivenName(emailSendDTO.getGivenName());
baseMapper.updateById(account);
String userEmail = account.getUserEmail();
@@ -500,6 +505,9 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
for (TrialOrder trialOrder : trialOrders) {
trialOrder.setCountry(emailSendDTO.getCountry());
trialOrder.setOccupation(emailSendDTO.getOccupation());
trialOrder.setTitle(emailSendDTO.getTitle());
trialOrder.setGivenName(emailSendDTO.getGivenName());
trialOrder.setSurname(emailSendDTO.getSurname());
trialOrderMapper.updateById(trialOrder);
}
}
@@ -2805,18 +2813,25 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
accountMapper.updateById(account);
}
public void updateUserInfo(String country, String occupation){
public Boolean updateUserInfo(UpdateUserInfoDTO updateUserInfoDTO){
Long accountId = UserContext.getUserHolder().getId();
Account account = accountMapper.selectById(accountId);
boolean flag = false;
if (!StringUtil.isNullOrEmpty(country) && !country.equals(account.getCountry())) {
account.setCountry(country.trim());
flag = true;
if (StringUtils.isNotEmpty(updateUserInfoDTO.getOccupation()) && !account.getOccupation().equals(updateUserInfoDTO.getOccupation())) {
account.setOccupation(updateUserInfoDTO.getOccupation());
}
if (!StringUtil.isNullOrEmpty(occupation) && !occupation.equals(account.getOccupation())) {
account.setOccupation(occupation.trim());
flag = true;
if (StringUtils.isNotEmpty(updateUserInfoDTO.getCountry()) && !account.getCountry().equals(updateUserInfoDTO.getCountry())) {
account.setCountry(updateUserInfoDTO.getCountry());
}
if(flag) accountMapper.updateById(account);
if (StringUtils.isNotEmpty(updateUserInfoDTO.getTitle()) && !account.getTitle().equals(updateUserInfoDTO.getTitle())) {
account.setTitle(updateUserInfoDTO.getTitle());
}
if (StringUtils.isNotEmpty(updateUserInfoDTO.getSurname()) && !account.getSurname().equals(updateUserInfoDTO.getSurname())) {
account.setSurname(updateUserInfoDTO.getSurname());
}
if (StringUtils.isNotEmpty(updateUserInfoDTO.getGivenName()) && !account.getGivenName().equals(updateUserInfoDTO.getGivenName())) {
account.setGivenName(updateUserInfoDTO.getGivenName());
}
accountMapper.updateById(account);
return Boolean.TRUE;
}
}