|
@@ -35,6 +35,8 @@ public class BytedanceAccountReportServiceImpl implements IBytedanceAccountRepor
|
|
|
@Autowired
|
|
|
BytedanceAccountReportMapper bytedanceAccountReportMapper;
|
|
|
|
|
|
+ private static final BigDecimal zero=BigDecimal.ZERO;
|
|
|
+
|
|
|
@Override
|
|
|
public Map<String, Object> getSumDataBy(String mediaId, BigDecimal discount, JSONArray accounts, String startDate, String endDate) {
|
|
|
Map<String, Object> result = new HashMap<>();
|
|
@@ -47,7 +49,7 @@ public class BytedanceAccountReportServiceImpl implements IBytedanceAccountRepor
|
|
|
}
|
|
|
before = bytedanceAccountReportMapper.queryTodaySumByHour(DateUtils.getAnotherDay(SystemDateConstant.yyyy_MM_dd, startDate, -1), after.getInteger("maxHour"), accounts);
|
|
|
if(before==null){
|
|
|
- return result;
|
|
|
+ before = after;
|
|
|
}
|
|
|
} else {
|
|
|
after = bytedanceAccountReportMapper.querySumByStartEndDate(endDate, startDate, accounts);
|
|
@@ -67,9 +69,12 @@ public class BytedanceAccountReportServiceImpl implements IBytedanceAccountRepor
|
|
|
if (startDate.equals(endDate)) {
|
|
|
List<JSONObject> after = bytedanceAccountReportMapper.queryTodayDetailReportBy(filedAll, startDate, accounts);
|
|
|
List<JSONObject> before = bytedanceAccountReportMapper.queryTodayDetailReportBy(filedAll, DateUtils.getAnotherDay(SystemDateConstant.yyyy_MM_dd, startDate, -1), accounts);
|
|
|
- if(after==null||before==null){
|
|
|
+ if(after.size()==0){
|
|
|
return result;
|
|
|
}
|
|
|
+ if(before.size()==0){
|
|
|
+ before=nullDataHandle();
|
|
|
+ }
|
|
|
List<JSONObject> afterDis = this.countDiscountCost(mediaId, discount, after);
|
|
|
List<JSONObject> beforeDis = this.countDiscountCost(mediaId, discount, before);
|
|
|
result = LinkUtils.getCompareDate(beforeDis, afterDis, "statHour");
|
|
@@ -182,7 +187,7 @@ public class BytedanceAccountReportServiceImpl implements IBytedanceAccountRepor
|
|
|
if (k.equals("accountId") || k.equals("authName") || v.toString().contains("%")) {
|
|
|
jsonObject.put(k, "-");
|
|
|
} else {
|
|
|
- jsonObject.put(k, LinkUtils.countLink(after.getBigDecimal(k), before.getBigDecimal(k)));
|
|
|
+ jsonObject.put(k, LinkUtils.countLink(after.getBigDecimal(k)==null?zero:after.getBigDecimal(k), before.getBigDecimal(k)==null?zero:before.getBigDecimal(k)));
|
|
|
}
|
|
|
});
|
|
|
return jsonObject;
|
|
@@ -241,5 +246,18 @@ public class BytedanceAccountReportServiceImpl implements IBytedanceAccountRepor
|
|
|
return new PageInfo<>(bytedanceAccountReportMapper.getBytedanceAccountInfoByProjectId(startDate,endDate,projectId,accountIds,yn));
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+ private List<JSONObject> nullDataHandle(){
|
|
|
+ List<JSONObject> objectList= new ArrayList<>();
|
|
|
+ JSONObject jsonObject=null;
|
|
|
+ for(int i=0;i<24;i++){
|
|
|
+ jsonObject=new JSONObject();
|
|
|
+ jsonObject.put("cost",0);
|
|
|
+ jsonObject.put("showNum",0);
|
|
|
+ jsonObject.put("click",0);
|
|
|
+ jsonObject.put("convertNum",0);
|
|
|
+ jsonObject.put("statHour",i);
|
|
|
+ objectList.add(jsonObject);
|
|
|
+ }
|
|
|
+ return objectList;
|
|
|
+ }
|
|
|
}
|