james.zhao 6 years ago
parent 18bfb7e593
commit e1c14d3404

@ -128,8 +128,8 @@ public class DailyReportImp implements DailyReport {
kpi.put("kpi_percent", p.getBigDecimal("month_amount").divide(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 ){ for(JSONObject clientAmount :clientsAmount ){
if(clientAmount.getString("bd_group").equals(kpi.getString("bd_group"))){ if(clientAmount.getString("bd_group").equals(kpi.getString("bd_group"))){
kpi.put("clients_month",clientAmount.getIntValue("clients_month")); kpi.put("clients_month",clientAmount.getBigDecimal("clients_month"));
kpi.put("clients_yesterday",clientAmount.getIntValue("clients_yesterday")); kpi.put("clients_yesterday",clientAmount.getBigDecimal("clients_yesterday"));
} }
} }
total_kpi_amount = total_kpi_amount.add(kpi_amount); total_kpi_amount = total_kpi_amount.add(kpi_amount);

@ -553,43 +553,89 @@
fbc.bd_name, fbc.bd_name,
fbc.bd_group, fbc.bd_group,
fbc.bd_type, fbc.bd_type,
count( * ) clients_month sum( a.proportion ) clients_month
FROM FROM
sys_clients sc sys_client_bd a
INNER JOIN sys_client_bd d ON sc.client_id = d.client_id INNER JOIN (
INNER JOIN financial_bd_config c ON d.bd_id = c.manager_id SELECT
INNER JOIN financial_bd_config fbc ON fbc.manager_id = c.bd_group bd_id,
max( create_time ) create_time
FROM
sys_client_bd
WHERE WHERE
sc.org_id = 1 client_id IN (
AND sc.create_time >= #{start_date_month} SELECT
AND d.is_valid = 1 client_id
AND c.bd_group IS NOT NULL FROM
AND d.start_date <= now( ) AND d.is_valid = 1 AND ( d.end_date IS NULL OR d.end_date > now( ) sys_clients c
WHERE
c.approve_time >= #{start_date_month}
AND c.approve_time <= #{end_date}
AND c.is_valid = 1
AND c.approve_result = 1
AND c.org_id = 1
)
AND start_date <= #{end_date} AND is_valid = 1 AND ( end_date > #{start_date_month}
OR end_date IS NULL
) )
GROUP BY GROUP BY
fbc.bd_type bd_id,
client_id
) b ON a.bd_id = b.bd_id
AND a.create_time = b.create_time
INNER JOIN financial_bd_config c ON a.bd_id = c.manager_id
INNER JOIN financial_bd_config fbc ON fbc.manager_id = c.bd_group
WHERE
a.is_valid = 1
GROUP BY
fbc.bd_group
ORDER BY
clients_month DESC
) t1 ) t1
LEFT JOIN ( LEFT JOIN (
SELECT SELECT
count( * ) clients_yesterday, fbc.bd_name,
fbc.bd_group fbc.bd_group,
fbc.bd_type,
sum( a.proportion ) clients_yesterday
FROM FROM
sys_clients sc sys_client_bd a
INNER JOIN sys_client_bd d ON sc.client_id = d.client_id INNER JOIN (
INNER JOIN financial_bd_config c ON d.bd_id = c.manager_id SELECT
INNER JOIN financial_bd_config fbc ON fbc.manager_id = c.bd_group bd_id,
max( create_time ) create_time
FROM
sys_client_bd
WHERE
client_id IN (
SELECT
client_id
FROM
sys_clients c
WHERE WHERE
sc.org_id = 1 c.approve_time >= #{start_date}
AND sc.create_time >= #{start_date} AND c.approve_time < #{end_date}
AND sc.create_time < #{end_date} AND c.is_valid = 1
AND d.is_valid = 1 AND c.approve_result = 1
AND d.start_date <= now( ) AND d.is_valid = 1 AND ( d.end_date IS NULL OR d.end_date > now( ) AND c.org_id = 1
)
AND start_date <= #{end_date} AND is_valid = 1 AND ( end_date > #{start_date}
OR end_date IS NULL
) )
GROUP BY GROUP BY
fbc.bd_type bd_id,
) t2 ON t1.bd_group = t2.bd_group client_id
) b ON a.bd_id = b.bd_id
AND a.create_time = b.create_time
INNER JOIN financial_bd_config c ON a.bd_id = c.manager_id
INNER JOIN financial_bd_config fbc ON fbc.manager_id = c.bd_group
WHERE WHERE
t1.bd_type IN ( 1, 2, 6, 7 ) a.is_valid = 1
GROUP BY
fbc.bd_group
ORDER BY
clients_yesterday DESC
) t2 ON t1.bd_group = t2.bd_group
</select> </select>
<select id="clientPayTypeInfoByClientIdRange" resultType="com.alibaba.fastjson.JSONObject"> <select id="clientPayTypeInfoByClientIdRange" resultType="com.alibaba.fastjson.JSONObject">

Loading…
Cancel
Save