|
@@ -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");
|
|
@@ -372,26 +372,52 @@ 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); // 折前消耗单价
|
|
|
}
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ 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); // 折后提交单价
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
|
|
|
- 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); // 折前激活单价
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ 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); // 折后激活单价
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ returnJson.put("chainRatio", chainRatioJson);
|
|
|
}
|
|
|
}
|
|
|
- returnJson.put("chainRatio", chainRatioJson);
|
|
|
} else if (type == 2) {
|
|
|
if (Check.isNull(statHour)) {
|
|
|
accountDetail = accountReportMapper.selectReportDetailGroupAccountId(anotherDay, accountIds, 23);
|
|
@@ -401,46 +427,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;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
}
|