diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java b/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java index 89630c392..17f0680fd 100644 --- a/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java +++ b/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java @@ -240,7 +240,7 @@ public class RetailAppServiceImp implements RetailAppService { if (device.getIntValue("client_id") != account.getIntValue("client_id") || PartnerRole.getRole(account.getIntValue("role")) == PartnerRole.CASHIER) { throw new ForbiddenException("You have no permission"); } - clientManager.updateAppClient(device.getIntValue("client_id"), appClientBean); + clientManager.updateAppClient(account,device.getIntValue("client_id"), appClientBean); } diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java index 600482fb0..7f6f0e23f 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java @@ -177,7 +177,7 @@ public interface ClientManager { void writeActivityPoster(JSONObject manager, String clientMoniker, String activityName, OutputStream ous) throws IOException; @Transactional - void updateTimeZone(String clientMoniker, String timezone); + void updateTimeZone(JSONObject account,String clientMoniker, String timezone); JSONObject listClientDevices(JSONObject manager, String clientMoniker, String remark, int page, int limit, String client_type, String[] client_ids); @@ -189,7 +189,7 @@ public interface ClientManager { JSONObject getBankInfo(JSONObject manager, String clientMoniker, String bsb_no); - void setMaxOrderAmount(String clientMoniker, BigDecimal limit); + void setMaxOrderAmount(JSONObject account,String clientMoniker, BigDecimal limit); void setClientQRCodePaySurCharge(String clientMoniker, boolean paySurcharge); @@ -241,13 +241,13 @@ public interface ClientManager { JSONArray getAllClientIds(int clientId); - void updateAppClient(int client_id, AppClientBean appClientBean); + void updateAppClient(JSONObject account,int client_id, AppClientBean appClientBean); - void setSkipClearing(String clientMoniker, Boolean skip_clearing); + void setSkipClearing(JSONObject account,String clientMoniker, Boolean skip_clearing); void enableGatewayUpgrade(String clientMoniker, boolean gatewayUpgrade); - void setCustomerSurchargeRate(String clientMoniker, BigDecimal customer_surcharge_rate); + void setCustomerSurchargeRate(JSONObject account,String clientMoniker, BigDecimal customer_surcharge_rate); void setOrderExpiryConfig(String clientMoniker, String orderExpiryConfig); 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 769484ff6..0f962266c 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 @@ -43,11 +43,17 @@ import au.com.royalpay.payment.manage.merchants.core.ClientConfigService; import au.com.royalpay.payment.manage.merchants.core.ClientInfoCacheSupport; import au.com.royalpay.payment.manage.merchants.core.ClientManager; import au.com.royalpay.payment.manage.merchants.core.ClientModifySupport; -import au.com.royalpay.payment.manage.merchants.entity.impls.ApproveEmailAuditModify; -import au.com.royalpay.payment.manage.merchants.entity.impls.GreenChannelAuditModify; -import au.com.royalpay.payment.manage.merchants.entity.impls.MerchantIdAuditModify; +import au.com.royalpay.payment.manage.merchants.entity.impls.ApproveEmailModify; +import au.com.royalpay.payment.manage.merchants.entity.impls.BDUserModify; +import au.com.royalpay.payment.manage.merchants.entity.impls.ClearDaysModify; +import au.com.royalpay.payment.manage.merchants.entity.impls.CustomerSurchargeRateModify; +import au.com.royalpay.payment.manage.merchants.entity.impls.GreenChannelModify; +import au.com.royalpay.payment.manage.merchants.entity.impls.MaxOrderAmountModify; +import au.com.royalpay.payment.manage.merchants.entity.impls.MerchantIdModify; import au.com.royalpay.payment.manage.merchants.entity.impls.RefundAuditModify; -import au.com.royalpay.payment.manage.merchants.entity.impls.SwitchPermissionAuditModify; +import au.com.royalpay.payment.manage.merchants.entity.impls.SettleHourModify; +import au.com.royalpay.payment.manage.merchants.entity.impls.SwitchPermissionModify; +import au.com.royalpay.payment.manage.merchants.entity.impls.TimeZoneModify; import au.com.royalpay.payment.manage.notice.core.MailService; import au.com.royalpay.payment.manage.signin.beans.TodoNotice; import au.com.royalpay.payment.manage.signin.core.ManagerTodoNoticeProvider; @@ -589,13 +595,13 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid String subMerchantId = subMerchantInfo.getString("sub_merchant_id"); WeChatPayConfig.Merchant availableMerchant = mpPaymentApi.determineMerchant(subMerchantId); clientModifySupport.processClientModify( - new MerchantIdAuditModify(manager, clientMoniker, subMerchantId, availableMerchant == null ? null : availableMerchant.getMerchantId())); + new MerchantIdModify(manager, clientMoniker, subMerchantId, availableMerchant == null ? null : availableMerchant.getMerchantId())); List children = clientMapper.listChildClients(clientId); for (JSONObject child : children) { if (Objects.equals(child.getString("sub_merchant_id"), originSubMerchantId)) { update.put("client_id", child.getIntValue("client_id")); clientModifySupport.processClientModify( - new MerchantIdAuditModify(manager, clientMoniker, subMerchantId, availableMerchant == null ? null : availableMerchant.getMerchantId())); + new MerchantIdModify(manager, clientMoniker, subMerchantId, availableMerchant == null ? null : availableMerchant.getMerchantId())); } } } @@ -653,7 +659,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid if (client.getString("sub_merchant_id") == null || client.getString("sub_merchant_id").equals("")) { throw new BadRequestException("该商户未设置微信 Sub Merchant ID!"); } - clientModifySupport.processClientModify(new GreenChannelAuditModify(manager, clientMoniker, manager.getString("manager_id"))); + clientModifySupport.processClientModify(new GreenChannelModify(manager, clientMoniker, manager.getString("manager_id"))); saveClientAuditProcess(client.getIntValue("client_id"), 10, 1, "绿色通道申请通过", manager); sendCommissionWechatMessage(client); initAdminUserAndSendEmail(manager, clientMoniker, client); @@ -837,7 +843,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } private void updateClientApproveEmailStatus(int status, JSONObject account, String client_moniker) { - clientModifySupport.processClientModify(new ApproveEmailAuditModify(account, client_moniker, status)); + clientModifySupport.processClientModify(new ApproveEmailModify(account, client_moniker, status)); } @Override @@ -878,7 +884,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid if (client == null) { throw new InvalidShortIdException(); } - clientModifySupport.processClientConfigModify(new SwitchPermissionAuditModify(manager,clientMoniker,permissionKey,allow)); + clientModifySupport.processClientConfigModify(new SwitchPermissionModify(manager, clientMoniker, permissionKey, allow)); } @Override @@ -889,7 +895,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid if (client == null) { throw new NotFoundException("Client Not Exists"); } - clientModifySupport.processClientConfigModify(new SwitchPermissionAuditModify(manager,clientMoniker,"enable_" + channel.toLowerCase(),allow)); + clientModifySupport.processClientConfigModify(new SwitchPermissionModify(manager, clientMoniker, "enable_" + channel.toLowerCase(), allow)); logger.info(manager.getString("display_name") + "(" + manager.getString("manager_id") + ") switched client " + clientMoniker + " channel " + channel + " to " + allow); return; @@ -1057,12 +1063,12 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } @Override - public void togglePayNotice(JSONObject account,String clientMoniker, boolean enable) { + public void togglePayNotice(JSONObject account, String clientMoniker, boolean enable) { JSONObject partner = getClientInfoByMoniker(clientMoniker); Assert.notNull(partner); partner.put("enable_pay_notice", enable); clientMapper.update(partner); - clientModifySupport.processClientConfigModify(new SwitchPermissionAuditModify(account,clientMoniker,"enable_pay_notice", enable)); + clientModifySupport.processClientConfigModify(new SwitchPermissionModify(account, clientMoniker, "enable_pay_notice", enable)); clientInfoCacheSupport.clearClientCache(partner.getIntValue("client_id")); } @@ -1201,12 +1207,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid throw new InvalidShortIdException(); } checkOrgPermission(manager, client); - logger.info(manager.getString("username") + " changed settle hour to " + hour); - JSONObject update = new JSONObject(); - update.put("client_id", client.getIntValue("client_id")); - update.put("settle_hour", hour); - clientMapper.update(update); - clientInfoCacheSupport.clearClientCache(client.getIntValue("client_id")); + clientModifySupport.processClientModify(new SettleHourModify(manager, clientMoniker, hour)); } @Override @@ -1308,7 +1309,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid JSONObject changeRate = merchantInfoProvider.clientCurrentRate(clientId, new Date(), "Wechat"); int cleanDays = changeRate.getIntValue("clean_days"); if (cleanDays != client.getIntValue("clean_days")) { - clientMapper.updateCleanDays(clientId, cleanDays); + clientModifySupport.processClientConfigModify(new ClearDaysModify(manager, clientMoniker, cleanDays)); } // clientMapper.updateCleanDays(clientId, config.getCleanDays()); } @@ -1494,17 +1495,14 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid bd_id = bd_id + user.getString("manager_id") + ","; bd_name = bd_name + user.getString("display_name") + ","; } - JSONObject clientUpdate = new JSONObject(); - clientUpdate.put("client_id", client.getIntValue("client_id")); - clientUpdate.put("bd_user", bd_id.substring(0, bd_id.length() - 1)); - clientUpdate.put("bd_user_name", bd_name.substring(0, bd_name.length() - 1)); + BDUserModify bdUserModify = new BDUserModify(managerMapper.findById(manager_id), client.getString("client_moniker"), + bd_id.substring(0, bd_id.length() - 1), bd_name.substring(0, bd_name.length() - 1)); if (users.size() > 0) { String bd_manager_id = users.get(0).getString("manager_id"); JSONObject manager = managerMapper.findById(bd_manager_id); - clientUpdate.put("org_id", manager.getIntValue("org_id")); + bdUserModify.setOrg_id(manager.getIntValue("org_id")); } - - clientMapper.update(clientUpdate); + clientModifySupport.processClientModify(bdUserModify); } @@ -1668,17 +1666,12 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } @Override - public void updateTimeZone(String clientMoniker, String timezone) { + public void updateTimeZone(JSONObject account,String clientMoniker, String timezone) { JSONObject client = getClientInfoByMoniker(clientMoniker); if (client == null) { throw new InvalidShortIdException(); } - JSONObject partner = new JSONObject(); - int clientId = client.getIntValue("client_id"); - partner.put("client_id", clientId); - partner.put("timezone", timezone); - clientMapper.update(partner); - clientInfoCacheSupport.clearClientCache(clientId); + clientModifySupport.processClientModify(new TimeZoneModify(account,clientMoniker,timezone)); } @Override @@ -1771,37 +1764,32 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } @Override - public void setMaxOrderAmount(String clientMoniker, BigDecimal limit) { + public void setMaxOrderAmount(JSONObject account,String clientMoniker, BigDecimal limit) { JSONObject client = getClientInfoByMoniker(clientMoniker); if (client == null) { throw new InvalidShortIdException(); } - JSONObject update = new JSONObject(); - update.put("client_id", client.getIntValue("client_id")); - update.put("max_order_amount", limit == null ? null : limit.toPlainString()); - clientMapper.update(update); + clientModifySupport.processClientConfigModify(new MaxOrderAmountModify(account,clientMoniker,limit)); } + @Override - public void setCustomerSurchargeRate(String clientMoniker, BigDecimal customer_surcharge_rate) { + public void setCustomerSurchargeRate(JSONObject account,String clientMoniker, BigDecimal customer_surcharge_rate) { JSONObject client = getClientInfoByMoniker(clientMoniker); if (client == null) { throw new InvalidShortIdException(); } - JSONObject update = new JSONObject(); - update.put("client_id", client.getIntValue("client_id")); if (customer_surcharge_rate == null) { - update.put("customer_surcharge_rate", null); + clientModifySupport.processClientConfigModify(new CustomerSurchargeRateModify(account,clientMoniker,null)); } else { BigDecimal rate_value = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "Wechat").getBigDecimal("rate_value"); if (customer_surcharge_rate.compareTo(PlatformEnvironment.getEnv().getMaxCustomerSurchargeRate()) > 0 || customer_surcharge_rate.compareTo(rate_value) < 0) { throw new ForbiddenException("Invalid Range"); } - update.put("customer_surcharge_rate", customer_surcharge_rate); + clientModifySupport.processClientConfigModify(new CustomerSurchargeRateModify(account,clientMoniker,customer_surcharge_rate)); } - clientConfigService.update(update); } @Override @@ -2810,7 +2798,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } @Override - public void updateAppClient(int client_id, AppClientBean appClientBean) { + public void updateAppClient(JSONObject account,int client_id, AppClientBean appClientBean) { JSONObject client = getClientInfo(client_id); Assert.notNull(client); JSONObject updateObj = appClientBean.updateObject(); @@ -2823,13 +2811,12 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid throw new ForbiddenException("customerSurchargeRate is 0"); } BigDecimal customerSurchargeRate = new BigDecimal(appClientBean.getCustomerSurchargeRate()).setScale(2, BigDecimal.ROUND_HALF_DOWN); - setCustomerSurchargeRate(client.getString("client_moniker"), customerSurchargeRate); + setCustomerSurchargeRate(account,client.getString("client_moniker"), customerSurchargeRate); } - clientInfoCacheSupport.clearClientCache(client_id); } @Override - public void setSkipClearing(String clientMoniker, Boolean skip_clearing) { + public void setSkipClearing(JSONObject account,String clientMoniker, Boolean skip_clearing) { JSONObject client = getClientInfoByMoniker(clientMoniker); if (client == null) { throw new InvalidShortIdException(); @@ -2838,6 +2825,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid int clientId = client.getIntValue("client_id"); update.put("client_id", clientId); update.put("skip_clearing", skip_clearing); + clientModifySupport.processClientConfigModify(new SwitchPermissionModify()); clientMapper.update(update); clientInfoCacheSupport.clearClientCache(clientId); } diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/ApproveEmailAuditModify.java b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/ApproveEmailModify.java similarity index 79% rename from src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/ApproveEmailAuditModify.java rename to src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/ApproveEmailModify.java index f05bf9688..6f9c5f960 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/ApproveEmailAuditModify.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/ApproveEmailModify.java @@ -7,10 +7,10 @@ import com.alibaba.fastjson.JSONObject; /** * Create by yixian at 2018-04-12 16:43 */ -public class ApproveEmailAuditModify extends ClientModify { +public class ApproveEmailModify extends ClientModify { private int approve_email_send; - public ApproveEmailAuditModify(JSONObject account, String clientMoniker, int approve_email_send) { + public ApproveEmailModify(JSONObject account, String clientMoniker, int approve_email_send) { super(account, clientMoniker); this.approve_email_send = approve_email_send; diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/BDUserModify.java b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/BDUserModify.java new file mode 100644 index 000000000..96165f218 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/BDUserModify.java @@ -0,0 +1,44 @@ +package au.com.royalpay.payment.manage.merchants.entity.impls; + +import au.com.royalpay.payment.manage.merchants.entity.ClientModify; + +import com.alibaba.fastjson.JSONObject; + +/** + * Create by yixian at 2018-04-12 16:43 + */ +public class BDUserModify extends ClientModify { + private String bd_user; + private String bd_user_name; + private int org_id; + + public BDUserModify(JSONObject account, String clientMoniker, String bd_user, String bd_user_name) { + super(account, clientMoniker); + this.bd_user = bd_user; + this.bd_user_name = bd_user_name; + } + + public int getOrg_id() { + return org_id; + } + + public void setOrg_id(int org_id) { + this.org_id = org_id; + } + + @Override + protected String business() { + return "修改商户BD为"+bd_user_name+"("+bd_user+")"; + } + + @Override + protected JSONObject getModifyResult() { + JSONObject modify = new JSONObject(); + modify.put("bd_user", bd_user); + modify.put("bd_user_name", bd_user_name); + if(org_id!=0){ + modify.put("org_id",org_id); + } + return modify; + } +} diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/ClearDaysModify.java b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/ClearDaysModify.java new file mode 100644 index 000000000..b53b5289c --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/ClearDaysModify.java @@ -0,0 +1,30 @@ +package au.com.royalpay.payment.manage.merchants.entity.impls; + +import au.com.royalpay.payment.manage.merchants.entity.ClientConfigModify; + +import com.alibaba.fastjson.JSONObject; + +/** + * Create by yixian at 2018-04-12 16:43 + */ +public class ClearDaysModify extends ClientConfigModify { + private int settle_hour; + + public ClearDaysModify(JSONObject account, String clientMoniker, int settle_hour) { + super(account, clientMoniker); + this.settle_hour = settle_hour; + } + + @Override + protected String business() { + + return "修改商户清算截止时间为:"+settle_hour; + } + + @Override + protected JSONObject getModifyResult() { + JSONObject modify = new JSONObject(); + modify.put("settle_hour", settle_hour); + return modify; + } +} \ No newline at end of file diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/CustomerSurchargeRateModify.java b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/CustomerSurchargeRateModify.java new file mode 100644 index 000000000..23544c98e --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/CustomerSurchargeRateModify.java @@ -0,0 +1,32 @@ +package au.com.royalpay.payment.manage.merchants.entity.impls; + +import au.com.royalpay.payment.manage.merchants.entity.ClientConfigModify; + +import com.alibaba.fastjson.JSONObject; + +import java.math.BigDecimal; + +/** + * Create by yixian at 2018-04-12 16:43 + */ +public class CustomerSurchargeRateModify extends ClientConfigModify { + private BigDecimal customer_surcharge_rate; + + public CustomerSurchargeRateModify(JSONObject account, String clientMoniker, BigDecimal customer_surcharge_rate) { + super(account, clientMoniker); + this.customer_surcharge_rate = customer_surcharge_rate; + } + + @Override + protected String business() { + + return "修改商户客户手续费率为:"+customer_surcharge_rate; + } + + @Override + protected JSONObject getModifyResult() { + JSONObject modify = new JSONObject(); + modify.put("customer_surcharge_rate", customer_surcharge_rate); + return modify; + } +} \ No newline at end of file diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/GreenChannelAuditModify.java b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/GreenChannelModify.java similarity index 83% rename from src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/GreenChannelAuditModify.java rename to src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/GreenChannelModify.java index 5bb0070b7..77b8e35b4 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/GreenChannelAuditModify.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/GreenChannelModify.java @@ -9,10 +9,10 @@ import java.util.Date; /** * Create by yixian at 2018-04-12 16:43 */ -public class GreenChannelAuditModify extends ClientModify { +public class GreenChannelModify extends ClientModify { private String manager_id; - public GreenChannelAuditModify(JSONObject account, String clientMoniker, String manager_id) { + public GreenChannelModify(JSONObject account, String clientMoniker, String manager_id) { super(account, clientMoniker); this.manager_id = manager_id; diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/MaxOrderAmountModify.java b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/MaxOrderAmountModify.java new file mode 100644 index 000000000..87e75bee6 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/MaxOrderAmountModify.java @@ -0,0 +1,32 @@ +package au.com.royalpay.payment.manage.merchants.entity.impls; + +import au.com.royalpay.payment.manage.merchants.entity.ClientConfigModify; + +import com.alibaba.fastjson.JSONObject; + +import java.math.BigDecimal; + +/** + * Create by yixian at 2018-04-12 16:43 + */ +public class MaxOrderAmountModify extends ClientConfigModify { + private BigDecimal max_order_amount; + + + public MaxOrderAmountModify(JSONObject account, String clientMoniker, BigDecimal max_order_amount) { + super(account, clientMoniker); + this.max_order_amount = max_order_amount; + } + + @Override + protected String business() { + return "修改商户最大订单额为:"+max_order_amount; + } + + @Override + protected JSONObject getModifyResult() { + JSONObject modify = new JSONObject(); + modify.put("max_order_amount", max_order_amount); + return modify; + } +} diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/MerchantIdAuditModify.java b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/MerchantIdModify.java similarity index 82% rename from src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/MerchantIdAuditModify.java rename to src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/MerchantIdModify.java index 3c743255b..c7422e6ba 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/MerchantIdAuditModify.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/MerchantIdModify.java @@ -7,11 +7,11 @@ import com.alibaba.fastjson.JSONObject; /** * Create by yixian at 2018-04-12 16:43 */ -public class MerchantIdAuditModify extends ClientModify { +public class MerchantIdModify extends ClientModify { private String sub_merchant_id; private String merchant_id; - public MerchantIdAuditModify(JSONObject account, String clientMoniker, String sub_merchant_id, String merchant_id) { + public MerchantIdModify(JSONObject account, String clientMoniker, String sub_merchant_id, String merchant_id) { super(account, clientMoniker); this.sub_merchant_id = sub_merchant_id; this.merchant_id = merchant_id; diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/SettleHourModify.java b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/SettleHourModify.java new file mode 100644 index 000000000..56d59465a --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/SettleHourModify.java @@ -0,0 +1,30 @@ +package au.com.royalpay.payment.manage.merchants.entity.impls; + +import au.com.royalpay.payment.manage.merchants.entity.ClientModify; + +import com.alibaba.fastjson.JSONObject; + +/** + * Create by yixian at 2018-04-12 16:43 + */ +public class SettleHourModify extends ClientModify { + private int settle_hour; + + public SettleHourModify(JSONObject account, String clientMoniker, int settle_hour) { + super(account, clientMoniker); + this.settle_hour = settle_hour; + } + + @Override + protected String business() { + + return "修改商户清算截止时间为:"+settle_hour; + } + + @Override + protected JSONObject getModifyResult() { + JSONObject modify = new JSONObject(); + modify.put("settle_hour", settle_hour); + return modify; + } +} \ No newline at end of file diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/SwitchPermissionAuditModify.java b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/SwitchPermissionModify.java similarity index 78% rename from src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/SwitchPermissionAuditModify.java rename to src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/SwitchPermissionModify.java index 6f7b85edb..0118080b0 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/SwitchPermissionAuditModify.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/SwitchPermissionModify.java @@ -7,11 +7,11 @@ import com.alibaba.fastjson.JSONObject; /** * Create by yixian at 2018-04-12 16:43 */ -public class SwitchPermissionAuditModify extends ClientConfigModify { +public class SwitchPermissionModify extends ClientConfigModify { private String key; private boolean value; - public SwitchPermissionAuditModify(JSONObject account, String clientMoniker, String key, boolean value) { + public SwitchPermissionModify(JSONObject account, String clientMoniker, String key, boolean value) { super(account, clientMoniker); this.key = key; this.value = value; diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/TimeZoneModify.java b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/TimeZoneModify.java new file mode 100644 index 000000000..75c132bac --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/TimeZoneModify.java @@ -0,0 +1,29 @@ +package au.com.royalpay.payment.manage.merchants.entity.impls; + +import au.com.royalpay.payment.manage.merchants.entity.ClientModify; + +import com.alibaba.fastjson.JSONObject; + +/** + * Create by yixian at 2018-04-12 16:43 + */ +public class TimeZoneModify extends ClientModify { + private String timezone; + + public TimeZoneModify(JSONObject account, String clientMoniker, String timezone) { + super(account, clientMoniker); + this.timezone = timezone; + } + + @Override + protected String business() { + return "修改商户时区为:"+timezone; + } + + @Override + protected JSONObject getModifyResult() { + JSONObject modify = new JSONObject(); + modify.put("timezone", timezone); + return modify; + } +} diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java b/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java index cb0627de9..a1a6ae0a9 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java @@ -10,13 +10,10 @@ import au.com.royalpay.payment.manage.merchants.beans.PartnerQuery; import au.com.royalpay.payment.manage.merchants.beans.SubMerchantIdApply; import au.com.royalpay.payment.manage.merchants.core.ClientManager; import au.com.royalpay.payment.manage.permission.manager.ManagerMapping; -import au.com.royalpay.payment.manage.permission.manager.PartnerMapping; import au.com.royalpay.payment.manage.permission.manager.RequireManager; -import au.com.royalpay.payment.manage.system.core.ClientContractService; import au.com.royalpay.payment.manage.tradelog.beans.TradeLogQuery; import au.com.royalpay.payment.manage.tradelog.core.TradeLogService; import au.com.royalpay.payment.tools.CommonConsts; -import au.com.royalpay.payment.tools.env.SysConfigManager; import au.com.royalpay.payment.tools.http.HttpUtils; import au.com.royalpay.payment.tools.merchants.beans.QRCodeConfig; import au.com.royalpay.payment.tools.permission.enums.ManagerRole; @@ -133,13 +130,13 @@ public class PartnerManageController { } @ManagerMapping(value = "/{clientMoniker}/max_order_amount", method = RequestMethod.PUT, role = {ManagerRole.OPERATOR}) - public void setMaxOrderAmount(@PathVariable String clientMoniker, @RequestBody JSONObject limit) { - clientManager.setMaxOrderAmount(clientMoniker, limit.getBigDecimal("limit")); + public void setMaxOrderAmount(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager,@PathVariable String clientMoniker, @RequestBody JSONObject limit) { + clientManager.setMaxOrderAmount(manager,clientMoniker, limit.getBigDecimal("limit")); } @ManagerMapping(value = "/{clientMoniker}/customer_surcharge_rate", method = RequestMethod.PUT, role = {ManagerRole.ADMIN}) - public void setCustomerSurchargeRate(@PathVariable String clientMoniker, @RequestBody JSONObject config) { - clientManager.setCustomerSurchargeRate(clientMoniker, config.getBigDecimal("customer_surcharge_rate")); + public void setCustomerSurchargeRate(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager,@PathVariable String clientMoniker, @RequestBody JSONObject config) { + clientManager.setCustomerSurchargeRate(manager,clientMoniker, config.getBigDecimal("customer_surcharge_rate")); } @ManagerMapping(value = "/{clientMoniker}/order_expiry_config", method = RequestMethod.PUT, role = {ManagerRole.ADMIN}) @@ -326,8 +323,8 @@ public class PartnerManageController { } @ManagerMapping(value = "/{clientMoniker}/skip_clearing", method = RequestMethod.PUT, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR, ManagerRole.FINANCIAL_STAFF}) - public void skipClearing(@PathVariable String clientMoniker, @RequestBody JSONObject skip_clearing) { - clientManager.setSkipClearing(clientMoniker, skip_clearing.getBooleanValue("skip_clearing")); + public void skipClearing(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager,@PathVariable String clientMoniker, @RequestBody JSONObject skip_clearing) { + clientManager.setSkipClearing(manager,clientMoniker, skip_clearing.getBooleanValue("skip_clearing")); } @ManagerMapping(value = "/{clientMoniker}/settle_hour", method = RequestMethod.PUT, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR, ManagerRole.SERVANT, ManagerRole.FINANCIAL_STAFF}) diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerViewController.java b/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerViewController.java index 7cd2836f8..f52f2c543 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerViewController.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerViewController.java @@ -277,7 +277,7 @@ public class PartnerViewController { if (!timezone.matches("^((Australia/West)|(Australia/Eucla)|(Australia/North)|(Australia/South)|(Australia/Brisbane)|(Australia/Melbourne)|(Australia/LHI))$")) { throw new ParamInvalidException("timezone", "error.payment.valid.invalid_timezone"); } - clientManager.updateTimeZone(account.getString("client_moniker"), timezone); + clientManager.updateTimeZone(account,account.getString("client_moniker"), timezone); } @PartnerMapping(value = "/sub_partners", method = RequestMethod.GET) @@ -352,7 +352,7 @@ public class PartnerViewController { @PartnerMapping(value = "/customer_surcharge_rate", method = RequestMethod.PUT, roles = PartnerRole.ADMIN) @ResponseBody public void setCustomerSurchargeRate(@RequestBody JSONObject pass, @ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject account) { - clientManager.setCustomerSurchargeRate(account.getString("client_moniker"), pass.getBigDecimal("customer_surcharge_rate")); + clientManager.setCustomerSurchargeRate(account,account.getString("client_moniker"), pass.getBigDecimal("customer_surcharge_rate")); } @PartnerMapping(value = "/trade_logs/full_release_preauth", method = RequestMethod.PUT, roles = {PartnerRole.ADMIN, PartnerRole.MANAGER})