|
@@ -4,18 +4,22 @@ import com.fdkankan.common.exception.BusinessException;
|
|
import com.fdkankan.common.util.JwtUtil;
|
|
import com.fdkankan.common.util.JwtUtil;
|
|
import com.fdkankan.ucenter.common.BaseController;
|
|
import com.fdkankan.ucenter.common.BaseController;
|
|
import com.fdkankan.ucenter.common.Result;
|
|
import com.fdkankan.ucenter.common.Result;
|
|
|
|
+import com.fdkankan.ucenter.common.ResultData;
|
|
|
|
+import com.fdkankan.ucenter.constant.LoginConstant;
|
|
|
|
+import com.fdkankan.ucenter.entity.ScenePlus;
|
|
|
|
+import com.fdkankan.ucenter.entity.ScenePro;
|
|
|
|
+import com.fdkankan.ucenter.entity.User;
|
|
|
|
+import com.fdkankan.ucenter.service.IScenePlusService;
|
|
import com.fdkankan.ucenter.service.ISceneProService;
|
|
import com.fdkankan.ucenter.service.ISceneProService;
|
|
import com.fdkankan.ucenter.service.ISceneService;
|
|
import com.fdkankan.ucenter.service.ISceneService;
|
|
import com.fdkankan.ucenter.service.IUserService;
|
|
import com.fdkankan.ucenter.service.IUserService;
|
|
|
|
+import com.fdkankan.ucenter.service.impl.LoginService;
|
|
import com.fdkankan.ucenter.vo.ResponseScene;
|
|
import com.fdkankan.ucenter.vo.ResponseScene;
|
|
import lombok.extern.log4j.Log4j2;
|
|
import lombok.extern.log4j.Log4j2;
|
|
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.util.StringUtils;
|
|
import org.springframework.util.StringUtils;
|
|
-import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
-import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
@@ -28,6 +32,12 @@ public class FdUserSceneController extends BaseController {
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private ISceneProService sceneProService;
|
|
private ISceneProService sceneProService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private IScenePlusService scenePlusService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private LoginService loginService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private IUserService userService;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 获取场景详情
|
|
* 获取场景详情
|
|
@@ -48,4 +58,29 @@ public class FdUserSceneController extends BaseController {
|
|
log.info("火调返回数据:{}",sceneDetailList);
|
|
log.info("火调返回数据:{}",sceneDetailList);
|
|
return Result.success(sceneDetailList);
|
|
return Result.success(sceneDetailList);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @GetMapping("/getTokenByNum")
|
|
|
|
+ public ResultData getTokenByNum(@RequestParam(required = false) String num ){
|
|
|
|
+ if(StringUtils.isEmpty(num)){
|
|
|
|
+ throw new BusinessException(-1,"参数为空");
|
|
|
|
+ }
|
|
|
|
+ Long userId = null;
|
|
|
|
+ ScenePlus scenePlus = scenePlusService.getByNum(num);
|
|
|
|
+ if(scenePlus != null){
|
|
|
|
+ userId = scenePlus.getUserId();
|
|
|
|
+ }else {
|
|
|
|
+ ScenePro scenePro = sceneProService.getByNum(num);
|
|
|
|
+ if(scenePro != null){
|
|
|
|
+ userId = scenePro.getUserId();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if(userId == null){
|
|
|
|
+ throw new BusinessException(-1,"场景为空");
|
|
|
|
+ }
|
|
|
|
+ User user = userService.getById(userId);
|
|
|
|
+ if(user == null){
|
|
|
|
+ throw new BusinessException(LoginConstant.FAILURE_CODE_3015, LoginConstant.FAILURE_MSG_3015);
|
|
|
|
+ }
|
|
|
|
+ return ResultData.ok(loginService.login(user));
|
|
|
|
+ }
|
|
}
|
|
}
|