feat(system): 更新租户类型并优化相关功能
- 修改租户类型描述,增加新的租户类型 - 优化租户创建流程,支持不同类型的租户 - 调整日志级别配置,增加 Redis 和 HikariCP 的日志 - 修复分
This commit is contained in:
parent
83ffa453f6
commit
7db59f91a9
@ -44,6 +44,8 @@ logging:
|
||||
org.springframework: warn
|
||||
org.mybatis.spring.mapper: error
|
||||
org.apache.fury: warn
|
||||
org.redisson.command.RedisExecutor: warn
|
||||
com.zaxxer.hikari.pool.HikariPool: warn
|
||||
config: classpath:logback-plus.xml
|
||||
|
||||
# 用户配置
|
||||
@ -181,6 +183,7 @@ tenant:
|
||||
- trans_divide_detail
|
||||
- trans_divide_rule
|
||||
- trans_divide_rule_detail
|
||||
- trans_pay_order
|
||||
- aws_system_statistics
|
||||
- act_integral_history
|
||||
- sys_version
|
||||
|
@ -116,7 +116,7 @@ public class SysTenant extends BaseEntity {
|
||||
@Schema(description = "代理人资质")
|
||||
private String qualification;
|
||||
|
||||
@Schema(description = "类型(0.店铺 1.代理 2.达人)")
|
||||
@Schema(description = "类型(2->商家,3->代理,4->平台,5->达人)")
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "所属代理商")
|
||||
|
@ -170,5 +170,11 @@ public class SysTenantVo implements Serializable {
|
||||
*/
|
||||
private Long createDept;
|
||||
|
||||
/**
|
||||
* 类型(2->商家,3->代理,4->平台,5->达人)
|
||||
*/
|
||||
@Schema(description = "类型(2->商家,3->代理,4->平台,5->达人)")
|
||||
private Integer type;
|
||||
|
||||
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ public class SysTenantServiceImpl implements ISysTenantService {
|
||||
private final SysTenantMapper baseMapper;
|
||||
private final SysTenantExtendMapper tenantExtendMapper;
|
||||
private final SysTenantPackageMapper tenantPackageMapper;
|
||||
private final SysTenantAccountMapper tenantAccountMapper;;
|
||||
private final SysTenantAccountMapper tenantAccountMapper;
|
||||
private final SysUserMapper userMapper;
|
||||
private final SysDeptMapper deptMapper;
|
||||
private final SysRoleMapper roleMapper;
|
||||
@ -136,9 +136,8 @@ public class SysTenantServiceImpl implements ISysTenantService {
|
||||
SysTenant tenant = new SysTenant();
|
||||
|
||||
String currentTenantId = LoginHelper.getTenantId();
|
||||
|
||||
SysTenant sysTenant = baseMapper.selectByTenantId(currentTenantId);
|
||||
Assert.isTrue(TenantType.allowCreateByType(sysTenant.getType(), bo.getType()), () -> new ServiceException("您无权限创建此类型的租户"));
|
||||
SysTenantVo sysTenantVo = this.queryByTenantId(currentTenantId);
|
||||
Assert.isTrue(TenantType.allowCreateByType(sysTenantVo.getType(), bo.getType()), () -> new ServiceException("您无权限创建此类型的租户"));
|
||||
|
||||
// 生成租户ID
|
||||
List<String> tenantIds = baseMapper.selectObjs(
|
||||
@ -147,9 +146,17 @@ public class SysTenantServiceImpl implements ISysTenantService {
|
||||
);
|
||||
String tenantId = generateTenantId(tenantIds);
|
||||
|
||||
String tenantName = bo.getAgencyName();
|
||||
if (bo.getType() == TenantType.REFERENCE.getType()){
|
||||
tenant.setAgencyTenantId(currentTenantId);
|
||||
}
|
||||
if (bo.getType() == TenantType.MERCHANT.getType()){
|
||||
tenant.setPromoterTenantId(currentTenantId);
|
||||
tenantName = bo.getStoreName();
|
||||
}
|
||||
// 设置sys_tenant表字段
|
||||
tenant.setTenantId(tenantId);
|
||||
tenant.setCompanyName(bo.getCompanyName());
|
||||
tenant.setCompanyName(StrUtil.isBlank(bo.getCompanyName()) ? tenantName : bo.getCompanyName());
|
||||
tenant.setLicenseNumber(bo.getLicenseNumber());
|
||||
tenant.setAddress(bo.getAddress());
|
||||
tenant.setDomain(bo.getDomain());
|
||||
@ -174,12 +181,6 @@ public class SysTenantServiceImpl implements ISysTenantService {
|
||||
tenant.setBirthday(bo.getBirthday());
|
||||
tenant.setQualification(bo.getQualification());
|
||||
tenant.setType(bo.getType());
|
||||
if (bo.getType() == TenantType.REFERENCE.getType()){
|
||||
tenant.setAgencyTenantId(currentTenantId);
|
||||
}
|
||||
if (bo.getType() == TenantType.MERCHANT.getType()){
|
||||
tenant.setPromoterTenantId(currentTenantId);
|
||||
}
|
||||
|
||||
// 插入sys_tenant表
|
||||
boolean tenantInserted = baseMapper.insert(tenant) > 0;
|
||||
@ -260,7 +261,7 @@ public class SysTenantServiceImpl implements ISysTenantService {
|
||||
// 创建部门
|
||||
SysDept dept = new SysDept();
|
||||
dept.setTenantId(tenantId);
|
||||
dept.setDeptName(bo.getCompanyName());
|
||||
dept.setDeptName(tenantName);
|
||||
dept.setParentId(Constants.TOP_PARENT_ID);
|
||||
dept.setAncestors(Constants.TOP_PARENT_ID.toString());
|
||||
deptMapper.insert(dept);
|
||||
|
@ -177,7 +177,7 @@ public class DivideServiceImpl extends ServiceImpl<DivideMapper, Divide> impleme
|
||||
Order order = orderService.getById(orderId);
|
||||
Assert.notNull(order, () -> new ServiceException("订单不存在"));
|
||||
Assert.isTrue(Objects.equals(order.getStatus(), OrderStatusEnum.PAID.getValue()), () -> new ServiceException("订单未支付"));
|
||||
PayOrder payOrder = TenantHelper.ignore(() -> payOrderService.getById(order.getPayId()));
|
||||
PayOrder payOrder = payOrderService.getById(order.getPayId());
|
||||
Assert.notNull(payOrder, () -> new ServiceException("支付单不存在"));
|
||||
Assert.isTrue(payOrder.getTransState() == TransState.PAID.getCode(), () -> new ServiceException("订单未支付"));
|
||||
Assert.isFalse(this.exists(Wrappers.lambdaQuery(Divide.class).eq(Divide::getOrderId, orderId)), () -> new ServiceException("已存在分账记录,无需再次分账"));
|
||||
|
Loading…
x
Reference in New Issue
Block a user