diff --git a/pom.xml b/pom.xml index 978a1b3df..2963cc568 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ 4.0.0 manage - 1.4.13 + 1.4.14 UTF-8 1.8.0 diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/mappers/ClientAnalysisMapper.java b/src/main/java/au/com/royalpay/payment/manage/analysis/mappers/ClientAnalysisMapper.java index d2c05d82d..a806cdc69 100644 --- a/src/main/java/au/com/royalpay/payment/manage/analysis/mappers/ClientAnalysisMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/analysis/mappers/ClientAnalysisMapper.java @@ -27,6 +27,8 @@ public interface ClientAnalysisMapper { // 统计所有的商户,包括禁用的 int countClientsAll(JSONObject params); + int countValidClientsAll(@Param("industry") String industry); + // 统计一段时期新增的商户数 List listNewClients(JSONObject params); diff --git a/src/main/java/au/com/royalpay/payment/manage/dataAnalysis/core/DataAnalysisServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/dataAnalysis/core/DataAnalysisServiceImpl.java index bd1784484..bb30e94cf 100644 --- a/src/main/java/au/com/royalpay/payment/manage/dataAnalysis/core/DataAnalysisServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/dataAnalysis/core/DataAnalysisServiceImpl.java @@ -11,6 +11,8 @@ import org.apache.commons.lang3.time.DateUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.math.BigDecimal; +import java.math.RoundingMode; import java.text.ParseException; import java.util.Date; import java.util.List; @@ -70,7 +72,14 @@ public class DataAnalysisServiceImpl implements DataAnalysisService { @Override public List getRpIndustryEchartsData(String from, String to, String industry, String managerId) throws ParseException { Date modifyTo = DateUtils.addDays(DateUtils.parseDate(to, "yyyy-MM-dd"), 1); - return transactionAnalysisMapper.getRpIndustryEchartsData(from, DateFormatUtils.format(modifyTo, "yyyy-MM-dd HH:mm:ss"), industry, managerId); + List data = transactionAnalysisMapper.getRpIndustryEchartsData(from, DateFormatUtils.format(modifyTo, "yyyy-MM-dd HH:mm:ss"), industry, managerId); + BigDecimal totalClients = new BigDecimal(clientAnalysisMapper.countValidClientsAll(industry)); + for (JSONObject detail : data) { + BigDecimal industryClients = detail.getBigDecimal("industry_trans_clients"); + detail.put("total_client", totalClients.setScale(0, RoundingMode.DOWN)); + detail.put("in_total_pcent", industryClients.divide(totalClients, 4, RoundingMode.HALF_UP).multiply(new BigDecimal(100))); + } + return data; } @Override diff --git a/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/ClientAnalysisMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/ClientAnalysisMapper.xml index 5356906fb..7177f3d33 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/ClientAnalysisMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/ClientAnalysisMapper.xml @@ -53,6 +53,21 @@ #{org_id} + + + - + - \ No newline at end of file + 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 58d305856..068a5c177 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 @@ -1112,12 +1112,14 @@ sum(so.total) as total_amount, sum(so.orders) as orders, + count(Distinct IF((c.royalpayindustry =1 or c.royalpayindustry like '100%'), so.client_id,0)) as industry_trans_clients, SUM(IF((c.royalpayindustry =1 or c.royalpayindustry like '100%'),so.total,0)) as industry_total_amount, SUM(IF((c.royalpayindustry =1 or c.royalpayindustry like '100%'),so.orders,0)) as industry_orders, convert(SUM(IF((c.royalpayindustry =1 or c.royalpayindustry like '100%'),so.total,0))/sum( so.total )*100,decimal(15,2)) as amount_pcent, convert(SUM(IF((c.royalpayindustry =1 or c.royalpayindustry like '100%'),so.orders,0))/sum( so.orders )*100,decimal(15,2)) as order_pcent, + count(Distinct so.client_id) as industry_trans_clients, sum(so.total) as industry_total_amount, sum(so.orders) as industry_orders, 100 as amount_pcent, @@ -1125,6 +1127,7 @@ + count(Distinct IF(c.royalpayindustry like #{industry}, so.client_id,0)) as industry_trans_clients, SUM(IF(c.royalpayindustry like #{industry},so.total,0)) as industry_total_amount, SUM(IF(c.royalpayindustry like #{industry},so.orders,0)) as industry_orders, convert(SUM(IF(c.royalpayindustry like #{industry},so.total,0))/sum( so.total )*100,decimal(15,2)) as amount_pcent, @@ -1148,6 +1151,7 @@ order by trans_date asc +