|
@@ -659,6 +659,8 @@ public class MealOrderService {
|
|
|
ExcelDataMap map = new ExcelDataMap(columns);
|
|
|
List<UserMealOrderView> userMealOrderViews = queryDownLoadMealOrderList(request);
|
|
|
// List<OrderPayment> orderPaymentList = orderPaymentService.getOrderPaymentListByMealOrderList(userMealOrderViews);
|
|
|
+ Map<String, Integer> statisticalDataMap = new HashMap<>();
|
|
|
+ int payTotal = 0, refundTotal = 0, rowSize = 0;
|
|
|
List<MealOrderInfo> list = new ArrayList<>();
|
|
|
if (!Checker.isNone(userMealOrderViews)) {
|
|
|
for (UserMealOrderView p : userMealOrderViews) {
|
|
@@ -770,9 +772,11 @@ public class MealOrderService {
|
|
|
map.getStringListSafely(col3).add(paymentTimeStr);
|
|
|
map.getStringListSafely(col4).add(orderNo);
|
|
|
map.getStringListSafely(col5).add(typeName);
|
|
|
+ rowSize++;
|
|
|
// ExcelHelper.settingMainBodyLabelCell(sheet, cellFormat2, n, bodyStr);
|
|
|
// n++;
|
|
|
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -807,16 +811,18 @@ public class MealOrderService {
|
|
|
map.getStringListSafely(col3).add(refundTimeStr);
|
|
|
map.getStringListSafely(col4).add(orderNo);
|
|
|
map.getStringListSafely(col5).add(typeName);
|
|
|
+ rowSize++;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
- int size = list.size();
|
|
|
- List<ExcelCollectPojo> itemList = new ArrayList<>();
|
|
|
- int bill = 0;
|
|
|
- downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList, size, bill);
|
|
|
+
|
|
|
+
|
|
|
+ List<CustomExcelItem> itemList = getStatisticsData(userMealOrderViews, shopList);
|
|
|
+ downloadRecordService.createMealFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map,
|
|
|
+ itemList, rowSize);
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
logger.error("/mealOrder/downloadMealOrderBillsList(): {}", e.getMessage(), e);
|
|
@@ -831,4 +837,36 @@ public class MealOrderService {
|
|
|
}
|
|
|
return new ArrayList<>();
|
|
|
}
|
|
|
+
|
|
|
+ private List<ExcelCollectPojo> getStatisticsData(int size, int payTotal, int refundTotal, Map<String, Integer> statisticalDataMap) {
|
|
|
+ int startRows = size + 3;
|
|
|
+ int startColumn = 0;
|
|
|
+
|
|
|
+ List<ExcelCollectPojo> customExcelItemList = new ArrayList<>();
|
|
|
+ customExcelItemList.add(new ExcelCollectPojo(startColumn + 1, startRows + 1, new String[]{"支付总额", FormatUtil.intShrink100ToStr(payTotal)}));
|
|
|
+ customExcelItemList.add(new ExcelCollectPojo(startColumn + 3, startRows + 1, new String[]{"退款总额", FormatUtil.intShrink100ToStr(refundTotal)}));
|
|
|
+ customExcelItemList.add(new ExcelCollectPojo(startColumn + 5, startRows + 1, new String[]{"实际支付总额", FormatUtil.intShrink100ToStr(payTotal - refundTotal)}));
|
|
|
+ PaymentChannelEnum[] paymentChannelList = PaymentChannelEnum.values();
|
|
|
+ startRows++;
|
|
|
+
|
|
|
+ if (!Checker.isNone(paymentChannelList)) {
|
|
|
+ for (int i = 0, j = paymentChannelList.length; i < j; i++) {
|
|
|
+ int paymentChannel = paymentChannelList[i].getValue();
|
|
|
+ if (paymentChannel <= 0) continue;
|
|
|
+ String paymentChannelName = paymentChannelList[i].getDisplayName();
|
|
|
+ String payKey = ConstantDef.PAY_KEY_PREFIX + paymentChannel;
|
|
|
+ String refundKey = ConstantDef.REFUND_KEY_PREFIX + paymentChannel;
|
|
|
+ // 按支付渠道统计
|
|
|
+ int payValue = statisticalDataMap.getOrDefault(payKey, 0);
|
|
|
+ int refundValue = statisticalDataMap.getOrDefault(refundKey, 0);
|
|
|
+ if (payValue > 0 || refundValue > 0) {
|
|
|
+ startRows += 1;
|
|
|
+ customExcelItemList.add(new ExcelCollectPojo(startColumn + 1, startRows, new String[]{paymentChannelName + "支付总额", FormatUtil.intShrink100ToStr(payValue)}));
|
|
|
+ customExcelItemList.add(new ExcelCollectPojo(startColumn + 3, startRows , new String[]{paymentChannelName + "退款总额", FormatUtil.intShrink100ToStr(refundValue)}));
|
|
|
+ customExcelItemList.add(new ExcelCollectPojo(startColumn + 5, startRows , new String[]{paymentChannelName + "实际支付总额", FormatUtil.intShrink100ToStr(payValue - refundValue)}));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return customExcelItemList;
|
|
|
+ }
|
|
|
}
|