|
@@ -7,6 +7,8 @@ import cn.com.ctop.bytedance.service.IBytedanceReportService;
|
|
|
import cn.com.ctop.common.module.entity.UserAllocation;
|
|
|
import cn.com.ctop.common.module.mapper.UserAllocationMapper;
|
|
|
import cn.com.ctop.common.module.utils.Check;
|
|
|
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccount;
|
|
|
+import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyAccountMapper;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
@@ -27,6 +29,9 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
|
|
|
@Autowired
|
|
|
private BytedanceReportMapper bytedanceReportMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private KuaishouReportDailyAccountMapper kuaishouReportDailyAccountMapper;
|
|
|
+
|
|
|
/**
|
|
|
* 媒体昨日总消耗
|
|
|
*
|
|
@@ -38,11 +43,11 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
|
|
|
JSONObject returnJson = new JSONObject();
|
|
|
QueryWrapper<UserAllocation> queryWrapper = new QueryWrapper<>();
|
|
|
queryWrapper.eq("user_id", loginId);
|
|
|
- queryWrapper.eq("media_id", 1);
|
|
|
queryWrapper.isNotNull("account_id");
|
|
|
queryWrapper.groupBy("account_id");
|
|
|
List<UserAllocation> userAllocations = userAllocationMapper.selectList(queryWrapper);
|
|
|
if (!Check.isNull(userAllocations)) {
|
|
|
+ // 头条相关
|
|
|
JSONObject bytedanceJson = new JSONObject();
|
|
|
BigDecimal byteDanceCost = new BigDecimal(0);
|
|
|
Long byteDanceClick = 0L;
|
|
@@ -53,6 +58,19 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
|
|
|
Long byteDanceActive = 0L;
|
|
|
JSONArray bytedanceDetail = new JSONArray();
|
|
|
|
|
|
+ // 快手相关
|
|
|
+ JSONArray kuaishouDetail = new JSONArray();
|
|
|
+ JSONObject kuaishouJson = new JSONObject();
|
|
|
+ BigDecimal kuaishouCost = new BigDecimal(0);
|
|
|
+
|
|
|
+ Long kuaishouClick = 0L;
|
|
|
+ Long kuaishouShow = 0L;
|
|
|
+ Long kuaishouConvert = 0L;
|
|
|
+ Long kuaishouForm = 0L;
|
|
|
+ Long kuaishouNextDayOpen = 0L;
|
|
|
+ Long kuaishouActive = 0L;
|
|
|
+
|
|
|
+
|
|
|
for (UserAllocation userAllocation : userAllocations) {
|
|
|
if ("1".equals(userAllocation.getMediaId())) {
|
|
|
QueryWrapper<BytedanceAdvertiserDailyReport> bytedanceAdvertiserDailyReportQueryWrapper = new QueryWrapper<>();
|
|
@@ -94,6 +112,48 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
|
|
|
} else if ("2".equals(userAllocation.getMediaId())) {
|
|
|
// 查询快手相关报表数据
|
|
|
|
|
|
+ QueryWrapper<KuaishouReportDailyAccount> kuaishouReportDailyAccountQueryWrapper = new QueryWrapper<>();
|
|
|
+ kuaishouReportDailyAccountQueryWrapper.eq("account_id", userAllocation.getAccountId());
|
|
|
+ // Map<String, Object> beforeDate = DateUtils.getBeforeDate();
|
|
|
+ // kuaishouReportDailyAccountQueryWrapper.between("stat_datetime", beforeDate.get("startDate"), beforeDate.get("endDate"));
|
|
|
+ kuaishouReportDailyAccountQueryWrapper.between("stat_date", "2019-10-08 00:00:00", "2019-10-08 23:59:59");
|
|
|
+ kuaishouReportDailyAccountQueryWrapper.orderByDesc("create_time");
|
|
|
+ kuaishouReportDailyAccountQueryWrapper.last("limit 1");
|
|
|
+ KuaishouReportDailyAccount reportDailyAccount = kuaishouReportDailyAccountMapper.selectOne(kuaishouReportDailyAccountQueryWrapper);
|
|
|
+ if (!Check.isNull(reportDailyAccount)) {
|
|
|
+ JSONObject kuaishouDetailJson = new JSONObject();
|
|
|
+ kuaishouDetailJson.put("accountId", userAllocation.getAccountId());
|
|
|
+ kuaishouDetailJson.put("accountName", userAllocation.getAuthName());
|
|
|
+
|
|
|
+ BigDecimal cost = reportDailyAccount.getCharge();// 花费
|
|
|
+ kuaishouDetailJson.put("cost", cost);
|
|
|
+ kuaishouCost = kuaishouCost.add(cost);
|
|
|
+
|
|
|
+ Long click = reportDailyAccount.getAclick();
|
|
|
+ kuaishouDetailJson.put("click", click);
|
|
|
+ kuaishouClick += click;
|
|
|
+
|
|
|
+ Long show = reportDailyAccount.getShow();
|
|
|
+ kuaishouDetailJson.put("show", show);
|
|
|
+ kuaishouShow += show;
|
|
|
+
|
|
|
+ Long convert = reportDailyAccount.getBclick();
|
|
|
+ kuaishouDetailJson.put("convert", convert);
|
|
|
+ kuaishouConvert += convert;
|
|
|
+
|
|
|
+ Long form = reportDailyAccount.getSubmit();
|
|
|
+ kuaishouDetailJson.put("form", form);
|
|
|
+ kuaishouForm += form;
|
|
|
+
|
|
|
+
|
|
|
+ Long active = reportDailyAccount.getActivation();
|
|
|
+ kuaishouDetailJson.put("active", active);
|
|
|
+ kuaishouActive += active;
|
|
|
+
|
|
|
+ kuaishouDetail.add(kuaishouDetailJson);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
bytedanceJson.put("cost", byteDanceCost); // 总消耗
|
|
@@ -106,6 +166,17 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
|
|
|
|
|
|
returnJson.put("bytedance", bytedanceJson);
|
|
|
returnJson.put("bytedanceDetail", bytedanceDetail);
|
|
|
+
|
|
|
+
|
|
|
+ kuaishouJson.put("cost", kuaishouCost);
|
|
|
+ kuaishouJson.put("click", kuaishouClick);
|
|
|
+ kuaishouJson.put("show", kuaishouShow);
|
|
|
+ kuaishouJson.put("convert", kuaishouConvert);
|
|
|
+ kuaishouJson.put("form", kuaishouForm);
|
|
|
+ kuaishouJson.put("nextDayOpen", 0);
|
|
|
+ kuaishouJson.put("active", kuaishouActive);
|
|
|
+ returnJson.put("kuaishou", kuaishouJson);
|
|
|
+ returnJson.put("kuaishouDetail", kuaishouDetail);
|
|
|
System.err.println(returnJson);
|
|
|
|
|
|
}
|