Selaa lähdekoodia

开发定制家具模块-组件模块

xiewenjie 3 vuotta sitten
vanhempi
commit
646ce69d97
56 muutettua tiedostoa jossa 2518 lisäystä ja 422 poistoa
  1. 2 2
      docker-compose.yml
  2. 31 1
      pom.xml
  3. 1 0
      sxz-application/src/main/java/com.fdkk.sxz/ChangeingApplication.java
  4. 13 0
      sxz-application/src/main/java/com.fdkk.sxz/main.java
  5. 12 15
      sxz-application/src/main/resources/application-dev.properties
  6. 9 15
      sxz-application/src/main/resources/application-prod.properties
  7. 13 17
      sxz-application/src/main/resources/application-uat.properties
  8. 3 3
      sxz-application/src/main/resources/application.properties
  9. 6 0
      sxz-application/src/main/resources/config/caffeine.properties
  10. 132 0
      sxz-application/src/main/resources/config/j2cache.properties
  11. 10 0
      sxz-base/pom.xml
  12. 1 1
      sxz-base/src/main/java/com/fdkk/sxz/base/IBaseService.java
  13. 9 2
      sxz-base/src/main/java/com/fdkk/sxz/base/Result.java
  14. 3 0
      sxz-base/src/main/java/com/fdkk/sxz/base/impl/BaseServiceImpl.java
  15. 1 1
      sxz-base/src/main/java/com/fdkk/sxz/util/OkHttpUtils.java
  16. 46 7
      sxz-base/src/main/java/com/fdkk/sxz/util/UploadToOssUtil.java
  17. 0 26
      sxz-core/src/main/java/com/fdkk/sxz/ChangeingApplication.java
  18. 485 226
      sxz-core/src/main/java/com/fdkk/sxz/other/listener/RunBuild.java
  19. 1 1
      sxz-core/src/main/java/com/fdkk/sxz/system/controller/SysUserController.java
  20. 1 1
      sxz-core/src/main/java/com/fdkk/sxz/webApi/controller/ImportDataController.java
  21. 20 15
      sxz-core/src/main/java/com/fdkk/sxz/webApi/controller/ManagerController.java
  22. 1 1
      sxz-core/src/main/java/com/fdkk/sxz/webApi/controller/SceneLightStyleController.java
  23. 2 2
      sxz-core/src/main/java/com/fdkk/sxz/webApi/controller/SceneStyleController.java
  24. 1 1
      sxz-core/src/main/java/com/fdkk/sxz/webApi/controller/VisualAngleController.java
  25. 380 0
      sxz-core/src/main/java/com/fdkk/sxz/webApi/controller/custom/ComponetManagerController.java
  26. 217 29
      sxz-core/src/main/java/com/fdkk/sxz/webApi/controller/custom/CustomManagerController.java
  27. 38 0
      sxz-core/src/main/java/com/fdkk/sxz/webApi/controller/testController.java
  28. 3 0
      sxz-core/src/main/java/com/fdkk/sxz/webApi/mapper/IComponentModelUploadMapper.java
  29. 1 1
      sxz-core/src/main/java/com/fdkk/sxz/webApi/mapper/IModelUploadMapper.java
  30. 15 0
      sxz-core/src/main/java/com/fdkk/sxz/webApi/service/IComponentModelUploadService.java
  31. 18 1
      sxz-core/src/main/java/com/fdkk/sxz/webApi/service/IModelUploadService.java
  32. 10 1
      sxz-core/src/main/java/com/fdkk/sxz/webApi/service/custom/ICustomComponentService.java
  33. 8 0
      sxz-core/src/main/java/com/fdkk/sxz/webApi/service/custom/ICustomProductFirstclassifyService.java
  34. 35 7
      sxz-core/src/main/java/com/fdkk/sxz/webApi/service/custom/impl/CustomComponentServiceImpl.java
  35. 30 5
      sxz-core/src/main/java/com/fdkk/sxz/webApi/service/custom/impl/CustomProductFirstclassifyServiceImpl.java
  36. 13 7
      sxz-core/src/main/java/com/fdkk/sxz/webApi/service/custom/impl/CustomProductServiceImpl.java
  37. 210 0
      sxz-core/src/main/java/com/fdkk/sxz/webApi/service/impl/ComponentModelUploadServiceImpl.java
  38. 307 4
      sxz-core/src/main/java/com/fdkk/sxz/webApi/service/impl/ModelUploadServiceImpl.java
  39. 31 0
      sxz-core/src/main/resources/mapper/ComponentModelUploadMapper.xml
  40. 6 11
      sxz-generator/src/main/java/com/fdkk/sxz/generator/Main.java
  41. 1 1
      sxz-modules/src/main/java/com/fdkk/sxz/entity/BaseEntity.java
  42. 10 10
      sxz-modules/src/main/java/com/fdkk/sxz/entity/ComponentModelUploadEntity.java
  43. 44 4
      sxz-modules/src/main/java/com/fdkk/sxz/entity/custuom/CustomComponentEntity.java
  44. 4 3
      sxz-modules/src/main/java/com/fdkk/sxz/entity/custuom/CustomProductEntity.java
  45. 33 0
      sxz-modules/src/main/java/com/fdkk/sxz/vo/request/RequestComponet.java
  46. 1 1
      sxz-modules/src/main/java/com/fdkk/sxz/vo/request/RequestCustom.java
  47. 15 0
      sxz-modules/src/main/java/com/fdkk/sxz/vo/request/RequestCustomComponent.java
  48. 8 0
      sxz-modules/src/main/java/com/fdkk/sxz/vo/request/RequestCustomProduct.java
  49. 21 0
      sxz-modules/src/main/java/com/fdkk/sxz/vo/request/RequestModelComponentSaveModel.java
  50. 99 0
      sxz-modules/src/main/java/com/fdkk/sxz/vo/request/RequestModelCustomUpload.java
  51. 44 0
      sxz-modules/src/main/java/com/fdkk/sxz/vo/response/ResponseComponentManager.java
  52. 1 0
      sxz-modules/src/main/java/com/fdkk/sxz/vo/response/ResponseCustomComponent.java
  53. 3 0
      sxz-modules/src/main/java/com/fdkk/sxz/vo/response/ResponseCustomProduct.java
  54. 8 0
      sxz-modules/src/main/java/com/fdkk/sxz/vo/response/ResponseCustomProductManager.java
  55. 52 0
      sxz-modules/src/main/java/com/fdkk/sxz/vo/response/ResponseModelComponent.java
  56. 49 0
      sxz-modules/src/main/java/com/fdkk/sxz/vo/response/ResponseModelCustom.java

+ 2 - 2
docker-compose.yml

@@ -2,7 +2,7 @@ version: "3"
 services:
   changeing-service:
     # 指定容器名称
-    container_name: sxz_web_java
+    container_name: sxz_web_java_jar
     # 重启机制
     restart: always
     image: java:8
@@ -15,7 +15,7 @@ services:
       - /etc/localtime:/etc/localtime
     # 访问端口
     ports:
-      - "8020:8082"
+      - "8080:8082"
       - "5525:5525"
     environment:
       - TZ="Asia/Shanghai"

+ 31 - 1
pom.xml

@@ -319,7 +319,37 @@
             <artifactId>java-jwt</artifactId>
             <version>3.7.0</version>
         </dependency>
-        <!-- j2cache -->
+
+        <!-- 缓存 -->
+        <dependency>
+            <groupId>net.oschina.j2cache</groupId>
+            <artifactId>j2cache-spring-boot2-starter</artifactId>
+            <version>2.8.0-release</version>
+            <!--排除这个slf4j-log4j12-->
+            <exclusions>
+                <exclusion>
+                    <groupId>org.slf4j</groupId>
+                    <artifactId>slf4j-simple</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>net.oschina.j2cache</groupId>
+            <artifactId>j2cache-core</artifactId>
+            <version>2.8.2-release</version>
+            <!--排除这个slf4j-log4j12-->
+            <exclusions>
+                <exclusion>
+                    <groupId>org.slf4j</groupId>
+                    <artifactId>slf4j-simple</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency><!-- Ehcache 3.x //-->
+            <groupId>org.ehcache</groupId>
+            <artifactId>ehcache</artifactId>
+            <version>3.4.0</version>
+        </dependency>
         <!-- 钉钉告警 -->
         <!--		<dependency>-->
         <!--			<groupId>com.aliyun</groupId>-->

+ 1 - 0
sxz-application/src/main/java/com.fdkk.sxz/ChangeingApplication.java

@@ -5,6 +5,7 @@ import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.builder.SpringApplicationBuilder;
 import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
+import org.springframework.cache.annotation.EnableCaching;
 import org.springframework.scheduling.annotation.EnableScheduling;
 
 @EnableScheduling

+ 13 - 0
sxz-application/src/main/java/com.fdkk.sxz/main.java

@@ -0,0 +1,13 @@
+package com.fdkk.sxz;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonToken;
+
+import java.io.*;
+import java.nio.charset.Charset;
+import java.util.LinkedList;
+import java.util.List;
+
+public class main {
+
+}

+ 12 - 15
sxz-application/src/main/resources/application-dev.properties

@@ -57,21 +57,18 @@ pagehelper.supportMethodsArguments=true
 #如果 pageSize=0 就会查询出全部的结果(相当于没有执行分页查询)
 pagehelper.page-size-zero=true
 #redis
-spring.redis.timeout=600000
-spring.redis.port=6379
-spring.redis.host=127.0.0.1
-spring.redis.password=1234
-spring.redis.database=0
-spring.redis.lettuce.pool.max-idle=8
-spring.redis.lettuce.pool.min-idle=0
-spring.redis.lettuce.pool.max-active=8
-spring.redis.lettuce.pool.max-wait=-1ms
-#Cluster集群
-#spring.redis.cluster.nodes=1
-#哨兵模式配置-开始
-#spring.redis.sentinel.master=mymaster
-#spring.redis.sentinel.nodes=192.168.0.108:26370,192.168.0.108:26371,192.168.0.108:26372
-#spring.redis.sentinel.password=
+j2cache.config-location=classpath:/config/j2cache.properties
+j2cache.open-spring-cache=true
+j2cache.j2CacheConfig.serialization=fastjson
+j2cache.cache-clean-mode=active
+j2cache.redis-client=lettuce
+j2cache.j2CacheConfig.hosts = 127.0.0.1:6379
+j2cache.j2CacheConfig.password = 1234
+j2cache.j2CacheConfig.database =4
+
+
+
+
 oss.point=http://oss-cn-shenzhen.aliyuncs.com
 oss.key=LTAIUrvuHqj8pvry
 oss.secrey=JLOVl0k8Ke0aaM8nLMMiUAZ3EiiqI4

+ 9 - 15
sxz-application/src/main/resources/application-prod.properties

@@ -57,21 +57,15 @@ pagehelper.supportMethodsArguments=true
 #如果 pageSize=0 就会查询出全部的结果(相当于没有执行分页查询)
 pagehelper.page-size-zero=true
 #redis
-spring.redis.timeout=600000
-spring.redis.lettuce.pool.max-active=100
-spring.redis.lettuce.pool.max-wait=-1
-spring.redis.lettuce.pool.max-idle=8
-spring.redis.lettuce.pool.min-idle=-1
-spring.redis.port=6379
-spring.redis.host=127.0.0.1
-spring.redis.password=1234
-spring.redis.database=1
-#Cluster集群
-#spring.redis.cluster.nodes=1
-#哨兵模式配置-开始
-#spring.redis.sentinel.master=mymaster
-#spring.redis.sentinel.nodes=192.168.0.108:26370,192.168.0.108:26371,192.168.0.108:26372
-#spring.redis.sentinel.password=
+j2cache.config-location=classpath:/config/j2cache.properties
+j2cache.open-spring-cache=true
+j2cache.j2CacheConfig.serialization=fastjson
+j2cache.cache-clean-mode=active
+j2cache.redis-client=lettuce
+j2cache.j2CacheConfig.hosts = 127.0.0.1:6379
+j2cache.j2CacheConfig.password = 1234
+j2cache.j2CacheConfig.database =15
+
 oss.point=http://oss-cn-shenzhen.aliyuncs.com
 oss.key=LTAIUrvuHqj8pvry
 oss.secrey=JLOVl0k8Ke0aaM8nLMMiUAZ3EiiqI4

+ 13 - 17
sxz-application/src/main/resources/application-uat.properties

@@ -32,14 +32,15 @@ spring.datasource.hikari.connection-timeout=30000
 #rabbitmq
 spring.rabbitmq.host=192.168.0.26
 spring.rabbitmq.port=5672
-spring.rabbitmq.username=guest
-spring.rabbitmq.password=guest
+spring.rabbitmq.username=uat
+spring.rabbitmq.password=uat
 ##mybatis-plus配置 ##
 mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.slf4j.Slf4jImpl
 mybatis-plus.configuration.map-underscore-to-camel-case=true
 mybatis-plus.global-config.db-config.db-type=mysql
 mybatis-plus.global-config.db-config.field-strategy=not_null
 mybatis-plus.global-config.db-config.id-type=auto
+mybatis-plus.global-config.db-config.logic-delete-field=rec_status
 mybatis-plus.global-config.db-config.logic-delete-value=A
 mybatis-plus.global-config.db-config.logic-not-delete-value=I
 mybatis-plus.global-config.db-config.table-prefix=t_
@@ -57,21 +58,16 @@ pagehelper.supportMethodsArguments=true
 #如果 pageSize=0 就会查询出全部的结果(相当于没有执行分页查询)
 pagehelper.page-size-zero=true
 #redis
-spring.redis.timeout=600000
-spring.redis.lettuce.pool.max-active=100
-spring.redis.lettuce.pool.max-wait=-1
-spring.redis.lettuce.pool.max-idle=8
-spring.redis.lettuce.pool.min-idle=-1
-spring.redis.port=6379
-spring.redis.host=127.0.0.1
-spring.redis.password=
-spring.redis.database=15
-#Cluster集群
-#spring.redis.cluster.nodes=1
-#哨兵模式配置-开始
-#spring.redis.sentinel.master=mymaster
-#spring.redis.sentinel.nodes=192.168.0.108:26370,192.168.0.108:26371,192.168.0.108:26372
-#spring.redis.sentinel.password=
+j2cache.config-location=classpath:/config/j2cache.properties
+j2cache.open-spring-cache=true
+j2cache.j2CacheConfig.serialization=fastjson
+j2cache.cache-clean-mode=active
+j2cache.redis-client=lettuce
+j2cache.j2CacheConfig.hosts = 127.0.0.1:6379
+j2cache.j2CacheConfig.password = 1234
+j2cache.j2CacheConfig.database =15
+
+
 oss.point=http://oss-cn-shenzhen.aliyuncs.com
 oss.key=LTAIUrvuHqj8pvry
 oss.secrey=JLOVl0k8Ke0aaM8nLMMiUAZ3EiiqI4

+ 3 - 3
sxz-application/src/main/resources/application.properties

@@ -1,7 +1,7 @@
 server.port=8082
 
-#开发 dev ,测试 uat ,生产 prod
-spring.profiles.active=uat
+#?? dev ,?? uat ,?? prod
+spring.profiles.active=@package.environment@
 
 
 system.defaultPwd=123456
@@ -11,7 +11,7 @@ system.noDataFilterRole=DATA_NO_FILTER
 system.smsTimes=25
 system.expireTime={web: 10800000l, app: 15768000000l}
 
-#扫描controller中不需要鉴权的method
+#??controller???????method
 
 controller.scanPackage= classpath*:com/fdkk/sxz/*/controller/*.class,classpath*:com/fdkk/sxz/*/controller/*.class
 

+ 6 - 0
sxz-application/src/main/resources/config/caffeine.properties

@@ -0,0 +1,6 @@
+#########################################
+# Caffeine configuration
+# [name] = size, xxxx[s|m|h|d]
+#########################################
+
+default = 1000, 30m

+ 132 - 0
sxz-application/src/main/resources/config/j2cache.properties

@@ -0,0 +1,132 @@
+#J2Cache configuration
+
+
+#########################################
+# Cache Broadcast Method
+# values:
+# jgroups -> use jgroups's multicast
+# redis -> use redis publish/subscribe mechanism (using jedis)
+# lettuce -> use redis publish/subscribe mechanism (using lettuce, Recommend)
+# rabbitmq -> use RabbitMQ publisher/consumer mechanism
+# rocketmq -> use RocketMQ publisher/consumer mechanism
+# none -> don't notify the other nodes in cluster
+# xx.xxxx.xxxx.Xxxxx your own cache broadcast policy classname that implement net.oschina.j2cache.cluster.ClusterPolicy
+#########################################
+
+j2cache.broadcast = lettuce
+
+# jgroups properties
+jgroups.channel.name = j2cache
+jgroups.configXml = /network.xml
+
+# RabbitMQ properties
+rabbitmq.exchange = j2cache
+rabbitmq.host = localhost
+rabbitmq.port = 5672
+rabbitmq.username = guest
+rabbitmq.password = guest
+
+
+#########################################
+# Level 1&2 provider
+# values:
+# none -> disable this level cache
+# ehcache -> use ehcache2 as level 1 cache
+# ehcache3 -> use ehcache3 as level 1 cache
+# caffeine -> use caffeine as level 1 cache(only in memory)
+# redis -> use redis as level 2 cache (using jedis)
+# lettuce -> use redis as level 2 cache (using lettuce)
+# readonly-redis -> use redis as level 2 cache ,but never write data to it. if use this provider, you must uncomment `j2cache.L2.config_section` to make the redis configurations available.
+# memcached -> use memcached as level 2 cache (xmemcached),
+# [classname] -> use custom provider
+#########################################
+
+j2cache.L1.provider_class = caffeine
+j2cache.L2.provider_class = lettuce
+
+# When L2 provider isn't `redis`, using `L2.config_section = redis` to read redis configurations
+# j2cache.L2.config_section = redis
+
+# Enable/Disable ttl in redis cache data (if disabled, the object in redis will never expire, default:true)
+# NOTICE: redis hash mode (redis.storage = hash) do not support this feature)
+j2cache.sync_ttl_to_redis = true
+
+# Whether to cache null objects by default (default false)
+j2cache.default_cache_null_object = true
+
+#########################################
+# Cache Serialization Provider
+# values:
+# fst -> using fast-serialization (recommend)
+# kryo -> using kryo serialization
+# json -> using fst's json serialization (testing)
+# fastjson -> using fastjson serialization (embed non-static class not support)
+# java -> java standard
+# fse -> using fse serialization
+# [classname implements Serializer]
+#########################################
+
+j2cache.serialization = ${j2cache.j2CacheConfig.serialization}
+#json.map.person = net.oschina.j2cache.demo.Person
+
+#########################################
+# Ehcache configuration
+#########################################
+
+# ehcache.configXml = /ehcache.xml
+
+# ehcache3.configXml = /ehcache3.xml
+# ehcache3.defaultHeapSize = 1000
+
+#########################################
+# Caffeine configuration
+# caffeine.region.[name] = size, xxxx[s|m|h|d]
+#
+#########################################
+caffeine.properties = /config/caffeine.properties
+
+#########################################
+# Redis connection configuration
+#########################################
+
+
+
+#########################################
+# Lettuce scheme
+#
+# redis -> single redis server
+# rediss -> single redis server with ssl
+# redis-sentinel -> redis sentinel
+# redis-cluster -> cluster servers
+#
+#########################################
+
+#########################################
+# Lettuce Mode
+#
+# single -> single redis server
+# sentinel -> master-slaves servers
+# cluster -> cluster servers (\u6570\u636e\u5e93\u914d\u7f6e\u65e0\u6548\uff0c\u4f7f\u7528 database = 0\uff09
+# sharded -> sharded servers  (\u5bc6\u7801\u3001\u6570\u636e\u5e93\u5fc5\u987b\u5728 hosts \u4e2d\u6307\u5b9a\uff0c\u4e14\u8fde\u63a5\u6c60\u914d\u7f6e\u65e0\u6548 ; redis://user:password@127.0.0.1:6379/0\uff09
+#
+#########################################
+
+## redis command scan parameter count, default[1000]
+#lettuce.scanCount = 1000
+lettuce.mode = single
+lettuce.namespace =
+lettuce.storage = hash
+lettuce.channel = j2cache
+lettuce.scheme = redis
+lettuce.hosts =  ${j2cache.j2CacheConfig.hosts}
+lettuce.password = ${j2cache.j2CacheConfig.password}
+lettuce.database = ${j2cache.j2CacheConfig.database}
+lettuce.sentinelMasterId =
+lettuce.maxTotal = 100
+lettuce.maxIdle = 10
+lettuce.minIdle = 10
+# timeout in milliseconds
+lettuce.timeout = 10000
+# redis cluster topology refresh interval in milliseconds
+lettuce.clusterTopologyRefresh = 3000
+

+ 10 - 0
sxz-base/pom.xml

@@ -240,6 +240,16 @@
             <artifactId>junit</artifactId>
             <scope>test</scope>
         </dependency>
+
+        <!-- 缓存 -->
+        <dependency>
+            <groupId>net.oschina.j2cache</groupId>
+            <artifactId>j2cache-spring-boot2-starter</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>net.oschina.j2cache</groupId>
+            <artifactId>j2cache-core</artifactId>
+        </dependency>
     </dependencies>
     <properties>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

+ 1 - 1
sxz-base/src/main/java/com/fdkk/sxz/base/IBaseService.java

@@ -12,7 +12,6 @@ public interface IBaseService<T> extends IService<T> {
 
 
 
-
     /**
      * 根据实体参数返回一行记录
      * @param condition
@@ -20,6 +19,7 @@ public interface IBaseService<T> extends IService<T> {
      */
     T getOne(T condition);
 
