|
@@ -1,5 +1,6 @@
|
|
|
package com.fdkankan.ucenter.service.impl;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.fdkankan.common.util.JwtUtil;
|
|
|
import com.fdkankan.ucenter.common.constants.ConstantFilePath;
|
|
@@ -11,6 +12,7 @@ import com.fdkankan.redis.util.RedisUtil;
|
|
|
import com.fdkankan.ucenter.common.OssPath;
|
|
|
import com.fdkankan.ucenter.constant.LoginConstant;
|
|
|
import com.fdkankan.ucenter.entity.*;
|
|
|
+import com.fdkankan.ucenter.httpClient.service.LaserService;
|
|
|
import com.fdkankan.ucenter.mapper.IScenePlusMapper;
|
|
|
import com.fdkankan.ucenter.service.*;
|
|
|
import com.fdkankan.ucenter.vo.request.AppSceneParam;
|
|
@@ -52,18 +54,24 @@ public class AppSceneService {
|
|
|
RedisUtil redisUtil;
|
|
|
@Autowired
|
|
|
ISceneCooperationService sceneCooperationService;
|
|
|
-
|
|
|
@Autowired
|
|
|
IScenePlusMapper scenePlusMapper;
|
|
|
@Autowired
|
|
|
IUserRoleService userRoleService;
|
|
|
@Autowired
|
|
|
ITmColdStorageService tmColdStorageService;
|
|
|
+ @Autowired
|
|
|
+ ITmContractorService tmContractorService;
|
|
|
+ @Autowired
|
|
|
+ ITmContractorNumService tmContractorNumService;
|
|
|
+ @Autowired
|
|
|
+ LaserService laserService;
|
|
|
|
|
|
@Value("${fyun.host}")
|
|
|
private String ossHost;
|
|
|
|
|
|
public PageInfo pageList(AppSceneParam param) {
|
|
|
+ log.info("getAppAllSceneByPage-param:{}",param);
|
|
|
if(StringUtils.isEmpty(param.getAppUserName()) && StringUtils.isEmpty(param.getPhoneNum()) && param.getCameraId() == null){
|
|
|
throw new BusinessException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
|
|
|
}
|
|
@@ -81,37 +89,52 @@ public class AppSceneService {
|
|
|
}
|
|
|
|
|
|
List<String> cooperationNumList = new ArrayList<>();
|
|
|
+ Set<Long> roleIds = null;
|
|
|
if(StringUtils.isNotBlank(param.getPhoneNum())){
|
|
|
User user = userService.getByUserName(param.getPhoneNum());
|
|
|
if(user == null){
|
|
|
throw new BusinessException(LoginConstant.FAILURE_CODE_3015, LoginConstant.FAILURE_MSG_3015);
|
|
|
}
|
|
|
- cooperationNumList = sceneCooperationService.getNumByUserIds(Arrays.asList(user.getId()));
|
|
|
+
|
|
|
+ cooperationNumList = tmContractorNumService.getNumListByCompanyId(user.getCompanyId());
|
|
|
if(cooperationNumList.size() >0){
|
|
|
param.setCooperationNumList(cooperationNumList );
|
|
|
}
|
|
|
- Set<Long> roleIds = userRoleService.getByUser(user);
|
|
|
+ roleIds = userRoleService.getByUser(user);
|
|
|
// if(!roleIds.contains(5L) && !roleIds.contains(6L)){
|
|
|
// param.setUserId(user.getId());
|
|
|
// }
|
|
|
if(!roleIds.contains(5L) ){
|
|
|
param.setCompanyId(user.getCompanyId());
|
|
|
+ param.setUserId(user.getId());
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
Page<AppSceneVo> page = scenePlusMapper.pageList(new Page<>(param.getPageNum(),param.getPageSize()),param);
|
|
|
-
|
|
|
List<String> numList = page.getRecords().stream().map(AppSceneVo::getNum).collect(Collectors.toList());
|
|
|
+
|
|
|
+ HashMap<String, JSONObject> ssSceneMap = new HashMap<>();
|
|
|
+ if(param.getCameraType() == 10 || param.getCameraType() == 11){ //深时
|
|
|
+ ssSceneMap = laserService.list(numList);
|
|
|
+ }
|
|
|
+
|
|
|
HashMap<String,Boolean> coldMap = tmColdStorageService.getByNumList(numList);
|
|
|
|
|
|
-// Set<Long> cameraIdSet = page.getRecords().stream().map(AppSceneVo::getCameraId).collect(Collectors.toSet());
|
|
|
-// List<Long> cameraIds = new ArrayList<>(cameraIdSet);
|
|
|
-// HashMap<Long, Camera> cameraHashMap = cameraService.getByIds(cameraIds);
|
|
|
-// HashMap<Long, CameraDetail> detailHashMap = cameraDetailService.getByCameraIds(cameraIds);
|
|
|
//账号密码登录 sceneSourceType 取值 1用户场景,2协作场景
|
|
|
//相机登录 sceneSourceType 取值皆为0
|
|
|
|
|
|
for (AppSceneVo record : page.getRecords()) {
|
|
|
+ if(param.getCameraType() == 10 || param.getCameraType() == 11){ //深时
|
|
|
+ JSONObject ssObj = ssSceneMap.get(record.getNum());
|
|
|
+ if(ssObj!=null){
|
|
|
+ record.setSceneName(ssObj.getString("title"));
|
|
|
+ record.setThumb(ssObj.getString("thumb"));
|
|
|
+ record.setWebSite(ssObj.getString("webSite"));
|
|
|
+ }else{
|
|
|
+ record.setStatus(-1);
|
|
|
+ record.setWebSite(null);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if(coldMap.get(record.getNum()) != null ){
|
|
|
record.setColdStorage(coldMap.get(record.getNum()));
|
|
|
}
|
|
@@ -120,20 +143,14 @@ public class AppSceneService {
|
|
|
} else if (record.getStatus() == 500) {
|
|
|
record.setStatus(-1);
|
|
|
}
|
|
|
- //虚拟场景
|
|
|
- if(record.getCameraId() == null && param.getUserId() != null){
|
|
|
- record.setSceneSourceType(record.getUserId().equals(param.getUserId()) ? 1 :2);
|
|
|
- continue;
|
|
|
- }
|
|
|
- //相机场景
|
|
|
- if(param.getCameraId() !=null && record.getCameraId().equals(param.getCameraId())){
|
|
|
- record.setSceneSourceType(0);
|
|
|
- continue;
|
|
|
- }
|
|
|
+ record.setSceneSourceType(2);
|
|
|
//用户场景
|
|
|
if(param.getUserId() != null && record.getUserId() != null){
|
|
|
record.setSceneSourceType(record.getUserId().equals(param.getUserId()) ? 1 :2);
|
|
|
}
|
|
|
+ if(roleIds!= null && (roleIds.contains(5L) || roleIds.contains(6L))){
|
|
|
+ record.setSceneSourceType(1);
|
|
|
+ }
|
|
|
}
|
|
|
return PageInfo.PageInfo(page);
|
|
|
}
|