|
@@ -5,21 +5,22 @@ import com.persagy.proxy.adm.model.relation.ShInBdList;
|
|
|
import com.persagy.proxy.adm.request.AdmResponse;
|
|
|
import com.persagy.proxy.adm.service.IAdmRelationService;
|
|
|
import com.persagy.proxy.adm.utils.AdmContextUtil;
|
|
|
-import com.persagy.proxy.common.entity.InstanceUrlParam;
|
|
|
import com.persagy.proxy.common.entity.RelationDTO;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
-import org.springframework.web.bind.annotation.*;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
|
+ * 关系-竖井所在建筑
|
|
|
* @author zhangwencheng
|
|
|
- *关系-竖井所在建筑
|
|
|
*/
|
|
|
@Slf4j
|
|
|
@RestController
|
|
@@ -29,14 +30,11 @@ public class RelationShInBdController {
|
|
|
@Autowired
|
|
|
private IAdmRelationService service;
|
|
|
|
|
|
- @Value("${middleware.group.code}")
|
|
|
- private String groupCode;
|
|
|
/**
|
|
|
* 创建竖井所在建筑关系
|
|
|
* @param shInBdList
|
|
|
* @return
|
|
|
*/
|
|
|
-
|
|
|
@PostMapping("link-bd")
|
|
|
public AdmResponse createBd(@RequestBody ShInBdList shInBdList){
|
|
|
log.info("创建系统所在建筑关系link-bd");
|
|
@@ -47,16 +45,15 @@ public class RelationShInBdController {
|
|
|
return AdmResponse.failure("必填项:shaftId(竖井id)、BuildingIdList(建筑id列表)");
|
|
|
}
|
|
|
List<RelationDTO> voList = new ArrayList<>();
|
|
|
- AdmRelationTypeEnum typeEnum = AdmRelationTypeEnum.BD2SH_ARCHFORARCH;
|
|
|
- String graphCode = typeEnum.getGraphCode();
|
|
|
- String relCode = typeEnum.getRelCode();
|
|
|
+ String graphCode = AdmRelationTypeEnum.BD2SH_ARCHFORARCH.getGraphCode();
|
|
|
+ String relCode = AdmRelationTypeEnum.BD2SH_ARCHFORARCH.getRelCode();
|
|
|
+ // 组装关系
|
|
|
for (String buildingId : buildingIdList) {
|
|
|
- //ArchForArch
|
|
|
- RelationDTO relation = new RelationDTO(null, graphCode, relCode, "", shaftId,buildingId);
|
|
|
+ RelationDTO relation = RelationDTO.builder().graphCode(graphCode).relCode(relCode)
|
|
|
+ .objFrom(buildingId).objTo(shaftId).build();
|
|
|
voList.add(relation);
|
|
|
}
|
|
|
- InstanceUrlParam context = AdmContextUtil.toDmpContext();
|
|
|
- service.doSave(context, voList);
|
|
|
+ service.doSave(AdmContextUtil.toDmpContext(), voList);
|
|
|
return AdmResponse.success();
|
|
|
}
|
|
|
|