|
@@ -0,0 +1,120 @@
|
|
|
+package com.fs.company.controller.store;
|
|
|
+
|
|
|
+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.model.LoginUser;
|
|
|
+import com.fs.common.core.page.TableDataInfo;
|
|
|
+import com.fs.common.enums.BusinessType;
|
|
|
+import com.fs.common.exception.CustomException;
|
|
|
+import com.fs.common.utils.poi.ExcelUtil;
|
|
|
+import com.fs.his.domain.FsCoupon;
|
|
|
+import com.fs.his.param.FsCouponParam;
|
|
|
+import com.fs.his.service.IFsCouponService;
|
|
|
+import com.fs.his.vo.FsCouponAllListVO;
|
|
|
+import com.fs.his.vo.FsCouponListVO;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 优惠券Controller
|
|
|
+ *
|
|
|
+ * @author fs
|
|
|
+ * @date 2023-09-04
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@RequestMapping("/store/coupon")
|
|
|
+public class FsCouponController extends BaseController
|
|
|
+{
|
|
|
+ @Autowired
|
|
|
+ private IFsCouponService fsCouponService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询优惠券列表订单查询
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('store:coupon:list')")
|
|
|
+ @GetMapping("/list")
|
|
|
+ public TableDataInfo list(FsCouponParam fsCoupon)
|
|
|
+ {
|
|
|
+ startPage();
|
|
|
+ List<FsCouponListVO> list = fsCouponService.selectFsCouponListVO(fsCoupon);
|
|
|
+ return getDataTable(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询优惠券列表订单查询
|
|
|
+ */
|
|
|
+ @GetMapping("/allList")
|
|
|
+ public AjaxResult allList()
|
|
|
+ {
|
|
|
+ List<FsCouponAllListVO> list = fsCouponService.selectFsCouponListAll();
|
|
|
+ return AjaxResult.success(list);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 导出优惠券列表
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('store:coupon:export')")
|
|
|
+ @Log(title = "优惠券", businessType = BusinessType.EXPORT)
|
|
|
+ @GetMapping("/export")
|
|
|
+ public AjaxResult export(FsCoupon fsCoupon)
|
|
|
+ {
|
|
|
+ List<FsCoupon> list = fsCouponService.selectFsCouponList(fsCoupon);
|
|
|
+ ExcelUtil<FsCoupon> util = new ExcelUtil<FsCoupon>(FsCoupon.class);
|
|
|
+ return util.exportExcel(list, "优惠券数据");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取优惠券详细信息
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('store:coupon:query')")
|
|
|
+ @GetMapping(value = "/{couponId}")
|
|
|
+ public AjaxResult getInfo(@PathVariable("couponId") Long couponId)
|
|
|
+ {
|
|
|
+ return AjaxResult.success(fsCouponService.selectFsCouponByCouponId(couponId));
|
|
|
+ }
|
|
|
+
|
|
|
+// /**
|
|
|
+// * 新增优惠券
|
|
|
+// */
|
|
|
+// @PreAuthorize("@ss.hasPermi('store:coupon:add')")
|
|
|
+// @Log(title = "优惠券", businessType = BusinessType.INSERT)
|
|
|
+// @PostMapping
|
|
|
+// public AjaxResult add(@RequestBody FsCoupon fsCoupon)
|
|
|
+// {
|
|
|
+// return toAjax(fsCouponService.insertFsCoupon(fsCoupon));
|
|
|
+// }
|
|
|
+//
|
|
|
+// /**
|
|
|
+// * 修改优惠券
|
|
|
+// */
|
|
|
+// @PreAuthorize("@ss.hasPermi('store:coupon:edit')")
|
|
|
+// @Log(title = "优惠券", businessType = BusinessType.UPDATE)
|
|
|
+// @PutMapping
|
|
|
+// public AjaxResult edit(@RequestBody FsCoupon fsCoupon)
|
|
|
+// {
|
|
|
+// FsCoupon c = fsCouponService.selectFsCouponByCouponId(fsCoupon.getCouponId());
|
|
|
+// long l = c.getRemainNumber() + fsCoupon.getNumber() - c.getNumber();
|
|
|
+// if (l<0){
|
|
|
+// throw new CustomException("剩余卷不足");
|
|
|
+// }
|
|
|
+// fsCoupon.setRemainNumber(l);
|
|
|
+// return toAjax(fsCouponService.updateFsCoupon(fsCoupon));
|
|
|
+// }
|
|
|
+//
|
|
|
+// /**
|
|
|
+// * 删除优惠券
|
|
|
+// */
|
|
|
+// @PreAuthorize("@ss.hasPermi('store:coupon:remove')")
|
|
|
+// @Log(title = "优惠券", businessType = BusinessType.DELETE)
|
|
|
+// @DeleteMapping("/{couponIds}")
|
|
|
+// public AjaxResult remove(@PathVariable Long[] couponIds)
|
|
|
+// {
|
|
|
+// return toAjax(fsCouponService.deleteFsCouponByCouponIds(couponIds));
|
|
|
+// }
|
|
|
+}
|