play框架异步回调怎么写,和spring有哪些不同,求大神指教
代码:
route配置:POST /card/business/petrolCard/notify controllers.GateBusinessPetrolCard.notify()
controller中代码:
@With(SessionSet.class)
public void notify(HttpServletRequest request, HttpServletResponse response){
JSONObject js=new JSONObject();
request.setCharacterEncoding("UTF-8");
ServletInputStream in=request.getInputStream();
BufferedReader reader=new BufferedReader(new InputStreamReader(in));
String s="";
StringBuffer stringResult=new StringBuffer();
while((s=reader.readLine())!=null){
stringResult.append(s);
}
System.out.println("---------------------充值接口notifyURL接收到的参数--------------------"+stringResult);
JSONObject jsonData=JSONObject.fromObject(stringResult);
System.out.println("---------------------充值接口notifyURL返回参数--------------------"+jsonData);
String retcode=jsonData.getString("retcode");
String errMsg=jsonData.getString("errMsg");
String orderId=jsonData.getString("orderId")==null?"0":jsonData.getString("orderId");
String inTradeOrderNo=jsonData.getString("merchOrderId");
String dstatus=jsonData.getString("dstatus");
BookOrderService bookOrderService=(BookOrderService) Spring.getBean("bookOrderService");
BookOrder bookOrder=bookOrderService.selectBookOrderByBookOrderId(Long.parseLong(orderId));
if(retcode.equals("1000")&&dstatus.equals("00")){
bookOrder.setCheckOutStatus((short)1);
bookOrderService.updateBookOrderCheckStatus(bookOrder);
}
}