Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yd-email
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xingmin
yd-email
Commits
155416bf
Commit
155416bf
authored
Oct 09, 2025
by
zhangxingmin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
push
parent
602eb1bb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
1 deletions
+40
-1
yd-email-api/src/main/java/com/yd/email/api/service/impl/ApiEmailFileServiceImpl.java
+40
-1
No files found.
yd-email-api/src/main/java/com/yd/email/api/service/impl/ApiEmailFileServiceImpl.java
View file @
155416bf
...
@@ -143,6 +143,9 @@ public class ApiEmailFileServiceImpl implements ApiEmailFileService {
...
@@ -143,6 +143,9 @@ public class ApiEmailFileServiceImpl implements ApiEmailFileService {
log
.
info
(
"表头信息: {}"
,
importResult
.
getHeaders
());
log
.
info
(
"表头信息: {}"
,
importResult
.
getHeaders
());
log
.
info
(
"导入数据条数: {}"
,
importResult
.
getTotalCount
());
log
.
info
(
"导入数据条数: {}"
,
importResult
.
getTotalCount
());
//导入-变量excel-校验excel字段
processImportDataCheck
(
importResult
.
getData
());
//根据表头字段(变量字段)中文名查询对应的英文名,返回集合(固定+非固定)
//根据表头字段(变量字段)中文名查询对应的英文名,返回集合(固定+非固定)
List
<
EmailVariable
>
emailVariableList
=
getEmailVariableList
(
importResult
.
getHeaders
());
List
<
EmailVariable
>
emailVariableList
=
getEmailVariableList
(
importResult
.
getHeaders
());
...
@@ -205,7 +208,7 @@ public class ApiEmailFileServiceImpl implements ApiEmailFileService {
...
@@ -205,7 +208,7 @@ public class ApiEmailFileServiceImpl implements ApiEmailFileService {
}
}
/**
/**
* 处理导入数据
*
导入-变量excel-
处理导入数据
* @param data
* @param data
* @param headers
* @param headers
* @param sessionId
* @param sessionId
...
@@ -246,6 +249,42 @@ public class ApiEmailFileServiceImpl implements ApiEmailFileService {
...
@@ -246,6 +249,42 @@ public class ApiEmailFileServiceImpl implements ApiEmailFileService {
}
}
/**
/**
* 导入-变量excel-校验excel字段
* @param data
* @return
*/
public
Result
processImportDataCheck
(
List
<
Map
<
String
,
Object
>>
data
)
{
Set
<
String
>
emailSet
=
new
HashSet
<>();
int
i
=
1
;
for
(
Map
<
String
,
Object
>
row
:
data
)
{
String
email
=
getStringValue
(
row
,
GeneralVariableEnum
.
GENERAL_EMAIL
.
getItemLabel
());
if
(
StringUtils
.
isBlank
(
getStringValue
(
row
,
GeneralVariableEnum
.
GENERAL_CONTACT
.
getItemLabel
())))
{
throw
new
BusinessException
(
"第"
+
i
+
"行的"
+
GeneralVariableEnum
.
GENERAL_CONTACT
.
getItemLabel
()
+
"不能为空!"
);
}
if
(
StringUtils
.
isBlank
(
getStringValue
(
row
,
GeneralVariableEnum
.
GENERAL_EMAIL
.
getItemLabel
())))
{
throw
new
BusinessException
(
"第"
+
i
+
"行的"
+
GeneralVariableEnum
.
GENERAL_EMAIL
.
getItemLabel
()
+
"不能为空!"
);
}
if
(
StringUtils
.
isBlank
(
getStringValue
(
row
,
GeneralVariableEnum
.
GENERAL_CC_EMAIL
.
getItemLabel
())))
{
throw
new
BusinessException
(
"第"
+
i
+
"行的"
+
GeneralVariableEnum
.
GENERAL_CC_EMAIL
.
getItemLabel
()
+
"不能为空!"
);
}
if
(
StringUtils
.
isBlank
(
getStringValue
(
row
,
GeneralVariableEnum
.
GENERAL_APPELLATION
.
getItemLabel
())))
{
throw
new
BusinessException
(
"第"
+
i
+
"行的"
+
GeneralVariableEnum
.
GENERAL_APPELLATION
.
getItemLabel
()
+
"不能为空!"
);
}
if
(
StringUtils
.
isBlank
(
getStringValue
(
row
,
GeneralVariableEnum
.
GENERAL_COMPANTNAME
.
getItemLabel
())))
{
throw
new
BusinessException
(
"第"
+
i
+
"行的"
+
GeneralVariableEnum
.
GENERAL_COMPANTNAME
.
getItemLabel
()
+
"不能为空!"
);
}
// 检查收件人邮箱是否重复
if
(
emailSet
.
contains
(
email
))
{
throw
new
BusinessException
(
"第"
+
i
+
"行的"
+
GeneralVariableEnum
.
GENERAL_EMAIL
.
getItemLabel
()
+
"重复:"
+
email
);
}
emailSet
.
add
(
email
);
i
++;
}
return
Result
.
success
();
}
/**
* 处理变量数据,转换为JSON格式
* 处理变量数据,转换为JSON格式
* @param row
* @param row
* @param headers
* @param headers
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment