|
@@ -2,11 +2,14 @@ package com.xy.controller;
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.date.DatePattern;
|
|
|
+import cn.hutool.core.date.DateTime;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import com.xy.annotate.RestMappingController;
|
|
|
import com.xy.dto.DeviceDataDto;
|
|
|
import com.xy.dto.MercMiniDeviceDto;
|
|
|
+import com.xy.dto.OrderRefundDto;
|
|
|
import com.xy.service.DeviceDataServiceImpl;
|
|
|
+import com.xy.service.OrderRefundService;
|
|
|
import com.xy.utils.MercAuthUtils;
|
|
|
import com.xy.utils.R;
|
|
|
import io.swagger.annotations.Api;
|
|
@@ -30,7 +33,7 @@ import java.util.List;
|
|
|
public class MercMiniDeviceHomePageController {
|
|
|
|
|
|
private final DeviceDataServiceImpl deviceDataService;
|
|
|
-// private final OrderRefundService refundService;
|
|
|
+ private final OrderRefundService refundService;
|
|
|
|
|
|
@PostMapping("count")
|
|
|
@ApiOperation("首页统计")
|
|
@@ -42,9 +45,13 @@ public class MercMiniDeviceHomePageController {
|
|
|
List<DeviceDataDto.Vo> mercDataOneDay = deviceDataService.getMercDataOneDay(mercId, DateUtil.format(new Date(), DatePattern.PURE_DATE_PATTERN));
|
|
|
if (CollUtil.isNotEmpty(mercDataOneDay)) {
|
|
|
//今日退款成功订单金额
|
|
|
-
|
|
|
+ OrderRefundDto.CountByDateVO countByDateVO = R.feignCheckData(refundService.countByDate(new OrderRefundDto.CountByDateDTO().setDate(DateTime.now()).setMercId(mercId)));
|
|
|
+ Integer hisRefundMoney = countByDateVO.getHisRefundMoney();
|
|
|
+ Integer todayRefundMoney = countByDateVO.getTodayRefundMoney();
|
|
|
//今日销售额 (扣除今日的订单的退款金额)
|
|
|
- day.setSalesPrice(mercDataOneDay.stream().mapToInt(DeviceDataDto.Vo::getSalesMoney).sum());
|
|
|
+ day.setDayHisRefundMoney(hisRefundMoney);
|
|
|
+ day.setDayRefundMoney(todayRefundMoney);
|
|
|
+ day.setSalesPrice(mercDataOneDay.stream().mapToInt(DeviceDataDto.Vo::getSalesMoney).sum() - todayRefundMoney);
|
|
|
day.setOrderNum(mercDataOneDay.stream().mapToInt(DeviceDataDto.Vo::getSalesCount).sum());
|
|
|
day.setRefundMoney(mercDataOneDay.stream().mapToInt(DeviceDataDto.Vo::getRefundMoney).sum());
|
|
|
}
|
|
@@ -53,9 +60,14 @@ public class MercMiniDeviceHomePageController {
|
|
|
MercMiniDeviceDto.MonthCountVO month = new MercMiniDeviceDto.MonthCountVO().setOrderNum(0).setSalesPrice(0).setRefundMoney(0);
|
|
|
List<DeviceDataDto.Vo> mercDataOneMonth = deviceDataService.getMercDataOneMonth(mercId, DateUtil.format(new Date(), DatePattern.SIMPLE_MONTH_PATTERN));
|
|
|
if (CollUtil.isNotEmpty(mercDataOneMonth)) {
|
|
|
- month.setSalesPrice(mercDataOneMonth.stream().mapToInt(DeviceDataDto.Vo::getSalesMoney).sum());
|
|
|
+ OrderRefundDto.CountByMonthVO countByMonthVO = R.feignCheckData(refundService.countByMonth(new OrderRefundDto.CountByMonthDTO().setCurMonthDate(DateTime.now()).setMercId(mercId)));
|
|
|
+ Integer hisMonthRefundMoney = countByMonthVO.getHisMonthRefundMoney();
|
|
|
+ Integer monthRefundMoney = countByMonthVO.getMonthRefundMoney();
|
|
|
+ month.setSalesPrice(mercDataOneMonth.stream().mapToInt(DeviceDataDto.Vo::getSalesMoney).sum() - monthRefundMoney);
|
|
|
month.setOrderNum(mercDataOneMonth.stream().mapToInt(DeviceDataDto.Vo::getSalesCount).sum());
|
|
|
month.setRefundMoney(mercDataOneMonth.stream().mapToInt(DeviceDataDto.Vo::getRefundMoney).sum());
|
|
|
+ month.setMonthRefundMoney(monthRefundMoney);
|
|
|
+ month.setMonthHisRefundMoney(hisMonthRefundMoney);
|
|
|
}
|
|
|
vo.setMonth(month);
|
|
|
return R.ok(vo);
|