|
@@ -7,12 +7,15 @@ 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.SysUser;
|
|
|
import com.miaxis.common.core.domain.entity.UserInfo;
|
|
|
import com.miaxis.common.core.page.ResponsePageInfo;
|
|
|
import com.miaxis.common.exception.CustomException;
|
|
|
import com.miaxis.common.utils.SecurityUtils;
|
|
|
import com.miaxis.common.utils.uuid.CommonUtils;
|
|
|
+import com.miaxis.score.domain.ScoreInfo;
|
|
|
import com.miaxis.system.service.ISysDictDataService;
|
|
|
+import com.miaxis.system.service.ISysUserService;
|
|
|
import com.miaxis.wx.domain.WxOrder;
|
|
|
import com.miaxis.wx.dto.WxOrderCreateDTO;
|
|
|
import com.miaxis.wx.dto.WxOrderCreateFuluDTO;
|
|
@@ -69,6 +72,10 @@ public class WxController extends BaseController {
|
|
|
@Autowired
|
|
|
private ISysDictDataService dictDataService;
|
|
|
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ISysUserService sysUserService;
|
|
|
+
|
|
|
@Value("${app.appid}")
|
|
|
private String appid;
|
|
|
@Value("${wxpay.notifyUrl}")
|
|
@@ -99,7 +106,7 @@ public class WxController extends BaseController {
|
|
|
*/
|
|
|
@PostMapping(value = "/prepareOrder")
|
|
|
@ApiOperation("微信支付下单")
|
|
|
- public Response<WxParamEntity> getPrepareOrder() throws Exception{
|
|
|
+ public Response<WxParamEntity> getPrepareOrder(String referralCode) throws Exception{
|
|
|
|
|
|
//创建本地微信订单
|
|
|
WxOrder order = new WxOrder();
|
|
@@ -108,6 +115,10 @@ public class WxController extends BaseController {
|
|
|
order.setOutTradeNo(orderCode);
|
|
|
order.setOpenid(student.getOpenid());
|
|
|
order.setGoodsType("1");
|
|
|
+ SysUser sysUser = sysUserService.selectUserByReferralCode(referralCode);
|
|
|
+ if (sysUser != null){
|
|
|
+ order.setReferralUserId(sysUser.getUserId());
|
|
|
+ }
|
|
|
wxOrderService.createVipOrder(order);
|
|
|
wxOrderService.save(order);
|
|
|
return Response.success(placeWxOrder(order, "学车vip充值"));
|
|
@@ -116,6 +127,20 @@ public class WxController extends BaseController {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
+ * 查询是否存在推荐码
|
|
|
+ */
|
|
|
+ @GetMapping(value = "/{referralCode}")
|
|
|
+ @ApiOperation("查询是否存在推荐码")
|
|
|
+ public Response<Boolean> getInfo(
|
|
|
+ @ApiParam(name = "referralCode", value = "推荐码", required = true)
|
|
|
+ @PathVariable("referralCode") String referralCode
|
|
|
+ ){
|
|
|
+
|
|
|
+ return Response.success(sysUserService.selectUserByReferralCode(referralCode)!= null ? true :false);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
//下单
|
|
|
private WxParamEntity placeWxOrder(WxOrder order, String goodsName) throws Exception {
|
|
|
HttpPost httpPost = initHttpPost();
|