|
@@ -69,24 +69,20 @@ public class CoordinateCalculateServiceImpl implements CalculateService {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- if (graphCalInfo.getFromIsPointFlag()){
|
|
|
-
|
|
|
- calculateRelationInternal(graphCalInfo,calculatingDTO,
|
|
|
- calculatingDTO.getFilterRelFlag()?calculatingDTO.getFromIds():new HashSet<>(),
|
|
|
- relationDefine.getFromObjType(),graphCalInfo.getFromInfoCode(),
|
|
|
- calculatingDTO.getFilterRelFlag()?calculatingDTO.getToIds():new HashSet<>(),
|
|
|
- relationDefine.getToObjType(),graphCalInfo.getToInfoCode());
|
|
|
+
|
|
|
+ if (graphCalInfo.getFromIsPointFlag() && graphCalInfo.getToIsPointFlag()){
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
calculateRelationInternal(graphCalInfo,calculatingDTO,
|
|
|
- calculatingDTO.getFilterRelFlag()?calculatingDTO.getToIds():new HashSet<>(),
|
|
|
- relationDefine.getToObjType(),graphCalInfo.getToInfoCode(),
|
|
|
calculatingDTO.getFilterRelFlag()?calculatingDTO.getFromIds():new HashSet<>(),
|
|
|
- relationDefine.getFromObjType(),graphCalInfo.getFromInfoCode());
|
|
|
+ relationDefine.getFromObjType(),graphCalInfo.getFromInfoCode(),
|
|
|
+ calculatingDTO.getFilterRelFlag()?calculatingDTO.getToIds():new HashSet<>(),
|
|
|
+ relationDefine.getToObjType(),graphCalInfo.getToInfoCode());
|
|
|
}
|
|
|
+
|
|
|
|
|
|
- * Description: 内部的计算关系
|
|
|
+ * Description: 内部的计算关系(点-面计算逻辑)
|
|
|
* @param graphCalInfo : 坐标计算信息对象
|
|
|
* @param calculatingDTO : 请求参数
|
|
|
* @param fromIds : 来源id集合
|
|
@@ -107,12 +103,22 @@ public class CoordinateCalculateServiceImpl implements CalculateService {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- List<ObjectDigital> fromObjectDigitals = queryFromData(fromIds,fromObjType,fromInfoCode,calculatingDTO);
|
|
|
+ List<ObjectDigital> fromObjectDigitals;
|
|
|
+ if (graphCalInfo.getFromIsPointFlag()){
|
|
|
+ fromObjectDigitals = queryPointData(fromIds,fromObjType,fromInfoCode,calculatingDTO);
|
|
|
+ }else {
|
|
|
+ fromObjectDigitals = queryPlaneData(fromIds,fromObjType,fromInfoCode,calculatingDTO);
|
|
|
+ }
|
|
|
if (CollUtil.isEmpty(fromObjectDigitals)){
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- List<ObjectDigital> toObjectDigitals = queryToData(toIds,toObjType,toInfoCode,calculatingDTO);
|
|
|
+ List<ObjectDigital> toObjectDigitals;
|
|
|
+ if (graphCalInfo.getToIsPointFlag()){
|
|
|
+ toObjectDigitals = queryPointData(toIds,toObjType,toInfoCode,calculatingDTO);
|
|
|
+ }else {
|
|
|
+ toObjectDigitals = queryPlaneData(toIds,toObjType,toInfoCode,calculatingDTO);
|
|
|
+ }
|
|
|
if (CollUtil.isEmpty(toObjectDigitals)){
|
|
|
return;
|
|
|
}
|
|
@@ -120,14 +126,17 @@ public class CoordinateCalculateServiceImpl implements CalculateService {
|
|
|
List<ObjectRelation> resultList = new ArrayList<>();
|
|
|
for (ObjectDigital fromObjectDigital : fromObjectDigitals) {
|
|
|
for (ObjectDigital toObjectDigital : toObjectDigitals) {
|
|
|
- if (CollUtil.isEmpty(toObjectDigital.getOutLines())){
|
|
|
- continue;
|
|
|
+ boolean pointInPoly;
|
|
|
+ if (graphCalInfo.getFromIsPointFlag()){
|
|
|
+ pointInPoly = GeoToolsUtil
|
|
|
+ .isPointInPoly(fromObjectDigital.getBimLocation(), toObjectDigital.getOutLines());
|
|
|
+ }else if (graphCalInfo.getToIsPointFlag()){
|
|
|
+ pointInPoly = GeoToolsUtil
|
|
|
+ .isPointInPoly(toObjectDigital.getBimLocation(), fromObjectDigital.getOutLines());
|
|
|
+ }else {
|
|
|
+ pointInPoly = GeoToolsUtil
|
|
|
+ .isPolyInPoly(fromObjectDigital.getOutLines(), toObjectDigital.getOutLines());
|
|
|
}
|
|
|
- if (null==fromObjectDigital.getBimLocation()){
|
|
|
- continue;
|
|
|
- }
|
|
|
- Boolean pointInPoly = GeoToolsUtil
|
|
|
- .isPointInPoly(fromObjectDigital.getBimLocation(), toObjectDigital.getOutLines());
|
|
|
if (!pointInPoly){
|
|
|
continue;
|
|
|
}
|
|
@@ -137,8 +146,8 @@ public class CoordinateCalculateServiceImpl implements CalculateService {
|
|
|
objectRelation.setGraphId(DigitalCommonUtils.getDefaultGraphIdByGraphCode(calculatingDTO.getGraphCode()));
|
|
|
objectRelation.setGraphCode(calculatingDTO.getGraphCode());
|
|
|
objectRelation.setRelCode(calculatingDTO.getRelCode());
|
|
|
- objectRelation.setObjFrom(graphCalInfo.getFromIsPointFlag()?fromObjectDigital.getId():toObjectDigital.getId());
|
|
|
- objectRelation.setObjTo(graphCalInfo.getFromIsPointFlag()?toObjectDigital.getId():fromObjectDigital.getId());
|
|
|
+ objectRelation.setObjFrom(fromObjectDigital.getId());
|
|
|
+ objectRelation.setObjTo(toObjectDigital.getId());
|
|
|
objectRelation.setRelValue(calculatingDTO.getRelValue());
|
|
|
objectRelation.setCreateApp(calculatingDTO.getAppId());
|
|
|
objectRelation.setUpdateApp(calculatingDTO.getAppId());
|
|
@@ -168,17 +177,7 @@ public class CoordinateCalculateServiceImpl implements CalculateService {
|
|
|
*/
|
|
|
private void deleteRelDataByCondition(CalculatingDTO calculatingDTO, Set<String> fromIds, Set<String> toIds) {
|
|
|
fromIds.addAll(toIds);
|
|
|
- QueryWrapper<ObjectRelation> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.eq(ObjectDigital.PROP_VALID,Boolean.TRUE);
|
|
|
- if (CollUtil.isNotEmpty(fromIds)){
|
|
|
- queryWrapper.in(ObjectDigital.PROP_ID,fromIds);
|
|
|
- }
|
|
|
- if (StrUtil.isNotBlank(calculatingDTO.getGroupCode())){
|
|
|
- queryWrapper.eq(StrUtil.toUnderlineCase(CommonConstant.QUERY_GROUPCODE),calculatingDTO.getGroupCode());
|
|
|
- }
|
|
|
- if (StrUtil.isNotBlank(calculatingDTO.getProjectId())){
|
|
|
- queryWrapper.eq(StrUtil.toUnderlineCase(CommonConstant.QUERY_PROJECTID),calculatingDTO.getProjectId());
|
|
|
- }
|
|
|
+ QueryWrapper<ObjectRelation> queryWrapper = createCommonQueryWrapper(fromIds,calculatingDTO);
|
|
|
queryWrapper.eq(StrUtil.toUnderlineCase(ObjectRelation.GRAPH_CODE_HUM),calculatingDTO.getGraphCode());
|
|
|
queryWrapper.eq(StrUtil.toUnderlineCase(ObjectRelation.REL_CODE_HUM),calculatingDTO.getRelCode());
|
|
|
if (StrUtil.isNotBlank(calculatingDTO.getRelValue())){
|
|
@@ -190,7 +189,7 @@ public class CoordinateCalculateServiceImpl implements CalculateService {
|
|
|
|
|
|
* Description: 查询去向数据
|
|
|
* @param toIds : 去向id集合
|
|
|
- * @param toObjType : 去向对象类型
|
|
|
+ * @param objType : 去向对象类型
|
|
|
* @param toInfoCode : 去向对象信息点
|
|
|
* @param calculatingDTO : 请求参数
|
|
|
* @return : java.util.List<com.persagy.dmp.digital.entity.ObjectDigital>
|
|
@@ -198,8 +197,11 @@ public class CoordinateCalculateServiceImpl implements CalculateService {
|
|
|
* @date :2021/9/11 15:36
|
|
|
* Update By lijie 2021/9/11 15:36
|
|
|
*/
|
|
|
- private List<ObjectDigital> queryToData(Set<String> toIds, String toObjType, String toInfoCode, CalculatingDTO calculatingDTO) {
|
|
|
- QueryWrapper<ObjectDigital> queryWrapper = createCommonQueryWrapper(toIds,toObjType,calculatingDTO);
|
|
|
+ private List<ObjectDigital> queryPlaneData(Set<String> toIds, String objType, String toInfoCode, CalculatingDTO calculatingDTO) {
|
|
|
+ QueryWrapper<ObjectDigital> queryWrapper = createCommonQueryWrapper(toIds,calculatingDTO);
|
|
|
+ if (StrUtil.isNotBlank(objType)){
|
|
|
+ queryWrapper.eq(ObjectDigital.OBJ_TYPE,objType);
|
|
|
+ }
|
|
|
queryWrapper.select(ObjectDigital.PROP_ID,
|
|
|
StrUtil.toUnderlineCase(CommonConstant.QUERY_GROUPCODE),
|
|
|
StrUtil.toUnderlineCase(CommonConstant.QUERY_PROJECTID),
|
|
@@ -208,20 +210,20 @@ public class CoordinateCalculateServiceImpl implements CalculateService {
|
|
|
"IF(JSON_DEPTH(JSON_UNQUOTE(JSON_EXTRACT(infos,'$.{}')))=4,'$[0][*]','$[0][0][*]')))) AS outLines",
|
|
|
toInfoCode,toInfoCode,toInfoCode),
|
|
|
ObjectDigital.CLASS_CODE,ObjectDigital.OBJ_TYPE);
|
|
|
- return objectDigitalMapper.queryToData(toIds,toObjType,toInfoCode,calculatingDTO);
|
|
|
+ return objectDigitalMapper.queryToData(toIds,objType,toInfoCode,calculatingDTO);
|
|
|
}
|
|
|
+
|
|
|
|
|
|
* Description: 创建通用查询条件对象
|
|
|
* @param ids : 对象id数组
|
|
|
- * @param objType : 对象分类
|
|
|
* @param calculatingDTO : 请求参数
|
|
|
* @return : com.baomidou.mybatisplus.core.conditions.query.QueryWrapper<com.persagy.dmp.digital.entity.ObjectDigital>
|
|
|
* @author : lijie
|
|
|
* @date :2021/9/11 15:41
|
|
|
* Update By lijie 2021/9/11 15:41
|
|
|
*/
|
|
|
- private QueryWrapper<ObjectDigital> createCommonQueryWrapper(Set<String> ids, String objType, CalculatingDTO calculatingDTO) {
|
|
|
- QueryWrapper<ObjectDigital> queryWrapper = new QueryWrapper<>();
|
|
|
+ private <T> QueryWrapper<T> createCommonQueryWrapper(Set<String> ids, CalculatingDTO calculatingDTO) {
|
|
|
+ QueryWrapper<T> queryWrapper = new QueryWrapper<>();
|
|
|
queryWrapper.eq(ObjectDigital.PROP_VALID,Boolean.TRUE);
|
|
|
if (CollUtil.isNotEmpty(ids)){
|
|
|
queryWrapper.in(ObjectDigital.PROP_ID,ids);
|
|
@@ -232,16 +234,13 @@ public class CoordinateCalculateServiceImpl implements CalculateService {
|
|
|
if (StrUtil.isNotBlank(calculatingDTO.getProjectId())){
|
|
|
queryWrapper.eq(StrUtil.toUnderlineCase(CommonConstant.QUERY_PROJECTID),calculatingDTO.getProjectId());
|
|
|
}
|
|
|
- if (StrUtil.isNotBlank(objType)){
|
|
|
- queryWrapper.eq(ObjectDigital.OBJ_TYPE,objType);
|
|
|
- }
|
|
|
return queryWrapper;
|
|
|
}
|
|
|
|
|
|
|
|
|
* Description: 查询来源数据
|
|
|
* @param fromIds : 来源id集合
|
|
|
- * @param fromObjType : 对象分类
|
|
|
+ * @param objType : 对象分类
|
|
|
* @param fromInfoCode : 来源信息点
|
|
|
* @param calculatingDTO : 请求参数
|
|
|
* @return : void
|
|
@@ -249,8 +248,11 @@ public class CoordinateCalculateServiceImpl implements CalculateService {
|
|
|
* @date :2021/9/11 15:32
|
|
|
* Update By lijie 2021/9/11 15:32
|
|
|
*/
|
|
|
- private List<ObjectDigital> queryFromData(Set<String> fromIds, String fromObjType, String fromInfoCode, CalculatingDTO calculatingDTO) {
|
|
|
- QueryWrapper<ObjectDigital> queryWrapper = createCommonQueryWrapper(fromIds, fromObjType, calculatingDTO);
|
|
|
+ private List<ObjectDigital> queryPointData(Set<String> fromIds, String objType, String fromInfoCode, CalculatingDTO calculatingDTO) {
|
|
|
+ QueryWrapper<ObjectDigital> queryWrapper = createCommonQueryWrapper(fromIds, calculatingDTO);
|
|
|
+ if (StrUtil.isNotBlank(objType)){
|
|
|
+ queryWrapper.eq(ObjectDigital.OBJ_TYPE,objType);
|
|
|
+ }
|
|
|
queryWrapper.select(ObjectDigital.PROP_ID,
|
|
|
StrUtil.toUnderlineCase(CommonConstant.QUERY_GROUPCODE),
|
|
|
StrUtil.toUnderlineCase(CommonConstant.QUERY_PROJECTID),
|
|
@@ -261,6 +263,6 @@ public class CoordinateCalculateServiceImpl implements CalculateService {
|
|
|
"FROM 2 FOR LENGTH(JSON_EXTRACT(infos, '$.{}'))-2),']')), '$[1]')) AS bimLocation",
|
|
|
fromInfoCode,fromInfoCode,fromInfoCode,fromInfoCode),
|
|
|
ObjectDigital.CLASS_CODE,ObjectDigital.OBJ_TYPE);
|
|
|
- return objectDigitalMapper.queryFromData(fromIds,fromObjType,fromInfoCode,calculatingDTO);
|
|
|
+ return objectDigitalMapper.queryFromData(fromIds,objType,fromInfoCode,calculatingDTO);
|
|
|
}
|
|
|
}
|