dcs 7 달 전
부모
커밋
b67f705f33

+ 90 - 0
virgo.bim/pom.xml

@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+
+	<groupId>com.bosshand.virgo</groupId>
+	<artifactId>bim</artifactId>
+	
+	<!-- Inherit defaults from Spring Boot -->
+	<parent>
+		<groupId>com.bosshand</groupId>
+		<artifactId>virgo</artifactId>
+		<version>0.0.1-SNAPSHOT</version>
+		<relativePath>../pom.xml</relativePath>
+	</parent>
+	<repositories>
+        <repository>
+            <id>com.e-iceblue</id>
+            <url>http://repo.e-iceblue.cn/repository/maven-public/</url>
+        </repository>
+    </repositories>
+	<!-- Add typical dependencies for a web application -->
+	<dependencies>
+        <dependency>
+		   <groupId>org.springframework.boot</groupId>
+		   <artifactId>spring-boot-devtools</artifactId>
+		   <scope>runtime</scope>
+		   <optional>true</optional>
+		</dependency>
+
+		<!--aliyunOSS-->
+		<dependency>
+			<groupId>com.aliyun.oss</groupId>
+			<artifactId>aliyun-sdk-oss</artifactId>
+			<version>2.4.0</version>
+		</dependency>
+		<dependency>
+			<groupId>commons-fileupload</groupId>
+			<artifactId>commons-fileupload</artifactId>
+			<version>1.3.1</version>
+		</dependency>		
+		
+		<dependency>
+		    <groupId>log4j</groupId>
+		    <artifactId>log4j</artifactId>
+		    <version>1.2.17</version>
+		</dependency>
+		
+		<dependency>
+			<groupId>com.bosshand.virgo</groupId>
+			<artifactId>core</artifactId>
+			<version>0.0.1-SNAPSHOT</version>
+		</dependency>
+		
+		<dependency>
+			<groupId>com.squareup.okhttp3</groupId>
+			<artifactId>okhttp</artifactId>
+			<version>3.6.0</version>
+		</dependency>
+		
+		<dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-data-mongodb</artifactId>
+        </dependency>
+        
+        <dependency>
+		    <groupId>org.springframework.cloud</groupId>
+		    <artifactId>spring-cloud-starter-openfeign</artifactId>
+		</dependency>
+        
+	</dependencies>
+	
+	<properties>
+   		<log4j2.version>2.15.0</log4j2.version>
+	</properties>
+
+	<!-- Package as an executable jar -->
+	<build>
+		<plugins>
+			<plugin>
+				<groupId>org.springframework.boot</groupId>
+				<artifactId>spring-boot-maven-plugin</artifactId>
+				<configuration>
+        			<includeSystemScope>true</includeSystemScope>
+      			</configuration>
+			</plugin>
+		</plugins>
+	</build>
+
+</project>

+ 25 - 0
virgo.bim/src/main/java/com/bosshand/virgo/bim/dao/ElementDao.java

@@ -0,0 +1,25 @@
+package com.bosshand.virgo.bim.dao;
+
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.mongodb.core.MongoTemplate;
+import org.springframework.stereotype.Component;
+
+import com.bosshand.virgo.bim.model.bimface.Element;
+
+@Component
+public class ElementDao {
+
+	@Autowired
+	MongoTemplate mongoTemplate;
+	
+	public void save(Element element) {
+        mongoTemplate.save(element);
+    }
+	
+	public void batchSave(List<Element> list) {
+		mongoTemplate.insert(list, Element.class);
+	}
+	
+}

+ 28 - 0
virgo.bim/src/main/java/com/bosshand/virgo/bim/dao/FloorDao.java

@@ -0,0 +1,28 @@
+package com.bosshand.virgo.bim.dao;
+
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.mongodb.core.MongoTemplate;
+import org.springframework.data.mongodb.core.query.Criteria;
+import org.springframework.data.mongodb.core.query.Query;
+import org.springframework.stereotype.Component;
+
+import com.bosshand.virgo.bim.model.bimface.Floor;
+
+@Component
+public class FloorDao {
+	
+	@Autowired
+	MongoTemplate mongoTemplate;
+	
+	public void batchSave(List<Floor> list) {
+		mongoTemplate.insert(list, Floor.class);
+	}
+
+	public List<Floor> getFileId(String fileId) {
+		Query query = new Query(Criteria.where("fileId").is(fileId));
+		return mongoTemplate.find(query, Floor.class);
+	}
+
+}

