Prechádzať zdrojové kódy

fix 修改公司后台挂号订单下载以及对账下载接口

DYH2020 2 rokov pred
rodič
commit
aac3f6ae16

+ 15 - 0
src/main/java/com/ywt/mg/domain/entities/OrderPayment.java

@@ -272,6 +272,12 @@ public class OrderPayment implements Serializable {
   private String posTerminalTraceNo;
 
   /**
+   * 支付宝交易凭证号
+   */
+  @Column(name = "alipay_trade_no")
+  private String alipayTradeNo;
+
+  /**
    * 主键
    */
   public Integer getId() {
@@ -875,6 +881,14 @@ public class OrderPayment implements Serializable {
     this.posTerminalTraceNo = posTerminalTraceNo;
   }
 
+  public String getAlipayTradeNo() {
+    return alipayTradeNo;
+  }
+
+  public void setAlipayTradeNo(String alipayTradeNo) {
+    this.alipayTradeNo = alipayTradeNo;
+  }
+
   public String toString() {
     return "OrderPayment{id=" + id + 
       ", orderId=" + orderId + 
@@ -920,6 +934,7 @@ public class OrderPayment implements Serializable {
       ", posTransDate=" + posTransDate + 
       ", posTerminalId=" + posTerminalId + 
       ", posTerminalTraceNo=" + posTerminalTraceNo + 
+      ", alipayTradeNo=" + alipayTradeNo +
       "}";
   }
 }

+ 2 - 2
src/main/java/com/ywt/mg/domain/entities/OrderPaymentRepository.java

@@ -14,6 +14,6 @@ public interface OrderPaymentRepository extends JpaRepository<OrderPayment, Inte
     @Query(value = "select * from order_payment where order_no = ? order by id desc limit 1;", nativeQuery = true)
     OrderPayment getOrderPaymentByOrderNo(String orderNo);
 
-    @Query(value = "select * from order_payment where transaction_id = ? order by id desc limit 1;", nativeQuery = true)
-    OrderPayment getOrderPaymentByTransactionId(String transactionId);
+    @Query(value = "select * from order_payment where ( transaction_id = ? or alipay_trade_no = ? ) order by id desc limit 1;", nativeQuery = true)
+    OrderPayment getOrderPaymentByTransactionId(String transactionId, String alipayTradeNo);
 }

+ 4 - 1
src/main/java/com/ywt/mg/domain/models/enums/PaymentChannelEnum.java

@@ -10,7 +10,10 @@ public enum PaymentChannelEnum {
     MedicalCard("诊疗卡", 4),
     POS("pos机", 5),
     FREE("无须支付", 6),
-    MedicalInsurance("医保", 7);
+    MedicalInsurance("医保", 7),
+    ICBC("工行", 8),
+    PharmacyPOS("药店pos机", 9),
+    UNKNOWN("", 0);
 
     private final String displayName;
 

+ 11 - 0
src/main/java/com/ywt/mg/params/registeredOrder/RegisteredOrderListRequest.java

@@ -64,6 +64,9 @@ public class RegisteredOrderListRequest extends PageRequest implements Serializa
     @ApiModelProperty(value = "判断医院后台还是公司后台")
     private int hosp;
 
+    @ApiModelProperty(value = "支付流水号")
+    private String paymentno;
+
     public String getOrderno() {
         return orderno;
     }
@@ -207,4 +210,12 @@ public class RegisteredOrderListRequest extends PageRequest implements Serializa
     public void setHosp(int hosp) {
         this.hosp = hosp;
     }
+
+    public String getPaymentno() {
+        return paymentno;
+    }
+
+    public void setPaymentno(String paymentno) {
+        this.paymentno = paymentno;
+    }
 }

+ 7 - 1
src/main/java/com/ywt/mg/services/OrderPaymentService.java

@@ -133,7 +133,7 @@ public class OrderPaymentService extends ServiceBase {
      * @return {@link OrderPayment}
      */
     public OrderPayment getOrderPaymentByTransactionId(String transactionId) {
-        return orderPaymentRepository.getOrderPaymentByTransactionId(transactionId);
+        return orderPaymentRepository.getOrderPaymentByTransactionId(transactionId, transactionId);
     }
 
 
@@ -170,6 +170,9 @@ public class OrderPaymentService extends ServiceBase {
             if (orderPayment != null && !Checker.isNone(orderPayment.getTransactionId())) {
                 return orderPayment.getTransactionId();
             }
+            if (orderPayment != null && !Checker.isNone(orderPayment.getAlipayTradeNo())) {
+                return orderPayment.getAlipayTradeNo();
+            }
         }
         return "";
     }
@@ -198,6 +201,9 @@ public class OrderPaymentService extends ServiceBase {
             if (orderPayment != null && !Checker.isNone(orderPayment.getTransactionId())) {
                 return orderPayment.getTransactionId();
             }
+            if (orderPayment != null && !Checker.isNone(orderPayment.getAlipayTradeNo())) {
+                return orderPayment.getAlipayTradeNo();
+            }
         }
         return "";
     }

