diff --git a/pom.xml b/pom.xml index 81b23401f..345236f4f 100644 --- a/pom.xml +++ b/pom.xml @@ -13,7 +13,7 @@ UTF-8 1.1.2 - 1.0.8 + 1.0.9 diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/DailyReportImp.java b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/DailyReportImp.java index cfd767040..823285900 100644 --- a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/DailyReportImp.java +++ b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/DailyReportImp.java @@ -2,6 +2,7 @@ package au.com.royalpay.payment.manage.analysis.core.impls; import au.com.royalpay.payment.manage.analysis.core.DailyReport; import au.com.royalpay.payment.manage.mappers.cashback.CashbackRecordsMapper; +import au.com.royalpay.payment.manage.mappers.financial.FinancialBDCommissionConfigMapper; import au.com.royalpay.payment.manage.mappers.financial.FinancialBDPrizeLogMapper; import au.com.royalpay.payment.manage.mappers.log.ClearingLogMapper; import au.com.royalpay.payment.manage.mappers.log.DailyReportMapper; @@ -22,7 +23,6 @@ import org.apache.commons.lang3.time.DateFormatUtils; import org.apache.commons.lang3.time.DateUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -54,6 +54,8 @@ public class DailyReportImp implements DailyReport { private MpWechatApiProvider mpWechatApiProvider; @Resource private FinancialBDPrizeLogMapper financialBDPrizeLogMapper; + @Resource + private FinancialBDCommissionConfigMapper financialBDCommissionConfigMapper; private Logger logger = LoggerFactory.getLogger(getClass()); @@ -98,8 +100,8 @@ public class DailyReportImp implements DailyReport { private JSONObject getKPI(Date dt){ JSONObject report = new JSONObject(); List kpiList =new ArrayList<>(); - List prizeAmountAndBdTypeList = financialBDPrizeLogMapper.findBdPrizeAmountMonth(DateUtils.truncate(DateUtils.addDays(dt,-1), Calendar.DATE),DateUtils.truncate(dt, Calendar.DATE),DateUtils.truncate(DateUtils.addDays(dt,-1), Calendar.MONTH)); - List prizeAmountAndBdTypeListYesterDay = financialBDPrizeLogMapper.findBdPrizeAmountMonth(DateUtils.truncate(DateUtils.addDays(dt,-2), Calendar.DATE),DateUtils.truncate(DateUtils.addDays(dt,-1), Calendar.DATE),DateUtils.truncate(DateUtils.addDays(dt,-2), Calendar.MONTH)); + List prizeAmountAndBdTypeList = financialBDPrizeLogMapper.findBdPrizeAmountMonth(DateUtils.truncate(dt, Calendar.DATE),DateUtils.truncate(DateUtils.addDays(dt,1), Calendar.DATE),DateUtils.truncate(dt, Calendar.MONTH)); + List prizeAmountAndBdTypeListYesterDay = financialBDPrizeLogMapper.findBdPrizeAmountMonth(DateUtils.truncate(DateUtils.addDays(dt,-1), Calendar.DATE),DateUtils.truncate(dt, Calendar.DATE),DateUtils.truncate(DateUtils.addDays(dt,-1), Calendar.MONTH)); List clientsAmount = clientMapper.createClientsByGroup(DateUtils.truncate(DateUtils.addDays(dt,-1), Calendar.DATE),DateUtils.truncate(dt, Calendar.DATE)); //BD团队总KPI BigDecimal total_kpi_amount = BigDecimal.ZERO; @@ -114,7 +116,8 @@ public class DailyReportImp implements DailyReport { kpi.put("total_amount",p.getBigDecimal("total_amount")); //当月数据 kpi.put("month_amount",p.getBigDecimal("month_amount")); - kpi.put("kpi_amount",p.getBigDecimal("kpi_amount")); + BigDecimal kpi_amount = financialBDCommissionConfigMapper.findCurrentCommissionMaxAmount(DateFormatUtils.format(DateUtils.truncate(dt,Calendar.MONTH),"yyyy-MM"), p.getIntValue("bd_type")); + kpi.put("kpi_amount",kpi_amount); for(JSONObject prize : prizeAmountAndBdTypeListYesterDay){ if(prize.getString("bd_group").equals(kpi.getString("bd_group"))){ BigDecimal compare = kpi.getBigDecimal("total_amount").subtract(prize.getBigDecimal("total_amount")); @@ -122,14 +125,14 @@ public class DailyReportImp implements DailyReport { kpi.put("compare_value",Math.abs(compare.doubleValue())); } } - kpi.put("kpi_percent", p.getBigDecimal("month_amount").divide(p.getBigDecimal("kpi_amount"),4,BigDecimal.ROUND_HALF_DOWN).multiply(BigDecimal.valueOf(100)).toString().substring(0,5)+"%"); + kpi.put("kpi_percent", p.getBigDecimal("month_amount").divide(kpi_amount,4,BigDecimal.ROUND_HALF_DOWN).multiply(BigDecimal.valueOf(100)).toString().substring(0,5)+"%"); for(JSONObject clientAmount :clientsAmount ){ if(clientAmount.getString("bd_group").equals(kpi.getString("bd_group"))){ kpi.put("clients_history",clientAmount.getIntValue("clients_history")); kpi.put("clients_yesterday",clientAmount.getIntValue("clients_yesterday")); } } - total_kpi_amount = total_kpi_amount.add(p.getBigDecimal("kpi_amount")); + total_kpi_amount = total_kpi_amount.add(kpi_amount); total_month_amount = total_month_amount.add(p.getBigDecimal("month_amount")); kpiList.add(kpi); }