设备交易记录、商户交易记录
This commit is contained in:
1 parent
d3926e63ad
commit
83d91ae763
14 files changed
+464
-88
No files matched your search
+11
-3
@@ -11,6 +11,8 @@ import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@@ -25,13 +27,19 @@ public class WalletTransactionCzExcelVo {
|
||||
@ExcelProperty("姓名")
|
||||
private String username;
|
||||
|
||||
@ExcelProperty("部门")
|
||||
@ExcelProperty("手机号")
|
||||
private String userMobile;
|
||||
|
||||
@ExcelProperty("充值金额")
|
||||
@ExcelProperty("部门")
|
||||
private String userDeptName;
|
||||
|
||||
@ExcelProperty("充值时间")
|
||||
@ExcelProperty("充值类型")
|
||||
private String title;
|
||||
|
||||
@ExcelProperty("充值金额")
|
||||
private String price;
|
||||
|
||||
@ExcelProperty("充值时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
+13
-5
@@ -7,6 +7,8 @@ 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.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScopeFuncEnum;
|
||||
import com.bsd.pjcloud.common.log.annotation.SysLog;
|
||||
import com.bsd.pjcloud.common.security.annotation.Inner;
|
||||
import com.bsd.pjcloud.common.security.service.PjcloudUser;
|
||||
@@ -73,7 +75,9 @@ public class WalletTransactionController {
|
||||
public R appGetAll(@ParameterObject Page page, @ParameterObject WalletTransactionDto dto) {
|
||||
PjcloudUser user = SecurityUtils.getUser();
|
||||
dto.setUserId(user.getId());
|
||||
return R.ok(walletTransactionService.pageJoin(page, dto));
|
||||
DataScope dataScope = new DataScope();
|
||||
dataScope.func(DataScopeFuncEnum.ALL);
|
||||
return R.ok(walletTransactionService.scopePageList(page, dto, dataScope));
|
||||
}
|
||||
/* ************************************* end app end ************************************* */
|
||||
|
||||
@@ -88,7 +92,8 @@ public class WalletTransactionController {
|
||||
@GetMapping("/page-cz")
|
||||
public R pageCz(@ParameterObject Page page, @ParameterObject WalletTransactionDto dto) {
|
||||
dto.setBizTypes(List.of(WalletBizEnum.RECHARGE.getCode()));
|
||||
return R.ok(walletTransactionService.scopePageList(page, dto));
|
||||
DataScope dataScope = new DataScope();
|
||||
return R.ok(walletTransactionService.scopePageList(page, dto, dataScope));
|
||||
}
|
||||
|
||||
@Operation(summary = "后台消费分页", description = "后台消费分页")
|
||||
@@ -96,7 +101,8 @@ public class WalletTransactionController {
|
||||
public R pageXf(@ParameterObject Page page, @ParameterObject WalletTransactionDto dto) {
|
||||
dto.setBizTypes(List.of(WalletBizEnum.PAYMENT.getCode()));
|
||||
dto.setIsFindOrder(true);
|
||||
return R.ok(walletTransactionService.scopePageList(page, dto));
|
||||
DataScope dataScope = new DataScope();
|
||||
return R.ok(walletTransactionService.scopePageList(page, dto, dataScope));
|
||||
}
|
||||
|
||||
@Operation(summary = "后台退款分页", description = "后台退款分页")
|
||||
@@ -104,14 +110,16 @@ public class WalletTransactionController {
|
||||
public R pageTk(@ParameterObject Page page, @ParameterObject WalletTransactionDto dto) {
|
||||
dto.setBizTypes(List.of(WalletBizEnum.REFUND.getCode()));
|
||||
dto.setIsFindOrder(true);
|
||||
return R.ok(walletTransactionService.scopePageList(page, dto));
|
||||
DataScope dataScope = new DataScope();
|
||||
return R.ok(walletTransactionService.scopePageList(page, dto, dataScope));
|
||||
}
|
||||
|
||||
@Operation(summary = "分页查询复杂查询", description = "分页查询复杂查询")
|
||||
@GetMapping("/page-join")
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletTransaction_view')")
|
||||
public R getWalletTransactionPageJoin(@ParameterObject Page page, @ParameterObject WalletTransactionDto dto) {
|
||||
return R.ok(walletTransactionService.scopePageList(page, dto));
|
||||
DataScope dataScope = new DataScope();
|
||||
return R.ok(walletTransactionService.scopePageList(page, dto, dataScope));
|
||||
}
|
||||
|
||||
@Operation(summary = "通过id查询", description = "通过id查询")
|
||||
|
||||
+7
-24
@@ -22,28 +22,6 @@ import java.util.Objects;
|
||||
@Mapper
|
||||
public interface WalletTransactionMapper extends PjcloudBaseMapper<WalletTransactionEntity> {
|
||||
|
||||
default Page<WalletTransactionVo> pageJoin(Page page, 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 selectJoinPage(page, WalletTransactionVo.class, wrapper);
|
||||
}
|
||||
|
||||
default List<WalletTransactionVo> pageList(WalletTransactionDto dto) {
|
||||
MPJLambdaWrapper<WalletTransactionEntity> wrapper = new MPJLambdaWrapper<WalletTransactionEntity>()
|
||||
.selectAll(WalletTransactionEntity.class)
|
||||
@@ -66,7 +44,7 @@ public interface WalletTransactionMapper extends PjcloudBaseMapper<WalletTransac
|
||||
return selectJoinList(WalletTransactionVo.class, wrapper);
|
||||
}
|
||||
|
||||
default Page<WalletTransactionVo> scopePageList(Page page, WalletTransactionDto dto) {
|
||||
default Page<WalletTransactionVo> scopePageList(Page page, WalletTransactionDto dto, DataScope dataScope) {
|
||||
LambdaQueryWrapper<WalletTransactionEntity> wrapper = new LambdaQueryWrapper<WalletTransactionEntity>()
|
||||
.eq(ObjectUtil.isNotEmpty(dto.getWalletId()), WalletTransactionEntity::getWalletId, dto.getWalletId())
|
||||
.eq(ObjectUtil.isNotEmpty(dto.getBizType()), WalletTransactionEntity::getBizType, dto.getBizType())
|
||||
@@ -78,7 +56,12 @@ public interface WalletTransactionMapper extends PjcloudBaseMapper<WalletTransac
|
||||
ObjectUtil.isNotEmpty(dto.getCreateTimeList()) ? dto.getCreateTimeList()[0] : null,
|
||||
ObjectUtil.isNotEmpty(dto.getCreateTimeList()) ? dto.getCreateTimeList()[1] : null
|
||||
);
|
||||
Page list = selectPageByScope(page, wrapper, DataScope.of());
|
||||
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);
|
||||
}
|
||||
Page list = selectPageByScope(page, wrapper, dataScope);
|
||||
list.setRecords(BeanUtils.toBean(list.getRecords(), WalletTransactionVo.class));
|
||||
return list;
|
||||
}
|
||||
|
||||
+3
-3
@@ -2,6 +2,7 @@ package com.bsd.pjcloud.wallet.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.wallet.api.constant.WalletBizEnum;
|
||||
import com.bsd.pjcloud.wallet.api.dto.WalletTransactionDto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletTransactionEntity;
|
||||
@@ -11,9 +12,7 @@ import java.util.List;
|
||||
|
||||
public interface WalletTransactionService extends IService<WalletTransactionEntity> {
|
||||
|
||||
Page<WalletTransactionVo> scopePageList(Page page, WalletTransactionDto dto);
|
||||
|
||||
Page<WalletTransactionVo> pageJoin(Page page, WalletTransactionDto dto);
|
||||
Page<WalletTransactionVo> scopePageList(Page page, WalletTransactionDto dto, DataScope dataScope);
|
||||
|
||||
List<WalletTransactionVo> pageList(WalletTransactionDto dto);
|
||||
|
||||
@@ -42,6 +41,7 @@ public interface WalletTransactionService extends IService<WalletTransactionEnti
|
||||
|
||||
/**
|
||||
* 更新会员用户余额
|
||||
*
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
|
||||
+3
-50
@@ -13,6 +13,7 @@ import com.bsd.pjcloud.admin.api.utils.DataUtil;
|
||||
import com.bsd.pjcloud.common.core.constant.CacheConstants;
|
||||
import com.bsd.pjcloud.common.core.util.CollectionUtils;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.wallet.api.constant.WalletBizEnum;
|
||||
import com.bsd.pjcloud.wallet.api.dto.WalletManageDto;
|
||||
import com.bsd.pjcloud.wallet.api.dto.WalletTransactionDto;
|
||||
@@ -152,56 +153,8 @@ public class WalletTransactionServiceImpl extends ServiceImpl<WalletTransactionM
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<WalletTransactionVo> scopePageList(Page page, WalletTransactionDto dto) {
|
||||
Page<WalletTransactionVo> list = baseMapper.scopePageList(page, dto);
|
||||
if (ObjectUtil.isNotEmpty(list.getRecords())) {
|
||||
// 用户
|
||||
List<Long> userIds = list.getRecords().stream().map(WalletTransactionVo::getUserId).distinct().toList();
|
||||
R<List<SysUser>> userList = userService.getUserById(new ArrayList<>(userIds));
|
||||
if (ObjectUtil.isNotEmpty(userList.getData())) {
|
||||
DataUtil.convertUserList(list.getRecords(), CollectionUtils.convertMap(userList.getData(), SysUser::getUserId));
|
||||
}
|
||||
// 部门
|
||||
List<Long> deptIds = list.getRecords().stream().map(WalletTransactionVo::getDeptId).distinct().toList();
|
||||
R<Map<Long, SysDept>> deptList = deptService.getDeptByDeptIds(deptIds);
|
||||
if (ObjectUtil.isNotEmpty(deptList.getData())) {
|
||||
DataUtil.convertDeptList(list.getRecords(), deptList.getData());
|
||||
}
|
||||
// 饭卡
|
||||
List<Long> walletIds = list.getRecords().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.getRecords(), CollectionUtils.convertMap(walletList, WalletManageEntity::getId));
|
||||
}
|
||||
}
|
||||
// 饭卡类型
|
||||
List<Long> walletTypeIds = list.getRecords().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.getRecords(), CollectionUtils.convertMap(walletTypeList, WalletTypeEntity::getId));
|
||||
}
|
||||
}
|
||||
// 订单
|
||||
if (dto.getIsFindOrder()) {
|
||||
list.getRecords().forEach(v -> {
|
||||
if (ObjectUtil.isNotEmpty(v.getBizId())) {
|
||||
v.setOrderId(Long.valueOf(v.getBizId()));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<WalletTransactionVo> pageJoin(Page page, WalletTransactionDto dto) {
|
||||
Page<WalletTransactionVo> list = baseMapper.pageJoin(page, dto);
|
||||
public Page<WalletTransactionVo> scopePageList(Page page, WalletTransactionDto dto, DataScope dataScope) {
|
||||
Page<WalletTransactionVo> list = baseMapper.scopePageList(page, dto, dataScope);
|
||||
if (ObjectUtil.isNotEmpty(list.getRecords())) {
|
||||
// 用户
|
||||
List<Long> userIds = list.getRecords().stream().map(WalletTransactionVo::getUserId).distinct().toList();
|
||||
|
||||
Reference in new issue
Block a user