Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -40,21 +40,23 @@ public class MybatisPlusConfig {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Expression getTenantId() {
|
public Expression getTenantId() {
|
||||||
|
String tenantId;
|
||||||
|
// 从请求头拿ID
|
||||||
|
tenantId = request.getHeader("tenantId");
|
||||||
|
if(tenantId != null){
|
||||||
|
System.out.println("从请求头拿ID = " + tenantId);
|
||||||
|
return new LongValue(tenantId);
|
||||||
|
}
|
||||||
// 从域名拿ID
|
// 从域名拿ID
|
||||||
String Domain = request.getHeader("Domain");
|
String Domain = request.getHeader("Domain");
|
||||||
if (StrUtil.isNotBlank(Domain)) {
|
if (StrUtil.isNotBlank(Domain)) {
|
||||||
String key = "Domain:" + Domain;
|
String key = "Domain:" + Domain;
|
||||||
String tenantId = redisUtil.get(key);
|
tenantId = redisUtil.get(key);
|
||||||
if(tenantId != null){
|
if(tenantId != null){
|
||||||
System.out.println("授权域名" + Domain + " => " + tenantId);
|
System.out.println("授权域名" + Domain + " => " + tenantId);
|
||||||
return new LongValue(tenantId);
|
return new LongValue(tenantId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 从请求头拿ID
|
|
||||||
final String tenantId = request.getHeader("tenantId");
|
|
||||||
if(tenantId != null){
|
|
||||||
return new LongValue(tenantId);
|
|
||||||
}
|
|
||||||
return getLoginUserTenantId();
|
return getLoginUserTenantId();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,9 +79,9 @@ public class MybatisPlusConfig {
|
|||||||
// "sys_company",
|
// "sys_company",
|
||||||
"sys_domain",
|
"sys_domain",
|
||||||
"sys_white_domain",
|
"sys_white_domain",
|
||||||
"cms_website",
|
// "cms_website",
|
||||||
"cms_domain",
|
"cms_domain",
|
||||||
"cms_website_field",
|
// "cms_website_field",
|
||||||
"cms_navigation",
|
"cms_navigation",
|
||||||
"cms_design",
|
"cms_design",
|
||||||
"cms_design_record",
|
"cms_design_record",
|
||||||
@@ -101,7 +103,8 @@ public class MybatisPlusConfig {
|
|||||||
"cms_product",
|
"cms_product",
|
||||||
"cms_product_url",
|
"cms_product_url",
|
||||||
"cms_product_spec",
|
"cms_product_spec",
|
||||||
"cms_product_spec_value"
|
"cms_product_spec_value",
|
||||||
|
"sys_company_content"
|
||||||
).contains(tableName);
|
).contains(tableName);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -73,12 +73,7 @@ public class BaseController {
|
|||||||
* @return tenantId
|
* @return tenantId
|
||||||
*/
|
*/
|
||||||
public Integer getTenantId() {
|
public Integer getTenantId() {
|
||||||
// 1 从登录用户拿tenantId
|
// 1 从域名拿ID
|
||||||
User loginUser = getLoginUser();
|
|
||||||
if (loginUser != null) {
|
|
||||||
return loginUser.getTenantId();
|
|
||||||
}
|
|
||||||
// 2 从域名拿ID
|
|
||||||
String Domain = request.getHeader("Domain");
|
String Domain = request.getHeader("Domain");
|
||||||
if (StrUtil.isNotBlank(Domain)) {
|
if (StrUtil.isNotBlank(Domain)) {
|
||||||
String key = "Domain:" + Domain;
|
String key = "Domain:" + Domain;
|
||||||
@@ -88,11 +83,16 @@ public class BaseController {
|
|||||||
return Integer.valueOf(tenantId);
|
return Integer.valueOf(tenantId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 3 从请求头拿ID
|
// 2 从请求头拿ID
|
||||||
String tenantId = request.getHeader("tenantId");
|
String tenantId = request.getHeader("tenantId");
|
||||||
if(StrUtil.isNotBlank(tenantId)){
|
if(StrUtil.isNotBlank(tenantId)){
|
||||||
return Integer.valueOf(tenantId);
|
return Integer.valueOf(tenantId);
|
||||||
}
|
}
|
||||||
|
// 1 从登录用户拿tenantId
|
||||||
|
User loginUser = getLoginUser();
|
||||||
|
if (loginUser != null) {
|
||||||
|
return loginUser.getTenantId();
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ public class DictionaryDataController extends BaseController {
|
|||||||
return success(dictionaryDataService.pageRel(param));
|
return success(dictionaryDataService.pageRel(param));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('sys:dictionary:list')")
|
|
||||||
@ApiOperation("查询全部字典数据")
|
@ApiOperation("查询全部字典数据")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public ApiResult<List<DictionaryData>> list(DictionaryDataParam param) {
|
public ApiResult<List<DictionaryData>> list(DictionaryDataParam param) {
|
||||||
|
|||||||
@@ -85,6 +85,8 @@ public class MainController extends BaseController {
|
|||||||
@Resource
|
@Resource
|
||||||
private CompanyMapper companyMapper;
|
private CompanyMapper companyMapper;
|
||||||
@Resource
|
@Resource
|
||||||
|
private UserRoleService userRoleService;
|
||||||
|
@Resource
|
||||||
private CompanyService companyService;
|
private CompanyService companyService;
|
||||||
|
|
||||||
|
|
||||||
@@ -194,7 +196,7 @@ public class MainController extends BaseController {
|
|||||||
String key = "TenantInfo:" + tenantId;
|
String key = "TenantInfo:" + tenantId;
|
||||||
final String tenantInfo = redisUtil.get(key);
|
final String tenantInfo = redisUtil.get(key);
|
||||||
if(StrUtil.isNotBlank(tenantInfo)){
|
if(StrUtil.isNotBlank(tenantInfo)){
|
||||||
return success(JSONObject.parseObject(tenantInfo,Company.class));
|
// return success(JSONObject.parseObject(tenantInfo,Company.class));
|
||||||
}
|
}
|
||||||
final Company company = companyMapper.getByTenantId(tenantId);
|
final Company company = companyMapper.getByTenantId(tenantId);
|
||||||
// 是否过期
|
// 是否过期
|
||||||
@@ -210,6 +212,9 @@ public class MainController extends BaseController {
|
|||||||
config.put("LICENSE_CODE", "dk9mcwJyetRWQlxWRiojIzJCLi8mcQ5Wa4ojI0NWZqJWd6ICZpJCL0kjNwl1NnhENahnIvl2cyVmdiwiIiATMuEjI6IibQf0NW==");
|
config.put("LICENSE_CODE", "dk9mcwJyetRWQlxWRiojIzJCLi8mcQ5Wa4ojI0NWZqJWd6ICZpJCL0kjNwl1NnhENahnIvl2cyVmdiwiIiATMuEjI6IibQf0NW==");
|
||||||
config.put("MAP_KEY", "8191620da39a742c6f18f010c084c772");
|
config.put("MAP_KEY", "8191620da39a742c6f18f010c084c772");
|
||||||
company.setConfig(config);
|
company.setConfig(config);
|
||||||
|
//应用菜单
|
||||||
|
company.setRoles(userRoleService.listByUserId(company.getUserId()));
|
||||||
|
company.setAuthorities(roleMenuService.listMenuByUserId(company.getUserId(), null));
|
||||||
|
|
||||||
redisUtil.set(key,company,1L, TimeUnit.DAYS);
|
redisUtil.set(key,company,1L, TimeUnit.DAYS);
|
||||||
return success(company);
|
return success(company);
|
||||||
@@ -352,6 +357,13 @@ public class MainController extends BaseController {
|
|||||||
return fail("请输入有效的手机号码");
|
return fail("请输入有效的手机号码");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (param.getScene() != null && param.getScene().equals("login")){
|
||||||
|
final User byPhone = userService.getByPhone(param.getPhone());
|
||||||
|
if (ObjectUtil.isEmpty(byPhone)) {
|
||||||
|
return fail("该手机号码未注册!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// 读取租户的短信配置
|
// 读取租户的短信配置
|
||||||
if (getTenantId() != null) {
|
if (getTenantId() != null) {
|
||||||
|
|||||||
@@ -313,6 +313,14 @@ public class Company implements Serializable {
|
|||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private Integer num;
|
private Integer num;
|
||||||
|
|
||||||
|
@ApiModelProperty("角色列表")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private List<Role> roles;
|
||||||
|
|
||||||
|
@ApiModelProperty("权限列表")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private List<Menu> authorities;
|
||||||
|
|
||||||
public String getMobile() {
|
public String getMobile() {
|
||||||
return DesensitizedUtil.mobilePhone(this.phone);
|
return DesensitizedUtil.mobilePhone(this.phone);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,4 +31,7 @@ public class SmsCaptchaParam implements Serializable {
|
|||||||
@ApiModelProperty("租户ID")
|
@ApiModelProperty("租户ID")
|
||||||
private String tenantId;
|
private String tenantId;
|
||||||
|
|
||||||
|
@ApiModelProperty("场景")
|
||||||
|
private String scene;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.annotation.TableLogic;
|
|||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|||||||
@@ -5,8 +5,6 @@ import com.gxwebsoft.common.core.utils.DomainUtil;
|
|||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
|
|
||||||
import static com.gxwebsoft.common.core.constants.DomainConstants.DOMAIN;
|
import static com.gxwebsoft.common.core.constants.DomainConstants.DOMAIN;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user