|
@@ -162,6 +162,7 @@ public class CheckUpOrderService {
|
|
List<OrderPayment> orderPaymentList = orderPaymentService.getOrderPaymentListByCheckUpOrderList(list);
|
|
List<OrderPayment> orderPaymentList = orderPaymentService.getOrderPaymentListByCheckUpOrderList(list);
|
|
ExcelDataMap map = new ExcelDataMap(columns);
|
|
ExcelDataMap map = new ExcelDataMap(columns);
|
|
int payTotal = 0, refundTotal = 0;
|
|
int payTotal = 0, refundTotal = 0;
|
|
|
|
+ Map<String, Integer> statisticalDataMap = new HashMap<>();
|
|
if (!Checker.isNone(list)) {
|
|
if (!Checker.isNone(list)) {
|
|
for (CheckUpOrder p : list) {
|
|
for (CheckUpOrder p : list) {
|
|
if (!Checker.isNone(p)) {
|
|
if (!Checker.isNone(p)) {
|
|
@@ -201,11 +202,30 @@ public class CheckUpOrderService {
|
|
map.getStringListSafely(col9).add(paymentTimeValue);
|
|
map.getStringListSafely(col9).add(paymentTimeValue);
|
|
map.getStringListSafely(col10).add(hospitalName);
|
|
map.getStringListSafely(col10).add(hospitalName);
|
|
|
|
|
|
|
|
+
|
|
|
|
+ int payChanelInt = Checker.getIntegerValue(p.getPaymentChannel());
|
|
|
|
+
|
|
|
|
+ String payKey = ConstantDef.PAY_KEY_PREFIX + payChanelInt;
|
|
|
|
+ String refundKey = ConstantDef.REFUND_KEY_PREFIX + payChanelInt;
|
|
|
|
+ int payValue = statisticalDataMap.getOrDefault(payKey, 0);
|
|
|
|
+ int refundValue = statisticalDataMap.getOrDefault(refundKey, 0);
|
|
|
|
+ int amountInt = Checker.getIntegerValue(p.getAmount());
|
|
|
|
+ if (Checker.getIntegerValue(p.getPaymentStatus()) == PaymentStatusEnum.Success.getValue()) {
|
|
|
|
+ payTotal += amountInt;
|
|
|
|
+ payValue += amountInt;
|
|
|
|
+ statisticalDataMap.put(payKey, payValue);
|
|
|
|
+ }
|
|
|
|
+ if (Checker.getIntegerValue(p.getRefundStatus()) == RefundStatusEnum.SUCCESS.getValue()) {
|
|
|
|
+ refundTotal += amountInt;
|
|
|
|
+ refundValue += amountInt;
|
|
|
|
+ statisticalDataMap.put(refundKey, refundValue);
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
int size = list.size();
|
|
int size = list.size();
|
|
- List<ExcelCollectPojo> itemList = getStatisticsData(size, payTotal, refundTotal, list);
|
|
|
|
|
|
+ List<ExcelCollectPojo> itemList = getStatisticsData(size, payTotal, refundTotal,statisticalDataMap);
|
|
downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList, size);
|
|
downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList, size);
|
|
|
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
@@ -222,51 +242,30 @@ public class CheckUpOrderService {
|
|
* @param refundTotal 退款金额
|
|
* @param refundTotal 退款金额
|
|
* @return {@link List<ExcelCollectPojo> }
|
|
* @return {@link List<ExcelCollectPojo> }
|
|
*/
|
|
*/
|
|
- private List<ExcelCollectPojo> getStatisticsData(int size, int payTotal, int refundTotal, List<CheckUpOrder> itemList) {
|
|
|
|
|
|
+ private List<ExcelCollectPojo> getStatisticsData(int size, int payTotal, int refundTotal, Map<String, Integer> statisticalDataMap ) {
|
|
int startRows = size + 3;
|
|
int startRows = size + 3;
|
|
- int startColumn = 3;
|
|
|
|
|
|
+ int startColumn = 0;
|
|
|
|
|
|
List<ExcelCollectPojo> customExcelItemList = new ArrayList<>();
|
|
List<ExcelCollectPojo> customExcelItemList = new ArrayList<>();
|
|
- customExcelItemList.add(new ExcelCollectPojo(startColumn + 1, startRows , new String[]{"支付总额", FormatUtil.intShrink100ToStr(payTotal)}));
|
|
|
|
- customExcelItemList.add(new ExcelCollectPojo(startColumn + 3, startRows , new String[]{"退款总额", FormatUtil.intShrink100ToStr(refundTotal)}));
|
|
|
|
- customExcelItemList.add(new ExcelCollectPojo(startColumn + 5, startRows , new String[]{"实际支付总额", FormatUtil.intShrink100ToStr(payTotal - refundTotal)}));
|
|
|
|
-
|
|
|
|
-// startRows += 1;
|
|
|
|
-
|
|
|
|
- if (!Checker.isNone(itemList)) {
|
|
|
|
- List<Integer> integerList = itemList.stream().map(CheckUpOrder::getPaymentChannel).collect(Collectors.toList());
|
|
|
|
- integerList = integerList.stream().filter(p -> !Checker.isNone(p)).collect(Collectors.toList());
|
|
|
|
- // 去重
|
|
|
|
-
|
|
|
|
-// for (CheckUpOrder o : itemList){
|
|
|
|
-// int payChannel = Checker.getIntegerValue(o.getPaymentChannel());
|
|
|
|
-// integerList.add(payChannel);
|
|
|
|
-// }
|
|
|
|
- // 去重
|
|
|
|
-
|
|
|
|
- List<CheckUpOrder> paymentList = itemList;
|
|
|
|
- List<CheckUpOrder> refundList = itemList;
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- paymentList = paymentList.stream().filter(p -> Checker.getIntegerValue(p.getPaymentStatus()) == PaymentStatusEnum.Success.getValue()).collect(Collectors.toList());
|
|
|
|
- refundList = refundList.stream().filter(p -> Checker.getIntegerValue(p.getRefundStatus()) == RefundStatusEnum.SUCCESS.getValue()).collect(Collectors.toList());
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- if (!Checker.isNone(integerList)) {
|
|
|
|
- List<Integer> paymentChannelList = new ArrayList<Integer>(new TreeSet<Integer>(integerList));
|
|
|
|
- if (!Checker.isNone(paymentChannelList)) {
|
|
|
|
- for (int i = 0, j = paymentChannelList.size(); i < j; i++) {
|
|
|
|
- int paymentChannel = paymentChannelList.get(i).intValue();
|
|
|
|
- if (paymentChannel <= 0) continue;
|
|
|
|
- startRows += 1;
|
|
|
|
- String paymentChannelName = PaymentChannelEnum.getDisplayName(paymentChannel);
|
|
|
|
- // 按支付渠道统计
|
|
|
|
- int paymentAmount = paymentList.stream().filter(p -> Checker.getIntegerValue(p.getPaymentChannel()) == paymentChannel).mapToInt(CheckUpOrder::getAmount).sum();
|
|
|
|
- int refundAmount = refundList.stream().filter(p -> Checker.getIntegerValue(p.getPaymentChannel()) == paymentChannel).mapToInt(CheckUpOrder::getAmount).sum();
|
|
|
|
- customExcelItemList.add(new ExcelCollectPojo(startColumn + 1, startRows, new String[]{paymentChannelName + "支付总额", FormatUtil.intShrink100ToStr(paymentAmount)}));
|
|
|
|
- customExcelItemList.add(new ExcelCollectPojo(startColumn + 3, startRows, new String[]{paymentChannelName + "退款总额", FormatUtil.intShrink100ToStr(refundAmount)}));
|
|
|
|
- customExcelItemList.add(new ExcelCollectPojo(startColumn + 5, startRows, new String[]{paymentChannelName + "实际支付总额", FormatUtil.intShrink100ToStr(paymentAmount - refundAmount)}));
|
|
|
|
- }
|
|
|
|
|
|
+ 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();
|
|
|
|
+ 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 + 1, new String[]{paymentChannelName + "支付总额", FormatUtil.intShrink100ToStr(payValue)}));
|
|
|
|
+ customExcelItemList.add(new ExcelCollectPojo(startColumn + 3, startRows + 2, new String[]{paymentChannelName + "退款总额", FormatUtil.intShrink100ToStr(refundValue)}));
|
|
|
|
+ customExcelItemList.add(new ExcelCollectPojo(startColumn + 5, startRows + 5, new String[]{paymentChannelName + "实际支付总额", FormatUtil.intShrink100ToStr(payValue - refundValue)}));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -281,11 +280,14 @@ public class CheckUpOrderService {
|
|
String col3 = "交易日期*";
|
|
String col3 = "交易日期*";
|
|
String col4 = "订单号";
|
|
String col4 = "订单号";
|
|
String col5 = "类型";
|
|
String col5 = "类型";
|
|
- String[] columns = new String[]{col0, col1, col2, col3, col4, col5};
|
|
|
|
|
|
+ String col6 = "支付渠道";
|
|
|
|
+ String[] columns = new String[]{col0, col1, col2, col3, col4, col5, col6};
|
|
|
|
|
|
request.setPaymentStatus(PaymentStatusEnum.Success.getValue() + "");
|
|
request.setPaymentStatus(PaymentStatusEnum.Success.getValue() + "");
|
|
List<CheckUpOrder> checkUpOrderList = queryCheckUpOrderListCommon(request);
|
|
List<CheckUpOrder> checkUpOrderList = queryCheckUpOrderListCommon(request);
|
|
ExcelDataMap map = new ExcelDataMap(columns);
|
|
ExcelDataMap map = new ExcelDataMap(columns);
|
|
|
|
+ Map<String, Integer> statisticalDataMap = new HashMap<>();
|
|
|
|
+ int payTotal = 0, refundTotal = 0, realityTotal = 0, rowSize = 0;
|
|
if (!Checker.isNone(checkUpOrderList)) {
|
|
if (!Checker.isNone(checkUpOrderList)) {
|
|
// 得到支付的记录日志(需要从 order_payment 获取 transaction_id 字段)
|
|
// 得到支付的记录日志(需要从 order_payment 获取 transaction_id 字段)
|
|
List<OrderPayment> orderPaymentList = orderPaymentService.getOrderPaymentListByCheckUpOrderList(checkUpOrderList);
|
|
List<OrderPayment> orderPaymentList = orderPaymentService.getOrderPaymentListByCheckUpOrderList(checkUpOrderList);
|
|
@@ -313,12 +315,27 @@ public class CheckUpOrderService {
|
|
// 类型
|
|
// 类型
|
|
String typeStr = "体检缴费";
|
|
String typeStr = "体检缴费";
|
|
// String[] bodyStr = {type, transactionId, totalStr, paymentTimeStr, orderNo, typeStr};
|
|
// String[] bodyStr = {type, transactionId, totalStr, paymentTimeStr, orderNo, typeStr};
|
|
|
|
+
|
|
|
|
+ int paymentChannelInt = Checker.getIntegerValue(p.getPaymentChannel());
|
|
|
|
+ String paymentChannel = PaymentChannelEnum.getDisplayName(paymentChannelInt);
|
|
|
|
+
|
|
map.getStringListSafely(col0).add(type);
|
|
map.getStringListSafely(col0).add(type);
|
|
map.getStringListSafely(col1).add(transactionId);
|
|
map.getStringListSafely(col1).add(transactionId);
|
|
map.getStringListSafely(col2).add(totalStr);
|
|
map.getStringListSafely(col2).add(totalStr);
|
|
map.getStringListSafely(col3).add(paymentTimeStr);
|
|
map.getStringListSafely(col3).add(paymentTimeStr);
|
|
map.getStringListSafely(col4).add(orderNo);
|
|
map.getStringListSafely(col4).add(orderNo);
|
|
map.getStringListSafely(col5).add(typeStr);
|
|
map.getStringListSafely(col5).add(typeStr);
|
|
|
|
+ map.getStringListSafely(col6).add(paymentChannel);
|
|
|
|
+ rowSize++;
|
|
|
|
+
|
|
|
|
+ String payKey = ConstantDef.PAY_KEY_PREFIX + paymentChannelInt;
|
|
|
|
+ int payValue = statisticalDataMap.getOrDefault(payKey, 0);
|
|
|
|
+ int amountInt = Checker.getIntegerValue(p.getAmount());
|
|
|
|
+ if (Checker.getIntegerValue(p.getPaymentStatus()) == PaymentStatusEnum.Success.getValue()) {
|
|
|
|
+ payTotal += amountInt;
|
|
|
|
+ payValue += amountInt;
|
|
|
|
+ statisticalDataMap.put(payKey, payValue);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -339,6 +356,9 @@ public class CheckUpOrderService {
|
|
// 订单号
|
|
// 订单号
|
|
String orderNo = Checker.getStringValue(p.getOrderNo());
|
|
String orderNo = Checker.getStringValue(p.getOrderNo());
|
|
// 类型
|
|
// 类型
|
|
|
|
+ int paymentChannelInt = Checker.getIntegerValue(p.getPaymentChannel());
|
|
|
|
+ String paymentChannel = PaymentChannelEnum.getDisplayName(paymentChannelInt);
|
|
|
|
+
|
|
String typeName = "体检缴费";
|
|
String typeName = "体检缴费";
|
|
map.getStringListSafely(col0).add(type);
|
|
map.getStringListSafely(col0).add(type);
|
|
map.getStringListSafely(col1).add(transactionId);
|
|
map.getStringListSafely(col1).add(transactionId);
|
|
@@ -346,14 +366,25 @@ public class CheckUpOrderService {
|
|
map.getStringListSafely(col3).add(refundTimeStr);
|
|
map.getStringListSafely(col3).add(refundTimeStr);
|
|
map.getStringListSafely(col4).add(orderNo);
|
|
map.getStringListSafely(col4).add(orderNo);
|
|
map.getStringListSafely(col5).add(typeName);
|
|
map.getStringListSafely(col5).add(typeName);
|
|
|
|
+ map.getStringListSafely(col6).add(paymentChannel);
|
|
|
|
+
|
|
|
|
+ rowSize++;
|
|
|
|
+
|
|
|
|
+ String refundKey = ConstantDef.REFUND_KEY_PREFIX + paymentChannelInt;
|
|
|
|
+ int refundValue = statisticalDataMap.getOrDefault(refundKey, 0);
|
|
|
|
+ int amountInt = Checker.getIntegerValue(p.getAmount());
|
|
|
|
+ if (Checker.getIntegerValue(p.getRefundStatus()) == RefundStatusEnum.SUCCESS.getValue()) {
|
|
|
|
+ refundTotal += amountInt;
|
|
|
|
+ refundValue += amountInt;
|
|
|
|
+ statisticalDataMap.put(refundKey, refundValue);
|
|
|
|
+ }
|
|
|
|
|
|
-// String[] bodyStr = {type, transactionId, totalStr, refundTimeStr, orderNo, typeName};
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
int size = checkUpOrderList.size();
|
|
int size = checkUpOrderList.size();
|
|
- List<ExcelCollectPojo> itemList = new ArrayList<>();
|
|
|
|
|
|
+ List<ExcelCollectPojo> itemList = getStatisticsData(size, payTotal, refundTotal,statisticalDataMap);
|
|
downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList, size);
|
|
downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList, size);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
logger.error("/checkUp/downloadCheckUpOrderBillList(): {}", e.getMessage(), e);
|
|
logger.error("/checkUp/downloadCheckUpOrderBillList(): {}", e.getMessage(), e);
|