|
@@ -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.SysDictData;
|
|
|
import com.miaxis.common.core.domain.entity.UserInfo;
|
|
|
import com.miaxis.common.exception.CustomException;
|
|
|
import com.miaxis.common.utils.SecurityUtils;
|
|
|
import com.miaxis.common.utils.uuid.CommonUtils;
|
|
|
import com.miaxis.system.domain.SysConfig;
|
|
|
import com.miaxis.system.service.ISysConfigService;
|
|
|
+import com.miaxis.system.service.ISysDictDataService;
|
|
|
+import com.miaxis.system.service.ISysDictTypeService;
|
|
|
import com.miaxis.system.service.ISysUserService;
|
|
|
import com.miaxis.wx.domain.WxOrder;
|
|
|
import com.miaxis.wx.service.IWxOrderService;
|
|
@@ -38,6 +41,7 @@ import java.io.File;
|
|
|
import java.security.PrivateKey;
|
|
|
import java.security.Signature;
|
|
|
import java.util.Base64;
|
|
|
+import java.util.List;
|
|
|
|
|
|
import static com.miaxis.common.utils.OrderCodeFactory.getOrderCode;
|
|
|
|
|
@@ -70,6 +74,9 @@ public class WxController extends BaseController {
|
|
|
@Autowired
|
|
|
private ISysConfigService sysConfigService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ISysDictDataService sysDictDataService;
|
|
|
+
|
|
|
@Value("${app.appid}")
|
|
|
private String appid;
|
|
|
@Value("${wxpay.notifyUrl}")
|
|
@@ -100,12 +107,12 @@ public class WxController extends BaseController {
|
|
|
*/
|
|
|
@PostMapping(value = "/prepareOrder")
|
|
|
@ApiOperation("app端微信支付下单")
|
|
|
- public Response<WxParamEntity> getPrepareOrder( @ApiParam(name="type",value="1-超级vip 2-普通vip 3-升级高级vip")Integer type) throws Exception{
|
|
|
+ public Response<WxParamEntity> getPrepareOrder(@RequestParam @ApiParam(name="dictCode",value="字典编码")Long dictCode) throws Exception{
|
|
|
|
|
|
//兼容线上,app上线后删除
|
|
|
- if (type == null){
|
|
|
- type = 1;
|
|
|
- }
|
|
|
+// if (type == null){
|
|
|
+// type = 1;
|
|
|
+// }
|
|
|
//创建本地微信订单
|
|
|
WxOrder order = new WxOrder();
|
|
|
UserInfo student = SecurityUtils.getLoginUser().getStudent();
|
|
@@ -113,15 +120,12 @@ public class WxController extends BaseController {
|
|
|
order.setOutTradeNo(orderCode);
|
|
|
order.setAppOpenid(student.getAppOpenid());
|
|
|
order.setUnionId(student.getUnionId());
|
|
|
- String key = getKeyByType(type);
|
|
|
- SysConfig config = sysConfigService.selectConfigObjByKey(key);
|
|
|
- String goodsName = config.getConfigName();
|
|
|
- order.setGoodsName(goodsName);
|
|
|
- order.setOrderDataJson(Integer.valueOf(type).toString());
|
|
|
- wxOrderService.createVipOrder(order,type);
|
|
|
+
|
|
|
+ SysDictData sysDictData = sysDictDataService.selectDictDataById(dictCode);
|
|
|
+ wxOrderService.createVipOrder(order,sysDictData);
|
|
|
wxOrderService.save(order);
|
|
|
|
|
|
- return Response.success(placeWxOrder(order, goodsName));
|
|
|
+ return Response.success(placeWxOrder(order, order.getGoodsName()));
|
|
|
|
|
|
|
|
|
}
|
|
@@ -143,18 +147,18 @@ 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);
|
|
|
- }
|
|
|
+// /**
|
|
|
+// * 查询是否存在推荐码
|
|
|
+// */
|
|
|
+// @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);
|
|
|
+// }
|
|
|
|
|
|
|
|
|
//下单
|