+ 26 - 0
virgo.bim/src/main/java/com/bosshand/virgo/bim/dao/ModelInfoDao.java

@@ -0,0 +1,26 @@
+package com.bosshand.virgo.bim.dao;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.mongodb.core.MongoTemplate;
+import org.springframework.data.mongodb.core.query.Criteria;
+import org.springframework.data.mongodb.core.query.Query;
+import org.springframework.stereotype.Component;
+
+import com.bosshand.virgo.bim.model.bimface.ModelInfo;
+
+@Component
+public class ModelInfoDao {
+	
+	@Autowired
+	MongoTemplate mongoTemplate;
+	
+	public void save(ModelInfo modelInfo) {
+        mongoTemplate.save(modelInfo);
+    }
+	
+	public ModelInfo get(String fileId) {
+		Query query = new Query(Criteria.where("fileId").is(fileId));
+		return mongoTemplate.findOne(query, ModelInfo.class);
+	}
+
+}

+ 33 - 0
virgo.bim/src/main/java/com/bosshand/virgo/bim/dao/RoomDao.java

@@ -0,0 +1,33 @@
+package com.bosshand.virgo.bim.dao;
+
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.mongodb.core.MongoTemplate;
+import org.springframework.data.mongodb.core.query.Criteria;
+import org.springframework.data.mongodb.core.query.Query;
+import org.springframework.stereotype.Component;
+
+import com.bosshand.virgo.bim.model.bimface.Room;
+
+@Component
+public class RoomDao {
+	
+	@Autowired
+	MongoTemplate mongoTemplate;
+	
+	public void batchSave(List<Room> list) {
+		mongoTemplate.insert(list, Room.class);
+	}
+	
+	public List<Room> getByFileId(String fileId) {
+		Query query = new Query(Criteria.where("fileId").is(fileId));
+		return mongoTemplate.find(query, Room.class);
+	}
+	
+	public List<Room> getByFloorId(String floorId) {
+		Query query = new Query(Criteria.where("floorId").is(floorId));
+		return mongoTemplate.find(query, Room.class);
+	}
+
+}

+ 14 - 0
virgo.bim/src/main/java/com/bosshand/virgo/bim/dao/TestDao.java

@@ -0,0 +1,14 @@
+package com.bosshand.virgo.bim.dao;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Mapper;
+
+import com.bosshand.virgo.bim.model.Test;
+
+@Mapper
+public interface TestDao {
+
+	List<Test> getArtifactsId(long artifactsId);
+
+}

+ 35 - 0
virgo.bim/src/main/java/com/bosshand/virgo/bim/model/Test.java

@@ -0,0 +1,35 @@
+package com.bosshand.virgo.bim.model;
+
+public class Test {
+
+	private long id;
+
+	private long artifactsId;
+
+	private String data;
+
+	public long getId() {
+		return id;
+	}
+
+	public void setId(long id) {
+		this.id = id;
+	}
+
+	public long getArtifactsId() {
+		return artifactsId;
+	}
+
+	public void setArtifactsId(long artifactsId) {
+		this.artifactsId = artifactsId;
+	}
+	
+	public String getData() {
+		return data;
+	}
+
+	public void setData(String data) {
+		this.data = data;
+	}
+
+}

+ 41 - 0
virgo.bim/src/main/java/com/bosshand/virgo/bim/model/bimface/Element.java

@@ -0,0 +1,41 @@
+package com.bosshand.virgo.bim.model.bimface;
+
+public class Element {
+	
+	private String id;
+	private String fileId;
+	private String elementId;
+	private String attributes;
+	public String getId() {
+		return id;
+	}
+	public void setId(String id) {
+		this.id = id;
+	}
+	public String getFileId() {
+		return fileId;
+	}
+	public void setFileId(String fileId) {
+		this.fileId = fileId;
+	}
+	public String getElementId() {
+		return elementId;
+	}
+	public void setElementId(String elementId) {
+		this.elementId = elementId;
+	}
+	public String getAttributes() {
+		return attributes;
+	}
+	public void setAttributes(String attributes) {
+		this.attributes = attributes;
+	}
+	@Override
+	public String toString() {
+		return "Element [id=" + id + ", fileId=" + fileId + ", elementId=" + elementId + ", attributes=" + attributes
+				+ "]";
+	}
+
+
+	
+}

