From a768dc3daa04d35fedfbe75c0a59b9b2545b85c4 Mon Sep 17 00:00:00 2001
From: gongzuming <gongzuming>
Date: 星期四, 19 九月 2024 16:59:33 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master-v2'
---
src/main/java/com/mzl/flower/web/point/CustomerPointController.java | 88 ++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 88 insertions(+), 0 deletions(-)
diff --git a/src/main/java/com/mzl/flower/web/point/CustomerPointController.java b/src/main/java/com/mzl/flower/web/point/CustomerPointController.java
new file mode 100644
index 0000000..3a214a1
--- /dev/null
+++ b/src/main/java/com/mzl/flower/web/point/CustomerPointController.java
@@ -0,0 +1,88 @@
+package com.mzl.flower.web.point;
+
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.mzl.flower.base.BaseController;
+import com.mzl.flower.base.R;
+import com.mzl.flower.base.ReturnDataDTO;
+import com.mzl.flower.config.security.SecurityUtils;
+import com.mzl.flower.dto.request.point.ChangePointDTO;
+import com.mzl.flower.dto.request.point.QueryCustomerPointDTO;
+import com.mzl.flower.dto.request.point.QueryPointDetailDTO;
+import com.mzl.flower.dto.request.supplier.UpdateSupplierDTO;
+import com.mzl.flower.dto.response.content.AdvertisementDTO;
+import com.mzl.flower.dto.response.point.CustomerPointDTO;
+import com.mzl.flower.dto.response.point.CustomerPointDetailDTO;
+import com.mzl.flower.service.point.CustomerPointService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.http.ResponseEntity;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.ValidationException;
+import javax.validation.constraints.NotNull;
+import java.util.List;
+
+@RestController
+@RequestMapping("/api/customer/point")
+@Api(value = "会员积分", tags = "会员积分")
+@Validated
+@Slf4j
+public class CustomerPointController extends BaseController {
+
+
+ private final CustomerPointService customerPointService;
+
+ public CustomerPointController(CustomerPointService customerPointService) {
+ this.customerPointService = customerPointService;
+ }
+
+
+ @GetMapping("/page/list")
+ @ApiOperation(value = "管理端-积分详细记录列表", notes = "管理端-商户积分详细记录列表")
+ public ResponseEntity<ReturnDataDTO<Page<CustomerPointDetailDTO>>> queryCustomerDetails(QueryPointDetailDTO dto, Page page) {
+ if(dto.getCustomerId() == null || dto.getCustomerId() == 0){
+ throw new ValidationException("商户ID不能为空");
+ }
+ return returnData(R.SUCCESS.getCode(),customerPointService.queryCustomerDetails(dto, page));
+ }
+
+
+ @GetMapping("/page")
+ @ApiOperation(value = "管理端-积分查询", notes = "用户端-积分查询")
+ public ResponseEntity<ReturnDataDTO<Page<CustomerPointDTO>>> queryPage(QueryCustomerPointDTO dto, Page page) {
+ return returnData(R.SUCCESS.getCode(), customerPointService.queryPage(dto, page));
+ }
+
+ @PostMapping("/giveaway")
+ @ApiOperation(value = "管理端-积分赠送", notes = "管理端-积分赠送")
+ public ResponseEntity<ReturnDataDTO> giveawayPoint(@Validated @RequestBody ChangePointDTO dto) {
+ if(dto.getPoint()<=0){
+ throw new ValidationException("赠送积分必须大于0");
+ }
+ customerPointService.giveawayPoint(dto);
+ return returnData(R.SUCCESS.getCode(),null);
+ }
+
+ @PostMapping("/deduction")
+ @ApiOperation(value = "管理端-积分扣除", notes = "管理端-积分扣除")
+ public ResponseEntity<ReturnDataDTO> deductionPoint(@Validated @RequestBody ChangePointDTO dto) {
+ if(dto.getPoint()<=0){
+ throw new ValidationException("扣除积分必须大于0");
+ }
+ customerPointService.deductionPoint(dto);
+ return returnData(R.SUCCESS.getCode(),null);
+ }
+
+
+
+ @GetMapping("/list")
+ @ApiOperation(value = "用户端-积分列表(花店积分列表)", notes = "管理端-积分列表(花店积分列表)")
+ public ResponseEntity<ReturnDataDTO<Page<CustomerPointDetailDTO>>> myPointDetails(QueryPointDetailDTO dto, Page page) {
+ dto.setUserId(SecurityUtils.getUserId());
+ return returnData(R.SUCCESS.getCode(),customerPointService.queryCustomerDetails(dto, page));
+ }
+
+}
--
Gitblit v1.9.3