|
|
|
|
@ -2,7 +2,12 @@ package au.com.royalpay.payment.manage.task;
|
|
|
|
|
|
|
|
|
|
import au.com.royalpay.payment.manage.mappers.system.ManagerMapper;
|
|
|
|
|
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
|
|
|
|
|
import au.com.royalpay.payment.tools.env.SysConfigManager;
|
|
|
|
|
import au.com.royalpay.payment.tools.env.mappers.SysConfigMapper;
|
|
|
|
|
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
|
|
|
|
|
import au.com.royalpay.payment.tools.scheduler.SynchronizedScheduler;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
|
|
|
|
@ -23,21 +28,26 @@ public class UpdatePartnerPasswordTask {
|
|
|
|
|
@Resource
|
|
|
|
|
private SynchronizedScheduler synchronizedScheduler;
|
|
|
|
|
@Resource
|
|
|
|
|
private ManagerMapper managerMapper;
|
|
|
|
|
private SysConfigManager sysConfigManager;
|
|
|
|
|
|
|
|
|
|
private final static String EMAIL = "lily.tao@royalpay.com.au,bella.sun@royalpay.com.au,astro.dai@royalpay.com.au,taylor.dang@royalpay.com.au";
|
|
|
|
|
// private final static String EMAIL = "lily.tao@royalpay.com.au,bella.sun@royalpay.com.au,astro.dai@royalpay.com.au,taylor.dang@royalpay.com.au";
|
|
|
|
|
|
|
|
|
|
@Scheduled(cron = "0 0 9 28 * ?")
|
|
|
|
|
public void resetPartnerPassword() {
|
|
|
|
|
synchronizedScheduler.executeProcess("manage_task:resetPartnerPassword", 300_000, () -> {
|
|
|
|
|
final List<String> emails = new ArrayList<>();
|
|
|
|
|
List<String> emailList = Arrays.asList(EMAIL.split(","));
|
|
|
|
|
emailList.stream().forEach(email -> {
|
|
|
|
|
if (!emails.contains(email)) {
|
|
|
|
|
emails.add(email);
|
|
|
|
|
//抄送人邮箱
|
|
|
|
|
JSONObject sysConfig = sysConfigManager.getSysConfig();
|
|
|
|
|
String ccMail = sysConfig.getString("reset_password.cc_list");
|
|
|
|
|
//账号白名单
|
|
|
|
|
String accountWhiteList = sysConfig.getString("reset_password.account_white_list");
|
|
|
|
|
if (StringUtils.isEmpty(ccMail)) {
|
|
|
|
|
throw new BadRequestException("抄送人不能为空");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
clientManager.updateAllPartnerPassword("PINE", emails);
|
|
|
|
|
if (accountWhiteList == null) {
|
|
|
|
|
accountWhiteList = "";
|
|
|
|
|
}
|
|
|
|
|
List<String> emailList = Arrays.asList(ccMail.split(","));
|
|
|
|
|
clientManager.updateAllPartnerPassword("PINE", emailList, accountWhiteList);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|