|
|
|
@ -4088,24 +4088,28 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public void updateAllPartnerPassword(String clientMoniker, List<String> emails) {
|
|
|
|
|
@Transactional
|
|
|
|
|
public void updateAllPartnerPassword(String clientMoniker, List<String> emails, String accountWhiteList) {
|
|
|
|
|
JSONObject client = getClientInfoByMoniker(clientMoniker);
|
|
|
|
|
if (client == null) {
|
|
|
|
|
throw new InvalidShortIdException();
|
|
|
|
|
}
|
|
|
|
|
List<JSONObject> partners = clientAccountMapper.partnerAndSubPartnerAccounts(client.getIntValue("client_id"));
|
|
|
|
|
partners.stream().forEach(partner -> {
|
|
|
|
|
String pwd = RandomStringUtils.random(8, true, true);
|
|
|
|
|
String salt = PasswordUtils.newSalt();
|
|
|
|
|
String pwdHash = PasswordUtils.hashPwd(pwd, salt);
|
|
|
|
|
partner.put("salt", salt);
|
|
|
|
|
partner.put("password_hash", pwdHash);
|
|
|
|
|
partner.put("password_aes", PasswordUtils.encryptAESPwd(pwd));
|
|
|
|
|
deviceManager.deviceOffline(partner.getString("account_id"));
|
|
|
|
|
clientAccountMapper.update(partner);
|
|
|
|
|
signInAccountService.clearAccountCache(partner.getString("account_id"));
|
|
|
|
|
partner.put("password", pwd);
|
|
|
|
|
});
|
|
|
|
|
partners = partners.stream().filter(partner -> !Arrays.asList(accountWhiteList.split(",")).contains(partner.getString("username"))).collect(Collectors.toList());
|
|
|
|
|
partners.forEach(
|
|
|
|
|
partner -> {
|
|
|
|
|
String pwd = RandomStringUtils.random(8, true, true);
|
|
|
|
|
String salt = PasswordUtils.newSalt();
|
|
|
|
|
String pwdHash = PasswordUtils.hashPwd(pwd, salt);
|
|
|
|
|
partner.put("salt", salt);
|
|
|
|
|
partner.put("password_hash", pwdHash);
|
|
|
|
|
partner.put("password_aes", PasswordUtils.encryptAESPwd(pwd));
|
|
|
|
|
deviceManager.deviceOffline(partner.getString("account_id"));
|
|
|
|
|
clientAccountMapper.update(partner);
|
|
|
|
|
signInAccountService.clearAccountCache(partner.getString("account_id"));
|
|
|
|
|
partner.put("password", pwd);
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
sendTestMerchantPassword(partners, emails);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -4338,6 +4342,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
mailService.sendEmail("测试商户账户已更新", emails.isEmpty() ? "" : StringUtils.join(emails, ","), "", content);
|
|
|
|
|
} catch (Exception ignored) {
|
|
|
|
|
logger.error("邮件发送失败", ignored);
|
|
|
|
|
throw new BadRequestException("邮件发送失败");
|
|
|
|
|
}
|
|
|
|
|
}).start();
|
|
|
|
|
}
|
|
|
|
|