处理摄像头

This commit is contained in:
wangliwen 2022-07-12 11:36:56 +08:00
parent 44abdc3c2f
commit 454b0c5ed6
1 changed files with 31 additions and 2 deletions

View File

@ -26,11 +26,15 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -53,6 +57,10 @@ public class TAbilityApplicationController {
private ResourceService resourceService;
@Autowired
private ActivitiService activitiService;
@Autowired
private JdbcTemplate jdbcTemplate;
@Value("${project.place}")
private Integer projectPlace;
/**
@ -108,22 +116,43 @@ public class TAbilityApplicationController {
final List<TAbilityApplicationDTO> tAbilityApplicationDTOList = result.get(index);
List<ResourceDTO> resourceDTOS =
tAbilityApplicationDTOList.stream()
.filter(tAbilityApplicationDTO -> !tAbilityApplicationDTO.getResourceId().equals("8888888880000000001")) // 过滤非摄像头申请
.filter(tAbilityApplicationDTO -> StringUtils.isEmpty(tAbilityApplicationDTO.getCameraList())) // 过滤非摄像头申请
.map(tAbilityApplicationDTO -> resourceService.get(Long.valueOf(tAbilityApplicationDTO.getResourceId()))).collect(Collectors.toList());
List<HistoryDetailDTO> taskHandleDetailInfo = activitiService.getTaskHandleDetailInfo(tAbilityApplicationDTOList.get(0).getInstanceId());
List<Map> camera = new ArrayList<>();
switch (Constant.ProjectPlace.getByFlag(projectPlace)) { // 处理基础设施
case TSINGTAO_XHA:
break;
case TSINGTAO: { // 大数据局
camera = tAbilityApplicationDTOList.stream()
.filter(tAbilityApplicationDTO -> StringUtils.isNotEmpty(tAbilityApplicationDTO.getCameraList()))
.map(index_ -> jdbcTemplate.queryForObject("SELECT * FROM t_camera_channel WHERE idt_camera_channel = " + index_.getResourceId(), Map.class))
.filter(index_ -> !index_.isEmpty()).collect(Collectors.toList());
}
break;
case BAOTOU:
case UNKNOWN:
default:
}
List<Map> finalCamera = camera;
Map<String, Object> resourceApplication = new HashMap<String, Object>() {
{
put("instanceId", tAbilityApplicationDTOList.get(0).getInstanceId()); // 流程id
put("resourceOwnerDept", tAbilityApplicationDTOList.get(0).getResourceOwnerDept()); // 资源所属部门信息
put("resources", resourceDTOS);//申请的该部门的能力资源
put("taskHandleDetailInfo", taskHandleDetailInfo); // 流程详情
if (!finalCamera.isEmpty()) {
put("camera", finalCamera); // 流程详情
}
}
};
return resourceApplication;
}).collect(Collectors.groupingBy(t -> {
SysDeptDTO sysDeptDTO = (SysDeptDTO) t.get("resourceOwnerDept");
if (sysDeptDTO == null) {
return "无部门信息"; // 无部门信息
return "未知部门"; // 无部门信息
} else {
return sysDeptDTO.getName();
}