|
@@ -1,6 +1,7 @@
|
|
package com.fdkankan.fusion.httpClient;
|
|
package com.fdkankan.fusion.httpClient;
|
|
|
|
|
|
import cn.dev33.satoken.stp.StpUtil;
|
|
import cn.dev33.satoken.stp.StpUtil;
|
|
|
|
+import cn.hutool.core.collection.CollectionUtil;
|
|
import cn.hutool.core.date.DateUtil;
|
|
import cn.hutool.core.date.DateUtil;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.fdkankan.fusion.common.ResultCode;
|
|
import com.fdkankan.fusion.common.ResultCode;
|
|
@@ -20,14 +21,14 @@ import com.fdkankan.fusion.httpClient.response.FdRoomVo;
|
|
import com.fdkankan.fusion.httpClient.response.FdkkLoginVo;
|
|
import com.fdkankan.fusion.httpClient.response.FdkkLoginVo;
|
|
import com.fdkankan.fusion.httpClient.response.FdkkResponse;
|
|
import com.fdkankan.fusion.httpClient.response.FdkkResponse;
|
|
import com.fdkankan.fusion.response.CameraVo;
|
|
import com.fdkankan.fusion.response.CameraVo;
|
|
|
|
+import com.fdkankan.fusion.service.ICaseService;
|
|
|
|
+import com.fdkankan.fusion.service.ITmCameraService;
|
|
import com.fdkankan.redis.util.RedisUtil;
|
|
import com.fdkankan.redis.util.RedisUtil;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
|
-import java.util.Date;
|
|
|
|
-import java.util.List;
|
|
|
|
|
|
+import java.util.*;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@Service
|
|
@Service
|
|
@@ -126,8 +127,57 @@ public class FdService {
|
|
return fdkkResponse.getData();
|
|
return fdkkResponse.getData();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ ITmCameraService tmCameraService;
|
|
|
|
+ @Autowired
|
|
|
|
+ ICaseService caseService;
|
|
|
|
+
|
|
public Object overallList(JSONObject param) {
|
|
public Object overallList(JSONObject param) {
|
|
- JSONObject fdkkResponse = fdKKClient.overallList(param, getFdToken());
|
|
|
|
|
|
+ List<TmCamera> tmCameraList = null;
|
|
|
|
+ String tokenValue = StpUtil.getTokenValue();
|
|
|
|
+
|
|
|
|
+ List<String> snCodesReq = new ArrayList<>();
|
|
|
|
+ if(StringUtils.isNotBlank(tokenValue)){
|
|
|
|
+ tmCameraList = tmCameraService.getByDeptIds();
|
|
|
|
+ List<String> snCodes = tmCameraList.stream().map(TmCamera::getCameraSn).collect(Collectors.toList());
|
|
|
|
+ if(CollectionUtil.isNotEmpty(snCodes)){
|
|
|
|
+ snCodesReq.addAll(snCodes);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if(StringUtils.isNotBlank(param.getString("deptId"))){
|
|
|
|
+ List<TmCamera> tmCameras = tmCameraService.getByDeptIds(Arrays.asList(param.getString("deptId")));
|
|
|
|
+ Set<String> snCodeSet = tmCameras.parallelStream().map(TmCamera::getCameraSn).collect(Collectors.toSet());
|
|
|
|
+ if(snCodesReq.isEmpty()){
|
|
|
|
+ snCodesReq = new ArrayList<>(snCodeSet);
|
|
|
|
+ }else {
|
|
|
|
+ snCodesReq = snCodesReq.stream().filter(snCodeSet::contains).collect(Collectors.toList());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if(StringUtils.isNotBlank(param.getString("snCode"))){
|
|
|
|
+ List<String> snCodes1 = new ArrayList<>();
|
|
|
|
+ snCodes1.add(param.getString("snCode"));
|
|
|
|
+ if(snCodesReq.isEmpty()){
|
|
|
|
+ snCodesReq = snCodes1;
|
|
|
|
+ }else {
|
|
|
|
+ snCodesReq = snCodesReq.stream().filter(snCodes1::contains).collect(Collectors.toList());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if(param.getInteger("caseId") !=null){
|
|
|
|
+ String deptId = caseService.getDeptId(param.getInteger("caseId"));
|
|
|
|
+ List<TmCamera> tmCameras = tmCameraService.getByDeptIds(Arrays.asList(deptId));
|
|
|
|
+ List<String> snCodes1 = tmCameras.stream().map(TmCamera::getCameraSn).collect(Collectors.toList());
|
|
|
|
+ snCodes1.add(param.getString("snCode"));
|
|
|
|
+ if(snCodesReq.isEmpty()){
|
|
|
|
+ snCodesReq = snCodes1;
|
|
|
|
+ }else {
|
|
|
|
+ snCodesReq = snCodesReq.stream().filter(snCodes1::contains).collect(Collectors.toList());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if(CollectionUtil.isEmpty(snCodesReq)){
|
|
|
|
+ return ResultData.ok();
|
|
|
|
+ }
|
|
|
|
+ param.put("snCodes",snCodesReq);
|
|
|
|
+ JSONObject fdkkResponse = fdKKClient.overallList(param);
|
|
return fdkkResponse;
|
|
return fdkkResponse;
|
|
}
|
|
}
|
|
}
|
|
}
|