Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,11 @@ public enum ExceptionEnum implements IBaseError {
/**
* Cm 339 exception enum.
*/
CM339("CM339", "token检验失败,请重新登录");
CM339("CM339", "token检验失败,请重新登录"),
/**
* Cm 340 exception enum.
*/
CM340("CM340", "请求资源不存在");

/**
* 错误码
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,10 @@ public Result<User> me() {
user.setUsername(loginUserContext.getLoginUserId());
}
user.setTenant(tenants);

user.setPassword(null);
user.setPrivateKey(null);
user.setPublicKey(null);
user.setSalt(null);
return Result.success(user);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ public void addInterceptors(InterceptorRegistry registry) {
// 登录相关
"/platform-center/api/user/login",
// 忘记密码
"/platform-center/api/user/forgot-password"
"/platform-center/api/user/forgot-password",
// AI
"/app-center/api/ai/chat",
"/app-center/api/chat/completions"
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import com.tinyengine.it.model.entity.Tenant;
import com.tinyengine.it.model.entity.User;
import com.tinyengine.it.service.app.UserService;
import com.tinyengine.it.service.platform.TenantService;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jwts;
import io.swagger.v3.oas.annotations.Operation;
Expand Down Expand Up @@ -90,6 +91,8 @@ public class LoginController {

@Autowired
LoginUserContext loginUserContext;
@Autowired
private TenantService tenantService;

/**
* 注册
Expand Down Expand Up @@ -238,10 +241,12 @@ public Result<ValidationResult> validateToken(@RequestParam String token) {
@SystemControllerLog(description = "设置当前组织")
@GetMapping("/user/tenant")
public Result<SSOTicket> setTenant(@RequestParam Integer tenantId) {
List<Tenant> tenants = loginUserContext.getTenants();
if (tenantId == null) {
return Result.failed(ExceptionEnum.CM320);
}

List<Tenant> tenants = tenantService.findTenantByTenantId(tenantId);

if (tenants == null || tenants.isEmpty()) {
return Result.failed(ExceptionEnum.CM337);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -495,18 +495,16 @@ public Page addIsHome(Page pageInfo) {
* @return the app home page id
*/
public int getAppHomePageId(int appId) {
log.info("Getting home page ID for appId: {}, TenantId: {}", appId, loginUserContext.getTenantId());
App appInfo = appMapper.queryAppById(appId, loginUserContext.getTenantId());
// appHomePageId 存在为null的情况,即app没有设置首页
Integer homePage = appInfo.getHomePage();

// 将 homePage 转换为整数,如果为空则默认为 0
int id;
if (homePage == null) {
id = 0;
return id;
if (appInfo == null) {
throw new ServiceException(ExceptionEnum.CM340.getResultCode(), "App not found for ID: " + appId+",TenantId:"+loginUserContext.getTenantId());
}
id = homePage;
return id;
// 将 homePage 转换为整数,如果为空则默认为 0
Integer homePage = appInfo.getHomePage();
log.info("Retrieved home page ID: {} for appId: {}", homePage, appId);
return homePage != null ? homePage : 0;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@ public interface TenantService extends IService<Tenant> {
*/
List<Tenant> findTenantByCondition(Tenant tenant);

/**
* 根据条件查询表t_tenant信息
*
* @param tenantId the tenantId
* @return the list
*/
List<Tenant> findTenantByTenantId(Integer tenantId);

/**
* 根据主键id删除t_tenant数据
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,17 @@ public List<Tenant> findTenantByCondition(Tenant tenant) {
return baseMapper.queryTenantByCondition(tenant);
}

/**
* 根据条件查询表t_tenant信息
*
* @param tenantId the tenantId
* @return the list
*/
@Override
public List<Tenant> findTenantByTenantId(Integer tenantId) {
return baseMapper.selectList(new QueryWrapper<Tenant>().eq("id", tenantId));
}

/**
* 根据主键id删除表t_tenant数据
*
Expand Down
Loading