فهرست منبع

盯盘-账户月消耗

yangzian 3 سال پیش
والد
کامیت
f511063337

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

@@ -55,6 +55,8 @@ public interface MaterialStareMapper {
     JSONObject getKuaiShouAccountBalance(@Param("accountId")Long accountId);
     //快手 账户 消耗以及状态
     JSONObject getKuaiShouAccountTotalCost(@Param("accountId")Long accountId,@Param("statDate")Long statDate);
+    //快手-账户 月总消耗
+    JSONObject getKuaiShouAccountCostMonth(@Param("accountId")Long accountId,@Param("statDate")Long statDate,@Param("endDate")Long endDate);
 
     //快手 账户趋势图-时报
     List<JSONObject> getKuaiShouAccountInfoBrokenLineHour(@Param("type")String type,@Param("accountId")Long accountId,@Param("statDate")Long statDate,@Param("endDate")Long endDate);

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

@@ -383,6 +383,28 @@
     </select>
 
 
+    <!-- 快手-账户 月总消耗 -->
+    <select id="getKuaiShouAccountCostMonth" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+            SUM( d.charge ) cost
+        FROM
+            application.kuaishou_account_report_daily_dw d
+        <where>
+            <if test="accountId != null and accountId != '' ">
+                and d.account_id = #{accountId}
+            </if>
+            <if test="statDate != null and statDate != '' ">
+                and d.stat_date &gt;= #{statDate}
+            </if>
+            <if test="endDate != null and endDate != '' ">
+                and d.stat_date &lt;= #{endDate}
+            </if>
+
+        </where>
+
+    </select>
+
+
 
     <!-- 快手 账户趋势图-时报 -->
     <select id="getKuaiShouAccountInfoBrokenLineHour" resultType="com.alibaba.fastjson.JSONObject">

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

@@ -574,6 +574,9 @@ public class MaterialStareServiceImpl implements MaterialStareService {
         String now = sdf.format(new Date());
         long nowDate = Long.valueOf(now);
 
+        //当前月份第一天
+        long monthFirstDay = Long.valueOf(DateUtils.getFirstDayByMonth());
+
         //账户余额
         JSONObject balance = materialStareMapper.getKuaiShouAccountBalance(accountId);
         resultMap.put("balance",Check.isNull(balance) ? "0" : balance.getString("balance"));
@@ -586,6 +589,11 @@ public class MaterialStareServiceImpl implements MaterialStareService {
         resultMap.put("totalCost",Check.isNull(totalCost) ? "0" : totalCost.getString("todayCost"));
         //0-开 1-关
         resultMap.put("state", Check.isNull(totalCost) ? "1" : totalCost.getString("accountStatus"));
+
+        //月消耗
+        JSONObject monthCost = materialStareMapper.getKuaiShouAccountCostMonth(accountId, monthFirstDay,nowDate);
+        resultMap.put("monthCost",Check.isNull(monthCost) ? "0" : monthCost.getString("cost"));
+
         return Result.successMsg("账户查询成功",resultMap);
     }