From 883fc770110017cc1fc63a322182d299b70b9c5a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=86=B7=E5=86=B7?= <2270033969@qq.com>
Date: Sun, 1 Sep 2024 14:11:01 +0800
Subject: [PATCH] =?UTF-8?q?refactor(common-excel):=20=E6=94=AF=E6=8C=81?=
=?UTF-8?q?=E5=AD=97=E5=85=B8=E8=87=AA=E5=8A=A8=E8=BD=AC=E6=8D=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pig-common/pig-common-core/pom.xml | 4 ++++
.../common/core/config/RestTemplateConfiguration.java | 8 ++++++++
.../pig/common/excel/ExcelAutoConfiguration.java | 10 ++++++++++
.../com/pig4cloud/pig/admin/api/vo/UserExcelVO.java | 2 +-
4 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/pig-common/pig-common-core/pom.xml b/pig-common/pig-common-core/pom.xml
index 296f2703..44230135 100755
--- a/pig-common/pig-common-core/pom.xml
+++ b/pig-common/pig-common-core/pom.xml
@@ -61,5 +61,9 @@
spring-webmvc
provided
+
+ org.springframework.cloud
+ spring-cloud-commons
+
diff --git a/pig-common/pig-common-core/src/main/java/com/pig4cloud/pig/common/core/config/RestTemplateConfiguration.java b/pig-common/pig-common-core/src/main/java/com/pig4cloud/pig/common/core/config/RestTemplateConfiguration.java
index 39f5e994..a72eb8d6 100755
--- a/pig-common/pig-common-core/src/main/java/com/pig4cloud/pig/common/core/config/RestTemplateConfiguration.java
+++ b/pig-common/pig-common-core/src/main/java/com/pig4cloud/pig/common/core/config/RestTemplateConfiguration.java
@@ -17,6 +17,8 @@
package com.pig4cloud.pig.common.core.config;
import org.springframework.boot.autoconfigure.AutoConfiguration;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;
@@ -27,7 +29,13 @@ import org.springframework.web.client.RestTemplate;
@AutoConfiguration
public class RestTemplateConfiguration {
+ /**
+ * 动态 REST 模板
+ * @return {@link RestTemplate }
+ */
@Bean
+ @LoadBalanced
+ @ConditionalOnProperty(value = "spring.cloud.nacos.discovery.enabled", havingValue = "true", matchIfMissing = true)
public RestTemplate restTemplate() {
return new RestTemplate();
}
diff --git a/pig-common/pig-common-excel/src/main/java/com/pig4cloud/pig/common/excel/ExcelAutoConfiguration.java b/pig-common/pig-common-excel/src/main/java/com/pig4cloud/pig/common/excel/ExcelAutoConfiguration.java
index 1cdac4bf..fce7ae2e 100644
--- a/pig-common/pig-common-excel/src/main/java/com/pig4cloud/pig/common/excel/ExcelAutoConfiguration.java
+++ b/pig-common/pig-common-excel/src/main/java/com/pig4cloud/pig/common/excel/ExcelAutoConfiguration.java
@@ -16,6 +16,16 @@ import org.springframework.web.client.RestTemplate;
@AutoConfiguration
public class ExcelAutoConfiguration {
+ /**
+ * REST 模板
+ * @return {@link RestTemplate }
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public RestTemplate restTemplate() {
+ return new RestTemplate();
+ }
+
/**
* dict 数据提供程序
* @param restTemplate REST 模板
diff --git a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/UserExcelVO.java b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/UserExcelVO.java
index d897a1b1..0cd3b038 100644
--- a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/UserExcelVO.java
+++ b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/UserExcelVO.java
@@ -96,7 +96,7 @@ public class UserExcelVO implements Serializable {
* 锁定标记
*/
@ExcelProperty("锁定标记,0:正常,9:已锁定")
- @DictTypeProperty("lock_flagX")
+ @DictTypeProperty("lock_flag")
private String lockFlag;
/**