Преглед изворни кода

fix 调整挂号订单对账接口

DYH2020 пре 2 година
родитељ
комит
990f7cbf0a
1 измењених фајлова са 15 додато и 21 уклоњено
  1. 15 21
      src/main/java/com/ywt/mg/services/RegisteredOrderService.java

+ 15 - 21
src/main/java/com/ywt/mg/services/RegisteredOrderService.java

@@ -359,9 +359,6 @@ public class RegisteredOrderService {
             List<RegisteredOrder> valueList = new ArrayList();
             ExcelDataMap map = new ExcelDataMap(columns);
             if (!Checker.isNone(registeredOrderList)) {
-//                valueList.addAll(registeredOrderList.getItems());
-//                int size = registeredOrderList.getTotalPage();
-//                List<RegisteredOrder> lst = registeredOrderList.getItems();
                 List<MedicalCard> medicalCardList = getMedicalCardListByRegisteredOrderList(registeredOrderList);
                 List<OrderPayment> orderPaymentList = orderPaymentService.getOrderPaymentListByRegisteredOrderList(registeredOrderList);
                 SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd");
@@ -392,9 +389,6 @@ public class RegisteredOrderService {
                         cardNo = Checker.getStringValue(medicalCard.getCardNo());
                     }
                     String transactionId = orderPaymentService.getTransactionIdByOrderId(orderPaymentList, Checker.getIntegerValue(p.getOrderId()));
-//                    String[] bodyStr = {p.getOrderNo(), p.getPaymentNo(), transactionId, p.getPatientName(), patientMobile, cardNo,
-//                            p.getDoctorName(), p.getDeptName(), totalStr, registeredTime, source,
-//                            typeName, registeredStatus, paymentStatus, createTime, cancelRemark};
                     if (hosp > 0) {
                         map.getStringListSafely(col0).add(p.getOrderNo());
                         map.getStringListSafely(col1).add(p.getPaymentNo());
@@ -441,7 +435,7 @@ public class RegisteredOrderService {
             if (!Checker.isNone(request.getRegisteredEndTime())) {
                 billEndTime = DateUtil.stringToDate(request.getRegisteredEndTime() + ConstantDef.BILL_TIME_END_FORMAT);
             }
-            List<ExcelCollectPojo> itemList = getStatisticsData(billStartTime, billEndTime, registeredOrderList);
+            List<ExcelCollectPojo> itemList = getStatisticsData(size, billStartTime, billEndTime, registeredOrderList);
             downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList, size);
 
         } catch (Exception e) {
@@ -554,10 +548,9 @@ public class RegisteredOrderService {
         return backDate;
     }
 
-    private List<ExcelCollectPojo> getStatisticsData(Date billStartTime, Date billEndTime, List<RegisteredOrder> itemList) {
+    private List<ExcelCollectPojo> getStatisticsData(int size, Date billStartTime, Date billEndTime, List<RegisteredOrder> itemList) {
         List<ExcelCollectPojo> customExcelItemList = new ArrayList<>();
         if (Checker.isNone(itemList)) return customExcelItemList;
-        int size = itemList.size();
         List<RegisteredOrder> paymentList = itemList;
         List<RegisteredOrder> refundList = itemList;
         if (!Checker.isNone(billStartTime)) {
@@ -570,12 +563,13 @@ public class RegisteredOrderService {
         }
         int payTotal = paymentList.stream().filter(p -> Checker.getIntegerValue(p.getPaymentStatus()) == PaymentStatusEnum.Success.getValue()).mapToInt(RegisteredOrder::getTotal).sum();
         int refundTotal = refundList.stream().filter(p -> Checker.getIntegerValue(p.getRefundStatus()) == RefundStatusEnum.SUCCESS.getValue()).mapToInt(RegisteredOrder::getTotal).sum();
-        int startRows = size + 3;
-        int startColumn = 3;
 
-        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)}));
+        int startRows = size + 1;
+        int startColumn = 0;
+
+        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)}));
         if (!Checker.isNone(itemList)) {
             List<Integer> integerList = itemList.stream().map(RegisteredOrder::getPaymentChannel).collect(Collectors.toList());
             // 去重
@@ -589,9 +583,9 @@ public class RegisteredOrderService {
                     // 按支付渠道统计
                     int paymentAmount = paymentList.stream().filter(p -> Checker.getIntegerValue(p.getPaymentChannel()) == paymentChannel).mapToInt(RegisteredOrder::getTotal).sum();
                     int refundAmount = refundList.stream().filter(p -> Checker.getIntegerValue(p.getPaymentChannel()) == paymentChannel).mapToInt(RegisteredOrder::getTotal).sum();
-                    customExcelItemList.add(new ExcelCollectPojo(startColumn + 1, startRows + 1, new String[]{paymentChannelName + "支付总额", FormatUtil.intShrink100ToStr(paymentAmount)}));
-                    customExcelItemList.add(new ExcelCollectPojo(startColumn + 3, startRows + 1, new String[]{paymentChannelName + "退款总额", FormatUtil.intShrink100ToStr(refundAmount)}));
-                    customExcelItemList.add(new ExcelCollectPojo(startColumn + 5, startRows + 1, new String[]{paymentChannelName + "实际支付金额", FormatUtil.intShrink100ToStr(paymentAmount - refundAmount)}));
+                    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)}));
                 }
             }
         }
@@ -610,7 +604,7 @@ public class RegisteredOrderService {
             String col5 = "类型";
             String col6 = "支付渠道";
             String[] columns = new String[]{col0, col1, col2, col3, col4, col5, col6};
-
+            int size = 1;
             List<RegisteredOrder> registeredOrderList = queryRegisteredOrderList(request);
             ExcelDataMap map = new ExcelDataMap(columns);
             Date billStartTime = DateUtil.stringToDate(request.getBillStartTime() + ConstantDef.BILL_TIME_START_FORMAT);
@@ -620,7 +614,6 @@ public class RegisteredOrderService {
                 // 得到退款的记录日志(需要从 refund_log 获取 refund_id 字段)
                 List<RefundLog> refundLogList = refundLogService.getRefundLogListByRegisteredOrderList(registeredOrderList);
                 List<RegisteredOrder> refundRegisteredOrderList = new ArrayList<>(getRefundRegisteredOrderList(registeredOrderList));
-
                 for (RegisteredOrder p : registeredOrderList) {
                     if (!Checker.isNone(p) && Checker.getIntegerValue(p.getPaymentStatus()) == PaymentStatusEnum.Success.getValue()
                             && Checker.getIntegerValue(p.getTotal()) > 0
@@ -651,6 +644,7 @@ public class RegisteredOrderService {
                             map.getStringListSafely(col4).add(orderNo);
                             map.getStringListSafely(col5).add(typeName);
                             map.getStringListSafely(col6).add(paymentChannel);
+                            size++;
                         }
                     }
                 }
@@ -681,12 +675,12 @@ public class RegisteredOrderService {
                             map.getStringListSafely(col4).add(orderNo);
                             map.getStringListSafely(col5).add(typeName);
                             map.getStringListSafely(col6).add(paymentChannel);
+                            size++;
                         }
                     }
                 }
             }
-            int size = registeredOrderList.size();
-            List<ExcelCollectPojo> itemList = getStatisticsData(billStartTime, billEndTime, registeredOrderList);
+            List<ExcelCollectPojo> itemList = getStatisticsData(size, billStartTime, billEndTime, registeredOrderList);
             downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList, size);
 
         } catch (Exception e) {