Kaynağa Gözat

新建产品库模块

home 2 yıl önce
ebeveyn
işleme
abe97b37ff

+ 1 - 0
hx-api/pom.xml

@@ -24,6 +24,7 @@
     <modules>
         <module>iot-management-api</module>
         <module>storage-api</module>
+        <module>product-library-api</module>
     </modules>
 
     <dependencyManagement>

+ 19 - 0
hx-api/product-library-api/pom.xml

@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>hx-api</artifactId>
+        <groupId>com.fjhx</groupId>
+        <version>3.2.0</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>product-library-api</artifactId>
+
+    <properties>
+        <maven.compiler.source>8</maven.compiler.source>
+        <maven.compiler.target>8</maven.compiler.target>
+    </properties>
+
+</project>

+ 3 - 3
hx-common/hx-tool/src/main/java/com/fjhx/utils/feign/UserClientUtil.java

@@ -22,7 +22,7 @@ public class UserClientUtil {
      * @param userIdList 用户id列表
      * @return MAP<用户id, 用户名称>
      */
-    public static Map<Long, String> getUserNameMapByLong(List<Long> userIdList) {
+    public static Map<Long, String> getUserNameMap(List<Long> userIdList) {
         R<Map<Long, String>> r = userSearchClient.mapByUser(userIdList);
         if (r.getCode() == ResultCode.SUCCESS.getCode()) {
             return r.getData();
@@ -37,7 +37,7 @@ public class UserClientUtil {
      * @param mapper Lambda方法
      * @return MAP<用户id, 用户名称>
      */
-    public static <T> Map<Long, String> getUserNameMapByLong(List<T> list, Function<T, Long> mapper) {
+    public static <T> Map<Long, String> getUserNameMapFunctionLong(List<T> list, Function<T, Long> mapper) {
 
         List<Long> userIdList = list.stream().map(mapper).distinct().filter(Objects::nonNull).collect(Collectors.toList());
 
@@ -56,7 +56,7 @@ public class UserClientUtil {
      * @param mapper Lambda方法
      * @return MAP<用户id, 用户名称>
      */
-    public static <T> Map<Long, String> getUserNameMapByList(List<T> list, Function<T, List<Long>> mapper) {
+    public static <T> Map<Long, String> getUserNameMapFunctionList(List<T> list, Function<T, List<Long>> mapper) {
 
         List<List<Long>> userIdsList = list.stream().map(mapper).collect(Collectors.toList());
 

+ 0 - 32
hx-serve/iot-management/pom.xml

@@ -14,12 +14,8 @@
     <properties>
         <maven.compiler.source>8</maven.compiler.source>
         <maven.compiler.target>8</maven.compiler.target>
-
-        <hx.version>3.2.0</hx.version>
-        <bladex.version>2.8.2.RELEASE</bladex.version>
     </properties>
 
-
     <dependencies>
 
         <dependency>
@@ -34,32 +30,4 @@
 
     </dependencies>
 
-    <build>
-        <resources>
-            <resource>
-                <directory>src/main/resources</directory>
-            </resource>
-            <resource>
-                <directory>src/main/java</directory>
-                <includes>
-                    <include>**/*.xml</include>
-                </includes>
-            </resource>
-        </resources>
-        <plugins>
-            <plugin>
-                <groupId>org.springframework.boot</groupId>
-                <artifactId>spring-boot-maven-plugin</artifactId>
-                <version>2.3.1.RELEASE</version>
-                <executions>
-                    <execution>
-                        <goals>
-                            <goal>repackage</goal>
-                        </goals>
-                    </execution>
-                </executions>
-            </plugin>
-        </plugins>
-    </build>
-
 </project>

+ 2 - 2
hx-serve/iot-management/src/main/java/com/fjhx/ManagementApplication.java → hx-serve/iot-management/src/main/java/com/fjhx/IotManagementApplication.java

@@ -9,13 +9,13 @@ import org.springframework.cloud.client.SpringCloudApplication;
  */
 @EnableBladeFeign
 @SpringCloudApplication
-public class ManagementApplication {
+public class IotManagementApplication {
 
     private static final String APP_NAME = "iot-management";
 
     public static void main(String[] args) {
         // 调用ApiConstant.Server赋值appName会出现单服务打包失败的情况
-        BladeApplication.run(APP_NAME, ManagementApplication.class, args);
+        BladeApplication.run(APP_NAME, IotManagementApplication.class, args);
     }
 
 }

+ 1 - 1
hx-serve/iot-management/src/main/java/com/fjhx/bom/service/impl/BomServiceImpl.java

@@ -43,7 +43,7 @@ public class BomServiceImpl extends ServiceImpl<BomMapper, Bom> implements BomSe
         Page<BomVo> result = baseMapper.getPage(createPage(condition), wrapper);
 
         // 赋值最后修改人
-        Map<Long, String> userNameMap = UserClientUtil.getUserNameMapByLong(result.getRecords(), Bom::getUpdateUser);
+        Map<Long, String> userNameMap = UserClientUtil.getUserNameMapFunctionLong(result.getRecords(), Bom::getUpdateUser);
         result.getRecords().forEach(item -> item.setUpdateUserName(userNameMap.get(item.getUpdateUser())));
         return result;
     }

+ 6 - 7
hx-serve/iot-management/src/main/java/com/fjhx/workshop/service/impl/WorkshopServiceImpl.java

@@ -5,20 +5,19 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fjhx.base.BaseEntity;
+import com.fjhx.entity.workshop.Workshop;
+import com.fjhx.params.workshop.WorkshopEx;
+import com.fjhx.params.workshop.WorkshopVo;
 import com.fjhx.utils.HxBeanUtil;
 import com.fjhx.utils.WrapperUtil;
 import com.fjhx.utils.feign.UserClientUtil;
-import com.fjhx.entity.workshop.Workshop;
-import com.fjhx.params.workshop.WorkshopEx;
 import com.fjhx.workshop.mapper.WorkshopMapper;
 import com.fjhx.workshop.service.WorkshopService;
-import com.fjhx.params.workshop.WorkshopVo;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
 import java.util.Map;
-import java.util.stream.Collectors;
 
 /**
  * <p>
@@ -48,9 +47,9 @@ public class WorkshopServiceImpl extends ServiceImpl<WorkshopMapper, Workshop> i
         Page<WorkshopEx> result = HxBeanUtil.copyPageEx(page, WorkshopEx.class);
 
         // 赋值车间负责人名称
-        List<Long> userIdList = page.getRecords().stream().map(Workshop::getResponsibleUserId).collect(Collectors.toList());
-        Map<Long, String> userNameMap = UserClientUtil.getUserNameMapByLong(userIdList);
-        result.getRecords().forEach(item -> item.setResponsibleUserName(userNameMap.get(item.getResponsibleUserId())));
+        List<WorkshopEx> records = result.getRecords();
+        Map<Long, String> userNameMap = UserClientUtil.getUserNameMapFunctionLong(records, Workshop::getResponsibleUserId);
+        records.forEach(item -> item.setResponsibleUserName(userNameMap.get(item.getResponsibleUserId())));
 
         return result;
     }

+ 34 - 0
hx-serve/pom.xml

@@ -23,6 +23,7 @@
     <modules>
         <module>iot-management</module>
         <module>storage</module>
+        <module>product-library</module>
     </modules>
 
     <dependencyManagement>
@@ -56,8 +57,41 @@
                 <version>${hx.version}</version>
             </dependency>
 
+            <dependency>
+                <groupId>com.fjhx</groupId>
+                <artifactId>product-library-api</artifactId>
+                <version>${hx.version}</version>
+            </dependency>
+
         </dependencies>
     </dependencyManagement>
 
+    <build>
+        <resources>
+            <resource>
+                <directory>src/main/resources</directory>
+            </resource>
+            <resource>
+                <directory>src/main/java</directory>
+                <includes>
+                    <include>**/*.xml</include>
+                </includes>
+            </resource>
+        </resources>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <version>2.3.1.RELEASE</version>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>repackage</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
 
 </project>

+ 33 - 0
hx-serve/product-library/pom.xml

@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>hx-serve</artifactId>
+        <groupId>com.fjhx</groupId>
+        <version>3.2.0</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>product-library</artifactId>
+
+    <properties>
+        <maven.compiler.source>8</maven.compiler.source>
+        <maven.compiler.target>8</maven.compiler.target>
+    </properties>
+
+    <dependencies>
+
+        <dependency>
+            <groupId>com.fjhx</groupId>
+            <artifactId>hx-tool</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.fjhx</groupId>
+            <artifactId>product-library-api</artifactId>
+        </dependency>
+
+    </dependencies>
+
+</project>

+ 19 - 0
hx-serve/product-library/src/main/java/com/fjhx/ProductLibraryApplication.java

@@ -0,0 +1,19 @@
+package com.fjhx;
+
+import org.springblade.core.launch.BladeApplication;
+import org.springframework.cloud.client.SpringCloudApplication;
+
+/**
+ * 产品库模块启动器
+ */
+@SpringCloudApplication
+public class ProductLibraryApplication {
+
+    private static final String APP_NAME = "product-library";
+
+    public static void main(String[] args) {
+        // 调用ApiConstant.Server赋值appName会出现单服务打包失败的情况
+        BladeApplication.run(APP_NAME, ProductLibraryApplication.class, args);
+    }
+
+}

+ 13 - 0
hx-serve/product-library/src/main/resources/application-dev.yml

@@ -0,0 +1,13 @@
+# 服务器端口
+server:
+  port: 8400
+logging:
+  level:
+    org.springframework.data.mongodb.core: DEBUG
+# 数据源配置
+spring:
+  # 数据库
+  datasource:
+    url: ${blade.datasource.product_library.dev.url}
+    username: ${blade.datasource.product_library.dev.username}
+    password: ${blade.datasource.product_library.dev.password}

+ 12 - 0
hx-serve/product-library/src/main/resources/application-prod.yml

@@ -0,0 +1,12 @@
+# 服务器端口
+server:
+  port: 8400
+
+# 数据源配置
+spring:
+  # 数据库
+  datasource:
+    url: ${blade.datasource.product_library.prod.url}
+    username: ${blade.datasource.product_library.prod.username}
+    password: ${blade.datasource.product_library.prod.password}
+

+ 11 - 0
hx-serve/product-library/src/main/resources/application-test.yml

@@ -0,0 +1,11 @@
+# 服务器端口
+server:
+  port: 8400
+
+# 数据源配置
+spring:
+  # 数据库
+  datasource:
+    url: ${blade.datasource.product_library.test.url}
+    username: ${blade.datasource.product_library.test.username}
+    password: ${blade.datasource.product_library.test.password}

+ 0 - 28
hx-serve/storage/pom.xml

@@ -30,32 +30,4 @@
 
     </dependencies>
 
-    <build>
-        <resources>
-            <resource>
-                <directory>src/main/resources</directory>
-            </resource>
-            <resource>
-                <directory>src/main/java</directory>
-                <includes>
-                    <include>**/*.xml</include>
-                </includes>
-            </resource>
-        </resources>
-        <plugins>
-            <plugin>
-                <groupId>org.springframework.boot</groupId>
-                <artifactId>spring-boot-maven-plugin</artifactId>
-                <version>2.3.1.RELEASE</version>
-                <executions>
-                    <execution>
-                        <goals>
-                            <goal>repackage</goal>
-                        </goals>
-                    </execution>
-                </executions>
-            </plugin>
-        </plugins>
-    </build>
-
 </project>