|
|
@ -22,6 +22,7 @@ import au.com.royalpay.payment.manage.analysis.mappers.TransactionAnalysisMapper
|
|
|
|
import au.com.royalpay.payment.manage.appclient.beans.AppClientBean;
|
|
|
|
import au.com.royalpay.payment.manage.appclient.beans.AppClientBean;
|
|
|
|
import au.com.royalpay.payment.manage.appclient.beans.AppMerchantBean;
|
|
|
|
import au.com.royalpay.payment.manage.appclient.beans.AppMerchantBean;
|
|
|
|
import au.com.royalpay.payment.manage.application.core.SimpleClientApplyService;
|
|
|
|
import au.com.royalpay.payment.manage.application.core.SimpleClientApplyService;
|
|
|
|
|
|
|
|
import au.com.royalpay.payment.manage.dev.bean.TestMerchantAccountInfo;
|
|
|
|
import au.com.royalpay.payment.manage.device.core.DeviceManager;
|
|
|
|
import au.com.royalpay.payment.manage.device.core.DeviceManager;
|
|
|
|
import au.com.royalpay.payment.manage.management.sysconfig.core.impls.PermissionPartnerManagerImpl;
|
|
|
|
import au.com.royalpay.payment.manage.management.sysconfig.core.impls.PermissionPartnerManagerImpl;
|
|
|
|
import au.com.royalpay.payment.manage.mappers.financial.FinancialBDConfigMapper;
|
|
|
|
import au.com.royalpay.payment.manage.mappers.financial.FinancialBDConfigMapper;
|
|
|
@ -94,6 +95,7 @@ import org.springframework.cache.annotation.Cacheable;
|
|
|
|
import org.springframework.context.ApplicationEventPublisher;
|
|
|
|
import org.springframework.context.ApplicationEventPublisher;
|
|
|
|
import org.springframework.context.ApplicationEventPublisherAware;
|
|
|
|
import org.springframework.context.ApplicationEventPublisherAware;
|
|
|
|
import org.springframework.context.MessageSource;
|
|
|
|
import org.springframework.context.MessageSource;
|
|
|
|
|
|
|
|
import org.springframework.data.mongodb.core.MongoTemplate;
|
|
|
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
|
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
@ -280,6 +282,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
private CommonSubMerchantIdMapper commonSubMerchantIdMapper;
|
|
|
|
private CommonSubMerchantIdMapper commonSubMerchantIdMapper;
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private Locker locker;
|
|
|
|
private Locker locker;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private MongoTemplate mongoTemplate;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
@ -5093,30 +5097,28 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
|
|
|
|
|
|
|
private void sendTestMerchantPassword(List<JSONObject> accounts) {
|
|
|
|
private void sendTestMerchantPassword(List<JSONObject> accounts) {
|
|
|
|
List<JSONObject> royalPayUsers = managerMapper.listRoyalPayUsers();
|
|
|
|
List<JSONObject> royalPayUsers = managerMapper.listRoyalPayUsers();
|
|
|
|
royalPayUsers = royalPayUsers.stream().filter(rpUser -> StringUtils.isNotEmpty(rpUser.getString("email"))).collect(Collectors.toList());
|
|
|
|
|
|
|
|
List<String> needNotifyUsers = royalPayUsers.stream().filter(user -> StringUtils.isNotEmpty(user.getString("wx_openid"))).map(user -> user.getString("wx_openid")).collect(Collectors.toList());
|
|
|
|
List<String> needNotifyUsers = royalPayUsers.stream().filter(user -> StringUtils.isNotEmpty(user.getString("wx_openid"))).map(user -> user.getString("wx_openid")).collect(Collectors.toList());
|
|
|
|
List<JSONObject> sendAccounts = new ArrayList<>();
|
|
|
|
accounts.forEach(account -> {
|
|
|
|
|
|
|
|
TestMerchantAccountInfo accountInfo = new TestMerchantAccountInfo();
|
|
|
|
|
|
|
|
accountInfo.setId(account.getString("username"));
|
|
|
|
|
|
|
|
accountInfo.setClientMoniker(account.getString("client_moniker"));
|
|
|
|
|
|
|
|
accountInfo.setRole(account.getIntValue("role"));
|
|
|
|
|
|
|
|
accountInfo.setUsername(account.getString("username"));
|
|
|
|
|
|
|
|
accountInfo.setPassword(account.getString("password"));
|
|
|
|
|
|
|
|
mongoTemplate.save(accountInfo);
|
|
|
|
|
|
|
|
});
|
|
|
|
needNotifyUsers.forEach(userOpenId -> {
|
|
|
|
needNotifyUsers.forEach(userOpenId -> {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
accounts.forEach(account -> {
|
|
|
|
|
|
|
|
JSONObject params = new JSONObject();
|
|
|
|
|
|
|
|
params.put("client_moniker", account.getString("client_moniker"));
|
|
|
|
|
|
|
|
params.put("role", account.getIntValue("role"));
|
|
|
|
|
|
|
|
params.put("username", account.getString("username"));
|
|
|
|
|
|
|
|
params.put("password", account.getString("password"));
|
|
|
|
|
|
|
|
sendAccounts.add(params);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
String signStr = "?sign=" + AESencrypt(sendAccounts.toString(), userOpenId);
|
|
|
|
|
|
|
|
MpWechatApi paymentApi = mpWechatApiProvider.getNewPaymentApi();
|
|
|
|
MpWechatApi paymentApi = mpWechatApiProvider.getNewPaymentApi();
|
|
|
|
TemplateMessage msg = initSendTestPasswordTemplate(userOpenId, paymentApi.getTemplateId("test-merchant-password"), signStr.replace("+", "%2B"));
|
|
|
|
TemplateMessage msg = initSendTestPasswordTemplate(userOpenId, paymentApi.getTemplateId("test-merchant-password"));
|
|
|
|
paymentApi.sendTemplateMessage(msg);
|
|
|
|
paymentApi.sendTemplateMessage(msg);
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (Exception e) {
|
|
|
|
logger.error("给{}发送微信消息失败,原因:{}", userOpenId, e);
|
|
|
|
logger.error("给{}发送微信消息失败,原因:{}", userOpenId, e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
private TemplateMessage initSendTestPasswordTemplate(String wxopenid, String templateId, String url) {
|
|
|
|
private TemplateMessage initSendTestPasswordTemplate(String wxopenid, String templateId) {
|
|
|
|
TemplateMessage msg = new TemplateMessage(wxopenid, templateId, PlatformEnvironment.getEnv().concatUrl("testMerchantPassword" + url));
|
|
|
|
TemplateMessage msg = new TemplateMessage(wxopenid, templateId, PlatformEnvironment.getEnv().concatUrl("testMerchantPassword"));
|
|
|
|
msg.put("first", "系统测试商户账户已重置", "#000000");
|
|
|
|
msg.put("first", "系统测试商户账户已重置", "#000000");
|
|
|
|
msg.put("keyword1", "PINE", "#0000ff");
|
|
|
|
msg.put("keyword1", "PINE", "#0000ff");
|
|
|
|
msg.put("keyword2", "账号密码重置", "#000000");
|
|
|
|
msg.put("keyword2", "账号密码重置", "#000000");
|
|
|
@ -5130,27 +5132,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
return api.registerShortUrl(longUrl);
|
|
|
|
return api.registerShortUrl(longUrl);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static String AESencrypt(String content, String password) {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
KeyGenerator kgen = KeyGenerator.getInstance("AES");
|
|
|
|
|
|
|
|
SecureRandom random = SecureRandom.getInstance("SHA1PRNG");
|
|
|
|
|
|
|
|
random.setSeed(password.getBytes());
|
|
|
|
|
|
|
|
kgen.init(128, random);
|
|
|
|
|
|
|
|
SecretKey secretKey = kgen.generateKey();
|
|
|
|
|
|
|
|
byte[] enCodeFormat = secretKey.getEncoded();
|
|
|
|
|
|
|
|
SecretKeySpec key = new SecretKeySpec(enCodeFormat, "AES");
|
|
|
|
|
|
|
|
Cipher cipher = Cipher.getInstance("AES");
|
|
|
|
|
|
|
|
byte[] byteContent = content.getBytes(StandardCharsets.UTF_8);
|
|
|
|
|
|
|
|
cipher.init(Cipher.ENCRYPT_MODE, key);
|
|
|
|
|
|
|
|
byte[] result = cipher.doFinal(byteContent);
|
|
|
|
|
|
|
|
return Base64.encodeBase64String(result);
|
|
|
|
|
|
|
|
} catch (NoSuchPaddingException | NoSuchAlgorithmException | InvalidKeyException | IllegalBlockSizeException | BadPaddingException e) {
|
|
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private JSONObject getRsaKey() {
|
|
|
|
private JSONObject getRsaKey() {
|
|
|
|
JSONObject key = new JSONObject();
|
|
|
|
JSONObject key = new JSONObject();
|
|
|
|
KeyPair keyPairGen = RSACrypt.generateKeyPairs();
|
|
|
|
KeyPair keyPairGen = RSACrypt.generateKeyPairs();
|
|
|
|