From d339aeb296652aef7f5ab12344db75fc6588620e Mon Sep 17 00:00:00 2001
From: java110 <928255095@qq.com>
Date: 星期五, 03 九月 2021 03:39:03 +0800
Subject: [PATCH] 优化代码
---
service-front/src/main/java/com/java110/front/smo/payment/adapt/wechatPay/WechatOweFeeToNotifyAdapt.java | 29 ++++++++++++++++++++++-------
1 files changed, 22 insertions(+), 7 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
old mode 100644
new mode 100755
index 6b2c861..45d9894
--- 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,12 +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.IOweFeeToNotifySMO;
import com.java110.front.smo.payment.adapt.IOweFeeToNotifyAdapt;
-import com.java110.front.smo.payment.adapt.IPayNotifyAdapt;
import com.java110.utils.cache.CommonCache;
import com.java110.utils.constant.CommonConstant;
import com.java110.utils.constant.ServiceConstant;
@@ -40,7 +37,6 @@
import org.springframework.web.client.HttpStatusCodeException;
import org.springframework.web.client.RestTemplate;
-import javax.servlet.http.HttpServletRequest;
import java.util.*;
/**
@@ -70,7 +66,7 @@
* @return
* @throws Exception
*/
- public String confirmPayFee(String param) {
+ public String confirmPayFee(String param,String wId) {
String resXml = "";
try {
Map<String, Object> map = PayUtil.getMapFromXML(param);
@@ -143,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","");
+ }
+ }
}
@@ -178,9 +193,9 @@
responseEntity = new ResponseEntity<String>(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
} finally {
logger.debug("璇锋眰鍦板潃涓�,{} 璇锋眰涓績鏈嶅姟淇℃伅锛寋},涓績鏈嶅姟杩斿洖淇℃伅锛寋}", url, httpEntity, responseEntity);
- return responseEntity;
}
+ return responseEntity;
}
--
Gitblit v1.8.0