fix
This commit is contained in:
@@ -3,6 +3,7 @@ package com.starry.admin.modules.clerk.service;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.starry.admin.modules.clerk.module.entity.PlayClerkLevelInfoEntity;
|
||||
import com.starry.admin.modules.platform.entity.SysTenantEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -14,14 +15,23 @@ import java.util.List;
|
||||
*/
|
||||
public interface IPlayClerkLevelInfoService extends IService<PlayClerkLevelInfoEntity> {
|
||||
|
||||
/**
|
||||
* 初始化店员等级
|
||||
*
|
||||
* @param sysTenantEntity 租户信息
|
||||
* @author 杭州世平信息科技有限公司-xuhq
|
||||
* @since 2024/7/19 15:13
|
||||
**/
|
||||
void initDefaultLevel(SysTenantEntity sysTenantEntity);
|
||||
|
||||
/**
|
||||
* 获取新增陪聊时,默认最低等级ID
|
||||
*
|
||||
* @return PlayClerkLevelInfoEntity
|
||||
*/
|
||||
PlayClerkLevelInfoEntity getDefaultLevel();
|
||||
|
||||
/**
|
||||
*
|
||||
* 查询店员等级
|
||||
*
|
||||
* @param id 店员等级主键
|
||||
@@ -87,7 +97,6 @@ public interface IPlayClerkLevelInfoService extends IService<PlayClerkLevelInfoE
|
||||
|
||||
/**
|
||||
* 删除最大等级
|
||||
*
|
||||
*/
|
||||
void delMaxLevelByLevel(Integer level);
|
||||
}
|
||||
|
||||
@@ -6,10 +6,10 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.starry.admin.common.exception.CustomException;
|
||||
import com.starry.admin.modules.clerk.mapper.PlayClerkLevelInfoMapper;
|
||||
import com.starry.admin.modules.clerk.module.entity.PlayClerkLevelInfoEntity;
|
||||
import com.starry.admin.modules.clerk.service.IPlayClerkLevelInfoService;
|
||||
import com.starry.admin.modules.platform.entity.SysTenantEntity;
|
||||
import com.starry.common.utils.IdUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -29,13 +29,43 @@ public class PlayClerkLevelInfoServiceImpl extends ServiceImpl<PlayClerkLevelInf
|
||||
@Resource
|
||||
private PlayClerkLevelInfoMapper playClerkLevelInfoMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public void initDefaultLevel(SysTenantEntity sysTenantEntity) {
|
||||
List<PlayClerkLevelInfoEntity> list = this.selectAll();
|
||||
if (list == null || list.isEmpty()) {
|
||||
PlayClerkLevelInfoEntity entity = new PlayClerkLevelInfoEntity();
|
||||
entity.setName("普通");
|
||||
entity.setFirstRandomRadio(45);
|
||||
entity.setNotFirstRandomRadio(50);
|
||||
entity.setFirstRewardRatio(45);
|
||||
entity.setNotFirstRewardRatio(50);
|
||||
entity.setFirstRegularRatio(45);
|
||||
entity.setNotFirstRegularRatio(50);
|
||||
entity.setLevel(1);
|
||||
entity.setTenantId(sysTenantEntity.getTenantId());
|
||||
this.baseMapper.insert(entity);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlayClerkLevelInfoEntity getDefaultLevel() {
|
||||
List<PlayClerkLevelInfoEntity> list = this.selectAll();
|
||||
if (list != null && !list.isEmpty()) {
|
||||
return list.get(0);
|
||||
} else {
|
||||
PlayClerkLevelInfoEntity entity = new PlayClerkLevelInfoEntity();
|
||||
entity.setName("普通");
|
||||
entity.setFirstRandomRadio(45);
|
||||
entity.setNotFirstRandomRadio(50);
|
||||
entity.setFirstRewardRatio(45);
|
||||
entity.setNotFirstRewardRatio(50);
|
||||
entity.setFirstRegularRatio(45);
|
||||
entity.setNotFirstRegularRatio(50);
|
||||
entity.setLevel(1);
|
||||
this.baseMapper.insert(entity);
|
||||
return entity;
|
||||
}
|
||||
throw new CustomException("系统错误,等级数据未初始化");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.starry.admin.modules.custom.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.starry.admin.modules.custom.module.entity.PlayCustomLevelInfoEntity;
|
||||
import com.starry.admin.modules.platform.entity.SysTenantEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -13,6 +14,14 @@ import java.util.List;
|
||||
*/
|
||||
public interface IPlayCustomLevelInfoService extends IService<PlayCustomLevelInfoEntity> {
|
||||
|
||||
/**
|
||||
* 初始化顾客等级
|
||||
*
|
||||
* @param sysTenantEntity 租户细信息
|
||||
* @author 杭州世平信息科技有限公司-xuhq
|
||||
* @since 2024/7/19 15:13
|
||||
**/
|
||||
void initDefaultLevel(SysTenantEntity sysTenantEntity);
|
||||
|
||||
/**
|
||||
* 获取新增顾客时,默认最低等级ID
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
package com.starry.admin.modules.custom.service.impl;
|
||||
|
||||
import com.starry.common.utils.IdUtils;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.starry.admin.common.exception.CustomException;
|
||||
import com.starry.admin.modules.custom.mapper.PlayCustomLevelInfoMapper;
|
||||
import com.starry.admin.modules.custom.module.entity.PlayCustomLevelInfoEntity;
|
||||
import com.starry.admin.modules.custom.service.IPlayCustomLevelInfoService;
|
||||
import com.starry.admin.modules.platform.entity.SysTenantEntity;
|
||||
import com.starry.common.utils.IdUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@@ -27,13 +27,34 @@ public class PlayCustomLevelInfoServiceImpl extends ServiceImpl<PlayCustomLevelI
|
||||
private PlayCustomLevelInfoMapper playCustomLevelInfoMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public void initDefaultLevel(SysTenantEntity sysTenantEntity) {
|
||||
List<PlayCustomLevelInfoEntity> list = this.selectAll();
|
||||
if (list == null || list.isEmpty()) {
|
||||
PlayCustomLevelInfoEntity entity = new PlayCustomLevelInfoEntity();
|
||||
entity.setLevel(1);
|
||||
entity.setName("V1");
|
||||
entity.setConsumptionAmount("1");
|
||||
entity.setDiscount(100);
|
||||
entity.setTenantId(sysTenantEntity.getTenantId());
|
||||
this.baseMapper.insert(entity);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlayCustomLevelInfoEntity getDefaultLevel() {
|
||||
List<PlayCustomLevelInfoEntity> list = this.selectAll();
|
||||
if (list != null && !list.isEmpty()) {
|
||||
return list.get(0);
|
||||
} else {
|
||||
PlayCustomLevelInfoEntity entity = new PlayCustomLevelInfoEntity();
|
||||
entity.setLevel(1);
|
||||
entity.setName("V1");
|
||||
entity.setConsumptionAmount("1");
|
||||
entity.setDiscount(100);
|
||||
this.baseMapper.insert(entity);
|
||||
return entity;
|
||||
}
|
||||
throw new CustomException("系统错误,等级数据未初始化");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -11,6 +11,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.starry.admin.common.domain.LoginUser;
|
||||
import com.starry.admin.common.exception.CustomException;
|
||||
import com.starry.admin.modules.clerk.service.IPlayClerkLevelInfoService;
|
||||
import com.starry.admin.modules.custom.service.IPlayCustomLevelInfoService;
|
||||
import com.starry.admin.modules.platform.entity.SysTenantEntity;
|
||||
import com.starry.admin.modules.platform.entity.SysTenantPackageEntity;
|
||||
import com.starry.admin.modules.platform.mapper.SysTenantMapper;
|
||||
@@ -68,6 +70,12 @@ public class SysTenantServiceImpl extends ServiceImpl<SysTenantMapper, SysTenant
|
||||
@Resource
|
||||
private RedisCache redisCache;
|
||||
|
||||
@Resource
|
||||
private IPlayCustomLevelInfoService playCustomLevelInfoService;
|
||||
|
||||
@Resource
|
||||
private IPlayClerkLevelInfoService playClerkLevelInfoService;
|
||||
|
||||
|
||||
@Override
|
||||
public List<SysTenantEntity> listAll() {
|
||||
@@ -85,7 +93,7 @@ public class SysTenantServiceImpl extends ServiceImpl<SysTenantMapper, SysTenant
|
||||
if (DateUtil.compare(tenant.getTenantTime(), new Date()) < 0) {
|
||||
throw new RuntimeException("当前租户已过期,无法继续使用");
|
||||
}
|
||||
if (tenant.getTenantStatus().equals("1")) {
|
||||
if ("1".equals(tenant.getTenantStatus())) {
|
||||
throw new RuntimeException("当前租户已被禁用");
|
||||
}
|
||||
return tenant;
|
||||
@@ -211,6 +219,9 @@ public class SysTenantServiceImpl extends ServiceImpl<SysTenantMapper, SysTenant
|
||||
// 创建域名
|
||||
this.createDomainAndDns(sysTenantEntity.getTenantKey());
|
||||
this.initRole(sysTenantEntity);
|
||||
//初始化店铺等级数据和用户等级数据
|
||||
playCustomLevelInfoService.initDefaultLevel(sysTenantEntity);
|
||||
playClerkLevelInfoService.initDefaultLevel(sysTenantEntity);
|
||||
return R.ok("租户创建成功!");
|
||||
}
|
||||
|
||||
@@ -319,6 +330,7 @@ public class SysTenantServiceImpl extends ServiceImpl<SysTenantMapper, SysTenant
|
||||
log.info("腾讯云域名映射结果:{}", JSONObject.toJSONString(createRecordResponse));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initRole(SysTenantEntity sysTenantEntity) {
|
||||
|
||||
SysRoleEntity operator = new SysRoleEntity();
|
||||
|
||||
Reference in New Issue
Block a user