parent
7153a7dfed
commit
4f327a4517
|
|
@ -3,18 +3,20 @@ package com.czg.controller.user;
|
|||
import com.czg.account.dto.shopuser.ShopUserAddDTO;
|
||||
import com.czg.account.dto.shopuser.ShopUserDetailDTO;
|
||||
import com.czg.account.dto.shopuser.ShopUserVipCardDTO;
|
||||
import com.czg.account.entity.MemberPointsLog;
|
||||
import com.czg.account.entity.ShopUser;
|
||||
import com.czg.account.entity.ShopUserFlow;
|
||||
import com.czg.account.entity.*;
|
||||
import com.czg.account.service.MemberPointsLogService;
|
||||
import com.czg.account.service.ShopUserFlowService;
|
||||
import com.czg.account.service.UShopUserService;
|
||||
import com.czg.account.vo.MemberPointsLogVO;
|
||||
import com.czg.account.vo.PointsShopListVO;
|
||||
import com.czg.account.vo.ShopUserFlowInfoVO;
|
||||
import com.czg.annotation.Debounce;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.sa.StpKit;
|
||||
import com.czg.utils.MyQueryWrapper;
|
||||
import com.czg.utils.PageUtil;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.query.QueryCondition;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
|
@ -85,9 +87,12 @@ public class UShopUserController {
|
|||
* @return 分页数据
|
||||
*/
|
||||
@GetMapping("/moneyRecord")
|
||||
public CzgResult<Page<ShopUserFlow>> getMoneyRecord(@RequestParam Long shopId) {
|
||||
return CzgResult.success(shopUserFlowService.page(PageUtil.buildPage(), new QueryWrapper().eq(ShopUserFlow::getShopId, shopId)
|
||||
.eq(ShopUserFlow::getUserId, StpKit.USER.getLoginIdAsLong()).orderBy(ShopUserFlow::getId, false)));
|
||||
public CzgResult<Page<ShopUserFlowInfoVO>> getMoneyRecord(@RequestParam Long shopId) {
|
||||
return CzgResult.success(shopUserFlowService.pageAs(PageUtil.buildPage(), new QueryWrapper().eq(ShopUserFlow::getShopId, shopId)
|
||||
.eq(ShopUserFlow::getUserId, StpKit.USER.getLoginIdAsLong()).leftJoin(ShopInfo.class).on(ShopUserFlow::getShopId, ShopInfo::getId)
|
||||
.select(ShopInfo::getShopName)
|
||||
.select(ShopUserFlow::getUserId, ShopUserFlow::getAmount, ShopUserFlow::getBizCode, ShopUserFlow::getRemark)
|
||||
.orderBy(ShopUserFlow::getId, false), ShopUserFlowInfoVO.class));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -114,10 +119,14 @@ public class UShopUserController {
|
|||
* @return 分页数据
|
||||
*/
|
||||
@GetMapping("/pointsRecord")
|
||||
public CzgResult<Page<MemberPointsLog>> getPointsRecord(@RequestParam Long shopId) {
|
||||
public CzgResult<Page<MemberPointsLogVO>> getPointsRecord(@RequestParam Long shopId) {
|
||||
ShopUser shopUser = shopUserService.getShopUserInfo(shopId, StpKit.USER.getLoginIdAsLong());
|
||||
return CzgResult.success(memberPointsLogService.page(PageUtil.buildPage(), new QueryWrapper().eq(MemberPointsLog::getShopId, shopId)
|
||||
.eq(MemberPointsLog::getShopUserId, shopUser.getId()).orderBy(MemberPointsLog::getId, false)));
|
||||
return CzgResult.success(memberPointsLogService.pageAs(PageUtil.buildPage(), new MyQueryWrapper().eq(MemberPointsLog::getShopId, shopId)
|
||||
.eq(MemberPointsLog::getShopUserId, shopUser.getId())
|
||||
.selectAll(MemberPointsLog.class)
|
||||
.select(ShopInfo::getShopName)
|
||||
.leftJoin(ShopInfo.class).on(MemberPointsLog::getShopId, ShopInfo::getId)
|
||||
.orderBy(MemberPointsLog::getId, false), MemberPointsLogVO.class));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -0,0 +1,61 @@
|
|||
package com.czg.account.vo;
|
||||
|
||||
import com.mybatisflex.annotation.Column;
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.KeyType;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 会员积分变动记录
|
||||
*
|
||||
* @author Tankaikai tankaikai@aliyun.com
|
||||
* @since 1.0 2025-02-25
|
||||
*/
|
||||
@Data
|
||||
@Table("tb_member_points_log")
|
||||
public class MemberPointsLogVO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@Id(keyType = KeyType.Auto)
|
||||
private Long id;
|
||||
/**
|
||||
* 店铺id
|
||||
*/
|
||||
private Long shopId;
|
||||
/**
|
||||
* 店铺用户id
|
||||
*/
|
||||
private Long shopUserId;
|
||||
/**
|
||||
* 摘要信息(如:兑换某个商品/消费多少钱/充值多少钱/新会员赠送积分等)
|
||||
*/
|
||||
private String content;
|
||||
/**
|
||||
* 订单编号
|
||||
*/
|
||||
private String orderNo;
|
||||
/**
|
||||
* 浮动类型 add-累加 subtract-扣减
|
||||
*/
|
||||
private String floatType;
|
||||
/**
|
||||
* 浮动积分(非0正负数)
|
||||
*/
|
||||
private Integer floatPoints;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Column(onInsertValue = "now()")
|
||||
private LocalDateTime createTime;
|
||||
private String shopName;
|
||||
}
|
||||
|
|
@ -0,0 +1,105 @@
|
|||
package com.czg.account.vo;
|
||||
|
||||
import com.mybatisflex.annotation.Column;
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.KeyType;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 用户余额流水 实体类。
|
||||
*
|
||||
* @author zs
|
||||
* @since 2025-02-13
|
||||
*/
|
||||
@Data
|
||||
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ShopUserFlowInfoVO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id(keyType = KeyType.Auto)
|
||||
private Long id;
|
||||
|
||||
private Long userId;
|
||||
|
||||
private Long shopId;
|
||||
/**
|
||||
* 充值金额
|
||||
*/
|
||||
private BigDecimal amount;
|
||||
/**
|
||||
* 当前余额
|
||||
*/
|
||||
private BigDecimal balance;
|
||||
/**
|
||||
* 已退款金额
|
||||
*/
|
||||
private BigDecimal refundAmount;
|
||||
|
||||
/**
|
||||
* 类型:
|
||||
* cashIn 现金充值,
|
||||
* wechatIn 微信小程序充值,
|
||||
* alipayIn 支付宝小程序充值,
|
||||
* awardIn 充值奖励,
|
||||
* rechargeRefund 充值退款
|
||||
* <p>
|
||||
* orderPay 订单消费,
|
||||
* orderRefund 订单退款,
|
||||
* <p>
|
||||
* adminIn 管理员充值
|
||||
* adminOut管理员消费
|
||||
*/
|
||||
private String bizCode;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 关联id,
|
||||
* 订单支付/订单退款/霸王餐时 订单id
|
||||
* 支付/退款 tb_order_payment.id
|
||||
*/
|
||||
private Long relationId;
|
||||
/**
|
||||
* 充值记录id 当前表的id
|
||||
* 退款使用
|
||||
*/
|
||||
private Long rechargeId;
|
||||
|
||||
|
||||
@Column(onInsertValue = "now()")
|
||||
private LocalDateTime createTime;
|
||||
/**
|
||||
* 退款失败原因
|
||||
*/
|
||||
private String failMsg;
|
||||
private String shopName;
|
||||
|
||||
|
||||
public BigDecimal getAmount() {
|
||||
if (amount == null) {
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
return amount;
|
||||
}
|
||||
|
||||
public BigDecimal getRefundAmount() {
|
||||
if (refundAmount == null) {
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
return refundAmount;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue