会员积分代码提交
This commit is contained in:
@@ -33,7 +33,7 @@ public class PointsBasicSettingController {
|
||||
@GetMapping()
|
||||
@OperationLog("积分基本设置-详情")
|
||||
//@SaAdminCheckPermission("basicSetting:info")
|
||||
public CzgResult<PointsBasicSettingDTO> getPointsBasicSettingByShopId() {
|
||||
public CzgResult<PointsBasicSettingDTO> getPointsBasicSetting() {
|
||||
Long shopId = StpKit.USER.getShopId(0L);
|
||||
PointsBasicSetting entity = pointsBasicSettingService.getById(shopId);
|
||||
PointsBasicSettingDTO data = BeanUtil.copyProperties(entity, PointsBasicSettingDTO.class);
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.czg.controller.admin;
|
||||
|
||||
import com.czg.account.dto.points.PointsExchangeRecordDTO;
|
||||
import com.czg.account.param.PointsExchangeCfParam;
|
||||
import com.czg.account.param.PointsExchangeRecordParam;
|
||||
import com.czg.account.service.PointsExchangeRecordService;
|
||||
import com.czg.account.vo.PointsExchangeSummaryVo;
|
||||
@@ -13,7 +12,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
/**
|
||||
* 积分兑换
|
||||
* 积分兑换记录
|
||||
*
|
||||
* @author Tankaikai tankaikai@aliyun.com
|
||||
* @since 1.0 2025-02-25
|
||||
@@ -25,7 +24,6 @@ public class PointsExchangeRecordController {
|
||||
|
||||
private final PointsExchangeRecordService pointsExchangeRecordService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
@@ -63,28 +61,6 @@ public class PointsExchangeRecordController {
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消
|
||||
*/
|
||||
@PostMapping("cancel")
|
||||
@OperationLog("积分兑换-取消")
|
||||
//@SaAdminCheckPermission("pointsExchangeRecord:cancel")
|
||||
public CzgResult<Void> cancel(@RequestBody PointsExchangeCfParam param) {
|
||||
pointsExchangeRecordService.cancel(param);
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 退单
|
||||
*/
|
||||
@PostMapping("refund")
|
||||
@OperationLog("积分兑换-退单")
|
||||
//@SaAdminCheckPermission("pointsExchangeRecord:refund")
|
||||
public CzgResult<Void> refund(@RequestBody PointsExchangeCfParam param) {
|
||||
pointsExchangeRecordService.refund(param);
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 统计
|
||||
*/
|
||||
|
||||
@@ -5,7 +5,6 @@ import com.czg.account.entity.MemberPoints;
|
||||
import com.czg.account.param.ConsumeAwardPointsParam;
|
||||
import com.czg.account.param.PayedDeductPointsParam;
|
||||
import com.czg.account.service.MemberPointsService;
|
||||
import com.czg.log.annotation.OperationLog;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.sa.StpKit;
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -14,7 +13,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 会员积分
|
||||
* 支付相关积分接口
|
||||
*
|
||||
* @author Tankaikai tankaikai@aliyun.com
|
||||
* @since 1.0 2025-02-25
|
||||
@@ -27,10 +26,9 @@ public class UMemberPointsController {
|
||||
private final MemberPointsService memberPointsService;
|
||||
|
||||
/**
|
||||
* 获取会员积分等信息
|
||||
* 001-会员积分账户信息
|
||||
*/
|
||||
@GetMapping("my-points")
|
||||
@OperationLog("会员积分-获取会员积分等信息")
|
||||
public CzgResult<MemberPoints> getMemberPoints() {
|
||||
long userId = StpKit.USER.getLoginIdAsLong();
|
||||
MemberPoints data = memberPointsService.getMemberPoints(userId);
|
||||
@@ -38,57 +36,52 @@ public class UMemberPointsController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取订单可用积分及抵扣金额
|
||||
* 002-获取订单可用积分及抵扣金额(支付页面使用)
|
||||
*
|
||||
* @param userId 用户id
|
||||
* @param orderAmount 订单金额
|
||||
*/
|
||||
@GetMapping("calc-usable-points")
|
||||
@OperationLog("获取订单可用积分及抵扣金额")
|
||||
public CzgResult<OrderDeductionPointsDTO> getMemberUsablePoints(@RequestParam Long userId, @RequestParam BigDecimal orderAmount) {
|
||||
OrderDeductionPointsDTO usablePoints = memberPointsService.getMemberUsablePoints(userId, orderAmount);
|
||||
return CzgResult.success(usablePoints);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据抵扣金额计算所需积分
|
||||
* 004-根据抵扣金额计算所需积分
|
||||
*
|
||||
* @param userId 用户id
|
||||
* @param orderAmount 订单金额
|
||||
* @param deductionAmount 抵扣金额
|
||||
*/
|
||||
@GetMapping("calc-used-points")
|
||||
@OperationLog("根据抵扣金额计算所需积分")
|
||||
public CzgResult<Integer> calcUsedPoints(@RequestParam Long userId, @RequestParam BigDecimal orderAmount, @RequestParam BigDecimal deductionAmount) {
|
||||
int points = memberPointsService.calcUsedPoints(userId, orderAmount, deductionAmount);
|
||||
return CzgResult.success(points);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据积分计算可抵扣金额
|
||||
* 003-根据积分计算可抵扣金额
|
||||
*/
|
||||
@GetMapping("calc-deduction-amount")
|
||||
@OperationLog("根据积分计算可抵扣金额")
|
||||
public CzgResult<BigDecimal> calcDeductionAmount(@RequestParam Long memberId, @RequestParam BigDecimal orderAmount, @RequestParam Integer points) {
|
||||
BigDecimal deductionAmount = memberPointsService.calcDeductionAmount(memberId, orderAmount, points);
|
||||
return CzgResult.success(deductionAmount);
|
||||
}
|
||||
|
||||
/**
|
||||
* 支付完成扣减积分(支付成功回调中使用)
|
||||
* 005-支付完成扣减积分(支付成功回调中使用)
|
||||
*/
|
||||
@PostMapping("payed-deduct-points")
|
||||
@OperationLog("支付完成扣减积分(支付成功回调中使用)")
|
||||
public CzgResult<Boolean> deductPoints(@RequestBody PayedDeductPointsParam param) {
|
||||
boolean ret = memberPointsService.deductPoints(param.getUserId(), param.getPoints(), param.getContent(), param.getOrderId());
|
||||
return CzgResult.success(ret);
|
||||
}
|
||||
|
||||
/**
|
||||
* 消费赠送积分(支付成功回调中使用)
|
||||
* 006-消费赠送积分(支付成功回调中使用)
|
||||
*/
|
||||
@PostMapping("consume-award-points")
|
||||
@OperationLog("消费赠送积分(支付成功回调中使用)")
|
||||
public CzgResult<Void> consumeAwardPoints(@RequestBody ConsumeAwardPointsParam param) {
|
||||
memberPointsService.consumeAwardPoints(param.getUserId(), param.getOrderId());
|
||||
return CzgResult.success();
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
package com.czg.controller.user;
|
||||
|
||||
import com.czg.account.dto.points.PointsExchangeRecordDTO;
|
||||
import com.czg.account.dto.points.PointsGoodsSettingDTO;
|
||||
import com.czg.account.param.PointsExchangeCfParam;
|
||||
import com.czg.account.param.PointsExchangeRecordParam;
|
||||
import com.czg.account.param.PointsOrderCreateParam;
|
||||
import com.czg.account.param.PointsOrderPayParam;
|
||||
import com.czg.account.service.PointsExchangeRecordService;
|
||||
import com.czg.account.service.PointsGoodsSettingService;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.sa.StpKit;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
/**
|
||||
* 积分商城
|
||||
*
|
||||
* @author Tankaikai tankaikai@aliyun.com
|
||||
* @since 1.0 2025-02-25
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/user/points/mall")
|
||||
public class UPointsMallController {
|
||||
|
||||
private final PointsGoodsSettingService pointsGoodsSettingService;
|
||||
private final PointsExchangeRecordService pointsExchangeRecordService;
|
||||
|
||||
/**
|
||||
* 商品列表
|
||||
*/
|
||||
@GetMapping("/goods/page")
|
||||
public CzgResult<Page<PointsGoodsSettingDTO>> getPointsGoodsSettingPage(PointsGoodsSettingDTO param) {
|
||||
Page<PointsGoodsSettingDTO> data = pointsGoodsSettingService.getPointsGoodsSettingPage(param);
|
||||
return CzgResult.success(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成订单
|
||||
*/
|
||||
@PostMapping("/order/create")
|
||||
public CzgResult<PointsExchangeRecordDTO> create(@RequestBody PointsOrderCreateParam param) {
|
||||
PointsExchangeRecordDTO data = pointsExchangeRecordService.create(param);
|
||||
return CzgResult.success(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消订单
|
||||
*/
|
||||
@PostMapping("/order/cancel")
|
||||
public CzgResult<Void> cancel(@RequestBody PointsExchangeCfParam param) {
|
||||
pointsExchangeRecordService.cancel(param);
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 支付订单
|
||||
*/
|
||||
@PostMapping("/order/pay")
|
||||
public CzgResult<PointsExchangeRecordDTO> pay(@RequestBody PointsOrderPayParam param) {
|
||||
PointsExchangeRecordDTO data = pointsExchangeRecordService.pay(param);
|
||||
return CzgResult.success(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 申请退单
|
||||
*/
|
||||
@PostMapping("/order/refund")
|
||||
public CzgResult<Void> refund(@RequestBody PointsExchangeCfParam param) {
|
||||
pointsExchangeRecordService.refund(param);
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 我的兑换记录
|
||||
*/
|
||||
@GetMapping("/order/page")
|
||||
public CzgResult<Page<PointsExchangeRecordDTO>> getPointsExchangeRecordPage(PointsExchangeRecordParam param) {
|
||||
param.setUserId(StpKit.USER.getLoginIdAsLong());
|
||||
Page<PointsExchangeRecordDTO> page = pointsExchangeRecordService.getPointsExchangeRecordPage(param);
|
||||
return CzgResult.success(page);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user