|
|
@@ -0,0 +1,138 @@
|
|
|
+package beilv.voucher.controller;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+import beilv.shopping.domain.QmjsShoppingMall;
|
|
|
+import beilv.system.domain.SysMember;
|
|
|
+import beilv.system.service.ISysMemberService;
|
|
|
+import beilv.vipCard.domain.Exchange;
|
|
|
+import beilv.vipCard.domain.VipCard;
|
|
|
+import beilv.voucher.domain.BeilvVoucherMember;
|
|
|
+import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Controller;
|
|
|
+import org.springframework.ui.ModelMap;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.PathVariable;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
+import beilv.common.annotation.Log;
|
|
|
+import beilv.common.enums.BusinessType;
|
|
|
+import beilv.voucher.domain.BeilvVoucher;
|
|
|
+import beilv.voucher.service.IBeilvVoucherService;
|
|
|
+import beilv.common.core.controller.BaseController;
|
|
|
+import beilv.common.core.domain.AjaxResult;
|
|
|
+import beilv.common.utils.poi.ExcelUtil;
|
|
|
+import beilv.common.core.page.TableDataInfo;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 代金券Controller
|
|
|
+ *
|
|
|
+ * @author ruoyi
|
|
|
+ * @date 2025-11-20
|
|
|
+ */
|
|
|
+@Controller
|
|
|
+@RequestMapping("/voucher")
|
|
|
+public class BeilvVoucherController extends BaseController {
|
|
|
+ private String prefix = "voucher";
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IBeilvVoucherService beilvVoucherService;
|
|
|
+ @Autowired
|
|
|
+ private ISysMemberService sysMemberService;
|
|
|
+
|
|
|
+
|
|
|
+ @GetMapping()
|
|
|
+ public String voucher() {
|
|
|
+ return prefix + "/voucher";
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询代金券列表
|
|
|
+ */
|
|
|
+ @PostMapping("/list")
|
|
|
+ @ResponseBody
|
|
|
+ public TableDataInfo list(BeilvVoucher beilvVoucher) {
|
|
|
+ startPage();
|
|
|
+ List<BeilvVoucher> list = beilvVoucherService.selectBeilvVoucherList(beilvVoucher);
|
|
|
+ return getDataTable(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 导出代金券列表
|
|
|
+ */
|
|
|
+ @Log(title = "代金券", businessType = BusinessType.EXPORT)
|
|
|
+ @PostMapping("/export")
|
|
|
+ @ResponseBody
|
|
|
+ public AjaxResult export(BeilvVoucher beilvVoucher) {
|
|
|
+ List<BeilvVoucher> list = beilvVoucherService.selectBeilvVoucherList(beilvVoucher);
|
|
|
+ ExcelUtil<BeilvVoucher> util = new ExcelUtil<BeilvVoucher>(BeilvVoucher.class);
|
|
|
+ return util.exportExcel(list, "代金券数据");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增代金券
|
|
|
+ */
|
|
|
+ @GetMapping("/add")
|
|
|
+ public String add() {
|
|
|
+ return prefix + "/add";
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增保存代金券
|
|
|
+ */
|
|
|
+ @Log(title = "代金券", businessType = BusinessType.INSERT)
|
|
|
+ @PostMapping("/add")
|
|
|
+ @ResponseBody
|
|
|
+ public AjaxResult addSave(BeilvVoucher beilvVoucher) {
|
|
|
+ return toAjax(beilvVoucherService.insertBeilvVoucher(beilvVoucher));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改代金券
|
|
|
+ */
|
|
|
+ @GetMapping("/edit/{id}")
|
|
|
+ public String edit(@PathVariable("id") Long id, ModelMap mmap) {
|
|
|
+ BeilvVoucher beilvVoucher = beilvVoucherService.selectBeilvVoucherById(id);
|
|
|
+ mmap.put("beilvVoucher", beilvVoucher);
|
|
|
+ return prefix + "/edit";
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改保存代金券
|
|
|
+ */
|
|
|
+ @Log(title = "代金券", businessType = BusinessType.UPDATE)
|
|
|
+ @PostMapping("/edit")
|
|
|
+ @ResponseBody
|
|
|
+ public AjaxResult editSave(BeilvVoucher beilvVoucher) {
|
|
|
+ return toAjax(beilvVoucherService.updateBeilvVoucher(beilvVoucher));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除代金券
|
|
|
+ */
|
|
|
+ @Log(title = "代金券", businessType = BusinessType.DELETE)
|
|
|
+ @PostMapping("/remove")
|
|
|
+ @ResponseBody
|
|
|
+ public AjaxResult remove(String ids) {
|
|
|
+ return toAjax(beilvVoucherService.deleteBeilvVoucherByIds(ids));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 发放代金券
|
|
|
+ * @param id
|
|
|
+ * @param mmap
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping("/coupon/{id}")
|
|
|
+ public String exchangeInfo(@PathVariable("id") Long id, ModelMap mmap) {
|
|
|
+ BeilvVoucher beilvVoucher = beilvVoucherService.selectBeilvVoucherById(id);
|
|
|
+ List<SysMember> members = sysMemberService.selectSysMemberList(new SysMember());
|
|
|
+ mmap.put("voucher", beilvVoucher);
|
|
|
+ mmap.put("members", members);
|
|
|
+ return prefix + "/coupon";
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+}
|