|
@@ -32,10 +32,8 @@
|
|
|
<if test="mediaId !=null and mediaId != ''">
|
|
|
AND media_id = #{mediaId}
|
|
|
</if>
|
|
|
-
|
|
|
</select>
|
|
|
|
|
|
-
|
|
|
<!-- 查询 头条 账户 图片-->
|
|
|
<select id="getAccountImagesBytedance" resultType="java.lang.String">
|
|
|
SELECT
|
|
@@ -47,10 +45,6 @@
|
|
|
AND upload_years = #{uploadYears}
|
|
|
</select>
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
<!-- 获取快手 账户 日流水信息 账户维度-->
|
|
|
<select id="getAccountTransactionDayKuaiShou" resultType="org.jeecg.ctop.finance.settlement.entity.vo.SettlementReportKuaiShouVo">
|
|
|
select t.*,c.auth_name as accountName,
|
|
@@ -70,9 +64,6 @@
|
|
|
where uploadYears = #{uploadYears}
|
|
|
</select>
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
<!-- 获取快手 账户 日流水信息 代理商维度-->
|
|
|
<select id="getAccountTransactionDayKuaiShouAgent" resultType="org.jeecg.ctop.finance.settlement.entity.vo.SettlementReportKuaiShouVo">
|
|
|
|
|
@@ -102,8 +93,6 @@
|
|
|
t.date
|
|
|
</select>
|
|
|
|
|
|
-
|
|
|
-
|
|
|
<!-- 获取快手 账户 日流水信息 代理商 和 账户 维度-->
|
|
|
<select id="getTransactionDayKuaiShouAgentAndAccount" resultType="org.jeecg.ctop.finance.settlement.entity.vo.SettlementReportKuaiShouVo">
|
|
|
SELECT
|
|
@@ -168,56 +157,8 @@
|
|
|
|
|
|
</select>
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
<!-- 查询 头条利润表 所用账户-->
|
|
|
<select id="getProfitBytedanceAccountCost" resultType="java.util.LinkedHashMap">
|
|
|
- <!-- SELECT
|
|
|
- d.advertiser_id AS accountId,
|
|
|
- SUM( d.cost ) AS cost,
|
|
|
- SUM( d.cash_cost ) AS cashCost,
|
|
|
- SUM( d.reward_cost ) rewardCost,
|
|
|
- pd.id as productId,
|
|
|
- pd.product_name AS productName
|
|
|
- FROM
|
|
|
- ctop_account_transaction_day d
|
|
|
- LEFT JOIN ctop_user_allocation u ON d.advertiser_id = u.account_id
|
|
|
- LEFT JOIN ctop_project p ON u.project_id = p.id
|
|
|
- LEFT JOIN ctop_product pd on pd.id = p.product_id
|
|
|
- where (u.media_id = 1 or u.media_id = 3)
|
|
|
- <if test="accountId !=null and accountId != ''">
|
|
|
- AND d.advertiser_id = #{accountId}
|
|
|
- </if>
|
|
|
- <if test="startTime !=null and startTime != ''">
|
|
|
- AND d.date >= #{startTime}
|
|
|
- </if>
|
|
|
- <if test="endTime !=null and endTime != ''">
|
|
|
- AND d.date <= #{endTime}
|
|
|
- </if>
|
|
|
- GROUP BY
|
|
|
- d.advertiser_id;
|
|
|
--->
|
|
|
-<!--
|
|
|
-
|
|
|
- SELECT
|
|
|
- d.advertiser_id AS accountId,
|
|
|
- SUM( d.cost ) AS cost,
|
|
|
- SUM( d.cash_cost ) AS cashCost,
|
|
|
- SUM( d.reward_cost ) rewardCost,
|
|
|
- p.id AS productId,
|
|
|
- p.product_name AS productName
|
|
|
- FROM
|
|
|
- ctop_account_transaction_day d,
|
|
|
- ctop_cwjs_settlement_info c,
|
|
|
- ctop_product p
|
|
|
- WHERE
|
|
|
- d.advertiser_id = c.account_id
|
|
|
- AND c.product_id = p.id
|
|
|
-
|
|
|
--->
|
|
|
-
|
|
|
SELECT
|
|
|
d.advertiser_id as accountId,
|
|
|
SUM( d.cost ) AS cost,
|
|
@@ -248,33 +189,8 @@
|
|
|
|
|
|
</select>
|
|
|
|
|
|
-
|
|
|
<!-- 查询 头条利润表 总花费-->
|
|
|
<select id="getProfitBytedanceCost" resultType="java.util.LinkedHashMap">
|
|
|
- <!-- SELECT
|
|
|
- d.advertiser_id AS accountId,
|
|
|
- SUM( d.cost ) AS cost,
|
|
|
- SUM( d.cash_cost ) AS cashCost,
|
|
|
- SUM( d.reward_cost ) rewardCost,
|
|
|
- pd.id as productId,
|
|
|
- pd.product_name AS productName
|
|
|
- FROM
|
|
|
- ctop_account_transaction_day d
|
|
|
- LEFT JOIN ctop_user_allocation u ON d.advertiser_id = u.account_id
|
|
|
- LEFT JOIN ctop_project p ON u.project_id = p.id
|
|
|
- LEFT JOIN ctop_product pd on pd.id = p.product_id
|
|
|
- where (u.media_id = 1 or u.media_id = 3)
|
|
|
- <if test="accountId !=null and accountId != ''">
|
|
|
- AND d.advertiser_id = #{accountId}
|
|
|
- </if>
|
|
|
- <if test="startTime !=null and startTime != ''">
|
|
|
- AND d.date >= #{startTime}
|
|
|
- </if>
|
|
|
- <if test="endTime !=null and endTime != ''">
|
|
|
- AND d.date <= #{endTime}
|
|
|
- </if>
|
|
|
--->
|
|
|
-
|
|
|
SELECT
|
|
|
d.advertiser_id AS accountId,
|
|
|
SUM( d.cost ) AS cost,
|
|
@@ -298,38 +214,6 @@
|
|
|
|
|
|
<!-- 查询 头条利润表 返点类型和比列-->
|
|
|
<select id="getProfitBytedance" resultType="java.util.LinkedHashMap">
|
|
|
-<!--
|
|
|
-
|
|
|
- SELECT
|
|
|
- pp.create_user_id,
|
|
|
- cp.rebate_type AS rebateType,
|
|
|
- cp.rebate_rate AS rebateRate,
|
|
|
- cp.approved_status AS approvedStatus,
|
|
|
- cp.policy_start_date as policyStartDate,
|
|
|
- cp.policy_end_date as policyEndDate,
|
|
|
- cp.create_time as createTime
|
|
|
- FROM
|
|
|
- ctop_cwjs_policy_product pp
|
|
|
- LEFT JOIN ctop_cwjs_policy_info cp ON cp.id = pp.policy_id
|
|
|
- WHERE
|
|
|
- pp.del_flag = 0
|
|
|
- AND cp.del_flag = 0
|
|
|
- and cp.approved_status = 3
|
|
|
- <if test="mediaType !=null and mediaType != ''">
|
|
|
- AND cp.media_type = #{mediaType}
|
|
|
- </if>
|
|
|
- <if test="productName !=null and productName != ''">
|
|
|
- AND pp.policy_product_name = #{productName}
|
|
|
- </if>
|
|
|
- <if test="startTime !=null and startTime != ''">
|
|
|
- AND (cp.policy_start_date >= #{startTime} or cp.policy_start_date <= #{endTime})
|
|
|
- </if>
|
|
|
- <if test="endTime !=null and endTime != ''">
|
|
|
- AND (cp.policy_end_date >= #{startTime} or cp.policy_end_date <= #{endTime})
|
|
|
- </if>
|
|
|
-
|
|
|
--->
|
|
|
-
|
|
|
SELECT t.* from (
|
|
|
SELECT
|
|
|
cp.rebate_type AS rebateType,
|
|
@@ -358,9 +242,6 @@
|
|
|
</if>
|
|
|
GROUP BY r.policy_id
|
|
|
) t
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
</select>
|
|
|
|
|
|
|
|
@@ -387,16 +268,10 @@
|
|
|
GROUP BY
|
|
|
p.id
|
|
|
limit 1
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
</select>
|
|
|
|
|
|
-
|
|
|
<!-- 查询 头条利润表 销售人员姓名 -->
|
|
|
<select id="getProfitBytedanceSale" resultType="java.util.LinkedHashMap">
|
|
|
-
|
|
|
SELECT f.create_user_id,u.realname as saleName
|
|
|
from ctop_cwjs_settlement_info f
|
|
|
LEFT JOIN sys_user u on u.id = f.create_user_id
|
|
@@ -405,29 +280,10 @@
|
|
|
AND f.account_id = #{accountId}
|
|
|
</if>
|
|
|
limit 1
|
|
|
-
|
|
|
-
|
|
|
</select>
|
|
|
|
|
|
-
|
|
|
-
|
|
|
<!-- 查询 头条利润表 广告主和运营和运营所属区域-->
|
|
|
<select id="getProfitBytedanceOperate" resultType="java.util.LinkedHashMap">
|
|
|
- <!--select
|
|
|
- u.advertiser_id,
|
|
|
- u.advertiser_name as advertiserName,
|
|
|
- u.user_id,
|
|
|
- u.user_name as operateName,
|
|
|
- u.auth_name,
|
|
|
- IFNULL(p.nick_name,'') as operateArea
|
|
|
- from
|
|
|
- ctop_user_allocation u
|
|
|
- LEFT JOIN user_company p on p.user_id = u.user_id
|
|
|
- <where>
|
|
|
- <if test="accountId !=null and accountId != ''">
|
|
|
- AND u.account_id = #{accountId}
|
|
|
- </if>
|
|
|
- </where>-->
|
|
|
SELECT
|
|
|
c.create_user_id AS operateUserId,
|
|
|
p.user_name AS operateName,
|
|
@@ -442,63 +298,10 @@
|
|
|
AND c.account_id = #{accountId}
|
|
|
</if>
|
|
|
limit 1
|
|
|
-
|
|
|
</select>
|
|
|
|
|
|
-
|
|
|
-<!-- 查询 快手 利润表 总花费-->
|
|
|
+ <!-- 查询 快手 利润表 总花费-->
|
|
|
<select id="getProfitKuaiShouAccountCost" resultType="java.util.LinkedHashMap">
|
|
|
- <!--SELECT
|
|
|
- d.account_id AS accountId,
|
|
|
- SUM( d.daily_charge ) AS cost,
|
|
|
- SUM( d.real_charged ) AS cashCost,
|
|
|
- pd.id as productId,
|
|
|
- pd.product_name AS productName
|
|
|
- FROM
|
|
|
- ctop_kuaishou_daily_flows d
|
|
|
- LEFT JOIN ctop_user_allocation u ON d.account_id = u.account_id
|
|
|
- LEFT JOIN ctop_project p ON u.project_id = p.id
|
|
|
- LEFT JOIN ctop_product pd on pd.id = p.product_id
|
|
|
- where (u.media_id = 2 or u.media_id = 4)
|
|
|
- <if test="accountId !=null and accountId != ''">
|
|
|
- AND d.account_id = #{accountId}
|
|
|
- </if>
|
|
|
- <if test="startTime !=null and startTime != ''">
|
|
|
- AND d.date >= #{startTime}
|
|
|
- </if>
|
|
|
- <if test="endTime !=null and endTime != ''">
|
|
|
- AND d.date <= #{endTime}
|
|
|
- </if>
|
|
|
- GROUP BY
|
|
|
- d.account_id;-->
|
|
|
-
|
|
|
- <!-- SELECT
|
|
|
- d.account_id as accountId,
|
|
|
- d.user_id AS ksId,
|
|
|
- SUM(d.total_charged_in_yuan) AS cost,
|
|
|
- SUM((d.real_charged_in_yuan + d.total_rebate_real_charged_in_yuan + d.credit_real_charged_in_yuan)) as cashCost,
|
|
|
- c.product_id as productId,
|
|
|
- (SELECT p.product_name from ctop_product p where p.id = c.product_id) AS productName,
|
|
|
- (SELECT d.name as advertiserName from ctop_advertiser d where d.id = c.advertiser_id) advertiserName
|
|
|
- FROM
|
|
|
- ctop_kuaishou_daily_agent d
|
|
|
- RIGHT JOIN ctop_cwjs_settlement_info c
|
|
|
- on d.account_id = c.account_id
|
|
|
- and c.kuai_shou_id = d.user_id
|
|
|
- <where>
|
|
|
- <if test="accountId !=null and accountId != ''">
|
|
|
- AND d.account_id = #{accountId}
|
|
|
- </if>
|
|
|
- <if test="startTime !=null and startTime != ''">
|
|
|
- AND d.date_time >= #{startTime}
|
|
|
- </if>
|
|
|
- <if test="endTime !=null and endTime != ''">
|
|
|
- AND d.date_time <= #{endTime}
|
|
|
- </if>
|
|
|
- </where>
|
|
|
-
|
|
|
- GROUP BY d.account_id-->
|
|
|
-
|
|
|
SELECT
|
|
|
d.account_id as accountId,
|
|
|
d.user_id AS ksId,
|
|
@@ -525,33 +328,10 @@
|
|
|
</if>
|
|
|
</where>
|
|
|
GROUP BY d.account_id
|
|
|
-
|
|
|
</select>
|
|
|
|
|
|
-
|
|
|
-<!-- 查询 快手 利润表 总花费-->
|
|
|
+ <!-- 查询 快手 利润表 总花费-->
|
|
|
<select id="getProfitKuaiShouCost" resultType="java.util.LinkedHashMap">
|
|
|
- <!--SELECT
|
|
|
- d.account_id AS accountId,
|
|
|
- SUM( d.daily_charge ) AS cost,
|
|
|
- SUM( d.real_charged ) AS cashCost,
|
|
|
- pd.id as productId,
|
|
|
- pd.product_name AS productName
|
|
|
- FROM
|
|
|
- ctop_kuaishou_daily_flows d
|
|
|
- LEFT JOIN ctop_user_allocation u ON d.account_id = u.account_id
|
|
|
- LEFT JOIN ctop_project p ON u.project_id = p.id
|
|
|
- LEFT JOIN ctop_product pd on pd.id = p.product_id
|
|
|
- where (u.media_id = 2 or u.media_id = 4)
|
|
|
- <if test="accountId !=null and accountId != ''">
|
|
|
- AND d.account_id = #{accountId}
|
|
|
- </if>
|
|
|
- <if test="startTime !=null and startTime != ''">
|
|
|
- AND d.date >= #{startTime}
|
|
|
- </if>
|
|
|
- <if test="endTime !=null and endTime != ''">
|
|
|
- AND d.date <= #{endTime}
|
|
|
- </if>-->
|
|
|
SELECT
|
|
|
d.account_id,
|
|
|
d.user_id AS ksId,
|
|
@@ -570,34 +350,11 @@
|
|
|
AND d.date_time <= #{endTime}
|
|
|
</if>
|
|
|
</where>
|
|
|
-
|
|
|
-
|
|
|
</select>
|
|
|
|
|
|
|
|
|
-
|
|
|
<!-- 查询 快手 利润表 广告主和运营和运营所属区域-->
|
|
|
<select id="getProfitKuaiShouOperate" resultType="java.util.LinkedHashMap">
|
|
|
- <!-- select
|
|
|
- u.advertiser_id,
|
|
|
- u.account_id,
|
|
|
- b.user_id as ksId,
|
|
|
- d.name as advertiserName,
|
|
|
- u.user_id,
|
|
|
- u.user_name as operateName,
|
|
|
- u.auth_name,
|
|
|
- IFNULL(p.nick_name,'') as operateArea
|
|
|
- from
|
|
|
- ctop_user_allocation u
|
|
|
- LEFT JOIN ctop_kuaishou_advertiser_base_info b on u.account_id = b.account_id
|
|
|
- LEFT JOIN user_company p on p.user_id = u.user_id
|
|
|
- LEFT JOIN ctop_advertiser d on u.advertiser_id = d.id
|
|
|
- <where>
|
|
|
- <if test="accountId !=null and accountId != ''">
|
|
|
- AND u.account_id = #{accountId}
|
|
|
- </if>
|
|
|
- </where>-->
|
|
|
-
|
|
|
SELECT
|
|
|
c.create_user_id AS operateUserId,
|
|
|
p.user_name AS operateName,
|
|
@@ -614,14 +371,7 @@
|
|
|
limit 1
|
|
|
</select>
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- <!-- 给运营人员发送微信通知 -->
|
|
|
-
|
|
|
-
|
|
|
-<!-- 查询 所有已绑定用户的运营人员id -->
|
|
|
+ <!-- 查询 所有已绑定用户的运营人员id -->
|
|
|
<select id="getAccountOperateUserId" resultType="java.util.LinkedHashMap">
|
|
|
SELECT user_id userId,user_name userName
|
|
|
from ctop_user_allocation
|
|
@@ -647,11 +397,4 @@
|
|
|
AND c.user_id = #{userId}
|
|
|
</select>
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- <!-- 给运营人员发送微信通知 -->
|
|
|
-
|
|
|
-
|
|
|
</mapper>
|