|
|
@@ -363,4 +363,29 @@ public class InnerAPIController extends BaseController {
|
|
|
ManageLoginResponse login = manageService.login(param);
|
|
|
return ResultData.ok(login.getToken());
|
|
|
}
|
|
|
+
|
|
|
+ @PostMapping("/getTokenByProjectId")
|
|
|
+ public ResultData getTokenByProjectId(@RequestBody ManageLoginRequest param){
|
|
|
+ if(StringUtils.isBlank(param.getProjectId())){
|
|
|
+ throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
|
|
|
+ }
|
|
|
+ LambdaQueryWrapper<ScenePlus> sceneQw = new LambdaQueryWrapper<>();
|
|
|
+ sceneQw.eq(ScenePlus::getTaskId,param.getProjectId());
|
|
|
+ List<ScenePlus> list = scenePlusService.list(sceneQw);
|
|
|
+ if(list == null || list.isEmpty()){
|
|
|
+ throw new BusinessException(ResultCode.SCENE_NOT_EXIST);
|
|
|
+ }
|
|
|
+ ScenePlus scenePlus = list.get(0);
|
|
|
+ User user = userService.getById(scenePlus.getUserId());
|
|
|
+ if(user == null){
|
|
|
+ throw new BusinessException(ResultCode.JY_ID_NO_EXIST);
|
|
|
+ }
|
|
|
+
|
|
|
+ param.setUserName(user.getUserName());
|
|
|
+ String clientIP = ServletUtil.getClientIP(request);
|
|
|
+ param.setNeedPassword(false);
|
|
|
+ param.setClientIp(clientIP);
|
|
|
+ ManageLoginResponse login = manageService.login(param);
|
|
|
+ return ResultData.ok(login.getToken());
|
|
|
+ }
|
|
|
}
|