|
@@ -31,19 +31,25 @@ public class KuaishouAccountReportDailyDwServiceImpl extends ServiceImpl<Kuaisho
|
|
|
public List<JSONObject> getListDataByParams(String mediaId, BigDecimal discount, JSONArray accounts, String startDate, String endDate, int hour, String target, String order) {
|
|
|
List<JSONObject> result;
|
|
|
String filedAll = JsonResourceUtil.joinAllFiled(AccountReportConstants.getDicMapKs());
|
|
|
- if (startDate.equals(endDate)) {
|
|
|
+ Long startDateNum = Long.parseLong(startDate.replace("-",""));
|
|
|
+ Long anotherStartDateNum = Long.parseLong(DateUtils.getAnotherDay(SystemDateConstant.yyyy_MM_dd, startDate, -1).replace("-",""));
|
|
|
+
|
|
|
+ Long endDateNum = Long.parseLong(endDate.replace("-",""));
|
|
|
+ Long anotherEndDateNum = Long.parseLong(DateUtils.getAnotherDay(SystemDateConstant.yyyy_MM_dd, endDate, -1).replace("-",""));
|
|
|
+
|
|
|
+ if (startDateNum.equals(endDateNum)) {
|
|
|
String groupBy = "account_id";
|
|
|
if (startDate.equals(DateUtils.date2Str())) {
|
|
|
- result = kuaishouAccountReportHourlyDwMapper.getReportByParams(filedAll, startDate, hour, accounts, target, order,1,groupBy);
|
|
|
- JSONObject afterSum = kuaishouAccountReportHourlyDwMapper.getReportByParams(filedAll, startDate, hour, accounts,target,order,0,groupBy).get(0);
|
|
|
- JSONObject beforeSum = kuaishouAccountReportHourlyDwMapper.getReportByParams(filedAll, DateUtils.getAnotherDay(SystemDateConstant.yyyy_MM_dd, startDate, -1), hour, accounts,target,order,0,groupBy).get(0);
|
|
|
+ result = kuaishouAccountReportHourlyDwMapper.getReportByParams(filedAll, startDateNum, hour, accounts, target, order,1,groupBy);
|
|
|
+ JSONObject afterSum = kuaishouAccountReportHourlyDwMapper.getReportByParams(filedAll, startDateNum, hour, accounts,target,order,0,groupBy).get(0);
|
|
|
+ JSONObject beforeSum = kuaishouAccountReportHourlyDwMapper.getReportByParams(filedAll,anotherStartDateNum , hour, accounts,target,order,0,groupBy).get(0);
|
|
|
result.add(afterSum);
|
|
|
result.add(beforeSum);
|
|
|
result.add(countTotal(afterSum, beforeSum));
|
|
|
} else {
|
|
|
- result = kuaishouAccountReportDailyDwMapper.getReportByParams(filedAll, endDate, startDate, accounts, target, order,1,groupBy);
|
|
|
- JSONObject afterSum = kuaishouAccountReportDailyDwMapper.getReportByParams(filedAll, endDate, startDate, accounts,target,order,0,groupBy).get(0);
|
|
|
- JSONObject beforeSum = kuaishouAccountReportDailyDwMapper.getReportByParams(filedAll, DateUtils.getAnotherDay(SystemDateConstant.yyyy_MM_dd, endDate, -1), DateUtils.getAnotherDay(SystemDateConstant.yyyy_MM_dd, startDate, -1), accounts,target,order,0,groupBy).get(0);
|
|
|
+ result = kuaishouAccountReportDailyDwMapper.getReportByParams(filedAll, endDateNum, startDateNum, accounts, target, order,1,groupBy);
|
|
|
+ JSONObject afterSum = kuaishouAccountReportDailyDwMapper.getReportByParams(filedAll, endDateNum, startDateNum, accounts,target,order,0,groupBy).get(0);
|
|
|
+ JSONObject beforeSum = kuaishouAccountReportDailyDwMapper.getReportByParams(filedAll, anotherEndDateNum, anotherStartDateNum, accounts,target,order,0,groupBy).get(0);
|
|
|
result.add(afterSum);
|
|
|
result.add(beforeSum);
|
|
|
result.add(countTotal(afterSum, beforeSum));
|
|
@@ -53,8 +59,8 @@ public class KuaishouAccountReportDailyDwServiceImpl extends ServiceImpl<Kuaisho
|
|
|
if (accounts.size() > 1) {
|
|
|
groupBy = "account_id";
|
|
|
}
|
|
|
- result = kuaishouAccountReportDailyDwMapper.getReportByParams(filedAll, endDate, startDate, accounts, target, order,1,groupBy);
|
|
|
- List<JSONObject> totalList = kuaishouAccountReportDailyDwMapper.getReportByParams(filedAll, endDate, startDate, accounts,target,order,0,groupBy);
|
|
|
+ result = kuaishouAccountReportDailyDwMapper.getReportByParams(filedAll, endDateNum, startDateNum, accounts, target, order,1,groupBy);
|
|
|
+ List<JSONObject> totalList = kuaishouAccountReportDailyDwMapper.getReportByParams(filedAll, endDateNum, startDateNum, accounts,target,order,0,groupBy);
|
|
|
if(null!=totalList&&!totalList.isEmpty()){
|
|
|
result.add(totalList.get(0));
|
|
|
}
|