generated from root/miduo_server
master
parent
d5981259a5
commit
abcd85dfb1
|
@ -18,8 +18,11 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.ServletInputStream;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
@ -42,6 +45,26 @@ public class HaoGameRechargeController {
|
|||
|
||||
LOGGER.info("haoGameCallback body.length={} body={}", body.length(), body);
|
||||
|
||||
InputStream is = null;
|
||||
try {
|
||||
is = request.getInputStream();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
byte[] b = new byte[4096];
|
||||
for (int n; (n = is.read(b)) != -1; ) {
|
||||
sb.append(new String(b, 0, n));
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (null != is) {
|
||||
try {
|
||||
is.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// try {
|
||||
// BufferedReader reader = request.getReader();
|
||||
// StringBuilder sb = new StringBuilder();
|
||||
|
@ -54,17 +77,14 @@ public class HaoGameRechargeController {
|
|||
// if (body.isEmpty()) {
|
||||
// LOGGER.info("haoGameCallback body.isEmpty=");
|
||||
// }
|
||||
//
|
||||
HaoGameParamBean haoGameParamBean = JsonUtil.serializeToObject(body);
|
||||
LOGGER.info("haoGameCallback getOuttradeno={} getOpenid={} getSign={} ={}",haoGameParamBean.getOuttradeno(), haoGameParamBean.getOpenid(), haoGameParamBean.getSign(), haoGameParamBean.getExtra());
|
||||
// JsonUtil.getInstence().getGson().fromJson(buffer)
|
||||
HaoGameParamBean haoGameParamBean = JsonUtil.serializeToObject(body);
|
||||
LOGGER.info("haoGameCallback getOuttradeno={} getOpenid={} getSign={} ={}", haoGameParamBean.getOuttradeno(), haoGameParamBean.getOpenid(), haoGameParamBean.getSign(), haoGameParamBean.getExtra());
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
SortedMap<String, String> parameterMap = new TreeMap<>();
|
||||
if (parameterMap.isEmpty()) {
|
||||
LOGGER.info("data is null");
|
||||
|
|
|
@ -68,12 +68,13 @@ public class JsonUtil {
|
|||
|
||||
|
||||
public static HaoGameParamBean serializeToObject(String str) throws IOException, ClassNotFoundException {
|
||||
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(str.getBytes("UTF-8"));
|
||||
ObjectInputStream objectInputStream = new ObjectInputStream(byteArrayInputStream);
|
||||
HaoGameParamBean object = (HaoGameParamBean) objectInputStream.readObject();
|
||||
objectInputStream.close();
|
||||
byteArrayInputStream.close();
|
||||
return object;
|
||||
// ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(str.getBytes("UTF-8"));
|
||||
// ObjectInputStream objectInputStream = new ObjectInputStream(byteArrayInputStream);
|
||||
// HaoGameParamBean object = (HaoGameParamBean) objectInputStream.readObject();
|
||||
// objectInputStream.close();
|
||||
// byteArrayInputStream.close();
|
||||
HaoGameParamBean haoGameParamBean = gson.fromJson(str, HaoGameParamBean.class);
|
||||
return haoGameParamBean;
|
||||
}
|
||||
|
||||
public SortedMap<String, String> getParameterMapYX(HttpServletRequest request) {
|
||||
|
|
Loading…
Reference in New Issue