|
@@ -17,6 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
|
|
+import java.text.ParseException;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
@@ -137,7 +138,7 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
|
|
kuaishouDetailJson.put("click", click);
|
|
kuaishouDetailJson.put("click", click);
|
|
kuaishouClick += click;
|
|
kuaishouClick += click;
|
|
|
|
|
|
- Long show = reportDailyAccount.getShow();
|
|
|
|
|
|
+ Long show = reportDailyAccount.getPhotoShow();
|
|
kuaishouDetailJson.put("show", show);
|
|
kuaishouDetailJson.put("show", show);
|
|
kuaishouShow += show;
|
|
kuaishouShow += show;
|
|
|
|
|
|
@@ -209,8 +210,8 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
|
|
if (!Check.isNull(yesterdayJson)) {
|
|
if (!Check.isNull(yesterdayJson)) {
|
|
BigDecimal cost = accountJson.getBigDecimal("cost"); // 今日消耗
|
|
BigDecimal cost = accountJson.getBigDecimal("cost"); // 今日消耗
|
|
BigDecimal yesterdayCost = yesterdayJson.getBigDecimal("cost");// 昨日消耗
|
|
BigDecimal yesterdayCost = yesterdayJson.getBigDecimal("cost");// 昨日消耗
|
|
- BigDecimal compareBigDecima = new BigDecimal(0);
|
|
|
|
- if (yesterdayCost.compareTo(compareBigDecima) != 0) {
|
|
|
|
|
|
+ BigDecimal compareBigDecimal = new BigDecimal(0);
|
|
|
|
+ if (yesterdayCost.compareTo(compareBigDecimal) != 0) {
|
|
BigDecimal costProportion = (cost.subtract(yesterdayCost)).divide(yesterdayCost, BigDecimal.ROUND_HALF_UP);
|
|
BigDecimal costProportion = (cost.subtract(yesterdayCost)).divide(yesterdayCost, BigDecimal.ROUND_HALF_UP);
|
|
accountJson.put("costProportion", costProportion); // 较昨日增加比例
|
|
accountJson.put("costProportion", costProportion); // 较昨日增加比例
|
|
} else {
|
|
} else {
|
|
@@ -320,16 +321,17 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
|
|
} else {
|
|
} else {
|
|
comparedJson.put("comparedAclick", 0);
|
|
comparedJson.put("comparedAclick", 0);
|
|
}
|
|
}
|
|
|
|
+ Long comparedPhotoShow = beComparedJson.getLong("photoShow");
|
|
|
|
+ Long photoShow = comparedJson.getLong("photoShow");
|
|
|
|
+ if (comparedPhotoShow != 0L) {
|
|
|
|
+ double showProportion = (photoShow.doubleValue() - comparedPhotoShow.doubleValue()) / comparedPhotoShow.doubleValue();
|
|
|
|
+ comparedJson.put("showProportion", showProportion);
|
|
|
|
+ } else {
|
|
|
|
+ comparedJson.put("showProportion", 0);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
- Long comparedPhotoShow = beComparedJson.getLong("photoShow");
|
|
|
|
- Long photoShow = comparedJson.getLong("photoShow");
|
|
|
|
- if (comparedPhotoShow != 0L) {
|
|
|
|
- double showProportion = (photoShow.doubleValue() - comparedPhotoShow.doubleValue()) / comparedPhotoShow.doubleValue();
|
|
|
|
- comparedJson.put("showProportion", showProportion);
|
|
|
|
- } else {
|
|
|
|
- comparedJson.put("showProportion", 0);
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
accountJson.put("beCompared", beComparedJson);
|
|
accountJson.put("beCompared", beComparedJson);
|
|
accountJson.put("compared", comparedJson);
|
|
accountJson.put("compared", comparedJson);
|
|
|
|
|
|
@@ -618,11 +620,13 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
|
|
|
|
|
|
} else if ("day".equals(sign)) {
|
|
} else if ("day".equals(sign)) {
|
|
List<JSONObject> comparedArr = reportMapper.selectHourlyDetailsByDate(comparedDate);// 除数数据
|
|
List<JSONObject> comparedArr = reportMapper.selectHourlyDetailsByDate(comparedDate);// 除数数据
|
|
- detailJson.put("beStatDate", beComparedDate);
|
|
|
|
- detailJson.put("beComparedDetail", comparedArr);
|
|
|
|
- List<JSONObject> beComparedArr = reportMapper.selectHourlyDetailsByDate(beComparedDate);// 被除数数据
|
|
|
|
detailJson.put("statDate", comparedDate);
|
|
detailJson.put("statDate", comparedDate);
|
|
- detailJson.put("comparedDetail", beComparedArr);
|
|
|
|
|
|
+ detailJson.put("comparedDetail", comparedArr);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ List<JSONObject> beComparedArr = reportMapper.selectHourlyDetailsByDate(beComparedDate);// 被除数数据
|
|
|
|
+ detailJson.put("beStatDate", beComparedDate);
|
|
|
|
+ detailJson.put("beComparedDetail", beComparedArr);
|
|
|
|
|
|
}
|
|
}
|
|
reportList.add(detailJson);
|
|
reportList.add(detailJson);
|
|
@@ -631,8 +635,14 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
System.err.println(reportList);
|
|
System.err.println(reportList);
|
|
return reportList;
|
|
return reportList;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ public static void main(String[] args) throws ParseException {
|
|
|
|
+ String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
|
|
|
|
+ String anotherDay = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -1);
|
|
|
|
+ String endDate = DateUtils.getMonthBefore("yyyy-MM-dd", anotherDay, -3);
|
|
|
|
+ System.err.println(endDate);
|
|
|
|
+ }
|
|
}
|
|
}
|