修复租户bug
This commit is contained in:
parent
cdc8a819df
commit
419edc6f9f
|
|
@ -0,0 +1,27 @@
|
|||
package org.jeecg.common.util;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class ShareQrUtils {
|
||||
|
||||
@Value("${domain.domain}")
|
||||
private String domain;
|
||||
|
||||
|
||||
/**
|
||||
* 拼接静态地址
|
||||
*/
|
||||
public String completeStaticUrl(String url) {
|
||||
if (StringUtils.isNotBlank(url)) {
|
||||
if(url.contains("http")){
|
||||
return url;
|
||||
}else{
|
||||
return domain + "/sys/common/static/" + url;
|
||||
}
|
||||
}
|
||||
return url;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
package org.jeecg.config.mybatis;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.ibatis.binding.MapperMethod.ParamMap;
|
||||
import org.apache.ibatis.executor.Executor;
|
||||
import org.apache.ibatis.mapping.MappedStatement;
|
||||
|
|
@ -88,13 +89,21 @@ public class MybatisInterceptor implements Interceptor {
|
|||
//------------------------------------------------------------------------------------------------
|
||||
//注入租户ID(是否开启系统管理模块的多租户数据隔离【SAAS多租户模式】)
|
||||
if(MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL) {
|
||||
log.error(field.getName()+"=============checkOne============"+TenantContext.getTenant());
|
||||
if (TenantConstant.TENANT_ID.equals(field.getName())) {
|
||||
field.setAccessible(true);
|
||||
Object localTenantId = field.get(parameter);
|
||||
log.error(field.getName()+"xxxlocalTenantIdxxxx"+parameter);
|
||||
field.setAccessible(false);
|
||||
if (localTenantId == null) {
|
||||
if (localTenantId == null || StringUtils.isBlank(localTenantId.toString())) {
|
||||
field.setAccessible(true);
|
||||
field.set(parameter, oConvertUtils.getInt(TenantContext.getTenant(),0));
|
||||
|
||||
if (field.getType() == String.class) {
|
||||
field.set(parameter, oConvertUtils.getString(TenantContext.getTenant(),"0"));
|
||||
log.error("checkC============"+field.get(parameter));
|
||||
}else{
|
||||
field.set(parameter, oConvertUtils.getInt(TenantContext.getTenant(),0));
|
||||
}
|
||||
field.setAccessible(false);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import org.jeecg.config.JeecgBaseConfig;
|
|||
import org.jeecg.modules.base.service.BaseCommonService;
|
||||
import org.jeecg.modules.system.entity.SysDepart;
|
||||
import org.jeecg.modules.system.entity.SysRoleIndex;
|
||||
import org.jeecg.modules.system.entity.SysTenant;
|
||||
import org.jeecg.modules.system.entity.SysUser;
|
||||
import org.jeecg.modules.system.model.SysLoginModel;
|
||||
import org.jeecg.modules.system.service.*;
|
||||
|
|
@ -68,6 +69,9 @@ public class LoginController {
|
|||
@Autowired
|
||||
private JeecgBaseConfig jeecgBaseConfig;
|
||||
|
||||
@Autowired
|
||||
private ShareQrUtils shareQrUtils;
|
||||
|
||||
private final String BASE_CHECK_CODES = "qwertyuiplkjhgfdsazxcvbnmQWERTYUPLKJHGFDSAZXCVBNM1234567890";
|
||||
|
||||
@ApiOperation("登录接口")
|
||||
|
|
@ -460,6 +464,14 @@ public class LoginController {
|
|||
return loginTenantError;
|
||||
}
|
||||
|
||||
SysTenant sysTenant = sysTenantService.getById(sysUser.getLoginTenantId());
|
||||
if(sysTenant!=null){
|
||||
sysUser.setLoadingName(sysTenant.getLoadingName());
|
||||
sysUser.setSystemName(sysTenant.getSystemName());
|
||||
sysUser.setAppLogoName(sysTenant.getAppLogoName());
|
||||
sysUser.setAptImage(shareQrUtils.completeStaticUrl(sysTenant.getAptImage()));
|
||||
}
|
||||
|
||||
//3.设置登录用户信息
|
||||
obj.put("userInfo", sysUser);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package org.jeecg.modules.system.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
|
@ -133,4 +134,24 @@ public class SysTenant implements Serializable {
|
|||
*/
|
||||
private Integer applyStatus;
|
||||
|
||||
/**
|
||||
* 左上logo名称
|
||||
*/
|
||||
private String appLogoName;
|
||||
|
||||
/**
|
||||
* 中上系统名称
|
||||
*/
|
||||
private String systemName;
|
||||
|
||||
/**
|
||||
* loadingName
|
||||
*/
|
||||
private String loadingName;
|
||||
|
||||
/**
|
||||
* 小程序图片
|
||||
*/
|
||||
private String aptImage;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -201,4 +201,28 @@ public class SysUser implements Serializable {
|
|||
* 流程状态
|
||||
*/
|
||||
private String bpmStatus;
|
||||
|
||||
/**
|
||||
* 左上logo名称
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String appLogoName;
|
||||
|
||||
/**
|
||||
* 中上系统名称
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String systemName;
|
||||
|
||||
/**
|
||||
* loadingName
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String loadingName;
|
||||
|
||||
/**
|
||||
* 小程序图片
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String aptImage;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -634,7 +634,7 @@ public class BigScreenController {
|
|||
// remainList.add(survDeviceDeploy);
|
||||
}
|
||||
}
|
||||
|
||||
log.error("step============="+waterIdList.size());
|
||||
//查询五常数据
|
||||
ScreenIndexSummaryDetailVo waterQuality = commonP2Service.processWaterQuality(screenSummaryVo,waterIdList,startTime,endTime);
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.jeecg.common.config.TenantContext;
|
||||
import org.jeecg.common.entity.SurvMulchRecord;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.jeecg.common.system.util.JwtUtil;
|
||||
|
|
@ -69,6 +70,7 @@ public class SurvMulchRecordController extends JeecgController<SurvMulchRecord,
|
|||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody SurvMulchRecord survMulchRecord,HttpServletRequest request) {
|
||||
String username = JwtUtil.getUserNameByToken(request);
|
||||
// survMulchRecord.setTenantId(TenantContext.getTenant());
|
||||
survMulchRecord.setCreatedBy(username);
|
||||
survMulchRecord.setCreateTime(new Date());
|
||||
survMulchRecordService.save(survMulchRecord);
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ public class IotCommonServiceImpl {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
log.error("wtf========"+deploys.size());
|
||||
//无设备直接返回
|
||||
if(CollectionUtils.isEmpty(deploys)){
|
||||
return result;
|
||||
|
|
|
|||
Loading…
Reference in New Issue