|
@@ -1,5 +1,7 @@
|
|
|
package com.fdkankan.ucenter.controller.api;
|
|
|
+import com.fdkankan.common.constant.ErrorCode;
|
|
|
import com.fdkankan.common.exception.BusinessException;
|
|
|
+import com.fdkankan.common.util.JwtUtil;
|
|
|
import com.fdkankan.ucenter.common.BaseController;
|
|
|
import com.fdkankan.ucenter.common.Result;
|
|
|
import com.fdkankan.ucenter.entity.ScenePlus;
|
|
@@ -44,7 +46,15 @@ public class LaserController extends BaseController {
|
|
|
*/
|
|
|
@RequestMapping(value = "/getSnCodeByPhone",method = RequestMethod.GET)
|
|
|
public Result getSnCodeByUserName(@RequestParam(required = false)String phone,
|
|
|
- @RequestParam(required = false,defaultValue = "4")Integer sceneSource) throws Exception {
|
|
|
+ @RequestParam(required = false,defaultValue = "4")String sceneSource) throws Exception {
|
|
|
+ if(StringUtils.isBlank(phone)){
|
|
|
+ String token = getToken();
|
|
|
+ phone = JwtUtil.getUsername(token);
|
|
|
+ }
|
|
|
+ if(StringUtils.isBlank(phone)){
|
|
|
+ throw new BusinessException(ErrorCode.MISSING_REQUIRED_PARAMETERS);
|
|
|
+ }
|
|
|
+
|
|
|
List<Long> userIds = userService.getLikeUserName(phone);
|
|
|
HashMap<String,Object> map = new HashMap<>();
|
|
|
Set<String> snCodeSet = new HashSet<>();
|
|
@@ -54,10 +64,21 @@ public class LaserController extends BaseController {
|
|
|
return Result.success(map);
|
|
|
}
|
|
|
List<CameraAppVo> camera = new ArrayList<>();
|
|
|
- if(sceneSource == 4){
|
|
|
+ if(sceneSource.contains(",")){
|
|
|
+ String[] split = sceneSource.split(",");
|
|
|
+ for (String resource : split) {
|
|
|
+ if("4".equals(resource)){
|
|
|
+ camera.addAll( cameraDetailService.getListByUserIdsAndType(userIds, 10));
|
|
|
+ }
|
|
|
+ if("5".equals(resource)){
|
|
|
+ camera.addAll(cameraDetailService.getListByUserIdsAndType(userIds, 11));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if("4".equals(sceneSource)){
|
|
|
camera = cameraDetailService.getListByUserIdsAndType(userIds, 10);
|
|
|
}
|
|
|
- if(sceneSource == 5){
|
|
|
+ if("5".equals(sceneSource)){
|
|
|
camera = cameraDetailService.getListByUserIdsAndType(userIds, 11);
|
|
|
}
|
|
|
if(camera.size() >0){
|