|
|
|
|
|
|
|
|
import com.tuoheng.common.utils.*; |
|
|
import com.tuoheng.common.utils.*; |
|
|
import com.tuoheng.system.entity.User; |
|
|
import com.tuoheng.system.entity.User; |
|
|
import com.tuoheng.system.mapper.UserMapper; |
|
|
import com.tuoheng.system.mapper.UserMapper; |
|
|
|
|
|
import com.tuoheng.system.utils.ShiroUtils; |
|
|
import org.springframework.beans.BeanUtils; |
|
|
import org.springframework.beans.BeanUtils; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
// 参数转换 |
|
|
// 参数转换 |
|
|
Tenant tenant = new Tenant(); |
|
|
Tenant tenant = new Tenant(); |
|
|
BeanUtils.copyProperties(tenantDto, tenant); |
|
|
BeanUtils.copyProperties(tenantDto, tenant); |
|
|
|
|
|
tenant.setCreateUser(ShiroUtils.getUserId()); |
|
|
|
|
|
tenant.setCreateTime(DateUtils.now()); |
|
|
|
|
|
tenant.setUpdateUser(ShiroUtils.getUserId()); |
|
|
|
|
|
tenant.setUpdateTime(DateUtils.now()); |
|
|
// 租户头像 |
|
|
// 租户头像 |
|
|
if (StringUtils.isNotNull(tenantDto.getLogo()) && tenantDto.getLogo().contains(CommonConfig.imageURL)) { |
|
|
if (StringUtils.isNotNull(tenantDto.getLogo()) && tenantDto.getLogo().contains(CommonConfig.imageURL)) { |
|
|
tenant.setLogo(tenantDto.getLogo().replaceAll(CommonConfig.imageURL, "")); |
|
|
tenant.setLogo(tenantDto.getLogo().replaceAll(CommonConfig.imageURL, "")); |
|
|
|
|
|
|
|
|
return JsonResult.error("系统中已经存在相同的租户编码"); |
|
|
return JsonResult.error("系统中已经存在相同的租户编码"); |
|
|
} |
|
|
} |
|
|
BeanUtils.copyProperties(tenantDto, tenant); |
|
|
BeanUtils.copyProperties(tenantDto, tenant); |
|
|
|
|
|
tenant.setUpdateUser(ShiroUtils.getUserId()); |
|
|
|
|
|
tenant.setUpdateTime(DateUtils.now()); |
|
|
// 租户头像 |
|
|
// 租户头像 |
|
|
if (StringUtils.isNotNull(tenantDto.getLogo()) && tenantDto.getLogo().contains(CommonConfig.imageURL)) { |
|
|
if (StringUtils.isNotNull(tenantDto.getLogo()) && tenantDto.getLogo().contains(CommonConfig.imageURL)) { |
|
|
tenant.setLogo(tenantDto.getLogo().replaceAll(CommonConfig.imageURL, "")); |
|
|
tenant.setLogo(tenantDto.getLogo().replaceAll(CommonConfig.imageURL, "")); |