Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
spring-simple-operation
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guokunkun
spring-simple-operation
Commits
4d9c948f
Commit
4d9c948f
authored
Jun 15, 2026
by
kk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
存储
parent
67a366b2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
56 additions
and
0 deletions
+56
-0
MyTest2.java
src/test/java/cn/kk/spring_simple_operation/MyTest2.java
+56
-0
No files found.
src/test/java/cn/kk/spring_simple_operation/MyTest2.java
View file @
4d9c948f
...
...
@@ -3,6 +3,7 @@ package cn.kk.spring_simple_operation;
import
cn.kk.spring_simple_operation.entity.*
;
import
cn.kk.spring_simple_operation.mapper.*
;
import
cn.kk.spring_simple_operation.model.dto.ImportExcelDto
;
import
cn.kk.spring_simple_operation.model.dto.RiskCheckAreaExportDTO
;
import
cn.kk.spring_simple_operation.model.dto.SkuImageDesignDTO
;
import
cn.kk.spring_simple_operation.model.vo.SkuAPlusImageAndVideoVO
;
import
cn.kk.spring_simple_operation.utils.ExcelUtil
;
...
...
@@ -278,6 +279,45 @@ public class MyTest2 {
@Test
public
void
exportWoolRiskCheckArea
()
{
List
<
VisualAPlusPlan
>
planList
=
visualAPlusPlanMapper
.
selectList
(
Wrappers
.<
VisualAPlusPlan
>
lambdaQuery
()
.
eq
(
VisualAPlusPlan:
:
getIsDelete
,
0
)
.
and
(
wrapper
->
wrapper
.
like
(
VisualAPlusPlan:
:
getRiskCheckArea
,
"wool"
)
.
or
().
like
(
VisualAPlusPlan:
:
getRiskCheckArea
,
"Cashmere"
)
.
or
().
like
(
VisualAPlusPlan:
:
getRiskCheckArea
,
"kashmir"
)
.
or
().
like
(
VisualAPlusPlan:
:
getRiskCheckArea
,
"pashmina"
))
.
select
(
VisualAPlusPlan:
:
getId
,
VisualAPlusPlan:
:
getRiskCheckArea
));
Map
<
Long
,
String
>
planRiskMap
=
planList
.
stream
()
.
collect
(
Collectors
.
toMap
(
VisualAPlusPlan:
:
getId
,
VisualAPlusPlan:
:
getRiskCheckArea
,
(
a
,
b
)
->
a
));
List
<
RiskCheckAreaExportDTO
>
resultList
=
new
ArrayList
<>();
Lists
.
partition
(
new
ArrayList
<>(
planRiskMap
.
keySet
()),
500
).
forEach
(
planIdList
->
{
List
<
APlusProduct
>
aPlusProducts
=
aPlusProductMapper
.
selectList
(
Wrappers
.<
APlusProduct
>
lambdaQuery
()
.
in
(
APlusProduct:
:
getAPlusPlanId
,
planIdList
)
.
eq
(
APlusProduct:
:
getIsUploadBackstage
,
2
)
.
eq
(
APlusProduct:
:
getIsDelete
,
0
)
.
select
(
APlusProduct:
:
getSku
,
APlusProduct:
:
getSite
,
APlusProduct:
:
getAPlusPlanId
,
APlusProduct:
:
getOptimizeType
));
for
(
APlusProduct
aPlusProduct
:
aPlusProducts
)
{
RiskCheckAreaExportDTO
dto
=
new
RiskCheckAreaExportDTO
();
dto
.
setSku
(
aPlusProduct
.
getSku
());
dto
.
setSite
(
aPlusProduct
.
getSite
());
dto
.
setOptimizeType
(
aPlusProduct
.
getOptimizeType
());
String
riskCheckArea
=
planRiskMap
.
get
(
aPlusProduct
.
getAPlusPlanId
());
dto
.
setRiskCheckArea
(
riskCheckArea
);
dto
.
setKeywords
(
extractRiskKeywords
(
riskCheckArea
));
resultList
.
add
(
dto
);
}
});
ExcelUtil
<
RiskCheckAreaExportDTO
>
util
=
new
ExcelUtil
<>(
RiskCheckAreaExportDTO
.
class
);
util
.
exportExcelFile
(
resultList
,
"羊绒风险A+产品检测sku导出.xlsx"
);
log
.
info
(
"导出完成,共 {} 条"
,
resultList
.
size
());
}
@Test
public
void
exportSkuIsMakePic
()
throws
Exception
{
ExcelUtil
<
SkuImageDesignDTO
>
util
=
new
ExcelUtil
<>(
SkuImageDesignDTO
.
class
);
List
<
SkuImageDesignDTO
>
list
=
util
.
importExcel
(
Files
.
newInputStream
(
new
File
(
"sku-是否作图.xlsx"
).
toPath
()));
...
...
@@ -330,6 +370,22 @@ public class MyTest2 {
return
cell
;
}
private
static
final
String
[]
RISK_KEYWORDS
=
{
"wool"
,
"Cashmere"
,
"kashmir"
,
"pashmina"
};
private
String
extractRiskKeywords
(
String
riskCheckArea
)
{
if
(
StringUtils
.
isEmpty
(
riskCheckArea
))
{
return
""
;
}
String
lower
=
riskCheckArea
.
toLowerCase
(
Locale
.
ROOT
);
List
<
String
>
hit
=
new
ArrayList
<>();
for
(
String
keyword
:
RISK_KEYWORDS
)
{
if
(
lower
.
contains
(
keyword
.
toLowerCase
(
Locale
.
ROOT
)))
{
hit
.
add
(
keyword
);
}
}
return
String
.
join
(
","
,
hit
);
}
private
String
buildSkuSiteKey
(
String
sku
,
String
site
)
{
return
(
sku
==
null
?
""
:
sku
.
trim
())
+
"#"
+
(
site
==
null
?
""
:
site
.
trim
());
}
...
...
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