疯体ios支付修改

master
duhui 2022-07-14 14:55:50 +08:00
parent 58a8575a56
commit 96987cec3b
1 changed files with 15 additions and 5 deletions

View File

@ -1,5 +1,6 @@
package com.jmfy.controller;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.jmfy.paramBean.PaySdkEnum;
@ -8,12 +9,14 @@ import com.jmfy.util.MD5Util;
import net.sf.json.JSON;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.io.InputStreamReader;
import java.security.KeyFactory;
import java.security.Signature;
import java.security.interfaces.RSAPublicKey;
@ -27,11 +30,18 @@ import java.util.*;
public class OhayooGetExternalController {
private static final Logger LOGGER = LoggerFactory.getLogger(OhayooGetExternalController.class);
@RequestMapping(value = "/ohayooGetExternal", method = {RequestMethod.POST, RequestMethod.GET})
@PostMapping(value = "/ohayooGetExternal")
public String ohayooGetExternal(HttpServletRequest request) throws Exception {
HashMap<String, String> parameterMap = JsonUtil.getInstence().getParameterMap2(request);
TreeMap<String, String> map = new TreeMap<>(parameterMap);
Gson gson = new Gson();
TreeMap<String, String> map = new TreeMap<>();
InputStreamReader insr = new InputStreamReader(request.getInputStream(),"utf-8");
String result = "";
int respInt = insr.read();
while(respInt != -1) {
result += (char) respInt;
respInt = insr.read();
}
map = gson.fromJson(result, map.getClass());
LOGGER.info("ohayoo获取前端参数{}",map);
if (map == null || map.isEmpty()) {
return null;
@ -46,7 +56,7 @@ public class OhayooGetExternalController {
String sign = MD5Util.encrypByMd5(payKey + externalOrder + payKey);
map.put("sign",sign);
Gson gson = new Gson();
LOGGER.info("ohayoo返回前端参数{}",gson.toJson(map));
return gson.toJson(map);