Commit ee1a9627 by chongli

小程序继续下单接口

parent 19626b37
......@@ -52,6 +52,19 @@ public abstract class AbstractOrderController<H extends AbstractOrderBean<T>, T,
return response;
}
@SuppressWarnings("unchecked")
@ResponseBody
@RequestMapping(value = "/continueWeiXinPay", method = RequestMethod.POST)
public Response<JSONObject> continueWeiXinPay(@RequestBody Request<H> request) {
Response<JSONObject> response = new Response<JSONObject>();
try {
response = this.getOrderService().continueWeiXinPay(request.getBody());
} catch (Exception e) {
e.printStackTrace();
}
return response;
}
@SuppressWarnings("unchecked")
@ResponseBody
......
......@@ -243,6 +243,29 @@ public abstract class AbstractOrderService<H extends AbstractOrderBean<T>, T> ex
}
protected void checkContinuePayParameters(H abstractOrderBean) {
if (null == abstractOrderBean.getOrderNo()) {
throw new OrderException(-11, "订单参数有误");
}
if (abstractOrderBean.getUid()==null||"".equals(abstractOrderBean.getUid())) {
throw new OrderException(-11, "订单参数有误");
}
}
public Response<JSONObject> continueWeiXinPay(H abstractOrderBean) throws Exception{
this.checkContinuePayParameters(abstractOrderBean);
UserExt userExt = getUserExtDao().getByUid(abstractOrderBean.getUid());
Order order = this.getOrderDao().getOrderByOrderNo(abstractOrderBean.getOrderNo());
Response<JSONObject> response = new Response<JSONObject>();
JSONObject jSONObject = new JSONObject();
response.setBody(jSONObject);
try {
jSONObject = WeiXinAtcion.weixinPlay(userExt.getMiniAppOpenId(),order.getAmount().multiply(new BigDecimal("100")).intValue(), order.getOrderNo()+"", this.getNotifyUrlForWeiXinPay(order), "dingqiu");
} catch (Exception e) {
e.printStackTrace();
}
return response;
}
protected void adjustOrderPayAmount(H abstractOrderBean) {
......@@ -1122,7 +1145,7 @@ public abstract class AbstractOrderService<H extends AbstractOrderBean<T>, T> ex
//调用微信下单的逻辑
UserExt userExt = getUserExtDao().getByUid(abstractOrderBean.getUid());
try {
jSONObject = WeiXinAtcion.weixinPlay(userExt.getMiniAppOpenId(),needPayAmount.multiply(new BigDecimal("100")).intValue(), order.getOrderId()+"", this.getNotifyUrlForWeiXinPay(order), "dingqiu");
jSONObject = WeiXinAtcion.weixinPlay(userExt.getMiniAppOpenId(),needPayAmount.multiply(new BigDecimal("100")).intValue(), order.getOrderNo()+"", this.getNotifyUrlForWeiXinPay(order), "dingqiu");
} catch (Exception e) {
e.printStackTrace();
}
......
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