From 1c538488b9a4c26fb6ea10c285e07c72c893e8ce Mon Sep 17 00:00:00 2001 From: yixian Date: Thu, 1 Mar 2018 14:25:45 +0800 Subject: [PATCH] retail query daily transactions can choose dev only transactions --- .../appclient/core/RetailAppService.java | 2 +- .../core/impls/RetailAppServiceImp.java | 4 ++-- .../appclient/web/RetailAppController.java | 18 ++++++++++-------- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/core/RetailAppService.java b/src/main/java/au/com/royalpay/payment/manage/appclient/core/RetailAppService.java index 9c0ec74d3..ac99a87ba 100644 --- a/src/main/java/au/com/royalpay/payment/manage/appclient/core/RetailAppService.java +++ b/src/main/java/au/com/royalpay/payment/manage/appclient/core/RetailAppService.java @@ -62,7 +62,7 @@ public interface RetailAppService { JSONObject getClientCurrentRateNew(JSONObject device); - JSONObject listDailyTransactions(String dateStr, String timezone, JSONObject device); + JSONObject listDailyTransactions(String dateStr, String timezone, boolean thisDevOnly, JSONObject device); JSONObject getActivities(JSONObject device, String activity_page, int page, int limit); 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 c55d4b6a7..1c7edd376 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 @@ -952,7 +952,7 @@ public class RetailAppServiceImp implements RetailAppService { } @Override - public JSONObject listDailyTransactions(String dateStr, String timezone, JSONObject device) { + public JSONObject listDailyTransactions(String dateStr, String timezone, boolean thisDevOnly, JSONObject device) { try { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd"); dateFormat.setTimeZone(TimeZone.getTimeZone(timezone)); @@ -960,7 +960,7 @@ public class RetailAppServiceImp implements RetailAppService { String clientType = device.getString("client_type"); DeviceRegister register = deviceSupport.findRegister(clientType); String devId = null; - if (register.includeDevId()) { + if (register.includeDevId() || thisDevOnly) { devId = device.getString("dev_id"); } Date to = DateUtils.addDays(date, 1); 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 c5c985f3c..368ed4069 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 @@ -116,7 +116,7 @@ public class RetailAppController { @RequestMapping(value = "/notice/{noticeId}", method = RequestMethod.PUT) public void updateNoticePartnerHasRead(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device, @PathVariable String noticeId, @RequestBody JSONObject account_param) { - if (!device.getString("account_id").equals(account_param.getString("account_id"))){ + if (!device.getString("account_id").equals(account_param.getString("account_id"))) { throw new ForbiddenException("You have no permission"); } retailAppService.updateReadStatus(device, noticeId); @@ -200,8 +200,9 @@ public class RetailAppController { @RequestMapping(value = "/daily_transactions/date/{dateStr}", method = RequestMethod.GET) public JSONObject listDailyTransactions(@PathVariable String dateStr, @RequestParam(defaultValue = "Australia/Melbourne") String timezone, + @RequestParam(defaultValue = "false") boolean thisdevice, @ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) { - return retailAppService.listDailyTransactions(dateStr, timezone, device); + return retailAppService.listDailyTransactions(dateStr, timezone, thisdevice, device); } @RequestMapping(value = "/modify/retail_surcharge", method = RequestMethod.PUT) @@ -250,11 +251,11 @@ public class RetailAppController { } @RequestMapping(value = "/cash_back/clean_info", method = RequestMethod.GET) - public JSONObject getCashbackCleanInfo(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device,@RequestParam(value = "client_id",required = false) String client_id) { - if (client_id==null){ - client_id=device.getString("client_id"); + public JSONObject getCashbackCleanInfo(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device, @RequestParam(value = "client_id", required = false) String client_id) { + if (client_id == null) { + client_id = device.getString("client_id"); } - return retailAppService.getCashbackCleanInfo(device,client_id); + return retailAppService.getCashbackCleanInfo(device, client_id); } @RequestMapping(value = "/partner_signin_app_qrcode/{codeId}", method = RequestMethod.GET) @@ -289,9 +290,10 @@ public class RetailAppController { public JSONObject getAd(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) { return retailAppService.getAd(device); } + @RequestMapping(value = "/ads/{article_id}", method = RequestMethod.GET) - public JSONObject getAdDetail(@PathVariable String article_id,@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) { - return retailAppService.getAdDetail(device,article_id); + public JSONObject getAdDetail(@PathVariable String article_id, @ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) { + return retailAppService.getAdDetail(device, article_id); }