+
     /**
      * 根据实体参数返回列表数据
      * @param condition

+ 9 - 2
sxz-base/src/main/java/com/fdkk/sxz/base/Result.java

@@ -19,7 +19,7 @@ import java.io.Serializable;
 public class Result<T> implements Serializable {
     private static final long serialVersionUID = -1491499610244557029L;
     public static final String SUCCESS_MSG = "操作成功";
-    public static final String ERROR_MSG = "操作成功";
+    public static final String ERROR_MSG = "操作失败";
 
     public static int CODE_SUCCESS = 0;
     public static int CODE_FAILURE = -1;
@@ -97,7 +97,14 @@ public class Result<T> implements Serializable {
         return failure(CODE_FAILURE, msg);
     }
 
-
+    /**
+     * 处理失败
+     *
+     * @return data
+     */
+    public static Result failure() {
+        return failure(CODE_FAILURE, ERROR_MSG);
+    }
 
     /**
      * 放入object

+ 3 - 0
sxz-base/src/main/java/com/fdkk/sxz/base/impl/BaseServiceImpl.java

@@ -20,6 +20,9 @@ import java.util.List;
 @Slf4j
 public abstract class BaseServiceImpl<M extends IBaseMapper<T>, T> extends ServiceImpl<M, T> implements IBaseService<T> {
 
+
+
+
     @Override
     public boolean save(T entity) {
         return super.save(entity);

+ 1 - 1
sxz-base/src/main/java/com/fdkk/sxz/util/OkHttpUtils.java

@@ -1,6 +1,7 @@
 package com.fdkk.sxz.util;
 
 import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.http.HttpRequest;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.fdkk.sxz.Interceptor.OkHttpLogInterceptor;
@@ -174,7 +175,6 @@ public class OkHttpUtils {
             log.error("url为null!");
             return "";
         }
-
         MediaType JSON = MediaType.parse(HTTP_JSON);
         RequestBody body = RequestBody.create(JSON, json);
         Request.Builder requestBuilder = new Request.Builder().url(url);

+ 46 - 7
sxz-base/src/main/java/com/fdkk/sxz/util/UploadToOssUtil.java

@@ -177,7 +177,8 @@ public class UploadToOssUtil {
 			if(filePath.contains(".jpg")){
 				metadata.setContentType("image/jpeg");
 			}
-			ossClient.putObject("4d-tjw", key1, new File(filePath), metadata);
+			PutObjectResult res=ossClient.putObject("4d-tjw", key1, new File(filePath), metadata);
+			log.info("上传Etag:" + res.getETag());
 
 		} catch (Exception e) {
 			log.error(e.toString() + filePath);
@@ -193,7 +194,8 @@ public class UploadToOssUtil {
 			//Response res = uploadManager.put(data, key, getUpToken(key));
 
 			// 2019-2-28 启动aliyun oss 空间
-			ossClient.putObject("4d-tjw", key1, new ByteArrayInputStream(data));
+			PutObjectResult res=	ossClient.putObject("4d-tjw", key1, new ByteArrayInputStream(data));
+			log.info("上传Etag:" + res.getETag());
 			//log.info(res.bodyString());
 		} catch (Exception e) {
 			log.error(e.toString()+key1);
@@ -204,9 +206,12 @@ public class UploadToOssUtil {
 //		if("oss".equals(type)){
 		OSSClient ossClient = new OSSClient(point, key, secrey);
 		try {
-
-			ossClient.copyObject("4d-tjw", oldPath, "4d-tjw", newPath);
-
+			if (!existFileToOSS(oldPath,"4d-tjw")){
+				log.info("文件不存在不予以拷贝:" );
+				return;
+			}
+			CopyObjectResult res=	ossClient.copyObject("4d-tjw", oldPath, "4d-tjw", newPath);
+			log.info("拷贝Etag:" + res.getResponse().getStatusCode());
 		} catch (Exception e) {
 			log.error(e.toString() + newPath);
 		}
@@ -219,6 +224,7 @@ public class UploadToOssUtil {
 
 			// 2019-2-28 启动aliyun oss 空间
 			ossClient.deleteObject("4d-tjw", key1);
+
 		} catch (Exception e) {
 			e.printStackTrace();
 		}
@@ -263,12 +269,29 @@ public class UploadToOssUtil {
 
 		// 创建OSSClient实例。
 		OSSClient ossClient = new OSSClient(point, key, secrey);
+		if (!existFileToOSS(objectName,"4d-tjw")){
+			return;
+		}
 		// 下载OSS文件到本地文件。如果指定的本地文件存在会覆盖,不存在则新建。
 		ossClient.getObject(new GetObjectRequest("4d-tjw", objectName),
 				new File(localFileName));
 		// 关闭OSSClient。
 		ossClient.shutdown();
 	}
+	/**
+	 * 通过文件名下载文件
+	 *
+	 * @param remoteFileName    文件名
+	 */
+	public Boolean existFileToOSS (String remoteFileName,String bucketStr) {
+
+		OSSClient ossClient = new OSSClient(point, key, secrey);
+		Boolean result=ossClient.doesObjectExist( bucketStr,remoteFileName);
+
+		// 关闭OSSClient。
+		ossClient.shutdown();
+		return result;
+	}
 
 
 	public void upload2(String filePath, String key1) {
@@ -411,8 +434,24 @@ public class UploadToOssUtil {
 //		OSSClient ossClient = new OSSClient(point, key, secrey);
 		try {
 
-			ossClient.copyObject("4d-tjw", "domain/eHome/furniture/models/YK2ZhwzL.glb", "4d-tjw", "domain/eHome/furniture/temp/YK2ZhwzL.glb");
-
+			// 构造ListObjectsRequest请求。
+			ListObjectsRequest listObjectsRequest = new ListObjectsRequest("4d-tjw");
+			// 设置正斜线(/)为文件夹的分隔符。
+			listObjectsRequest.setDelimiter("/");
+			// 设置prefix参数来获取fun目录下的所有文件。
+			if (!StringUtils.isEmpty("domain/eHome/furniture/ue4data/e202cfd0713749888c72c0b5c6c29276/e202cfd0713749888c72c0b5c6c29276Sub0/")) {
+				listObjectsRequest.setPrefix("domain/eHome/furniture/ue4data/e202cfd0713749888c72c0b5c6c29276/e202cfd0713749888c72c0b5c6c29276Sub0/");
+			}
+			// 列出文件
+			ObjectListing listing = ossClient.listObjects(listObjectsRequest);
+			// 遍历所有commonPrefix
+			List<String> list = new ArrayList<>();
+			for (OSSObjectSummary objectSummary : listing.getObjectSummaries()) {
+				list.add(objectSummary.getKey());
+			}
+			// 关闭OSSClient
+			ossClient.shutdown();
+			System.out.println(list);
 		} catch (Exception e) {
 			log.error(e.toString() + "domain/eHome/furniture/models/YK2ZhwzL_preview.jpg");
 		}

+ 0 - 26
sxz-core/src/main/java/com/fdkk/sxz/ChangeingApplication.java

@@ -1,26 +0,0 @@
-package com.fdkk.sxz;
-
-import com.github.pagehelper.autoconfigure.PageHelperAutoConfiguration;
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
-import org.springframework.boot.builder.SpringApplicationBuilder;
-import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
-import org.springframework.context.ConfigurableApplicationContext;
-import org.springframework.scheduling.annotation.EnableScheduling;
-
-@EnableScheduling
-@SpringBootApplication(exclude= {DataSourceAutoConfiguration.class,PageHelperAutoConfiguration.class})
-public class ChangeingApplication extends SpringBootServletInitializer {
-
-	@Override
-	protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
-		return application.sources(ChangeingApplication.class);
-	}
-
-	public static void main(String[] args) {
-		ConfigurableApplicationContext configurableBootstrapContext=		SpringApplication.run(ChangeingApplication.class, args);
-
-	}
-
-}

+ 485 - 226
sxz-core/src/main/java/com/fdkk/sxz/other/listener/RunBuild.java

@@ -5,6 +5,7 @@ import cn.hutool.core.io.FileUtil;
 import cn.hutool.core.io.file.FileReader;
 import cn.hutool.core.io.file.FileWriter;
 import cn.hutool.core.util.IdUtil;
+import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.StrUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
@@ -14,9 +15,11 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.fdkk.sxz.constant.ConstantFileName;
 import com.fdkk.sxz.constant.ConstantFilePath;
 import com.fdkk.sxz.entity.*;
+import com.fdkk.sxz.entity.custuom.CustomComponentEntity;
 import com.fdkk.sxz.other.mq.TopicRabbitConfig;
 import com.fdkk.sxz.webApi.service.*;
 import com.fdkk.sxz.util.*;
+import com.fdkk.sxz.webApi.service.custom.ICustomComponentService;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.amqp.rabbit.annotation.RabbitHandler;
 import org.springframework.amqp.rabbit.annotation.RabbitListener;
@@ -56,6 +59,9 @@ public class RunBuild {
     @Autowired
     private IComponentModelUploadService componentModelUploadService;
 
+    @Autowired
+    private ICustomComponentService customComponentService;
+
     @Value("${server.file.location}")
     private String buildPath;
 
@@ -78,16 +84,16 @@ public class RunBuild {
     private RedisUtil redisUtil;
 
     @RabbitHandler
-    @RabbitListener(queues = "topic.change")
+    @RabbitListener(queues = TopicRabbitConfig.CHANGE)
     public void change(String str) {
         log.info("场景:" + str + ",开始计算");
         buildCopy(str);
     }
 
     @RabbitHandler
-    @RabbitListener(queues = "topic.light")
+    @RabbitListener(queues = TopicRabbitConfig.LIGHT)
     public void light(String str) {
-        if (str.contains("modelPreview")) {
+        if (str.contains("modelPreview")||str.contains("customFurniturePreview")) {
             log.info("模型:" + str + ",开始生成封面图");
             modelCreatThum(str);
         } else {
@@ -97,7 +103,6 @@ public class RunBuild {
     }
 
     @RabbitHandler
-//    @RabbitListener(queues = "topic.model.copy")
     @RabbitListener(queues = TopicRabbitConfig.MODEL)
     public void model(String str) {
         log.info("模型转换:" + str);
@@ -684,291 +689,417 @@ public class RunBuild {
         String modelType = datas[3];
         //true表示定制,FALSE表示成品
         String flag = datas[4];
+        //1 成品  2 定制  3 组件
+        String UploadType = datas[5];
 
+        ModelUploadEntity modelUploadEntity =null;
 
-        ModelUploadEntity modelUploadEntity = modelUploadService.findById(Long.valueOf(modelUploadId));
-        try {
 
-            String path = buildPath + "upload";
-            String filePath = path + File.separator + fileId + File.separator;
+        ComponentModelUploadEntity componentModelUploadEntity=null;
 
-            List<String> allList = new ArrayList<>();
-            FileUtils.readfilePath(filePath, allList);
-            String maxPath = "";
-            String maxName = "";
-            for (String targetPath : allList) {
-                if (targetPath.toLowerCase().endsWith(".max")) {
-                    maxPath = targetPath;
-                    break;
+        //上锁保证只有一个在消费,加锁一个钟,成功消费就解锁了
+        String token = RedisUtil.tryLock(fileId, 60*60*1000);
+        if (token != null ){
+            log.info("已有同样的fileId:"+fileId+",正在消费了");
+            log.info("暂无的fileId:"+fileId+"消费,继续执行处理逻辑");
+            try {
+                String path = buildPath + "upload";
+                String filePath = path + File.separator + fileId + File.separator;
+
+                List<String> allList = new ArrayList<>();
+                FileUtils.readfilePath(filePath, allList);
+                String maxPath = "";
+                String maxName = "";
+                for (String targetPath : allList) {
+                    if (targetPath.toLowerCase().endsWith(".max")) {
+                        maxPath = targetPath;
+                        break;
+                    }
                 }
-            }
 
-            maxName = maxPath.replace(filePath, "");
+                maxName = maxPath.replace(filePath, "");
 
-            String max = new File(maxPath).getName();
-            Thread.sleep(1000);
-            log.info("开始运行maxToDatasmith");
-            String maxUrl = maxObjUrl + "maxToDatasmith?uuid=" + fileId + "&max=" + maxName + "&flag=" + flag;
-            log.info("请求maxToDatasmith地址-{}", maxUrl);
-            OkHttpUtils.httpGet(maxUrl);
-            log.info("运行maxToDatasmith结束-{}", fileId);
+                String max = new File(maxPath).getName();
+                Thread.sleep(1000);
+                log.info("开始运行maxToDatasmith");
+                String maxUrl = maxObjUrl + "maxToDatasmith?uuid=" + fileId + "&max=" + maxName + "&flag=" + flag;
+                log.info("请求maxToDatasmith地址-{}", maxUrl);
+                OkHttpUtils.httpGet(maxUrl);
+                log.info("运行maxToDatasmith结束-{}", fileId);
 
-            String filesTxt = filePath + max.replace(".max", "") + "/files.txt";
-            if (!new File(filesTxt).exists()) {
-                log.info("运行maxToDatasmith失败,没有files.txt文件:" + filesTxt);
-                throw new RuntimeException(fileId + ":运行maxToDatasmith失败,没有files.txt文件");
-            }
+                String filesTxt = filePath + max.replace(".max", "") + "/files.txt";
+                if (!new File(filesTxt).exists()) {
+                    log.info("运行maxToDatasmith失败,没有files.txt文件:" + filesTxt);
+                    throw new RuntimeException(fileId + ":运行maxToDatasmith失败,没有files.txt文件");
+                }
 
 
-            String[] files = FileUtils.readFile(filesTxt).split(";");
+                String[] files = FileUtils.readFile(filesTxt).split(";");
 
-            //判断obj文件是否有vt 开头
-            String obj = filePath + max.replace(".max", "");
-            //判断是否存在/furniture.json
-            String furniture = filePath + max.replace(".max", "");
+                //判断obj文件是否有vt 开头
+                String obj = filePath + max.replace(".max", "");
+                //判断是否存在/furniture.json
+                String furniture = filePath + max.replace(".max", "");
 
-            //判断是否存在/MeshMatMap.txt
-            String MeshMatMap = filePath + max.replace(".max", "");
+                //判断是否存在/MeshMatMap.txt
+                String MeshMatMap = filePath + max.replace(".max", "");
 
-            for (String file : files) {
-                if (file.endsWith("Output.obj")) {
-                    obj = obj + file;
-                }
-                if (file.endsWith("furniture.json")) {
-                    furniture = furniture + file;
-                }
-                if (file.endsWith("MeshMatMap.txt")) {
-                    MeshMatMap = MeshMatMap + file;
+                for (String file : files) {
+                    if (file.endsWith("Output.obj")) {
+                        obj = obj + file;
+                    }
+                    if (file.endsWith("furniture.json")) {
+                        furniture = furniture + file;
+                    }
+                    if (file.endsWith("MeshMatMap.txt")) {
+                        MeshMatMap = MeshMatMap + file;
+                    }
                 }
-            }
-
-            if (!ObjProcess.hasVt(obj)) {
-                //没有vt,直接报错
-                modelUploadEntity.setStatus(-2);
-                modelUploadService.updateById(modelUploadEntity);
-                return;
-            }
 
-            if (flag.equals("true")) {
 
-                JSONObject jsonObject = new JSONObject();
-                jsonObject.put("name", fileId);
-                jsonObject.put("taskType", "customFurniture");
-                jsonObject.put("taskId", userId);
-                jsonObject.put("postfix", modelType);
-                JSONArray params1 = new JSONArray();
 
 
-                //处理 furniture.json
-                JSONArray furnitureJson = null;
-                if (StrUtil.isNotEmpty(furniture)) {
-                    FileReader fileReader = new FileReader(furniture);
-                    furnitureJson = JSON.parseArray(fileReader.readString());
-                }
-                JSONObject jsonObj = JSON.parseObject(JSON.toJSONString(furnitureJson.get(0)));
-                JSONArray componentSlots = jsonObj.getJSONArray("componentSlots");
-
-                for (Object componentSlot : componentSlots) {
-                    JSONObject component = JSON.parseObject(JSONObject.toJSONString(componentSlot)).getJSONObject("component");
-                    String filesId = component.getString("name");
-                    String componentPath = filePath + max.replace(".max", "") + "/" + filesId;
-
-                    String objFileRealPath = "";
-                    String udatasmitFileRealPath = "";
-                    String udsmeshFileRealPath = "";
-                    String mtlPathFileRealPath= "";
-                    String keyPath = "domain/eHome/furniture/InitialData/" + modelType + "/" + filesId + "/";
-
-                    if (StrUtil.isNotEmpty(component.getString("template"))) {
-                        objFileRealPath = component.getString("template").replaceAll("Z:/OneKeyDecorate", buildPath);
-                    }
+                String objPath = filePath + fileId + ".obj";
+                File target = null;
 
-                    if (StrUtil.isNotEmpty(component.getString("mtlPath"))) {
-                         mtlPathFileRealPath = component.getString("mtlPath").replaceAll("Z:/OneKeyDecorate", buildPath);
-                    }
+                switch (UploadType){
+                    case "1":
+                        modelUploadEntity = modelUploadService.findById(Long.valueOf(modelUploadId));
 
-                    if (StrUtil.isNotEmpty(component.getString("datasmith"))) {
-                        udatasmitFileRealPath = component.getString("datasmith").replaceAll("Z:/OneKeyDecorate", buildPath);
-                    }
+                        if (!ObjProcess.hasVt(obj)) {
+                            //没有vt,直接报错
+                            modelUploadEntity.setStatus(-2);
+                            modelUploadService.updateById(modelUploadEntity);
+                            return;
+                        }
 
-                    if (StrUtil.isNotEmpty(component.getString("smithAssetPath"))) {
-                        //贴图和udsmesh都在这个目录,直接批量传
-                        udsmeshFileRealPath = component.getString("smithAssetPath").replaceAll("Z:/OneKeyDecorate", buildPath);
-                        //获取目录所有文件然后上传
-                        List<File> udsmeshfiles = FileUtil.loopFiles(udsmeshFileRealPath);
-                        for (File file : udsmeshfiles) {
-                            uploadToOssUtil.uploadTo4dTjw(file.getPath(), keyPath + file.getName());
+                        for (String file : files) {
+                            target = new File(filePath + max.replace(".max", "") + file);
+                            uploadToOssUtil.uploadTo4dTjw(filePath + max.replace(".max", "") + file, "domain/eHome/furniture/InitialData/" + modelType + "/" + fileId + "/" + target.getName());
                         }
 
-                    }
+                        Thread.sleep(2000L);
 
 
-                    uploadToOssUtil.uploadTo4dTjw(objFileRealPath, keyPath + filesId + ".obj");
 
-                    uploadToOssUtil.uploadTo4dTjw(udatasmitFileRealPath, keyPath + filesId + ".udatasmith");
 
-                    uploadToOssUtil.uploadTo4dTjw(mtlPathFileRealPath, keyPath + filesId + ".mtl");
+                        JSONObject jsonObject = new JSONObject();
+                        jsonObject.put("name", fileId);
+                        jsonObject.put("taskType", "datafactory");
+                        jsonObject.put("taskId", userId);
+                        jsonObject.put("postfix", modelType);
+//            String buildResult = OkHttpUtils.httpPostJson(buildUrl + "pro", jsonObject.toJSONString());
 
+                        postJson(fileId, filePath, jsonObject);
 
-                    //覆盖json里面的name
+                        Thread.sleep(1000L);
 
-                    params1.add(filesId);
+                        checkResultJson(fileId, filePath, jsonObject, modelUploadId);
 
+                        Integer facesNum = 0;
+                        if ("fbx".equals(modelType)) {
+                            String ossUrl = "domain/eHome/furniture/ue4data/" + fileId + "/" + fileId + "_preview.jpg";
+                            String localUrl = filePath + fileId + "_preview.jpg";
+                            uploadToOssUtil.downloadFileTo4dTjw(ossUrl, localUrl);
+                            log.info("ossUrl-{}", ossUrl);
+                            log.info("本地Url-{}", localUrl);
 
-                    log.info("处理配件,大小为{}", component.toJSONString());
-                    ComponentModelUploadEntity componentModelUploadEntity = new ComponentModelUploadEntity();
+                            String maxObjUrlGet = maxObjUrl + "fbxToObj?uuid=" + fileId + "&fbx=" + fileId +
+                                    ".fbx&obj=" + fileId + ".obj&jpg=" + fileId + ".jpg&r=30";
+                            OkHttpUtils.httpGet(maxObjUrlGet);
+                            log.info("请求maxObj地址-{}", maxObjUrlGet);
+                        }
 
-                    BeanUtil.copyProperties(modelUploadEntity, componentModelUploadEntity, false);
+                        if ("datasmith".equals(modelType)) {
+                            String ossDownlUrl = "domain/eHome/furniture/ue4data/" + fileId;
+                            CreateObjUtil.ossCommonUtilCp(ossDownlUrl, filePath);
+                            log.info("oss下载datasmith-{}", ossDownlUrl);
 
-                    String objPaths = objFileRealPath;
-                    componentModelUploadEntity.setId(null);
-                    componentModelUploadEntity.setFileId(filesId);
-                    componentModelUploadEntity.setObjPath(objPaths.replace(buildPath, ""));
-                    componentModelUploadEntity.setStatus(1);
-                    componentModelUploadEntity.setProgress(100);
-                    componentModelUploadEntity.setMtlPath(mtlPathFileRealPath);
-                    if (JSON.parseObject(JSONObject.toJSONString(componentSlot)).containsKey("origin")) {
-                        componentModelUploadEntity.setCacheData(JSON.parseObject(JSONObject.toJSONString(componentSlot)).getJSONObject("origin").toJSONString());
-                    }
-                    componentModelUploadEntity.setPartsModelUploadId(modelUploadEntity.getId());
-                    componentModelUploadService.save(componentModelUploadEntity);
-                    //保存id,方便后续拿预览图
-                    component.put("id",componentModelUploadEntity.getId());
-                    log.info("处理配件集合,完成保存配件,ID:{}", componentModelUploadEntity);
+                            if (new File(filePath + fileId + "-base.obj").exists()) {
+                                facesNum = ObjProcess.findFacesNum(filePath + fileId + "-base.obj");
 
-                }
+                                String maxObjUrlGet = maxObjUrl + "objToObj?uuid=" + fileId + "&inObj=" + fileId +
+                                        "-base.obj&outObj=" + fileId + ".obj&r=3000";
+                                OkHttpUtils.httpGet(maxObjUrlGet);
+                                log.info("请求maxObj地址-{}", maxObjUrlGet);
+                            }
+                        }
 
-                uploadToOssUtil.uploadTo4dTjw(furniture, "domain/eHome/furniture/CustomFurniture/" + fileId + "/" + fileId + ".json");
+                        log.info("obj路径-{}", objPath);
+                        if (!new File(objPath).exists()) {
+                            log.info("obj文件生成失败:" + objPath);
+                            throw new RuntimeException("obj文件生成失败");
+                        }
 
+                        if (new File(filePath + fileId + "_preview.jpg").exists()) {
+                            modelUploadEntity.setThumPath((filePath + fileId + "_preview.jpg").replace(buildPath, ""));
+                        }
 
-                uploadToOssUtil.uploadTo4dTjw(MeshMatMap, "domain/eHome/furniture/CustomFurniture/" + fileId + "/" + "MeshMatMap.txt");
+                        modelUploadEntity.setStatus(1);
+                        modelUploadEntity.setProgress(100);
+                        modelUploadEntity.setObjPath(objPath.replace(buildPath, ""));
+                        modelUploadEntity.setFacesNum(facesNum);
+                        modelUploadService.updateById(modelUploadEntity);
+                        break;
+                    case "2":
+
+                        modelUploadEntity = modelUploadService.findById(Long.valueOf(modelUploadId));
+
+                        if (!ObjProcess.hasVt(obj)) {
+                            //没有vt,直接报错
+                            modelUploadEntity.setStatus(-2);
+                            modelUploadService.updateById(modelUploadEntity);
+                            return;
+                        }
 
+                        JSONObject postJsonObj = new JSONObject();
+                        postJsonObj.put("name", fileId);
+                        postJsonObj.put("taskType", "customFurniture");
+                        postJsonObj.put("taskId", userId);
+                        postJsonObj.put("postfix", modelType);
+                        JSONArray params1 = new JSONArray();
 
-                //分组处理文件
-                Thread.sleep(2000L);
 
-                jsonObject.put("params1", params1);
-                postJson(fileId, filePath, jsonObject);
+                        //处理 furniture.json
+                        JSONArray furnitureJson = null;
+                        if (StrUtil.isNotEmpty(furniture)) {
+                            FileReader fileReader = new FileReader(furniture);
+                            furnitureJson = JSON.parseArray(fileReader.readString());
+                        }
+                        JSONObject uploadModelJson = JSON.parseObject(JSON.toJSONString(furnitureJson.get(0)));
+                        JSONArray componentSlots = uploadModelJson.getJSONArray("componentSlots");
+
+                        log.info("furnitureJson.json-componentSlots长度:" + componentSlots.size());
+
+                        JSONObject jsonObj =new JSONObject();
+                        jsonObj.put("width",uploadModelJson.get("width"));
+                        jsonObj.put("height",uploadModelJson.get("height"));
+                        jsonObj.put("depth",uploadModelJson.get("depth"));
+                        modelUploadEntity.setCacheData(jsonObj.toJSONString());
+                        JSONArray saveJsonArray=new JSONArray();
+
+                        for (Object componentSlot : componentSlots) {
+                            JSONObject component = JSON.parseObject(JSONObject.toJSONString(componentSlot)).getJSONObject("component");
+                            String filesId = component.getString("name");
+
+                            String objFileRealPath = "";
+                            String udatasmitFileRealPath = "";
+                            String udsmeshFileRealPath = "";
+                            String mtlPathFileRealPath= "";
+                            String keyPath = "domain/eHome/furniture/InitialData/" + modelType + "/" + filesId + "/";
+
+                            if (StrUtil.isNotEmpty(component.getString("template"))) {
+                                objFileRealPath = component.getString("template").replaceAll("Z:/OneKeyDecorate/", buildPath);
+                            }
+
+                            if (StrUtil.isNotEmpty(component.getString("templateMtl"))) {
+                                mtlPathFileRealPath = component.getString("templateMtl").replaceAll("Z:/OneKeyDecorate/", buildPath);
+                            }
+
+                            if (StrUtil.isNotEmpty(component.getString("datasmith"))) {
+                                udatasmitFileRealPath = component.getString("datasmith").replaceAll("Z:/OneKeyDecorate/", buildPath);
+                            }
+
+                            if (StrUtil.isNotEmpty(component.getString("smithAssetPath"))) {
+                                //贴图和udsmesh都在这个目录,直接批量传
+                                udsmeshFileRealPath = component.getString("smithAssetPath").replaceAll("Z:/OneKeyDecorate/", buildPath);
+                                //获取目录所有文件然后上传
+                                List<File> udsmeshfiles = FileUtil.loopFiles(udsmeshFileRealPath);
+                                for (File file : udsmeshfiles) {
+                                    uploadToOssUtil.uploadTo4dTjw(file.getPath(), keyPath + file.getName());
+                                }
+
+                            }
+
+
+                            uploadToOssUtil.uploadTo4dTjw(objFileRealPath, keyPath + filesId + ".obj");
+
+                            uploadToOssUtil.uploadTo4dTjw(udatasmitFileRealPath, keyPath + filesId + ".udatasmith");
+
+                            uploadToOssUtil.uploadTo4dTjw(mtlPathFileRealPath, keyPath + filesId + ".mtl");
+
+
+                            //覆盖json里面的name
+
+                            params1.add(filesId);
+
+
+                            log.info("处理配件,大小为{}", component.toJSONString());
+                            componentModelUploadEntity = new ComponentModelUploadEntity();
+
+                            BeanUtil.copyProperties(modelUploadEntity, componentModelUploadEntity, false);
+
+                            componentModelUploadEntity.setId(null);
+                            componentModelUploadEntity.setFileId(filesId);
+                            componentModelUploadEntity.setStatus(-1);
+                            componentModelUploadEntity.setProgress(0);
+                            componentModelUploadEntity.setMtlPath(mtlPathFileRealPath);
+                            if (JSON.parseObject(JSONObject.toJSONString(componentSlot)).containsKey("origin")) {
+                                JSONObject cache=new JSONObject();
+                                cache.put("origin",JSON.parseObject(JSONObject.toJSONString(componentSlot)).get("origin"));
+                                JSONObject deploy=new JSONObject();
+                                deploy.put("width",component.getFloat("width"));
+                                deploy.put("depth",component.getFloat("depth"));
+                                deploy.put("height",component.getFloat("height"));
+                                cache.put("deploy",deploy);
+                                componentModelUploadEntity.setCacheData(cache.toJSONString());
+                            }
+                            componentModelUploadEntity.setPartsModelUploadId(modelUploadEntity.getId());
+                            componentModelUploadService.save(componentModelUploadEntity);
+                            //保存id,方便后续拿预览图
+                            component.put("id",componentModelUploadEntity.getId());
+                            log.info("处理配件集合,完成保存配件,ID:{}", componentModelUploadEntity);
+                            saveJsonArray.add(component);
+                        }
 
-                Thread.sleep(1000L);
+                        uploadToOssUtil.uploadTo4dTjw(furniture, "domain/eHome/furniture/CustomFurniture/" + fileId + "/" + fileId + ".json");
 
-                checkResultJson(fileId, filePath, jsonObject, modelUploadId);
 
+                        uploadToOssUtil.uploadTo4dTjw(MeshMatMap, "domain/eHome/furniture/CustomFurniture/" + fileId + "/" + "MeshMatMap.txt");
 
-                //拿预览图+obj 成品+组件
-                if (jsonObj.containsKey("name")) {
-                    String productName = jsonObj.getString("name");
-                    uploadToOssUtil.downloadFileTo4dTjw("domain/eHome/furniture/ue4data/" + productName + "/" + productName + "_preview.jpg", filePath + productName + "_preview.jpg");
-                    uploadToOssUtil.downloadFileTo4dTjw("domain/eHome/furniture/ue4data/" + productName + "/" + productName + ".obj", filePath + productName + "-base.obj");
-                    modelUploadEntity.setThumPath(filePath + productName + "_preview.jpg");
-                    modelUploadEntity.setObjPath(filePath + productName + ".obj");
-                    Thread.sleep(1000L);
 
-                }
+                        //分组处理文件
+                        Thread.sleep(2000L);
+
+                        postJsonObj.put("params1", params1);
+                        postJson(fileId, filePath, postJsonObj);
 
-                for (Object componentSlot : componentSlots) {
-                    JSONObject component = JSON.parseObject(JSONObject.toJSONString(componentSlot)).getJSONObject("component");
-                    if (component.containsKey("name")) {
-                        String componentName = component.getString("name");
-                        uploadToOssUtil.downloadFileTo4dTjw("domain/eHome/furniture/ue4data/" + componentName + "/" + componentName + "_preview.jpg", filePath + componentName + "_preview.jpg");
-                        uploadToOssUtil.downloadFileTo4dTjw("domain/eHome/furniture/ue4data/" + componentName + "/" + componentName + "-base.obj", filePath + componentName + ".obj");
-                        ComponentModelUploadEntity componentEntity =componentModelUploadService.findById(component.getLong("id"));
-                        componentEntity.setThumPath(filePath + componentName + "_preview.jpg");
-                        componentEntity.setObjPath(filePath + componentName + ".obj");
-                        componentEntity.setStatus(1);
-                        componentModelUploadService.updateById(componentEntity);
                         Thread.sleep(1000L);
 
-                    }
+                        checkResultJson(fileId, filePath, postJsonObj, modelUploadId);
 
-                }
+                        String productName ="";
+                        //拿预览图+obj 成品+组件
+                        if (uploadModelJson.containsKey("name")) {
+                            productName = uploadModelJson.getString("name");
+                            uploadToOssUtil.downloadFileTo4dTjw("domain/eHome/furniture/ue4data/" + productName + "/" + productName + "_preview.jpg", filePath + productName + "_preview.jpg");
+                            modelUploadEntity.setThumPath(filePath.replace(buildPath, "")  + productName + "_preview.jpg");
+                            Thread.sleep(1000L);
+                            log.info("处理成品生成后的预览图"+modelUploadEntity.getThumPath());
 
-                modelUploadEntity.setStatus(1);
-                modelUploadEntity.setProgress(100);
-//                modelUploadEntity.setObjPath(objPath.replace(buildPath, ""));
-                modelUploadService.updateById(modelUploadEntity);
+                        }
 
-            } else {
+                        for (Object componentSlot : saveJsonArray) {
+                            JSONObject component = JSON.parseObject(JSONObject.toJSONString(componentSlot));
+                            if (component.containsKey("name")) {
+
+                                String componentName = component.getString("name");
+                                String uploadPath=filePath +componentName+"/" ;
+                                if (!FileUtil.exist(uploadPath)){
+                                    FileUtil.mkdir(uploadPath);
+                                }
+                                uploadPath=uploadPath+componentName;
+                                uploadToOssUtil.downloadFileTo4dTjw("domain/eHome/furniture/ue4data/"+productName+"/" + componentName + "/" + componentName + "_preview.jpg",uploadPath+"_preview.jpg" );
+                                uploadToOssUtil.downloadFileTo4dTjw("domain/eHome/furniture/ue4data/"+productName+"/" + componentName + "/" + componentName + "-base.obj", uploadPath+ ".obj");
+                                uploadToOssUtil.downloadFileTo4dTjw("domain/eHome/furniture/ue4data/"+productName+"/" + componentName + "/" + componentName + ".mtl", uploadPath+ ".mtl");
+                                uploadToOssUtil.downloadFileTo4dTjw("domain/eHome/furniture/ue4data/"+productName+"/" + componentName + "/" + componentName + ".jpg", uploadPath+ ".jpg");
+                                ComponentModelUploadEntity componentEntity =componentModelUploadService.findById(component.getLong("id"));
+                                if (componentEntity != null) {
+                                    componentEntity.setThumPath(uploadPath.replace(buildPath, "") + "_preview.jpg");
+                                    componentEntity.setObjPath(uploadPath.replace(buildPath, "") + ".obj");
+                                    componentEntity.setMtlPath(uploadPath.replace(buildPath, "") + ".mtl");
+                                    //TODO 贴图是啥
+                                    componentEntity.setImgPath(uploadPath.replace(buildPath, "") + ".jpg");
+                                    componentEntity.setStatus(1);
+                                    componentEntity.setProgress(100);
+                                    componentEntity.setThumStatus(1);
+                                    componentEntity.setThumProgress(100);
+                                    componentModelUploadService.updateById(componentEntity);
+                                    log.info("处理配件生成后的预览图"+componentEntity.getThumPath()+"|obj"+componentEntity.getObjPath()+"|mtl"+componentEntity.getMtlPath());
+                                    Thread.sleep(1000L);
+                                }
+                            }
 
-                File target = null;
-                for (String file : files) {
-                    target = new File(filePath + max.replace(".max", "") + file);
-                    uploadToOssUtil.uploadTo4dTjw(filePath + max.replace(".max", "") + file, "domain/eHome/furniture/InitialData/" + modelType + "/" + fileId + "/" + target.getName());
-                }
+                        }
 
-                Thread.sleep(2000L);
+                        modelUploadEntity.setStatus(1);
+                        modelUploadEntity.setProgress(100);
+                        modelUploadService.updateById(modelUploadEntity);
+                        log.info("配件逻处理完毕");
+                        break;
 
+                    case "3":
+                        componentModelUploadEntity=componentModelUploadService.findById(Long.valueOf(modelUploadId));
 
-                String objPath = filePath + fileId + ".obj";
-                String imgPath = filePath + fileId + ".jpg";
+                        for (String file : files) {
+                            target = new File(filePath + max.replace(".max", "") + file);
+                            uploadToOssUtil.uploadTo4dTjw(filePath + max.replace(".max", "") + file, "domain/eHome/furniture/InitialData/" + modelType + "/" + fileId + "/" + target.getName());
+                        }
 
+                        Thread.sleep(2000L);
 
-                JSONObject jsonObject = new JSONObject();
-                jsonObject.put("name", fileId);
-                jsonObject.put("taskType", "datafactory");
-                jsonObject.put("taskId", userId);
-                jsonObject.put("postfix", modelType);
+
+
+                        JSONObject componetJsonObject = new JSONObject();
+                        componetJsonObject.put("name", fileId);
+                        componetJsonObject.put("taskType", "datafactory");
+                        componetJsonObject.put("taskId", userId);
+                        componetJsonObject.put("postfix", modelType);
 //            String buildResult = OkHttpUtils.httpPostJson(buildUrl + "pro", jsonObject.toJSONString());
 
-                postJson(fileId, filePath, jsonObject);
+                        postJson(fileId, filePath, componetJsonObject);
 
-                Thread.sleep(1000L);
+                        Thread.sleep(1000L);
 
-                checkResultJson(fileId, filePath, jsonObject, modelUploadId);
+                        checkResultJson(fileId, filePath, componetJsonObject, modelUploadId);
 
-                Integer facesNum = 0;
-                if ("fbx".equals(modelType)) {
-                    String ossUrl = "domain/eHome/furniture/ue4data/" + fileId + "/" + fileId + "_preview.jpg";
-                    String localUrl = filePath + fileId + "_preview.jpg";
-                    uploadToOssUtil.downloadFileTo4dTjw(ossUrl, localUrl);
-                    log.info("ossUrl-{}", ossUrl);
-                    log.info("本地Url-{}", localUrl);
+                        if ("datasmith".equals(modelType)) {
+                            String ossDownlUrl = "domain/eHome/furniture/ue4data/" + fileId;
+                            CreateObjUtil.ossCommonUtilCp(ossDownlUrl, filePath);
+                            log.info("oss下载datasmith-{}", ossDownlUrl);
+                            if (FileUtil.exist(filePath + fileId + "-base.obj")) {
+                                FileUtil.copyFile( filePath + fileId + "-base.obj" ,filePath + fileId + ".obj");
+                            }
+                        }
+                        log.info("obj路径-{}", objPath);
+                        if (!new File(objPath).exists()) {
+                            log.info("obj文件生成失败:" + objPath);
+                            throw new RuntimeException("obj文件生成失败");
+                        }
 
-                    String maxObjUrlGet = maxObjUrl + "fbxToObj?uuid=" + fileId + "&fbx=" + fileId +
-                            ".fbx&obj=" + fileId + ".obj&jpg=" + fileId + ".jpg&r=30";
-                    OkHttpUtils.httpGet(maxObjUrlGet);
-                    log.info("请求maxObj地址-{}", maxObjUrlGet);
-                }
+                        componentModelUploadEntity.setStatus(1);
+                        componentModelUploadEntity.setProgress(100);
 
-                if ("datasmith".equals(modelType)) {
-                    String ossDownlUrl = "domain/eHome/furniture/ue4data/" + fileId;
-                    CreateObjUtil.ossCommonUtilCp(ossDownlUrl, filePath);
-                    log.info("oss下载datasmith-{}", ossDownlUrl);
+                        componentModelUploadEntity.setThumStatus(1);
+                        componentModelUploadEntity.setThumProgress(100);
+                        componentModelUploadEntity.setThumPath(objPath.replace(buildPath, "").replace(".obj", "") + "_preview.jpg");
+                        componentModelUploadEntity.setMtlPath(objPath.replace(buildPath, "").replace(".obj", "") + ".mtl");
+//                    componentModelUploadEntity.setImgPath(objPath.replace(buildPath, "").replace(".obj", "") + ".jpg");
+                        componentModelUploadEntity.setObjPath(objPath.replace(buildPath, ""));
+                        componentModelUploadService.updateById(componentModelUploadEntity);
+                        break;
 
-                    if (new File(filePath + fileId + "-base.obj").exists()) {
-                        facesNum = ObjProcess.findFacesNum(filePath + fileId + "-base.obj");
+                    default:
+                        break;
 
-                        String maxObjUrlGet = maxObjUrl + "objToObj?uuid=" + fileId + "&inObj=" + fileId +
-                                "-base.obj&outObj=" + fileId + ".obj&r=3000";
-                        OkHttpUtils.httpGet(maxObjUrlGet);
-                        log.info("请求maxObj地址-{}", maxObjUrlGet);
-                    }
-                }
 
-                log.info("obj路径-{}", objPath);
-                if (!new File(objPath).exists()) {
-                    log.info("obj文件生成失败:" + objPath);
-                    throw new RuntimeException("obj文件生成失败");
                 }
 
-                if (new File(filePath + fileId + "_preview.jpg").exists()) {
-                    modelUploadEntity.setThumPath((filePath + fileId + "_preview.jpg").replace(buildPath, ""));
+
+
+
+
+
+            } catch (Exception e) {
+                e.printStackTrace();
+                log.error("修改模型报错-{}", e.getMessage());
+                if (ObjectUtil.isNotNull(modelUploadEntity)){
+                    modelUploadEntity.setStatus(-1);
+                    modelUploadService.updateById(modelUploadEntity);
+                }else if (ObjectUtil.isNotNull(componentModelUploadEntity)){
+                    componentModelUploadEntity.setStatus(-1);
+                    componentModelUploadService.findById(Long.valueOf(modelUploadId));
                 }
 
-                modelUploadEntity.setStatus(1);
-                modelUploadEntity.setProgress(100);
-                modelUploadEntity.setObjPath(objPath.replace(buildPath, ""));
-                modelUploadEntity.setFacesNum(facesNum);
-                modelUploadService.updateById(modelUploadEntity);
-            }
 
-        } catch (Exception e) {
-            e.printStackTrace();
-            log.error("修改模型报错-{}", e.getMessage());
-            modelUploadEntity.setStatus(-1);
-            modelUploadService.updateById(modelUploadEntity);
+            }finally {
+                if (token!=null){
+                    RedisUtil.unlock(fileId, token);
+                }
+            }
         }
 
+
     }
 
 
@@ -1075,15 +1206,45 @@ public class RunBuild {
         String modelId = datas[2];
         String dataJson = datas[3];
         String taskType = datas[4];
+        //1 +   成品   2定制  3 组件
+        String uploadType = datas[5];
 
         String path = buildPath + "upload";
         String filePath = path + File.separator + fileId + File.separator;
 
-        JSONObject jsonObject = new JSONObject();
+        switch (uploadType){
+            case "1":
+                endProductHandler(fileId, userId, modelId, dataJson, taskType, uploadType, filePath);
+                break;
+            case "2":
+                customHandler(fileId, userId, modelId, dataJson, taskType, uploadType, filePath);
+                break;
+            case "3":
+                componentHandler(fileId, userId, modelId, dataJson, taskType, uploadType, filePath);
+                break;
+            default:
+                break;
+        }
 
-        ModelUploadEntity modelUploadEntity = null;
+
+    }
+
+    private void componentHandler(String fileId, String userId, String modelId, String dataJson, String taskType, String uploadType, String filePath) {
+        ComponentModelUploadEntity componentModelUploadEntity=null;
+        JSONObject jsonObject = null;
+        ModelUploadEntity uploadEntity=null;
         try {
-            jsonObject.put("name", fileId);
+            jsonObject=new JSONObject();
+            ComponentModelUploadEntity byFileId = componentModelUploadService.findByFileId(fileId);
+            if (ObjectUtil.isNotNull(byFileId.getPartsModelUploadId())){
+                 uploadEntity = modelUploadService.findById(byFileId.getPartsModelUploadId());
+                if (ObjectUtil.isNotNull(uploadEntity)){
+                    jsonObject.put("name", uploadEntity.getFileId()+"#"+fileId);
+                }
+            }else {
+                jsonObject.put("name", fileId);
+            }
+
             jsonObject.put("taskType", taskType);
             jsonObject.put("taskId", userId);
             jsonObject.put("params1", JSONObject.parseObject(dataJson).getJSONObject("Param1"));
@@ -1092,14 +1253,67 @@ public class RunBuild {
 
             Thread.sleep(1000L);
 
-            checkExaggerateSurace(jsonObject, filePath, fileId, modelId, taskType);
+            checkExaggerateSurace(jsonObject, filePath, fileId, modelId, taskType, uploadType);
+            if (ObjectUtil.isNotNull(uploadEntity)){
+                jsonObject.put("name", uploadEntity.getFileId()+"#"+fileId);
+                uploadToOssUtil.downloadFileTo4dTjw("domain/eHome/furniture/ue4data/"+uploadEntity.getFileId()+"/" + fileId + "/" + fileId + "_preview.jpg", filePath + fileId + "_preview.jpg");
+
+            }else {
+
+                uploadToOssUtil.downloadFileTo4dTjw("domain/eHome/furniture/ue4data/" + fileId + "/" + fileId + "_preview.jpg", filePath + fileId + "_preview.jpg");
+            }
+
+            uploadToOssUtil.uploadTo4dTjw(filePath + fileId + "_preview.jpg", "domain/eHome/furniture/models/" +fileId+ "_preview.jpg");
+            componentModelUploadEntity = new ComponentModelUploadEntity();
+            componentModelUploadEntity.setId(Long.valueOf(modelId));
+            componentModelUploadEntity.setThumStatus(1);
+            componentModelUploadEntity.setProgress(100);
+            componentModelUploadService.updateById(componentModelUploadEntity);
+
+        } catch (Exception e) {
+            log.error("生成封面失败-{}", e);
+            componentModelUploadEntity = new ComponentModelUploadEntity();
+            componentModelUploadEntity.setId(Long.valueOf(modelId));
+            componentModelUploadEntity.setThumStatus(-1);
+            componentModelUploadService.updateById(componentModelUploadEntity);
+        }
+    }
+
+    private void customHandler(String fileId, String userId, String modelId, String dataJson, String taskType, String uploadType, String filePath) {
+        ModelUploadEntity modelUploadEntity=null;
+        JSONObject jsonObject = null;
+        try {
+            jsonObject=new JSONObject();
+            JSONArray componentPositions=JSONObject.parseObject(dataJson).getJSONObject("Param1").getJSONArray("componmentPositions");
+            List<String> ids=new LinkedList<>();
+            ids.add(fileId);
+            for (Object componentPosition : componentPositions) {
+                String id = JSON.parseObject(JSONObject.toJSONString(componentPosition)).getString("id");
+                ids.add(id);
+            }
+            jsonObject.put("name", String.join("#",ids));
+            jsonObject.put("taskType", taskType);
+            jsonObject.put("taskId", userId);
+            jsonObject.put("params1", JSONObject.parseObject(dataJson).getJSONObject("Param1"));
+
+            postExaggerateSurace(fileId, modelId, taskType, filePath, jsonObject);
+
+            Thread.sleep(1000L);
+
+            checkExaggerateSurace(jsonObject, filePath, fileId, modelId, taskType, uploadType);
 
             uploadToOssUtil.downloadFileTo4dTjw("domain/eHome/furniture/ue4data/" + fileId + "/" + fileId + "_preview.jpg", filePath + fileId + "_preview.jpg");
+
+            uploadToOssUtil.uploadTo4dTjw(filePath + fileId + "_preview.jpg", "domain/eHome/furniture/models/" +fileId + "_preview" + ".jpg");
+
             modelUploadEntity = new ModelUploadEntity();
             modelUploadEntity.setId(Long.valueOf(modelId));
             modelUploadEntity.setThumStatus(1);
             modelUploadEntity.setProgress(100);
             modelUploadService.updateById(modelUploadEntity);
+
+
+
         } catch (Exception e) {
             log.error("生成封面失败-{}", e);
             modelUploadEntity = new ModelUploadEntity();
@@ -1107,7 +1321,41 @@ public class RunBuild {
             modelUploadEntity.setThumStatus(-1);
             modelUploadService.updateById(modelUploadEntity);
         }
+    }
+
+    //成品处理
+    private void endProductHandler(String fileId, String userId, String modelId, String dataJson, String taskType, String uploadType, String filePath) {
+        JSONObject jsonObject=null;
+        ModelUploadEntity modelUploadEntity=null;
+        try {
+            jsonObject=new JSONObject();
+            jsonObject.put("name", fileId);
+            jsonObject.put("taskType", taskType);
+            jsonObject.put("taskId", userId);
+            jsonObject.put("params1", JSONObject.parseObject(dataJson).getJSONObject("Param1"));
+
+            postExaggerateSurace(fileId, modelId, taskType, filePath, jsonObject);
+
+            Thread.sleep(1000L);
+
+            checkExaggerateSurace(jsonObject, filePath, fileId, modelId, taskType, uploadType);
+
+            uploadToOssUtil.downloadFileTo4dTjw("domain/eHome/furniture/ue4data/" + fileId + "/" + fileId + "_preview.jpg", filePath + fileId + "_preview.jpg");
+            modelUploadEntity = new ModelUploadEntity();
+            modelUploadEntity.setId(Long.valueOf(modelId));
+            modelUploadEntity.setThumStatus(1);
+            modelUploadEntity.setProgress(100);
+            modelUploadService.updateById(modelUploadEntity);
+
 
+
+        } catch (Exception e) {
+            log.error("生成封面失败-{}", e);
+            modelUploadEntity = new ModelUploadEntity();
+            modelUploadEntity.setId(Long.valueOf(modelId));
+            modelUploadEntity.setThumStatus(-1);
+            modelUploadService.updateById(modelUploadEntity);
+        }
     }
 
     /**
@@ -1118,6 +1366,7 @@ public class RunBuild {
      * @param fileId
      * @param modelId
      * @param taskType
+     * @param uploadType
      * @throws IOException
      * @throws InterruptedException
      */
@@ -1125,15 +1374,18 @@ public class RunBuild {
                                        String filePath,
                                        String fileId,
                                        String modelId,
-                                       String taskType
+                                       String taskType,
+                                       String uploadType
     ) throws IOException, InterruptedException {
         boolean over = false;
+
+        JSONObject checkPostJson=new JSONObject();
+        checkPostJson.put("name",jsonObject.get("name"));
+        checkPostJson.put("taskType",jsonObject.get("taskType"));
         while (true) {
-            String checkResult = OkHttpUtils.httpPostJson(modelBuildUrl + "check", jsonObject.toJSONString());
+            String checkResult = OkHttpUtils.httpPostJson(modelBuildUrl + "check", checkPostJson.toString());
             JSONObject checkJson = JSONObject.parseObject(checkResult);
-
             JSONArray checkArray = checkJson.getJSONArray("msg");
-
             if (checkArray.size() == 0) {
                 FileUtils.writeFile(filePath + "/error-check-thum.json", checkJson.toJSONString());
                 throw new RuntimeException(fileId + ":" + taskType + "方式check接口返回error错误");
@@ -1153,10 +1405,17 @@ public class RunBuild {
                 }
 
                 if (objectJson.containsKey("progress")) {
-                    ModelUploadEntity modelUploadEntity = new ModelUploadEntity();
-                    modelUploadEntity.setId(Long.valueOf(modelId));
-                    modelUploadEntity.setProgress(objectJson.getInteger("progress"));
-                    modelUploadService.updateById(modelUploadEntity);
+                    if (uploadType.equals("3")){
+                        ComponentModelUploadEntity  componentModelUploadEntity = new ComponentModelUploadEntity();
+                        componentModelUploadEntity.setId(Long.valueOf(modelId));
+                        componentModelUploadEntity.setProgress(objectJson.getInteger("progress"));
+                        componentModelUploadService.updateById(componentModelUploadEntity);
+                    }else {
+                        ModelUploadEntity modelUploadEntity = new ModelUploadEntity();
+                        modelUploadEntity.setId(Long.valueOf(modelId));
+                        modelUploadEntity.setProgress(objectJson.getInteger("progress"));
+                        modelUploadService.updateById(modelUploadEntity);
+                    }
                 }
             }
 

+ 1 - 1
sxz-core/src/main/java/com/fdkk/sxz/system/controller/SysUserController.java

@@ -141,7 +141,7 @@ public class SysUserController extends BaseController {
         boolean result=false;
         if (ObjectUtil.isNotNull(user)){
             user.setRecStatus("I");
-            result = userService.updateById(user);
+            result = userService.removeById(user.getId());
         }
         if (result) {
             return success("删除成功");

+ 1 - 1
sxz-core/src/main/java/com/fdkk/sxz/webApi/controller/ImportDataController.java

@@ -408,7 +408,7 @@ public class ImportDataController extends BaseController {
                 rabbitTemplate.convertAndSend(TopicRabbitConfig.TOPICE, TopicRabbitConfig.LIGHT,
                         styleNum + ":;" + sceneNum + ":;" + type + ":;" + dateType + ":;" +
                                 ratio + ":;" + sceneLightEntity.getId().longValue() + ":;" +
-                                quality + ":;" + buildType);
+                                quality + ":;" + buildType+":;"+1);
             }
 
             FileUtils.deleteDirectory(buildPath + "Output/" + styleNum);

+ 20 - 15
sxz-core/src/main/java/com/fdkk/sxz/webApi/controller/ManagerController.java

@@ -87,6 +87,9 @@ public class ManagerController extends BaseController {
     private ICompanyService companyService;
 
     @Autowired
+    private IComponentModelUploadService componentModelUploadService;
+
+    @Autowired
     private ObjToToolbagUtil objToToolbagUtil;
 
     @Value("${build.url}")
@@ -132,10 +135,13 @@ public class ManagerController extends BaseController {
 
         String fileId = null;
         ModelUploadEntity modelUploadEntity = null;
+        ComponentModelUploadEntity componentModelUploadEntity =null;
         do {
             fileId = RandomUtil.generateShortUuid();
             modelUploadEntity = modelUploadService.findByFileId(fileId);
-        } while (modelUploadEntity != null);
+            componentModelUploadEntity= componentModelUploadService.findByFileId(fileId);
+
+        } while (modelUploadEntity != null&&componentModelUploadEntity!=null);
 
         modelUploadEntity = new ModelUploadEntity();
         modelUploadEntity.setUserId(Long.valueOf(userId));
@@ -206,7 +212,7 @@ public class ManagerController extends BaseController {
 //            }
 //        }
 
-        rabbitTemplate.convertAndSend(TopicRabbitConfig.TOPICE, TopicRabbitConfig.MODEL, modelUploadEntity.getId() + ":;" + fileId + ":;" + userId + ":;" + modelType+ ":;" +"false");
+        rabbitTemplate.convertAndSend(TopicRabbitConfig.TOPICE, TopicRabbitConfig.MODEL, modelUploadEntity.getId() + ":;" + fileId + ":;" + userId + ":;" + modelType+ ":;" +"false"+":;" +"1");
 
         return Result.success(modelUploadEntity);
     }
@@ -510,8 +516,7 @@ public class ManagerController extends BaseController {
         if ("I".equals(renovationPartsDetailEntity.getRecStatus())) {
             ModelUploadEntity modelUploadEntity = modelUploadService.findByPartsDetailId(renovationPartsDetailEntity.getId());
             if (modelUploadEntity != null) {
-                modelUploadEntity.setRecStatus("I");
-                modelUploadService.updateById(modelUploadEntity);
+                modelUploadService.removeById(modelUploadEntity.getId());
             }
         }
 
@@ -576,7 +581,7 @@ public class ManagerController extends BaseController {
             return Result.failure(CodeConstant.FAILURE_CODE_4009, CodeConstant.FAILURE_MSG_4009);
         }
 
-        //先执行python脚本,处理obj文件
+        //先执行python-NewResortForOne脚本,处理obj文件
         CreateObjUtil.objHandle(buildPath + modelUploadEntity.getObjPath());
 
         //obj转换成glb格式
@@ -675,8 +680,8 @@ public class ManagerController extends BaseController {
             renovationPartsDetailEntity.setHasToolbag(1);
         }
 
-        renovationPartsDetailService.save(renovationPartsDetailEntity);
-        if (renovationPartsDetailEntity.getId() == null) {
+        Boolean saveFlag=renovationPartsDetailService.save(renovationPartsDetailEntity);
+        if (!saveFlag) {
             return Result.failure(CodeConstant.FAILURE_CODE_4008, CodeConstant.FAILURE_MSG_4008);
         }
 
@@ -791,7 +796,6 @@ public class ManagerController extends BaseController {
     @ApiImplicitParams({
             @ApiImplicitParam(name = "id", value = "模型id", dataType = "String")})
     @NoAuthentication
-    @AroundLog(name = "通过id查询上传模型进度")
     public Result findUploadModelById(@RequestBody RequestRenovationPartsDetailManager param) {
         if (param.getId() == null) {
             return Result.failure(CodeConstant.FAILURE_CODE_3001, CodeConstant.FAILURE_MSG_3001);
@@ -862,12 +866,14 @@ public class ManagerController extends BaseController {
         String[] idArray = param.getIds().split(",");
         ModelUploadEntity modelUploadEntity = new ModelUploadEntity();
         for (String id : idArray) {
-            modelUploadEntity.setId(Long.valueOf(id));
-            modelUploadEntity.setRecStatus("I");
-
-            modelUploadService.updateById(modelUploadEntity);
+            modelUploadService.removeById(id);
+            if(param.getFileType()==2){
+                List<ComponentModelUploadEntity> entityList= componentModelUploadService.findPartsModelUploadId(Long.valueOf(id));
+                entityList.forEach(a->{
+                    componentModelUploadService.removeById(a.getId());
+                });
+            }
         }
-
         return Result.success();
     }
 
@@ -898,7 +904,7 @@ public class ManagerController extends BaseController {
 
         rabbitTemplate.convertAndSend(TopicRabbitConfig.TOPICE, TopicRabbitConfig.LIGHT,
                 modelUploadEntity.getFileId() + ":;" + modelUploadEntity.getUserId() + ":;" +
-                        modelUploadEntity.getId() + ":;" + jsonData + ":;modelPreview");
+                        modelUploadEntity.getId() + ":;" + jsonData + ":;modelPreview:;"+1);
 
         modelUploadService.updateById(modelUploadEntity);
         return Result.success();
@@ -914,7 +920,6 @@ public class ManagerController extends BaseController {
     @ApiImplicitParams({
             @ApiImplicitParam(name = "id", value = "模型id", dataType = "String")})
     @NoAuthentication
-    @AroundLog(name = "根据模型id查询模型详情")
     public Result findModelById(Long id) throws Exception {
         if (id == null) {
             return Result.failure(CodeConstant.FAILURE_CODE_3001, CodeConstant.FAILURE_MSG_3001);

+ 1 - 1
sxz-core/src/main/java/com/fdkk/sxz/webApi/controller/SceneLightStyleController.java

@@ -117,7 +117,7 @@ public class SceneLightStyleController  extends BaseController {
         entity.setId(lightStyle.getId());
         entity.setRecStatus("I");
         entity.setUpdateTime(new Date());
-        sceneLightStyleService.updateById(entity);
+        sceneLightStyleService.removeById(entity.getId());
         return Result.success();
     }
 

+ 2 - 2
sxz-core/src/main/java/com/fdkk/sxz/webApi/controller/SceneStyleController.java

@@ -137,7 +137,7 @@ public class SceneStyleController extends BaseController {
         }
 
         sceneStyleEntity.setRecStatus("I");
-        Boolean updateFlag = sceneStyleService.updateById(sceneStyleEntity);
+        Boolean updateFlag = sceneStyleService.removeById(sceneStyleEntity.getId());
 
         log.info("修改状态:" + updateFlag);
 
@@ -273,7 +273,7 @@ public class SceneStyleController extends BaseController {
         entity.setId(style.getId());
         entity.setRecStatus("I");
         entity.setUpdateTime(new Date());
-        sceneLightService.updateById(entity);
+        sceneLightService.removeById(entity.getId());
 
         return Result.success();
     }

+ 1 - 1
sxz-core/src/main/java/com/fdkk/sxz/webApi/controller/VisualAngleController.java

@@ -111,7 +111,7 @@ public class VisualAngleController extends BaseController {
         VisualAngleEntity visualAngleEntity = visualAngleService.findById(param.getId());
         if(visualAngleEntity != null){
             visualAngleEntity.setRecStatus("I");
-            visualAngleService.updateById(visualAngleEntity);
+            visualAngleService.removeById(visualAngleEntity.getId());
         }
         return Result.success();
     }

+ 380 - 0
sxz-core/src/main/java/com/fdkk/sxz/webApi/controller/custom/ComponetManagerController.java

@@ -0,0 +1,380 @@
+package com.fdkk.sxz.webApi.controller.custom;
+
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.StrUtil;
+import com.fdkk.sxz.annotation.auth.NoAuthentication;
+import com.fdkk.sxz.annotation.log.AroundLog;
+import com.fdkk.sxz.base.BaseController;
+import com.fdkk.sxz.base.Result;
+import com.fdkk.sxz.constant.CodeConstant;
+import com.fdkk.sxz.entity.ComponentModelUploadEntity;
+import com.fdkk.sxz.entity.ModelUploadEntity;
+import com.fdkk.sxz.entity.custuom.CustomComponentClassifyEntity;
+import com.fdkk.sxz.entity.custuom.CustomComponentEntity;
+import com.fdkk.sxz.other.mq.TopicRabbitConfig;
+import com.fdkk.sxz.util.CreateObjUtil;
+import com.fdkk.sxz.util.FileUtils;
+import com.fdkk.sxz.util.RandomUtil;
+import com.fdkk.sxz.util.UploadToOssUtil;
+import com.fdkk.sxz.vo.request.*;
+import com.fdkk.sxz.vo.response.ResponseComponentManager;
+import com.fdkk.sxz.webApi.service.IComponentModelUploadService;
+import com.fdkk.sxz.webApi.service.IModelUploadService;
+import com.fdkk.sxz.webApi.service.custom.*;
+import com.github.pagehelper.Page;
+import com.github.pagehelper.PageInfo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.amqp.rabbit.core.RabbitTemplate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletRequest;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * @description: 定制家具——库模块相关API接口
+ * @author: Xiewj
+ * @date: 2021-08-30 14:44:45
+ **/
+@Api(tags = "定制家具后台组件管理接口 author:Xiewj")
+@RestController
+@RequestMapping("/manager/component")
+@Slf4j
+public class ComponetManagerController extends BaseController {
+
+    @Value("${server.file.location}")
+    private String buildPath;
+
+    @Autowired
+    private RabbitTemplate rabbitTemplate;  //使用RabbitTemplate,这提供了接收/发送等等方
+
+
+
+    @Autowired
+    private ICustomComponentService customComponentService;
+
+    @Autowired
+    private ICustomComponentClassifyService componentClassifyService;
+
+    @Autowired
+    private IComponentModelUploadService componentModelUploadService;
+
+    @Autowired
+    private UploadToOssUtil uploadToOssUtil;
+
+    @Value("${prefix.ali}")
+    private String prefix;
+
+    @Autowired
+    private IModelUploadService modelUploadService;
+    /**
+     * 根据用户id,查询所有未发布的上传模型
+     *
+     * @param param
+     * @return
+     */
+    @ApiOperation("根据用户id,查询所有未发布的上传模型")
+    @RequestMapping(value = "/findIsNotPartsDetailId", method = RequestMethod.POST)
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "userId", value = "用户id", dataType = "String"),
+            @ApiImplicitParam(name = "fileType", value = "文件类型 1模型 2定制模型", dataType = "int")
+    })
+    @NoAuthentication
+    @AroundLog(name = "根据用户id,查询所有未发布的上传模型")
+    public Result findIsNotPartsDetailId(@RequestBody RequestRenovationParts param) {
+        if (param.getUserId() == null) {
+            return Result.failure(CodeConstant.FAILURE_CODE_3001, CodeConstant.FAILURE_MSG_3001);
+        }
+
+        return Result.success(componentModelUploadService.findIsNotPartsDetailId(param.getUserId(), param.getFileType()));
+    }
+
+    /**
+     * 更新模型审核状态
+     *
+     * @return
+     */
+    @ApiOperation("更新模型审核状态")
+    @RequestMapping(value = "/updatePartsDetailExamine", method = RequestMethod.POST)
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "模型id", dataType = "String"),
+            @ApiImplicitParam(name = "examine", value = "审核,0审核中,1审核通过,-1审核失败", dataType = "String")})
+    @NoAuthentication
+    @AroundLog(name = "更新模型审核状态")
+    public Result updatePartsDetailExamine(@RequestBody RequestRenovationPartsDetailManager param) {
+        if (param.getId() == null || param.getExamine() == null) {
+            return Result.failure(CodeConstant.FAILURE_CODE_3001, CodeConstant.FAILURE_MSG_3001);
+        }
+
+        CustomComponentEntity componentEntity = customComponentService.findById(param.getId());
+        if (ObjectUtil.isNotNull(componentEntity)) {
+//            uploadToOssUtil.copyTo4dTjw(componentEntity.getThumbnailSrc().replace(prefix, ""),
+//                    componentEntity.getThumbnailSrc().replace("/temp/", "/models/").replace(prefix, ""));
+//            uploadToOssUtil.copyTo4dTjw(componentEntity.getTemplate().replace(prefix, ""),
+//                    componentEntity.getTemplate().replace("/temp/", "/models/").replace(prefix, ""));
+//            uploadToOssUtil.deleteTo4dTjw(componentEntity.getThumbnailSrc().replace(prefix, ""));
+//            uploadToOssUtil.deleteTo4dTjw(componentEntity.getTemplate().replace(prefix, ""));
+//            componentEntity.setThumbnailSrc(componentEntity.getThumbnailSrc().replace("/temp/", "/models/"));
+//            componentEntity.setTemplate(componentEntity.getTemplate().replace("/temp/", "/models/"));
+            componentEntity.setExamine(param.getExamine());
+            componentEntity.setExamineTime(new Date());
+            customComponentService.updateById(componentEntity);
+        }
+
+        return Result.success();
+    }
+
+    /**
+     * 通过id查询上传模型进度
+     *
+     * @param param
+     * @return
+     */
+    @ApiOperation("通过id查询上传模型进度")
+    @RequestMapping(value = "/findUploadModelById", method = RequestMethod.POST)
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "模型id", dataType = "String")})
+    @NoAuthentication
+    public Result findUploadModelById(@RequestBody RequestRenovationPartsDetailManager param) {
+        if (param.getId() == null) {
+            return Result.failure(CodeConstant.FAILURE_CODE_3001, CodeConstant.FAILURE_MSG_3001);
+        }
+
+        return Result.success(componentModelUploadService.findComponent(param.getId()));
+    }
+    /**
+     * 生成封面图
+     *
+     * @return
+     */
+    @ApiOperation("生成封面图")
+    @RequestMapping(value = "/createImg", method = RequestMethod.POST)
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "jsonData", value = "json数据", dataType = "String"),
+            @ApiImplicitParam(name = "modelId", value = "模型id", dataType = "String")})
+    @NoAuthentication
+    @AroundLog(name = "生成封面图")
+    public Result createImg(Long modelId, String jsonData) throws Exception {
+
+        if (StrUtil.isEmpty(jsonData) || modelId == null) {
+            return Result.failure(CodeConstant.FAILURE_CODE_3001, CodeConstant.FAILURE_MSG_3001);
+        }
+
+        ComponentModelUploadEntity modelUploadEntity = componentModelUploadService.findById(modelId);
+        if (modelUploadEntity == null) {
+            return Result.failure(CodeConstant.FAILURE_CODE_4009, CodeConstant.FAILURE_MSG_4009);
+        }
+
+        modelUploadEntity.setThumStatus(0);
+
+        rabbitTemplate.convertAndSend(TopicRabbitConfig.TOPICE, TopicRabbitConfig.LIGHT,
+                modelUploadEntity.getFileId() + ":;" + modelUploadEntity.getUserId() + ":;" +
+                        modelUploadEntity.getId() + ":;" + jsonData + ":;modelPreview"+":;"+3);
+
+        componentModelUploadService.updateById(modelUploadEntity);
+        return Result.success();
+    }
+
+
+    /**
+     * 上传模型文件
+     *
+     * @param file
+     * @return
+     */
+    @ApiOperation("上传模型文件")
+    @RequestMapping(value = "/uploadModel", method = RequestMethod.POST)
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "userId", value = "用户id", dataType = "String"),
+            @ApiImplicitParam(name = "userType", value = "0管理员,1普通用户", dataType = "String"),
+            @ApiImplicitParam(name = "file", value = "文件", dataType = "MultipartFile")})
+    @NoAuthentication
+    @AroundLog(name = "上传模型文件")
+    public Result uploadModel(HttpServletRequest request, @RequestParam("file") MultipartFile file) throws Exception {
+
+        String userId = request.getParameter("userId");
+        String userType = request.getParameter("userType");
+
+        if (StrUtil.isEmpty(userId) || StrUtil.isEmpty(userType) || file.isEmpty()) {
+            return Result.failure(CodeConstant.FAILURE_CODE_3001, CodeConstant.FAILURE_MSG_3001);
+        }
+
+        String fileId = null;
+        ModelUploadEntity modelUploadEntity = null;
+        ComponentModelUploadEntity componentModelUploadEntity =null;
+        do {
+            fileId = RandomUtil.generateShortUuid();
+            modelUploadEntity = modelUploadService.findByFileId(fileId);
+            componentModelUploadEntity= componentModelUploadService.findByFileId(fileId);
+
+        } while (modelUploadEntity != null&&componentModelUploadEntity!=null);
+
+
+        componentModelUploadEntity = new ComponentModelUploadEntity();
+        componentModelUploadEntity.setUserId(Long.valueOf(userId));
+        componentModelUploadEntity.setFileId(fileId);
+        componentModelUploadEntity.setUserType(Integer.valueOf(userType));
+        componentModelUploadEntity.setStatus(0);
+        componentModelUploadEntity.setFileType(1);
+        componentModelUploadEntity.setUploadFile(file.getOriginalFilename());
+
+        String path = buildPath + "upload";
+        File targetFile = new File(path);
+        if (!targetFile.exists()) {
+            targetFile.mkdirs();
+        }
+
+        String filePath = path + File.separator + fileId + File.separator;
+        targetFile = new File(filePath + file.getOriginalFilename());
+        if (!targetFile.getParentFile().exists()) {
+            targetFile.getParentFile().mkdirs();
+        }
+        if (targetFile.exists()) {
+            FileUtils.deleteFile(filePath + file.getOriginalFilename());
+        }
+        file.transferTo(targetFile);
+
+
+        if (!file.getOriginalFilename().toLowerCase().endsWith(".zip") && !file.getOriginalFilename().toLowerCase().endsWith(".rar")) {
+            return Result.failure(CodeConstant.FAILURE_CODE_4012, CodeConstant.FAILURE_MSG_4012);
+        }
+        if (file.getOriginalFilename().toLowerCase().endsWith(".zip")) {
+            CreateObjUtil.unZip(filePath + file.getOriginalFilename(), filePath);
+        }
+        if (file.getOriginalFilename().toLowerCase().endsWith(".rar")) {
+            CreateObjUtil.unRar(filePath + file.getOriginalFilename(), filePath);
+        }
+
+        List<String> allList = new ArrayList<>();
+        FileUtils.readfilePath(filePath, allList);
+
+        File target = null;
+
+        String modelType = "datasmith";
+
+        boolean falg = true;
+        for (String targetPath : allList) {
+            log.info("解压后的-{}文件全路径是-{}", fileId, targetPath);
+            if (targetPath.toLowerCase().endsWith(".max")) {
+                falg = false;
+                new File(targetPath).renameTo(new File(targetPath.substring(
+                        0, targetPath.lastIndexOf(File.separator) + 1) + fileId + ".max"));
+                break;
+            }
+        }
+
+        if (falg) {
+            log.error("上传的数据类型不正确-{}", fileId);
+            return Result.failure(CodeConstant.FAILURE_CODE_4013, CodeConstant.FAILURE_MSG_4013);
+        }
+
+        componentModelUploadService.save(componentModelUploadEntity);
+
+
+        rabbitTemplate.convertAndSend(TopicRabbitConfig.TOPICE, TopicRabbitConfig.MODEL, componentModelUploadEntity.getId() + ":;" + fileId + ":;" + userId + ":;" + modelType + ":;" + "false"+":;" +"3");
+
+        return Result.success(componentModelUploadEntity);
+    }
+
+    /**
+     * 修改模型详情(编辑,是否显示,删除)
+     *
+     * @return
+     */
+    @ApiOperation("修改模型详情(编辑,是否显示,删除)")
+    @RequestMapping(value = "/updateModelDetail", method = RequestMethod.POST)
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "RequestRenovationPartsDetailManager", value = "json对象里面的参数", dataType = "String")})
+    @NoAuthentication
+    @AroundLog(name = "修改模型详情(编辑,是否显示,删除)")
+    public Result updateModelDetail(@RequestBody RequestComponet param) {
+        if (param.getId() == null) {
+            return Result.failure(CodeConstant.FAILURE_CODE_3001, CodeConstant.FAILURE_MSG_3001);
+        }
+        CustomComponentEntity entity = customComponentService.findById(param.getId());
+        if (ObjectUtil.isNull(entity)) {
+            return Result.failure(1, "模型不存在");
+        }
+        entity.setIsShow(param.getIsShow());
+
+        if (ObjectUtil.isNotNull(param.getRecStatus()) && param.getRecStatus().equals("I")) {
+            Boolean removeFlag = customComponentService.removeById(entity.getId());
+            return Result.success(removeFlag);
+        } else {
+            Boolean updateFlag = customComponentService.updateById(entity);
+            return Result.success(updateFlag);
+        }
+
+    }
+
+    /**
+     * 保存或者修改
+     *
+     * @param param
+     * @return
+     */
+    @ApiOperation("保存或者修改")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "主键id", dataType = "Int"),
+    })
+    @RequestMapping(value = "/saveOrUpdate", method = RequestMethod.POST)
+    @NoAuthentication
+    @AroundLog(name = "保存或者修改模型方案")
+    public Result saveOrUpdate(@RequestBody RequestModelComponentSaveModel param) throws Exception {
+
+        return componentModelUploadService.saveOrUpdateCustomUpload(param);
+    }
+
+    /**
+     * 获取模型列表
+     *
+     * @return
+     */
+    @ApiOperation("获取模型列表")
+    @RequestMapping(value = "/findModelList", method = RequestMethod.POST)
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "userId", value = "用户id", dataType = "String"),
+            @ApiImplicitParam(name = "userName", value = "userName", dataType = "String"),
+            @ApiImplicitParam(name = "pageNum", value = "页码", dataType = "String"),
+            @ApiImplicitParam(name = "pageSize", value = "页数", dataType = "String"),
+            @ApiImplicitParam(name = "name", value = "模型名称", dataType = "String")})
+    @NoAuthentication
+    @AroundLog(name = "获取模型列表")
+    public Result findModelList(@RequestBody RequestCustomComponent param) {
+
+        if (param.getUserId() == null) {
+            return Result.failure(CodeConstant.FAILURE_CODE_3001, CodeConstant.FAILURE_MSG_3001);
+        }
+        if ("88888888888".equals(param.getUserName())) {
+            param.setUserId(null);
+        }
+        param.setOrderBy("id");
+        PageInfo<CustomComponentEntity> pageInfos = customComponentService.listByPage(param);
+        List<ResponseComponentManager> managers = new LinkedList<>();
+
+        for (CustomComponentEntity componentEntity : pageInfos.getList()) {
+            ResponseComponentManager manager = new ResponseComponentManager();
+            BeanUtil.copyProperties(componentEntity, manager, false);
+            CustomComponentClassifyEntity customComponentClassifyEntity = componentClassifyService.findById(componentEntity.getComponentTypeId());
+            manager.setTypeName(customComponentClassifyEntity.getName());
+            managers.add(manager);
+        }
+
+        Page<ResponseComponentManager> a = new Page<>(param.getPageNum(), param.getPageSize());
+        a.setTotal(pageInfos.getTotal());
+        PageInfo<ResponseComponentManager> result = a.toPageInfo();
+        result.setList(managers);
+        return Result.success(result);
+    }
+}

+ 217 - 29
sxz-core/src/main/java/com/fdkk/sxz/webApi/controller/custom/CustomManagerController.java

@@ -1,29 +1,32 @@
 package com.fdkk.sxz.webApi.controller.custom;
 
 import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.StrUtil;
+import com.alibaba.fastjson.JSONArray;
 import com.fdkk.sxz.annotation.auth.NoAuthentication;
 import com.fdkk.sxz.annotation.log.AroundLog;
 import com.fdkk.sxz.base.BaseController;
 import com.fdkk.sxz.base.Result;
 import com.fdkk.sxz.constant.CodeConstant;
-import com.fdkk.sxz.entity.ModelUploadEntity;
-import com.fdkk.sxz.entity.SceneLightStyleEntity;
+import com.fdkk.sxz.entity.*;
+import com.fdkk.sxz.entity.custuom.CustomComponentEntity;
 import com.fdkk.sxz.entity.custuom.CustomProductEntity;
 import com.fdkk.sxz.entity.custuom.CustomProductFirstclassifyEntity;
 import com.fdkk.sxz.other.mq.TopicRabbitConfig;
 import com.fdkk.sxz.util.CreateObjUtil;
 import com.fdkk.sxz.util.FileUtils;
 import com.fdkk.sxz.util.RandomUtil;
+import com.fdkk.sxz.util.UploadToOssUtil;
 import com.fdkk.sxz.vo.request.RequestCustomProduct;
-import com.fdkk.sxz.vo.request.RequestSceneLightStyle;
-import com.fdkk.sxz.vo.response.ResponseCustomProductManager;
-import com.fdkk.sxz.vo.response.ResponseRenovationPartsDetailManager;
+import com.fdkk.sxz.vo.request.RequestModelCustomUpload;
+import com.fdkk.sxz.vo.request.RequestRenovationPartsDetailManager;
+import com.fdkk.sxz.vo.response.*;
+import com.fdkk.sxz.webApi.service.IComponentModelUploadService;
 import com.fdkk.sxz.webApi.service.IModelUploadService;
 import com.fdkk.sxz.webApi.service.custom.*;
 import com.github.pagehelper.Page;
 import com.github.pagehelper.PageInfo;
-import com.github.pagehelper.util.StringUtil;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
@@ -77,8 +80,127 @@ public class CustomManagerController extends BaseController {
     @Autowired
     private IModelUploadService modelUploadService;
 
+    @Autowired
+    private UploadToOssUtil uploadToOssUtil;
+    @Autowired
+    private IComponentModelUploadService componentModelUploadService;
+    @Value("${prefix.ali}")
+    private String prefix;
+
+
+
+    /**
+     * 生成封面图
+     *
+     * @return
+     */
+    @ApiOperation("生成封面图")
+    @RequestMapping(value = "/createImg", method = RequestMethod.POST)
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "jsonData", value = "json数据", dataType = "String"),
+            @ApiImplicitParam(name = "modelId", value = "模型id", dataType = "String")})
+    @NoAuthentication
+    @AroundLog(name = "生成封面图")
+    public Result createImg(Long modelId, String jsonData) throws Exception {
+
+        if (StrUtil.isEmpty(jsonData) || modelId == null) {
+            return Result.failure(CodeConstant.FAILURE_CODE_3001, CodeConstant.FAILURE_MSG_3001);
+        }
+
+        ModelUploadEntity modelUploadEntity = modelUploadService.findById(modelId);
+        if (modelUploadEntity == null) {
+            return Result.failure(CodeConstant.FAILURE_CODE_4009, CodeConstant.FAILURE_MSG_4009);
+        }
+
+        modelUploadEntity.setThumStatus(0);
+
+        rabbitTemplate.convertAndSend(TopicRabbitConfig.TOPICE, TopicRabbitConfig.LIGHT,
+                modelUploadEntity.getFileId() + ":;" + modelUploadEntity.getUserId() + ":;" +
+                        modelUploadEntity.getId() + ":;" + jsonData + ":;customFurniturePreview:;"+2);
+
+        modelUploadService.updateById(modelUploadEntity);
+        return Result.success();
+    }
+
+
+
+    /**
+     * 更新模型审核状态
+     *
+     * @return
+     */
+    @ApiOperation("更新模型审核状态")
+    @RequestMapping(value = "/updatePartsDetailExamine", method = RequestMethod.POST)
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "模型id", dataType = "String"),
+            @ApiImplicitParam(name = "examine", value = "审核,0审核中,1审核通过,-1审核失败", dataType = "String")})
+    @NoAuthentication
+    @AroundLog(name = "更新模型审核状态")
+    public Result updatePartsDetailExamine(@RequestBody RequestRenovationPartsDetailManager param) {
+        if (param.getId() == null || param.getExamine() == null) {
+            return Result.failure(CodeConstant.FAILURE_CODE_3001, CodeConstant.FAILURE_MSG_3001);
+        }
+
+        CustomProductEntity customProductEntity = productService.findById(param.getId());
+        customProductEntity.setId(param.getId());
+        customProductEntity.setExamine(param.getExamine());
+        customProductEntity.setExamineTime(new Date());
+        if (param.getExamine().intValue() == 1) {
+//            uploadToOssUtil.copyTo4dTjw(customProductEntity.getThumbnailSrc().replace(prefix, ""),
+//                    customProductEntity.getThumbnailSrc().replace("/temp/", "/models/").replace(prefix, ""));
+//            uploadToOssUtil.deleteTo4dTjw(customProductEntity.getThumbnailSrc().replace(prefix, ""));
+//            customProductEntity.setThumbnailSrc(customProductEntity.getThumbnailSrc().replace("/temp/", "/models/"));
+        }
+        boolean updateFlag = productService.updateById(customProductEntity);
+
+        if (updateFlag && ObjectUtil.isNotNull(customProductEntity.getComponentTypeIds())) {
+            List<ResponseCustomComponent> responseCustomComponents = new ArrayList<>();
+            JSONArray components = JSONArray.parseArray(customProductEntity.getComponentTypeIds());
+            //获取每个配件加入集合
+            components.forEach(c -> {
+                Long id = Long.valueOf((String) c);
+                CustomComponentEntity componentEntity = customComponentService.findById(id);
+                if (ObjectUtil.isNotNull(componentEntity)) {
+//                    uploadToOssUtil.copyTo4dTjw(componentEntity.getThumbnailSrc().replace(prefix, ""),
+//                            componentEntity.getThumbnailSrc().replace("/temp/", "/models/").replace(prefix, ""));
+//                    uploadToOssUtil.copyTo4dTjw(componentEntity.getTemplate().replace(prefix, ""),
+//                            componentEntity.getTemplate().replace("/temp/", "/models/").replace(prefix, ""));
+//                    uploadToOssUtil.deleteTo4dTjw(componentEntity.getThumbnailSrc().replace(prefix, ""));
+//                    uploadToOssUtil.deleteTo4dTjw(componentEntity.getTemplate().replace(prefix, ""));
+//                    componentEntity.setThumbnailSrc(componentEntity.getThumbnailSrc().replace("/temp/", "/models/"));
+//                    componentEntity.setTemplate(componentEntity.getTemplate().replace("/temp/", "/models/"));
+                    componentEntity.setExamine(param.getExamine());
+                    componentEntity.setExamineTime(new Date());
+                    customComponentService.updateById(componentEntity);
+                }
+            });
+        }
+
+        return Result.success();
+    }
+
+    /**
+     * 通过id查询上传模型进度
+     *
+     * @param param
+     * @return
+     */
+    @ApiOperation("通过id查询上传模型进度")
+    @RequestMapping(value = "/findUploadModelById", method = RequestMethod.POST)
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "模型id", dataType = "String")})
+    @NoAuthentication
+    public Result findUploadModelById(@RequestBody RequestRenovationPartsDetailManager param) {
+        if (param.getId() == null) {
+            return Result.failure(CodeConstant.FAILURE_CODE_3001, CodeConstant.FAILURE_MSG_3001);
+        }
+
+        return Result.success(modelUploadService.findCustom(param.getId()));
+    }
+
     /**
      * 上传模型文件
+     *
      * @param file
      * @return
      */
