Compare commits
3 Commits
be54601cdd
...
6fad3b45fe
| Author | SHA1 | Date | |
|---|---|---|---|
| 6fad3b45fe | |||
| a8da54c130 | |||
| d105bd4fa6 |
@@ -90,14 +90,6 @@ public class KeyboardTenantCommissionController {
|
|||||||
return success(BeanUtils.toBean(pageResult, KeyboardTenantCommissionRespVO.class));
|
return success(BeanUtils.toBean(pageResult, KeyboardTenantCommissionRespVO.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/my-page")
|
|
||||||
@Operation(summary = "获得当前登录租户的分成记录分页")
|
|
||||||
@PreAuthorize("@ss.hasPermission('keyboard:tenant-commission:query:mypage')")
|
|
||||||
public CommonResult<PageResult<KeyboardTenantCommissionRespVO>> getMyTenantCommissionPage(@Valid KeyboardTenantCommissionPageReqVO pageReqVO) {
|
|
||||||
PageResult<KeyboardTenantCommissionDO> pageResult = tenantCommissionService.getMyTenantCommissionPage(pageReqVO);
|
|
||||||
return success(BeanUtils.toBean(pageResult, KeyboardTenantCommissionRespVO.class));
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/export-excel")
|
@GetMapping("/export-excel")
|
||||||
@Operation(summary = "导出租户内购分成记录 Excel")
|
@Operation(summary = "导出租户内购分成记录 Excel")
|
||||||
@PreAuthorize("@ss.hasPermission('keyboard:tenant-commission:export')")
|
@PreAuthorize("@ss.hasPermission('keyboard:tenant-commission:export')")
|
||||||
|
|||||||
@@ -14,6 +14,9 @@ import static com.yolo.keyboard.framework.common.util.date.DateUtils.FORMAT_YEAR
|
|||||||
@Data
|
@Data
|
||||||
public class KeyboardTenantCommissionPageReqVO extends PageParam {
|
public class KeyboardTenantCommissionPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "租户ID", example = "1", hidden = true)
|
||||||
|
private Long tenantId;
|
||||||
|
|
||||||
@Schema(description = "内购记录ID", example = "20900")
|
@Schema(description = "内购记录ID", example = "20900")
|
||||||
private Integer purchaseRecordId;
|
private Integer purchaseRecordId;
|
||||||
|
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ public interface KeyboardTenantCommissionMapper extends BaseMapperX<KeyboardTena
|
|||||||
|
|
||||||
default PageResult<KeyboardTenantCommissionDO> selectPage(KeyboardTenantCommissionPageReqVO reqVO) {
|
default PageResult<KeyboardTenantCommissionDO> selectPage(KeyboardTenantCommissionPageReqVO reqVO) {
|
||||||
return selectPage(reqVO, new LambdaQueryWrapperX<KeyboardTenantCommissionDO>()
|
return selectPage(reqVO, new LambdaQueryWrapperX<KeyboardTenantCommissionDO>()
|
||||||
|
.eqIfPresent(KeyboardTenantCommissionDO::getTenantId, reqVO.getTenantId())
|
||||||
.eqIfPresent(KeyboardTenantCommissionDO::getPurchaseRecordId, reqVO.getPurchaseRecordId())
|
.eqIfPresent(KeyboardTenantCommissionDO::getPurchaseRecordId, reqVO.getPurchaseRecordId())
|
||||||
.eqIfPresent(KeyboardTenantCommissionDO::getTransactionId, reqVO.getTransactionId())
|
.eqIfPresent(KeyboardTenantCommissionDO::getTransactionId, reqVO.getTransactionId())
|
||||||
.eqIfPresent(KeyboardTenantCommissionDO::getInviteeUserId, reqVO.getInviteeUserId())
|
.eqIfPresent(KeyboardTenantCommissionDO::getInviteeUserId, reqVO.getInviteeUserId())
|
||||||
@@ -57,28 +58,4 @@ public interface KeyboardTenantCommissionMapper extends BaseMapperX<KeyboardTena
|
|||||||
.eqIfPresent(KeyboardTenantCommissionDO::getRemark, reqVO.getRemark())
|
.eqIfPresent(KeyboardTenantCommissionDO::getRemark, reqVO.getRemark())
|
||||||
.orderByDesc(KeyboardTenantCommissionDO::getId));
|
.orderByDesc(KeyboardTenantCommissionDO::getId));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据租户ID分页查询分成记录
|
|
||||||
*/
|
|
||||||
default PageResult<KeyboardTenantCommissionDO> selectPageByTenantId(KeyboardTenantCommissionPageReqVO reqVO, Long tenantId) {
|
|
||||||
return selectPage(reqVO, new LambdaQueryWrapperX<KeyboardTenantCommissionDO>()
|
|
||||||
.eq(KeyboardTenantCommissionDO::getTenantId, tenantId)
|
|
||||||
.eqIfPresent(KeyboardTenantCommissionDO::getPurchaseRecordId, reqVO.getPurchaseRecordId())
|
|
||||||
.eqIfPresent(KeyboardTenantCommissionDO::getTransactionId, reqVO.getTransactionId())
|
|
||||||
.eqIfPresent(KeyboardTenantCommissionDO::getInviteeUserId, reqVO.getInviteeUserId())
|
|
||||||
.eqIfPresent(KeyboardTenantCommissionDO::getInviterUserId, reqVO.getInviterUserId())
|
|
||||||
.eqIfPresent(KeyboardTenantCommissionDO::getPurchaseAmount, reqVO.getPurchaseAmount())
|
|
||||||
.eqIfPresent(KeyboardTenantCommissionDO::getCommissionRate, reqVO.getCommissionRate())
|
|
||||||
.eqIfPresent(KeyboardTenantCommissionDO::getCommissionAmount, reqVO.getCommissionAmount())
|
|
||||||
.eqIfPresent(KeyboardTenantCommissionDO::getStatus, reqVO.getStatus())
|
|
||||||
.betweenIfPresent(KeyboardTenantCommissionDO::getPurchaseTime, reqVO.getPurchaseTime())
|
|
||||||
.eqIfPresent(KeyboardTenantCommissionDO::getSettledAt, reqVO.getSettledAt())
|
|
||||||
.eqIfPresent(KeyboardTenantCommissionDO::getBalanceTransactionId, reqVO.getBalanceTransactionId())
|
|
||||||
.eqIfPresent(KeyboardTenantCommissionDO::getCreatedAt, reqVO.getCreatedAt())
|
|
||||||
.eqIfPresent(KeyboardTenantCommissionDO::getUpdatedAt, reqVO.getUpdatedAt())
|
|
||||||
.eqIfPresent(KeyboardTenantCommissionDO::getRemark, reqVO.getRemark())
|
|
||||||
.orderByDesc(KeyboardTenantCommissionDO::getId));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,6 +65,5 @@ public interface KeyboardTenantCommissionService {
|
|||||||
* @param pageReqVO 分页查询
|
* @param pageReqVO 分页查询
|
||||||
* @return 租户内购分成记录分页
|
* @return 租户内购分成记录分页
|
||||||
*/
|
*/
|
||||||
PageResult<KeyboardTenantCommissionDO> getMyTenantCommissionPage(KeyboardTenantCommissionPageReqVO pageReqVO);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -15,6 +15,8 @@ import com.yolo.keyboard.framework.common.util.object.BeanUtils;
|
|||||||
|
|
||||||
import com.yolo.keyboard.dal.mysql.tenantcommission.KeyboardTenantCommissionMapper;
|
import com.yolo.keyboard.dal.mysql.tenantcommission.KeyboardTenantCommissionMapper;
|
||||||
import com.yolo.keyboard.framework.tenant.core.context.TenantContextHolder;
|
import com.yolo.keyboard.framework.tenant.core.context.TenantContextHolder;
|
||||||
|
import com.yolo.keyboard.module.system.dal.dataobject.tenant.TenantDO;
|
||||||
|
import com.yolo.keyboard.module.system.dal.mysql.tenant.TenantMapper;
|
||||||
|
|
||||||
import static com.yolo.keyboard.framework.common.exception.util.ServiceExceptionUtil.exception;
|
import static com.yolo.keyboard.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
import static com.yolo.keyboard.framework.common.util.collection.CollectionUtils.convertList;
|
import static com.yolo.keyboard.framework.common.util.collection.CollectionUtils.convertList;
|
||||||
@@ -32,6 +34,9 @@ public class KeyboardTenantCommissionServiceImpl implements KeyboardTenantCommis
|
|||||||
@Resource
|
@Resource
|
||||||
private KeyboardTenantCommissionMapper tenantCommissionMapper;
|
private KeyboardTenantCommissionMapper tenantCommissionMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private TenantMapper tenantMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long createTenantCommission(KeyboardTenantCommissionSaveReqVO createReqVO) {
|
public Long createTenantCommission(KeyboardTenantCommissionSaveReqVO createReqVO) {
|
||||||
// 插入
|
// 插入
|
||||||
@@ -79,13 +84,16 @@ public class KeyboardTenantCommissionServiceImpl implements KeyboardTenantCommis
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<KeyboardTenantCommissionDO> getTenantCommissionPage(KeyboardTenantCommissionPageReqVO pageReqVO) {
|
public PageResult<KeyboardTenantCommissionDO> getTenantCommissionPage(KeyboardTenantCommissionPageReqVO pageReqVO) {
|
||||||
|
// 如果当前租户的 tenantLevel 不等于 0,只能查询属于自己的数据
|
||||||
|
Long currentTenantId = TenantContextHolder.getTenantId();
|
||||||
|
if (currentTenantId != null) {
|
||||||
|
TenantDO currentTenant = tenantMapper.selectById(currentTenantId);
|
||||||
|
if (currentTenant != null && currentTenant.getTenantLevel() != null
|
||||||
|
&& currentTenant.getTenantLevel() != 0) {
|
||||||
|
pageReqVO.setTenantId(currentTenantId);
|
||||||
|
}
|
||||||
|
}
|
||||||
return tenantCommissionMapper.selectPage(pageReqVO);
|
return tenantCommissionMapper.selectPage(pageReqVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public PageResult<KeyboardTenantCommissionDO> getMyTenantCommissionPage(KeyboardTenantCommissionPageReqVO pageReqVO) {
|
|
||||||
Long tenantId = TenantContextHolder.getRequiredTenantId();
|
|
||||||
return tenantCommissionMapper.selectPageByTenantId(pageReqVO, tenantId);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -11,6 +11,7 @@ import com.yolo.keyboard.framework.tenant.core.aop.TenantIgnore;
|
|||||||
import com.yolo.keyboard.module.system.controller.admin.tenant.vo.tenant.TenantPageReqVO;
|
import com.yolo.keyboard.module.system.controller.admin.tenant.vo.tenant.TenantPageReqVO;
|
||||||
import com.yolo.keyboard.module.system.controller.admin.tenant.vo.tenant.TenantRespVO;
|
import com.yolo.keyboard.module.system.controller.admin.tenant.vo.tenant.TenantRespVO;
|
||||||
import com.yolo.keyboard.module.system.controller.admin.tenant.vo.tenant.TenantSaveReqVO;
|
import com.yolo.keyboard.module.system.controller.admin.tenant.vo.tenant.TenantSaveReqVO;
|
||||||
|
import com.yolo.keyboard.module.system.controller.admin.tenant.vo.tenant.TenantInfoRespVO;
|
||||||
import com.yolo.keyboard.module.system.dal.dataobject.tenant.TenantDO;
|
import com.yolo.keyboard.module.system.dal.dataobject.tenant.TenantDO;
|
||||||
import com.yolo.keyboard.module.system.service.tenant.TenantService;
|
import com.yolo.keyboard.module.system.service.tenant.TenantService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
@@ -113,6 +114,13 @@ public class TenantController {
|
|||||||
return success(BeanUtils.toBean(tenant, TenantRespVO.class));
|
return success(BeanUtils.toBean(tenant, TenantRespVO.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/current")
|
||||||
|
@Operation(summary = "获得当前登录租户信息")
|
||||||
|
public CommonResult<TenantInfoRespVO> getCurrentTenant() {
|
||||||
|
TenantDO tenant = tenantService.getCurrentTenant();
|
||||||
|
return success(BeanUtils.toBean(tenant, TenantInfoRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
@Operation(summary = "获得租户分页")
|
@Operation(summary = "获得租户分页")
|
||||||
@PreAuthorize("@ss.hasPermission('system:tenant:query')")
|
@PreAuthorize("@ss.hasPermission('system:tenant:query')")
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package com.yolo.keyboard.module.system.controller.admin.tenant.vo.tenant;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 当前租户信息 Response VO")
|
||||||
|
@Data
|
||||||
|
public class TenantInfoRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "租户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "上级租户编号", example = "1")
|
||||||
|
private Long parentId;
|
||||||
|
|
||||||
|
@Schema(description = "代理级别", example = "1")
|
||||||
|
private Integer tenantLevel;
|
||||||
|
|
||||||
|
@Schema(description = "分润比例", example = "0.3")
|
||||||
|
private BigDecimal profitShareRatio;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -19,6 +19,7 @@ public interface TenantMapper extends BaseMapperX<TenantDO> {
|
|||||||
.likeIfPresent(TenantDO::getContactName, reqVO.getContactName())
|
.likeIfPresent(TenantDO::getContactName, reqVO.getContactName())
|
||||||
.likeIfPresent(TenantDO::getContactMobile, reqVO.getContactMobile())
|
.likeIfPresent(TenantDO::getContactMobile, reqVO.getContactMobile())
|
||||||
.eqIfPresent(TenantDO::getStatus, reqVO.getStatus())
|
.eqIfPresent(TenantDO::getStatus, reqVO.getStatus())
|
||||||
|
.eqIfPresent(TenantDO::getParentId, reqVO.getParentId())
|
||||||
.betweenIfPresent(TenantDO::getCreateTime, reqVO.getCreateTime())
|
.betweenIfPresent(TenantDO::getCreateTime, reqVO.getCreateTime())
|
||||||
.orderByDesc(TenantDO::getId));
|
.orderByDesc(TenantDO::getId));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -142,4 +142,11 @@ public interface TenantService {
|
|||||||
*/
|
*/
|
||||||
void validTenant(Long id);
|
void validTenant(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取当前登录租户信息
|
||||||
|
*
|
||||||
|
* @return 当前租户
|
||||||
|
*/
|
||||||
|
TenantDO getCurrentTenant();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -285,6 +285,15 @@ public class TenantServiceImpl implements TenantService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<TenantDO> getTenantPage(TenantPageReqVO pageReqVO) {
|
public PageResult<TenantDO> getTenantPage(TenantPageReqVO pageReqVO) {
|
||||||
|
// 如果当前租户是一级代理(tenantLevel=1),只能查询自己的下级租户
|
||||||
|
Long currentTenantId = TenantContextHolder.getTenantId();
|
||||||
|
if (currentTenantId != null) {
|
||||||
|
TenantDO currentTenant = tenantMapper.selectById(currentTenantId);
|
||||||
|
if (currentTenant != null && currentTenant.getTenantLevel() != null
|
||||||
|
&& currentTenant.getTenantLevel() == 1) {
|
||||||
|
pageReqVO.setParentId(currentTenantId);
|
||||||
|
}
|
||||||
|
}
|
||||||
return tenantMapper.selectPage(pageReqVO);
|
return tenantMapper.selectPage(pageReqVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -352,4 +361,10 @@ public class TenantServiceImpl implements TenantService {
|
|||||||
return tenantProperties == null || Boolean.FALSE.equals(tenantProperties.getEnable());
|
return tenantProperties == null || Boolean.FALSE.equals(tenantProperties.getEnable());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TenantDO getCurrentTenant() {
|
||||||
|
Long tenantId = TenantContextHolder.getRequiredTenantId();
|
||||||
|
return getTenant(tenantId);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user