谭斌 2 rokov pred
rodič
commit
f2315440cd

+ 19 - 17
device-api-service/src/main/java/com/xy/service/DeviceInfoServiceImpl.java

@@ -773,27 +773,29 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
         DeviceInfoDto.DeviceDataCountVO vo = new DeviceInfoDto.DeviceDataCountVO();
         //当天
         DeviceDataDto.Vo dayData = deviceDataService.getByDay(deviceId, mercId, DateUtil.format(new Date(), DatePattern.PURE_DATE_PATTERN));
+        if (dayData != null) {
+            //今日退款成功订单金额
+            OrderRefundDto.CountByDateVO countByDateVO = R.feignCheckData(
+                    refundService.countByDate(new OrderRefundDto.CountByDateDTO()
+                            .setDate(DateTime.now())
+                            .setMercId(mercId).setDeviceId(deviceId)));
+            Integer hisRefundMoney = countByDateVO.getHisRefundMoney();
+            Integer todayRefundMoney = countByDateVO.getTodayRefundMoney();
+            //今日销售额 (扣除今日的订单的退款金额)
+            dayData.setSalesMoney(dayData.getSalesMoney() - todayRefundMoney);
+            dayData.setRefundMoney(hisRefundMoney + todayRefundMoney);
+        }
 
-        //今日退款成功订单金额
-        OrderRefundDto.CountByDateVO countByDateVO = R.feignCheckData(
-                refundService.countByDate(new OrderRefundDto.CountByDateDTO()
-                        .setDate(DateTime.now())
-                        .setMercId(mercId).setDeviceId(deviceId)));
-        Integer hisRefundMoney = countByDateVO.getHisRefundMoney();
-        Integer todayRefundMoney = countByDateVO.getTodayRefundMoney();
-        //今日销售额 (扣除今日的订单的退款金额)
-        dayData.setSalesMoney(dayData.getSalesMoney() - todayRefundMoney);
-        dayData.setRefundMoney(hisRefundMoney + todayRefundMoney);
 
         //当月
         DeviceDataDto.Vo monthData = deviceDataService.getByMonth(deviceId, mercId, DateUtil.format(new Date(), DatePattern.SIMPLE_MONTH_PATTERN));
-        OrderRefundDto.CountByMonthVO countByMonthVO = R.feignCheckData(refundService.countByMonth(new OrderRefundDto.CountByMonthDTO().setCurMonthDate(DateTime.now()).setMercId(mercId).setDeviceId(deviceId)));
-        Integer hisMonthRefundMoney = countByMonthVO.getHisMonthRefundMoney();
-        Integer monthRefundMoney = countByMonthVO.getMonthRefundMoney();
-        monthData.setRefundMoney(hisMonthRefundMoney + monthRefundMoney);
-        monthData.setSalesMoney(monthData.getSalesMoney() - monthRefundMoney);
-
-
+        if (monthData != null) {
+            OrderRefundDto.CountByMonthVO countByMonthVO = R.feignCheckData(refundService.countByMonth(new OrderRefundDto.CountByMonthDTO().setCurMonthDate(DateTime.now()).setMercId(mercId).setDeviceId(deviceId)));
+            Integer hisMonthRefundMoney = countByMonthVO.getHisMonthRefundMoney();
+            Integer monthRefundMoney = countByMonthVO.getMonthRefundMoney();
+            monthData.setRefundMoney(hisMonthRefundMoney + monthRefundMoney);
+            monthData.setSalesMoney(monthData.getSalesMoney() - monthRefundMoney);
+        }
         vo.setDayBusinessData(copy(DeviceInfoDto.BusinessData.class, dayData));
         vo.setMonthBusinessData(copy(DeviceInfoDto.BusinessData.class, monthData));
         return vo;