From 206106caac981163ad7d79f06cf0a76dc85d27bd Mon Sep 17 00:00:00 2001 From: wangning <164851225@qq.com> Date: Wed, 7 Mar 2018 19:14:36 +0800 Subject: [PATCH] update --- .../appclient/web/RetailAppController.java | 18 +++++++++--------- .../apps/core/impls/AppFileServiceImpl.java | 11 ++++++++++- 2 files changed, 19 insertions(+), 10 deletions(-) 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 34c73b63c..bbb7700ee 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 @@ -14,6 +14,7 @@ import au.com.royalpay.payment.manage.signin.beans.ChangePwdBean; import au.com.royalpay.payment.manage.signin.core.SignInStatusManager; import au.com.royalpay.payment.tools.CommonConsts; import au.com.royalpay.payment.tools.device.advise.AppClientController; +import au.com.royalpay.payment.tools.env.SysConfigManager; import au.com.royalpay.payment.tools.exceptions.ForbiddenException; import au.com.royalpay.payment.tools.http.HttpUtils; @@ -51,6 +52,8 @@ public class RetailAppController { private BillService billService; @Resource private AppFileService appFileService; + @Resource + private SysConfigManager sysConfigManager; @RequestMapping(value = "/token", method = RequestMethod.PUT) public void updateDevToken(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device, @RequestBody JSONObject token) { @@ -194,9 +197,14 @@ public class RetailAppController { public JSONObject getClientInfo(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) { return retailAppService.getClientInfo(device); } + @RequestMapping(value = "/client/check", method = RequestMethod.GET) public JSONObject getCheckClientInfo(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) { - return retailAppService.getClientRateExpire(device.getIntValue("client_id")); + JSONObject result = retailAppService.getClientRateExpire(device.getIntValue("client_id")); + JSONObject file = appFileService.getOrGenerateSourceAgreement(device.getIntValue("client_id")); + result.put("file_url", file.getString("file_value")); + result.put("contract_info",sysConfigManager.getSysConfig().getString("contract_info")); + return result; } @RequestMapping(value = "/client", method = RequestMethod.PUT) @@ -331,14 +339,6 @@ public class RetailAppController { return result; } - @RequestMapping(value = "/file/agree", method = RequestMethod.PUT) - public JSONObject generateSourceAgreeFile(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) { - JSONObject file = appFileService.getOrGenerateSourceAgreement(device.getIntValue("client_id")); - JSONObject result = new JSONObject(); - result.put("file_value",file.getString("file_value")); - return result; - } - @RequestMapping(value = "/file/agree/confirm", method = RequestMethod.POST) public void confirmSourceAgreeFile(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) { appFileService.confirmSourceAgreement(device.getIntValue("client_id")); diff --git a/src/main/java/au/com/royalpay/payment/manage/apps/core/impls/AppFileServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/apps/core/impls/AppFileServiceImpl.java index b893f6b72..81cceb7f4 100644 --- a/src/main/java/au/com/royalpay/payment/manage/apps/core/impls/AppFileServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/apps/core/impls/AppFileServiceImpl.java @@ -1,5 +1,6 @@ package au.com.royalpay.payment.manage.apps.core.impls; +import au.com.royalpay.payment.manage.appclient.core.RetailAppService; import au.com.royalpay.payment.manage.apps.core.AppFileService; import au.com.royalpay.payment.manage.mappers.system.ClientFilesMapper; import au.com.royalpay.payment.manage.mappers.system.ClientsContractMapper; @@ -29,6 +30,8 @@ public class AppFileServiceImpl implements AppFileService { private ClientManager clientManager; @Resource private ClientsContractMapper clientsContractMapper; + @Resource + private RetailAppService retailAppService; @Override @Transactional @@ -47,7 +50,13 @@ public class AppFileServiceImpl implements AppFileService { saveContract(client_id, now); return files.get(0); } else { - return files.get(0); + JSONObject expireInfo = retailAppService.getClientRateExpire(client_id); + JSONObject file = files.get(0); + if(expireInfo.getBoolean("rate_expire")){ + file.put("last_update_date",now); + } + clientFilesMapper.update(file); + return file; } }