|
@@ -11,6 +11,9 @@ import com.miaxis.common.core.domain.entity.SysDictData;
|
|
import com.miaxis.common.enums.OrderStatusEnum;
|
|
import com.miaxis.common.enums.OrderStatusEnum;
|
|
import com.miaxis.common.exception.CustomException;
|
|
import com.miaxis.common.exception.CustomException;
|
|
import com.miaxis.common.utils.uuid.CommonUtils;
|
|
import com.miaxis.common.utils.uuid.CommonUtils;
|
|
|
|
+import com.miaxis.exam.domain.ExamInfo;
|
|
|
|
+import com.miaxis.exam.service.IExamInfoService;
|
|
|
|
+import com.miaxis.examvip.service.IVipUserExamService;
|
|
import com.miaxis.newgzpt.domain.GzptUserInfo;
|
|
import com.miaxis.newgzpt.domain.GzptUserInfo;
|
|
import com.miaxis.newgzpt.service.IGzptSchActivationService;
|
|
import com.miaxis.newgzpt.service.IGzptSchActivationService;
|
|
import com.miaxis.newgzpt.service.IGzptSchPayConfigService;
|
|
import com.miaxis.newgzpt.service.IGzptSchPayConfigService;
|
|
@@ -18,6 +21,7 @@ import com.miaxis.newgzpt.service.IGzptUserInfoService;
|
|
import com.miaxis.system.service.ISysDictDataService;
|
|
import com.miaxis.system.service.ISysDictDataService;
|
|
import com.miaxis.wx.domain.WxJsOrder;
|
|
import com.miaxis.wx.domain.WxJsOrder;
|
|
import com.miaxis.wx.dto.WxOrderDTO;
|
|
import com.miaxis.wx.dto.WxOrderDTO;
|
|
|
|
+import com.miaxis.wx.dto.WxOrderGoodsDTO;
|
|
import com.miaxis.wx.service.IWxJsOrderService;
|
|
import com.miaxis.wx.service.IWxJsOrderService;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
@@ -84,6 +88,14 @@ public class WxJsjpController extends BaseController {
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private IGzptSchActivationService schActivationService;
|
|
private IGzptSchActivationService schActivationService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private IVipUserExamService vipUserExamService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private IExamInfoService examInfoService;
|
|
|
|
+
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 微信支付获取预订单id
|
|
* 微信支付获取预订单id
|
|
*/
|
|
*/
|
|
@@ -145,6 +157,39 @@ public class WxJsjpController extends BaseController {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 微信支付获取预订单id
|
|
|
|
+ */
|
|
|
|
+ @PostMapping(value = "/getPrepareGoodsOrder")
|
|
|
|
+ @ApiOperation("微信商品下单")
|
|
|
|
+ public Response<WxParamEntity> getPrepareGoodsOrder(@RequestBody WxOrderGoodsDTO wxOrderGoodsDTO) throws Exception{
|
|
|
|
+ if(wxOrderGoodsDTO.getGoodsType()==1) {
|
|
|
|
+ int count = vipUserExamService.getUserExamByUserIdAndGoodsId(wxOrderGoodsDTO.getUserId(), wxOrderGoodsDTO.getGoodsId());
|
|
|
|
+ if (count > 0) {
|
|
|
|
+ throw new CustomException("您已购买过该考场,退回上个页面,重新进入。");
|
|
|
|
+ }
|
|
|
|
+ ExamInfo examInfo = examInfoService.getById(wxOrderGoodsDTO.getGoodsId());
|
|
|
|
+ //创建本地微信订单
|
|
|
|
+ WxJsOrder order = new WxJsOrder();
|
|
|
|
+ String orderCode = getOrderCode(wxOrderGoodsDTO.getUserId());
|
|
|
|
+ order.setGoodsId(wxOrderGoodsDTO.getGoodsId());
|
|
|
|
+ order.setGoodsName(examInfo.getName());
|
|
|
|
+ order.setGoodsType(1);
|
|
|
|
+ order.setOutTradeNo(orderCode);
|
|
|
|
+ order.setUserId(wxOrderGoodsDTO.getUserId());
|
|
|
|
+ order.setPhoneType(wxOrderGoodsDTO.getPhoneType()); //手机类型 1:苹果 2:安卓
|
|
|
|
+ order.setTotal(examInfo.getPrice());
|
|
|
|
+ order.setOrderStatus(OrderStatusEnum.PROCESSING.getCode());
|
|
|
|
+ wxJsOrderService.save(order);
|
|
|
|
+ return Response.success(placeWxOrder(order, examInfo.getName()));
|
|
|
|
+ } else if (wxOrderGoodsDTO.getGoodsType()==2) {
|
|
|
|
+ throw new CustomException("请正确传入GoodsType,GoodsType=2未开发");
|
|
|
|
+ } else {
|
|
|
|
+ throw new CustomException("请正确传入GoodsType。");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
//下单
|
|
//下单
|
|
private WxParamEntity placeWxOrder(WxJsOrder order, String goodsName) throws Exception {
|
|
private WxParamEntity placeWxOrder(WxJsOrder order, String goodsName) throws Exception {
|