+ 19 - 8
src/main/java/com/ywt/mg/services/RegisteredOrderService.java

@@ -134,7 +134,7 @@ public class RegisteredOrderService {
                 // 把日期往后增加一天.整数往后推,负数往前移动
                 Calendar calendar = new GregorianCalendar();
                 calendar.setTime(date);
-                calendar.add(calendar.DATE, 1);
+                calendar.add(Calendar.DATE, 1);
                 // 这个时间就是日期往后推一天的结果
                 date = calendar.getTime();
 
@@ -157,7 +157,7 @@ public class RegisteredOrderService {
                 // 把日期往后增加一天.整数往后推,负数往前移动
                 Calendar calendar = new GregorianCalendar();
                 calendar.setTime(date);
-                calendar.add(calendar.DATE, 1);
+                calendar.add(Calendar.DATE, 1);
                 // 这个时间就是日期往后推一天的结果
                 date = calendar.getTime();
 
@@ -285,7 +285,7 @@ public class RegisteredOrderService {
                 // 把日期往后增加一天.整数往后推,负数往前移动
                 Calendar calendar = new GregorianCalendar();
                 calendar.setTime(date);
-                calendar.add(calendar.DATE, 1);
+                calendar.add(Calendar.DATE, 1);
                 // 这个时间就是日期往后推一天的结果
                 date = calendar.getTime();
                 paramList.add(date);
@@ -310,6 +310,14 @@ public class RegisteredOrderService {
                     whereSql += " and ( order_id = -1 )";
                 }
             }
+
+
+            String paymentno = request.getPaymentno();
+            if (!Checker.isNull(paymentno)) {
+                whereSql += " and ( payment_no like ?)";
+                paramList.add("%" + paymentno.trim() + "%");
+            }
+
         } catch (Exception e) {
             e.printStackTrace();
             logger.error("queryRegisteredOrderList:{},{}", e.getMessage(), e);
@@ -344,7 +352,7 @@ public class RegisteredOrderService {
             String[] columns = new String[]{col0, col1, col2, col3, col4, col5, col6, col7, col8, col9, col10,
                     col11, col12, col13, col14, col15};
             if (hosp > 0) {
-                columns = new String[]{col0, col1, col3, col4, col5, col6, col7, col8, col9, col10,
+                columns = new String[]{col0, col1, col2, col3, col4, col5, col6, col7, col8, col9, col10,
                         col11};
             }
             List<RegisteredOrder> registeredOrderList = queryRegisteredOrderList(request);
@@ -397,7 +405,7 @@ public class RegisteredOrderService {
                     if (hosp > 0) {
                         map.getStringListSafely(col0).add(p.getOrderNo());
                         map.getStringListSafely(col1).add(p.getPaymentNo());
-//                        map.getStringListSafely(col2).add(transactionId);
+                        map.getStringListSafely(col2).add(transactionId);
                         map.getStringListSafely(col3).add(p.getPatientName());
                         map.getStringListSafely(col4).add(patientMobile);
                         map.getStringListSafely(col5).add(cardNo);
@@ -566,7 +574,8 @@ public class RegisteredOrderService {
             String col3 = "交易日期*";
             String col4 = "订单号";
             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};
 
             List<RegisteredOrder> registeredOrderList = queryRegisteredOrderList(request);
             ExcelDataMap map = new ExcelDataMap(columns);
@@ -596,8 +605,9 @@ public class RegisteredOrderService {
                             // 类型
                             int typeInt = Checker.getIntegerValue(p.getRegisteredType());
                             String typeName = RegisteredTypeEnum.valueOf(typeInt).getDisplayName();
-
-//                            String[] bodyStr = {type, transactionId, totalStr, paymentTimeStr, orderNo, typeName};
+                            // 支付渠道
+                            int paymentChannelInt = Checker.getIntegerValue(p.getPaymentChannel());
+                            String paymentChannel = PaymentChannelEnum.getDisplayName(paymentChannelInt);
 
                             map.getStringListSafely(col0).add(type);
                             map.getStringListSafely(col1).add(transactionId);
@@ -605,6 +615,7 @@ public class RegisteredOrderService {
                             map.getStringListSafely(col3).add(paymentTimeStr);
                             map.getStringListSafely(col4).add(orderNo);
                             map.getStringListSafely(col5).add(typeName);
+                            map.getStringListSafely(col6).add(paymentChannel);
 
                         }
                     }