From b237c9072c3e0c962aa75795e4094d6251d76d50 Mon Sep 17 00:00:00 2001 From: "eason.qian" Date: Wed, 3 Jan 2018 18:27:40 +0800 Subject: [PATCH] fix newCustomers --- .../manage/analysis/core/impls/DashboardServiceImpl.java | 7 ++++++- .../manage/analysis/mappers/TransactionAnalysisMapper.java | 2 ++ .../manage/analysis/mappers/TransactionAnalysisMapper.xml | 6 ++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/DashboardServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/DashboardServiceImpl.java index 6b65c4dc0..34e102afd 100644 --- a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/DashboardServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/DashboardServiceImpl.java @@ -401,7 +401,12 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT throw new ParamInvalidException("date", "error.payment.valid.invalid_date_format"); } params.put("channel",record.getString("channel")); - int newCustomers = transactionAnalysisMapper.countNewCustomers(params); + int newCustomers = 0; + if (client.getIntValue("client_id")==0){ + newCustomers = transactionAnalysisMapper.getCountCustomers(params.getDate("end")) - transactionAnalysisMapper.getCountCustomers(params.getDate("begin")); + }else { + newCustomers = transactionAnalysisMapper.countNewCustomers(params); + } int oldCustomers = transactionAnalysisMapper.countOldCustomers(params); record.put("new_customers",newCustomers); record.put("old_customers",oldCustomers); diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/mappers/TransactionAnalysisMapper.java b/src/main/java/au/com/royalpay/payment/manage/analysis/mappers/TransactionAnalysisMapper.java index 7b959d673..3e83dc242 100644 --- a/src/main/java/au/com/royalpay/payment/manage/analysis/mappers/TransactionAnalysisMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/analysis/mappers/TransactionAnalysisMapper.java @@ -69,4 +69,6 @@ public interface TransactionAnalysisMapper { BigDecimal getOneOrder(@Param("order_id") String order_id); + int getCountCustomers(@Param("date") Date date); + } diff --git a/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/TransactionAnalysisMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/TransactionAnalysisMapper.xml index 3469b71ad..4a3f597ef 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/TransactionAnalysisMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/TransactionAnalysisMapper.xml @@ -389,6 +389,12 @@ ]]> +