记得上下班打卡 | git大法好,push需谨慎

Commit 4e0fb890 authored by anjiabin's avatar anjiabin

优化支付代码

parent 63d24048
...@@ -66,9 +66,21 @@ public class AlipayBiz{ ...@@ -66,9 +66,21 @@ public class AlipayBiz{
// response.setSubCode("ACQ.TRADE_HAS_SUCCESS"); // response.setSubCode("ACQ.TRADE_HAS_SUCCESS");
log.info("alipay-alipayClient.sdkExecut->耗时:{}",(System.currentTimeMillis() - startTime)+"毫秒"); log.info("alipay-alipayClient.sdkExecut->耗时:{}",(System.currentTimeMillis() - startTime)+"毫秒");
// JSONObject responseJSON = JSONObject.parseObject(JSONObject.toJSONString(response)); // Map<String,Object> responseJSON = JsonUtils.OM().convertValue(response,Map.class);
Map<String,Object> responseJSON = JsonUtils.OM().convertValue(response,Map.class); Map<String,Object> responseJSON = ObjectUtil.cloneHashMapStringAndObj();
log.info("AlipayUtil-->tradeWapPay-->支付宝返回结果:{}", JsonUtils.toJson(response)); responseJSON.put("code",response.getCode());
responseJSON.put("msg",response.getMsg());
responseJSON.put("subCode",response.getSubCode());
responseJSON.put("subMsg",response.getSubMsg());
responseJSON.put("body",response.getBody());
responseJSON.put("merchantOrderNo",response.getMerchantOrderNo());
responseJSON.put("outTradeNo",response.getOutTradeNo());
responseJSON.put("sellerId",response.getSellerId());
responseJSON.put("totalAmount",response.getTotalAmount());
responseJSON.put("tradeNo",response.getTradeNo());
startTime = System.currentTimeMillis();
// log.info("AlipayUtil-->tradeWapPay-->支付宝返回结果:{}", JsonUtils.toJson(response));
log.info("AlipayUtil-->tradeWapPay-->支付宝返回结果 耗时:{}",(System.currentTimeMillis() - startTime)+"毫秒");
return responseJSON; return responseJSON;
} catch (Exception e) { } catch (Exception e) {
log.error("支付宝支付异常:{}", e); log.error("支付宝支付异常:{}", e);
......
...@@ -20,6 +20,7 @@ public class ObjectUtil { ...@@ -20,6 +20,7 @@ public class ObjectUtil {
private static final LinkedList<Object[]> linkedListObj = new LinkedList<Object[]>(); private static final LinkedList<Object[]> linkedListObj = new LinkedList<Object[]>();
private static final LinkedList<String> linkedListStr = new LinkedList<String>(); private static final LinkedList<String> linkedListStr = new LinkedList<String>();
private static final HashMap<String, String> hashMapStringAndString = new HashMap<>(); private static final HashMap<String, String> hashMapStringAndString = new HashMap<>();
private static final HashMap<String, Object> hashMapStringAndObj = new HashMap<>();
private static final AlipayTradeWapPayRequest alipayTradeWapPayRequest = new AlipayTradeWapPayRequest(); private static final AlipayTradeWapPayRequest alipayTradeWapPayRequest = new AlipayTradeWapPayRequest();
private static final JSONObject jsonObjectObj = new JSONObject(); private static final JSONObject jsonObjectObj = new JSONObject();
...@@ -35,6 +36,10 @@ public class ObjectUtil { ...@@ -35,6 +36,10 @@ public class ObjectUtil {
return (HashMap<String, String>) hashMapStringAndString.clone(); return (HashMap<String, String>) hashMapStringAndString.clone();
} }
public static HashMap<String, Object> cloneHashMapStringAndObj() {
return (HashMap<String, Object>) hashMapStringAndObj.clone();
}
public static AlipayTradeWapPayRequest cloneAlipayTradeWapPayRequest() { public static AlipayTradeWapPayRequest cloneAlipayTradeWapPayRequest() {
return alipayTradeWapPayRequest; return alipayTradeWapPayRequest;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment