Commit 3b22ec82 by chongli

微信小程序

parent 147382ac
...@@ -3,6 +3,10 @@ ...@@ -3,6 +3,10 @@
*/ */
package com.ctrip.fun.golf.api.payment; package com.ctrip.fun.golf.api.payment;
import java.io.BufferedReader;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
...@@ -10,11 +14,11 @@ import org.springframework.web.bind.annotation.RequestBody; ...@@ -10,11 +14,11 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import com.ctrip.fun.common.vo.payment.NotifyResponseBean; import com.ctrip.fun.common.vo.payment.NotifyResponseBean;
import com.ctrip.fun.common.vo.payment.PaymentResponse; import com.ctrip.fun.common.vo.payment.PaymentResponse;
import com.ctrip.fun.golf.service.payment.NotifyService; import com.ctrip.fun.golf.service.payment.NotifyService;
/** /**
* @author zgsong * @author zgsong
* @version 1.0.0 * @version 1.0.0
...@@ -40,15 +44,26 @@ public class NotifyController { ...@@ -40,15 +44,26 @@ public class NotifyController {
} }
/** /**
* 支付通知 * 微信支付通知
*
* @param createPayOrderRequestBean CreatePayOrderRequestBean
*/ */
@RequestMapping(value = "/notifyForMiniApp", produces = "application/json;charset=UTF-8")
@ResponseBody @ResponseBody
@RequestMapping(value = "/miniApp", method = RequestMethod.POST) public String notifyForMiniApp(HttpServletRequest request,HttpServletResponse response) throws Exception{
public Object notifyForMiniApp(@RequestBody PaymentResponse paymentResponse,@PathVariable String orderType) { BufferedReader reader = null;
NotifyResponseBean notifyResponseBean = this.notifyService.notify(paymentResponse,orderType); reader = request.getReader();
return notifyResponseBean; String line = "";
String xmlString = null;
StringBuffer inputString = new StringBuffer();
while ((line = reader.readLine()) != null) {
inputString.append(line);
}
xmlString = inputString.toString();
request.getReader().close();
System.out.println("----接收到的数据如下:---" + xmlString);
this.notifyService.notifyForMiniApp(xmlString);
response.getWriter().write("<xml><return_code><![CDATA[SUCCESS]]></return_code></xml>");
return null;
} }
......
...@@ -36,6 +36,18 @@ public class NotifyService { ...@@ -36,6 +36,18 @@ public class NotifyService {
return response; return response;
} }
/**
* @param paymentResponse
* @return
*/
public String notifyForMiniApp(String xml) {
HttpEntity<String> entity = new HttpEntity<String>(xml);
String response = restTemplate.exchange(this.getServerBaseNotifyPath()+"/communeOrder/notifyForMiniApp", HttpMethod.POST, entity, new ParameterizedTypeReference<String>() {
}).getBody();
return response;
}
public RestTemplate getRestTemplate() { public RestTemplate getRestTemplate() {
return restTemplate; return restTemplate;
......
...@@ -28,7 +28,7 @@ public class VoucherGetLogBean implements Serializable { ...@@ -28,7 +28,7 @@ public class VoucherGetLogBean implements Serializable {
/** /**
* 抢券时间 * 抢券时间
*/ */
private Date getTime; private Date createTime;
public Integer getId() { public Integer getId() {
return id; return id;
...@@ -46,10 +46,6 @@ public class VoucherGetLogBean implements Serializable { ...@@ -46,10 +46,6 @@ public class VoucherGetLogBean implements Serializable {
return voucherid; return voucherid;
} }
public Date getGetTime() {
return getTime;
}
public void setId(Integer id) { public void setId(Integer id) {
this.id = id; this.id = id;
} }
...@@ -66,7 +62,13 @@ public class VoucherGetLogBean implements Serializable { ...@@ -66,7 +62,13 @@ public class VoucherGetLogBean implements Serializable {
this.voucherid = voucherid; this.voucherid = voucherid;
} }
public void setGetTime(Date getTime) { public Date getCreateTime() {
this.getTime = getTime; return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
} }
} }
...@@ -55,6 +55,11 @@ public class CommuneOrderBean extends AbstractOrderBean<CommuneOrderResourceBean ...@@ -55,6 +55,11 @@ public class CommuneOrderBean extends AbstractOrderBean<CommuneOrderResourceBean
* *
*/ */
private Integer communeYears; private Integer communeYears;
/**
*
* 推荐人uid
*/
private String recommendUid;
public String getRecommendCode() { public String getRecommendCode() {
return recommendCode; return recommendCode;
...@@ -137,4 +142,12 @@ public class CommuneOrderBean extends AbstractOrderBean<CommuneOrderResourceBean ...@@ -137,4 +142,12 @@ public class CommuneOrderBean extends AbstractOrderBean<CommuneOrderResourceBean
this.communeYears = communeYears; this.communeYears = communeYears;
} }
public String getRecommendUid() {
return recommendUid;
}
public void setRecommendUid(String recommendUid) {
this.recommendUid = recommendUid;
}
} }
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 sign in to comment