去除游客账号

This commit is contained in:
2024-07-19 10:37:58 +08:00
parent 202fc07b35
commit 171843b91a
2 changed files with 33 additions and 7 deletions

View File

@@ -1,6 +1,7 @@
package com.gxwebsoft.common.system.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.gxwebsoft.common.core.annotation.OperationLog;
import com.gxwebsoft.common.core.web.*;
import com.gxwebsoft.common.system.entity.Company;
@@ -149,8 +150,8 @@ public class MenuController extends BaseController {
company.setVersionName(version.getVersionName());
company.setVersionCode(version.getVersionCode());
}
company.setClicks(company.getClicks()+1);
companyService.updateById(company);
return success("安装成功");
}
return fail("安装失败");

View File

@@ -1,8 +1,10 @@
package com.gxwebsoft.common.system.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.DesensitizedUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gxwebsoft.common.core.utils.CommonUtil;
import com.gxwebsoft.common.core.utils.DomainUtil;
@@ -14,9 +16,14 @@ import com.gxwebsoft.common.system.param.TenantParam;
import com.gxwebsoft.common.core.web.PageParam;
import com.gxwebsoft.common.core.web.PageResult;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* 租户Service实现
@@ -51,6 +58,24 @@ public class TenantServiceImpl extends ServiceImpl<TenantMapper, Tenant> impleme
PageParam<Tenant, TenantParam> page = new PageParam<>(param);
page.setDefaultOrder("sort_number asc, create_time desc");
List<Tenant> list = baseMapper.selectPageRel(page, param);
// if (param.getSceneType() != null && param.getSceneType().equals("plug")) {
// final Set<Integer> collectIds = list.stream().map(Tenant::getTenantId).collect(Collectors.toSet());
// System.out.println("collectIds = " + collectIds);
// final List<Company> companyList = companyService.list(new LambdaUpdateWrapper<Company>().in(Company::getTenantId, collectIds));
// System.out.println("companyList = " + companyList);
// final Map<Integer, List<Company>> collect = companyList.stream().collect(Collectors.groupingBy(Company::getTenantId));
// list.forEach(d -> {
// final List<Company> companies = collect.get(d.getTenantId());
// if (!CollectionUtils.isEmpty(companies)) {
// final Company c1 = companies.get(0);
// final Company c2 = new Company();
// c2.setCompanyName(c1.getCompanyName());
// c2.setShortName(c1.getShortName());
// c2.setPhone(DesensitizedUtil.mobilePhone(c1.getPhone()));
// d.setCompany(c2);
// }
// });
// }
return new PageResult<>(list, page.getTotal());
}
@@ -162,10 +187,10 @@ public class TenantServiceImpl extends ServiceImpl<TenantMapper, Tenant> impleme
role.setRoleCode("user");
role.setComments("普通注册用户");
roleService.save(role);
role.setRoleName("游客");
role.setRoleCode("guest");
role.setComments("用于未登录时的浏览权限");
roleService.save(role);
// role.setRoleName("游客");
// role.setRoleCode("guest");
// role.setComments("用于未登录时的浏览权限");
// roleService.save(role);
role.setRoleName("商户管理员");
role.setRoleCode("merchant");
role.setComments("商户管理员/店长角色");
@@ -188,12 +213,12 @@ public class TenantServiceImpl extends ServiceImpl<TenantMapper, Tenant> impleme
userRole.setUserId(superAdminUserId);
userRole.setRoleId(superAdminRoleId);
userRole.setTenantId(company.getTid());
userRoleService.save(userRole);
boolean resultUserRole = userRoleService.save(userRole);
// 添加游客用户角色
// userRole.setUserId(www.getUserId());
// userRole.setRoleId(guestRoleId);
boolean resultUserRole = userRoleService.save(userRole);
// boolean resultUserRole = userRoleService.save(userRole);
// 添加系统菜单
if (resultUserRole) {