From d4287e0bc0dc73582448a458d08348214138ffd2 Mon Sep 17 00:00:00 2001 From: wangning <164851225@qq.com> Date: Thu, 29 Mar 2018 09:25:24 +0800 Subject: [PATCH] update --- .../core/impl/ClientContractServiceImpl.java | 42 +++++++------------ 1 file changed, 15 insertions(+), 27 deletions(-) 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 9876a55d1..24b2838f0 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 @@ -54,7 +54,8 @@ public class ClientContractServiceImpl implements ClientContractService { JSONObject expireInfo = getClientContractExpire(client_id); JSONObject contract = clientsContractMapper.findByClientId(client_id); Date now = new Date(); - if ((expireInfo.getBoolean("rate_waring")||expireInfo.getBoolean("old_contract")) && (contract == null || now.compareTo(contract.getDate("expiry_date")) > 0)) { + if ((expireInfo.getBoolean("rate_waring") || expireInfo.getBoolean("old_contract")) + && (contract == null || now.compareTo(contract.getDate("expiry_date")) > 0)) { try { clientManager.getNewAggregateAgreeFile(client.getString("client_moniker"), null, true); } catch (Exception e) { @@ -118,30 +119,16 @@ public class ClientContractServiceImpl implements ClientContractService { contract.put("signatory", account.getString("display_name")); clientsContractMapper.update(contract); List rateInfo = clientRateMapper.minExpiryTime(client_id, null); - if (expire || old_contract) { - rateInfo.forEach((p) -> { - p.remove("client_rate_id"); - p.put("create_time", now); - p.put("active_time", now); - p.put("update_time", now); - p.put("manager_id", "0"); - p.put("expiry_time", DateUtils.addYears(now, 1)); - p.put("manager_name", "merchant_" + account_id + "_" + account.getString("display_name")); - clientRateMapper.saveRate(p); - }); - } - if (!expire && waring && !old_contract) { - rateInfo.forEach((p) -> { - p.remove("client_rate_id"); - p.put("create_time", now); - p.put("manager_id", "0"); - p.put("update_time", now); - p.put("manager_name", "merchant_" + account_id + "_" + account.getString("display_name")); - p.put("active_time", DateUtils.addDays(p.getDate("expiry_time"), 1)); - p.put("expiry_time", DateUtils.addYears(p.getDate("active_time"), 1)); - clientRateMapper.saveRate(p); - }); - } + rateInfo.forEach((p) -> { + p.remove("client_rate_id"); + p.put("create_time", now); + p.put("active_time", now); + p.put("update_time", now); + p.put("manager_id", "0"); + p.put("expiry_time", DateUtils.addYears(now, 1)); + p.put("manager_name", "merchant_" + account_id + "_" + account.getString("display_name")); + clientRateMapper.saveRate(p); + }); clientManager.setClientTaxInSurcharge(client.getString("client_moniker"), false); } @@ -213,14 +200,15 @@ public class ClientContractServiceImpl implements ClientContractService { result.put("rate_waring", true); } } - if(!result.getBoolean("rate_waring") && !result.getBoolean("rate_expire")){ + if (!result.getBoolean("rate_waring") && !result.getBoolean("rate_expire")) { List files = clientFilesMapper.findFileByClientAndType(client_id, "source_agree_file"); if (CollectionUtils.isEmpty(files)) { result.put("old_contract", true); result.put("rate_waring", true); } else { JSONObject file = files.get(0); - if (sysconfig.getDate("sys_new_contract_time").compareTo(file.getDate("last_update_date")) > 0 || (contract!=null && !contract.getBoolean("has_sign"))) { + if (sysconfig.getDate("sys_new_contract_time").compareTo(file.getDate("last_update_date")) > 0 + || (contract != null && !contract.getBoolean("has_sign"))) { result.put("old_contract", true); result.put("rate_waring", true); }