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