diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/web/PartnerCardDashboardController.java b/src/main/java/au/com/royalpay/payment/manage/analysis/web/PartnerCardDashboardController.java index bcb8a8f7a..49a9136a4 100644 --- a/src/main/java/au/com/royalpay/payment/manage/analysis/web/PartnerCardDashboardController.java +++ b/src/main/java/au/com/royalpay/payment/manage/analysis/web/PartnerCardDashboardController.java @@ -21,7 +21,7 @@ import java.util.List; * Created by yishuqian on 20/02/2017. */ @RestController -@ManagerMapping(role = {ManagerRole.ADMIN,ManagerRole.OPERATOR, ManagerRole.BD_USER,ManagerRole.DIRECTOR,ManagerRole.FINANCIAL_STAFF}, +@ManagerMapping(role = {ManagerRole.ADMIN, ManagerRole.OPERATOR, ManagerRole.BD_USER, ManagerRole.DIRECTOR, ManagerRole.FINANCIAL_STAFF}, value = "/analysis/partner_card", method = RequestMethod.GET) public class PartnerCardDashboardController { @@ -65,23 +65,18 @@ public class PartnerCardDashboardController { @RequestMapping("{client_moniker}/settlement_logs") public JSONObject getPartnerSettlementLog(@PathVariable String client_moniker, TradeLogQuery query, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { - return partnerCardDashboardService.getSettlementLog(client_moniker,query); + return partnerCardDashboardService.getSettlementLog(client_moniker, query); } @RequestMapping("{client_moniker}/login_logs") public JSONObject getPartnerLoginLog(@PathVariable String client_moniker, ClientLoginLogQueryBean query, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { - return clientLoginLogRepository.listClientLoginLogs(client_moniker,query.getPage(),query.getLimit()); + return clientLoginLogRepository.listClientLoginLogs(client_moniker, query.getPage(), query.getLimit()); } - @RequestMapping("/{client_id}/{clearing_data}") - public JSONObject listClearingTransactions(@PathVariable int client_id, @PathVariable String clearing_data){ - try { - return cleanService.getCleanLogTransactions(client_id, DateUtils.parseDate(clearing_data, new String[]{"yyyy-MM-dd"})); - }catch (ParseException e){ - throw new BadRequestException("error.payment.valid.invalid_date_format"); - } + @RequestMapping("/{client_id}/settlement_logs/{detailId}") + public JSONObject listClearingTransactions(@PathVariable int client_id, @PathVariable String detailId) { + return cleanService.getCleanLogTransactions(client_id, detailId); } - } 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 efeb6d09a..dd24c77db 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 @@ -444,8 +444,8 @@ public class RetailAppServiceImp implements RetailAppService { date_query.setClient_ids((String[]) params.get("client_ids")); } JSONObject date_params = date_query.toParams(query.getTimezone()); - date_params.put("begin",date_params.getDate("from")); - date_params.put("end",date_params.getDate("to")); + date_params.put("begin", date_params.getDate("from")); + date_params.put("end", date_params.getDate("to")); date_params.put("client_id", device.getIntValue("client_id")); JSONObject analysis = transactionAnalysisMapper.getClientTransaction(date_params); order.put("date_total", analysis); @@ -627,9 +627,12 @@ public class RetailAppServiceImp implements RetailAppService { @Override public void sendNoticeMessage(final NoticeInfo notice, final String[] client_monikers) { - sendingAppleMsgPool.execute(() -> { - for (String clientMoniker : client_monikers) { - JSONObject client = clientManager.getClientInfoByMoniker(clientMoniker); + for (String clientMoniker : client_monikers) { + JSONObject client = clientManager.getClientInfoByMoniker(clientMoniker); + if(client==null){ + continue; + } + sendingAppleMsgPool.execute(() -> { List tokens = clientDeviceTokenMapper.listAllTokensByClient_id(client.getIntValue("client_id")); if (tokens != null && tokens.size() > 0) { for (JSONObject devToken : tokens) { @@ -667,8 +670,8 @@ public class RetailAppServiceImp implements RetailAppService { } } } - } - }); + }); + } } @Override @@ -1032,15 +1035,12 @@ public class RetailAppServiceImp implements RetailAppService { Boolean isUpdate = PlatformEnvironment.getEnv().isAppUpdate(clientType); String updateContent = PlatformEnvironment.getEnv().getAppUpdateContent(clientType); int update_type = 0;// 0:不更新 1:更新 2:强制更新 - String[] versionArr = version.split("\\."); - String[] newVersionArr = newAppVersion.split("\\."); - for (int i = 0; i < newVersionArr.length; i++) { - if (Integer.valueOf(newVersionArr[i]) > Integer.valueOf(versionArr[i])) { - update_type = 1; - if (isUpdate) { - update_type = 2; - } - i = newVersionArr.length + 1; + String versionInt = version.replace(".",""); + String newAppVersionInt = newAppVersion.replace(".",""); + if (Integer.valueOf(versionInt) listSettledDatesInMonth(Date mon); - JSONObject listClearingTransactions(int client_id, Date date, JSONObject partner); + JSONObject listClearingTransactions(int client_id, String clearingDetailId, JSONObject partner); - void exportListClearingTransactions(int client_id, Date date, JSONObject partner, HttpServletResponse resp); + void exportListClearingTransactions(int client_id, String clearingDetailId, JSONObject partner, HttpServletResponse resp); List getSettlementMonthReport(int year, int monthOfYear); diff --git a/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/impl/CleanServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/impl/CleanServiceImpl.java index 23056f7e3..e9b33d0ab 100644 --- a/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/impl/CleanServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/impl/CleanServiceImpl.java @@ -238,8 +238,8 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider } @Override - public JSONObject getCleanLogTransactions(int clientId, Date date) { - return settlementSupport.listSettlementTransactionsForClient(clientId, date); + public JSONObject getCleanLogTransactions(int clientId, String clearingDetailId) { + return settlementSupport.listSettlementTransactionsForClient(clientId, clearingDetailId); } @Override @@ -596,17 +596,17 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider } @Override - public JSONObject listClearingTransactions(int client_id, Date date, JSONObject partner) { + public JSONObject listClearingTransactions(int client_id, String clearingDetailId, JSONObject partner) { JSONObject client = clientManager.getClientInfo(client_id); - Assert.notNull(client); + Assert.notNull(client, "Client not exists"); int parent_client_id = client.getIntValue("parent_client_id"); if (client_id != partner.getIntValue("client_id") && parent_client_id != partner.getIntValue("client_id")) { throw new ForbiddenException("No Permission"); } - JSONObject clearClient = clearingDetailMapper.listReport(date, client_id); + JSONObject clearClient = clearingDetailMapper.listReport(clearingDetailId, client_id); if (clearClient == null) { throw new NotFoundException(); } @@ -624,12 +624,13 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider } @Override - public void exportListClearingTransactions(int client_id, Date date, JSONObject partner, HttpServletResponse resp) { + public void exportListClearingTransactions(int client_id, String clearingDetailId, JSONObject partner, HttpServletResponse resp) { OutputStream ous = null; try { - JSONObject clearTransation = listClearingTransactions(client_id, date, partner); + JSONObject clearTransation = listClearingTransactions(client_id, clearingDetailId, partner); resp.setContentType("application/octet-stream;"); - resp.addHeader("Content-Disposition", "attachment; filename=" + "Merchant_Settlement_Info_" + DateFormatUtils.format(date, "yyyy-MM-dd") + ".xls"); + Date reportDate = clearTransation.getDate("report_date"); + resp.addHeader("Content-Disposition", "attachment; filename=" + "Merchant_Settlement_Info_" + DateFormatUtils.format(reportDate, "yyyy-MM-dd") + ".xls"); ous = resp.getOutputStream(); HSSFWorkbook wb = new HSSFWorkbook(); Cell cell = null; @@ -638,7 +639,7 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider font.setFontHeightInPoints((short) 10); CellStyle analysisStyle = wb.createCellStyle(); analysisStyle.setFont(font); - Sheet sheet = wb.createSheet("Merchant_Settlement_Info_" + DateFormatUtils.format(date, "yyyyMMdd")); + Sheet sheet = wb.createSheet("Merchant_Settlement_Info_" + DateFormatUtils.format(reportDate, "yyyyMMdd")); int rowNum = 0; Row row = sheet.createRow(rowNum); String[] title = {"order Id", "Client Order Id", "Transaction Time", "Channel", "Gateway", "Exchange Rate", "Transaction Type", "Currency", diff --git a/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/impl/SettleDelayConfigurerImpl.java b/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/impl/SettleDelayConfigurerImpl.java index 96b5e91c2..94b306c85 100644 --- a/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/impl/SettleDelayConfigurerImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/impl/SettleDelayConfigurerImpl.java @@ -226,7 +226,7 @@ public class SettleDelayConfigurerImpl implements SettleDelayConfigurer { continue; } String clientMoniker = client.getString("client_moniker"); - JSONObject clearing = clearingDetailMapper.listReport(date, clientId); + JSONObject clearing = clearingDetailMapper.listReportByDate(date, clientId); if (clearing == null) { continue; } diff --git a/src/main/java/au/com/royalpay/payment/manage/management/clearing/web/CleanLogClientController.java b/src/main/java/au/com/royalpay/payment/manage/management/clearing/web/CleanLogClientController.java index 3f5f5020e..712241f7b 100644 --- a/src/main/java/au/com/royalpay/payment/manage/management/clearing/web/CleanLogClientController.java +++ b/src/main/java/au/com/royalpay/payment/manage/management/clearing/web/CleanLogClientController.java @@ -15,7 +15,6 @@ import java.text.ParseException; import java.util.List; /** - * * Created by davep on 2016-08-29. */ @RestController @@ -27,30 +26,22 @@ public class CleanLogClientController { @RequestMapping public List listMonthCleanLogs(@RequestParam String month, @ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject client) { try { - return cleanService.listClientCleanLogsForMonth(DateUtils.parseDate(month, new String[] { "yyyyMM" }), client.getIntValue("client_id")); + return cleanService.listClientCleanLogsForMonth(DateUtils.parseDate(month, new String[]{"yyyyMM"}), client.getIntValue("client_id")); } catch (ParseException e) { throw new BadRequestException("error.payment.valid.invalid_date_format"); } } - @RequestMapping("/{client_id}/{clearing_data}") - public JSONObject listClearingTransactions(@PathVariable int client_id, @PathVariable String clearing_data, + @RequestMapping("/{client_id}/settlement_logs/{clearingDetailId}") + public JSONObject listClearingTransactions(@PathVariable int client_id, @PathVariable String clearingDetailId, @ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject partner) { - try { - return cleanService.listClearingTransactions(client_id, DateUtils.parseDate(clearing_data, new String[] { "yyyy-MM-dd" }), partner); - } catch (ParseException e) { - throw new BadRequestException("error.payment.valid.invalid_date_format"); - } + return cleanService.listClearingTransactions(client_id, clearingDetailId, partner); } - @PartnerMapping("/{client_id}/{clearing_data}/export") - public void exportListClearingTransactions(@PathVariable int client_id, @PathVariable String clearing_data, + @PartnerMapping("/{client_id}/settlement_logs/{clearingDetailId}/export") + public void exportListClearingTransactions(@PathVariable int client_id, @PathVariable String clearingDetailId, @ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject partner, HttpServletResponse resp) { - try { - cleanService.exportListClearingTransactions(client_id,DateUtils.parseDate(clearing_data, new String[] { "yyyy-MM-dd dd:mm:ss","yyyy-MM-dd" }), partner,resp); - } catch (ParseException e) { - throw new BadRequestException("error.payment.valid.invalid_date_format"); - } + cleanService.exportListClearingTransactions(client_id, clearingDetailId, partner, resp); } // @RequestMapping(value = "/{clearId}.json") diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/log/ClearingDetailMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/log/ClearingDetailMapper.java index bdd53577d..b4542d52c 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/log/ClearingDetailMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/log/ClearingDetailMapper.java @@ -34,7 +34,10 @@ public interface ClearingDetailMapper { PageList listReportsOfSettlementLogs(JSONObject params, PageBounds pagination); @AutoSql(type = SqlType.SELECT) - JSONObject listReport(@Param("report_date") Date report_date, @Param("client_id") int client_id); + JSONObject listReport(@Param("clear_detail_id") String clearDetailId, @Param("client_id") int client_id); + + @AutoSql(type = SqlType.SELECT) + JSONObject listReportByDate(@Param("report_date") Date date, @Param("client_id") int clientId); PageList listClientSettlementLog(JSONObject params, PageBounds pagination); } diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/bill/BillMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/bill/BillMapper.xml index 0911155ef..6870d79df 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/bill/BillMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/bill/BillMapper.xml @@ -5,7 +5,7 @@