Merge remote-tracking branch 'origin/develop' into develop

master
luoyang 6 years ago
commit e5717f0188

@ -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,9 +100,9 @@ public class DailyReportImp implements DailyReport {
private JSONObject getKPI(Date dt){
JSONObject report = new JSONObject();
List<JSONObject> kpiList =new ArrayList<>();
List<JSONObject> 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<JSONObject> 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<JSONObject> clientsAmount = clientMapper.createClientsByGroup(DateUtils.truncate(DateUtils.addDays(dt,-1), Calendar.DATE),DateUtils.truncate(dt, Calendar.DATE));
List<JSONObject> prizeAmountAndBdTypeList = financialBDPrizeLogMapper.findBdPrizeAmountMonth(DateUtils.truncate(dt, Calendar.DATE),DateUtils.truncate(DateUtils.addDays(dt,1), Calendar.DATE),DateUtils.truncate(dt, Calendar.MONTH));
List<JSONObject> 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<JSONObject> clientsAmount = clientMapper.createClientsByGroup(DateUtils.truncate(dt, Calendar.DATE),DateUtils.truncate(DateUtils.addDays(dt,1), Calendar.DATE),DateUtils.truncate(dt, Calendar.MONTH));
//BD团队总KPI
BigDecimal total_kpi_amount = BigDecimal.ZERO;
//BD团队当月总销售额
@ -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,20 +125,23 @@ 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_month",clientAmount.getIntValue("clients_month"));
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);
}
report.put("kpiList",kpiList);
report.put("kpi_percent_total",total_month_amount.divide(total_kpi_amount,4,BigDecimal.ROUND_HALF_DOWN).multiply(BigDecimal.valueOf(100)).toString().substring(0,5)+"%");
report.put("total_month_amount",total_month_amount);
Calendar calendar = Calendar.getInstance();
calendar.setTime(dt);
report.put("time_percent",BigDecimal.valueOf(calendar.get(Calendar.DAY_OF_MONTH)).divide(BigDecimal.valueOf(calendar.getActualMaximum(Calendar.DAY_OF_MONTH)),4,BigDecimal.ROUND_HALF_DOWN).multiply(BigDecimal.valueOf(100)).toString().substring(0,5)+"%");
return report;
}

@ -119,5 +119,5 @@ public interface ClientMapper {
@Select("select client_id from sys_clients where parent_client_id=#{parent_client_id}")
List<Integer> childClientId(@Param("parent_client_id") int parent_client_id);
List<JSONObject> createClientsByGroup(@Param("start_date") Date start_date,@Param("end_date") Date end_date);
List<JSONObject> createClientsByGroup(@Param("start_date") Date start_date,@Param("end_date") Date end_date,@Param("start_date_month") Date start_date_month);
}

@ -553,7 +553,7 @@
fbc.bd_name,
fbc.bd_group,
fbc.bd_type,
count( * ) clients_history
count( * ) clients_month
FROM
sys_clients sc
INNER JOIN sys_client_bd d ON sc.client_id = d.client_id
@ -561,7 +561,7 @@
INNER JOIN financial_bd_config fbc ON fbc.manager_id = c.bd_group
WHERE
sc.org_id = 1
AND sc.create_time &lt; #{start_date}
AND sc.create_time &gt;= #{start_date_month}
AND d.is_valid = 1
AND c.bd_group IS NOT NULL
AND d.start_date &lt;= now( ) AND d.is_valid = 1 AND ( d.end_date IS NULL OR d.end_date &gt; now( )

@ -145,6 +145,11 @@
<div class="weui-cell__ft weui-flex__item"
th:text="${report.kpi.kpi_percent_total}"></div>
</div>
<div class="weui-cell weui-flex">
<div class="weui-cell__hd weui-flex__item">时间进度</div>
<div class="weui-cell__ft weui-flex__item"
th:text="${report.kpi.time_percent}"></div>
</div>
<div class="weui-cell weui-flex"
th:each=" kpi : ${report.kpi.kpiList}">
<div class="weui-cell__hd weui-flex__item"
@ -183,7 +188,7 @@
</div>
<div class="weui-panel">
<div class="weui-panel__hd">昨日开户数(历史开户数)</div>
<div class="weui-panel__hd">昨日开户数(当月开户数)</div>
<div class="weui-panel__ft">
<div class="weui-media-box weui-media-box_small-appmsg">
<div class="weui-cells">
@ -192,7 +197,7 @@
<div class="weui-cell__hd weui-flex__item"
th:text="${kpi.group_name}"></div>
<div class="weui-cell__ft weui-flex__item"
th:text="${kpi.clients_yesterday}+'('+${kpi.clients_history}+')'"></div>
th:text="${kpi.clients_yesterday}+'('+${kpi.clients_month}+')'"></div>
</div>
</div>
</div>

Loading…
Cancel
Save