@@ -90,21 +212,24 @@ public class CustomManagerController extends BaseController {
             @ApiImplicitParam(name = "file", value = "文件", dataType = "MultipartFile")})
     @NoAuthentication
     @AroundLog(name = "上传模型文件")
-    public Result uploadModel(HttpServletRequest request, @RequestParam("file") MultipartFile file) throws Exception{
+    public Result uploadModel(HttpServletRequest request, @RequestParam("file") MultipartFile file) throws Exception {
 
         String userId = request.getParameter("userId");
         String userType = request.getParameter("userType");
 
-        if (StrUtil.isEmpty(userId) || StrUtil.isEmpty(userType) || file.isEmpty()){
+        if (StrUtil.isEmpty(userId) || StrUtil.isEmpty(userType) || file.isEmpty()) {
             return Result.failure(CodeConstant.FAILURE_CODE_3001, CodeConstant.FAILURE_MSG_3001);
         }
 
         String fileId = null;
         ModelUploadEntity modelUploadEntity = null;
-        do{
+        ComponentModelUploadEntity componentModelUploadEntity =null;
+        do {
             fileId = RandomUtil.generateShortUuid();
             modelUploadEntity = modelUploadService.findByFileId(fileId);
-        } while (modelUploadEntity != null);
+            componentModelUploadEntity= componentModelUploadService.findByFileId(fileId);
+
+        } while (modelUploadEntity != null&&componentModelUploadEntity!=null);
 
         modelUploadEntity = new ModelUploadEntity();
         modelUploadEntity.setUserId(Long.valueOf(userId));
@@ -116,28 +241,28 @@ public class CustomManagerController extends BaseController {
 
         String path = buildPath + "upload";
         File targetFile = new File(path);
-        if (!targetFile.exists()){
+        if (!targetFile.exists()) {
             targetFile.mkdirs();
         }
 
         String filePath = path + File.separator + fileId + File.separator;
         targetFile = new File(filePath + file.getOriginalFilename());
-        if(!targetFile.getParentFile().exists()){
+        if (!targetFile.getParentFile().exists()) {
             targetFile.getParentFile().mkdirs();
         }
-        if (targetFile.exists()){
+        if (targetFile.exists()) {
             FileUtils.deleteFile(filePath + file.getOriginalFilename());
         }
         file.transferTo(targetFile);
 
 
-        if(!file.getOriginalFilename().toLowerCase().endsWith(".zip") && !file.getOriginalFilename().toLowerCase().endsWith(".rar")){
+        if (!file.getOriginalFilename().toLowerCase().endsWith(".zip") && !file.getOriginalFilename().toLowerCase().endsWith(".rar")) {
             return Result.failure(CodeConstant.FAILURE_CODE_4012, CodeConstant.FAILURE_MSG_4012);
         }
-        if(file.getOriginalFilename().toLowerCase().endsWith(".zip")){
+        if (file.getOriginalFilename().toLowerCase().endsWith(".zip")) {
             CreateObjUtil.unZip(filePath + file.getOriginalFilename(), filePath);
         }
-        if(file.getOriginalFilename().toLowerCase().endsWith(".rar")){
+        if (file.getOriginalFilename().toLowerCase().endsWith(".rar")) {
             CreateObjUtil.unRar(filePath + file.getOriginalFilename(), filePath);
         }
 
@@ -151,7 +276,7 @@ public class CustomManagerController extends BaseController {
         boolean falg = true;
         for (String targetPath : allList) {
             log.info("解压后的-{}文件全路径是-{}", fileId, targetPath);
-            if(targetPath.toLowerCase().endsWith(".max")){
+            if (targetPath.toLowerCase().endsWith(".max")) {
                 falg = false;
                 new File(targetPath).renameTo(new File(targetPath.substring(
                         0, targetPath.lastIndexOf(File.separator) + 1) + fileId + ".max"));
@@ -159,7 +284,7 @@ public class CustomManagerController extends BaseController {
             }
         }
 
-        if(falg){
+        if (falg) {
             log.error("上传的数据类型不正确-{}", fileId);
             return Result.failure(CodeConstant.FAILURE_CODE_4013, CodeConstant.FAILURE_MSG_4013);
         }
@@ -167,12 +292,69 @@ public class CustomManagerController extends BaseController {
         modelUploadService.save(modelUploadEntity);
 
 
-        rabbitTemplate.convertAndSend(TopicRabbitConfig.TOPICE, TopicRabbitConfig.MODEL, modelUploadEntity.getId() + ":;" + fileId + ":;" + userId + ":;" + modelType+ ":;" +"true");
+        rabbitTemplate.convertAndSend(TopicRabbitConfig.TOPICE, TopicRabbitConfig.MODEL, modelUploadEntity.getId() + ":;" + fileId + ":;" + userId + ":;" + modelType + ":;" + "true"+":;" +"2");
 
         return Result.success(modelUploadEntity);
     }
+
+    /**
+     * 修改模型详情(编辑,是否显示,删除)
+     *
+     * @return
+     */
+    @ApiOperation("修改模型详情(编辑,是否显示,删除)")
+    @RequestMapping(value = "/updateModelDetail", method = RequestMethod.POST)
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "RequestRenovationPartsDetailManager", value = "json对象里面的参数", dataType = "String")})
+    @NoAuthentication
+    @AroundLog(name = "修改模型详情(编辑,是否显示,删除)")
+    public Result updateModelDetail(@RequestBody RequestCustomProduct param) {
+        if (param.getId() == null) {
+            return Result.failure(CodeConstant.FAILURE_CODE_3001, CodeConstant.FAILURE_MSG_3001);
+        }
+        CustomProductEntity entity = productService.findById(param.getId());
+        if (ObjectUtil.isNull(entity)) {
+            return Result.failure(1, "模型不存在");
+        }
+        entity.setIsShow(param.getIsShow());
+
+        if (ObjectUtil.isNotNull(param.getRecStatus()) && param.getRecStatus().equals("I")) {
+            Boolean removeFlag = productService.removeById(entity.getId());
+            if (removeFlag && ObjectUtil.isNotNull(entity.getComponentTypeIds())) {
+                List<ResponseCustomComponent> responseCustomComponents = new ArrayList<>();
+                JSONArray components = JSONArray.parseArray(entity.getComponentTypeIds());
+                //获取每个配件加入集合
+                components.forEach(c -> {
+                    Long id = Long.valueOf((String) c);
+                    CustomComponentEntity componentEntity = customComponentService.findById(id);
+                    if (ObjectUtil.isNotNull(componentEntity)) {
+                        customComponentService.removeById(id);
+                    }
+                });
+            }
+        } else {
+            Boolean updateFlag = productService.updateById(entity);
+            if (updateFlag && ObjectUtil.isNotNull(entity.getComponentTypeIds())) {
+                List<ResponseCustomComponent> responseCustomComponents = new ArrayList<>();
+                JSONArray components = JSONArray.parseArray(entity.getComponentTypeIds());
+                //获取每个配件加入集合
+                components.forEach(c -> {
+                    Long id = Long.valueOf((String) c);
+                    CustomComponentEntity componentEntity = customComponentService.findById(id);
+                    if (ObjectUtil.isNotNull(componentEntity)) {
+                        componentEntity.setIsShow(param.getIsShow());
+                        customComponentService.updateById(componentEntity);
+                    }
+                });
+            }
+        }
+
+        return Result.success();
+    }
+
     /**
      * 保存或者修改
+     *
      * @param param
      * @return
      */
@@ -183,13 +365,14 @@ public class CustomManagerController extends BaseController {
     @RequestMapping(value = "/saveOrUpdate", method = RequestMethod.POST)
     @NoAuthentication
     @AroundLog(name = "保存或者修改模型方案")
-    public Result saveOrUpdate(@RequestBody RequestCustomProduct param){
+    public Result saveOrUpdate(@RequestBody RequestModelCustomUpload param) throws Exception {
 
-        return Result.success();
+        return modelUploadService.saveOrUpdateCustomUpload(param);
     }
 
     /**
      * 获取模型列表
+     *
      * @return
      */
     @ApiOperation("获取模型列表")
@@ -204,31 +387,34 @@ public class CustomManagerController extends BaseController {
     @AroundLog(name = "获取模型列表")
     public Result findModelList(@RequestBody RequestCustomProduct param) {
 
-        if (param.getUserId() == null){
+        if (param.getUserId() == null) {
             return Result.failure(CodeConstant.FAILURE_CODE_3001, CodeConstant.FAILURE_MSG_3001);
         }
-        if("88888888888".equals(param.getUserName())){
+        if ("88888888888".equals(param.getUserName())) {
             param.setUserId(null);
         }
-
-        PageInfo<CustomProductEntity> pageInfos= productService.listByPage(param);
-        List<ResponseCustomProductManager> managers=new LinkedList<>();
+        PageInfo<CustomProductEntity> pageInfos = productService.listByPage(param);
+        List<ResponseCustomProductManager> managers = new LinkedList<>();
 
         for (CustomProductEntity customProductEntity : pageInfos.getList()) {
-            ResponseCustomProductManager manager=new ResponseCustomProductManager();
-            BeanUtil.copyProperties(customProductEntity,manager, false);
-            CustomProductFirstclassifyEntity firstclassifyEntity=productFirstclassifyService.findById(customProductEntity.getParentId());
+            ResponseCustomProductManager manager = new ResponseCustomProductManager();
+            BeanUtil.copyProperties(customProductEntity, manager, false);
+            CustomProductFirstclassifyEntity firstclassifyEntity = productFirstclassifyService.findById(customProductEntity.getParentId());
+            manager.setModelId(customProductEntity.getModelId());
             manager.setTypeName(firstclassifyEntity.getName());
             managers.add(manager);
         }
+
         Page<ResponseCustomProductManager> a = new Page<>(param.getPageNum(), param.getPageSize());
         a.setTotal(pageInfos.getTotal());
         PageInfo<ResponseCustomProductManager> result = a.toPageInfo();
         result.setList(managers);
         return Result.success(result);
     }
+
     /**
      * 获取定制家具配件类型
+     *
      * @return
      */
     @ApiOperation("获取定制家具产品类型")
@@ -238,8 +424,10 @@ public class CustomManagerController extends BaseController {
 
         return Result.success(productFirstclassifyService.list());
     }
+
     /**
      * 获取定制家具配件类型
+     *
      * @return
      */
     @ApiOperation("获取定制家具配件类型")

+ 38 - 0
sxz-core/src/main/java/com/fdkk/sxz/webApi/controller/testController.java

@@ -1,19 +1,25 @@
 package com.fdkk.sxz.webApi.controller;
 
+import cn.hutool.core.collection.CollUtil;
 import com.fdkk.sxz.base.BaseController;
+import com.fdkk.sxz.entity.custuom.CustomProductFirstclassifyEntity;
 import com.fdkk.sxz.util.OkHttpUtils;
 import com.fdkk.sxz.util.RedisUtil;
 import com.fdkk.sxz.base.Result;
+import com.fdkk.sxz.webApi.service.custom.ICustomProductFirstclassifyService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
+import net.oschina.j2cache.CacheChannel;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.Arrays;
+
 @Slf4j
 @RestController
 @RequestMapping("/change")
@@ -23,6 +29,13 @@ public class testController extends BaseController {
     @Autowired
     private RedisUtil redisUtil;
 
+    @Autowired
+    private ICustomProductFirstclassifyService customProductFirstclassifyService;
+
+    @Autowired
+    private CacheChannel cacheChannel;
+
+
     /**
      * 测试redis
      *
@@ -39,7 +52,32 @@ public class testController extends BaseController {
         redisUtil.set(key, val);
         return success(redisUtil.get(key));
     }
+    /**
+     * 测试redis
+     *
+     * @param id
+     * @return
+     */
+    @ApiOperation("jetcache")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "key", value = "key", dataType = "String"),
+            @ApiImplicitParam(name = "val", value = "val", dataType = "String")})
+    @RequestMapping(value = "/jetcache", method = RequestMethod.POST)
+    public Result jetcache(Long id) {
+        CustomProductFirstclassifyEntity byId = customProductFirstclassifyService.findById(id);
+        byId.setName(byId.getName()+"1");
+        cacheChannel.get("CustomProductFirstclassifyEntity","3CustomProductFirstclassifyEntity");
+
 
+        CustomProductFirstclassifyEntity byId1 = customProductFirstclassifyService.findById(id+1);
+
+         customProductFirstclassifyService.updateById(byId);
+
+//        customProductFirstclassifyService.removeById(byId.getId());
+        cacheChannel.set("asd", "AAA",123);
+
+        return success(CollUtil.newArrayList(byId, byId1));
+    }
     /**
      * 测试redis
      *

+ 3 - 0
sxz-core/src/main/java/com/fdkk/sxz/webApi/mapper/IComponentModelUploadMapper.java

@@ -2,9 +2,12 @@ package com.fdkk.sxz.webApi.mapper;
 
 import com.fdkk.sxz.base.IBaseMapper;
 import com.fdkk.sxz.entity.ComponentModelUploadEntity;
+import org.apache.ibatis.annotations.Select;
 import org.springframework.stereotype.Component;
 import org.apache.ibatis.annotations.Mapper;
 
+import java.util.List;
+
 /**
  * @description: 模型上传管理 Model
  * @author: Xiewj

+ 1 - 1
sxz-core/src/main/java/com/fdkk/sxz/webApi/mapper/IModelUploadMapper.java

@@ -36,7 +36,7 @@ public interface IModelUploadMapper extends IBaseMapper<ModelUploadEntity> {
             " and user_id = #{userId} " +
             "</if> " +
             "<if test= 'fileType != null'> " +
-            " and file_type = #{userId} " +
+            " and file_type = #{fileType} " +
             "</if> " +
 
             "</script>")

+ 15 - 0
sxz-core/src/main/java/com/fdkk/sxz/webApi/service/IComponentModelUploadService.java

@@ -1,7 +1,14 @@
 package com.fdkk.sxz.webApi.service;
 
 import com.fdkk.sxz.base.IBaseService;
+import com.fdkk.sxz.base.Result;
 import com.fdkk.sxz.entity.ComponentModelUploadEntity;
+import com.fdkk.sxz.entity.ModelUploadEntity;
+import com.fdkk.sxz.vo.request.RequestModelComponentSaveModel;
+import com.fdkk.sxz.vo.request.RequestModelCustomUpload;
+import com.fdkk.sxz.vo.response.ResponseModelComponent;
+
+import java.util.List;
 
 
 /**
@@ -12,5 +19,13 @@ import com.fdkk.sxz.entity.ComponentModelUploadEntity;
 public interface IComponentModelUploadService extends IBaseService<ComponentModelUploadEntity> {
 
 
+    List<ComponentModelUploadEntity> findPartsModelUploadId(Long id);
+
+    ComponentModelUploadEntity findByFileId(String fileId);
+
+    Result saveOrUpdateCustomUpload(RequestModelComponentSaveModel param) throws Exception;
+
+    List<ComponentModelUploadEntity> findIsNotPartsDetailId(Long userId, Integer fileType);
 
+    ResponseModelComponent findComponent(Long id);
 }

+ 18 - 1
sxz-core/src/main/java/com/fdkk/sxz/webApi/service/IModelUploadService.java

@@ -1,8 +1,11 @@
 package com.fdkk.sxz.webApi.service;
 
 import com.fdkk.sxz.base.IBaseService;
+import com.fdkk.sxz.base.Result;
 import com.fdkk.sxz.entity.ModelUploadEntity;
-import io.swagger.models.auth.In;
+import com.fdkk.sxz.entity.custuom.CustomProductFirstclassifyEntity;
+import com.fdkk.sxz.vo.request.RequestModelCustomUpload;
+import com.fdkk.sxz.vo.response.ResponseModelCustom;
 
 import java.util.List;
 
@@ -17,4 +20,18 @@ public interface IModelUploadService extends IBaseService<ModelUploadEntity> {
 
     List<ModelUploadEntity> findIsNotPartsDetailId(Long userId, Integer fileType);
 
+    ResponseModelCustom findCustom(Long id);
+
+    Result saveOrUpdateCustomUpload(RequestModelCustomUpload param) throws Exception;
+
+
+    ModelUploadEntity findById(Long id);
+
+    boolean updateById(ModelUploadEntity entity) ;
+
+    boolean removeById(Long id) ;
+
+
+
+
 }

+ 10 - 1
sxz-core/src/main/java/com/fdkk/sxz/webApi/service/custom/ICustomComponentService.java

@@ -4,6 +4,7 @@ import com.fdkk.sxz.base.IBaseService;
 import com.fdkk.sxz.entity.custuom.CustomComponentEntity;
 import com.fdkk.sxz.vo.request.RequestCustom;
 import com.fdkk.sxz.vo.request.RequestCustomComponent;
+import com.fdkk.sxz.vo.response.ResponseCustomComponent;
 import com.github.pagehelper.PageInfo;
 
 import java.util.List;
@@ -22,5 +23,13 @@ public interface ICustomComponentService extends IBaseService<CustomComponentEnt
 
   List<CustomComponentEntity> list(RequestCustomComponent param);
 
-  List<CustomComponentEntity> findComponentByParentId(RequestCustom param);
+
+  CustomComponentEntity findByFileId(String FileId);
+
+
+  List<ResponseCustomComponent>  findComponentByParentId(RequestCustom param);
+
+
+
+
 }

+ 8 - 0
sxz-core/src/main/java/com/fdkk/sxz/webApi/service/custom/ICustomProductFirstclassifyService.java

@@ -7,6 +7,9 @@ import com.fdkk.sxz.base.RequestBase;
 import com.fdkk.sxz.entity.custuom.CustomProductFirstclassifyEntity;
 import com.fdkk.sxz.vo.request.RequestCustomProductFirstclassify;
 import com.github.pagehelper.PageInfo;
+import org.springframework.cache.annotation.Cacheable;
+
+import java.io.Serializable;
 
 /**
  * @description: CustomProductFirstclassify 相关的服务接口类
@@ -20,7 +23,12 @@ public interface ICustomProductFirstclassifyService extends IBaseService<CustomP
 
     PageInfo<CustomProductFirstclassifyEntity> listByPage(RequestCustomProductFirstclassify param);
 
+
+
     CustomProductFirstclassifyEntity findById(Long id);
 
+    @Override
+    boolean updateById(CustomProductFirstclassifyEntity entity) ;
 
+    boolean removeById(Long id) ;
 }

+ 35 - 7
sxz-core/src/main/java/com/fdkk/sxz/webApi/service/custom/impl/CustomComponentServiceImpl.java

@@ -1,23 +1,25 @@
 package com.fdkk.sxz.webApi.service.custom.impl;
 
 import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fdkk.sxz.base.impl.BaseServiceImpl;
 import com.fdkk.sxz.entity.custuom.CustomComponentEntity;
+import com.fdkk.sxz.entity.custuom.CustomProductEntity;
 import com.fdkk.sxz.vo.request.RequestCustom;
 import com.fdkk.sxz.vo.request.RequestCustomComponent;
+import com.fdkk.sxz.vo.response.ResponseCustomComponent;
+import com.fdkk.sxz.vo.response.ResponseCustomProduct;
 import com.fdkk.sxz.webApi.mapper.custom.ICustomComponentMapper;
 import com.fdkk.sxz.webApi.service.custom.ICustomComponentService;
 import com.github.pagehelper.PageInfo;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
 
 import java.util.List;
+import java.util.stream.Collectors;
 
 /**
  * @description: CustomComponent 相关的服务实现类
@@ -35,26 +37,52 @@ public class CustomComponentServiceImpl extends BaseServiceImpl<ICustomComponent
     @Override
     public PageInfo<CustomComponentEntity> listByPage(RequestCustomComponent param) {
             LambdaQueryWrapper<CustomComponentEntity> wrapper =  Wrappers.lambdaQuery();
+        if (ObjectUtil.isNotNull(param.getName())&& StrUtil.isNotEmpty(param.getName())){
+            wrapper.like(CustomComponentEntity::getName,param.getName());
+        }
+        if (ObjectUtil.isNotNull(param.getUserId())){
+            wrapper.eq(CustomComponentEntity::getUserId,param.getUserId());
+        }
+        param.setOrderBy("create_time");
+        param.setSortBy("desc");
             return super.listByPage(param,wrapper);
     }
 
 
     @Override
+    public CustomComponentEntity findByFileId(String FileId) {
+        LambdaQueryWrapper<CustomComponentEntity> wrapper =  Wrappers.lambdaQuery();
+        if (ObjectUtil.isNotNull(FileId)&&StrUtil.isNotEmpty(FileId)){
+            wrapper.in(CustomComponentEntity::getFileId,FileId);
+        }
+        return getOne(wrapper);
+    }
+
+    @Override
     public List<CustomComponentEntity> list(RequestCustomComponent param) {
         LambdaQueryWrapper<CustomComponentEntity> wrapper =  Wrappers.lambdaQuery();
         if (ObjectUtil.isNotNull(param.getIds())){
             wrapper.in(CustomComponentEntity::getId,param.getIds());
         }
+        if (ObjectUtil.isNotNull(param.getModelId())){
+            wrapper.in(CustomComponentEntity::getModelId,param.getModelId());
+        }
         return list(wrapper);
     }
 
 
     @Override
-    public List<CustomComponentEntity> findComponentByParentId(RequestCustom param) {
+    public List<ResponseCustomComponent> findComponentByParentId(RequestCustom param) {
         LambdaQueryWrapper<CustomComponentEntity> wrapper =  Wrappers.lambdaQuery();
         if (ObjectUtil.isNotNull(param.getParentId())){
-            wrapper.eq(CustomComponentEntity::getParentId,param.getParentId());
+            wrapper.eq(CustomComponentEntity::getComponentTypeId,param.getParentId());
         }
-        return list(wrapper);
+        wrapper.eq(CustomComponentEntity::getIsShow,1);
+        return list(wrapper).stream().map(a ->{
+            ResponseCustomComponent customComponent=new ResponseCustomComponent();
+            BeanUtils.copyProperties(a, customComponent);
+            customComponent.setType("component");
+            return customComponent;
+        }).collect(Collectors.toList());
     }
 }

+ 30 - 5
sxz-core/src/main/java/com/fdkk/sxz/webApi/service/custom/impl/CustomProductFirstclassifyServiceImpl.java

@@ -1,5 +1,6 @@
 package com.fdkk.sxz.webApi.service.custom.impl;
 
+import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.util.ObjectUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
@@ -17,10 +18,15 @@ import com.fdkk.sxz.vo.request.RequestCustomProductFirstclassify;
 import com.fdkk.sxz.webApi.mapper.custom.ICustomProductFirstclassifyMapper;
 import com.fdkk.sxz.webApi.service.custom.ICustomProductFirstclassifyService;
 import com.github.pagehelper.PageInfo;
+import net.oschina.j2cache.CacheChannel;
+import net.oschina.j2cache.CacheObject;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.cache.annotation.CacheEvict;
+import org.springframework.cache.annotation.Cacheable;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.io.Serializable;
 import java.util.concurrent.TimeUnit;
 
 /**
@@ -32,7 +38,7 @@ import java.util.concurrent.TimeUnit;
 public class CustomProductFirstclassifyServiceImpl extends BaseServiceImpl<ICustomProductFirstclassifyMapper, CustomProductFirstclassifyEntity> implements ICustomProductFirstclassifyService {
 
     @Autowired
-    private RedisUtil redisUtil;
+    private CacheChannel cacheChannel;
 
 
 
@@ -45,17 +51,36 @@ public class CustomProductFirstclassifyServiceImpl extends BaseServiceImpl<ICust
 
 
     @Override
+    public boolean removeById(Long id) {
+        boolean removeById=super.removeById(id);
+        if (removeById){
+            cacheChannel.evict("CustomProductFirstclassifyEntity","id::"+id);
+        }
+        return removeById;
+    }
+
+    @Override
     public CustomProductFirstclassifyEntity findById(Long id) {
-        String key="firstclassifyEntity::" + id;
         CustomProductFirstclassifyEntity entity=null;
-        if (redisUtil.hasKey(key)) {
-           return JSONObject.parseObject(redisUtil.get(key), CustomProductFirstclassifyEntity.class);
+        if (cacheChannel.check("CustomProductFirstclassifyEntity","id::"+id) >0){
+            CacheObject cache= cacheChannel.get("CustomProductFirstclassifyEntity","id::"+id);
+            entity= BeanUtil.toBean(cache.getValue(),CustomProductFirstclassifyEntity.class);
         }else {
             entity=super.findById(id);
             if (ObjectUtil.isNotNull(entity)){
-                redisUtil.setEx(key, JSON.toJSONString(entity),10, TimeUnit.SECONDS);
+                cacheChannel.set("CustomProductFirstclassifyEntity","id::"+entity.getId(),entity,1800);
             }
         }
         return entity;
     }
+
+    @Override
+    public boolean updateById(CustomProductFirstclassifyEntity entity) {
+        boolean updateById=super.updateById(entity);
+        if (updateById){
+            cacheChannel.set("CustomProductFirstclassifyEntity","id::"+entity.getId(),entity,60*30  );
+        }
+        return updateById;
+    }
+
 }

+ 13 - 7
sxz-core/src/main/java/com/fdkk/sxz/webApi/service/custom/impl/CustomProductServiceImpl.java

@@ -52,11 +52,11 @@ public class CustomProductServiceImpl extends BaseServiceImpl<ICustomProductMapp
     @Override
     public PageInfo<CustomProductEntity> listByPage(RequestCustomProduct param) {
         LambdaQueryWrapper<CustomProductEntity> wrapper =  Wrappers.lambdaQuery();
-          if (ObjectUtil.isNotNull(param.getName())){
-              wrapper.eq(CustomProductEntity::getName,param.getName());
-          }
+        if (ObjectUtil.isNotNull(param.getName())&&StrUtil.isNotEmpty(param.getName())){
+              wrapper.like(CustomProductEntity::getName,param.getName());
+        }
         if (ObjectUtil.isNotNull(param.getUserId())){
-            wrapper.eq(CustomProductEntity::getUserId,param.getName());
+            wrapper.eq(CustomProductEntity::getUserId,param.getUserId());
         }
         param.setOrderBy("create_time");
         param.setSortBy("desc");
@@ -70,23 +70,29 @@ public class CustomProductServiceImpl extends BaseServiceImpl<ICustomProductMapp
           if (ObjectUtil.isNotNull(param.getParentId())){
               wrapper.eq(CustomProductEntity::getParentId,param.getParentId());
           }
+        wrapper.eq(CustomProductEntity::getIsShow,1);
         List<CustomProductEntity> list= this.list(wrapper);
         List<ResponseCustomProduct> bList = list.stream().map(a ->{
             //在此转把A转换为B
             ResponseCustomProduct responseCustomProduct = new ResponseCustomProduct();
             BeanUtils.copyProperties(a, responseCustomProduct);
+            responseCustomProduct.setType("product");
             //组装配件
             if (StrUtil.isNotEmpty(a.getComponentTypeIds())){
                 List<ResponseCustomComponent> responseCustomComponents= new ArrayList<>();
                 JSONArray components=JSONArray.parseArray(a.getComponentTypeIds());
                 //获取每个配件加入集合
                 components.forEach(c->{
-                    JSONObject data=(JSONObject)JSON.toJSON(c);
-                    CustomComponentEntity componentEntity= customComponentService.findById(data.getLong("id"));
+                    Long  id=Long.valueOf((String) c);
+                    CustomComponentEntity componentEntity= customComponentService.findById(id);
                     if (ObjectUtil.isNotNull(componentEntity)) {
                         ResponseCustomComponent responseCustomComponent = new ResponseCustomComponent();
                         BeanUtils.copyProperties(componentEntity, responseCustomComponent);
-                        responseCustomComponent.setOrigin(data.getJSONObject("origin"));
+                        JSONObject origin=new JSONObject();
+                        origin.put("x",componentEntity.getX());
+                        origin.put("y",componentEntity.getY());
+                        origin.put("z",componentEntity.getZ());
+                        responseCustomComponent.setOrigin(origin);
                         responseCustomComponents.add(responseCustomComponent);
                     }
                 });

+ 210 - 0
sxz-core/src/main/java/com/fdkk/sxz/webApi/service/impl/ComponentModelUploadServiceImpl.java

@@ -1,13 +1,43 @@
 package com.fdkk.sxz.webApi.service.impl;
 
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.StrUtil;
+import cn.hutool.json.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.fdkk.sxz.base.Result;
 import com.fdkk.sxz.base.impl.BaseServiceImpl;
 import com.fdkk.sxz.entity.ComponentModelUploadEntity;
+import com.fdkk.sxz.entity.ModelUploadEntity;
+import com.fdkk.sxz.entity.custuom.CustomComponentClassifyEntity;
+import com.fdkk.sxz.entity.custuom.CustomComponentEntity;
+import com.fdkk.sxz.entity.custuom.CustomProductEntity;
+import com.fdkk.sxz.entity.system.Organization;
+import com.fdkk.sxz.exception.BusinessException;
+import com.fdkk.sxz.util.CreateObjUtil;
+import com.fdkk.sxz.util.OkHttpUtils;
+import com.fdkk.sxz.util.SnowFlakeUUidUtils;
+import com.fdkk.sxz.util.UploadToOssUtil;
+import com.fdkk.sxz.vo.request.RequestModelComponentSaveModel;
+import com.fdkk.sxz.vo.request.RequestModelCustomUpload;
+import com.fdkk.sxz.vo.response.ResponseModelComponent;
+import com.fdkk.sxz.vo.response.ResponseModelCustom;
 import com.fdkk.sxz.webApi.mapper.IComponentModelUploadMapper;
 import com.fdkk.sxz.webApi.service.IComponentModelUploadService;
+import com.fdkk.sxz.webApi.service.custom.ICustomComponentService;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
+import java.sql.Wrapper;
 import java.util.Collection;
+import java.util.List;
 
 /**
  * @description: ComponentModelUpload 相关的服务实现类
@@ -15,10 +45,190 @@ import java.util.Collection;
  * @date: 2021-09-03 09:30:33
  **/
 @Service
+@Slf4j
 public class ComponentModelUploadServiceImpl extends BaseServiceImpl<IComponentModelUploadMapper, ComponentModelUploadEntity> implements IComponentModelUploadService {
 
     @Autowired
     private IComponentModelUploadMapper componentModelUploadMapper;
 
+    @Autowired
+    private ICustomComponentService customComponentService;
+
+    @Value("${server.file.location}")
+    private String buildPath;
+
+    @Value("${prefix.ali}")
+
+    private String prefix;
+    @Value("${build.url}")
+    private String buildUrl;
+
+    @Autowired
+    private UploadToOssUtil uploadToOssUtil;
+
+
+
+
+    @Override
+    public ResponseModelComponent findComponent(Long id) {
+        ComponentModelUploadEntity  componentModelUploadEntity= findById(id);
+
+        ResponseModelComponent responseModelComponent = new ResponseModelComponent();
+        responseModelComponent.setId(componentModelUploadEntity.getId());
+        responseModelComponent.setCreateTime(componentModelUploadEntity.getCreateTime());
+        responseModelComponent.setUserId(componentModelUploadEntity.getUserId());
+        responseModelComponent.setStatus(componentModelUploadEntity.getStatus());
+        responseModelComponent.setProgress(componentModelUploadEntity.getProgress());
+        responseModelComponent.setThumPath(componentModelUploadEntity.getThumPath());
+        responseModelComponent.setObjPath(componentModelUploadEntity.getObjPath());
+        responseModelComponent.setMtlPath(componentModelUploadEntity.getMtlPath());
+        responseModelComponent.setThumStatus(componentModelUploadEntity.getThumStatus());
+        if (ObjectUtil.isNotNull(componentModelUploadEntity.getPartsDetailId())){
+            CustomComponentEntity componentEntity = customComponentService.findById(componentModelUploadEntity.getPartsDetailId());
+            responseModelComponent.setName(componentEntity.getName());
+            responseModelComponent.setComponentTypeId(componentEntity.getComponentTypeId());
+            responseModelComponent.setModelId(componentEntity.getId());
+            responseModelComponent.setGlbPtah(componentEntity.getTemplate());
+        }else {
+            responseModelComponent.setComponentTypeId(0L);
+        }
+
+        return responseModelComponent;
+    }
+
+    @Override
+    public List<ComponentModelUploadEntity> findPartsModelUploadId(Long id) {
+        LambdaQueryWrapper<ComponentModelUploadEntity> wrapper =  Wrappers.lambdaQuery();
+        if (ObjectUtil.isNotNull(id)&&id>0){
+            wrapper.eq(ComponentModelUploadEntity::getPartsModelUploadId,id);
+        }
+        return list(wrapper);
+    }
+
+    @Override
+    public List<ComponentModelUploadEntity> findIsNotPartsDetailId(Long userId, Integer fileType) {
+        LambdaQueryWrapper<ComponentModelUploadEntity> wrapper =  Wrappers.lambdaQuery();
+        if (ObjectUtil.isNotNull(userId)&&userId>0){
+            wrapper.eq(ComponentModelUploadEntity::getUserId,userId);
+        }
+        if (ObjectUtil.isNotNull(fileType)&&fileType>0){
+            wrapper.eq(ComponentModelUploadEntity::getFileType,fileType);
+        }
+        wrapper.ne(ComponentModelUploadEntity::getStatus,-1);
+        wrapper.isNull(ComponentModelUploadEntity::getPartsDetailId);
+
+        return list(wrapper);
+    }
+
+    @Override
+    @Transactional(rollbackFor = BusinessException.class)
+    public Result saveOrUpdateCustomUpload(RequestModelComponentSaveModel param) throws Exception ,BusinessException{
+        if (ObjectUtil.isNotNull(param)) {
+            //判断保存或者修改
+            if (ObjectUtil.isNull(param.getModelId())) {
+                ComponentModelUploadEntity componentModel = findById(param.getId());
+
+                if (ObjectUtil.isNotNull(componentModel)) {
+                    CustomComponentEntity customComponentEntity = new CustomComponentEntity();
+                    customComponentEntity.setComponentTypeId(param.getComponentTypeId());
+                    customComponentEntity.setModelId(componentModel.getId());
+                    customComponentEntity.setName(param.getName());
+                    customComponentEntity.setUserId(param.getUserId());
+                    customComponentEntity.setFileId(componentModel.getFileId());
+                    log.info("处理缩略图");
+
+                    //先执行python-NewResortForOne脚本,处理obj文件
+                    CreateObjUtil.objHandle(buildPath + componentModel.getObjPath());
+
+                    uploadToOssUtil.uploadTo4dTjw(buildPath + componentModel.getThumPath(), "domain/eHome/furniture/models/" + componentModel.getFileId() + "_preview.jpg");
+
+                    customComponentEntity.setThumbnailSrc(prefix + "domain/eHome/furniture/models/" + componentModel.getFileId() + "_preview.jpg");
+                    //obj转换成glb格式
+                    log.info("配件obj转换成glb格式");
+                    String glbPath = buildPath + componentModel.getObjPath().replace(".obj", ".glb");
+                    log.info("obj转换成glb格式路径-{}", glbPath);
+                    CreateObjUtil.objToGlb(buildPath + componentModel.getObjPath(), glbPath);
+                    uploadToOssUtil.uploadTo4dTjw(buildPath + componentModel.getObjPath().replace(".obj", ".glb"), "domain/eHome/furniture/temp/" + componentModel.getFileId() + ".glb");
+                    customComponentEntity.setTemplate(prefix + "domain/eHome/furniture/models/" + componentModel.getFileId() + ".glb");
+                    //obj转换成glb格式
+                    log.info("上传obj到simpleObj-Mtl开始");
+                    uploadToOssUtil.uploadTo4dTjw(buildPath + componentModel.getObjPath(),
+                            "domain/eHome/furniture/simpleObj-Mtl/"+componentModel.getFileId() + "/"+componentModel.getFileId() +".obj");
+                    //obj转换成glb格式
+                    log.info("上传obj到simpleObj-Mtl结束");
+                    Boolean componentSaveFlag = customComponentService.save(customComponentEntity);
+                    if (componentSaveFlag) {
+                        componentModel.setPartsDetailId(customComponentEntity.getId());
+                        updateById(componentModel);
+                    }
+
+                    List<String>  fileList=uploadToOssUtil.fileFolderTo4dTjw("domain/eHome/furniture/ue4data/"+componentModel.getFileId());
+                    log.info("上传mtl+jpg 到simpleObj-Mtl开始");
+                    for (String s : fileList) {
+                        //上传到simpleObj-Mtl
+                        String oldPath="domain/eHome/furniture/ue4data/"+componentModel.getFileId()+"/";
+                        s=s.replace(oldPath,"");
+                        if (s.contains("_preview.jpg") || s.contains("-base.obj")){
+                            continue;
+                        }
+                        uploadToOssUtil.copyTo4dTjw(
+                                oldPath+s
+                                ,"domain/eHome/furniture/simpleObj-Mtl/"+componentModel.getFileId()+"/"+s);
+                    }
+                    log.info("上传mtl+jpg 到simpleObj-Mtl结束");
+                    //入库前先提交模型到模型库,失败返回提示
+                    JSONArray syncDataArray=new JSONArray();
+
+                    JSONObject object = new JSONObject();
+                    object.put("Name", componentModel.getFileId());
+                    object.put("UserID", componentModel.getUserId());
+                    object.put("Postfix", "fbx");
+                    object.put("ObjAliPath", "domain/eHome/furniture/simpleObj-Mtl/" + customComponentEntity.getFileId());
+                    syncDataArray.add(object);
+
+                    JSONObject jsonObject = new JSONObject();
+                    String version = SnowFlakeUUidUtils.generaUUid(null, null, null);
+                    log.info("更新模型库,syncmodel接口参数:" );
+                    uploadToOssUtil.uploadTo4dTjw(syncDataArray.toJSONString().getBytes(), "domain/eHome/furniture/syncdata/" +
+                            version + "/SyncData.json");
+                    log.info("上传完成SyncData.jsn:"+version);
+                    jsonObject.put("version", version);
+
+                    synchronized (customComponentEntity.getId()) {
+                        //链式构建请求
+                        String resultData = OkHttpUtils.httpPostJson(buildUrl + "syncmodel", jsonObject.toJSONString());
+                        JSONObject resultJson = JSONObject.parseObject(resultData);
+                        if ("error".equals(resultJson.getString("state"))) {
+                            log.info("更新模型库,syncmodel接口失败:" + resultData);
+                            throw new BusinessException("更新模型库,syncmodel接口失败:" + resultData);
+                        }
+                    }
+                    return Result.success(componentSaveFlag);
+
+                }
+                return Result.failure("查询不到成品模型");
+            } else {
+                log.info("修改成品");
+                CustomComponentEntity componentModel = customComponentService.findById(param.getModelId());
+                if (ObjectUtil.isNotNull(componentModel)) {
+                    componentModel.setName(param.getName());
+                    componentModel.setComponentTypeId(param.getComponentTypeId());
+                    boolean componentUpdateFlag= customComponentService.updateById(componentModel);
+                    return Result.success(componentUpdateFlag);
+
+                }
+                return Result.failure("查询不到成品模型");
+            }
+        }
+        return Result.failure();
+    }
 
+    @Override
+    public ComponentModelUploadEntity findByFileId(String fileId) {
+        LambdaQueryWrapper<ComponentModelUploadEntity> wrapper =  Wrappers.lambdaQuery();
+        if (ObjectUtil.isNotNull(fileId)&& StrUtil.isNotEmpty(fileId)){
+            wrapper.eq(ComponentModelUploadEntity::getFileId,fileId);
+        }
+        return getOne(wrapper);
+    }
 }

+ 307 - 4
sxz-core/src/main/java/com/fdkk/sxz/webApi/service/impl/ModelUploadServiceImpl.java

@@ -1,10 +1,33 @@
 package com.fdkk.sxz.webApi.service.impl;
 
+import cn.hutool.core.util.ObjectUtil;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.fdkk.sxz.base.Result;
 import com.fdkk.sxz.base.impl.BaseServiceImpl;
+import com.fdkk.sxz.entity.ComponentModelUploadEntity;
 import com.fdkk.sxz.entity.ModelUploadEntity;
+import com.fdkk.sxz.entity.custuom.CustomComponentEntity;
+import com.fdkk.sxz.entity.custuom.CustomProductEntity;
+import com.fdkk.sxz.entity.custuom.CustomProductFirstclassifyEntity;
+import com.fdkk.sxz.exception.BusinessException;
+import com.fdkk.sxz.util.CreateObjUtil;
+import com.fdkk.sxz.util.OkHttpUtils;
+import com.fdkk.sxz.util.SnowFlakeUUidUtils;
+import com.fdkk.sxz.util.UploadToOssUtil;
+import com.fdkk.sxz.vo.request.RequestModelCustomUpload;
+import com.fdkk.sxz.vo.response.ResponseModelCustom;
 import com.fdkk.sxz.webApi.mapper.IModelUploadMapper;
+import com.fdkk.sxz.webApi.service.IComponentModelUploadService;
 import com.fdkk.sxz.webApi.service.IModelUploadService;
+import com.fdkk.sxz.webApi.service.custom.ICustomComponentService;
+import com.fdkk.sxz.webApi.service.custom.ICustomProductService;
+import lombok.extern.slf4j.Slf4j;
+import net.oschina.j2cache.CacheChannel;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.cache.annotation.Cacheable;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -15,15 +38,227 @@ import java.util.List;
  */
 @Service
 @Transactional
-public class ModelUploadServiceImpl extends BaseServiceImpl<IModelUploadMapper, ModelUploadEntity> implements IModelUploadService{
+@Slf4j
+public class ModelUploadServiceImpl extends BaseServiceImpl<IModelUploadMapper, ModelUploadEntity> implements IModelUploadService {
 
     @Autowired
     private IModelUploadMapper modelUploadMapper;
 
+    @Autowired
+    private UploadToOssUtil uploadToOssUtil;
+
+    @Autowired
+    private IComponentModelUploadService componentModelUploadService;
+
+    @Autowired
+    private IModelUploadService modelUploadService;
+
+    @Autowired
+    private ICustomComponentService customComponentService;
+
+    @Autowired
+    private ICustomProductService customProductService;
+
+
+    @Value("${server.file.location}")
+    private String buildPath;
+
+    @Value("${prefix.ali}")
+
+    private String prefix;
+    @Value("${build.url}")
+    private String buildUrl;
+
+    @Autowired
+    private CacheChannel cacheChannel;
+
+    @Override
+    public boolean removeById(Long id) {
+        boolean removeById=super.removeById(id);
+        if (removeById){
+            cacheChannel.evict("ModelUploadEntity","id::"+id);
+            cacheChannel.evict("ModelUploadEntity","fileId::"+id);
+        }
+        return removeById;
+    }
+
+    @Override
+    public ModelUploadEntity findById(Long id) {
+        ModelUploadEntity entity=super.findById(id);
+        if (ObjectUtil.isNotNull(entity)){
+            cacheChannel.set("ModelUploadEntity","id::"+entity.getId(),entity,60*30 );
+        }
+        return super.findById(id);
+    }
+
+    @Override
+    public boolean updateById(ModelUploadEntity entity) {
+        boolean updateById=super.updateById(entity);
+        if (updateById){
+            cacheChannel.set("ModelUploadEntity","id::"+entity.getId(),entity,60*30  );
+            cacheChannel.set("ModelUploadEntity","fileId::"+entity.getFileId(),entity,60*30 );
+        }
+        return updateById;
+    }
+
+
+
+    @Override
+    @Transactional(rollbackFor = BusinessException.class)
+    public Result saveOrUpdateCustomUpload(RequestModelCustomUpload param) throws Exception {
+        if (ObjectUtil.isNotNull(param)) {
+            //判断保存或者修改
+            if (ObjectUtil.isNull(param.getModelId())) {
+                //保存
+                log.info("保存成品");
+                JSONArray syncDataArray=new JSONArray();
+
+                ModelUploadEntity modelUploadEntity = modelUploadService.findById(param.getId());
+                if (ObjectUtil.isNotNull(modelUploadEntity)) {
+                    //入库前先提交模型到模型库,失败返回提示
+
+                    CustomProductEntity entity = new CustomProductEntity();
+                    entity.setModelId(param.getId());
+                    entity.setName(param.getName());
+                    uploadToOssUtil.uploadTo4dTjw(buildPath + modelUploadEntity.getThumPath(), "domain/eHome/furniture/models/" + modelUploadEntity.getFileId() + "_preview" + ".jpg");
+                    entity.setThumbnailSrc(prefix + "domain/eHome/furniture/models/" + modelUploadEntity.getFileId() + "_preview.jpg");
+                    entity.setParentId(param.getCustomTypeId());
+                    entity.setWidth(param.getWidth());
+                    entity.setDepth(param.getDepth());
+                    entity.setHeight(param.getHeight());
+                    entity.setIsShow(1);
+                    entity.setCreateTime(param.getCreateTime());
+                    entity.setUserId(param.getUserId());
+                    JSONArray ids = new JSONArray();
+                    //处理配件
+                    log.info("保存配件");
+                    if (ObjectUtil.isNotNull(param.getComponentSlots())) {
+                        for (RequestModelCustomUpload.Component componentSlot : param.getComponentSlots()) {
+                            ComponentModelUploadEntity componentModel = componentModelUploadService.findById(componentSlot.getId());
+                            if (ObjectUtil.isNotNull(componentModel)) {
+                                CustomComponentEntity customComponentEntity = new CustomComponentEntity();
+                                customComponentEntity.setWidth(componentSlot.getWidth());
+                                customComponentEntity.setComponentTypeId(componentSlot.getCustomComponentTypeId());
+                                customComponentEntity.setDepth(componentSlot.getDepth());
+                                customComponentEntity.setHeight(componentSlot.getHeight());
+                                customComponentEntity.setX(componentSlot.getOrigin().getX());
+                                customComponentEntity.setY(componentSlot.getOrigin().getY());
+                                customComponentEntity.setZ(componentSlot.getOrigin().getZ());
+                                customComponentEntity.setModelId(componentModel.getId());
+                                customComponentEntity.setName(componentSlot.getTitle());
+                                customComponentEntity.setFileId(componentModel.getFileId());
+                                log.info("处理缩略图");
+
+                                //先执行python-NewResortForOne脚本,处理obj文件
+                                CreateObjUtil.objHandle(buildPath + componentModel.getObjPath());
+
+                                uploadToOssUtil.uploadTo4dTjw(buildPath + componentModel.getThumPath(), "domain/eHome/furniture/models/" + componentModel.getFileId() + "_preview.jpg");
+
+                                customComponentEntity.setThumbnailSrc(prefix + "domain/eHome/furniture/models/" + componentModel.getFileId() + "_preview.jpg");
+                                //obj转换成glb格式
+                                log.info("配件obj转换成glb格式");
+                                String glbPath = buildPath + componentModel.getObjPath().replace(".obj", ".glb");
+                                log.info("obj转换成glb格式路径-{}", glbPath);
+                                CreateObjUtil.objToGlb(buildPath + componentModel.getObjPath(), glbPath);
+                                uploadToOssUtil.uploadTo4dTjw(buildPath + componentModel.getObjPath().replace(".obj", ".glb"), "domain/eHome/furniture/models/" + componentModel.getFileId() + ".glb");
+                                customComponentEntity.setTemplate(prefix + "domain/eHome/furniture/models/" + componentModel.getFileId() + ".glb");
+                                //obj转换成glb格式
+                                log.info("上传obj到simpleObj-Mtl开始");
+                                uploadToOssUtil.uploadTo4dTjw(buildPath + componentModel.getObjPath(),
+                                        "domain/eHome/furniture/simpleObj-Mtl/"+componentModel.getFileId() +"/"+componentModel.getFileId()+ ".obj");
+                                //obj转换成glb格式
+                                log.info("上传obj到simpleObj-Mtl结束");
+                                Boolean componentSaveFlag = customComponentService.save(customComponentEntity);
+                                if (componentSaveFlag) {
+                                    componentModel.setPartsDetailId(customComponentEntity.getId());
+                                    componentModelUploadService.updateById(componentModel);
+                                    ids.add(customComponentEntity.getId().toString());
+                                }
+
+                               List<String>  fileList=uploadToOssUtil.fileFolderTo4dTjw("domain/eHome/furniture/ue4data/"+modelUploadEntity.getFileId()+"/"+componentModel.getFileId());
+                                log.info("上传mtl+jpg 到simpleObj-Mtl开始");
+                                for (String s : fileList) {
+                                    //上传到simpleObj-Mtl
+                                    String oldPath="domain/eHome/furniture/ue4data/"+modelUploadEntity.getFileId()+"/"+componentModel.getFileId()+"/";
+                                    s=s.replace(oldPath,"");
+                                    if (s.contains("_preview.jpg") || s.contains("-base.obj")){
+                                        continue;
+                                    }
+                                    uploadToOssUtil.copyTo4dTjw(
+                                            oldPath+s
+                                            ,"domain/eHome/furniture/simpleObj-Mtl/"+componentModel.getFileId()+"/"+s);
+                                }
+                                log.info("上传mtl+jpg 到simpleObj-Mtl结束");
+                                //入库前先提交模型到模型库,失败返回提示
+                                JSONObject object = new JSONObject();
+                                object.put("Name", componentModel.getFileId());
+                                object.put("UserID", modelUploadEntity.getUserId());
+                                object.put("Postfix", "fbx");
+                                object.put("ObjAliPath", "domain/eHome/furniture/simpleObj-Mtl/" + componentModel.getFileId());
+                                syncDataArray.add(object);
+                            }
+                        }
+                    }
+                    entity.setComponentTypeIds(ids.toString());
+                    Boolean saveFlag = customProductService.save(entity);
+                    if (saveFlag) {
+                        modelUploadEntity.setPartsDetailId(entity.getId());
+                        modelUploadService.updateById(modelUploadEntity);
+                    }
+                    JSONObject jsonObject = new JSONObject();
+                    String version = SnowFlakeUUidUtils.generaUUid(null, null, null);
+                    log.info("更新模型库,syncmodel接口参数:" + syncDataArray.toJSONString());
+                    uploadToOssUtil.uploadTo4dTjw(syncDataArray.toJSONString().getBytes(), "domain/eHome/furniture/syncdata/" +
+                            version + "/SyncData.json");
+                    log.info("上传完成SyncData.jsn:"+version);
+                    jsonObject.put("version", version);
+
+                    synchronized (entity.getId()) {
+                        //链式构建请求
+                        String resultData = OkHttpUtils.httpPostJson(buildUrl + "syncmodel", jsonObject.toJSONString());
+                        JSONObject resultJson = JSONObject.parseObject(resultData);
+                        if ("error".equals(resultJson.getString("state"))) {
+                            log.info("更新模型库,syncmodel接口失败:" + resultData);
+                            throw new BusinessException("更新模型库,syncmodel接口失败:" + resultData);
+                        }
+                    }
+                    return Result.success(saveFlag);
+                }
+                return Result.failure("查询不到成品模型");
+            } else {
+                //修改
+                log.info("修改成品");
+                CustomProductEntity entity = customProductService.findById(param.getModelId());
+                if (ObjectUtil.isNotNull(entity)) {
+                    log.info("修改成品" + entity.getId());
+                    entity.setName(param.getName());
+                    entity.setParentId(param.getCustomTypeId());
+                    if (ObjectUtil.isNotNull(param.getComponentSlots())) {
+                        log.info("修改配件");
+                        for (RequestModelCustomUpload.Component componentSlot : param.getComponentSlots()) {
+                            CustomComponentEntity componentModel = customComponentService.findById(componentSlot.getModelId());
+                            if (ObjectUtil.isNotNull(componentModel)) {
+                                componentModel.setName(componentSlot.getTitle());
+                                componentModel.setComponentTypeId(componentSlot.getCustomComponentTypeId());
+                                customComponentService.updateById(componentModel);
+                            }
+                        }
+                    }
+                    return Result.success(customProductService.updateById(entity));
+                }
+                return Result.failure("查询不到成品模型");
+            }
+        }
+        return Result.failure();
+    }
 
     @Override
     public ModelUploadEntity findByFileId(String fileId) {
-        return modelUploadMapper.findByFileId(fileId);
+        ModelUploadEntity entity=modelUploadMapper.findByFileId(fileId);
+        if (ObjectUtil.isNotNull(entity)){
+            cacheChannel.set("ModelUploadEntity","fileId::"+fileId,entity,60*30 );
+        }
+        return entity;
     }
 
     @Override
@@ -32,7 +267,75 @@ public class ModelUploadServiceImpl extends BaseServiceImpl<IModelUploadMapper,
     }
 
     @Override
-    public List<ModelUploadEntity> findIsNotPartsDetailId(Long userId,Integer fileType) {
-        return modelUploadMapper.findIsNotPartsDetailId(userId,fileType);
+    public List<ModelUploadEntity> findIsNotPartsDetailId(Long userId, Integer fileType) {
+        return modelUploadMapper.findIsNotPartsDetailId(userId, fileType);
+    }
+
+
+    @Override
+    public ResponseModelCustom findCustom(Long id) {
+        ModelUploadEntity entity = findById(id);
+
+        ResponseModelCustom responseModelCustomUpload = new ResponseModelCustom();
+        responseModelCustomUpload.setId(entity.getId());
+        responseModelCustomUpload.setCreateTime(entity.getCreateTime());
+        responseModelCustomUpload.setUserId(entity.getUserId());
+        responseModelCustomUpload.setStatus(entity.getStatus());
+        responseModelCustomUpload.setProgress(entity.getProgress());
+        responseModelCustomUpload.setThumPath(entity.getThumPath());
+        responseModelCustomUpload.setThumStatus(entity.getThumStatus());
+        if (ObjectUtil.isNotNull(entity.getPartsDetailId())){
+            CustomProductEntity customProductEntity=  customProductService.findById(entity.getPartsDetailId());
+            responseModelCustomUpload.setName(customProductEntity.getName());
+            responseModelCustomUpload.setCustomTypeId(customProductEntity.getParentId());
+            responseModelCustomUpload.setModelId(customProductEntity.getId());
+        }else {
+            responseModelCustomUpload.setCustomTypeId(0L);
+        }
+
+        if (ObjectUtil.isNotNull(entity.getCacheData())) {
+            JSONObject cache = JSONObject.parseObject(entity.getCacheData());
+            responseModelCustomUpload.setWidth(cache.getDouble("width"));
+            responseModelCustomUpload.setDepth(cache.getDouble("depth"));
+            responseModelCustomUpload.setHeight(cache.getDouble("height"));
+        }
+        if (entity.getStatus() != -1) {
+            JSONArray componentArray = new JSONArray();
+            List<ComponentModelUploadEntity> componentModelUploadEntities = componentModelUploadService.findPartsModelUploadId(entity.getId());
+            for (ComponentModelUploadEntity componentModelUploadEntity : componentModelUploadEntities) {
+
+                JSONObject json = new JSONObject();
+                json.put("id", componentModelUploadEntity.getId());
+                json.put("name", componentModelUploadEntity.getFileId());
+
+
+                if (ObjectUtil.isNotNull(componentModelUploadEntity.getPartsDetailId())){
+                    CustomComponentEntity componentEntity=customComponentService.findById(componentModelUploadEntity.getPartsDetailId());
+                    if (ObjectUtil.isNotNull(componentEntity)){
+                        json.put("customComponentTypeId", componentEntity.getComponentTypeId());
+                        json.put("title", componentEntity.getName());
+                        json.put("modelId", componentEntity.getId());
+                    }
+                }else {
+                    json.put("customComponentTypeId", 0);
+                }
+
+                json.put("objPath", componentModelUploadEntity.getObjPath());
+                json.put("thumPath", componentModelUploadEntity.getThumPath());
+                json.put("mtlPath", componentModelUploadEntity.getMtlPath());
+                if (ObjectUtil.isNotNull(componentModelUploadEntity.getCacheData())) {
+                    JSONObject componentCache = JSON.parseObject(componentModelUploadEntity.getCacheData());
+                    json.put("width", componentCache.getJSONObject("deploy").getDouble("width"));
+                    json.put("depth", componentCache.getJSONObject("deploy").getDouble("depth"));
+                    json.put("height", componentCache.getJSONObject("deploy").getDouble("height"));
+                    json.put("origin", componentCache.get("origin"));
+                }
+                componentArray.add(json);
+            }
+            responseModelCustomUpload.setComponentSlots(componentArray);
+        }
+
+
+        return responseModelCustomUpload;
     }
 }

+ 31 - 0
sxz-core/src/main/resources/mapper/ComponentModelUploadMapper.xml

@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="com.fdkk.sxz.webApi.mapper.IComponentModelUploadMapper">
+
+    <!-- 通用查询结果列 -->
+    <sql id="baseColumnList">
+        t.id,
+        t.user_id AS userId,
+        t.user_type AS userType,
+        t.file_id AS fileId,
+        t.parts_detail_id AS partsDetailId,
+        t.obj_path AS objPath,
+        t.img_path AS imgPath,
+        t.thum_path AS thumPath,
+        t.status AS status,
+        t.file_type AS fileType,
+        t.progress AS progress,
+        t.thum_status AS thumStatus,
+        t.thum_progress AS thumProgress,
+        t.upload_file AS uploadFile,
+        t.faces_num AS facesNum,
+        t.obj_size AS objSize,
+        t.cache_data AS cacheData,
+        t.parts_model_upload_id AS partsModelUploadId,
+        t.mtl_path AS mtlPath
+        t.update_time AS updateTime,
+        t.rec_status AS recStatus
+    </sql>
+
+
+</mapper>

+ 6 - 11
sxz-generator/src/main/java/com/fdkk/sxz/generator/Main.java

@@ -1,13 +1,14 @@
 package com.fdkk.sxz.generator;
 
 import cn.hutool.core.io.FileUtil;
+import cn.hutool.core.util.NumberUtil;
 import cn.hutool.core.util.StrUtil;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 
 import java.io.File;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 /**
  * @description: Main
@@ -19,12 +20,6 @@ public class Main {
      * 执行main方法,根据generator.properties配置文件生成代码
      **/
     public static void main(String[] args) {
-//        CodeGenerator.buildCode();
-
-        List<File> files=FileUtil.loopFiles("C:\\Users\\4DAGE\\Desktop\\fbxtoobj\\BOOT-INF\\classes\\com\\fdkankan\\controller");
-        for (File file : files) {
-            System.out.println(file.getPath());
-
-        }
+               CodeGenerator.buildCode();
     }
 }

+ 1 - 1
sxz-modules/src/main/java/com/fdkk/sxz/entity/BaseEntity.java

@@ -10,7 +10,7 @@ import java.io.Serializable;
 import java.util.Date;
 
 @Data
-public abstract class BaseEntity  {
+public abstract class BaseEntity implements Serializable {
 
     @TableId(value="id", type= IdType.AUTO)
     private Long id;

+ 10 - 10
sxz-modules/src/main/java/com/fdkk/sxz/entity/ComponentModelUploadEntity.java

@@ -47,14 +47,14 @@ public class ComponentModelUploadEntity extends BaseEntity {
      * tb_renovation_parts_detail的id
      */
     @TableField("parts_detail_id")
-    @ApiModelProperty(value = "tb_renovation_parts_detail的id", name = "parts_detail_id")
+    @ApiModelProperty(value = "tb_custom_component的id", name = "parts_detail_id")
     private Long partsDetailId;
 
     /**
      * tb_renovation_parts_detail的id
      */
     @TableField("parts_model_upload_id")
-    @ApiModelProperty(value = "成品模型上表id", name = "parts_model_upload_id")
+    @ApiModelProperty(value = "成品模型上表id", name = "parts_model_upload_id")
     private Long partsModelUploadId;
 
     /**
@@ -65,6 +65,13 @@ public class ComponentModelUploadEntity extends BaseEntity {
     private String objPath;
 
     /**
+     * 转换后的mtl文件路径
+     */
+    @TableField("mtl_path")
+    @ApiModelProperty(value = "转换后的mtl文件路径", name = "mtl_path")
+    private String mtlPath;
+
+    /**
      * 图片地址
      */
     @TableField("img_path")
@@ -89,7 +96,7 @@ public class ComponentModelUploadEntity extends BaseEntity {
      * 文件类型,0表示fbx,1表示datasmith
      */
     @TableField("file_type")
-    @ApiModelProperty(value = "文件类型,0表示fbx,1表示datasmith", name = "file_type")
+    @ApiModelProperty(value = "文件类型,1 代表单独上传 2,代表通过组件上传", name = "file_type")
     private Integer fileType;
 
     /**
@@ -142,11 +149,4 @@ public class ComponentModelUploadEntity extends BaseEntity {
     private String cacheData;
 
 
-    /**
-     * mtl_Path路径
-     */
-    @TableField("mtl_Path")
-    @ApiModelProperty(value = "前端保存的缓存数据", name = "mtlPath")
-    private String mtlPath;
-
 }

+ 44 - 4
sxz-modules/src/main/java/com/fdkk/sxz/entity/custuom/CustomComponentEntity.java

@@ -1,5 +1,6 @@
 package com.fdkk.sxz.entity.custuom;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
 import com.fdkk.sxz.entity.BaseEntity;
 import com.baomidou.mybatisplus.annotation.TableId;
@@ -9,6 +10,8 @@ import com.baomidou.mybatisplus.annotation.TableName;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 
+import java.util.Date;
+
 
 /**
  * @description: 定制家具——组件 Model
@@ -29,6 +32,20 @@ public class CustomComponentEntity extends BaseEntity {
     @ApiModelProperty(value = "名称", name = "name")
     private String name;
 
+
+    /**
+     * 用户id
+     */
+    @TableField("user_id")
+    @ApiModelProperty(value = "用户ID", name = "userId")
+    private Long userId;
+
+
+
+    @TableField("file_id")
+    @ApiModelProperty(value = "文件名称", name = "fileId")
+    private String fileId;
+
     /**
      * 默认宽度,单位是毫米
      */
@@ -74,16 +91,16 @@ public class CustomComponentEntity extends BaseEntity {
     /**
      * 所属目录
      */
-    @TableField("parentId")
-    @ApiModelProperty(value = "所属目录", name = "parentId")
-    private Integer parentId;
+    @TableField("componentTypeId")
+    @ApiModelProperty(value = "所属目录", name = "componentTypeId")
+    private Long componentTypeId;
 
     /**
      * 模型Id
      */
     @TableField("modelId")
     @ApiModelProperty(value = "模型Id", name = "modelId")
-    private Integer modelId;
+    private Long modelId;
 
     /**
      * 模型url
@@ -93,4 +110,27 @@ public class CustomComponentEntity extends BaseEntity {
     private String template;
 
 
+    @TableField( "x")
+    private Integer x;
+
+    @TableField( "y")
+    private Integer y;
+
+    @TableField( "z")
+    private Integer z;
+
+
+    @TableField( "is_show")
+    @ApiModelProperty(value = "0不显示,1显示", name = "isShow")
+    private Integer isShow;
+
+    @TableField( "examine")
+    @ApiModelProperty(value = "审核,0审核中,1审核通过", name = "depth")
+    private Integer examine;
+
+    @TableField( "examine_time")
+    @ApiModelProperty(value = "审核时间", name = "depth")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date examineTime;
+
 }

+ 4 - 3
sxz-modules/src/main/java/com/fdkk/sxz/entity/custuom/CustomProductEntity.java

@@ -74,7 +74,7 @@ public class CustomProductEntity extends BaseEntity {
      */
     @TableField("modelId")
     @ApiModelProperty(value = "模型Id", name = "modelId")
-    private Integer modelId;
+    private Long modelId;
 
     /**
      * 配件组合,不仅仅包含组合的配件类型,还包含配件的坐标,角度和尺寸
@@ -87,7 +87,7 @@ public class CustomProductEntity extends BaseEntity {
      * 所属目录,对应的是三级目录
      */
     @TableField("parentId")
-    @ApiModelProperty(value = "所属目录,对应的是级目录", name = "parentId")
+    @ApiModelProperty(value = "所属目录,对应的是级目录", name = "parentId")
     private Long parentId;
 
     /**
@@ -113,7 +113,7 @@ public class CustomProductEntity extends BaseEntity {
 
 
     @TableField( "is_show")
-    @ApiModelProperty(value = "上传用户id", name = "depth")
+    @ApiModelProperty(value = "0不显示,1显示", name = "isShow")
     private Integer isShow;
 
     @TableField( "examine")
@@ -125,4 +125,5 @@ public class CustomProductEntity extends BaseEntity {
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     private Date examineTime;
 
+
 }

+ 33 - 0
sxz-modules/src/main/java/com/fdkk/sxz/vo/request/RequestComponet.java

@@ -0,0 +1,33 @@
+package com.fdkk.sxz.vo.request;
+
+import com.fdkk.sxz.base.RequestBase;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * @description: 定制家具——成品 Model
+ * @author: Xiewj
+ * @date: 2021-09-01 11:24:32
+ */
+@Data
+public class RequestComponet extends RequestBase {
+
+
+    private Long id;
+
+    private String name;
+
+    private String[] ids;
+
+
+    private Long userId;
+
+    private String userName;
+
+
+    @ApiModelProperty(value = "0不显示,1显示", name = "isShow")
+    private Integer isShow;
+
+
+    private String recStatus;
+}

+ 1 - 1
sxz-modules/src/main/java/com/fdkk/sxz/vo/request/RequestCustom.java

@@ -18,7 +18,7 @@ public class RequestCustom extends RequestBase {
 
 
     @ApiModelProperty(value = "1.product、2.component、3.material", name = "type")
-    private String type;
+    private String type="";
 
     @ApiModelProperty(value = "父节点id", name = "parentId")
     private Long parentId;

+ 15 - 0
sxz-modules/src/main/java/com/fdkk/sxz/vo/request/RequestCustomComponent.java

@@ -1,5 +1,6 @@
 package com.fdkk.sxz.vo.request;
 
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import com.fdkk.sxz.base.RequestBase;
 
@@ -14,8 +15,22 @@ public class RequestCustomComponent extends RequestBase {
 
     private Long id;
 
+    private Long modelId;
+
+
     private String name;
 
     private String[] ids;
 
+    private Long userId;
+
+    private String userName;
+
+
+    @ApiModelProperty(value = "0不显示,1显示", name = "isShow")
+    private Integer isShow;
+
+
+    private String recStatus;
+
 }

+ 8 - 0
sxz-modules/src/main/java/com/fdkk/sxz/vo/request/RequestCustomProduct.java

@@ -1,5 +1,6 @@
 package com.fdkk.sxz.vo.request;
 
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import com.fdkk.sxz.base.RequestBase;
 
@@ -20,4 +21,11 @@ public class RequestCustomProduct extends RequestBase {
     private Long userId;
 
     private String userName;
+
+
+    @ApiModelProperty(value = "0不显示,1显示", name = "isShow")
+    private Integer isShow;
+
+
+    private String recStatus;
 }

+ 21 - 0
sxz-modules/src/main/java/com/fdkk/sxz/vo/request/RequestModelComponentSaveModel.java

@@ -0,0 +1,21 @@
+package com.fdkk.sxz.vo.request;
+
+import com.alibaba.fastjson.JSONObject;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fdkk.sxz.entity.ComponentModelUploadEntity;
+import com.fdkk.sxz.entity.custuom.CustomComponentEntity;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+import java.util.List;
+
+@Data
+public class RequestModelComponentSaveModel extends CustomComponentEntity {
+
+    private JSONObject jsonData;
+
+    private Long modelId;
+
+
+}

+ 99 - 0
sxz-modules/src/main/java/com/fdkk/sxz/vo/request/RequestModelCustomUpload.java

@@ -0,0 +1,99 @@
+package com.fdkk.sxz.vo.request;
+
+import com.alibaba.fastjson.JSONArray;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+import java.util.List;
+
+@Data
+public class RequestModelCustomUpload {
+
+
+    private Long id;
+
+    @ApiModelProperty(value = "modelId 修改时候才会有", name = "modelId")
+    private Long modelId;
+
+    @ApiModelProperty(value = "保存时候填的name", name = "name")
+    private String name;
+
+    @ApiModelProperty(value = "用户id", name = "userId")
+    private Long userId;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date createTime;
+
+    @ApiModelProperty(value = "成品分类id", name = "customTypeId")
+    private Long customTypeId;
+
+    @ApiModelProperty(value = "配件集合", name = "componentSlots")
+    private List<Component> componentSlots;
+
+    /**
+     * 宽:毫米
+     */
+    @ApiModelProperty(value = "宽:毫米", name = "width")
+    private Integer width;
+
+    /**
+     * 长:毫米
+     */
+    @ApiModelProperty(value = "长:毫米", name = "height")
+    private Integer height;
+
+    /**
+     * 深度:毫米
+     */
+    @ApiModelProperty(value = "深度:毫米", name = "depth")
+    private Integer depth;
+
+    @Data
+    public static class  Component {
+
+        private Long id;
+
+        @ApiModelProperty(value = "modelId 修改时候才会有", name = "modelId")
+        private Long modelId;
+
+        @ApiModelProperty(value = "保存时候填的name", name = "name")
+        private String name;
+
+        @ApiModelProperty(value = "配件分类id", name = "customTypeId")
+        private Long customComponentTypeId;
+        /**
+         * 宽:毫米
+         */
+        @ApiModelProperty(value = "宽:毫米", name = "width")
+        private Integer width;
+
+        /**
+         * 长:毫米
+         */
+        @ApiModelProperty(value = "长:毫米", name = "height")
+        private Integer height;
+        /**
+         * 深度:毫米
+         */
+        @ApiModelProperty(value = "深度:毫米", name = "depth")
+        private Integer depth;
+
+
+        @ApiModelProperty(value = "配件集合", name = "componentSlots")
+        private Origin origin;
+
+        @ApiModelProperty(value = "配件集合", name = "componentSlots")
+        private String title;
+    }
+
+    @Data
+    public static class  Origin {
+        private Integer x;
+        private Integer y;
+        private Integer z;
+    }
+
+}

+ 44 - 0
sxz-modules/src/main/java/com/fdkk/sxz/vo/response/ResponseComponentManager.java

@@ -0,0 +1,44 @@
+package com.fdkk.sxz.vo.response;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * Created by Xiewj
+ * date 2021年9月1日16:20:53
+ */
+@Data
+public class ResponseComponentManager {
+
+
+    @ApiModelProperty(value = "主键", name = "id")
+    private Long id;
+
+    @ApiModelProperty(value = "模型id", name = "modelId")
+    private Long modelId;
+
+    @ApiModelProperty(value = "模型名称", name = "name")
+    private String name;
+
+    @ApiModelProperty(value = "分类名称", name = "typeName")
+    private String typeName;
+
+    @ApiModelProperty(value = "是否显示", name = "isShow")
+    private Integer isShow;
+
+    @ApiModelProperty(value = "缩略图", name = "thumbnailSrc")
+    private String thumbnailSrc;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @ApiModelProperty(value = "创建时间", name = "createTime")
+    private Date createTime;
+
+    @ApiModelProperty(value = "审核,0审核中,1审核通过,-1审核失败", name = "isShow")
+    private Integer examine;
+
+
+
+}

+ 1 - 0
sxz-modules/src/main/java/com/fdkk/sxz/vo/response/ResponseCustomComponent.java

@@ -14,5 +14,6 @@ import lombok.Data;
 public class ResponseCustomComponent extends CustomComponentEntity {
 
     private JSONObject origin;
+    private String type;
 
 }

+ 3 - 0
sxz-modules/src/main/java/com/fdkk/sxz/vo/response/ResponseCustomProduct.java

@@ -18,4 +18,7 @@ public class ResponseCustomProduct extends CustomProductEntity {
 
     private List<ResponseCustomComponent> componentSlots;
 
+    private String type;
+
+
 }

+ 8 - 0
sxz-modules/src/main/java/com/fdkk/sxz/vo/response/ResponseCustomProductManager.java

@@ -17,12 +17,18 @@ public class ResponseCustomProductManager {
     @ApiModelProperty(value = "主键", name = "id")
     private Long id;
 
+    @ApiModelProperty(value = "模型id", name = "modelId")
+    private Long modelId;
+
     @ApiModelProperty(value = "模型名称", name = "name")
     private String name;
 
     @ApiModelProperty(value = "分类名称", name = "typeName")
     private String typeName;
 
+    @ApiModelProperty(value = "是否显示", name = "isShow")
+    private Integer isShow;
+
     @ApiModelProperty(value = "缩略图", name = "thumbnailSrc")
     private String thumbnailSrc;
 
@@ -33,4 +39,6 @@ public class ResponseCustomProductManager {
     @ApiModelProperty(value = "审核,0审核中,1审核通过,-1审核失败", name = "isShow")
     private Integer examine;
 
+
+
 }

+ 52 - 0
sxz-modules/src/main/java/com/fdkk/sxz/vo/response/ResponseModelComponent.java

@@ -0,0 +1,52 @@
+package com.fdkk.sxz.vo.response;
+
+import com.alibaba.fastjson.JSONArray;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+public class ResponseModelComponent {
+
+
+
+    private Long id;
+
+    private Long userId;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date createTime;
+
+    private Long componentTypeId;
+
+    private  Double width;
+
+    private  Double height;
+
+    private  Double depth;
+
+    private String thumPath;
+    private String mtlPath;
+    private String objPath;
+    private String glbPtah;
+
+    private JSONArray componentSlots;
+
+    private Integer status;
+
+    private Integer progress;
+
+
+    //提交时候的数据
+
+    private String name;
+
+
+    private Long modelId;
+
+    private Integer thumStatus;
+
+}

+ 49 - 0
sxz-modules/src/main/java/com/fdkk/sxz/vo/response/ResponseModelCustom.java

@@ -0,0 +1,49 @@
+package com.fdkk.sxz.vo.response;
+
+import com.alibaba.fastjson.JSONArray;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+import java.util.List;
+
+@Data
+public class ResponseModelCustom {
+
+
+
+    private Long id;
+
+    private Long userId;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date createTime;
+
+    private Long customTypeId;
+
+    private  Double width;
+
+    private  Double height;
+
+    private  Double depth;
+
+    private String thumPath;
+
+    private JSONArray componentSlots;
+
+    private Integer status;
+
+    private Integer progress;
+
+    private Integer thumStatus;
+    //提交时候的数据
+
+    private String name;
+
+
+    private Long modelId;
+
+
+}