|
|
@@ -85,7 +85,7 @@ public class SysTenantServiceImpl extends ServiceImpl<SysTenantMapper, SysTenant
|
|
|
|
|
|
|
|
|
@Override
|
|
|
- public SysTenantVo queryById(Long tenantId){
|
|
|
+ public SysTenantVo queryById(String tenantId){
|
|
|
SysTenant db = this.baseMapper.selectById(tenantId);
|
|
|
return BeanUtil.toBean(db, SysTenantVo.class);
|
|
|
}
|
|
|
@@ -95,7 +95,7 @@ public class SysTenantServiceImpl extends ServiceImpl<SysTenantMapper, SysTenant
|
|
|
LambdaQueryWrapper<SysTenant> lqw = Wrappers.lambdaQuery();
|
|
|
lqw.ne(SysTenant::getStatus, -1);
|
|
|
lqw.like(StrUtil.isNotBlank(bo.getTenantName()), SysTenant::getTenantName, bo.getTenantName());
|
|
|
- lqw.eq(ObjectUtils.isNotNull(bo.getTenantid()),SysTenant::getTenantId, bo.getTenantid());
|
|
|
+ lqw.eq(ObjectUtils.isNotNull(bo.getTenantId()),SysTenant::getTenantId, bo.getTenantId());
|
|
|
lqw.orderByDesc(SysTenant::getSort);
|
|
|
return entity2Vo(this.list(lqw));
|
|
|
}
|
|
|
@@ -168,12 +168,12 @@ public class SysTenantServiceImpl extends ServiceImpl<SysTenantMapper, SysTenant
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public Long createTenantAdmin(SysTenantAdminBo bo) {
|
|
|
+ public String createTenantAdmin(SysTenantAdminBo bo) {
|
|
|
if(Validator.isEmpty(bo.getTenantName())){
|
|
|
throw new CustomException("没有企业名称");
|
|
|
}
|
|
|
//中正后台企业ID
|
|
|
- Long tenantId = 867735392558919680L;
|
|
|
+ String tenantId = "867735392558919680";
|
|
|
//设置新机构
|
|
|
SysTenant sysTenant = getById(tenantId);
|
|
|
sysTenant.setTenantName(bo.getTenantName());
|
|
|
@@ -183,7 +183,7 @@ public class SysTenantServiceImpl extends ServiceImpl<SysTenantMapper, SysTenant
|
|
|
sysTenant.setHostH5Seller(null);
|
|
|
sysTenant.setHostAdmin(null);
|
|
|
//生成tenantId
|
|
|
- Long newTenantId = createTenantId();
|
|
|
+ String newTenantId = createTenantId();
|
|
|
sysTenant.setTenantId(newTenantId);
|
|
|
if (!save(sysTenant)){
|
|
|
throw new CustomException("创建企业失败");
|
|
|
@@ -247,16 +247,16 @@ public class SysTenantServiceImpl extends ServiceImpl<SysTenantMapper, SysTenant
|
|
|
|
|
|
}
|
|
|
|
|
|
- private Long createTenantId(){
|
|
|
+ private String createTenantId(){
|
|
|
String randomNumeric = RandomStringUtils.randomNumeric(15);
|
|
|
int count = count(new LambdaQueryWrapper<SysTenant>()
|
|
|
.eq(SysTenant::getTenantId, Long.valueOf(randomNumeric)));
|
|
|
if (count == 0){
|
|
|
- return Long.valueOf(randomNumeric);
|
|
|
+ return randomNumeric;
|
|
|
}else {
|
|
|
createTenantId();
|
|
|
}
|
|
|
- return Long.valueOf(randomNumeric);
|
|
|
+ return randomNumeric;
|
|
|
}
|
|
|
|
|
|
private boolean checkNameUnique(SysTenant entity) {
|
|
|
@@ -277,7 +277,7 @@ public class SysTenantServiceImpl extends ServiceImpl<SysTenantMapper, SysTenant
|
|
|
add.setUpdateTime(DateUtils.getNowTime());
|
|
|
this.save(add);
|
|
|
//创建属于新公司的admin用户
|
|
|
- Long tenantId = add.getTenantId();
|
|
|
+ String tenantId = add.getTenantId();
|
|
|
ServletUtils.getRequestAttributes().getResponse().setHeader("TenantId",String.valueOf(tenantId));
|
|
|
SysUser user = new SysUser();
|
|
|
user.setUserName("admin");
|
|
|
@@ -289,7 +289,7 @@ public class SysTenantServiceImpl extends ServiceImpl<SysTenantMapper, SysTenant
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Long findTenantId(SysTenantQueryBo bo) {
|
|
|
+ public String findTenantId(SysTenantQueryBo bo) {
|
|
|
return baseMapper.findTenantId(bo);
|
|
|
}
|
|
|
|
|
|
@@ -306,13 +306,13 @@ public class SysTenantServiceImpl extends ServiceImpl<SysTenantMapper, SysTenant
|
|
|
throw new CustomException("没有企业名称");
|
|
|
}
|
|
|
//中正后台企业ID
|
|
|
- Long tenantId = 867735392558919680L;
|
|
|
+ String tenantId = "867735392558919680";
|
|
|
//设置新机构
|
|
|
SysTenant sysTenant = getById(tenantId);
|
|
|
sysTenant.setTenantName(bo.getTenantName());
|
|
|
//生成tenantId
|
|
|
-// Long newTenantId = createTenantId();
|
|
|
- Long newTenantId = bo.getTenantId();
|
|
|
+// String newTenantId = createTenantId();
|
|
|
+ String newTenantId = bo.getTenantId();
|
|
|
sysTenant.setTenantId(newTenantId);
|
|
|
sysTenant.setHostH5("");
|
|
|
sysTenant.setHostPc("");
|
|
|
@@ -376,7 +376,7 @@ public class SysTenantServiceImpl extends ServiceImpl<SysTenantMapper, SysTenant
|
|
|
initConfigAndDict(newTenantId,tenantId);
|
|
|
}
|
|
|
|
|
|
- private void initConfigAndDict(Long newTenantId, Long tenantId) {
|
|
|
+ private void initConfigAndDict(String newTenantId, String tenantId) {
|
|
|
//字典
|
|
|
List<SysDictType> dictTypes = iSysDictTypeService.getListByTenant(tenantId);
|
|
|
if (CollectionUtils.isEmpty(dictTypes)){
|
|
|
@@ -409,24 +409,24 @@ public class SysTenantServiceImpl extends ServiceImpl<SysTenantMapper, SysTenant
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void updateRoleTenant(List<Long> tenantIds) {
|
|
|
- Long oldTenantId = 867735392558919680L;
|
|
|
- for (Long tenantId : tenantIds) {
|
|
|
+ public void updateRoleTenant(List<String> tenantIds) {
|
|
|
+ String oldTenantId = "867735392558919680";
|
|
|
+ for (String tenantId : tenantIds) {
|
|
|
initRoles(tenantId,oldTenantId);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void updateDictTenant(List<Long> tenantIds) {
|
|
|
- Long oldTenantId = 867735392558919680L;
|
|
|
- for (Long tenantId : tenantIds) {
|
|
|
+ public void updateDictTenant(List<String> tenantIds) {
|
|
|
+ String oldTenantId = "867735392558919680";
|
|
|
+ for (String tenantId : tenantIds) {
|
|
|
initConfigAndDict(tenantId,oldTenantId);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public List<SysTenantBankAccountVo> getBankAccountList(String tenantId) {
|
|
|
- SysTenant tenant = getById(Long.valueOf(tenantId));
|
|
|
+ SysTenant tenant = getById(tenantId);
|
|
|
if (ObjectUtils.isNull(tenant)){
|
|
|
throw new CustomException("机构信息获取失败!");
|
|
|
}
|
|
|
@@ -479,7 +479,7 @@ public class SysTenantServiceImpl extends ServiceImpl<SysTenantMapper, SysTenant
|
|
|
if (CollectionUtils.isEmpty(bo.getTenantIds())){
|
|
|
throw new CustomException("参数错误");
|
|
|
}
|
|
|
- for (Long tenantId : bo.getTenantIds()) {
|
|
|
+ for (String tenantId : bo.getTenantIds()) {
|
|
|
int count = topOldOrderService.count(new LambdaQueryWrapper<TopOldOrder>().eq(TopOldOrder::getTenantId, tenantId));
|
|
|
int num = orderService.count(new LambdaQueryWrapper<Order>().eq(Order::getTenantId, tenantId));
|
|
|
if (count > 0 || num > 0){
|
|
|
@@ -492,7 +492,7 @@ public class SysTenantServiceImpl extends ServiceImpl<SysTenantMapper, SysTenant
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<SysTenant> getListNoTenant(Long tenantId) {
|
|
|
+ public List<SysTenant> getListNoTenant(String tenantId) {
|
|
|
return baseMapper.getListNoTenant(tenantId);
|
|
|
}
|
|
|
|
|
|
@@ -501,7 +501,7 @@ public class SysTenantServiceImpl extends ServiceImpl<SysTenantMapper, SysTenant
|
|
|
return baseMapper.getExamRoomTenant();
|
|
|
}
|
|
|
|
|
|
- private void initRoles(Long newTenantId,Long tenantId) {
|
|
|
+ private void initRoles(String newTenantId,String tenantId) {
|
|
|
List<String> roleKey = new ArrayList<>();
|
|
|
roleKey.add("seller");
|
|
|
roleKey.add("seller_admin");
|
|
|
@@ -558,7 +558,7 @@ public class SysTenantServiceImpl extends ServiceImpl<SysTenantMapper, SysTenant
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- private Long getParentId(SysMenu oldSysMenu, Long tenantId, Long newTenantId) {
|
|
|
+ private Long getParentId(SysMenu oldSysMenu, String tenantId, String newTenantId) {
|
|
|
if (oldSysMenu.getParentId() == 0){
|
|
|
return 0L;
|
|
|
}
|