From cadeca36ff86f74371c77a05dc8422abc1e48855 Mon Sep 17 00:00:00 2001
From: KKSU <15274802129@163.com>
Date: Thu, 19 Dec 2024 16:28:40 +0800
Subject: [PATCH] feat(table): 添加合计行功能 - 在 mallMemberList.html 中添加了 totalRow 属性,用于显示碳币和碳积分的合计 - 在 moneyFlowList.html 中移除了 description 字段的 totalRow属性 - 在 sellVipList.html 中将 amount 和 amountFee 字段的 totalRow 属性改为 true
---
src/main/java/cc/mrbird/febs/mall/service/impl/AdminRunVipServiceImpl.java | 98 +++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 98 insertions(+), 0 deletions(-)
diff --git a/src/main/java/cc/mrbird/febs/mall/service/impl/AdminRunVipServiceImpl.java b/src/main/java/cc/mrbird/febs/mall/service/impl/AdminRunVipServiceImpl.java
index 2dc37af..07f46ee 100644
--- a/src/main/java/cc/mrbird/febs/mall/service/impl/AdminRunVipServiceImpl.java
+++ b/src/main/java/cc/mrbird/febs/mall/service/impl/AdminRunVipServiceImpl.java
@@ -1,9 +1,22 @@
package cc.mrbird.febs.mall.service.impl;
+import cc.mrbird.febs.common.entity.FebsResponse;
import cc.mrbird.febs.common.entity.QueryRequest;
+import cc.mrbird.febs.common.enumerates.RunVipMoneyFlowTypeEnum;
+import cc.mrbird.febs.common.enumerates.YesOrNoEnum;
+import cc.mrbird.febs.common.exception.FebsException;
+import cc.mrbird.febs.mall.entity.MallCharge;
+import cc.mrbird.febs.mall.entity.MallMemberWithdraw;
+import cc.mrbird.febs.mall.entity.MallMoneyFlow;
import cc.mrbird.febs.mall.entity.RunVip;
+import cc.mrbird.febs.mall.mapper.MallChargeMapper;
+import cc.mrbird.febs.mall.mapper.MallMemberWithdrawMapper;
+import cc.mrbird.febs.mall.mapper.MallMoneyFlowMapper;
import cc.mrbird.febs.mall.mapper.RunVipMapper;
import cc.mrbird.febs.mall.service.IAdminRunVipService;
+import cc.mrbird.febs.rabbit.producter.AgentProducer;
+import cn.hutool.core.util.ObjectUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -12,6 +25,9 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
+import java.util.ArrayList;
+import java.util.List;
+
@Slf4j
@Service
@RequiredArgsConstructor
@@ -19,6 +35,10 @@
public class AdminRunVipServiceImpl extends ServiceImpl<RunVipMapper, RunVip> implements IAdminRunVipService {
private final RunVipMapper runVipMapper;
+ private final MallChargeMapper mallChargeMapper;
+ private final MallMemberWithdrawMapper mallMemberWithdrawMapper;
+ private final MallMoneyFlowMapper mallMoneyFlowMapper;
+ private final AgentProducer agentProducer;
@Override
public IPage<RunVip> runVipListInPage(RunVip runVip,QueryRequest request) {
Page<RunVip> page = new Page<>(request.getPageNum(), request.getPageSize());
@@ -34,4 +54,82 @@
public void editVip(RunVip config) {
this.baseMapper.updateById(config);
}
+
+ @Override
+ public IPage<MallCharge> buyList(MallCharge mallCharge, QueryRequest request) {
+ Page<MallCharge> page = new Page<>(request.getPageNum(), request.getPageSize());
+ IPage<MallCharge> adminChargeListVoIPage = mallChargeMapper.selectAdminChargeListInPage(page, mallCharge);
+ return adminChargeListVoIPage;
+ }
+
+ @Override
+ public FebsResponse chargeAgree(Integer state, Long id) {
+ MallCharge mallCharge = mallChargeMapper.selectById(id);
+
+ if(ObjectUtil.isEmpty(mallCharge)){
+ throw new FebsException("记录不存在");
+ }
+ if(YesOrNoEnum.ING.getValue() != mallCharge.getState()){
+ throw new FebsException("记录不是进行中状态");
+ }
+ if(YesOrNoEnum.YES.getValue() == state){
+ mallCharge.setState(YesOrNoEnum.YES.getValue());
+ }
+ if(YesOrNoEnum.NO.getValue() == state){
+ mallCharge.setState(YesOrNoEnum.NO.getValue());
+ }
+ mallCharge.setRevision(mallCharge.getRevision()+1);
+ mallChargeMapper.updateById(mallCharge);
+
+ if(mallCharge.getState() == YesOrNoEnum.YES.getValue()){
+ agentProducer.sendBuyVipSuccessMsg(mallCharge.getId());
+ }
+ return new FebsResponse().success().message("操作成功");
+ }
+
+ @Override
+ public FebsResponse sellAgree(Integer state, Long id) {
+ MallMemberWithdraw mallMemberWithdraw = mallMemberWithdrawMapper.selectById(id);
+ if(ObjectUtil.isEmpty(mallMemberWithdraw)){
+ throw new FebsException("记录不存在");
+ }
+ if(YesOrNoEnum.ING.getValue() != mallMemberWithdraw.getStatus()){
+ throw new FebsException("记录不是进行中状态");
+ }
+ if(YesOrNoEnum.YES.getValue() == state){
+ mallMemberWithdraw.setStatus(YesOrNoEnum.YES.getValue());
+ }
+ if(YesOrNoEnum.NO.getValue() == state){
+ mallMemberWithdraw.setStatus(YesOrNoEnum.NO.getValue());
+ }
+ mallMemberWithdraw.setRevision(mallMemberWithdraw.getRevision()+1);
+ mallMemberWithdrawMapper.updateById(mallMemberWithdraw);
+
+ MallMoneyFlow mallMoneyFlow = mallMoneyFlowMapper.selectOne(new LambdaQueryWrapper<MallMoneyFlow>().eq(MallMoneyFlow::getOrderNo, mallMemberWithdraw.getWithdrawNo()));
+ mallMoneyFlow.setStatus(mallMemberWithdraw.getStatus());
+ mallMoneyFlowMapper.updateById(mallMoneyFlow);
+ return new FebsResponse().success().message("操作成功");
+ }
+
+ @Override
+ public IPage<MallMemberWithdraw> sellList(MallMemberWithdraw mallMemberWithdraw, QueryRequest request) {
+ Page<MallMemberWithdraw> page = new Page<>(request.getPageNum(), request.getPageSize());
+ IPage<MallMemberWithdraw> adminChargeListVoIPage = mallChargeMapper.selectAdminWithdrawListInPage(page, mallMemberWithdraw);
+ return adminChargeListVoIPage;
+ }
+
+ @Override
+ public List<MallMoneyFlow> allMoneyType() {
+ List<MallMoneyFlow> mallMoneyFlows = new ArrayList<>();
+ RunVipMoneyFlowTypeEnum[] values = RunVipMoneyFlowTypeEnum.values();
+ for (RunVipMoneyFlowTypeEnum value : values) {
+ MallMoneyFlow mallMoneyFlow = new MallMoneyFlow();
+ mallMoneyFlow.setType(value.getValue());
+ mallMoneyFlow.setDescription(value.getDescription());
+ mallMoneyFlow.setRemark(value.getTypeDec());
+ mallMoneyFlows.add(mallMoneyFlow);
+ }
+
+ return mallMoneyFlows;
+ }
}
--
Gitblit v1.9.1