|
@@ -7,6 +7,7 @@ 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 com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -33,7 +34,7 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
- public JSONObject getCost(String loginId) {
|
|
|
+ public JSONObject getAccountReport(String loginId) {
|
|
|
JSONObject returnJson = new JSONObject();
|
|
|
QueryWrapper<UserAllocation> queryWrapper = new QueryWrapper<>();
|
|
|
queryWrapper.eq("user_id", loginId);
|
|
@@ -50,8 +51,9 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
|
|
|
Long byteDanceForm = 0L;
|
|
|
Long byteDanceNextDayOpen = 0L;
|
|
|
Long byteDanceActive = 0L;
|
|
|
- for (UserAllocation userAllocation : userAllocations) {
|
|
|
+ JSONArray bytedanceDetail = new JSONArray();
|
|
|
|
|
|
+ for (UserAllocation userAllocation : userAllocations) {
|
|
|
if ("1".equals(userAllocation.getMediaId())) {
|
|
|
QueryWrapper<BytedanceAdvertiserDailyReport> bytedanceAdvertiserDailyReportQueryWrapper = new QueryWrapper<>();
|
|
|
bytedanceAdvertiserDailyReportQueryWrapper.eq("advertiser_id", userAllocation.getAccountId());
|
|
@@ -62,13 +64,31 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
|
|
|
bytedanceAdvertiserDailyReportQueryWrapper.last("limit 1");
|
|
|
BytedanceAdvertiserDailyReport bytedanceAdvertiserDailyReport = bytedanceAdvertiserDailyReportMapper.selectOne(bytedanceAdvertiserDailyReportQueryWrapper);
|
|
|
if (!Check.isNull(bytedanceAdvertiserDailyReport)) {
|
|
|
- byteDanceCost = byteDanceCost.add(bytedanceAdvertiserDailyReport.getCost());
|
|
|
- byteDanceClick += bytedanceAdvertiserDailyReport.getClick();
|
|
|
- byteDanceShow += bytedanceAdvertiserDailyReport.getShowNum();
|
|
|
- byteDanceConvert += bytedanceAdvertiserDailyReport.getConvertNum();
|
|
|
- byteDanceForm += bytedanceAdvertiserDailyReport.getForm();
|
|
|
- byteDanceNextDayOpen += bytedanceAdvertiserDailyReport.getNextDayOpen();
|
|
|
- byteDanceActive += bytedanceAdvertiserDailyReport.getActive();
|
|
|
+ JSONObject bytedanceDetailJson = new JSONObject();
|
|
|
+ BigDecimal cost = bytedanceAdvertiserDailyReport.getCost();
|
|
|
+ bytedanceDetailJson.put("cost", cost); // 账号总消耗
|
|
|
+ byteDanceCost = byteDanceCost.add(cost);
|
|
|
+ Long click = bytedanceAdvertiserDailyReport.getClick();
|
|
|
+ bytedanceDetailJson.put("click", click); // 账号总点击
|
|
|
+ byteDanceClick += click;
|
|
|
+ Long showNum = bytedanceAdvertiserDailyReport.getShowNum();
|
|
|
+ bytedanceDetailJson.put("show", showNum); // 账号总展示
|
|
|
+ byteDanceShow += showNum;
|
|
|
+ Long convertNum = bytedanceAdvertiserDailyReport.getConvertNum();
|
|
|
+ bytedanceDetailJson.put("convert", convertNum); // 账号总转化
|
|
|
+ byteDanceConvert += convertNum;
|
|
|
+ Long form = bytedanceAdvertiserDailyReport.getForm();
|
|
|
+ bytedanceDetailJson.put("form", form); // 账号总表单提交
|
|
|
+ byteDanceForm += form;
|
|
|
+ Long nextDayOpen = bytedanceAdvertiserDailyReport.getNextDayOpen();
|
|
|
+ bytedanceDetailJson.put("nextDayOpen", nextDayOpen); // 账号总次日留存
|
|
|
+ byteDanceNextDayOpen += nextDayOpen;
|
|
|
+ Long active = bytedanceAdvertiserDailyReport.getActive();
|
|
|
+ bytedanceDetailJson.put("active", active); // 账号总激活
|
|
|
+ byteDanceActive += active;
|
|
|
+ bytedanceDetailJson.put("accountId", userAllocation.getAccountId()); // 账号
|
|
|
+ bytedanceDetailJson.put("accountName", userAllocation.getAuthName()); // 账号 名称
|
|
|
+ bytedanceDetail.add(bytedanceDetailJson);
|
|
|
}
|
|
|
|
|
|
} else if ("2".equals(userAllocation.getMediaId())) {
|
|
@@ -85,12 +105,13 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
|
|
|
bytedanceJson.put("active", byteDanceActive); // 总激活
|
|
|
|
|
|
returnJson.put("bytedance", bytedanceJson);
|
|
|
+ returnJson.put("bytedanceDetail", bytedanceDetail);
|
|
|
System.err.println(returnJson);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
- return null;
|
|
|
+ return returnJson;
|
|
|
}
|
|
|
|
|
|
|