Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
e250a1083c
7 files changed
+210
-3
No files matched your search
+37
@@ -0,0 +1,37 @@
|
||||
package com.bsd.pjcloud.wallet.api.vo.recharge.excel;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.alibaba.excel.annotation.write.style.ColumnWidth;
|
||||
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
|
||||
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Accessors(chain = false)
|
||||
@HeadRowHeight(40)
|
||||
@ColumnWidth(50)
|
||||
@ContentRowHeight(20)
|
||||
@ExcelIgnoreUnannotated
|
||||
public class WalletTransactionCzExcelVo {
|
||||
|
||||
@ExcelProperty("姓名")
|
||||
private String username;
|
||||
|
||||
@ExcelProperty("部门")
|
||||
private String userMobile;
|
||||
|
||||
@ExcelProperty("充值金额")
|
||||
private String userDeptName;
|
||||
|
||||
@ExcelProperty("充值时间")
|
||||
private String price;
|
||||
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
package com.bsd.pjcloud.wallet.api.vo.recharge.excel;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.alibaba.excel.annotation.write.style.ColumnWidth;
|
||||
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
|
||||
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Accessors(chain = false)
|
||||
@HeadRowHeight(40)
|
||||
@ColumnWidth(50)
|
||||
@ContentRowHeight(20)
|
||||
@ExcelIgnoreUnannotated
|
||||
public class WalletTransactionTkExcelVo {
|
||||
|
||||
@ExcelProperty("姓名")
|
||||
private String username;
|
||||
|
||||
@ExcelProperty("部门")
|
||||
private String userMobile;
|
||||
|
||||
@ExcelProperty("用户部门")
|
||||
private String userDeptName;
|
||||
|
||||
@ExcelProperty("充值金额")
|
||||
private String price;
|
||||
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
package com.bsd.pjcloud.wallet.api.vo.recharge.excel;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.alibaba.excel.annotation.write.style.ColumnWidth;
|
||||
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
|
||||
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Accessors(chain = false)
|
||||
@HeadRowHeight(40)
|
||||
@ColumnWidth(50)
|
||||
@ContentRowHeight(20)
|
||||
@ExcelIgnoreUnannotated
|
||||
public class WalletTransactionXfExcelVo {
|
||||
|
||||
@ExcelProperty("姓名")
|
||||
private String username;
|
||||
|
||||
@ExcelProperty("部门")
|
||||
private String userMobile;
|
||||
|
||||
@ExcelProperty("充值金额")
|
||||
private String userDeptName;
|
||||
|
||||
@ExcelProperty("充值时间")
|
||||
private String price;
|
||||
|
||||
}
|
||||
+33
-3
@@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.common.core.util.BeanUtils;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.log.annotation.SysLog;
|
||||
import com.bsd.pjcloud.common.security.annotation.Inner;
|
||||
@@ -14,6 +15,10 @@ import com.bsd.pjcloud.wallet.api.constant.WalletBizEnum;
|
||||
import com.bsd.pjcloud.wallet.api.dto.WalletBalanceTransactionDto;
|
||||
import com.bsd.pjcloud.wallet.api.dto.WalletTransactionDto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletTransactionEntity;
|
||||
import com.bsd.pjcloud.wallet.api.vo.recharge.excel.WalletTransactionCzExcelVo;
|
||||
import com.bsd.pjcloud.wallet.api.vo.recharge.excel.WalletTransactionTkExcelVo;
|
||||
import com.bsd.pjcloud.wallet.api.vo.recharge.excel.WalletTransactionXfExcelVo;
|
||||
import com.bsd.pjcloud.wallet.api.vo.transaction.WalletTransactionVo;
|
||||
import com.bsd.pjcloud.wallet.service.WalletTransactionService;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@@ -26,6 +31,7 @@ import io.swagger.v3.oas.annotations.Operation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -140,9 +146,33 @@ public class WalletTransactionController {
|
||||
}
|
||||
|
||||
@ResponseExcel
|
||||
@GetMapping("/export")
|
||||
@Operation(summary = "充值导出", description = "充值导出")
|
||||
@GetMapping("/export-cz")
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletTransaction_export')")
|
||||
public List<WalletTransactionEntity> export(WalletTransactionEntity walletTransaction, Long[] ids) {
|
||||
return walletTransactionService.list(Wrappers.lambdaQuery(walletTransaction).in(ArrayUtil.isNotEmpty(ids), WalletTransactionEntity::getId, ids));
|
||||
public List<WalletTransactionCzExcelVo> exportCz(WalletTransactionDto dto) {
|
||||
dto.setBizTypes(List.of(WalletBizEnum.RECHARGE.getCode()));
|
||||
List<WalletTransactionVo> list = walletTransactionService.pageList(dto);
|
||||
return BeanUtils.toBean(list, WalletTransactionCzExcelVo.class);
|
||||
}
|
||||
|
||||
@ResponseExcel
|
||||
@Operation(summary = "消费导出", description = "消费导出")
|
||||
@GetMapping("/export-xf")
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletTransaction_export')")
|
||||
public List<WalletTransactionXfExcelVo> exportXf(WalletTransactionDto dto) {
|
||||
dto.setBizTypes(List.of(WalletBizEnum.PAYMENT.getCode()));
|
||||
List<WalletTransactionVo> list = walletTransactionService.pageList(dto);
|
||||
return BeanUtils.toBean(list, WalletTransactionXfExcelVo.class);
|
||||
}
|
||||
|
||||
@ResponseExcel
|
||||
@Operation(summary = "退款导出", description = "退款导出")
|
||||
@GetMapping("/export-tk")
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletTransaction_export')")
|
||||
public List<WalletTransactionTkExcelVo> exportTk(WalletTransactionDto dto) {
|
||||
dto.setBizTypes(List.of(WalletBizEnum.REFUND.getCode()));
|
||||
dto.setIsFindOrder(true);
|
||||
List<WalletTransactionVo> list = walletTransactionService.pageList(dto);
|
||||
return BeanUtils.toBean(list, WalletTransactionTkExcelVo.class);
|
||||
}
|
||||
}
|
||||
+22
@@ -44,6 +44,28 @@ public interface WalletTransactionMapper extends PjcloudBaseMapper<WalletTransac
|
||||
return selectJoinPage(page, WalletTransactionVo.class, wrapper);
|
||||
}
|
||||
|
||||
default List<WalletTransactionVo> pageList(WalletTransactionDto dto) {
|
||||
MPJLambdaWrapper<WalletTransactionEntity> wrapper = new MPJLambdaWrapper<WalletTransactionEntity>()
|
||||
.selectAll(WalletTransactionEntity.class)
|
||||
.selectAs(WalletManageEntity::getUserId, WalletTransactionVo::getUserId)
|
||||
.selectAs(WalletManageEntity::getDeptId, WalletTransactionVo::getDeptId)
|
||||
.selectAs(WalletTypeEntity::getName, WalletTransactionVo::getWalletTypeName)
|
||||
.selectAs(WalletTypeEntity::getUniqueCode, WalletTransactionVo::getWalletTypeUniqueCode)
|
||||
.leftJoin(WalletManageEntity.class, WalletManageEntity::getId, WalletTransactionEntity::getWalletId)
|
||||
.leftJoin(WalletTypeEntity.class, WalletTypeEntity::getId, WalletManageEntity::getWalletTypeId)
|
||||
.eqIfExists(WalletTransactionEntity::getWalletId, dto.getWalletId())
|
||||
.eqIfExists(WalletTransactionEntity::getBizType, dto.getBizType())
|
||||
.eqIfExists(WalletManageEntity::getWalletTypeId, dto.getWalletTypeId())
|
||||
.in(ObjectUtil.isNotEmpty(dto.getBizTypes()), WalletTransactionEntity::getBizType, dto.getBizTypes())
|
||||
.in(ObjectUtil.isNotEmpty(dto.getUserIds()), WalletManageEntity::getUserId, dto.getUserIds());
|
||||
if (ObjectUtil.equals(dto.getType(), WalletTransactionDto.TYPE_INCOME)) {
|
||||
wrapper.gt(WalletTransactionEntity::getPrice, 0);
|
||||
} else if (Objects.equals(dto.getType(), WalletTransactionDto.TYPE_EXPENSE)) {
|
||||
wrapper.lt(WalletTransactionEntity::getPrice, 0);
|
||||
}
|
||||
return selectJoinList(WalletTransactionVo.class, wrapper);
|
||||
}
|
||||
|
||||
default Page<WalletTransactionVo> scopePageList(Page page, WalletTransactionDto dto) {
|
||||
LambdaQueryWrapper<WalletTransactionEntity> wrapper = new LambdaQueryWrapper<WalletTransactionEntity>()
|
||||
.eq(ObjectUtil.isNotEmpty(dto.getWalletId()), WalletTransactionEntity::getWalletId, dto.getWalletId())
|
||||
|
||||
+4
@@ -7,12 +7,16 @@ import com.bsd.pjcloud.wallet.api.dto.WalletTransactionDto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletTransactionEntity;
|
||||
import com.bsd.pjcloud.wallet.api.vo.transaction.WalletTransactionVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface WalletTransactionService extends IService<WalletTransactionEntity> {
|
||||
|
||||
Page<WalletTransactionVo> scopePageList(Page page, WalletTransactionDto dto);
|
||||
|
||||
Page<WalletTransactionVo> pageJoin(Page page, WalletTransactionDto dto);
|
||||
|
||||
List<WalletTransactionVo> pageList(WalletTransactionDto dto);
|
||||
|
||||
/**
|
||||
* 扣减钱包余额
|
||||
*
|
||||
|
||||
+40
@@ -246,4 +246,44 @@ public class WalletTransactionServiceImpl extends ServiceImpl<WalletTransactionM
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<WalletTransactionVo> pageList(WalletTransactionDto dto) {
|
||||
List<WalletTransactionVo> list = baseMapper.pageList(dto);
|
||||
if (ObjectUtil.isNotEmpty(list)) {
|
||||
// 用户
|
||||
List<Long> userIds = list.stream().map(WalletTransactionVo::getUserId).distinct().toList();
|
||||
R<List<SysUser>> userList = userService.getUserById(new ArrayList<>(userIds));
|
||||
if (ObjectUtil.isNotEmpty(userList.getData())) {
|
||||
DataUtil.convertUserList(list, CollectionUtils.convertMap(userList.getData(), SysUser::getUserId));
|
||||
}
|
||||
// 部门
|
||||
List<Long> deptIds = list.stream().map(WalletTransactionVo::getDeptId).distinct().toList();
|
||||
R<Map<Long, SysDept>> deptList = deptService.getDeptByDeptIds(deptIds);
|
||||
if (ObjectUtil.isNotEmpty(deptList.getData())) {
|
||||
DataUtil.convertDeptList(list, deptList.getData());
|
||||
}
|
||||
// 饭卡
|
||||
List<Long> walletIds = list.stream().map(WalletTransactionVo::getWalletId).distinct().toList();
|
||||
if (ObjectUtil.isNotEmpty(walletIds)) {
|
||||
WalletManageDto walletManageDto = new WalletManageDto();
|
||||
walletManageDto.setWalletIds(walletIds);
|
||||
List<WalletManageEntity> walletList = walletManageMapper.list(walletManageDto);
|
||||
if (ObjectUtil.isNotEmpty(walletList)) {
|
||||
WalletDataUtil.convertWalletList(list, CollectionUtils.convertMap(walletList, WalletManageEntity::getId));
|
||||
}
|
||||
}
|
||||
// 饭卡类型
|
||||
List<Long> walletTypeIds = list.stream().map(WalletTransactionVo::getWalletTypeId).distinct().toList();
|
||||
if (ObjectUtil.isNotEmpty(walletTypeIds)) {
|
||||
WalletTypeDto walletTypeDto = new WalletTypeDto();
|
||||
walletTypeDto.setWalletTypeIds(walletTypeIds);
|
||||
List<WalletTypeEntity> walletTypeList = walletTypeMapper.list(walletTypeDto);
|
||||
if (ObjectUtil.isNotEmpty(walletTypeList)) {
|
||||
WalletDataUtil.convertWalletTypeList(list, CollectionUtils.convertMap(walletTypeList, WalletTypeEntity::getId));
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user