From 24c4d039b42a3ee588195af4122f52f26a60ab32 Mon Sep 17 00:00:00 2001
From: zhanghb <740323835@qq.com>
Date: Thu, 20 Feb 2025 15:21:37 +0800
Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9bug?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
mall-admin/pom.xml | 7 +-
.../mall/controller/VipCenterController.java | 151 ------------------
mall-portal/pom.xml | 1 +
3 files changed, 2 insertions(+), 157 deletions(-)
delete mode 100644 mall-admin/src/main/java/com/buy507/mall/controller/VipCenterController.java
diff --git a/mall-admin/pom.xml b/mall-admin/pom.xml
index c53622c..b25093a 100644
--- a/mall-admin/pom.xml
+++ b/mall-admin/pom.xml
@@ -66,6 +66,7 @@
org.projectlombok
lombok
true
+ 1.18.20
@@ -95,12 +96,6 @@
jaxb-runtime
2.3.1
-
- com.buy507.mall
- mall-portal
- 1.0-SNAPSHOT
- compile
-
diff --git a/mall-admin/src/main/java/com/buy507/mall/controller/VipCenterController.java b/mall-admin/src/main/java/com/buy507/mall/controller/VipCenterController.java
deleted file mode 100644
index 3884bea..0000000
--- a/mall-admin/src/main/java/com/buy507/mall/controller/VipCenterController.java
+++ /dev/null
@@ -1,151 +0,0 @@
-package com.buy507.mall.controller;
-
-import com.buy507.mall.common.api.CommonResult;
-import com.buy507.mall.dto.PmsProductParam;
-import com.buy507.mall.mapper.OmsOrderMapper;
-import com.buy507.mall.mapper.PmsProductMapper;
-import com.buy507.mall.mapper.UmsMemberMapper;
-import com.buy507.mall.model.OmsOrder;
-import com.buy507.mall.model.UmsMember;
-import com.buy507.mall.portal.service.OmsPortalOrderService;
-import com.buy507.mall.portal.service.UmsMemberService;
-import com.buy507.mall.service.PmsProductService;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-
-import java.math.BigDecimal;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
-
-
-
-/**
- * ClassName:VipCenterController
- * Description:
- *
- * @Author axin
- * @Create 2025/2/19 11:09
- * @Version 1.0
- */
-
-@Controller
-@Api(tags = "VipCenterController", description = "会员中心")
-@RequestMapping("/vipCenter")
-public class VipCenterController {
- @Autowired
- private UmsMemberMapper memberMapper;
-
- @Autowired
- private UmsMemberService memberService;
-
- @Autowired
- private PmsProductMapper productMapper;
-
- @Autowired
- private PmsProductService productService;
-
- @Autowired
- private OmsPortalOrderService portalOrderService;
-
- @Autowired
- private OmsOrderMapper orderMapper;
-
- //店长升级金额
- @Value("${storeManagerAmount}")
- private BigDecimal storeManagerAmount;
-
- //代理升级金额
- @Value("${agentAmount}")
- private BigDecimal agentAmount;
-
- //市代理升级金额
- @Value("${cityAgentAmount}")
- private BigDecimal cityAgentAmount;
-
- @ApiOperation("查询当前登录人信息")
- @RequestMapping("/getCurrentUserInfo")
- public CommonResult getCurrentUserInfo(){
- //获取当前登录人的信息
- UmsMember member = memberMapper.selectByPrimaryKey(memberService.getCurrentMember().getId());
-
- // 获取当前用户的会员等级ID
- Long memberLevelId = member.getMemberLevelId();
-
- String memberLevelName = "普通用户";
- if (memberLevelId == 1) {
- memberLevelName = "普通用户";
- } else if (memberLevelId == 2) {
- memberLevelName = "VIP会员";
- } else if (memberLevelId == 3) {
- memberLevelName = "店长";
- } else if (memberLevelId == 4) {
- memberLevelName = "代理";
- } else if (memberLevelId == 5) {
- memberLevelName = "市代理";
- }
-
- // 返回当前用户的会员信息
- return CommonResult.success("当前登录用户: " + member.getUsername() + ", 会员等级: " + memberLevelName);
- }
-
- @ApiOperation("创建会员中心订单")
- @RequestMapping( value = "/createVipOrder", method = RequestMethod.POST)
- public CommonResult createVipOrder(){
- //获取当前登录人的信息
- UmsMember member = memberMapper.selectByPrimaryKey(memberService.getCurrentMember().getId());
-
- // 获取当前用户的会员等级ID
- Long memberLevelId = member.getMemberLevelId();
-
- //创建返回值
- Map result = new HashMap<>();
-
- //生成订单
- OmsOrder order = new OmsOrder();
- // 根据会员等级ID动态设置订单金额
- // 店长
- if (memberLevelId == 3) {
- order.setTotalAmount(storeManagerAmount);
- order.setPayAmount(storeManagerAmount);
- // 代理
- } else if (memberLevelId == 4) {
- order.setTotalAmount(agentAmount);
- order.setPayAmount(agentAmount);
- // 市代理
- } else if (memberLevelId == 5) {
- order.setTotalAmount(cityAgentAmount);
- order.setPayAmount(cityAgentAmount);
- }
- order.setMemberId(member.getId());
- order.setCreateTime(new Date());
- order.setModifyTime(new Date());
-
- // 支付方式,0为未支付
- order.setPayType(0);
- // 订单状态,0为待付款
- order.setStatus(0);
- // 虚拟订单
- order.setOrderType(3);
- // 升级订单,无需实际收货人信息
- order.setReceiverName("会员升级");
-
- // 保存订单
- orderMapper.insert(order);
-
- // 更新返回结果
- result.put("orderId", order.getId());
-
- return CommonResult.success(result);
-
- }
-
-
-
-
-}
diff --git a/mall-portal/pom.xml b/mall-portal/pom.xml
index 2255830..aa0845a 100644
--- a/mall-portal/pom.xml
+++ b/mall-portal/pom.xml
@@ -59,6 +59,7 @@
org.projectlombok
lombok
true
+ 1.18.20
From 88d7814ad40453852337cfb355da17711dab6c4f Mon Sep 17 00:00:00 2001
From: zhanghb <740323835@qq.com>
Date: Thu, 20 Feb 2025 17:26:54 +0800
Subject: [PATCH 2/2] =?UTF-8?q?=E6=88=91=E7=9A=84=E9=92=B1=E5=8C=85?=
=?UTF-8?q?=E4=B8=9A=E5=8A=A1=E9=80=BB=E8=BE=91=E5=AE=9E=E7=8E=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../portal/controller/MyWalletController.java | 41 ++++++++++++++++
.../mall/portal/dao/MyWalletMapper.java | 47 ++++++++++++++++++
.../mall/portal/service/MyWalletService.java | 21 ++++++++
.../service/impl/MyWalletServiceImpl.java | 49 +++++++++++++++++++
.../mall/portal/vo/TransactionCashVo.java | 22 +++++++++
.../mall/portal/vo/TransactionPointsVo.java | 21 ++++++++
.../buy507/mall/portal/vo/WalletCashVo.java | 16 ++++++
.../buy507/mall/portal/vo/WalletPointsVo.java | 15 ++++++
.../src/main/resources/dao/MyWalletMapper.xml | 5 ++
9 files changed, 237 insertions(+)
create mode 100644 mall-portal/src/main/java/com/buy507/mall/portal/controller/MyWalletController.java
create mode 100644 mall-portal/src/main/java/com/buy507/mall/portal/dao/MyWalletMapper.java
create mode 100644 mall-portal/src/main/java/com/buy507/mall/portal/service/MyWalletService.java
create mode 100644 mall-portal/src/main/java/com/buy507/mall/portal/service/impl/MyWalletServiceImpl.java
create mode 100644 mall-portal/src/main/java/com/buy507/mall/portal/vo/TransactionCashVo.java
create mode 100644 mall-portal/src/main/java/com/buy507/mall/portal/vo/TransactionPointsVo.java
create mode 100644 mall-portal/src/main/java/com/buy507/mall/portal/vo/WalletCashVo.java
create mode 100644 mall-portal/src/main/java/com/buy507/mall/portal/vo/WalletPointsVo.java
create mode 100644 mall-portal/src/main/resources/dao/MyWalletMapper.xml
diff --git a/mall-portal/src/main/java/com/buy507/mall/portal/controller/MyWalletController.java b/mall-portal/src/main/java/com/buy507/mall/portal/controller/MyWalletController.java
new file mode 100644
index 0000000..a51c6e2
--- /dev/null
+++ b/mall-portal/src/main/java/com/buy507/mall/portal/controller/MyWalletController.java
@@ -0,0 +1,41 @@
+package com.buy507.mall.portal.controller;
+
+import com.buy507.mall.common.api.CommonResult;
+import com.buy507.mall.portal.service.MyWalletService;
+import com.buy507.mall.portal.vo.WalletCashVo;
+import com.buy507.mall.portal.vo.WalletPointsVo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMapping("/wallet")
+public class MyWalletController {
+
+ @Autowired
+ private MyWalletService myWalletService;
+
+ /**
+ * 获取现金余额和流水
+ * @param userId
+ * @return
+ */
+ @GetMapping("/balance")
+ public CommonResult getBalance(@RequestParam Long userId){
+ WalletCashVo walletCashVo = myWalletService.getBalanceAndCashFlow(userId);
+ return CommonResult.success(walletCashVo);
+ }
+
+ /**
+ * 获取积分余额和流水
+ * @param userId
+ * @return
+ */
+ @GetMapping("/points")
+ public CommonResult getIntegration(@RequestParam Long userId){
+ WalletPointsVo walletPointsVo = myWalletService.getIntegrationAndPointsFlow(userId);
+ return CommonResult.success(walletPointsVo);
+ }
+}
diff --git a/mall-portal/src/main/java/com/buy507/mall/portal/dao/MyWalletMapper.java b/mall-portal/src/main/java/com/buy507/mall/portal/dao/MyWalletMapper.java
new file mode 100644
index 0000000..a142017
--- /dev/null
+++ b/mall-portal/src/main/java/com/buy507/mall/portal/dao/MyWalletMapper.java
@@ -0,0 +1,47 @@
+package com.buy507.mall.portal.dao;
+
+import com.buy507.mall.portal.vo.TransactionCashVo;
+import com.buy507.mall.portal.vo.TransactionPointsVo;
+import com.buy507.mall.portal.vo.WalletCashVo;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Select;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+@Mapper
+public interface MyWalletMapper {
+ /**
+ * 获取用户现金余额
+ * @param userId
+ * @return
+ */
+ @Select("SELECT balance FROM ums_member WHERE id = #{userId}")
+ BigDecimal getBalance(Long userId);
+
+ /**
+ * 获取用户现金流水
+ * @param userId
+ * @return
+ */
+ @Select("SELECT revenue_amount, remarks, transfer_payment_time FROM ums_member_account_transaction " +
+ "WHERE ums_member_account_transaction.member_id = #{userId} ORDER BY transfer_payment_time DESC")
+ List getCashFlow(Long userId);
+
+ /**
+ * 获取用户积分余额
+ * @param userId
+ * @return
+ */
+ @Select("SELECT integration FROM ums_member WHERE id = #{userId}")
+ Integer getIntegration(Long userId);
+
+ /**
+ * 获取用户积分流水
+ * @param userId
+ * @return
+ */
+ @Select("SELECT revenue_points, remarks, transfer_payment_time FROM ums_member_account_transaction " +
+ "WHERE ums_member_account_transaction.member_id = #{userId} ORDER BY transfer_payment_time DESC")
+ List getPointsFlow(Long userId);
+}
diff --git a/mall-portal/src/main/java/com/buy507/mall/portal/service/MyWalletService.java b/mall-portal/src/main/java/com/buy507/mall/portal/service/MyWalletService.java
new file mode 100644
index 0000000..c40c13a
--- /dev/null
+++ b/mall-portal/src/main/java/com/buy507/mall/portal/service/MyWalletService.java
@@ -0,0 +1,21 @@
+package com.buy507.mall.portal.service;
+
+import com.buy507.mall.portal.vo.WalletCashVo;
+import com.buy507.mall.portal.vo.WalletPointsVo;
+
+public interface MyWalletService {
+
+ /**
+ * 获取现金余额和流水
+ * @param userId
+ * @return
+ */
+ WalletCashVo getBalanceAndCashFlow(Long userId);
+
+ /**
+ * 获取积分余额和流水
+ * @param userId
+ * @return
+ */
+ WalletPointsVo getIntegrationAndPointsFlow(Long userId);
+}
diff --git a/mall-portal/src/main/java/com/buy507/mall/portal/service/impl/MyWalletServiceImpl.java b/mall-portal/src/main/java/com/buy507/mall/portal/service/impl/MyWalletServiceImpl.java
new file mode 100644
index 0000000..806b477
--- /dev/null
+++ b/mall-portal/src/main/java/com/buy507/mall/portal/service/impl/MyWalletServiceImpl.java
@@ -0,0 +1,49 @@
+package com.buy507.mall.portal.service.impl;
+
+import com.buy507.mall.portal.dao.MyWalletMapper;
+import com.buy507.mall.portal.service.MyWalletService;
+import com.buy507.mall.portal.vo.WalletCashVo;
+import com.buy507.mall.portal.vo.WalletPointsVo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class MyWalletServiceImpl implements MyWalletService {
+
+ @Autowired
+ private MyWalletMapper myWalletMapper;
+
+ /**
+ * 获取现金余额和流水
+ * @param userId
+ * @return
+ */
+ @Override
+ public WalletCashVo getBalanceAndCashFlow(Long userId) {
+
+ WalletCashVo walletCashVo = new WalletCashVo();
+ //获取现金余额
+ walletCashVo.setBalance(myWalletMapper.getBalance(userId));
+ //获取现金流水
+ walletCashVo.setCashVoList(myWalletMapper.getCashFlow(userId));
+
+ return walletCashVo;
+ }
+
+ /**
+ * 获取积分余额和流水
+ * @param userId
+ * @return
+ */
+ @Override
+ public WalletPointsVo getIntegrationAndPointsFlow(Long userId) {
+ WalletPointsVo walletPointsVo = new WalletPointsVo();
+
+ //获取积分余额
+ walletPointsVo.setIntegration(myWalletMapper.getIntegration(userId));
+ //获取积分流水
+ walletPointsVo.setPointsVoList(myWalletMapper.getPointsFlow(userId));
+
+ return walletPointsVo;
+ }
+}
diff --git a/mall-portal/src/main/java/com/buy507/mall/portal/vo/TransactionCashVo.java b/mall-portal/src/main/java/com/buy507/mall/portal/vo/TransactionCashVo.java
new file mode 100644
index 0000000..ad45480
--- /dev/null
+++ b/mall-portal/src/main/java/com/buy507/mall/portal/vo/TransactionCashVo.java
@@ -0,0 +1,22 @@
+package com.buy507.mall.portal.vo;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class TransactionCashVo implements Serializable {
+
+ //现金数额
+ private Integer revenueAmount;
+
+ //备注
+ private String remarks;
+
+ //时间
+ private Data transferPaymentTime;
+}
diff --git a/mall-portal/src/main/java/com/buy507/mall/portal/vo/TransactionPointsVo.java b/mall-portal/src/main/java/com/buy507/mall/portal/vo/TransactionPointsVo.java
new file mode 100644
index 0000000..df7d12a
--- /dev/null
+++ b/mall-portal/src/main/java/com/buy507/mall/portal/vo/TransactionPointsVo.java
@@ -0,0 +1,21 @@
+package com.buy507.mall.portal.vo;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class TransactionPointsVo implements Serializable {
+ //积分数额
+ private Integer revenuePoints;
+
+ //备注
+ private String remarks;
+
+ //时间
+ private Data transferPaymentTime;
+}
diff --git a/mall-portal/src/main/java/com/buy507/mall/portal/vo/WalletCashVo.java b/mall-portal/src/main/java/com/buy507/mall/portal/vo/WalletCashVo.java
new file mode 100644
index 0000000..934f8da
--- /dev/null
+++ b/mall-portal/src/main/java/com/buy507/mall/portal/vo/WalletCashVo.java
@@ -0,0 +1,16 @@
+package com.buy507.mall.portal.vo;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+@Data
+public class WalletCashVo {
+
+ // 余额现金
+ private BigDecimal balance;
+
+ //现金流水
+ private List cashVoList;
+}
diff --git a/mall-portal/src/main/java/com/buy507/mall/portal/vo/WalletPointsVo.java b/mall-portal/src/main/java/com/buy507/mall/portal/vo/WalletPointsVo.java
new file mode 100644
index 0000000..55b0fdc
--- /dev/null
+++ b/mall-portal/src/main/java/com/buy507/mall/portal/vo/WalletPointsVo.java
@@ -0,0 +1,15 @@
+package com.buy507.mall.portal.vo;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+@Data
+public class WalletPointsVo {
+ // 余额积分
+ private Integer integration;
+
+ //积分流水
+ private List pointsVoList;
+}
diff --git a/mall-portal/src/main/resources/dao/MyWalletMapper.xml b/mall-portal/src/main/resources/dao/MyWalletMapper.xml
new file mode 100644
index 0000000..0daca2c
--- /dev/null
+++ b/mall-portal/src/main/resources/dao/MyWalletMapper.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file