From 900f31a2c6b204d441547eeb6789850b901739f0 Mon Sep 17 00:00:00 2001 From: wangning <164851225@qq.com> Date: Fri, 9 Mar 2018 13:57:40 +0800 Subject: [PATCH] update --- .../core/impls/RetailAppServiceImp.java | 30 +------------------ .../manage/merchants/core/ClientManager.java | 2 +- .../core/impls/ClientManagerImpl.java | 7 +++-- .../web/PartnerManageController.java | 2 +- .../system/core/ClientContractService.java | 2 +- .../core/impl/ClientContractServiceImpl.java | 8 ++--- 6 files changed, 12 insertions(+), 39 deletions(-) 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 8b946e3b1..dfc439376 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 @@ -1339,36 +1339,8 @@ public class RetailAppServiceImp implements RetailAppService { @Override public JSONObject getCheckClientInfo(JSONObject device) { - JSONObject result = clientContractService.getClientContractExpire(device.getIntValue("client_id")); - JSONObject config = sysConfigManager.getSysConfig(); - boolean expire = result.getBoolean("rate_expire"); - boolean waring = result.getBoolean("rate_waring"); - if (PartnerRole.getRole(device.getIntValue("role")) == PartnerRole.CASHIER) { - result.put("is_ordinary", true); - if (!expire && waring) { - String[] key = { result.getString("expire_days") }; - result.put("contract_info", editContractOrdinaryWaring(key, config.getString("sys_contract_ordinary_waring"))); - } - if (expire) { - result.put("contract_info", config.getString("sys_contract_ordinary_info")); - } - return result; - } else { - result.put("contract_info", config.getString("sys_contract_info")); - result.put("is_ordinary", false); - if (!expire && waring) { - String[] key = { result.getString("expire_days") }; - result.put("contract_info", editContractOrdinaryWaring(key, config.getString("sys_contract_waring"))); - } - if (expire) { - result.put("contract_info", config.getString("sys_contract_info")); - } - JSONObject file = clientContractService.getOrGenerateSourceAgreement(device.getIntValue("client_id")); - result.put("file_url", file.getString("file_value")); - return result; - } + clientManager.getCheckClientInfo(device.getIntValue("client_id"), device.getString("account_id")); } - private static boolean mathchLetterorNum(String str) { String regex = "[A-Za-z0-9]{8}"; return str.matches(regex); 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 41947c5ec..41a9240aa 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 @@ -284,5 +284,5 @@ public interface ClientManager { void clearCacheSubMerchantIdApplices(String clientMoniker); - JSONObject getCheckClientInfo(JSONObject account); + JSONObject getCheckClientInfo(int client_id,String account_id); } 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 887f2150f..4623b9302 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 @@ -3115,9 +3115,10 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } @Override - public JSONObject getCheckClientInfo(JSONObject account) { - JSONObject result = clientContractService.getClientContractExpire(account.getIntValue("client_id")); + public JSONObject getCheckClientInfo(int client_id,String account_id) { + JSONObject result = clientContractService.getClientContractExpire(client_id); JSONObject config = sysConfigManager.getSysConfig(); + JSONObject account = clientAccountMapper.findById(account_id); boolean expire = result.getBoolean("rate_expire"); boolean waring = result.getBoolean("rate_waring"); if (PartnerRole.getRole(account.getIntValue("role")) == PartnerRole.CASHIER) { @@ -3140,7 +3141,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid if (expire) { result.put("contract_info", config.getString("sys_contract_info")); } - JSONObject file = clientContractService.getOrGenerateSourceAgreement(account.getIntValue("client_id")); + JSONObject file = clientContractService.getOrGenerateSourceAgreement(account.getIntValue("client_id"),"pc"); result.put("file_url", file.getString("file_value")); return result; } 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 379016e93..105b0aa42 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 @@ -527,7 +527,7 @@ public class PartnerManageController { @PartnerMapping(value = "/check", method = RequestMethod.GET) public JSONObject getCheckClientInfo(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject account) { - return clientManager.getCheckClientInfo(account); + return clientManager.getCheckClientInfo(account.getIntValue("client_id"),account.getString("account_id")); } @PartnerMapping(value = "/agree/confirm", method = RequestMethod.POST) diff --git a/src/main/java/au/com/royalpay/payment/manage/system/core/ClientContractService.java b/src/main/java/au/com/royalpay/payment/manage/system/core/ClientContractService.java index 3b7804ee1..83989dd62 100644 --- a/src/main/java/au/com/royalpay/payment/manage/system/core/ClientContractService.java +++ b/src/main/java/au/com/royalpay/payment/manage/system/core/ClientContractService.java @@ -4,7 +4,7 @@ import com.alibaba.fastjson.JSONObject; public interface ClientContractService { - JSONObject getOrGenerateSourceAgreement(int client_id); + JSONObject getOrGenerateSourceAgreement(int client_id,String channel); void confirmSourceAgreement(int client_id,String account_id); diff --git a/src/main/java/au/com/royalpay/payment/manage/system/core/impl/ClientContractServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/system/core/impl/ClientContractServiceImpl.java index 6bad0c751..400f5d8c1 100644 --- a/src/main/java/au/com/royalpay/payment/manage/system/core/impl/ClientContractServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/system/core/impl/ClientContractServiceImpl.java @@ -44,7 +44,7 @@ public class ClientContractServiceImpl implements ClientContractService { @Override @Transactional - public JSONObject getOrGenerateSourceAgreement(int client_id) { + public JSONObject getOrGenerateSourceAgreement(int client_id,String channel) { JSONObject client = clientManager.getClientInfo(client_id); if (client == null) { throw new NotFoundException("merchant not found"); @@ -60,7 +60,7 @@ public class ClientContractServiceImpl implements ClientContractService { throw new ServerErrorException("System error"); } List files = clientFilesMapper.findFileByClientAndType(client_id, "source_agree_file"); - saveContract(client_id, now); + saveContract(client_id, now,channel); return files.get(0); } else { List files = clientFilesMapper.findFileByClientAndType(client_id, "source_agree_file"); @@ -75,11 +75,11 @@ public class ClientContractServiceImpl implements ClientContractService { } - private void saveContract(int client_id, Date now) { + private void saveContract(int client_id, Date now,String channel) { JSONObject newContract = new JSONObject(); newContract.put("create_time", now); newContract.put("expiry_date", DateUtils.addYears(now, 1)); - newContract.put("sign_channel", "App"); + newContract.put("sign_channel", channel); newContract.put("client_id", client_id); newContract.put("has_sign", false); clientsContractMapper.save(newContract);