Upd:管理端BD数据分析,手机端每日报表,变更查询新增商户逻辑为:统计BD下有效的新增商户,新转入商户

duLingLing 5 years ago
parent 05667b73b0
commit d30e9adeb1

@ -10,7 +10,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>manage</artifactId>
<version>1.2.28</version>
<version>1.2.29</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

@ -51,7 +51,7 @@ public class BDAnalysisServiceImpl implements BDAnalysisService {
}
private List<JSONObject> listSalesAnalysis(JSONObject jsonObject) {
List<JSONObject> listCountApproved = bdAnalysisMapper.countApproved(jsonObject);
List<JSONObject> listCountApproved = bdAnalysisMapper.queryBDNewMerchants(jsonObject);
List<JSONObject> bdSaleList = bdSalesReportMapper.getBDSaleList(jsonObject);
for (JSONObject countApproved : listCountApproved) {
for (JSONObject saleList : bdSaleList) {

@ -29,4 +29,7 @@ public interface BDAnalysisMapper {
//获取指定一天销售数据
List<JSONObject> getOneDayBDSaleList(JSONObject params);
//查询时间段范围BD新增商户
List<JSONObject> queryBDNewMerchants(JSONObject params);
}

@ -249,4 +249,27 @@
ORDER BY pay_amount DESC
</select>
<!--此处多分组一次t表是因为查询的结果会存在误操作的记录-->
<select id="queryBDNewMerchants" resultType="com.alibaba.fastjson.JSONObject">
SELECT t.bd_id,t.bd_name,count(t.client_id) num FROM (
SELECT bd_id,bd_name,client_id
FROM sys_client_bd
WHERE
is_valid = 1
AND create_time &gt;= #{begin}
AND create_time &lt; #{end}
AND client_id IN (
SELECT client_id FROM sys_clients
WHERE is_valid = 1
AND approve_result = 1
<if test="org_id != null">
AND org_id = #{org_id}
</if>
)
GROUP BY client_id,bd_id
) t
GROUP BY t.bd_id
ORDER BY num DESC
</select>
</mapper>

@ -675,24 +675,43 @@
</select>
<!--此处多分组一次t表是因为查询的结果会存在误操作的记录-->
<select id="findCountByBd" resultType="com.alibaba.fastjson.JSONObject">
SELECT *
FROM (
SELECT count(*) yesterday_count
FROM sys_clients
WHERE creator = #{bd_group}
AND create_time &gt;= #{yesterday}
AND create_time &lt; #{today}
AND is_valid = 1
) a,
(
SELECT count(*) month_count
FROM sys_clients
WHERE creator = #{bd_group}
AND create_time &gt;= #{month}
AND create_time &lt; #{today}
AND is_valid = 1
) b
SELECT count(client_id) yesterday_count
FROM (
SELECT bd.client_id
FROM sys_client_bd AS bd
WHERE
bd.is_valid = 1
AND bd.bd_id = #{bd_group}
AND bd.create_time &gt;= #{yesterday}
AND bd.create_time &lt; #{today}
AND bd.client_id IN (
SELECT client_id FROM sys_clients
WHERE is_valid = 1
AND approve_result = 1)
GROUP BY bd.client_id,bd_id
) t
) a,
(
SELECT count(client_id) yesterday_count
FROM (
SELECT bd.client_id
FROM sys_client_bd AS bd
WHERE
bd.is_valid = 1
AND bd.bd_id = #{bd_group}
AND bd.create_time &gt;= #{month}
AND bd.create_time &lt; #{today}
AND bd.client_id IN (
SELECT client_id FROM sys_clients
WHERE is_valid = 1
AND approve_result = 1)
GROUP BY bd.client_id,bd_id
) t
) b
</select>
<select id="findSamePhone" resultType="com.alibaba.fastjson.JSONObject">
@ -738,4 +757,6 @@
and client_id >= #{start}
and client_id &lt; #{end}
</select>
</mapper>

Loading…
Cancel
Save