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 5007dbe3c..90c432179 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 @@ -1129,10 +1129,11 @@ public class RetailAppServiceImp implements RetailAppService { int update_type = 0;// 0:不更新 1:更新 2:强制更新 String [] oldVersion = version.split("\\."); String [] newVersion = newAppVersion.split("\\."); - JSONObject res = new JSONObject(); - res.put("update_content", updateContent); + JSONObject res = null; for (int i = 0; i < newVersion.length; i++) { if(Integer.valueOf(newVersion[i])>Integer.valueOf(oldVersion[i])){ + res = new JSONObject(); + res.put("update_content", updateContent); update_type = 1; if (isUpdate) { update_type = 2; @@ -1141,7 +1142,6 @@ public class RetailAppServiceImp implements RetailAppService { return res; } } - res.put("update_type", update_type); return res; } @@ -1424,7 +1424,7 @@ public class RetailAppServiceImp implements RetailAppService { @Override public JSONObject getCheckClientInfo(JSONObject device) { - return clientManager.getCheckClientInfo(device.getIntValue("client_id"), device.getString("account_id")); + return clientManager.getCheckClientInfo(device.getIntValue("client_id"), device.getString("account_id"),"App"); } @Override diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/web/RetailAppController.java b/src/main/java/au/com/royalpay/payment/manage/appclient/web/RetailAppController.java index e7516ea92..037f89f45 100644 --- a/src/main/java/au/com/royalpay/payment/manage/appclient/web/RetailAppController.java +++ b/src/main/java/au/com/royalpay/payment/manage/appclient/web/RetailAppController.java @@ -223,11 +223,11 @@ public class RetailAppController { @RequestMapping(value = "/client/check", method = RequestMethod.GET) public JSONObject getCheckClientInfo(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) { - String version = device.getString("version"); - if("2.9.3".equals(version)){ - throw new BadRequestException("test"); - } - return retailAppService.getCheckClientInfo(device); + JSONObject defaultResult = new JSONObject(); + defaultResult.put("rate_expire", false); + defaultResult.put("rate_waring", false); + defaultResult.put("old_contract", false); + return defaultResult; } @RequestMapping(value = "/client/checkContract", method = RequestMethod.GET) 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 e11c4f1b6..711b267b1 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 @@ -283,5 +283,5 @@ public interface ClientManager { void clearCacheSubMerchantIdApplices(String clientMoniker); - JSONObject getCheckClientInfo(int client_id,String account_id); + JSONObject getCheckClientInfo(int client_id,String account_id, String channel); } 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 8c87c3b9d..55ca299de 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 @@ -2141,7 +2141,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid file.put("last_update_by", manager.getString("display_name")); } JSONObject contract = clientsContractMapper.findByClientId(client.getIntValue("client_id")); - if (contract == null || now.compareTo(contract.getDate("expiry_date")) > 0 || existFile == null || existFile.isEmpty()) { + if (contract == null || now.compareTo(contract.getDate("expiry_date")) > 0 ||!contract.getBoolean("has_sign")|| existFile == null || existFile.isEmpty()) { clientFilesMapper.save(file); } else { file.put("file_id", existFile.getString("file_id")); @@ -3239,13 +3239,15 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } @Override - public JSONObject getCheckClientInfo(int client_id, String account_id) { - JSONObject result = clientContractService.getClientContractExpire(client_id); + public JSONObject getCheckClientInfo(int client_id, String account_id, String channel) { + JSONObject result = null; + JSONObject expireInfo = clientContractService.getClientContractExpire(client_id,channel); JSONObject account = clientAccountMapper.findById(account_id); if (PartnerRole.getRole(account.getIntValue("role")) == PartnerRole.CASHIER) { - result.put("alert", false); + return result; } else { - if(result.getBoolean("alert")){ + if(expireInfo.getBoolean("alert")){ + result = new JSONObject(); result.put("content","Dear Valued Merchants,\n" + "\n" + "\n" + 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 5d084d848..591f99660 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 @@ -526,7 +526,7 @@ public class PartnerManageController { @PartnerMapping(value = "/check", method = RequestMethod.GET) public JSONObject getCheckClientInfo(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject account) { - return clientManager.getCheckClientInfo(account.getIntValue("client_id"),account.getString("account_id")); + return clientManager.getCheckClientInfo(account.getIntValue("client_id"),account.getString("account_id"),"PC"); } @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 2c9ae2f47..cf064e9b2 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 @@ -13,7 +13,7 @@ public interface ClientContractService { JSONObject getSourceAgreement(int client_id); - JSONObject getClientContractExpire(int client_id); + JSONObject getClientContractExpire(int client_id, String channel); void saveContract(int client_id, Date expire_date, String channel); 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 1b883f1b1..563120196 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 @@ -100,7 +100,7 @@ public class ClientContractServiceImpl implements ClientContractService { } @Override - public JSONObject getClientContractExpire(int client_id) { + public JSONObject getClientContractExpire(int client_id,String channel) { JSONObject client = clientManager.getClientInfo(client_id); if (client == null) { throw new NotFoundException("merchant not found please check ID"); @@ -117,7 +117,7 @@ public class ClientContractServiceImpl implements ClientContractService { if (sysconfig.getDate("sys_new_contract_time").compareTo(file.getDate("last_update_date")) > 0) { JSONObject contract = clientsContractMapper.findByClientId(client_id); if (contract == null) { - saveContract(client_id, new Date(), null); + saveContract(client_id, new Date(), channel); } } }