From fd064abfbe83310765faed10c259c7abd9900519 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Tue, 2 Sep 2025 09:43:26 +0800 Subject: [PATCH 01/12] =?UTF-8?q?fix=EF=BC=9A=E3=80=90infra=20=E5=9F=BA?= =?UTF-8?q?=E7=A1=80=E8=AE=BE=E6=96=BD=E3=80=91=E5=AF=BC=E5=87=BA=20excel?= =?UTF-8?q?=20=E5=8F=82=E6=95=B0=E4=B8=8D=E6=AD=A3=E7=A1=AE=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/codegen/vue3/views/components/list_sub_erp.vue.vm | 2 +- .../src/main/resources/codegen/vue3/views/index.vue.vm | 2 +- .../resources/codegen/vue3_vben5_antd/general/api/api.ts.vm | 2 +- .../codegen/vue3_vben5_antd/general/views/index.vue.vm | 2 +- .../vue3_vben5_antd/general/views/modules/list_sub_erp.vue.vm | 2 +- .../main/resources/codegen/vue3_vben5_antd/schema/api/api.ts.vm | 2 +- .../resources/codegen/vue3_vben5_antd/schema/views/index.vue.vm | 2 +- .../vue3_vben5_antd/schema/views/modules/list_sub_erp.vue.vm | 2 +- .../main/resources/codegen/vue3_vben5_ele/general/api/api.ts.vm | 2 +- .../resources/codegen/vue3_vben5_ele/general/views/index.vue.vm | 2 +- .../vue3_vben5_ele/general/views/modules/list_sub_erp.vue.vm | 2 +- .../main/resources/codegen/vue3_vben5_ele/schema/api/api.ts.vm | 2 +- .../resources/codegen/vue3_vben5_ele/schema/views/index.vue.vm | 2 +- .../vue3_vben5_ele/schema/views/modules/list_sub_erp.vue.vm | 2 +- 14 files changed, 14 insertions(+), 14 deletions(-) diff --git a/yudao-module-infra/src/main/resources/codegen/vue3/views/components/list_sub_erp.vue.vm b/yudao-module-infra/src/main/resources/codegen/vue3/views/components/list_sub_erp.vue.vm index a94cab5a59..29df64de16 100644 --- a/yudao-module-infra/src/main/resources/codegen/vue3/views/components/list_sub_erp.vue.vm +++ b/yudao-module-infra/src/main/resources/codegen/vue3/views/components/list_sub_erp.vue.vm @@ -217,7 +217,7 @@ const handleDeleteBatch = async () => { const checkedIds = ref([]) const handleRowCheckboxChange = (records: ${subSimpleClassName}[]) => { - checkedIds.value = records.map((item) => item.id); + checkedIds.value = records.map((item) => item.id!); } #end #end diff --git a/yudao-module-infra/src/main/resources/codegen/vue3/views/index.vue.vm b/yudao-module-infra/src/main/resources/codegen/vue3/views/index.vue.vm index dfb97804ce..fb7485d6d5 100644 --- a/yudao-module-infra/src/main/resources/codegen/vue3/views/index.vue.vm +++ b/yudao-module-infra/src/main/resources/codegen/vue3/views/index.vue.vm @@ -374,7 +374,7 @@ const handleDeleteBatch = async () => { const checkedIds = ref([]) const handleRowCheckboxChange = (records: ${simpleClassName}[]) => { - checkedIds.value = records.map((item) => item.id); + checkedIds.value = records.map((item) => item.id!); } #end diff --git a/yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/general/api/api.ts.vm b/yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/general/api/api.ts.vm index 090b14845b..c3691a8b73 100644 --- a/yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/general/api/api.ts.vm +++ b/yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/general/api/api.ts.vm @@ -98,7 +98,7 @@ export function delete${simpleClassName}List(ids: number[]) { /** 导出${table.classComment} */ export function export${simpleClassName}(params: any) { - return requestClient.download('${baseURL}/export-excel', params); + return requestClient.download('${baseURL}/export-excel', { params }); } ## 特殊:主子表专属逻辑 diff --git a/yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/general/views/index.vue.vm b/yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/general/views/index.vue.vm index 6553ed0c87..e1c2b08f26 100644 --- a/yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/general/views/index.vue.vm +++ b/yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/general/views/index.vue.vm @@ -182,7 +182,7 @@ function handleRowCheckboxChange({ }: { records: ${simpleClassName}Api.${simpleClassName}[]; }) { - checkedIds.value = records.map((item) => item.id); + checkedIds.value = records.map((item) => item.id!); } #end diff --git a/yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/general/views/modules/list_sub_erp.vue.vm b/yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/general/views/modules/list_sub_erp.vue.vm index 999257d91d..3ff72bf931 100644 --- a/yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/general/views/modules/list_sub_erp.vue.vm +++ b/yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/general/views/modules/list_sub_erp.vue.vm @@ -106,7 +106,7 @@ function handleRowCheckboxChange({ }: { records: ${simpleClassName}Api.${subSimpleClassName}[]; }) { - checkedIds.value = records.map((item) => item.id); + checkedIds.value = records.map((item) => item.id!); } #end #end diff --git a/yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/schema/api/api.ts.vm b/yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/schema/api/api.ts.vm index 875cd6bb8f..682e5923ae 100644 --- a/yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/schema/api/api.ts.vm +++ b/yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/schema/api/api.ts.vm @@ -98,7 +98,7 @@ export function delete${simpleClassName}List(ids: number[]) { /** 导出${table.classComment} */ export function export${simpleClassName}(params: any) { - return requestClient.download('${baseURL}/export-excel', params); + return requestClient.download('${baseURL}/export-excel', { params }); } ## 特殊:主子表专属逻辑 diff --git a/yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/schema/views/index.vue.vm b/yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/schema/views/index.vue.vm index 1e13de2e97..493603d801 100644 --- a/yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/schema/views/index.vue.vm +++ b/yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/schema/views/index.vue.vm @@ -119,7 +119,7 @@ function handleRowCheckboxChange({ }: { records: ${simpleClassName}Api.${simpleClassName}[]; }) { - checkedIds.value = records.map((item) => item.id); + checkedIds.value = records.map((item) => item.id!); } #end diff --git a/yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/schema/views/modules/list_sub_erp.vue.vm b/yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/schema/views/modules/list_sub_erp.vue.vm index e046226efc..3cc6be8246 100644 --- a/yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/schema/views/modules/list_sub_erp.vue.vm +++ b/yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/schema/views/modules/list_sub_erp.vue.vm @@ -99,7 +99,7 @@ function handleRowCheckboxChange({ }: { records: ${simpleClassName}Api.${subSimpleClassName}[]; }) { - checkedIds.value = records.map((item) => item.id); + checkedIds.value = records.map((item) => item.id!); } #end diff --git a/yudao-module-infra/src/main/resources/codegen/vue3_vben5_ele/general/api/api.ts.vm b/yudao-module-infra/src/main/resources/codegen/vue3_vben5_ele/general/api/api.ts.vm index 090b14845b..c3691a8b73 100644 --- a/yudao-module-infra/src/main/resources/codegen/vue3_vben5_ele/general/api/api.ts.vm +++ b/yudao-module-infra/src/main/resources/codegen/vue3_vben5_ele/general/api/api.ts.vm @@ -98,7 +98,7 @@ export function delete${simpleClassName}List(ids: number[]) { /** 导出${table.classComment} */ export function export${simpleClassName}(params: any) { - return requestClient.download('${baseURL}/export-excel', params); + return requestClient.download('${baseURL}/export-excel', { params }); } ## 特殊:主子表专属逻辑 diff --git a/yudao-module-infra/src/main/resources/codegen/vue3_vben5_ele/general/views/index.vue.vm b/yudao-module-infra/src/main/resources/codegen/vue3_vben5_ele/general/views/index.vue.vm index ae77cd4c7b..14d5bb3cae 100644 --- a/yudao-module-infra/src/main/resources/codegen/vue3_vben5_ele/general/views/index.vue.vm +++ b/yudao-module-infra/src/main/resources/codegen/vue3_vben5_ele/general/views/index.vue.vm @@ -177,7 +177,7 @@ function handleRowCheckboxChange({ }: { records: ${simpleClassName}Api.${simpleClassName}[]; }) { - checkedIds.value = records.map((item) => item.id); + checkedIds.value = records.map((item) => item.id!); } #end diff --git a/yudao-module-infra/src/main/resources/codegen/vue3_vben5_ele/general/views/modules/list_sub_erp.vue.vm b/yudao-module-infra/src/main/resources/codegen/vue3_vben5_ele/general/views/modules/list_sub_erp.vue.vm index ccad79a0d9..11cd4750b1 100644 --- a/yudao-module-infra/src/main/resources/codegen/vue3_vben5_ele/general/views/modules/list_sub_erp.vue.vm +++ b/yudao-module-infra/src/main/resources/codegen/vue3_vben5_ele/general/views/modules/list_sub_erp.vue.vm @@ -101,7 +101,7 @@ function handleRowCheckboxChange({ }: { records: ${simpleClassName}Api.${subSimpleClassName}[]; }) { - checkedIds.value = records.map((item) => item.id); + checkedIds.value = records.map((item) => item.id!); } #end #end diff --git a/yudao-module-infra/src/main/resources/codegen/vue3_vben5_ele/schema/api/api.ts.vm b/yudao-module-infra/src/main/resources/codegen/vue3_vben5_ele/schema/api/api.ts.vm index 875cd6bb8f..682e5923ae 100644 --- a/yudao-module-infra/src/main/resources/codegen/vue3_vben5_ele/schema/api/api.ts.vm +++ b/yudao-module-infra/src/main/resources/codegen/vue3_vben5_ele/schema/api/api.ts.vm @@ -98,7 +98,7 @@ export function delete${simpleClassName}List(ids: number[]) { /** 导出${table.classComment} */ export function export${simpleClassName}(params: any) { - return requestClient.download('${baseURL}/export-excel', params); + return requestClient.download('${baseURL}/export-excel', { params }); } ## 特殊:主子表专属逻辑 diff --git a/yudao-module-infra/src/main/resources/codegen/vue3_vben5_ele/schema/views/index.vue.vm b/yudao-module-infra/src/main/resources/codegen/vue3_vben5_ele/schema/views/index.vue.vm index c29beb9aa9..203db04830 100644 --- a/yudao-module-infra/src/main/resources/codegen/vue3_vben5_ele/schema/views/index.vue.vm +++ b/yudao-module-infra/src/main/resources/codegen/vue3_vben5_ele/schema/views/index.vue.vm @@ -113,7 +113,7 @@ function handleRowCheckboxChange({ }: { records: ${simpleClassName}Api.${simpleClassName}[]; }) { - checkedIds.value = records.map((item) => item.id); + checkedIds.value = records.map((item) => item.id!); } #end diff --git a/yudao-module-infra/src/main/resources/codegen/vue3_vben5_ele/schema/views/modules/list_sub_erp.vue.vm b/yudao-module-infra/src/main/resources/codegen/vue3_vben5_ele/schema/views/modules/list_sub_erp.vue.vm index 13a2415efd..f2787a0ebc 100644 --- a/yudao-module-infra/src/main/resources/codegen/vue3_vben5_ele/schema/views/modules/list_sub_erp.vue.vm +++ b/yudao-module-infra/src/main/resources/codegen/vue3_vben5_ele/schema/views/modules/list_sub_erp.vue.vm @@ -93,7 +93,7 @@ function handleRowCheckboxChange({ }: { records: ${simpleClassName}Api.${subSimpleClassName}[]; }) { - checkedIds.value = records.map((item) => item.id); + checkedIds.value = records.map((item) => item.id!); } #end From 100bdf8230771627b6a6996f43f6cc0538bbf6ad Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 20 Sep 2025 11:02:39 +0800 Subject: [PATCH 02/12] =?UTF-8?q?fix=EF=BC=9A=E3=80=90ai=20=E5=A4=A7?= =?UTF-8?q?=E6=A8=A1=E5=9E=8B=E3=80=91swagger-annotations-jakarta=20?= =?UTF-8?q?=E4=BE=9D=E8=B5=96=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yudao-module-ai/pom.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/yudao-module-ai/pom.xml b/yudao-module-ai/pom.xml index 06c9cc0ca9..95a28979a1 100644 --- a/yudao-module-ai/pom.xml +++ b/yudao-module-ai/pom.xml @@ -78,6 +78,12 @@ org.springframework.ai spring-ai-starter-model-openai ${spring-ai.version} + + + io.swagger.core.v3 + swagger-annotations-jakarta + + org.springframework.ai From a6d9da31e8d75947ebbc0f2149e24e971d1be086 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 20 Sep 2025 11:54:01 +0800 Subject: [PATCH 03/12] =?UTF-8?q?fix=EF=BC=9A=E3=80=90framework=20?= =?UTF-8?q?=E6=A1=86=E6=9E=B6=E3=80=91JacksonTypeHandler=20=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=20String=20=E5=A4=84=E7=90=86=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mybatis/config/YudaoMybatisAutoConfiguration.java | 5 +++-- .../yudao/framework/mybatis/core/dataobject/BaseDO.java | 5 +++-- .../yudao/module/pay/service/order/PayOrderServiceTest.java | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/config/YudaoMybatisAutoConfiguration.java b/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/config/YudaoMybatisAutoConfiguration.java index 4cbb91c2cc..775447a060 100644 --- a/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/config/YudaoMybatisAutoConfiguration.java +++ b/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/config/YudaoMybatisAutoConfiguration.java @@ -6,6 +6,7 @@ import cn.iocoder.yudao.framework.common.util.json.JsonUtils; import cn.iocoder.yudao.framework.mybatis.core.handler.DefaultDBFieldHandler; import com.baomidou.mybatisplus.annotation.DbType; import com.baomidou.mybatisplus.autoconfigure.MybatisPlusAutoConfiguration; +import com.baomidou.mybatisplus.core.handlers.IJsonTypeHandler; import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler; import com.baomidou.mybatisplus.core.incrementer.IKeyGenerator; import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; @@ -80,8 +81,8 @@ public class YudaoMybatisAutoConfiguration { throw new IllegalArgumentException(StrUtil.format("DbType{} 找不到合适的 IKeyGenerator 实现类", dbType)); } - @Bean - public JacksonTypeHandler jacksonTypeHandler(List objectMappers) { + @Bean // 特殊:返回结果使用 Object 而不用 JacksonTypeHandler 的原因,避免因为 JacksonTypeHandler 被 mybatis 全局使用! + public Object jacksonTypeHandler(List objectMappers) { // 特殊:设置 JacksonTypeHandler 的 ObjectMapper! ObjectMapper objectMapper = CollUtil.getFirst(objectMappers); if (objectMapper == null) { diff --git a/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/dataobject/BaseDO.java b/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/dataobject/BaseDO.java index a79fb2a73c..7e07fd8e32 100644 --- a/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/dataobject/BaseDO.java +++ b/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/dataobject/BaseDO.java @@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.TableLogic; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fhs.core.trans.vo.TransPojo; import lombok.Data; +import org.apache.ibatis.type.JdbcType; import java.io.Serializable; import java.time.LocalDateTime; @@ -37,14 +38,14 @@ public abstract class BaseDO implements Serializable, TransPojo { * * 使用 String 类型的原因是,未来可能会存在非数值的情况,留好拓展性。 */ - @TableField(fill = FieldFill.INSERT) + @TableField(fill = FieldFill.INSERT, jdbcType = JdbcType.VARCHAR) private String creator; /** * 更新者,目前使用 SysUser 的 id 编号 * * 使用 String 类型的原因是,未来可能会存在非数值的情况,留好拓展性。 */ - @TableField(fill = FieldFill.INSERT_UPDATE) + @TableField(fill = FieldFill.INSERT_UPDATE, jdbcType = JdbcType.VARCHAR) private String updater; /** * 是否删除 diff --git a/yudao-module-pay/src/test/java/cn/iocoder/yudao/module/pay/service/order/PayOrderServiceTest.java b/yudao-module-pay/src/test/java/cn/iocoder/yudao/module/pay/service/order/PayOrderServiceTest.java index cac08e9f65..3172c5e2fd 100755 --- a/yudao-module-pay/src/test/java/cn/iocoder/yudao/module/pay/service/order/PayOrderServiceTest.java +++ b/yudao-module-pay/src/test/java/cn/iocoder/yudao/module/pay/service/order/PayOrderServiceTest.java @@ -610,7 +610,7 @@ public class PayOrderServiceTest extends BaseDbAndRedisUnitTest { orderExtensionMapper.insert(orderExtension); // 重要:需要将 order 的 extensionId 更新下 order.setExtensionId(orderExtension.getId()); - orderMapper.updateById(new PayOrderDO().setId(order.getId()).setExtensionId(orderExtension.getId())); + orderMapper.updateById(order); // 准备参数 PayChannelDO channel = randomPojo(PayChannelDO.class, o -> o.setId(10L)); PayOrderRespDTO notify = randomPojo(PayOrderRespDTO.class, From 21bd03b4cd31241e2a41d68a9cfb055a920a4799 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 20 Sep 2025 12:09:46 +0800 Subject: [PATCH 04/12] =?UTF-8?q?fix=EF=BC=9A=E3=80=90iot=20=E7=89=A9?= =?UTF-8?q?=E8=81=94=E7=BD=91=E3=80=91=E5=A2=9E=E5=BC=BA=20jdk8=20?= =?UTF-8?q?=E7=9A=84=E5=85=BC=E5=AE=B9=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gateway/protocol/mqtt/manager/IotMqttConnectionManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yudao-module-iot/yudao-module-iot-gateway/src/main/java/cn/iocoder/yudao/module/iot/gateway/protocol/mqtt/manager/IotMqttConnectionManager.java b/yudao-module-iot/yudao-module-iot-gateway/src/main/java/cn/iocoder/yudao/module/iot/gateway/protocol/mqtt/manager/IotMqttConnectionManager.java index 3fd1a3a041..d7c4adbd00 100644 --- a/yudao-module-iot/yudao-module-iot-gateway/src/main/java/cn/iocoder/yudao/module/iot/gateway/protocol/mqtt/manager/IotMqttConnectionManager.java +++ b/yudao-module-iot/yudao-module-iot-gateway/src/main/java/cn/iocoder/yudao/module/iot/gateway/protocol/mqtt/manager/IotMqttConnectionManager.java @@ -125,7 +125,7 @@ public class IotMqttConnectionManager { */ public IotMqttConnectionManager.ConnectionInfo getConnectionInfoByDeviceId(Long deviceId) { // 通过设备 ID 获取连接端点 - var endpoint = getDeviceEndpoint(deviceId); + MqttEndpoint endpoint = getDeviceEndpoint(deviceId); if (endpoint == null) { return null; } From ef0bf372e51dedd0374d7712a7417090ee4a1a6e Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 20 Sep 2025 12:20:08 +0800 Subject: [PATCH 05/12] =?UTF-8?q?fix=EF=BC=9A=E3=80=90iot=20=E7=89=A9?= =?UTF-8?q?=E8=81=94=E7=BD=91=E3=80=91=E8=AE=BE=E5=A4=87=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=20CONFIG=5FPUSH=20=E5=BA=94=E8=AF=A5=E6=98=AF=E4=B8=8B?= =?UTF-8?q?=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yudao/module/iot/core/enums/IotDeviceMessageMethodEnum.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yudao-module-iot/yudao-module-iot-core/src/main/java/cn/iocoder/yudao/module/iot/core/enums/IotDeviceMessageMethodEnum.java b/yudao-module-iot/yudao-module-iot-core/src/main/java/cn/iocoder/yudao/module/iot/core/enums/IotDeviceMessageMethodEnum.java index 047fe5ffcd..e62b78e245 100644 --- a/yudao-module-iot/yudao-module-iot-core/src/main/java/cn/iocoder/yudao/module/iot/core/enums/IotDeviceMessageMethodEnum.java +++ b/yudao-module-iot/yudao-module-iot-core/src/main/java/cn/iocoder/yudao/module/iot/core/enums/IotDeviceMessageMethodEnum.java @@ -43,7 +43,7 @@ public enum IotDeviceMessageMethodEnum implements ArrayValuable { // ========== 设备配置 ========== // 可参考:https://help.aliyun.com/zh/iot/user-guide/remote-configuration-1 - CONFIG_PUSH("thing.config.push", "配置推送", true), + CONFIG_PUSH("thing.config.push", "配置推送", false), // ========== OTA 固件 ========== // 可参考:https://help.aliyun.com/zh/iot/user-guide/perform-ota-updates From f441de534b62e70edaef986ba746516d0285812e Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 20 Sep 2025 12:30:18 +0800 Subject: [PATCH 06/12] =?UTF-8?q?fix=EF=BC=9A=E3=80=90bpm=20=E5=B7=A5?= =?UTF-8?q?=E4=BD=9C=E6=B5=81=E3=80=91=E6=B5=81=E7=A8=8B=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=20ID=20=E5=BA=8F=E5=8F=B7=EF=BC=8C=E6=97=A0=20infix?= =?UTF-8?q?=20=E5=89=8D=E7=BC=80=E6=97=B6=EF=BC=8C=E6=B0=B8=E4=B8=8D?= =?UTF-8?q?=E8=BF=87=E6=9C=9F=EF=BC=8C=E5=8F=AF=E8=A7=81=20https://t.zsxq.?= =?UTF-8?q?com/MU1E2=20=E8=AE=A8=E8=AE=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yudao/module/bpm/dal/redis/BpmProcessIdRedisDAO.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/yudao-module-bpm/src/main/java/cn/iocoder/yudao/module/bpm/dal/redis/BpmProcessIdRedisDAO.java b/yudao-module-bpm/src/main/java/cn/iocoder/yudao/module/bpm/dal/redis/BpmProcessIdRedisDAO.java index 1f9cd5f49d..2a14f51a47 100644 --- a/yudao-module-bpm/src/main/java/cn/iocoder/yudao/module/bpm/dal/redis/BpmProcessIdRedisDAO.java +++ b/yudao-module-bpm/src/main/java/cn/iocoder/yudao/module/bpm/dal/redis/BpmProcessIdRedisDAO.java @@ -51,8 +51,8 @@ public class BpmProcessIdRedisDAO { String noPrefix = processIdRule.getPrefix() + infix + processIdRule.getPostfix(); String key = RedisKeyConstants.BPM_PROCESS_ID + noPrefix; Long no = stringRedisTemplate.opsForValue().increment(key); - if (StrUtil.isNotEmpty(infix)) { - // 特殊:没有前缀,则不能过期,不能每次都是从 0 开始 + if (StrUtil.isEmpty(infix)) { + // 特殊:没有前缀,则不能过期,不能每次都是从 0 开始。可见 https://t.zsxq.com/MU1E2 讨论 stringRedisTemplate.expire(key, Duration.ofDays(1L)); } return noPrefix + String.format("%0" + processIdRule.getLength() + "d", no); From d9e729e1a832c6a6f20589979b0e0b21ad2c0533 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 20 Sep 2025 15:19:02 +0800 Subject: [PATCH 07/12] =?UTF-8?q?fix=EF=BC=9A=E3=80=90framework=20?= =?UTF-8?q?=E6=A1=86=E6=9E=B6=E3=80=91=20app-api=20=E5=89=8D=E7=BC=80?= =?UTF-8?q?=E4=B8=8D=E7=94=9F=E6=95=88=EF=BC=8C=E9=83=BD=E6=98=AF=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=20admin-api?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../config/YudaoSwaggerAutoConfiguration.java | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/swagger/config/YudaoSwaggerAutoConfiguration.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/swagger/config/YudaoSwaggerAutoConfiguration.java index dec79d8eb6..ef874af3be 100644 --- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/swagger/config/YudaoSwaggerAutoConfiguration.java +++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/swagger/config/YudaoSwaggerAutoConfiguration.java @@ -11,6 +11,7 @@ import io.swagger.v3.oas.models.parameters.Parameter; import io.swagger.v3.oas.models.security.SecurityRequirement; import io.swagger.v3.oas.models.security.SecurityScheme; import org.springdoc.core.customizers.OpenApiBuilderCustomizer; +import org.springdoc.core.customizers.OperationCustomizer; import org.springdoc.core.customizers.ServerBaseUrlCustomizer; import org.springdoc.core.models.GroupedOpenApi; import org.springdoc.core.properties.SpringDocConfigProperties; @@ -127,6 +128,7 @@ public class YudaoSwaggerAutoConfiguration { .addOperationCustomizer((operation, handlerMethod) -> operation .addParametersItem(buildTenantHeaderParameter()) .addParametersItem(buildSecurityHeaderParameter())) + .addOperationCustomizer(buildOperationIdCustomizer()) .build(); } @@ -158,5 +160,26 @@ public class YudaoSwaggerAutoConfiguration { .schema(new StringSchema()._default("Bearer test1").name(HEADER_TENANT_ID).description("认证 Token")); // 默认:使用用户编号为 1 } + /** + * 核心:自定义OperationId生成规则,组合「类名前缀 + 方法名」 + * + * @see app-api 前缀不生效,都是使用 admin-api + */ + private static OperationCustomizer buildOperationIdCustomizer() { + return (operation, handlerMethod) -> { + // 1. 获取控制器类名(如 UserController) + String className = handlerMethod.getBeanType().getSimpleName(); + // 2. 提取类名前缀(去除 Controller 后缀,如 UserController -> User) + String classPrefix = className.replaceAll("Controller$", ""); + // 3. 获取方法名(如 list) + String methodName = handlerMethod.getMethod().getName(); + // 4. 组合生成 operationId(如 User_list) + String operationId = classPrefix + "_" + methodName; + // 5. 设置自定义 operationId + operation.setOperationId(operationId); + return operation; + }; + } + } From 5ca386bfac7096253c04a93c251f7056df2735d2 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 20 Sep 2025 16:01:56 +0800 Subject: [PATCH 08/12] =?UTF-8?q?fix=EF=BC=9A=E3=80=90framework=20?= =?UTF-8?q?=E6=A1=86=E6=9E=B6=E3=80=91knife4j=20=E5=9C=A8=E6=94=B9?= =?UTF-8?q?=E5=8C=85=E4=B8=8B=EF=BC=8CKnife4jOpenApiCustomizer=20=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E7=94=9F=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../swagger/config/YudaoSwaggerAutoConfiguration.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/swagger/config/YudaoSwaggerAutoConfiguration.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/swagger/config/YudaoSwaggerAutoConfiguration.java index ef874af3be..e77a065f99 100644 --- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/swagger/config/YudaoSwaggerAutoConfiguration.java +++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/swagger/config/YudaoSwaggerAutoConfiguration.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.framework.swagger.config; +import com.github.xiaoymin.knife4j.spring.configuration.Knife4jAutoConfiguration; import io.swagger.v3.oas.models.Components; import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.info.Contact; @@ -44,7 +45,7 @@ import static cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils.HEADER_ * * @author 芋道源码 */ -@AutoConfiguration +@AutoConfiguration(before = Knife4jAutoConfiguration.class) // before 原因,保证覆写的 Knife4jOpenApiCustomizer 先生效!相关 https://github.com/YunaiV/ruoyi-vue-pro/issues/954 讨论 @ConditionalOnClass({OpenAPI.class}) @EnableConfigurationProperties(SwaggerProperties.class) @ConditionalOnProperty(prefix = "springdoc.api-docs", name = "enabled", havingValue = "true", matchIfMissing = true) // 设置为 false 时,禁用 From d40c2a39de50f9e683cf5e9ceb02e5a61bda6889 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 20 Sep 2025 18:10:05 +0800 Subject: [PATCH 09/12] =?UTF-8?q?fix=EF=BC=9A=E3=80=90infra=20=E5=9F=BA?= =?UTF-8?q?=E7=A1=80=E8=AE=BE=E6=96=BD=E3=80=91=E6=96=87=E4=BB=B6=E8=B7=AF?= =?UTF-8?q?=E5=BE=84url=20"+"=E5=8F=B7=E8=A7=A3=E7=A0=81=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module/infra/controller/admin/file/FileController.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/FileController.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/FileController.java index f21e79a188..a12ba3934e 100644 --- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/FileController.java +++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/FileController.java @@ -26,6 +26,7 @@ import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; +import java.nio.charset.StandardCharsets; import java.util.List; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; @@ -99,8 +100,10 @@ public class FileController { if (StrUtil.isEmpty(path)) { throw new IllegalArgumentException("结尾的 path 路径必须传递"); } - // 解码,解决中文路径的问题 https://gitee.com/zhijiantianya/ruoyi-vue-pro/pulls/807/ - path = URLUtil.decode(path); + // 解码,解决中文路径的问题 + // https://gitee.com/zhijiantianya/ruoyi-vue-pro/pulls/807/ + // https://gitee.com/zhijiantianya/ruoyi-vue-pro/pulls/1432/ + path = URLUtil.decode(path, StandardCharsets.UTF_8, false); // 读取内容 byte[] content = fileService.getFileContent(configId, path); From 66d9abeabe1bcd835a7220cf6b2fa8301bd99138 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 20 Sep 2025 18:14:30 +0800 Subject: [PATCH 10/12] =?UTF-8?q?fix=EF=BC=9A=E3=80=90bpm=20=E5=B7=A5?= =?UTF-8?q?=E4=BD=9C=E6=B5=81=E3=80=91=E5=AE=9A=E6=97=B6=E8=BE=B9=E7=95=8C?= =?UTF-8?q?=E4=BA=8B=E4=BB=B6=E5=9B=BA=E5=AE=9A=E6=97=A5=E6=9C=9F=E5=92=8C?= =?UTF-8?q?=E5=9B=BA=E5=AE=9A=E6=97=B6=E9=95=BF=E5=8F=82=E6=95=B0=E4=BC=A0?= =?UTF-8?q?=E5=8F=8D=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bpm/framework/flowable/core/util/SimpleModelUtils.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/yudao-module-bpm/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/util/SimpleModelUtils.java b/yudao-module-bpm/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/util/SimpleModelUtils.java index 2582399a81..cfeb2c2ded 100644 --- a/yudao-module-bpm/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/util/SimpleModelUtils.java +++ b/yudao-module-bpm/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/util/SimpleModelUtils.java @@ -737,10 +737,10 @@ public class SimpleModelUtils { BoundaryEvent boundaryEvent = null; if (node.getDelaySetting().getDelayType().equals(BpmDelayTimerTypeEnum.FIXED_DATE_TIME.getType())) { boundaryEvent = buildTimeoutBoundaryEvent(receiveTask, BpmBoundaryEventTypeEnum.DELAY_TIMER_TIMEOUT.getType(), - node.getDelaySetting().getDelayTime(), null, null); + null, null, node.getDelaySetting().getDelayTime()); } else if (node.getDelaySetting().getDelayType().equals(BpmDelayTimerTypeEnum.FIXED_TIME_DURATION.getType())) { boundaryEvent = buildTimeoutBoundaryEvent(receiveTask, BpmBoundaryEventTypeEnum.DELAY_TIMER_TIMEOUT.getType(), - null, null, node.getDelaySetting().getDelayTime()); + node.getDelaySetting().getDelayTime(), null, null); } else { throw new UnsupportedOperationException("不支持的延迟类型:" + node.getDelaySetting()); } From 6d1b7ec4147f6f9360ba53ebf248646fe21e5e82 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 20 Sep 2025 18:16:39 +0800 Subject: [PATCH 11/12] =?UTF-8?q?fix=EF=BC=9A=E3=80=90mall=20=E5=95=86?= =?UTF-8?q?=E5=9F=8E=E3=80=91RewardActivityRespVO=20=E7=9A=84=20id=20?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E4=B8=8D=E6=AD=A3=E7=A1=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/admin/reward/vo/RewardActivityRespVO.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yudao-module-mall/yudao-module-promotion/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/reward/vo/RewardActivityRespVO.java b/yudao-module-mall/yudao-module-promotion/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/reward/vo/RewardActivityRespVO.java index 67bf12153b..ab0cb8810b 100755 --- a/yudao-module-mall/yudao-module-promotion/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/reward/vo/RewardActivityRespVO.java +++ b/yudao-module-mall/yudao-module-promotion/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/reward/vo/RewardActivityRespVO.java @@ -14,7 +14,7 @@ import java.time.LocalDateTime; public class RewardActivityRespVO extends RewardActivityBaseVO { @Schema(description = "活动编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") - private Integer id; + private Long id; @Schema(description = "活动状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") private Integer status; From 568216084e83e0dcb6f299c42f6977953035afa0 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 20 Sep 2025 21:30:53 +0800 Subject: [PATCH 12/12] =?UTF-8?q?feat=EF=BC=9A=E3=80=90infra=20=E5=9F=BA?= =?UTF-8?q?=E7=A1=80=E8=AE=BE=E6=96=BD=E3=80=91ftp=E3=80=81sftp=20?= =?UTF-8?q?=E5=BA=93=E5=8D=87=E7=BA=A7=E4=B8=8E=E5=85=BC=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yudao-dependencies/pom.xml | 4 +-- yudao-module-infra/pom.xml | 2 +- .../file/core/client/ftp/FtpFileClient.java | 21 ++++++++--- .../core/client/ftp/FtpFileClientConfig.java | 5 ++- .../file/core/client/sftp/SftpFileClient.java | 36 ++++++++++++++++--- .../client/sftp/SftpFileClientConfig.java | 5 ++- 6 files changed, 56 insertions(+), 17 deletions(-) diff --git a/yudao-dependencies/pom.xml b/yudao-dependencies/pom.xml index cc696f271c..e08f834fb9 100644 --- a/yudao-dependencies/pom.xml +++ b/yudao-dependencies/pom.xml @@ -61,7 +61,7 @@ 2.14.5 3.11.1 3.18.0 - 0.1.55 + 2.27.3 3.2.2 2.7.0 3.0.6 @@ -526,7 +526,7 @@ ${commons-net.version} - com.jcraft + com.github.mwiede jsch ${jsch.version} diff --git a/yudao-module-infra/pom.xml b/yudao-module-infra/pom.xml index be053b5cae..bd0e6c7408 100644 --- a/yudao-module-infra/pom.xml +++ b/yudao-module-infra/pom.xml @@ -101,7 +101,7 @@ commons-net - com.jcraft + com.github.mwiede jsch diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/framework/file/core/client/ftp/FtpFileClient.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/framework/file/core/client/ftp/FtpFileClient.java index 4207eb7e15..93bff27ece 100644 --- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/framework/file/core/client/ftp/FtpFileClient.java +++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/framework/file/core/client/ftp/FtpFileClient.java @@ -4,6 +4,7 @@ import cn.hutool.core.io.FileUtil; import cn.hutool.core.util.CharsetUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.extra.ftp.Ftp; +import cn.hutool.extra.ftp.FtpConfig; import cn.hutool.extra.ftp.FtpException; import cn.hutool.extra.ftp.FtpMode; import cn.iocoder.yudao.module.infra.framework.file.core.client.AbstractFileClient; @@ -18,6 +19,15 @@ import java.io.ByteArrayOutputStream; */ public class FtpFileClient extends AbstractFileClient { + /** + * 连接超时时间,单位:毫秒 + */ + private static final Long CONNECTION_TIMEOUT = 3000L; + /** + * 读写超时时间,单位:毫秒 + */ + private static final Long SO_TIMEOUT = 10000L; + private Ftp ftp; public FtpFileClient(Long id, FtpFileClientConfig config) { @@ -26,9 +36,12 @@ public class FtpFileClient extends AbstractFileClient { @Override protected void doInit() { - // 初始化 Ftp 对象 - this.ftp = new Ftp(config.getHost(), config.getPort(), config.getUsername(), config.getPassword(), - CharsetUtil.CHARSET_UTF_8, null, null, FtpMode.valueOf(config.getMode())); + // 初始化 Ftp 对象:https://gitee.com/zhijiantianya/yudao-cloud/pulls/207/ + FtpConfig ftpConfig = new FtpConfig(config.getHost(), config.getPort(), config.getUsername(), config.getPassword(), + CharsetUtil.CHARSET_UTF_8, null, null); + ftpConfig.setConnectionTimeout(CONNECTION_TIMEOUT); + ftpConfig.setSoTimeout(SO_TIMEOUT); + this.ftp = new Ftp(ftpConfig, FtpMode.valueOf(config.getMode())); } @Override @@ -72,4 +85,4 @@ public class FtpFileClient extends AbstractFileClient { ftp.reconnectIfTimeout(); } -} \ No newline at end of file +} diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/framework/file/core/client/ftp/FtpFileClientConfig.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/framework/file/core/client/ftp/FtpFileClientConfig.java index a1b92ffc1c..c1cbb18e7f 100644 --- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/framework/file/core/client/ftp/FtpFileClientConfig.java +++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/framework/file/core/client/ftp/FtpFileClientConfig.java @@ -1,11 +1,10 @@ package cn.iocoder.yudao.module.infra.framework.file.core.client.ftp; import cn.iocoder.yudao.module.infra.framework.file.core.client.FileClientConfig; -import lombok.Data; -import org.hibernate.validator.constraints.URL; - import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotNull; +import lombok.Data; +import org.hibernate.validator.constraints.URL; /** * Ftp 文件客户端的配置类 diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/framework/file/core/client/sftp/SftpFileClient.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/framework/file/core/client/sftp/SftpFileClient.java index 000cbd10b3..788325f6c2 100644 --- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/framework/file/core/client/sftp/SftpFileClient.java +++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/framework/file/core/client/sftp/SftpFileClient.java @@ -1,9 +1,14 @@ package cn.iocoder.yudao.module.infra.framework.file.core.client.sftp; import cn.hutool.core.io.FileUtil; +import cn.hutool.core.util.CharsetUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.extra.ftp.FtpConfig; +import cn.hutool.extra.ssh.JschRuntimeException; import cn.hutool.extra.ssh.Sftp; import cn.iocoder.yudao.framework.common.util.io.FileUtils; import cn.iocoder.yudao.module.infra.framework.file.core.client.AbstractFileClient; +import com.jcraft.jsch.JSch; import java.io.File; @@ -14,6 +19,20 @@ import java.io.File; */ public class SftpFileClient extends AbstractFileClient { + /** + * 连接超时时间,单位:毫秒 + */ + private static final Long CONNECTION_TIMEOUT = 3000L; + /** + * 读写超时时间,单位:毫秒 + */ + private static final Long SO_TIMEOUT = 10000L; + + static { + // 某些旧的 sftp 服务器仅支持 ssh-dss 协议,该协议并不安全,默认不支持该协议,按需添加 + JSch.setConfig("server_host_key", JSch.getConfig("server_host_key") + ",ssh-dss"); + } + private Sftp sftp; public SftpFileClient(Long id, SftpFileClientConfig config) { @@ -22,18 +41,27 @@ public class SftpFileClient extends AbstractFileClient { @Override protected void doInit() { - // 初始化 Ftp 对象 - this.sftp = new Sftp(config.getHost(), config.getPort(), config.getUsername(), config.getPassword()); + // 初始化 Sftp 对象 + FtpConfig ftpConfig = new FtpConfig(config.getHost(), config.getPort(), config.getUsername(), config.getPassword(), + CharsetUtil.CHARSET_UTF_8, null, null); + ftpConfig.setConnectionTimeout(CONNECTION_TIMEOUT); + ftpConfig.setSoTimeout(SO_TIMEOUT); + this.sftp = new Sftp(ftpConfig); } @Override public String upload(byte[] content, String path, String type) { // 执行写入 String filePath = getFilePath(path); + String fileName = FileUtil.getName(filePath); + String dir = StrUtil.removeSuffix(filePath, fileName); File file = FileUtils.createTempFile(content); reconnectIfTimeout(); - sftp.mkDirs(FileUtil.getParent(filePath, 1)); // 需要创建父目录,不然会报错 - sftp.upload(filePath, file); + sftp.mkDirs(dir); // 需要创建父目录,不然会报错 + boolean success = sftp.upload(filePath, file); + if (!success) { + throw new JschRuntimeException(StrUtil.format("上传文件到目标目录 ({}) 失败", filePath)); + } // 拼接返回路径 return super.formatFileUrl(config.getDomain(), path); } diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/framework/file/core/client/sftp/SftpFileClientConfig.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/framework/file/core/client/sftp/SftpFileClientConfig.java index c56d045fef..915c660764 100644 --- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/framework/file/core/client/sftp/SftpFileClientConfig.java +++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/framework/file/core/client/sftp/SftpFileClientConfig.java @@ -1,11 +1,10 @@ package cn.iocoder.yudao.module.infra.framework.file.core.client.sftp; import cn.iocoder.yudao.module.infra.framework.file.core.client.FileClientConfig; -import lombok.Data; -import org.hibernate.validator.constraints.URL; - import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotNull; +import lombok.Data; +import org.hibernate.validator.constraints.URL; /** * Sftp 文件客户端的配置类