1.商户账号修改白名单

2.添加禁用筛选
master
yangkai 6 years ago
parent 3fc305ac40
commit 02efeb6f01

@ -27,6 +27,7 @@ import au.com.royalpay.payment.manage.permission.manager.ManagerMapping;
import au.com.royalpay.payment.manage.tradelog.core.TradeLogService;
import au.com.royalpay.payment.tools.CommonConsts;
import au.com.royalpay.payment.tools.defines.TradeType;
import au.com.royalpay.payment.tools.env.SysConfigManager;
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.http.HttpUtils;
import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider;
@ -121,6 +122,8 @@ public class TestController implements ApplicationEventPublisherAware {
private HfUpdateService hfUpdateService;
@Resource
private ClientManager clientManager;
@Resource
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";
@ManagerMapping(value = "/{clientMoniker}/export/agreepdf", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.DIRECTOR, ManagerRole.OPERATOR})
@ -434,13 +437,18 @@ public class TestController implements ApplicationEventPublisherAware {
@ManagerMapping(value = "/partner/reset_password", method = RequestMethod.GET, role = ManagerRole.DEVELOPER)
public void resetPartnerPassword() {
final List<String> emails = new ArrayList<>();
List<String> emailList = Arrays.asList(EMAIL.split(","));
emailList.stream().forEach(email -> {
if (!emails.contains(email)) {
emails.add(email);
}
});
clientManager.updateAllPartnerPassword("PINE", emails);
//抄送人邮箱
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("抄送人不能为空");
}
if (accountWhiteList == null) {
accountWhiteList = "";
}
List<String> emailList = Arrays.asList(ccMail.split(","));
clientManager.updateAllPartnerPassword("PINE", emailList, accountWhiteList);
}
}

@ -355,7 +355,7 @@ public interface ClientManager {
void subYeepayMerchantApplication(String clientMoniker,JSONObject merchantInfo, JSONObject manager);
void updateAllPartnerPassword(String clientMoniker, List<String> emails);
void updateAllPartnerPassword(String clientMoniker, List<String> emails, String accountWhiteList);
void postponeClientRate(Date now, Date yearTomorrow, String expireDate, JSONObject client);

@ -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();
}

@ -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);
}
});
clientManager.updateAllPartnerPassword("PINE", emails);
//抄送人邮箱
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("抄送人不能为空");
}
if (accountWhiteList == null) {
accountWhiteList = "";
}
List<String> emailList = Arrays.asList(ccMail.split(","));
clientManager.updateAllPartnerPassword("PINE", emailList, accountWhiteList);
});
}
}

@ -241,7 +241,7 @@
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach>
</if>
<if test="referrer_id!=null">and c.referrer_id=#{referrer_id}</if>
<if test="is_valid">and c.is_valid=1</if>
<if test="is_valid">and c.is_valid=0</if>
</where>
</select>

@ -224,6 +224,11 @@
<input type="checkbox" ng-model="params.bd_upload_material"> 等待BD上传材料审核
</label>
</span>
<span class="checkbox-inline">
<label>
<input type="checkbox" ng-model="params.is_valid"> 禁用
</label>
</span>
</span>
<!--</div>-->

Loading…
Cancel
Save