lighter 11 달 전
부모
커밋
2117a962e4

+ 0 - 3
src/main/java/thyyxxk/wxservice_server/entity/wxapi/WxPayOrder.java

@@ -47,9 +47,6 @@ public class WxPayOrder {
     private String hisOrdNum;
     private Integer mzyRequestId;
     private Integer yjReqNo;
-    /**
-     * 订单状态,99:初值,0:未支付,1:支付成功,2:已关闭,3:支付失败,4:已退款,5:已接收,等待扣款,6:用户支付中,7:退款失败
-     * */
     private Transaction.TradeStateEnum tradeState;
     private String refundOpCode;
     private String refundReason;

+ 3 - 0
src/main/java/thyyxxk/wxservice_server/factory/cytj/CytjService.java

@@ -4,6 +4,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.web.client.RestTemplate;
 import thyyxxk.wxservice_server.entity.wxapi.WxPayOrder;
 import thyyxxk.wxservice_server.factory.cytj.model.NotifyBody;
+import thyyxxk.wxservice_server.utils.DateUtil;
 import thyyxxk.wxservice_server.utils.DecimalTool;
 
 /**
@@ -25,6 +26,8 @@ public class CytjService {
         notifyBody.setTradeNo(params.getTradeNo());
         notifyBody.setTotalAmt(DecimalTool.moneyYuanToFen(params.getTotalFee()));
         notifyBody.setSglcheckid(params.getSglCheckId());
+        notifyBody.setTradeState(params.getTradeState());
+        notifyBody.setPayTime(DateUtil.formatDatetime(params.getPayDatetime()));
         return notifyBody;
     }
 

+ 3 - 0
src/main/java/thyyxxk/wxservice_server/factory/cytj/model/NotifyBody.java

@@ -1,5 +1,6 @@
 package thyyxxk.wxservice_server.factory.cytj.model;
 
+import com.wechat.pay.java.service.payments.model.Transaction;
 import lombok.Data;
 
 @Data
@@ -8,4 +9,6 @@ public class NotifyBody {
     private Integer totalAmt;
     private String patientId;
     private String sglcheckid;
+    private Transaction.TradeStateEnum tradeState;
+    private String payTime;
 }

+ 4 - 1
src/main/java/thyyxxk/wxservice_server/service/WxApiService.java

@@ -19,6 +19,7 @@ import thyyxxk.wxservice_server.entity.wxapi.JsApiSHA1;
 import thyyxxk.wxservice_server.entity.wxapi.GenMzPayQrcodeParam;
 import thyyxxk.wxservice_server.entity.wxapi.WxPayOrder;
 import thyyxxk.wxservice_server.entity.wxapi.WxPyQrcdPrm;
+import thyyxxk.wxservice_server.factory.cytj.CytjService;
 import thyyxxk.wxservice_server.factory.wechatpay.WeChatPayService;
 import thyyxxk.wxservice_server.factory.wechatpay.model.NativePayResponse;
 import thyyxxk.wxservice_server.factory.wechatpay.model.WechatPayGlobalRequest;
@@ -189,7 +190,9 @@ public class WxApiService {
                     case INPATIENT_PRE_PAY:
                         return savePayResultService.saveZyYjjInfo(order, successTime);
                     case SELF_HELP_MACHINE:
+                        return "订单已支付。";
                     case INSPECTIONS:
+                        new CytjService().notifyPaymentSuccess(order);
                         return "订单已支付。";
                     case COUPON_PURCHASE:
                         return savePayResultService.saveCouponPurchase(order, successTime);
@@ -268,7 +271,7 @@ public class WxApiService {
         order.setBody(orderTypeName);
         order.setOpenid("");
         order.setTotalFee(DecimalTool.moneyFenToYuan(param.getTotalAmt()));
-        order.setPatientId(param.getPatientId());
+        order.setPatientId(param.getPatientId().trim());
         order.setPatientName(patName);
         order.setMchId(PropertiesUtil.getLocalProperty("mchId"));
         order.setTimeStamp(String.valueOf(timesStamp));

+ 2 - 1
src/main/java/thyyxxk/wxservice_server/service/WxPayNotifyService.java

@@ -35,9 +35,10 @@ public class WxPayNotifyService {
         Transaction transaction = new WeChatPayService().decryptNotify(request);
         String tradeNo = transaction.getOutTradeNo();
         WxPayOrder order = dao.selectOrderByTradeNo(tradeNo);
+
         Transaction.TradeStateEnum tradeState = order.getTradeState();
         if (order.getOrderType() == OrderType.INSPECTIONS.getCode()
-                && tradeState == Transaction.TradeStateEnum.SUCCESS) {
+                && transaction.getTradeState() == Transaction.TradeStateEnum.SUCCESS) {
             new CytjService().notifyPaymentSuccess(order);
         }
 

+ 1 - 5
src/main/java/thyyxxk/wxservice_server/utils/DateUtil.java

@@ -22,11 +22,7 @@ public class DateUtil {
     }
 
     public static String formatDatetime(Date date) {
-        if (null == date) {
-            date = new Date();
-        }
-        SimpleDateFormat sdf = new SimpleDateFormat(DEFAULT_PATTERN);
-        return sdf.format(date);
+        return formatDatetime(date, DEFAULT_PATTERN);
     }
 
     public static String formatDatetime(Date date, String pattern) {