|
|
@@ -0,0 +1,79 @@
|
|
|
+package com.fs.company.controller.live;
|
|
|
+
|
|
|
+import com.fs.common.annotation.Log;
|
|
|
+import com.fs.common.core.controller.BaseController;
|
|
|
+import com.fs.common.core.domain.AjaxResult;
|
|
|
+import com.fs.common.core.domain.R;
|
|
|
+import com.fs.common.core.page.TableDataInfo;
|
|
|
+import com.fs.common.enums.BusinessType;
|
|
|
+import com.fs.common.utils.poi.ExcelUtil;
|
|
|
+import com.fs.framework.security.SecurityUtils;
|
|
|
+import com.fs.live.domain.LiveCouponUser;
|
|
|
+import com.fs.live.param.LiveCouponVerifyParam;
|
|
|
+import com.fs.live.service.ILiveCouponService;
|
|
|
+import com.fs.live.service.ILiveCouponUserService;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 优惠券发放记录Controller(销售端)
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@RequestMapping("/live/coupon/user")
|
|
|
+public class LiveCouponUserController extends BaseController
|
|
|
+{
|
|
|
+ @Autowired
|
|
|
+ private ILiveCouponUserService liveCouponUserService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ILiveCouponService liveCouponService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询优惠券发放记录列表
|
|
|
+ * 仅返回 fs_user.bind_company_user_id = 当前销售 的优惠券
|
|
|
+ */
|
|
|
+ @GetMapping("/list")
|
|
|
+ public TableDataInfo list(LiveCouponUser liveCouponUser)
|
|
|
+ {
|
|
|
+ liveCouponUser.getParams().put("bindCompanyUserId", SecurityUtils.getLoginUser().getUser().getUserId());
|
|
|
+ startPage();
|
|
|
+ List<LiveCouponUser> list = liveCouponUserService.selectLiveCouponUserList(liveCouponUser);
|
|
|
+ return getDataTable(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 导出优惠券发放记录列表
|
|
|
+ */
|
|
|
+ @Log(title = "优惠券发放记录", businessType = BusinessType.EXPORT)
|
|
|
+ @GetMapping("/export")
|
|
|
+ public AjaxResult export(LiveCouponUser liveCouponUser)
|
|
|
+ {
|
|
|
+ liveCouponUser.getParams().put("bindCompanyUserId", SecurityUtils.getLoginUser().getUser().getUserId());
|
|
|
+ List<LiveCouponUser> list = liveCouponUserService.selectLiveCouponUserList(liveCouponUser);
|
|
|
+ ExcelUtil<LiveCouponUser> util = new ExcelUtil<LiveCouponUser>(LiveCouponUser.class);
|
|
|
+ return util.exportExcel(list, "优惠券发放记录");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取优惠券发放记录详细信息
|
|
|
+ */
|
|
|
+ @GetMapping(value = "/{id}")
|
|
|
+ public AjaxResult getInfo(@PathVariable("id") Long id)
|
|
|
+ {
|
|
|
+ return AjaxResult.success(liveCouponUserService.selectLiveCouponUserById(id));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 销售端核销优惠券
|
|
|
+ */
|
|
|
+ @Log(title = "优惠券核销", businessType = BusinessType.UPDATE)
|
|
|
+ @PostMapping("/verify")
|
|
|
+ public R verify(@RequestBody LiveCouponVerifyParam param)
|
|
|
+ {
|
|
|
+ Long verifyUserId = SecurityUtils.getLoginUser().getUser().getUserId();
|
|
|
+ param.setVerifyUserId(verifyUserId);
|
|
|
+ return liveCouponService.verifyCoupon(param);
|
|
|
+ }
|
|
|
+}
|