+ 34 - 0
virgo.bim/src/main/java/com/bosshand/virgo/bim/model/bimface/Floor.java

@@ -0,0 +1,34 @@
+package com.bosshand.virgo.bim.model.bimface;
+
+public class Floor {
+	private String fileId;
+	private String floorId;
+	private String name;
+	private String attributes;
+	public String getFileId() {
+		return fileId;
+	}
+	public void setFileId(String fileId) {
+		this.fileId = fileId;
+	}
+	public String getName() {
+		return name;
+	}
+	public void setName(String name) {
+		this.name = name;
+	}
+	public String getFloorId() {
+		return floorId;
+	}
+	public void setFloorId(String floorId) {
+		this.floorId = floorId;
+	}
+	public String getAttributes() {
+		return attributes;
+	}
+	public void setAttributes(String attributes) {
+		this.attributes = attributes;
+	}
+	
+	
+}

+ 16 - 0
virgo.bim/src/main/java/com/bosshand/virgo/bim/model/bimface/ModelInfo.java

@@ -0,0 +1,16 @@
+package com.bosshand.virgo.bim.model.bimface;
+
+public class ModelInfo {
+	
+	private String fileId;
+
+	public String getFileId() {
+		return fileId;
+	}
+
+	public void setFileId(String fileId) {
+		this.fileId = fileId;
+	}
+	
+	
+}

+ 42 - 0
virgo.bim/src/main/java/com/bosshand/virgo/bim/model/bimface/Room.java

@@ -0,0 +1,42 @@
+package com.bosshand.virgo.bim.model.bimface;
+
+public class Room {
+	
+	private String fileId;
+	private String floorId;
+	private String roomId;
+	private String name;
+	private String attributes;
+	public String getFileId() {
+		return fileId;
+	}
+	public void setFileId(String fileId) {
+		this.fileId = fileId;
+	}
+	public String getFloorId() {
+		return floorId;
+	}
+	public void setFloorId(String floorId) {
+		this.floorId = floorId;
+	}
+	public String getRoomId() {
+		return roomId;
+	}
+	public void setRoomId(String roomId) {
+		this.roomId = roomId;
+	}
+	public String getName() {
+		return name;
+	}
+	public void setName(String name) {
+		this.name = name;
+	}
+	public String getAttributes() {
+		return attributes;
+	}
+	public void setAttributes(String attributes) {
+		this.attributes = attributes;
+	}
+	
+
+}

+ 18 - 0
virgo.bim/src/main/java/com/bosshand/virgo/bim/service/FileClient.java

@@ -0,0 +1,18 @@
+package com.bosshand.virgo.bim.service;
+
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.multipart.MultipartFile;
+
+import com.bosshand.virgo.core.response.Response;
+
+import io.swagger.annotations.ApiParam;
+
+@FeignClient("virgo-file")
+public interface FileClient {
+	
+	@PostMapping(value = "/filenode/{parentId}", consumes = "multipart/form-data")
+    public Response uploadFile(@ApiParam(name = "uploadFile", required = true)  MultipartFile uploadFile, @PathVariable  int parentId);
+
+}

+ 17 - 0
virgo.bim/src/main/resources/mapper/TestMapper.xml

@@ -0,0 +1,17 @@
+<!DOCTYPE mapper
+    PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+    "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+ 
+<mapper namespace="com.bosshand.virgo.bim.dao.TestDao">
+
+	<resultMap type="com.bosshand.virgo.bim.model.Test" id="testResult">
+			<id column="id" property="id"/>
+			<result column="artifactsId" property="artifactsId"/>
+			<result column="data" property="data"/>
+	</resultMap>
+
+	<select id="getArtifactsId" resultMap="testResult">
+		SELECT * FROM test where artifactsId = #{artifactsId}
+	</select>
+	
+</mapper>

+ 12 - 0
virgo.bim/src/main/resources/mybatis-config.xml

@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE configuration
+  PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
+  "http://mybatis.org/dtd/mybatis-3-config.dtd">
+<configuration>
+	<settings>
+        <setting name="logImpl" value="SLF4J"/>
+        <!-- 开启驼峰命名转换 Table(create_time) -> Entity(createTime) -->
+        <setting name="mapUnderscoreToCamelCase" value="true" />
+    </settings>
+  	<mappers></mappers>
+</configuration>