Merge branch 'hotfix/master-20250425' into feature/202504

# Conflicts:
#	nflg-mobilebroken-cfs-app/src/main/java/com/nflg/mobilebroken/cfs/controller/UserController.java
This commit is contained in:
曹鹏飞 2025-04-30 16:51:22 +08:00
commit cf07bbee4c
2 changed files with 45 additions and 17 deletions

View File

@ -386,14 +386,28 @@ public class AppUserController extends ControllerBase {
public ApiResult<Void> sendResetPasswordEmail(@Valid @RequestBody @NotEmpty List<Integer> ids){
try {
for (Integer id : ids) {
String password=RandomUtil.randomString(6);
AppUser appUser=appUserService.resetPassword(id,password);
String subject = dictionaryItemTranslateService.getValueByCode(Constant.DICTIONARY_EMAIL_NOTIFY, Constant.DICTIONARY_ITEM_EMAIL_TITLE_ACCOUNT_RESET_PASSWORD, appUser.getLanguageCode());
String content = dictionaryItemTranslateService.getValueByCode(Constant.DICTIONARY_EMAIL_NOTIFY, Constant.DICTIONARY_ITEM_EMAIL_CONTENT_RESET_PASSWORD_NOTIFY, appUser.getLanguageCode())
.replace("${loginName}",appUser.getLoginName())
.replace("${url}",activateUrl + "?code=" + Base64.getUrlEncoder().encodeToString((appUser.getEmail()+"|0").getBytes()))
.replace("${password}",password);
emailService.sendEmail(appUser.getEmail(), subject, content);
AppUser appUser = appUserService.getById(id);
if (Objects.nonNull(appUser)) {
if (Objects.equals(appUser.getState().intValue(), 1)) {
String password = RandomUtil.randomString(6);
appUserService.resetPassword(id, password);
String subject = dictionaryItemTranslateService.getValueByCode(Constant.DICTIONARY_EMAIL_NOTIFY, Constant.DICTIONARY_ITEM_EMAIL_TITLE_ACCOUNT_RESET_PASSWORD, appUser.getLanguageCode());
String content = dictionaryItemTranslateService.getValueByCode(Constant.DICTIONARY_EMAIL_NOTIFY, Constant.DICTIONARY_ITEM_EMAIL_CONTENT_RESET_PASSWORD_NOTIFY, appUser.getLanguageCode())
.replace("${loginName}", appUser.getLoginName())
.replace("${url}", activateUrl + "?code=" + Base64.getUrlEncoder().encodeToString((appUser.getEmail() + "|0").getBytes()))
.replace("${password}", password);
emailService.sendEmail(appUser.getEmail(), subject, content);
} else if(Objects.equals(appUser.getState().intValue(), 0)){
String password = RandomUtil.randomString(6);
String subject = dictionaryItemTranslateService.getValueByCode(Constant.DICTIONARY_EMAIL_NOTIFY, Constant.DICTIONARY_ITEM_EMAIL_TITLE_ACCOUNT_ACTIVATION, appUser.getLanguageCode());
String content = dictionaryItemTranslateService.getValueByCode(Constant.DICTIONARY_EMAIL_NOTIFY, Constant.DICTIONARY_ITEM_EMAIL_CONTENT_ACCOUNT_ACTIVATION_NOTIFY, appUser.getLanguageCode())
.replace("${loginName}", appUser.getEmail())
.replace("${url}", activateUrl + "?code=" + Base64.getUrlEncoder().encodeToString((appUser.getEmail() + "|0").getBytes()))
.replace("${password}", password)
.replace("${website}", websiteUrl);
emailService.sendEmail(appUser.getEmail(), subject, content);
}
}
}
}catch (Exception ex){
throw new NflgException(STATE.BusinessError,"发送邮件失败:"+ex.getMessage());

View File

@ -310,15 +310,29 @@ public class UserController extends ControllerBase {
public ApiResult<Void> sendResetPasswordEmail(@Valid @RequestBody @NotEmpty List<Integer> ids){
try {
for (Integer id : ids) {
String password=RandomUtil.randomString(6);
AppUser appUser=appUserService.resetPassword(id,password);
String subject = dictionaryItemTranslateService.getValueByCode(Constant.DICTIONARY_EMAIL_NOTIFY, Constant.DICTIONARY_ITEM_EMAIL_TITLE_ACCOUNT_RESET_PASSWORD, appUser.getLanguageCode());
String content = dictionaryItemTranslateService.getValueByCode(Constant.DICTIONARY_EMAIL_NOTIFY, Constant.DICTIONARY_ITEM_EMAIL_CONTENT_RESET_PASSWORD_NOTIFY, appUser.getLanguageCode())
.replace("${loginName}",appUser.getLoginName())
.replace("${url}",activateUrl + "?code=" + Base64.getUrlEncoder().encodeToString((appUser.getEmail()+"|0").getBytes()))
.replace("${password}",password)
.replace("${website}",websiteUrl);
emailService.sendEmail(appUser.getEmail(), subject, content);
AppUser appUser = appUserService.getById(id);
if (Objects.nonNull(appUser)) {
if (Objects.equals(appUser.getState().intValue(), 1)) {
String password = RandomUtil.randomString(6);
appUserService.resetPassword(id, password);
String subject = dictionaryItemTranslateService.getValueByCode(Constant.DICTIONARY_EMAIL_NOTIFY, Constant.DICTIONARY_ITEM_EMAIL_TITLE_ACCOUNT_RESET_PASSWORD, appUser.getLanguageCode());
String content = dictionaryItemTranslateService.getValueByCode(Constant.DICTIONARY_EMAIL_NOTIFY, Constant.DICTIONARY_ITEM_EMAIL_CONTENT_RESET_PASSWORD_NOTIFY, appUser.getLanguageCode())
.replace("${loginName}", appUser.getLoginName())
.replace("${url}", activateUrl + "?code=" + Base64.getUrlEncoder().encodeToString((appUser.getEmail()+"|0").getBytes()))
.replace("${password}", password)
.replace("${website}", websiteUrl);
emailService.sendEmail(appUser.getEmail(), subject, content);
} else if(Objects.equals(appUser.getState().intValue(), 0)){
String password = RandomUtil.randomString(6);
String subject = dictionaryItemTranslateService.getValueByCode(Constant.DICTIONARY_EMAIL_NOTIFY, Constant.DICTIONARY_ITEM_EMAIL_TITLE_ACCOUNT_ACTIVATION, appUser.getLanguageCode());
String content = dictionaryItemTranslateService.getValueByCode(Constant.DICTIONARY_EMAIL_NOTIFY, Constant.DICTIONARY_ITEM_EMAIL_CONTENT_ACCOUNT_ACTIVATION_NOTIFY, appUser.getLanguageCode())
.replace("${loginName}", appUser.getEmail())
.replace("${url}", activateUrl + "?code=" + Base64.getUrlEncoder().encodeToString((appUser.getEmail() + "|0").getBytes()))
.replace("${password}", password)
.replace("${website}", websiteUrl);
emailService.sendEmail(appUser.getEmail(), subject, content);
}
}
}
}catch (Exception ex){
throw new NflgException(STATE.BusinessError,"发送邮件失败:"+ex.getMessage());