|
@@ -3,6 +3,7 @@ package com.ywt.mg.services;
|
|
|
import com.ywt.mg.core.utils.Checker;
|
|
|
import com.ywt.mg.core.utils.DateUtil;
|
|
|
import com.ywt.mg.core.utils.FormatUtil;
|
|
|
+import com.ywt.mg.domain.entities.NatOrder;
|
|
|
import com.ywt.mg.domain.entities.OrderPayment;
|
|
|
import com.ywt.mg.domain.entities.RefundLog;
|
|
|
import com.ywt.mg.domain.models.ConstantDef;
|
|
@@ -483,13 +484,7 @@ public class PrescriptionServices {
|
|
|
|
|
|
}
|
|
|
int size = prescriptionInfoList.size();
|
|
|
- List<ExcelCollectPojo> itemList = getStatisticsData(size, payTotal, refundTotal, weChatPay, weChatRefundTotal,
|
|
|
- aliPay, aliRefundTotal,
|
|
|
- cashPay, cashRefundTotal,
|
|
|
- medicalCardPay, medicalCardRefundTotal,
|
|
|
- posPay, posRefundTotal,
|
|
|
- medicalInsurancePay, medicalInsuranceRefundTotal,
|
|
|
- icbcPay, icbcRefundTotal, pharmacyPosPay, pharmacyPosRefundTotal);
|
|
|
+ List<ExcelCollectPojo> itemList = getStatisticsData(size, payTotal, refundTotal, prescriptionInfoList);
|
|
|
downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList, size);
|
|
|
|
|
|
|
|
@@ -561,60 +556,50 @@ public class PrescriptionServices {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private List<ExcelCollectPojo> getStatisticsData(int size, int payTotal, int refundTotal, int weChatPay, int weChatRefundTotal,
|
|
|
- int aliPay, int aliRefundTotal,
|
|
|
- int cashPay, int cashRefundTotal,
|
|
|
- int medicalCardPay, int medicalCardRefundTotal,
|
|
|
- int posPay, int posRefundTotal,
|
|
|
- int medicalInsurancePay, int medicalInsuranceRefundTotal,
|
|
|
- int icbcPay, int icbcRefundTotal, int pharmacyPosPay, int pharmacyPosRefundTotal) {
|
|
|
+ private List<ExcelCollectPojo> getStatisticsData(int size, int payTotal, int refundTotal, List<PrescriptionInfo> itemList) {
|
|
|
int startRows = size + 3;
|
|
|
int startColumn = 3;
|
|
|
|
|
|
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;
|
|
|
+ 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)}));
|
|
|
|
|
|
- customExcelItemList.add(new ExcelCollectPojo(startColumn + 1, startRows, new String[]{"微信支付总额", FormatUtil.intShrink100ToStr(weChatPay)}));
|
|
|
- customExcelItemList.add(new ExcelCollectPojo(startColumn + 3, startRows, new String[]{"微信退费总额", FormatUtil.intShrink100ToStr(weChatRefundTotal)}));
|
|
|
- customExcelItemList.add(new ExcelCollectPojo(startColumn + 5, startRows, new String[]{"微信实际支付金额", FormatUtil.intShrink100ToStr(weChatPay - weChatRefundTotal)}));
|
|
|
startRows += 1;
|
|
|
|
|
|
- customExcelItemList.add(new ExcelCollectPojo(startColumn + 1, startRows, new String[]{"支付宝支付", FormatUtil.intShrink100ToStr(aliPay)}));
|
|
|
- customExcelItemList.add(new ExcelCollectPojo(startColumn + 3, startRows, new String[]{"支付宝退费总额", FormatUtil.intShrink100ToStr(aliRefundTotal)}));
|
|
|
- customExcelItemList.add(new ExcelCollectPojo(startColumn + 5, startRows, new String[]{"支付宝实际金额", FormatUtil.intShrink100ToStr(aliPay - aliRefundTotal)}));
|
|
|
- startRows += 1;
|
|
|
+ if (!Checker.isNone(itemList)) {
|
|
|
|
|
|
- customExcelItemList.add(new ExcelCollectPojo(startColumn + 1, startRows, new String[]{"现金支付", FormatUtil.intShrink100ToStr(cashPay)}));
|
|
|
- customExcelItemList.add(new ExcelCollectPojo(startColumn + 3, startRows, new String[]{"现金退费总额", FormatUtil.intShrink100ToStr(cashRefundTotal)}));
|
|
|
- customExcelItemList.add(new ExcelCollectPojo(startColumn + 5, startRows, new String[]{"现金实际金额", FormatUtil.intShrink100ToStr(cashPay - cashRefundTotal)}));
|
|
|
- startRows += 1;
|
|
|
+ List<Integer> integerList = itemList.stream().map(PrescriptionInfo::getPaymentChannel).collect(Collectors.toList());
|
|
|
+ integerList = integerList.stream().filter(p -> !Checker.isNone(p)).collect(Collectors.toList());
|
|
|
+ // 去重
|
|
|
|
|
|
- customExcelItemList.add(new ExcelCollectPojo(startColumn + 1, startRows, new String[]{"诊疗卡支付", FormatUtil.intShrink100ToStr(medicalCardPay)}));
|
|
|
- customExcelItemList.add(new ExcelCollectPojo(startColumn + 3, startRows, new String[]{"诊疗卡退款总额", FormatUtil.intShrink100ToStr(medicalCardRefundTotal)}));
|
|
|
- customExcelItemList.add(new ExcelCollectPojo(startColumn + 5, startRows, new String[]{"诊疗卡实际支付金额", FormatUtil.intShrink100ToStr(medicalCardPay - medicalCardRefundTotal)}));
|
|
|
- startRows += 1;
|
|
|
+ List<PrescriptionInfo> paymentList = itemList;
|
|
|
+ List<PrescriptionInfo> refundList = itemList;
|
|
|
|
|
|
- customExcelItemList.add(new ExcelCollectPojo(startColumn + 1, startRows, new String[]{"平台POS机", FormatUtil.intShrink100ToStr(posPay)}));
|
|
|
- customExcelItemList.add(new ExcelCollectPojo(startColumn + 3, startRows, new String[]{"平台POS机退款总额", FormatUtil.intShrink100ToStr(posRefundTotal)}));
|
|
|
- customExcelItemList.add(new ExcelCollectPojo(startColumn + 5, startRows, new String[]{"平台POS机实际支付金额", FormatUtil.intShrink100ToStr(posPay - posRefundTotal)}));
|
|
|
- startRows += 1;
|
|
|
|
|
|
- customExcelItemList.add(new ExcelCollectPojo(startColumn + 1, startRows, new String[]{"医保支付", FormatUtil.intShrink100ToStr(medicalInsurancePay)}));
|
|
|
- customExcelItemList.add(new ExcelCollectPojo(startColumn + 3, startRows, new String[]{"医保退款总额", FormatUtil.intShrink100ToStr(medicalInsuranceRefundTotal)}));
|
|
|
- customExcelItemList.add(new ExcelCollectPojo(startColumn + 5, startRows, new String[]{"医保实际支付金额", FormatUtil.intShrink100ToStr(medicalInsurancePay - medicalInsuranceRefundTotal)}));
|
|
|
- startRows += 1;
|
|
|
+ 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());
|
|
|
|
|
|
- customExcelItemList.add(new ExcelCollectPojo(startColumn + 1, startRows, new String[]{"工行支付", FormatUtil.intShrink100ToStr(icbcPay)}));
|
|
|
- customExcelItemList.add(new ExcelCollectPojo(startColumn + 3, startRows, new String[]{"工行退款总额", FormatUtil.intShrink100ToStr(icbcRefundTotal)}));
|
|
|
- customExcelItemList.add(new ExcelCollectPojo(startColumn + 5, startRows, new String[]{"工行实际支付金额", FormatUtil.intShrink100ToStr(icbcPay - icbcRefundTotal)}));
|
|
|
|
|
|
- customExcelItemList.add(new ExcelCollectPojo(startColumn + 1, startRows, new String[]{"药店POS机", FormatUtil.intShrink100ToStr(pharmacyPosPay)}));
|
|
|
- customExcelItemList.add(new ExcelCollectPojo(startColumn + 3, startRows, new String[]{"药店POS机退款总额", FormatUtil.intShrink100ToStr(pharmacyPosRefundTotal)}));
|
|
|
- customExcelItemList.add(new ExcelCollectPojo(startColumn + 5, startRows, new String[]{"药店POS机实际支付金额", FormatUtil.intShrink100ToStr(pharmacyPosPay - pharmacyPosRefundTotal)}));
|
|
|
- startRows += 1;
|
|
|
+ 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(PrescriptionInfo::getTotalPrice).sum();
|
|
|
+ int refundAmount = refundList.stream().filter(p -> Checker.getIntegerValue(p.getPaymentChannel()) == paymentChannel).mapToInt(PrescriptionInfo::getTotalPrice).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)}));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
|
|
|
return customExcelItemList;
|
|
@@ -1069,13 +1054,7 @@ public class PrescriptionServices {
|
|
|
}
|
|
|
}
|
|
|
int size = prescriptionInfoList.size();
|
|
|
- List<ExcelCollectPojo> itemList = getStatisticsData(size, payTotal, refundTotal, weChatPay, weChatRefundTotal,
|
|
|
- aliPay, aliRefundTotal,
|
|
|
- cashPay, cashRefundTotal,
|
|
|
- medicalCardPay, medicalCardRefundTotal,
|
|
|
- posPay, posRefundTotal,
|
|
|
- medicalInsurancePay, medicalInsuranceRefundTotal,
|
|
|
- icbcPay, icbcRefundTotal, pharmacyPosPay, pharmacyPosRefundTotal);
|
|
|
+ List<ExcelCollectPojo> itemList = getStatisticsData(size, payTotal, refundTotal, prescriptionInfoList);
|
|
|
downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList, size);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -1222,13 +1201,7 @@ public class PrescriptionServices {
|
|
|
|
|
|
}
|
|
|
int size = prescriptionInfoList.size();
|
|
|
- List<ExcelCollectPojo> itemList = getStatisticsData(size, payTotal, refundTotal, weChatPay, weChatRefundTotal,
|
|
|
- aliPay, aliRefundTotal,
|
|
|
- cashPay, cashRefundTotal,
|
|
|
- medicalCardPay, medicalCardRefundTotal,
|
|
|
- posPay, posRefundTotal,
|
|
|
- medicalInsurancePay, medicalInsuranceRefundTotal,
|
|
|
- icbcPay, icbcRefundTotal, pharmacyPosPay, pharmacyPosRefundTotal);
|
|
|
+ List<ExcelCollectPojo> itemList = getStatisticsData(size, payTotal, refundTotal, prescriptionInfoList);
|
|
|
downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList, size);
|
|
|
|
|
|
|