Commit 98859d13 authored by tianbo's avatar tianbo

修改视频监控批量导入时建筑位置字段保存错误修改(wl_video_source:parent_source_ids)

bug6303,bug6287
parent 9dad0c39
...@@ -25,10 +25,10 @@ public class VideoDownloadVO implements Serializable { ...@@ -25,10 +25,10 @@ public class VideoDownloadVO implements Serializable {
@ExcelProperty(value = "token", index = 3) @ExcelProperty(value = "token", index = 3)
private String token; private String token;
@ExcelProperty(value = "机构编码", index = 4) @ExcelProperty(value = "机构编码(必填)", index = 4)
private String bizOrgCode; private String bizOrgCode;
@ExcelProperty(value = "机构/部门名称", index = 5) @ExcelProperty(value = "机构/部门名称(必填)", index = 5)
private String bizOrgName; private String bizOrgName;
@ExcelProperty(value = "所属建筑编码", index = 6) @ExcelProperty(value = "所属建筑编码", index = 6)
......
...@@ -34,7 +34,6 @@ import com.yeejoin.equipmanage.operation.SyncRiskOperator; ...@@ -34,7 +34,6 @@ import com.yeejoin.equipmanage.operation.SyncRiskOperator;
import com.yeejoin.equipmanage.operation.factory.PageOperatorFactory; import com.yeejoin.equipmanage.operation.factory.PageOperatorFactory;
import com.yeejoin.equipmanage.remote.RemoteSecurityService; import com.yeejoin.equipmanage.remote.RemoteSecurityService;
import com.yeejoin.equipmanage.service.*; import com.yeejoin.equipmanage.service.*;
import liquibase.pro.packaged.S;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
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;
...@@ -48,7 +47,6 @@ import org.typroject.tyboot.core.foundation.exception.BaseException; ...@@ -48,7 +47,6 @@ import org.typroject.tyboot.core.foundation.exception.BaseException;
import org.typroject.tyboot.core.foundation.utils.Bean; import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest; import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
...@@ -553,8 +551,8 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i ...@@ -553,8 +551,8 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
return fireFightingSystemService.transferListToPointTree(responses, null,instanceId); return fireFightingSystemService.transferListToPointTree(responses, null,instanceId);
} }
@Override
public List<PointTreeVo> getEquipTree(String bizOrgCode,String instanceId,String displayName) { public List<PointTreeVo> getEquipTree(String bizOrgCode, String instanceId, String displayName) {
//根据关键字筛选建筑树 //根据关键字筛选建筑树
List<PointTreeVo> responses = this.baseMapper.getBuildAll(displayName); List<PointTreeVo> responses = this.baseMapper.getBuildAll(displayName);
if(ValidationUtil.isEmpty(bizOrgCode) && ValidationUtil.isEmpty(instanceId) && ValidationUtil.isEmpty(displayName) ){ if(ValidationUtil.isEmpty(bizOrgCode) && ValidationUtil.isEmpty(instanceId) && ValidationUtil.isEmpty(displayName) ){
......
...@@ -4,11 +4,15 @@ import com.alibaba.fastjson.JSONObject; ...@@ -4,11 +4,15 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.base.Joiner;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.yeejoin.amos.boot.biz.common.dto.OrgMenuDto; import com.yeejoin.amos.boot.biz.common.dto.OrgMenuDto;
import com.yeejoin.equipmanage.common.dto.OrgUsrDto; import com.yeejoin.equipmanage.common.dto.OrgUsrDto;
import com.yeejoin.equipmanage.common.entity.*; import com.yeejoin.equipmanage.common.entity.*;
import com.yeejoin.equipmanage.common.entity.dto.VideoDTO; import com.yeejoin.equipmanage.common.entity.dto.VideoDTO;
import com.yeejoin.equipmanage.common.entity.dto.VideoSaveDto; import com.yeejoin.equipmanage.common.entity.dto.VideoSaveDto;
import com.yeejoin.equipmanage.common.entity.publics.BaseEntity;
import com.yeejoin.equipmanage.common.entity.vo.*; import com.yeejoin.equipmanage.common.entity.vo.*;
import com.yeejoin.equipmanage.common.enums.EquipmentSpeIndexEnum; import com.yeejoin.equipmanage.common.enums.EquipmentSpeIndexEnum;
import com.yeejoin.equipmanage.common.enums.IndustryEnum; import com.yeejoin.equipmanage.common.enums.IndustryEnum;
...@@ -361,6 +365,16 @@ public class VideoServiceImpl extends ServiceImpl<VideoMapper, Video> implements ...@@ -361,6 +365,16 @@ public class VideoServiceImpl extends ServiceImpl<VideoMapper, Video> implements
static final Pattern urlPattern = Pattern.compile("^(((http)|(https)):\\/\\/)?([0-9]{1,3}.){3}[0-9]{1,3}(:[1-3]?[0-9]{1,4})?$"); static final Pattern urlPattern = Pattern.compile("^(((http)|(https)):\\/\\/)?([0-9]{1,3}.){3}[0-9]{1,3}(:[1-3]?[0-9]{1,4})?$");
private List<Long> getParents(Map<Long, Long> allMap, Long wsId) {
List<Long> parents = Lists.newLinkedList();
if (wsId != null && wsId != 0) {
parents.add(wsId);
parents.addAll(getParents(allMap, allMap.get(wsId)));
}
parents.remove(0L);
return parents;
}
@Override @Override
@Transactional(rollbackFor = {Exception.class}) @Transactional(rollbackFor = {Exception.class})
public List<Video> videoUpload(List<VideoDownloadVO> videoDownloadVOS) { public List<Video> videoUpload(List<VideoDownloadVO> videoDownloadVOS) {
...@@ -374,8 +388,19 @@ public class VideoServiceImpl extends ServiceImpl<VideoMapper, Video> implements ...@@ -374,8 +388,19 @@ public class VideoServiceImpl extends ServiceImpl<VideoMapper, Video> implements
// 获取所有的视频设备编号 // 获取所有的视频设备编号
Set<String> videoCodeSet = new HashSet(Bean.listToMap(this.baseMapper.selectList(new QueryWrapper<>()), "code", Video.class).keySet()); Set<String> videoCodeSet = new HashSet(Bean.listToMap(this.baseMapper.selectList(new QueryWrapper<>()), "code", Video.class).keySet());
// 所有建筑列表
List<WarehouseStructure> allWarehouseStructureList =
warehouseStructureService.list().stream().filter(z -> StringUtil.isNotEmpty(z.getCode())).collect(Collectors.toList());
// 建筑对应父级建筑map
Map<Long, String> withParentMap = Maps.newHashMap();
if (!ValidationUtil.isEmpty(allWarehouseStructureList)) {
Map<Long, Long> allMap = allWarehouseStructureList.stream().collect(Collectors.toMap(BaseEntity::getId,
WarehouseStructure::getParentId));
allWarehouseStructureList.forEach(ws -> withParentMap.put(ws.getId(),
Joiner.on(",").join(getParents(allMap, ws.getId()))));
}
// 获取所有的建筑code与id对应关系 // 获取所有的建筑code与id对应关系
Map<String, Long> buildingMap = new HashMap(Bean.listToMap(warehouseStructureService.list().stream().filter(z -> StringUtil.isNotEmpty(z.getCode())).collect(Collectors.toList()), "code", "id", WarehouseStructure.class)); Map<String, Long> buildingMap = new HashMap(Bean.listToMap(allWarehouseStructureList, "code", "id", WarehouseStructure.class));
// 获取所有的装备code与id对应关系 // 获取所有的装备code与id对应关系
Map<String, Long> equipMap = new HashMap(Bean.listToMap(equipmentSpecificSerivce.list().stream().filter(z -> StringUtil.isNotEmpty(z.getCode())).collect(Collectors.toList()), "code", "id", EquipmentSpecific.class)); Map<String, Long> equipMap = new HashMap(Bean.listToMap(equipmentSpecificSerivce.list().stream().filter(z -> StringUtil.isNotEmpty(z.getCode())).collect(Collectors.toList()), "code", "id", EquipmentSpecific.class));
// 获取所有重点设备code与id对应关系 // 获取所有重点设备code与id对应关系
...@@ -398,13 +423,13 @@ public class VideoServiceImpl extends ServiceImpl<VideoMapper, Video> implements ...@@ -398,13 +423,13 @@ public class VideoServiceImpl extends ServiceImpl<VideoMapper, Video> implements
throw new RuntimeException("错误行" + rowNum + ":视频地址不能为空"); throw new RuntimeException("错误行" + rowNum + ":视频地址不能为空");
} }
if (ValidationUtil.isEmpty(x.getType())) { if (ValidationUtil.isEmpty(x.getType())) {
throw new RuntimeException("机构/部门编码不能为空,请修改后上传!"); throw new RuntimeException("视频类型(枪机/球机)不能为空,请修改后上传!");
} }
if (ValidationUtil.isEmpty(x.getBizOrgCode())) { if (ValidationUtil.isEmpty(x.getBizOrgCode())) {
throw new RuntimeException("机构/部门名称不能为空,请修改后上传!"); throw new RuntimeException("机构编码不能为空,请修改后上传!");
} }
if (ValidationUtil.isEmpty(x.getBizOrgName())) { if (ValidationUtil.isEmpty(x.getBizOrgName())) {
throw new RuntimeException("视频类型为必填字段,请修改后上传!"); throw new RuntimeException("机构/部门名称不能为空,请修改后上传!");
} }
// if (!urlPattern.matcher(x.getUrl().trim()).matches()) { // if (!urlPattern.matcher(x.getUrl().trim()).matches()) {
// throw new RuntimeException("错误行" + rowNum + ":视频地址格式有误,仅支持协议+ip+端口的格式"); // throw new RuntimeException("错误行" + rowNum + ":视频地址格式有误,仅支持协议+ip+端口的格式");
...@@ -432,6 +457,7 @@ public class VideoServiceImpl extends ServiceImpl<VideoMapper, Video> implements ...@@ -432,6 +457,7 @@ public class VideoServiceImpl extends ServiceImpl<VideoMapper, Video> implements
VideoSource videoSource = new VideoSource(); VideoSource videoSource = new VideoSource();
videoSource.setVideoId(video.getId()); videoSource.setVideoId(video.getId());
videoSource.setSourceId(buildingMap.get(x.getBuildingCodes().trim())); videoSource.setSourceId(buildingMap.get(x.getBuildingCodes().trim()));
videoSource.setParentSourceIds(withParentMap.get(buildingMap.get(x.getBuildingCodes().trim())));
videoSources.add(videoSource); videoSources.add(videoSource);
} }
// 处理监控和多个装备关系(1个摄像头对多个装备) // 处理监控和多个装备关系(1个摄像头对多个装备)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment