Browse Source

盯盘-账户维度添加余额和预算

yangzian 3 years ago
parent
commit
53905a0ec1

+ 6 - 0
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/entity/vo/KuaiShouOperateAccountVo.java

@@ -26,6 +26,12 @@ public class KuaiShouOperateAccountVo {
     @ApiModelProperty(value = "运营姓名")
     private String userName;
 
+    @ApiModelProperty(value = "预算")
+    private Double warningAmount;
+
+    @ApiModelProperty(value = "余额")
+    private Double balance;
+
     @ApiModelProperty(value = "激活数")
     private Integer activation;
 

+ 1 - 1
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/mapper/MaterialStareMapper.java

@@ -51,7 +51,7 @@ public interface MaterialStareMapper {
 
 
     //快手 账户 余额
-    JSONObject getKuaiShouAccountBalance(@Param("accountId")Long accountId,@Param("statDate")Long statDate);
+    JSONObject getKuaiShouAccountBalance(@Param("accountId")Long accountId);
     //快手 账户 消耗以及状态
     JSONObject getKuaiShouAccountTotalCost(@Param("accountId")Long accountId,@Param("statDate")Long statDate);
 

+ 7 - 11
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/mapper/xml/MaterialStareMapper.xml

@@ -280,6 +280,8 @@
         d.project_name AS projectName,
         COUNT( DISTINCT d.user_id ) AS userNum,
         ( SELECT u.realname FROM `jeecg-boot`.sys_user u WHERE u.id = d.user_id ) AS userName,
+        (SELECT u.warning_amount FROM `jeecg-boot`.ctop_user_allocation u where u.account_id = d.account_id) as warningAmount,
+        (SELECT u.balance FROM media_api.kuaishou_advertiser_fund_get u where u.advertiser_id = d.account_id ORDER BY stat_date DESC limit 1 ) as balance,
         IFNULL(SUM( d.activation ),0) AS activation,
         IFNULL(ROUND( SUM( d.charge ) / SUM( d.activation ), 2 ),0) AS activationPrice,
         IF(SUM( d.event_next_day_stay ) / SUM( d.activation ) > 0.0001,CONCAT(ROUND(SUM( d.event_next_day_stay ) / SUM( d.activation ) * 100, 2 ),'%'),0) AS leave,
@@ -356,17 +358,11 @@
     <!-- 快手 账户 余额 -->
     <select id="getKuaiShouAccountBalance" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
-            d.total_charged_in_yuan as totalCost,
-            d.total_balance_in_yuan as balance
-        FROM application.app_kuaishou_agent_report_d d
-        <where>
-            <if test="accountId != null and accountId != '' ">
-                and d.account_id = #{accountId}
-            </if>
-            <if test="statDate != null and statDate != '' ">
-                and d.stat_date = #{statDate}
-            </if>
-        </where>
+            advertiser_id as accountId,
+            balance
+        FROM media_api.kuaishou_advertiser_fund_get
+        where d.account_id = #{accountId}
+
     </select>
 
 

+ 1 - 1
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/service/impl/MaterialStareServiceImpl.java

@@ -567,7 +567,7 @@ public class MaterialStareServiceImpl implements MaterialStareService {
         long nowDate = Long.valueOf(now);
 
         //账户余额
-        JSONObject balance = materialStareMapper.getKuaiShouAccountBalance(accountId, nowDate);
+        JSONObject balance = materialStareMapper.getKuaiShouAccountBalance(accountId);
         resultMap.put("balance",Check.isNull(balance) ? "0" : balance.getString("balance"));
         //账户今日消耗 以及状态
         JSONObject totalCost = materialStareMapper.getKuaiShouAccountTotalCost(accountId, nowDate);