@OverridepublicYJLResponseModel getOrderNewDayCountByYearAndMonth(String condtionStr) {
setYjlResponseModel(newYJLResponseModel());
PageData pageData= JSON.parseObject(condtionStr, PageData.class);//按年+月获取每一天数据
List orderCountList =ordOrderNewMapper.getOrderNewDayCountByYearAndMonth(pageData);//初始化====================//java获取当前年份
Calendar cale =Calendar.getInstance();int currentYear = cale.get(Calendar.YEAR);int currentMonth= cale.get(Calendar.MONTH)+ 1;//判断是否是当前年月,不是的话取满月,是的话,取当前截止日期
int argYear = Integer.parseInt(pageData.getString("year"));int argMonth = Integer.parseInt(pageData.getString("month"));//定义最大天数,默认取满天
int maxDays=getMaxDay(argYear,argMonth);//如果有数据,补充数据===================
if(orderCountList!=null && orderCountList.size()>0) {if (argYear == currentYear && argMonth ==currentMonth) {//获取最后一天日期
PageData lastDay = orderCountList.get(orderCountList.size() - 1);//获取截止天数
maxDays = Integer.parseInt(lastDay.get("day").toString());
}
}//定义最大天数数组
int[] count = new int[maxDays];int[] days = new int[maxDays];//补全日期到数组中
for(int i=0;i
days[i]= i+1;
}if(orderCountList!=null && orderCountList.size()>0) {//将获取到不同年份不同月份不同日期对应不同的订单量放在数组中
for (int i=0;i
PageData oc= orderCountList.get(i);//获取对应天
if(oc!=null){
count[Integer.parseInt(oc.get("day").toString())-1] = Integer.parseInt(oc.get("count").toString());
}
}
}
pageData.put("count",count);
pageData.put("days",days);
getYjlResponseModel().setData(pageData);
getYjlResponseModel().setSuccess(true);returngetYjlResponseModel();
}
@OverridepublicYJLResponseModel getOrderNewDayCountByYear(String condtionStr) {
setYjlResponseModel(newYJLResponseModel());
PageData pageData= JSON.parseObject(condtionStr, PageData.class);//按年获取每一天数据
List orderCountList =ordOrderNewMapper.getOrderNewDayCountByYear(pageData);//初始化数据==============================//定义最大月数数组,默认除了当前年之前年是12个月,当期年是截止月//获取传参年数
int argYear = Integer.parseInt(pageData.getString("year"));//java获取当前年份
Calendar cale =Calendar.getInstance();int currentYear = cale.get(Calendar.YEAR);//定义某年月数,默认12
int maxMonths = 12;//优化数据,补充数据=======================
if(orderCountList!=null && orderCountList.size()>0){if(argYear==currentYear){//获取最后一个月份
PageData lastMonth = orderCountList.get(orderCountList.size()-1);//获取截止月份
maxMonths= Integer.parseInt(lastMonth.get("month").toString());
}
}//定义返回数据格式,默认都是0
int[] count = new int[maxMonths];int[] months = new int[maxMonths];//补全月份到数组中
for(int i=0;i
months[i]= i+1;
}if(orderCountList!=null && orderCountList.size()>0){//将获取到不同年份不同月份对应的订单量放在数组中
for (int i=0;i
PageData oc= orderCountList.get(i);//获取对应天
if(oc!=null){
count[Integer.parseInt(oc.get("month").toString())-1] = Integer.parseInt(oc.get("count").toString());
}
}
}
pageData.put("count",count);
pageData.put("month",months);
getYjlResponseModel().setData(pageData);
getYjlResponseModel().setSuccess(true);returngetYjlResponseModel();
}