Pārlūkot izejas kodu

盯盘-运营经理

yangzian 3 gadi atpakaļ
vecāks
revīzija
d0f6d978e6

+ 3 - 2
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/DateUtils.java

@@ -1979,9 +1979,10 @@ public class DateUtils extends PropertyEditorSupport {
        // SimpleDateFormat sdf1 = new SimpleDateFormat("yyyyMMdd");
         //System.out.println(sdf1.parse("20220115"));
 
-        Double  a = 3.268890;
+       /* Double  a = 3.268890;
         System.out.println(String.format("%.3f", a));
-
+*/
+        System.out.println(DateUtils.addDayParse("20220224",-1));
 
     }
 

+ 5 - 3
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/controller/KuaiShouMaterialStareController.java

@@ -217,15 +217,17 @@ public class KuaiShouMaterialStareController {
      * @param accountId
      * @param startTime
      * @param endTime
+     * @param type 查询类型 额。。。 查询选中的指标 --、 给前端组装数据格式  I didn't want to write
      * @return: org.jeecg.common.api.vo.Result
      * @author: zianY
-     * @time: 2022/2/22 10:50
+     * @time: 2022/2/22
      */
     @GetMapping("/getKuaiShouAccountPieChar")
     public Result getKuaiShouAccountPieChar(@RequestParam(name="accountId") long accountId,
                                             @RequestParam(name="startTime") String startTime,
-                                            @RequestParam(name="endTime") String endTime) {
-        return materialStareService.getKuaiShouAccountPieChar(accountId,startTime,endTime);
+                                            @RequestParam(name="endTime") String endTime,
+                                            @RequestParam(name="type") String type) {
+        return materialStareService.getKuaiShouAccountPieChar(accountId,startTime,endTime,type);
     }
 
 

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

@@ -15,6 +15,7 @@ public class KuaiShouOperateAccountVo {
 
     @ApiModelProperty(value = "账户id")
     private long accountId;
+    private String accountName;
 
     @ApiModelProperty(value = "总花费")
     private Double totalCost;

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

@@ -52,7 +52,7 @@ public interface MaterialStareMapper {
     JSONObject getKuaiShouAccountTotalCost(@Param("accountId")Long accountId,@Param("statDate")Long statDate);
 
     //快手 账户趋势图-时报
-    List<JSONObject> getKuaiShouAccountInfoBrokenLineHour(@Param("accountId")Long accountId,@Param("statDate")Long statDate);
+    List<JSONObject> getKuaiShouAccountInfoBrokenLineHour(@Param("accountId")Long accountId,@Param("statDate")Long statDate,@Param("endDate")Long endDate);
     //快手 账户趋势图-日报
     List<JSONObject> getKuaiShouAccountInfoBrokenLineDaily(@Param("accountId")Long accountId,@Param("startDate")Long startDate, @Param("endDate")Long endDate);
 
@@ -61,11 +61,11 @@ public interface MaterialStareMapper {
 
 
     //快手 账户饼图图-分版位
-    List<KuaiShouAccountPieVo> getKuaiShouAccountPieScene(@Param("accountId")Long accountId, @Param("startDate")Long startDate, @Param("endDate")Long endDate);
+    List<KuaiShouAccountPieVo> getKuaiShouAccountPieScene(@Param("accountId")Long accountId, @Param("startDate")Long startDate, @Param("endDate")Long endDate,@Param("type")String type);
     //快手 账户饼图图-分年龄
-    List<KuaiShouAccountPieVo> getKuaiShouAccountPieAge(@Param("accountId")Long accountId, @Param("startDate")Long startDate, @Param("endDate")Long endDate);
+    List<KuaiShouAccountPieVo> getKuaiShouAccountPieAge(@Param("accountId")Long accountId, @Param("startDate")Long startDate, @Param("endDate")Long endDate,@Param("type")String type);
     //快手 账户饼图图-分性别
-    List<KuaiShouAccountPieVo> getKuaiShouAccountPieGender(@Param("accountId")Long accountId, @Param("startDate")Long startDate, @Param("endDate")Long endDate);
+    List<KuaiShouAccountPieVo> getKuaiShouAccountPieGender(@Param("accountId")Long accountId, @Param("startDate")Long startDate, @Param("endDate")Long endDate,@Param("type")String type);
 
 
 

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

@@ -6,7 +6,7 @@
     <select id="getKuaiShouCostHourlyByUserIdList" resultType="Map">
         SELECT
         t.`hour`,
-        ROUND( SUM( charge ), 3 ) AS totalCost
+        ROUND( SUM( charge ), 2 ) AS totalCost
         FROM
         application.kuaishou_account_report_hourly_dw t
         where
@@ -53,7 +53,7 @@
 <!--快手 -日报  -->
     <select id="getKuaiShouCostDailyByUserIdList" resultType="Map">
         SELECT DATE_FORMAT(t.stat_date,'%Y-%m-%d') as dateTime,
-        ROUND(SUM(charge),3) as totalCost
+        ROUND(SUM(charge),2) as totalCost
         FROM application.kuaishou_account_report_daily_dw t
         WHERE
         t.stat_date &gt;= #{startDate}
@@ -96,7 +96,7 @@
     <!-- 快手 时报总消耗 及 账户数量 -->
     <select id="getKuaiShouTotalCost" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
-        ROUND( SUM( charge ), 3 ) AS totalCost,
+        ROUND( SUM( charge ), 2 ) AS totalCost,
         COUNT(DISTINCT account_id) accountNum
         FROM
         application.kuaishou_account_report_hourly_dw
@@ -182,20 +182,20 @@
         COUNT( DISTINCT d.user_id ) AS userNum,
         SUM( d.activation ) AS activation,
         ROUND( SUM( d.charge ) / SUM( d.activation ), 2 ) AS activationPrice,
-        ROUND( SUM( d.event_next_day_stay ) / SUM( d.activation ), 2 ) AS leave,
+        CONCAT(ROUND(SUM( d.event_next_day_stay ) / SUM( d.activation ) * 100, 2 ),'%') AS leave,
         SUM( d.event_pay ) AS eventPay,
         ROUND( SUM( d.charge ) / SUM( d.event_pay ), 2 ) AS eventPayCost,
-        ROUND( SUM( d.event_pay ) / ( SUM( d.activation ) + SUM( d.form_count )), 2 ) AS eventPayRate,
+        CONCAT(ROUND( SUM( d.event_pay ) / ( SUM( d.activation ) + SUM( d.form_count )) * 100, 2 ),'%') AS eventPayRate,
         SUM( d.event_new_user_pay ) AS eventNewUserPay,
         ROUND( SUM( d.charge ) / SUM( d.event_new_user_pay ), 2 ) AS eventNewUserPayCost,
-        ROUND( SUM( d.event_new_user_pay ) / ( SUM( d.activation ) + SUM( d.form_count )), 2 ) AS eventNewUserPayRate,
+        CONCAT(ROUND( SUM( d.event_new_user_pay ) / ( SUM( d.activation ) + SUM( d.form_count )) * 100, 2 ),'%') AS eventNewUserPayRate,
         SUM( d.event_app_invoked ) AS eventAppInvoked,
         ROUND( SUM( d.charge ) / SUM( d.event_app_invoked ), 2 ) AS eventAppInvokedCost,
         SUM( d.event_register ) AS eventRegister,
         ROUND( SUM( d.charge ) / SUM( d.event_register ), 2 ) AS eventRegisterCost,
         SUM( d.key_action ) AS keyAction,
         ROUND( SUM( d.charge ) / SUM( d.key_action ), 2 ) AS keyActionCost,
-        CONCAT( ROUND( SUM( d.charge )/ SUM( d.activation )* 100, 2 ), '%' ) AS keyActionRate,
+        CONCAT( ROUND( SUM( d.charge )/ SUM( d.key_action )* 100, 2 ), '%' ) AS keyActionRate,
         SUM( d.event_pay_purchase_amount_first_day ) AS eventPayPurchaseAmountFirstDay,
         SUM( d.event_pay_first_day_roi ) AS eventPayFirstDayRoi,
         SUM( d.form_count ) AS formCount,
@@ -253,16 +253,17 @@
         SELECT
         SUM( d.charge ) AS totalCost,
         d.account_id as accountId,
+        d.account_name as accountName,
         d.project_id AS projectId,
         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,
         SUM( d.activation ) AS activation,
         ROUND( SUM( d.charge ) / SUM( d.activation ), 2 ) AS activationPrice,
-        ROUND( SUM( d.event_next_day_stay ) / SUM( d.activation ), 2 ) AS leave,
+        CONCAT(ROUND(SUM( d.event_next_day_stay ) / SUM( d.activation ) * 100, 2 ),'%') AS leave,
         SUM( d.event_pay ) AS eventPay,
         ROUND( SUM( d.charge ) / SUM( d.event_pay ), 2 ) AS eventPayCost,
-        ROUND( SUM( d.event_pay ) / ( SUM( d.activation ) + SUM( d.form_count )), 2 ) AS eventPayRate,
+        CONCAT(ROUND( SUM( d.event_pay ) / ( SUM( d.activation ) + SUM( d.form_count )) * 100, 2 ),'%') AS eventPayRate,
         SUM( d.event_new_user_pay ) AS eventNewUserPay,
         ROUND( SUM( d.charge ) / SUM( d.event_new_user_pay ), 2 ) AS eventNewUserPayCost,
         ROUND( SUM( d.event_new_user_pay ) / ( SUM( d.activation ) + SUM( d.form_count )), 2 ) AS eventNewUserPayRate,
@@ -351,7 +352,9 @@
     <select id="getKuaiShouAccountTotalCost" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
         SUM(h.charge) todayCost,
-        u.account_status as accountStatus
+        u.account_status as accountStatus,
+        u.account_id as accountId,
+        u.auth_name as accountName
         from
         application.kuaishou_account_report_hourly_dw h
         LEFT JOIN `jeecg-boot`.`ctop_user_allocation` u
@@ -405,8 +408,8 @@
                     <if test="accountId != null and accountId != '' ">
                         and h.account_id = #{accountId}
                     </if>
-                    <if test="statDate != null and statDate != '' ">
-                        and h.stat_date = #{statDate}
+                    <if test="endDate != null and endDate != '' ">
+                        and h.stat_date = #{endDate}
                     </if>
                 </where>
                 ORDER BY
@@ -419,6 +422,7 @@
     <!-- 快手 账户趋势图-日报 -->
     <select id="getKuaiShouAccountInfoBrokenLineDaily" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
+            DATE_FORMAT(d.stat_date,'%Y-%m-%d') as dateTime,
             SUM( d.charge ) as cost,
             IFNULL( ROUND( SUM( d.charge ) / SUM( d.activation ), 2 ), 0 ) AS activationPrice,
             IFNULL( ROUND( SUM( d.charge ) / SUM( d.event_new_user_pay ), 2 ), 0 ) AS eventNewUserPayCost,
@@ -443,14 +447,72 @@
     </select>
 
     <!-- 快手 账户 素材上新-有效-爆款   searchType: 0-全部 1-上新 2-有效 3-爆款-->
+    <select id="getKuaiShouAccountPieScene" resultType="org.jeecg.ctop.material.entity.vo.KuaiShouAccountPieVo">
+        SELECT
+        <if test='type == "cost"'>
+            SUM( d.charge ) AS cost,
+        </if>
+        <if test='type == "activation"'>
+            SUM( d.activation ) AS activation,
+        </if>
+        <if test='type == "activationPrice"'>
+            IFNULL( ROUND( SUM( d.charge ) / SUM( d.activation ), 2 ), 0 ) AS activationPrice,
+        </if>
+        <if test='type == "eventPayRoi"'>
+             SUM( d.event_pay_roi ) AS eventPayRoi,
+        </if>
+        <if test='type == "eventPay"'>
+                SUM( d.event_pay ) AS eventPay,
+        </if>
+        <if test='type == "eventPayCost"'>
+              IFNULL( ROUND( SUM( d.charge ) / SUM( d.event_pay ), 2 ), 0 ) AS eventPayCost,
+        </if>
+        <if test='type == "eventPayPurchaseAmountFirstDay"'>
+              SUM( d.event_pay_purchase_amount_first_day ) AS eventPayPurchaseAmountFirstDay,
+        </if>
+        <if test='type == "eventNextDayStay"'>
+            SUM( d.event_next_day_stay ) AS eventNextDayStay,
+        </if>
+        <if test='type == "leave"'>
+             IFNULL( ROUND( SUM( d.event_next_day_stay ) / SUM( d.activation ), 2 ), 0 ) AS leave,
+        </if>
+        d.ad_scene AS adScene
+        FROM
+        application.app_kuaishou_account_ad_scene_report_d d
+        <where>
+            <if test="accountId != null and accountId != '' ">
+                and d.account_id = #{accountId}
+            </if>
+            <if test="startDate != null and startDate != '' ">
+                and d.stat_date &gt;= #{startDate}
+            </if>
+            <if test="endDate != null and endDate != '' ">
+                and d.stat_date &lt;= #{endDate}
+            </if>
+        </where>
+        GROUP BY
+        d.ad_scene
+        ORDER BY
+        d.ad_scene
+    </select>
+
+
+
+
+
+    <!-- 快手 账户饼图图-分版位 -->
     <select id="getKuaiShouAccountMaterialNewAndEffectAndFaddish" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
+        DATE_FORMAT(m.media_time,'%Y-%m-%d') as dateTime,
         vd.signature,
+        m.material_name as videoName,
+        m.video_url as videoUrl,
         SUM( vd.charge ) AS totalCost,
         SUM( vd.activation ) AS activation,
         ROUND(( SUM( vd.charge ) / SUM( vd.activation ) ), 2 ) AS activationPrice,
         vd.stat_date AS statDate,
-        m.media_time AS mediaTime
+        m.media_time AS mediaTime,
+        SUM(vd.show) as showNum
         FROM
         application.kuaishou_material_video_report_daily_dw vd,
         application.app_kuaishou_material_info m
@@ -479,55 +541,37 @@
     </select>
 
 
-
-
-
-    <!-- 快手 账户饼图图-分版位 -->
-    <select id="getKuaiShouAccountPieScene" resultType="org.jeecg.ctop.material.entity.vo.KuaiShouAccountPieVo">
-        SELECT
-        d.ad_scene AS adScene,
-        SUM( d.charge ) AS cost,
-        SUM( d.activation ) AS activation,
-        IFNULL( ROUND( SUM( d.charge ) / SUM( d.activation ), 2 ), 0 ) AS activationPrice,
-        SUM( d.event_pay_roi ) AS eventPayRoi,
-        SUM( d.event_pay ) AS eventPay,
-        IFNULL( ROUND( SUM( d.charge ) / SUM( d.event_pay ), 2 ), 0 ) AS eventPayCost,
-        SUM( d.event_pay_purchase_amount_first_day ) AS eventPayPurchaseAmountFirstDay,
-        SUM( d.event_next_day_stay ) AS event_next_day_stay,
-        IFNULL( ROUND( SUM( d.event_next_day_stay ) / SUM( d.activation ), 2 ), 0 ) AS leave
-        FROM
-        application.app_kuaishou_account_ad_scene_report_d d
-        <where>
-            <if test="accountId != null and accountId != '' ">
-                and d.account_id = #{accountId}
-            </if>
-            <if test="startDate != null and startDate != '' ">
-                and d.stat_date &gt;= #{startDate}
-            </if>
-            <if test="endDate != null and endDate != '' ">
-                and d.stat_date &lt;= #{endDate}
-            </if>
-        </where>
-        GROUP BY
-            d.ad_scene
-        ORDER BY
-            d.ad_scene
-    </select>
-
-
     <!-- 快手 账户饼图图-分年龄 -->
     <select id="getKuaiShouAccountPieAge" resultType="org.jeecg.ctop.material.entity.vo.KuaiShouAccountPieVo">
         SELECT
-        d.age_segment AS ageSegment,
-        SUM( d.charge ) AS cost,
-        SUM( d.activation ) AS activation,
-        IFNULL( ROUND( SUM( d.charge ) / SUM( d.activation ), 2 ), 0 ) AS activationPrice,
-        SUM( d.event_pay_roi ) AS eventPayRoi,
-        SUM( d.event_pay ) AS eventPay,
-        IFNULL( ROUND( SUM( d.charge ) / SUM( d.event_pay ), 2 ), 0 ) AS eventPayCost,
-        SUM( d.event_pay_purchase_amount_first_day ) AS eventPayPurchaseAmountFirstDay,
-        SUM( d.event_next_day_stay ) AS event_next_day_stay,
-        IFNULL( ROUND( SUM( d.event_next_day_stay ) / SUM( d.activation ), 2 ), 0 ) AS leave
+        <if test='type == "cost"'>
+            SUM( d.charge ) AS cost,
+        </if>
+        <if test='type == "activation"'>
+            SUM( d.activation ) AS activation,
+        </if>
+        <if test='type == "activationPrice"'>
+            IFNULL( ROUND( SUM( d.charge ) / SUM( d.activation ), 2 ), 0 ) AS activationPrice,
+        </if>
+        <if test='type == "eventPayRoi"'>
+            SUM( d.event_pay_roi ) AS eventPayRoi,
+        </if>
+        <if test='type == "eventPay"'>
+            SUM( d.event_pay ) AS eventPay,
+        </if>
+        <if test='type == "eventPayCost"'>
+            IFNULL( ROUND( SUM( d.charge ) / SUM( d.event_pay ), 2 ), 0 ) AS eventPayCost,
+        </if>
+        <if test='type == "eventPayPurchaseAmountFirstDay"'>
+            SUM( d.event_pay_purchase_amount_first_day ) AS eventPayPurchaseAmountFirstDay,
+        </if>
+        <if test='type == "eventNextDayStay"'>
+            SUM( d.event_next_day_stay ) AS eventNextDayStay,
+        </if>
+        <if test='type == "leave"'>
+            IFNULL( ROUND( SUM( d.event_next_day_stay ) / SUM( d.activation ), 2 ), 0 ) AS leave,
+        </if>
+        d.age_segment AS ageSegment
         FROM
         media_api.kuaishou_audience_age_report_daily d
         <where>
@@ -551,16 +595,34 @@
     <!-- 快手 账户饼图图-分性别 -->
     <select id="getKuaiShouAccountPieGender" resultType="org.jeecg.ctop.material.entity.vo.KuaiShouAccountPieVo">
         SELECT
-        d.gender AS gender,
-        SUM( d.charge ) AS cost,
-        SUM( d.activation ) AS activation,
-        IFNULL( ROUND( SUM( d.charge ) / SUM( d.activation ), 2 ), 0 ) AS activationPrice,
-        SUM( d.event_pay_roi ) AS eventPayRoi,
-        SUM( d.event_pay ) AS eventPay,
-        IFNULL( ROUND( SUM( d.charge ) / SUM( d.event_pay ), 2 ), 0 ) AS eventPayCost,
-        SUM( d.event_pay_purchase_amount_first_day ) AS eventPayPurchaseAmountFirstDay,
-        SUM( d.event_next_day_stay ) AS event_next_day_stay,
-        IFNULL( ROUND( SUM( d.event_next_day_stay ) / SUM( d.activation ), 2 ), 0 ) AS leave
+        <if test='type == "cost"'>
+            SUM( d.charge ) AS cost,
+        </if>
+        <if test='type == "activation"'>
+            SUM( d.activation ) AS activation,
+        </if>
+        <if test='type == "activationPrice"'>
+            IFNULL( ROUND( SUM( d.charge ) / SUM( d.activation ), 2 ), 0 ) AS activationPrice,
+        </if>
+        <if test='type == "eventPayRoi"'>
+            SUM( d.event_pay_roi ) AS eventPayRoi,
+        </if>
+        <if test='type == "eventPay"'>
+            SUM( d.event_pay ) AS eventPay,
+        </if>
+        <if test='type == "eventPayCost"'>
+            IFNULL( ROUND( SUM( d.charge ) / SUM( d.event_pay ), 2 ), 0 ) AS eventPayCost,
+        </if>
+        <if test='type == "eventPayPurchaseAmountFirstDay"'>
+            SUM( d.event_pay_purchase_amount_first_day ) AS eventPayPurchaseAmountFirstDay,
+        </if>
+        <if test='type == "eventNextDayStay"'>
+            SUM( d.event_next_day_stay ) AS eventNextDayStay,
+        </if>
+        <if test='type == "leave"'>
+            IFNULL( ROUND( SUM( d.event_next_day_stay ) / SUM( d.activation ), 2 ), 0 ) AS leave,
+        </if>
+        d.gender AS gender
         FROM
         media_api.kuaishou_audience_gender_report_daily d
         <where>

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

@@ -27,7 +27,7 @@ public interface MaterialStareService {
 
     Result getKuaiShouAccountMaterialNewAndEffectAndFaddish(long accountId,String searchType,String startTime, String endTime,Integer pageNum,Integer pageSize);
 
-    Result getKuaiShouAccountPieChar(long accountId,String startTime, String endTime);
+    Result getKuaiShouAccountPieChar(long accountId,String startTime, String endTime,String type);
 
 
     Result getCompanyAllSubordinateByUserId(String userId);

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

@@ -99,13 +99,14 @@ public class MaterialStareServiceImpl implements MaterialStareService {
                             add(jsonObject.getString("user_id"));
                         }};
                         List<Map> usertopList = materialStareMapper.getKuaiShouCostHourlyByUserIdList(stratDate, endDate, userSet);
-                        map.put(jsonObject.getString("userName"),usertopList);
+                        map.put("userName",jsonObject.getString("userName"));
+                        map.put("data",usertopList);
                         resultList.add(map);
                     }
                     return Result.successMsg("查询-时报-运营个人消耗top5成功。",resultList);
                 }
 
-                //报 消耗前5
+                //报 消耗前5
                 List<JSONObject> userList = materialStareMapper.getKuaiShouCostByTop5DailyList(stratDate,endDate, operatorUserIds);
                 List<Map> resultList = new ArrayList<>();
                 for (JSONObject jsonObject : userList) {
@@ -114,17 +115,13 @@ public class MaterialStareServiceImpl implements MaterialStareService {
                         add(jsonObject.getString("user_id"));
                     }};
                     List<Map> usertopList = materialStareMapper.getKuaiShouCostDailyByUserIdList(stratDate, endDate, userSet);
-                    map.put(jsonObject.getString("userName"),usertopList);
+                    map.put("userName",jsonObject.getString("userName"));
+                    map.put("data",usertopList);
                     resultList.add(map);
                 }
                 return Result.successMsg("查询-日报-运营个人消耗top5成功。",resultList);
             }
         }
