master
yuan 6 years ago
parent 69bd35bb1b
commit 440cacb194

@ -130,7 +130,7 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT
}
private JSONObject getYesOrLasMonth(JSONObject params){
JSONObject res = new JSONObject();
res.put("traded_partners", clientCustomersMapper.countTradedClients(params));
res.put("traded_partners", customerAndOrdersStatisticsMapper.countTradedClients(params));
res.put("total_customers", clientCustomersMapper.countTotalCustomers(params));
res.put("old_customers", clientCustomersMapper.countTotalOldCustomers(params));
return res;

@ -55,4 +55,6 @@ public interface CustomerAndOrdersStatisticsMapper {
List<JSONObject> countTradedClientsByDate(JSONObject parasm);
List<JSONObject> getAreaMerchantTradeByLastCycle(JSONObject parasm);
int countTradedClients(JSONObject params);
}

@ -456,4 +456,36 @@
</where>
GROUP BY datelist ORDER BY datelist
</select>
<select id="countTradedClients" resultType="java.lang.Integer">
SELECT COUNT(DISTINCT s.client_id) traded_partners
FROM statistics_customer_order s
LEFT JOIN sys_clients c ON c.client_id = s.client_id and c.is_valid=1
<where>
s.client_id != 0
<if test="begin!=null">and s.date &gt;= #{begin}</if>
<if test="end!=null">and s.date &lt; #{end}</if>
<if test="client_ids!=null">
AND s.client_id IN
<foreach collection="client_ids" open="(" close=")" separator="," item="client_id">
#{client_id}
</foreach>
</if>
<if test="client_ids==null and client_id != null">
and s.client_id=#{client_id}
</if>
<if test="channel!=null">and s.channel = #{channel}</if>
<if test="org_id!=null and org_ids==null">and c.org_id=#{org_id}</if>
<if test="org_ids!=null">and c.org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if>
<if test="bd_group!=null">and c.client_id in
(SELECT b.client_id FROM sys_client_bd b
INNER JOIN financial_bd_config c ON c.manager_id=b.bd_id
where b.is_valid=1 and b.start_date&lt;=now() and (b.end_date is null or b.end_date &gt;= now())
AND (c.bd_group=#{bd_group} or c.manager_id=#{bd_group})
<if test="bd_group_bd">and c.manager_id=#{bd_group_bd}</if>
)
</if>
</where>
</select>
</mapper>
Loading…
Cancel
Save