|
@@ -25,7 +25,7 @@ import java.util.List;
|
|
|
public class TotalDataServiceImpl extends ServiceImpl<ITotalDataMapper, TotalData> implements ITotalDataService {
|
|
|
|
|
|
@Override
|
|
|
- public TotalData getByType(Integer type, String time) throws Exception {
|
|
|
+ public TotalData getByType(Integer type, String time,String startDay,String endDay) throws Exception {
|
|
|
switch (type){
|
|
|
case 0: //日
|
|
|
if(StringUtils.isEmpty(time)){
|
|
@@ -59,6 +59,19 @@ public class TotalDataServiceImpl extends ServiceImpl<ITotalDataMapper, TotalDat
|
|
|
}
|
|
|
month.setId(time);
|
|
|
return month;
|
|
|
+ case 3: //时间段
|
|
|
+ if(StringUtils.isNotBlank(startDay) && StringUtils.isNotBlank(endDay)){
|
|
|
+ TotalData totalData = this.getBaseMapper().getWeek(startDay, endDay);
|
|
|
+ if(totalData == null){
|
|
|
+ totalData = newTotalData(startDay +"-"+endDay);
|
|
|
+ }
|
|
|
+ totalData.setId(startDay +"-"+ endDay);
|
|
|
+ return totalData;
|
|
|
+ }
|
|
|
+ if(StringUtils.isEmpty(time)){
|
|
|
+ time = DateUtil.getDay(new Date(),-1);
|
|
|
+ }
|
|
|
+ return this.getById(time) == null ? newTotalData(time) : this.getById(time);
|
|
|
default:
|
|
|
throw new IllegalStateException("Unexpected value: " + type);
|
|
|
}
|