1. 用户积分查询
This commit is contained in:
2026-02-13 15:35:04 +08:00
parent b2839ed1d5
commit eddfc26a45
3 changed files with 36 additions and 14 deletions

View File

@@ -20,9 +20,11 @@ import org.springblade.modules.api.vo.*;
import org.springblade.modules.common.service.ICommonUserAddressService;
import org.springblade.modules.common.service.ICommonUserOrderService;
import org.springblade.modules.common.service.ICommonUserNoticeService;
import org.springblade.modules.common.service.ICommonUserPointService;
import org.springblade.modules.system.service.IUserService;
import org.springframework.web.bind.annotation.*;
import java.math.BigDecimal;
import java.util.List;
@Hidden
@@ -40,6 +42,8 @@ public class APPUserController {
private final ICommonUserAddressService addressService;
private final ICommonUserPointService pointService;
/**
* 是否修改过密码
@@ -170,5 +174,11 @@ public class APPUserController {
}
@GetMapping("/user-points")
@ApiOperationSupport(order = 14)
@Operation(summary = "用户积分查询")
public R<BigDecimal> userPoints() {
return R.data(pointService.queryPoint());
}
}

View File

@@ -7,6 +7,8 @@ import org.springblade.modules.common.pojo.vo.CommonUserPointVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseService;
import java.math.BigDecimal;
/**
* 用户商城积分表 服务类
*
@@ -39,4 +41,7 @@ public interface ICommonUserPointService extends BaseService<CommonUserPointEnti
* @return 操作结果
*/
Boolean deductUserPoint(CommonUserPointApiDTO dto);
BigDecimal queryPoint();
}

View File

@@ -3,6 +3,7 @@ package org.springblade.modules.common.service.impl;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.common.utils.date.DateUtil;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.modules.common.convert.AppCommonConvert;
import org.springblade.modules.common.pojo.dto.CommonUserPointApiDTO;
import org.springblade.modules.common.pojo.entity.CommonCashCouponEntity;
@@ -84,6 +85,12 @@ public class CommonUserPointServiceImpl extends BaseServiceImpl<CommonUserPointM
return Boolean.TRUE;
}
@Override
public BigDecimal queryPoint() {
CommonUserPointEntity userPoint = getById(AuthUtil.getUserId());
return userPoint == null ? BigDecimal.ZERO : userPoint.getAmount();
}
private CommonUserPointLogEntity saveBenefitPointLog(CommonUserPointApiDTO dto, Integer type) {
CommonUserPointLogEntity userPointLog = AppCommonConvert.INSTANCE.convertUserPointDTOToEntity(dto);