-
-
-
-
-
         return null;
     }
 
@@ -144,6 +141,7 @@ public class MaterialStareServiceImpl implements MaterialStareService {
     @Override
     public Result kuaiShouOperateDateTotal(String mediaType, String startTime, String endTime, String userId) {
         Map resultMap = new HashMap();
+        DecimalFormat decimalFormat = new DecimalFormat("0.00%");
         try {
             //查询当前人员所有下级
             Set<String> operatorUserIds = getAffiliateId(userId);
@@ -162,19 +160,21 @@ public class MaterialStareServiceImpl implements MaterialStareService {
             JSONObject jsonObjectYesterday = materialStareMapper.getKuaiShouTotalCost(time,time,nowHour,operatorUserIds);
             //今日同比 = (今天总消耗 - 昨天总消耗 ) / 昨天总消耗
             Double d = (Double.valueOf(jsonObjectNow.getString("totalCost")) - Double.valueOf(jsonObjectYesterday.getString("totalCost"))) / Double.valueOf(jsonObjectYesterday.getString("totalCost"));
-            resultMap.put("compare",d);
+            resultMap.put("compare",decimalFormat.format(d));
 
             //时间段内 总消耗 及 账户数量
             JSONObject totalCost = materialStareMapper.getKuaiShouTotalCost(Long.valueOf(DateUtils.getDateInteger(startTime)),
                     Long.valueOf(DateUtils.getDateInteger(endTime)),
                     0,
                     operatorUserIds);
+            resultMap.put("sectionCost",totalCost.getDoubleValue("totalCost"));
             // 人均账户数量 = 时间段内 账户总数量 / 人数
             Double userAverageAccount = Double.valueOf(totalCost.getString("accountNum")) / operatorUserIds.size();
             // 人均消耗 = 时间段内 总消耗 / 人数
             Double userAveragecost = Double.valueOf(totalCost.getString("totalCost")) / operatorUserIds.size();
-            resultMap.put("userAverageAccount",userAverageAccount);
-            resultMap.put("userAveragecost",userAveragecost);
+            DecimalFormat df = new DecimalFormat("#.00");
+            resultMap.put("userAverageAccount",df.format(userAverageAccount));
+            resultMap.put("userAveragecost",df.format(userAveragecost));
         }catch (Exception e){
             e.printStackTrace();
         }
@@ -217,7 +217,7 @@ public class MaterialStareServiceImpl implements MaterialStareService {
             List<KuaiShouOperateVo> userOperate = materialStareMapper.getKuaiShouOperateInfo(lastTimeStart,lastTimeEnd,userSet);
             Double rate = new Double(0);
             if (!Check.isNull(userOperate)){
-                //环比 =
+                //环比
                 rate = (operate.getTotalCost() - userOperate.get(0).getTotalCost()) / userOperate.get(0).getTotalCost() * 100;
                 rate = Double.valueOf(String.format("%.3f", rate));
             }
@@ -435,10 +435,13 @@ public class MaterialStareServiceImpl implements MaterialStareService {
 
         //账户余额
         JSONObject balance = materialStareMapper.getKuaiShouAccountBalance(accountId, nowDate);
+        resultMap.put("balance",Check.isNull(balance) ? "0" : balance.getString("balance"));
         //账户今日消耗 以及状态
         JSONObject totalCost = materialStareMapper.getKuaiShouAccountTotalCost(accountId, nowDate);
 
-        resultMap.put("balance",Check.isNull(balance) ? "0" : balance);
+        resultMap.put("accountId",Check.isNull(totalCost) ? "-" : totalCost.getString("accountId"));
+        resultMap.put("accountName",Check.isNull(totalCost) ? "0" : totalCost.getString("accountName"));
+
         resultMap.put("totalCost",Check.isNull(totalCost) ? "0" : totalCost.getString("todayCost"));
         //0-开 1-关
         resultMap.put("state", Check.isNull(totalCost) ? "1" : totalCost.getString("accountStatus"));
@@ -471,7 +474,9 @@ public class MaterialStareServiceImpl implements MaterialStareService {
             Integer daysBetween = Integer.valueOf(lastTime.get("daysBetween"));
 
             if (daysBetween == 0){
-                resultList = materialStareMapper.getKuaiShouAccountInfoBrokenLineHour(accountId,startDate);
+                //昨天
+                long yesterday = DateUtils.getDateInteger(DateUtils.addDayParse(String.valueOf(entDate), -1));
+                resultList = materialStareMapper.getKuaiShouAccountInfoBrokenLineHour(accountId,startDate,yesterday);
                 return Result.successMsg("账户时报报折线图查询成功",resultList);
             }
             resultList = materialStareMapper.getKuaiShouAccountInfoBrokenLineDaily(accountId,startDate,entDate);
@@ -519,18 +524,17 @@ public class MaterialStareServiceImpl implements MaterialStareService {
      * @time: 2022/2/22
      */
     @Override
-    public Result getKuaiShouAccountPieChar(long accountId, String startTime, String endTime) {
-
+    public Result getKuaiShouAccountPieChar(long accountId, String startTime, String endTime,String type) {
         Map resultMap = new HashMap();
         //2022-02-15 ==>> 20220215
         long startDate = Long.valueOf(DateUtils.getDateInteger(startTime));
         long entDate = Long.valueOf(DateUtils.getDateInteger(endTime));
         //版位
-        List<KuaiShouAccountPieVo> sceneList = materialStareMapper.getKuaiShouAccountPieScene(accountId,startDate,entDate);
+        List<KuaiShouAccountPieVo> sceneList = materialStareMapper.getKuaiShouAccountPieScene(accountId,startDate,entDate,type);
         //年龄
-        List<KuaiShouAccountPieVo> ageList = materialStareMapper.getKuaiShouAccountPieAge(accountId,startDate,entDate);
+        List<KuaiShouAccountPieVo> ageList = materialStareMapper.getKuaiShouAccountPieAge(accountId,startDate,entDate,type);
         //性别
-        List<KuaiShouAccountPieVo> genderList = materialStareMapper.getKuaiShouAccountPieGender(accountId,startDate,entDate);
+        List<KuaiShouAccountPieVo> genderList = materialStareMapper.getKuaiShouAccountPieGender(accountId,startDate,entDate,type);
         resultMap.put("scene",sceneList);
         resultMap.put("age",ageList);
         resultMap.put("gender",genderList);