|
@@ -249,10 +249,10 @@ public class AccountReportServiceImpl implements IAccountReportService {
|
|
|
}
|
|
|
JSONObject chainRatioJson = new JSONObject();
|
|
|
accountDetail = accountReportMapper.selectReportDetailGroupAccountId(nowDate, accountIds, hour);
|
|
|
- JSONObject nowAccountSummary = accountReportMapper.selectSummaryByAccountId(nowDate, accountIds, hour);
|
|
|
+ JSONObject nowAccountSummary = accountReportMapper.selectSummaryByAccountId(nowDate, accountIds, hour, discount);
|
|
|
if (!Check.isNull(nowAccountSummary)) {
|
|
|
returnJson.put("now", nowAccountSummary);
|
|
|
- JSONObject yesterdayAccountSummary = accountReportMapper.selectSummaryByAccountId(anotherDay, accountIds, hour);
|
|
|
+ JSONObject yesterdayAccountSummary = accountReportMapper.selectSummaryByAccountId(anotherDay, accountIds, hour, discount);
|
|
|
if (!Check.isNull(yesterdayAccountSummary)) {
|
|
|
returnJson.put("yesterday", yesterdayAccountSummary);
|
|
|
BigDecimal nowCost = nowAccountSummary.getBigDecimal("cost");
|
|
@@ -264,6 +264,8 @@ public class AccountReportServiceImpl implements IAccountReportService {
|
|
|
} else {
|
|
|
chainRatioJson.put("costProportion", 0); // 消耗环比
|
|
|
}
|
|
|
+ } else {
|
|
|
+ chainRatioJson.put("costProportion", 0); // 消耗环比
|
|
|
}
|
|
|
|
|
|
Long photoShow = nowAccountSummary.getLong("photoShow");// 今日封面展示
|
|
@@ -275,6 +277,8 @@ public class AccountReportServiceImpl implements IAccountReportService {
|
|
|
} else {
|
|
|
chainRatioJson.put("showProportion", 0); // 展示环比
|
|
|
}
|
|
|
+ } else {
|
|
|
+ chainRatioJson.put("showProportion", 0); // 展示环比
|
|
|
}
|
|
|
|
|
|
Long photoClick = nowAccountSummary.getLong("photoClick");// 封面点击
|
|
@@ -286,6 +290,8 @@ public class AccountReportServiceImpl implements IAccountReportService {
|
|
|
} else {
|
|
|
chainRatioJson.put("photoClickProportion", 0); // 点击环比
|
|
|
}
|
|
|
+ } else {
|
|
|
+ chainRatioJson.put("photoClickProportion", 0); // 点击环比
|
|
|
}
|
|
|
|
|
|
Long nowAClick = nowAccountSummary.getLong("aclick"); // 爆光
|
|
@@ -297,6 +303,8 @@ public class AccountReportServiceImpl implements IAccountReportService {
|
|
|
} else {
|
|
|
chainRatioJson.put("aClickProportion", 0); //爆光环比
|
|
|
}
|
|
|
+ } else {
|
|
|
+ chainRatioJson.put("aClickProportion", 0); //爆光环比
|
|
|
}
|
|
|
|
|
|
BigDecimal nowPhotoClickRatio = nowAccountSummary.getBigDecimal("photoClickRatio"); // 封面点击率
|
|
@@ -308,6 +316,8 @@ public class AccountReportServiceImpl implements IAccountReportService {
|
|
|
} else {
|
|
|
chainRatioJson.put("photoClickRatioProportion", 0); // 封面点击率环比
|
|
|
}
|
|
|
+ } else {
|
|
|
+ chainRatioJson.put("photoClickRatioProportion", 0); // 封面点击率环比
|
|
|
}
|
|
|
|
|
|
BigDecimal nowCvr = nowAccountSummary.getBigDecimal("cvr"); // cvr
|
|
@@ -319,6 +329,8 @@ public class AccountReportServiceImpl implements IAccountReportService {
|
|
|
} else {
|
|
|
chainRatioJson.put("cvrProportion", 0); // cvr环比
|
|
|
}
|
|
|
+ } else {
|
|
|
+ chainRatioJson.put("cvrProportion", 0); // cvr环比
|
|
|
}
|
|
|
|
|
|
BigDecimal nowCpm = nowAccountSummary.getBigDecimal("cpm"); // cpm
|
|
@@ -330,6 +342,8 @@ public class AccountReportServiceImpl implements IAccountReportService {
|
|
|
} else {
|
|
|
chainRatioJson.put("cpmProportion", 0); // cpm环比
|
|
|
}
|
|
|
+ } else {
|
|
|
+ chainRatioJson.put("cpmProportion", 0); // cpm环比
|
|
|
}
|
|
|
|
|
|
Long nowBClick = nowAccountSummary.getLong("bClick"); // 行为数
|
|
@@ -341,6 +355,8 @@ public class AccountReportServiceImpl implements IAccountReportService {
|
|
|
} else {
|
|
|
chainRatioJson.put("bClickProportion", 0); //行为数环比
|
|
|
}
|
|
|
+ } else {
|
|
|
+ chainRatioJson.put("bClickProportion", 0); //行为数环比
|
|
|
}
|
|
|
|
|
|
Long nowFormCount = nowAccountSummary.getLong("formCount"); // 表单提交数
|
|
@@ -353,6 +369,8 @@ public class AccountReportServiceImpl implements IAccountReportService {
|
|
|
} else {
|
|
|
chainRatioJson.put("formCountProportion", 0); //表单提交数环比
|
|
|
}
|
|
|
+ } else {
|
|
|
+ chainRatioJson.put("formCountProportion", 0); //表单提交数环比
|
|
|
}
|
|
|
|
|
|
|
|
@@ -365,6 +383,8 @@ public class AccountReportServiceImpl implements IAccountReportService {
|
|
|
} else {
|
|
|
chainRatioJson.put("activationCountProportion", 0); //表单提交数环比
|
|
|
}
|
|
|
+ } else {
|
|
|
+ chainRatioJson.put("activationCountProportion", 0); //表单提交数环比
|
|
|
}
|
|
|
|
|
|
BigDecimal nowFormPrice = nowAccountSummary.getBigDecimal("formPrice"); // 表单提交单价
|
|
@@ -372,26 +392,60 @@ public class AccountReportServiceImpl implements IAccountReportService {
|
|
|
if (!Check.isNull(nowFormPrice) && !Check.isNull(yesterdayFormPrice)) {
|
|
|
if (yesterdayFormPrice.compareTo(new BigDecimal(0)) != 0) {
|
|
|
BigDecimal formPriceProportion = (nowFormPrice.subtract(yesterdayFormPrice)).divide(yesterdayFormPrice, BigDecimal.ROUND_HALF_UP, 2);
|
|
|
- chainRatioJson.put("formPriceProportion", formPriceProportion.divide(discount, BigDecimal.ROUND_HALF_UP, 2));
|
|
|
+ chainRatioJson.put("beforeFormPriceProportion", formPriceProportion); // 折前消耗单价
|
|
|
} else {
|
|
|
- chainRatioJson.put("formPriceProportion", 0); // 表单提交单价环比
|
|
|
+ chainRatioJson.put("beforeFormPriceProportion", 0); // 折前消耗单价
|
|
|
}
|
|
|
+ } else {
|
|
|
+ chainRatioJson.put("beforeFormPriceProportion", 0); // 折前消耗单价
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ BigDecimal nowAfterFormPrice = nowAccountSummary.getBigDecimal("afterFormPrice"); // 表单提交单价
|
|
|
+ BigDecimal yesterdayAfterFormPrice = yesterdayAccountSummary.getBigDecimal("afterFormPrice");
|
|
|
+ if (!Check.isNull(nowAfterFormPrice) && !Check.isNull(yesterdayAfterFormPrice)) {
|
|
|
+ if (yesterdayAfterFormPrice.compareTo(new BigDecimal(0)) != 0) {
|
|
|
+ BigDecimal afterFormPriceProportion = (nowAfterFormPrice.subtract(yesterdayAfterFormPrice)).divide(yesterdayAfterFormPrice, BigDecimal.ROUND_HALF_UP, 2);
|
|
|
+ chainRatioJson.put("afterFormPriceProportion", afterFormPriceProportion); // 折后提交单价
|
|
|
+ } else {
|
|
|
+ chainRatioJson.put("afterFormPriceProportion", 0); // 折后提交单价
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ chainRatioJson.put("afterFormPriceProportion", 0); // 折后提交单价
|
|
|
+ }
|
|
|
|
|
|
|
|
|
- BigDecimal nowActivationPrice = nowAccountSummary.getBigDecimal("activationPrice"); // 表单提交单价
|
|
|
- BigDecimal yesterdayActivationPrice = yesterdayAccountSummary.getBigDecimal("activationPrice");
|
|
|
- if (!Check.isNull(nowActivationPrice) && !Check.isNull(yesterdayActivationPrice)) {
|
|
|
- if (yesterdayFormPrice.compareTo(new BigDecimal(0)) != 0) {
|
|
|
- BigDecimal activationPriceProportion = (nowActivationPrice.subtract(yesterdayActivationPrice)).divide(yesterdayActivationPrice, BigDecimal.ROUND_HALF_UP, 2);
|
|
|
- chainRatioJson.put("activationPriceProportion", activationPriceProportion.divide(discount, BigDecimal.ROUND_HALF_UP, 2));
|
|
|
- } else {
|
|
|
- chainRatioJson.put("activationPriceProportion", 0); // 表单提交单价环比
|
|
|
- }
|
|
|
+ BigDecimal nowActivationPrice = nowAccountSummary.getBigDecimal("activationPrice"); // 转化提交单价
|
|
|
+ BigDecimal yesterdayActivationPrice = yesterdayAccountSummary.getBigDecimal("activationPrice");
|
|
|
+ if (!Check.isNull(nowActivationPrice) && !Check.isNull(yesterdayActivationPrice)) {
|
|
|
+ if (yesterdayActivationPrice.compareTo(new BigDecimal(0)) != 0) {
|
|
|
+ BigDecimal activationPriceProportion = (nowActivationPrice.subtract(yesterdayActivationPrice)).divide(yesterdayActivationPrice, BigDecimal.ROUND_HALF_UP, 2);
|
|
|
+ chainRatioJson.put("beforeActivationPriceProportion", activationPriceProportion); // 折前转化单价
|
|
|
+ } else {
|
|
|
+ chainRatioJson.put("beforeActivationPriceProportion", 0); // 折前激活单价
|
|
|
}
|
|
|
+ } else {
|
|
|
+ chainRatioJson.put("beforeActivationPriceProportion", 0); // 折前激活单价
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ BigDecimal nowAfterActivationPrice = nowAccountSummary.getBigDecimal("afterActivationPrice"); // 转化提交单价
|
|
|
+ BigDecimal yesterdayAfterActivationPrice = yesterdayAccountSummary.getBigDecimal("afterActivationPrice");
|
|
|
+ if (!Check.isNull(nowAfterActivationPrice) && !Check.isNull(yesterdayAfterActivationPrice)) {
|
|
|
+ if (yesterdayAfterActivationPrice.compareTo(new BigDecimal(0)) != 0) {
|
|
|
+ BigDecimal activationPriceProportion = (nowAfterActivationPrice.subtract(yesterdayAfterActivationPrice)).divide(yesterdayAfterActivationPrice, BigDecimal.ROUND_HALF_UP, 2);
|
|
|
+ chainRatioJson.put("afterActivationPriceProportion", activationPriceProportion); // 折后转化单价
|
|
|
+ } else {
|
|
|
+ chainRatioJson.put("afterActivationPriceProportion", 0); // 折后激活单价
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ chainRatioJson.put("afterActivationPriceProportion", 0); // 折后激活单价
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ returnJson.put("chainRatio", chainRatioJson);
|
|
|
}
|
|
|
}
|
|
|
- returnJson.put("chainRatio", chainRatioJson);
|
|
|
} else if (type == 2) {
|
|
|
if (Check.isNull(statHour)) {
|
|
|
accountDetail = accountReportMapper.selectReportDetailGroupAccountId(anotherDay, accountIds, 23);
|
|
@@ -401,46 +455,51 @@ public class AccountReportServiceImpl implements IAccountReportService {
|
|
|
|
|
|
} else if (type == 3) { // 近七天
|
|
|
String endDate = DateUtils.getAnotherDay("yyyy-MM-dd", anotherDay, -7);
|
|
|
- accountDetail = accountReportMapper.selectAccountReportByDate(anotherDay, endDate, accountIds);
|
|
|
+ accountDetail = accountReportMapper.selectAccountReportByDate(anotherDay, endDate, accountIds, discount);
|
|
|
|
|
|
} else if (type == 4) { // 近15天
|
|
|
String endDate = DateUtils.getAnotherDay("yyyy-MM-dd", anotherDay, -15);
|
|
|
- accountDetail = accountReportMapper.selectAccountReportByDate(anotherDay, endDate, accountIds);
|
|
|
+ accountDetail = accountReportMapper.selectAccountReportByDate(anotherDay, endDate, accountIds, discount);
|
|
|
|
|
|
|
|
|
} else if (type == 5) {// 近一个月
|
|
|
String endDate = DateUtils.getMonthBefore("yyyy-MM-dd", anotherDay, -1);
|
|
|
- accountDetail = accountReportMapper.selectAccountReportByDate(anotherDay, endDate, accountIds);
|
|
|
+ accountDetail = accountReportMapper.selectAccountReportByDate(anotherDay, endDate, accountIds, discount);
|
|
|
|
|
|
|
|
|
} else if (type == 6) {// 近三个月
|
|
|
String endDate = DateUtils.getMonthBefore("yyyy-MM-dd", anotherDay, -3);
|
|
|
- accountDetail = accountReportMapper.selectAccountReportByDate(anotherDay, endDate, accountIds);
|
|
|
+ accountDetail = accountReportMapper.selectAccountReportByDate(anotherDay, endDate, accountIds, discount);
|
|
|
|
|
|
|
|
|
} else if (type == 7) {// 近六个月
|
|
|
String endDate = DateUtils.getMonthBefore("yyyy-MM-dd", anotherDay, -6);
|
|
|
- accountDetail = accountReportMapper.selectAccountReportByDate(anotherDay, endDate, accountIds);
|
|
|
+ accountDetail = accountReportMapper.selectAccountReportByDate(anotherDay, endDate, accountIds, discount);
|
|
|
|
|
|
|
|
|
} else if (type == 8) { // 所有
|
|
|
- accountDetail = accountReportMapper.selectAccountReport(accountIds);
|
|
|
+ accountDetail = accountReportMapper.selectAccountReport(accountIds, discount);
|
|
|
|
|
|
|
|
|
} else if (type == 9) { // 自定义查询日期
|
|
|
String startDate = json.getString("startDate");
|
|
|
String endDate = json.getString("endDate");
|
|
|
- accountDetail = accountReportMapper.selectAccountReportByDate(startDate, endDate, accountIds);
|
|
|
+ accountDetail = accountReportMapper.selectAccountReportByDate(startDate, endDate, accountIds, discount);
|
|
|
|
|
|
}
|
|
|
|
|
|
+
|
|
|
returnJson.put("accountDetail", accountDetail);
|
|
|
+
|
|
|
+
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
|
|
|
}
|
|
|
|
|
|
+
|
|
|
return returnJson;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
}
|