This commit is contained in:
2025-10-30 02:27:56 +08:00
parent e7099a37d5
commit 5408f9a21d
2 changed files with 17 additions and 6 deletions

View File

@@ -60,7 +60,7 @@ public class BatchPublishServiceImpl implements IBatchPublishService
private IOuterIdGeneratorService outerIdGeneratorService;
/**
* 清理文本中的所有URL链接
* 清理文本中的所有URL链接(保留换行符)
*
* @param text 原始文本
* @return 清理后的文本
@@ -74,9 +74,12 @@ public class BatchPublishServiceImpl implements IBatchPublishService
// 匹配到空格、换行或中文字符为止
String cleaned = text.replaceAll("https?://[^\\s\\u4e00-\\u9fa5]+", "");
// 清理可能留下的多余空白和换行
cleaned = cleaned.replaceAll("\\s+", " ");
cleaned = cleaned.replaceAll("^\\s+|\\s+$", "");
// 清理URL删除后可能留下的连续空格但保留换行符
// 只将连续的空格或制表符替换为单个空格,不处理换行符
cleaned = cleaned.replaceAll("[ \\t]+", " ");
// 清理每行开头和结尾的多余空格(但保留换行符)
cleaned = cleaned.replaceAll("(?m)^[ \\t]+|[ \\t]+$", "");
return cleaned;
}

View File

@@ -92,11 +92,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert id="batchInsertBatchPublishItem" parameterType="java.util.List">
insert into batch_publish_item
(task_id, skuid, product_name, target_account, account_remark, sub_account, status, publish_price, delay_seconds, create_time)
(task_id, skuid, product_name, target_account, account_remark, status, publish_price, delay_seconds, create_time
<if test="list != null and list.size() > 0 and list[0].subAccount != null">
, sub_account
</if>
)
values
<foreach collection="list" item="item" separator=",">
(#{item.taskId}, #{item.skuid}, #{item.productName}, #{item.targetAccount}, #{item.accountRemark},
#{item.subAccount}, #{item.status}, #{item.publishPrice}, #{item.delaySeconds}, #{item.createTime})
#{item.status}, #{item.publishPrice}, #{item.delaySeconds}, #{item.createTime}
<if test="list != null and list.size() > 0 and list[0].subAccount != null">
, #{item.subAccount}
</if>
)
</foreach>
</insert>