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

View File

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

View File

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