From 6df1b67b41840f2990e9d08fb14a0f5710516f30 Mon Sep 17 00:00:00 2001
From: java110 <928255095@qq.com>
Date: 星期三, 23 十二月 2020 09:41:10 +0800
Subject: [PATCH] 优化代码 手机支付问题

---
 service-front/src/main/java/com/java110/front/smo/payment/adapt/wechatPay/WechatOweFeeToNotifyAdapt.java |   27 +++++++++++++++++++++++----
 1 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/service-front/src/main/java/com/java110/front/smo/payment/adapt/wechatPay/WechatOweFeeToNotifyAdapt.java b/service-front/src/main/java/com/java110/front/smo/payment/adapt/wechatPay/WechatOweFeeToNotifyAdapt.java
index b295f14..4c602c7 100644
--- a/service-front/src/main/java/com/java110/front/smo/payment/adapt/wechatPay/WechatOweFeeToNotifyAdapt.java
+++ b/service-front/src/main/java/com/java110/front/smo/payment/adapt/wechatPay/WechatOweFeeToNotifyAdapt.java
@@ -19,10 +19,9 @@
 import com.alibaba.fastjson.JSONObject;
 import com.java110.core.factory.WechatFactory;
 import com.java110.dto.fee.FeeDto;
-import com.java110.dto.rentingPool.RentingPoolDto;
 import com.java110.dto.smallWeChat.SmallWeChatDto;
 import com.java110.front.properties.WechatAuthProperties;
-import com.java110.front.smo.payment.adapt.IPayNotifyAdapt;
+import com.java110.front.smo.payment.adapt.IOweFeeToNotifyAdapt;
 import com.java110.utils.cache.CommonCache;
 import com.java110.utils.constant.CommonConstant;
 import com.java110.utils.constant.ServiceConstant;
@@ -48,7 +47,7 @@
  */
 
 @Component(value = "wechatOweFeeToNotifyAdapt")
-public class WechatOweFeeToNotifyAdapt implements IPayNotifyAdapt {
+public class WechatOweFeeToNotifyAdapt implements IOweFeeToNotifyAdapt {
 
     private static final Logger logger = LoggerFactory.getLogger(WechatOweFeeToNotifyAdapt.class);
 
@@ -140,13 +139,32 @@
         //鏌ヨ鐢ㄦ埛ID
         JSONObject paramIn = JSONObject.parseObject(order);
         paramIn.put("oId", orderId);
-        String url = ServiceConstant.SERVICE_API_URL + "/api/feeApi/payOweFee";
+        freshFees(paramIn);
+        String url = ServiceConstant.SERVICE_API_URL + "/api/fee.payOweFee";
         responseEntity = this.callCenterService(restTemplate, "-1", paramIn.toJSONString(), url, HttpMethod.POST);
 
         if (responseEntity.getStatusCode() != HttpStatus.OK) {
             return 0;
         }
         return 1;
+    }
+
+    private void freshFees(JSONObject paramIn) {
+        if (!paramIn.containsKey("fees")) {
+            return;
+        }
+
+        JSONArray fees = paramIn.getJSONArray("fees");
+        JSONObject fee = null;
+        for(int feeIndex = 0; feeIndex < fees.size();feeIndex ++){
+            fee = fees.getJSONObject(feeIndex);
+            if(fee.containsKey("deadlineTime")){
+                fee.put("startTime",fee.getString("endTime"));
+                fee.put("endTime",fee.getString("deadlineTime"));
+                fee.put("receivedAmount",fee.getString("feePrice"));
+                fee.put("state","");
+            }
+        }
     }
 
 
@@ -202,4 +220,5 @@
         return BeanConvertUtil.covertBean(smallWeChats.get(0), SmallWeChatDto.class);
     }
 
+
 }

--
Gitblit v1.8.0