|
@@ -7,7 +7,9 @@ import com.miaxis.common.config.WxpayConfig;
|
|
|
import com.miaxis.common.constant.Constants;
|
|
|
import com.miaxis.common.core.controller.BaseController;
|
|
|
import com.miaxis.common.core.domain.Response;
|
|
|
+import com.miaxis.common.core.domain.entity.SysDictData;
|
|
|
import com.miaxis.common.core.domain.entity.UserInfo;
|
|
|
+import com.miaxis.common.enums.OrderStatusEnum;
|
|
|
import com.miaxis.common.exception.CustomException;
|
|
|
import com.miaxis.common.utils.SecurityUtils;
|
|
|
import com.miaxis.common.utils.uuid.CommonUtils;
|
|
@@ -99,18 +101,29 @@ public class WxController extends BaseController {
|
|
|
@ApiOperation("微信支付下单")
|
|
|
public Response<JSONObject> getPrepareOrder(@RequestBody WxOrderDTO wxOrderDTO) throws Exception{
|
|
|
|
|
|
+
|
|
|
+ SysDictData sysDictData = dictDataService.selectDictDataById(wxOrderDTO.getDictCode());
|
|
|
+ String[] values = sysDictData.getDictValue().split(",");
|
|
|
//创建本地微信订单
|
|
|
+ WxOrder order = createOrder(values);
|
|
|
+ wxOrderService.save(order);
|
|
|
+ return Response.success(placeWxOrder(order, sysDictData.getDictLabel(),notifyUrl));
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private WxOrder createOrder(String[] values) {
|
|
|
WxOrder order = new WxOrder();
|
|
|
UserInfo student = SecurityUtils.getLoginUser().getStudent();
|
|
|
String orderCode = getOrderCode(student.getId());
|
|
|
order.setOutTradeNo(orderCode);
|
|
|
order.setOpenid(student.getOpenid());
|
|
|
- order.setGoodsType("1");
|
|
|
- wxOrderService.createVipOrder(order);
|
|
|
- wxOrderService.save(order);
|
|
|
- return Response.success(placeWxOrder(order, "学车vip充值",notifyUrl));
|
|
|
-
|
|
|
-
|
|
|
+ order.setOrderStatus(OrderStatusEnum.PROCESSING.getCode());
|
|
|
+ Double dprice = Double.valueOf(values[0]);
|
|
|
+ Double v =dprice* 100;
|
|
|
+ order.setTotal(v.intValue());
|
|
|
+ order.setOrderDataJson(values[2]);
|
|
|
+ return order;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -120,6 +133,7 @@ public class WxController extends BaseController {
|
|
|
@ApiOperation("微信支付下单-测试")
|
|
|
public Response<JSONObject> getPrepareOrderTest() throws Exception{
|
|
|
|
|
|
+
|
|
|
//创建本地微信订单
|
|
|
WxOrder order = new WxOrder();
|
|
|
UserInfo student = SecurityUtils.getLoginUser().getStudent();
|
|
@@ -128,7 +142,7 @@ public class WxController extends BaseController {
|
|
|
order.setOpenid(student.getOpenid());
|
|
|
order.setGoodsType("1");
|
|
|
wxOrderService.createVipOrder(order);
|
|
|
- wxOrderService.save(order);
|
|
|
+ //wxOrderService.save(order);
|
|
|
return Response.success(placeWxOrder(order, "学车vip充值", "http://jpcj-h5.zzxcx.net.zzxcx.net/prod-api/open-api/wx/notify/wxpay1"));
|
|
|
|
|
|
|