|
|
@@ -8,6 +8,7 @@ import com.ruoyi.common.annotation.Anonymous;
|
|
|
import com.ruoyi.common.core.controller.BaseController;
|
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
import com.ruoyi.system.domain.PromotionUserCoupon;
|
|
|
+import com.ruoyi.system.domain.dto.ReceiveCouponDto;
|
|
|
import com.ruoyi.system.service.IPromotionUserCouponService;
|
|
|
import com.ruoyi.system.utils.Auth;
|
|
|
import com.ruoyi.system.utils.JwtUtil;
|
|
|
@@ -62,18 +63,16 @@ public class UserPromotionCouponController extends BaseController {
|
|
|
@Anonymous
|
|
|
@Auth
|
|
|
@PostMapping("/receive")
|
|
|
- public AjaxResult receive(@RequestHeader String token,@RequestBody Map<String, Object> params) {
|
|
|
+ public AjaxResult receive(@RequestHeader String token,@RequestBody ReceiveCouponDto dto) {
|
|
|
JwtUtil jwtUtil=new JwtUtil();
|
|
|
String userId = jwtUtil.getusid(token);
|
|
|
if (userId == null) {
|
|
|
return AjaxResult.error("请先登录");
|
|
|
}
|
|
|
- if (params.get("batchId") == null) {
|
|
|
+ if (dto.getBatchId() == null) {
|
|
|
return AjaxResult.error("参数错误:缺少batchId");
|
|
|
}
|
|
|
- Long batchId = Long.valueOf(params.get("batchId").toString());
|
|
|
- Long storeId = params.get("storeId") != null ? Long.valueOf(params.get("storeId").toString()) : null;
|
|
|
- PromotionUserCoupon coupon = userCouponService.receiveCoupon(Long.valueOf(userId), batchId, storeId);
|
|
|
+ PromotionUserCoupon coupon = userCouponService.receiveCoupon(Long.valueOf(userId), dto.getBatchId(), dto.getStoreId());
|
|
|
return AjaxResult.success("领取成功", coupon);
|
|
|
}
|
|
|
|