diff --git a/src/main/java/au/com/royalpay/payment/manage/dev/web/TestController.java b/src/main/java/au/com/royalpay/payment/manage/dev/web/TestController.java index 2f2725959..b2873e131 100644 --- a/src/main/java/au/com/royalpay/payment/manage/dev/web/TestController.java +++ b/src/main/java/au/com/royalpay/payment/manage/dev/web/TestController.java @@ -25,7 +25,6 @@ import au.com.royalpay.payment.manage.mappers.system.ClientMapper; import au.com.royalpay.payment.manage.merchants.core.ClientManager; import au.com.royalpay.payment.manage.permission.manager.ManagerMapping; import au.com.royalpay.payment.manage.system.core.TradeSecureService; -import au.com.royalpay.payment.manage.system.core.beans.TradeSecureFile; import au.com.royalpay.payment.manage.tradelog.core.TradeLogService; import au.com.royalpay.payment.tools.CommonConsts; import au.com.royalpay.payment.tools.defines.TradeType; @@ -62,8 +61,6 @@ import java.io.File; import java.io.IOException; import java.math.BigDecimal; import java.net.URISyntaxException; -import java.util.ArrayList; -import java.util.Arrays; import java.util.Date; import java.util.List; diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java index c0f5384ca..be80afe17 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java @@ -103,7 +103,6 @@ import org.springframework.util.CollectionUtils; import org.springframework.web.bind.annotation.RequestMethod; import org.thymeleaf.context.Context; import org.thymeleaf.spring4.SpringTemplateEngine; -import sun.misc.BASE64Encoder; import javax.annotation.PostConstruct; import javax.annotation.Resource; @@ -416,8 +415,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } //商户支付场景 if (StringUtils.isNotBlank(client.getString("client_pay_type"))) { - client.put("client_pay_type",client.getString("client_pay_type").split(",")); - client.put("client_pay_desc",client.getString("client_pay_desc").split(",")); + client.put("client_pay_type", client.getString("client_pay_type").split(",")); + client.put("client_pay_desc", client.getString("client_pay_desc").split(",")); } if (StringUtils.isNotBlank(client.getString("parent_client_id")) && sysClientMapper.childClientId(client.getIntValue("client_id")).size() > 0) { @@ -427,7 +426,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid JSONObject partnerGatewaySign = merchantSignInfoMapper.findClientSign(client.getString("client_moniker")); if (partnerGatewaySign == null) { client.put("enable_gateway_version2", false); - }else { + } else { client.put("enable_gateway_version2", partnerGatewaySign.getBooleanValue("is_valid")); client.put("gateway_sign", partnerGatewaySign); } @@ -525,7 +524,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid int authDays = PlatformEnvironment.getEnv().authDays();// 快速自助开通申请有效期 for (JSONObject partner : partners) { String subMerchantId = partner.getString("sub_merchant_id"); - if (subMerchantId != null ) { + if (subMerchantId != null) { partner.put("temp_sub_merchant", checkSubMerchantIdInCommonPool(subMerchantId)); } if (partner.getIntValue("approve_result") == 2) { @@ -1818,7 +1817,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid List clients = clientMapper.listChildClients(partner.getIntValue("client_id")); if (clients.size() > 0) { partner.put("level3Clients", clients); - clients.forEach(e->{ + clients.forEach(e -> { e.put("parent_client_moniker", partner.getString("client_moniker")); }); } @@ -1903,7 +1902,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid JSONObject clientInfo = getClientInfo(Integer.parseInt(currentClientId)); if (clientInfo.containsKey("parent_client_id")) { int parentClientId = clientInfo.getIntValue("parent_client_id"); - if (parentClientId != client_id && client_id!= Integer.parseInt(currentClientId) && !listLevel3Client(client_id).contains(parentClientId)) { + if (parentClientId != client_id && client_id != Integer.parseInt(currentClientId) && !listLevel3Client(client_id).contains(parentClientId)) { throw new Exception("partner has no permission"); } } @@ -3272,7 +3271,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid gatewaySignInfo.put("last_update_date", new Date()); merchantSignInfoMapper.insert(gatewaySignInfo); } - clientModifySupport.processClientGatewaySignModify(new SwitchGatewaySignPermissionModify(account, client.getString("client_moniker"),"is_valid" ,enable_gateway_v2)); + clientModifySupport.processClientGatewaySignModify(new SwitchGatewaySignPermissionModify(account, client.getString("client_moniker"), "is_valid", enable_gateway_v2)); } @Override @@ -3282,7 +3281,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid if (client == null) { throw new InvalidShortIdException(); } - clientModifySupport.processClientGatewaySignModify(new SwitchGatewaySignPermissionModify(account, client.getString("client_moniker"),"verify_ip" ,verify_ip)); + clientModifySupport.processClientGatewaySignModify(new SwitchGatewaySignPermissionModify(account, client.getString("client_moniker"), "verify_ip", verify_ip)); } @Override @@ -3293,7 +3292,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid throw new InvalidShortIdException(); } if (StringUtils.isNotBlank(ipWhitelistConfig)) { - clientModifySupport.processClientGatewaySignModify(new GatewayInfoModify(account, client.getString("client_moniker"),"ip_whitelist", ipWhitelistConfig, "重新设置IP白名单")); + clientModifySupport.processClientGatewaySignModify(new GatewayInfoModify(account, client.getString("client_moniker"), "ip_whitelist", ipWhitelistConfig, "重新设置IP白名单")); } } @@ -3306,8 +3305,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid throw new InvalidShortIdException(); } JSONObject key = getRsaKey(); - clientModifySupport.processClientGatewaySignModify(new GatewayInfoModify(account, client.getString("client_moniker"),"platform_public_key",key.getString("public_key"),"重新生成平台公钥")); - clientModifySupport.processClientGatewaySignModify(new GatewayInfoModify(account, client.getString("client_moniker"),"platform_private_key",key.getString("private_key"),"重新生成平台私钥")); + clientModifySupport.processClientGatewaySignModify(new GatewayInfoModify(account, client.getString("client_moniker"), "platform_public_key", key.getString("public_key"), "重新生成平台公钥")); + clientModifySupport.processClientGatewaySignModify(new GatewayInfoModify(account, client.getString("client_moniker"), "platform_private_key", key.getString("private_key"), "重新生成平台私钥")); } @Override @@ -3648,7 +3647,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid if (client == null) { throw new InvalidShortIdException(); } - return clearingDistributedSurchargeMapper.findSurchargeTransactionsByDetailId(client.getIntValue("client_id"),detailId); + return clearingDistributedSurchargeMapper.findSurchargeTransactionsByDetailId(client.getIntValue("client_id"), detailId); } @Override @@ -4177,27 +4176,27 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid queryGMSJson.put("partner", mch.getPid()); queryGMSJson.put("sign_type", "MD5"); queryGMSJson.put("_input_charset", "utf-8"); - queryGMSJson.put("timestamp", DateFormatUtils.format(System.currentTimeMillis(),"yyyy-MM-dd HH:mm:ss")); + queryGMSJson.put("timestamp", DateFormatUtils.format(System.currentTimeMillis(), "yyyy-MM-dd HH:mm:ss")); queryGMSJson.put("secondary_merchant_name", client.getString("company_name")); queryGMSJson.put("secondary_merchant_id", client.getString("client_moniker")); queryGMSJson.put("store_id", client.getString("client_moniker")); queryGMSJson.put("store_name", client.getString("short_name")); - queryGMSJson.put("store_country", client.getString("country").substring(0,2)); - queryGMSJson.put("store_address", client.getString("country") + " "+client.getString("state") + " "+client.getString("suburb") + " "+client.getString("address")); + queryGMSJson.put("store_country", client.getString("country").substring(0, 2)); + queryGMSJson.put("store_address", client.getString("country") + " " + client.getString("state") + " " + client.getString("suburb") + " " + client.getString("address")); queryGMSJson.put("store_industry", client.getString("alipayindustry")); queryGMSJson.put("internal_store_photo", client.getString("company_photo")); queryGMSJson.put("external_storefront_photo", client.getString("store_photo")); - queryGMSJson.put("register_country", client.getString("country").substring(0,2)); - queryGMSJson.put("register_address", client.getString("country") + " "+client.getString("state") + " "+client.getString("suburb") + " "+client.getString("address")); + queryGMSJson.put("register_country", client.getString("country").substring(0, 2)); + queryGMSJson.put("register_address", client.getString("country") + " " + client.getString("state") + " " + client.getString("suburb") + " " + client.getString("address")); if ("Company".equals(client.getString("business_structure"))) { queryGMSJson.put("secondary_merchant_type", "ENTERPRISE"); queryGMSJson.put("registration_no", client.getString("acn")); - }else { + } else { queryGMSJson.put("secondary_merchant_type", "INDIVIDUAL"); queryGMSJson.put("representative_name", client.getString("contact_person")); } - queryGMSJson.put("contact_no",client.getString("contact_phone")); - queryGMSJson.put("contact_email",client.getString("contact_email")); + queryGMSJson.put("contact_no", client.getString("contact_phone")); + queryGMSJson.put("contact_email", client.getString("contact_email")); return queryGMSJson; } @@ -4214,12 +4213,12 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid queryGMSJson.put("partner", mch.getPid()); queryGMSJson.put("sign_type", "MD5"); queryGMSJson.put("_input_charset", "utf-8"); - queryGMSJson.put("timestamp", DateFormatUtils.format(System.currentTimeMillis(),"yyyy-MM-dd HH:mm:ss")); + queryGMSJson.put("timestamp", DateFormatUtils.format(System.currentTimeMillis(), "yyyy-MM-dd HH:mm:ss")); queryGMSJson.put("secondary_merchant_name", client.getString("company_name")); queryGMSJson.put("secondary_merchant_id", client.getString("client_moniker")); queryGMSJson.put("secondary_merchant_industry", client.getString("alipayindustry")); - queryGMSJson.put("register_country", client.getString("country").substring(0,2)); - queryGMSJson.put("register_address", client.getString("country") + " "+client.getString("state") + " "+client.getString("suburb") + " "+client.getString("address")); + queryGMSJson.put("register_country", client.getString("country").substring(0, 2)); + queryGMSJson.put("register_address", client.getString("country") + " " + client.getString("state") + " " + client.getString("suburb") + " " + client.getString("address")); JSONObject website = new JSONObject(); List websites = new ArrayList<>(); website.put("site_type", "WEB"); @@ -4231,12 +4230,12 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid queryGMSJson.put("secondary_merchant_type", "ENTERPRISE"); queryGMSJson.put("registration_no", client.getString("acn")); queryGMSJson.put("shareholder_name", client.getString("contact_person")); - }else { + } else { queryGMSJson.put("secondary_merchant_type", "INDIVIDUAL"); queryGMSJson.put("representative_name", client.getString("contact_person")); } - queryGMSJson.put("contact_no",client.getString("contact_phone")); - queryGMSJson.put("contact_email",client.getString("contact_email")); + queryGMSJson.put("contact_no", client.getString("contact_phone")); + queryGMSJson.put("contact_email", client.getString("contact_email")); return queryGMSJson; } @@ -4855,7 +4854,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid needCheckParams.put("bank_account_no", bankAccount.getString("account_no")); } List listRiskySimilarMerchants = riskAttentionMerchantsMapper.listRiskySimilarMerchants(needCheckParams); - if (listRiskySimilarMerchants.size() > 0) { + if (!listRiskySimilarMerchants.isEmpty()) { StringBuilder appendStr = new StringBuilder(); StringBuilder infoStr = new StringBuilder(); @@ -5112,7 +5111,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid List sendAccounts = new ArrayList<>(); needNotifyUsers.forEach(userOpenId -> { try { - accounts.forEach(account ->{ + accounts.forEach(account -> { JSONObject params = new JSONObject(); params.put("client_moniker", account.getString("client_moniker")); params.put("role", account.getIntValue("role")); @@ -5173,8 +5172,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid KeyPair keyPairGen = RSACrypt.generateKeyPairs(); RSAPublicKey publicKey = (RSAPublicKey) keyPairGen.getPublic(); RSAPrivateKey privateKey = (RSAPrivateKey) keyPairGen.getPrivate(); - key.put("public_key", new BASE64Encoder().encode(publicKey.getEncoded())); - key.put("private_key", new BASE64Encoder().encode(privateKey.getEncoded())); + key.put("public_key", Base64.encodeBase64String(publicKey.getEncoded())); + key.put("private_key", Base64.encodeBase64String(privateKey.getEncoded())); return key; } diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/enums/PaymentScenarioEnum.java b/src/main/java/au/com/royalpay/payment/manage/merchants/enums/PaymentScenarioEnum.java new file mode 100644 index 000000000..b58f6ffe0 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/enums/PaymentScenarioEnum.java @@ -0,0 +1,59 @@ +package au.com.royalpay.payment.manage.merchants.enums; + +/** + * @Author: luoyang + * @Date: 2019-05-29 10:30 + */ +public enum PaymentScenarioEnum { + PC_WEB("101", "PC网站"),//1 + + MOBILE_WEB("102", "手机端网站"),//2 + + APP("103", "APP"),//3 + + WECHAT_ALIPAY_WEB("104", "微信内、支付宝内网站"),//4 + + MINIPROGRAM("105", "小程序"),//5 + + QRCODE_BOARD("201", "二维码立牌"),//6 + + ROYALPAY_POS("202", "Royalpay POS"),//7 + + CASHIER_POS("203", "收银系统"),//8 + + IPOS("20301", "ipos"),//9 + + POSPAL("20302", "pospal"),//10 + + AUPOS("20303", "aupos"),//11 + + OTHER("20399", "other"),//12 + + VENDING_MACHINE("204", "无人售货机"),//13 + + LOTUS("20304", "Lotus"), + + AOSHANGBAO("20305", "AoShangBao"), + + INFINITY("20306", "Infinity"), + + EASY_CLOUD("20307", "EasyCloud"), + + AOMAIKE("20308", "AoMaiKe"); + + private final String scenarioTypeId; + private final String desc; + + public String getScenarioTypeId() { + return scenarioTypeId; + } + + public String getDesc() { + return desc; + } + + PaymentScenarioEnum(String scenarioTypeId, String desc) { + this.scenarioTypeId = scenarioTypeId; + this.desc = desc; + } +} \ No newline at end of file diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/enums/paymentScenarioEnum.java b/src/main/java/au/com/royalpay/payment/manage/merchants/enums/paymentScenarioEnum.java deleted file mode 100644 index 912300a0a..000000000 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/enums/paymentScenarioEnum.java +++ /dev/null @@ -1,47 +0,0 @@ -package au.com.royalpay.payment.manage.merchants.enums; - -/** - * @Author: luoyang - * @Date: 2019-05-29 10:30 - */ -public enum paymentScenarioEnum { - PC_WEB(1, "PC网站"), - - MOBILE_WEB(2, "手机端网站"), - - APP(3, "APP"), - - WECHAT_ALIPAY_WEB(4, "微信内、支付宝内网站"), - - MINIPROGRAM(5, "小程序"), - - QRCODE_BOARD(6, "二维码立牌"), - - ROYALPAY_POS(7,"Royalpay POS"), - - CASHIER_POS(8,"收银系统"), - - IPOS(9,"ipos"), - - POSPAL(10,"pospal"), - - AUPOS(11,"aupos"), - - OTHER(12,"other"), - - VENDING_MACHINE(13,"无人售货机"); - - private final int scenarioTypeId; - private final String desc; - - public int getScenarioTypeId() { - return scenarioTypeId; - } - - public String getDesc() { - return desc; - } - paymentScenarioEnum(int scenarioTypeId, String desc) { - this.scenarioTypeId = scenarioTypeId; - this.desc = desc; - }} \ No newline at end of file