|
@@ -7,13 +7,16 @@ import com.ym.mec.biz.service.SysCouponCodeService;
|
|
|
import com.ym.mec.biz.service.SysCouponIssueRecordService;
|
|
|
import com.ym.mec.common.controller.BaseController;
|
|
|
import com.ym.mec.common.entity.HttpResponseResult;
|
|
|
+import com.ym.mec.common.exception.BizException;
|
|
|
import com.ym.mec.common.page.QueryInfo;
|
|
|
+import com.ym.mec.common.page.WrapperUtil;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.web.bind.annotation.PostMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import java.util.Map;
|
|
|
+import java.util.Optional;
|
|
|
|
|
|
@RequestMapping("sysCouponCode")
|
|
|
@Api(tags = "优惠券明细")
|
|
@@ -57,4 +60,31 @@ public class SysCouponCodeController extends BaseController {
|
|
|
return succeed(sysCouponCodeService.exchangeCouponTest(sysUser.getId(), couponId, paymentOrderId, exchangeNum));
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 手动领取优惠券
|
|
|
+ *
|
|
|
+ * @param param userId 领取者id
|
|
|
+ * @param param couponId 优惠券id
|
|
|
+ */
|
|
|
+ @ApiOperation("手动领取优惠券")
|
|
|
+ @PostMapping(value = "/manualIssueCoupon")
|
|
|
+ public HttpResponseResult manualIssueCoupon(@RequestBody Map<String, Object> param) {
|
|
|
+ Integer couponId = WrapperUtil.toInt(param, "couponId", "传入参数错误!");
|
|
|
+ couponIssueRecordService.manualIssueCoupon(getUserId(), couponId);
|
|
|
+ return succeed();
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation("查询优惠券发放记录")
|
|
|
+ @GetMapping(value = "/queryCanBeGet")
|
|
|
+ public HttpResponseResult queryCanBeGetCoupon() {
|
|
|
+ return succeed(couponIssueRecordService.queryCanBeGetCoupon(getUserId()));
|
|
|
+ }
|
|
|
+
|
|
|
+ private Integer getUserId() {
|
|
|
+ //修改机构基础信息
|
|
|
+ return Optional.ofNullable(sysUserFeignService.queryUserInfo())
|
|
|
+ .map(SysUser::getId)
|
|
|
+ .orElseThrow(() -> new BizException("用户信息获取失败,重新登录!"));
|
|
|
+ }
|
|
|
+
|
|
|
}
|