Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
custom-server
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
lizhonghong
custom-server
Commits
c701c5ab
Commit
c701c5ab
authored
Jun 17, 2026
by
Lizh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
对比老接口的返回结果,调整新接口返回结构
parent
05642cf7
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
295 additions
and
286 deletions
+295
-286
custom-server-app/src/main/java/com/jomalls/custom/app/aspect/PermissionAspect.java
+3
-2
custom-server-app/src/main/java/com/jomalls/custom/app/constant/Constants.java
+9
-0
custom-server-app/src/main/java/com/jomalls/custom/app/dto/CustomProductInfoQuerySnakeDTO.java
+3
-2
custom-server-app/src/main/java/com/jomalls/custom/app/service/DiyUserService.java
+1
-4
custom-server-app/src/main/java/com/jomalls/custom/app/service/impl/CustomProductInfoServiceImpl.java
+20
-23
custom-server-app/src/main/java/com/jomalls/custom/app/service/impl/CustomProductItemServiceImpl.java
+4
-6
custom-server-app/src/main/java/com/jomalls/custom/app/service/impl/DiyUserServiceImpl.java
+1
-7
custom-server-app/src/main/java/com/jomalls/custom/app/service/impl/ProductTemplateInfoServiceImpl.java
+18
-23
custom-server-app/src/main/java/com/jomalls/custom/app/vo/BasicCustomProductInfoSnakeModel.java
+0
-28
custom-server-app/src/main/java/com/jomalls/custom/app/vo/BasicCustomProductItemSnakeModel.java
+200
-0
custom-server-app/src/main/java/com/jomalls/custom/app/vo/CraftCenterSnakeVO.java
+1
-1
custom-server-app/src/main/java/com/jomalls/custom/app/vo/CustomProductInfoSnakeVO.java
+28
-1
custom-server-app/src/main/java/com/jomalls/custom/app/vo/CustomProductItemSnakeVO.java
+4
-187
custom-server-app/src/main/java/com/jomalls/custom/app/vo/CustomWarehouseInfoSnakeVO.java
+1
-1
custom-server-webapp/src/main/java/com/jomalls/custom/webapp/controller/CustomProductItemController.java
+2
-1
No files found.
custom-server-app/src/main/java/com/jomalls/custom/app/aspect/PermissionAspect.java
View file @
c701c5ab
...
@@ -2,6 +2,7 @@ package com.jomalls.custom.app.aspect;
...
@@ -2,6 +2,7 @@ package com.jomalls.custom.app.aspect;
import
com.jomalls.custom.app.annotation.RequiresPermissions
;
import
com.jomalls.custom.app.annotation.RequiresPermissions
;
import
com.jomalls.custom.app.annotation.RequiresRoles
;
import
com.jomalls.custom.app.annotation.RequiresRoles
;
import
com.jomalls.custom.app.constant.Constants
;
import
com.jomalls.custom.enums.CodeEnum
;
import
com.jomalls.custom.enums.CodeEnum
;
import
com.jomalls.custom.app.exception.ServiceException
;
import
com.jomalls.custom.app.exception.ServiceException
;
import
com.jomalls.custom.app.service.PermissionService
;
import
com.jomalls.custom.app.service.PermissionService
;
...
@@ -64,7 +65,7 @@ public class PermissionAspect {
...
@@ -64,7 +65,7 @@ public class PermissionAspect {
boolean
hasPermission
;
boolean
hasPermission
;
if
(
mode
==
RequiresPermissions
.
RequireMode
.
ALL
)
{
if
(
mode
==
RequiresPermissions
.
RequireMode
.
ALL
)
{
String
[]
permissions
=
permission
.
split
(
","
);
String
[]
permissions
=
permission
.
split
(
Constants
.
COMMA
);
hasPermission
=
true
;
hasPermission
=
true
;
for
(
String
p
:
permissions
)
{
for
(
String
p
:
permissions
)
{
if
(!
permissionService
.
hasPermi
(
p
.
trim
()))
{
if
(!
permissionService
.
hasPermi
(
p
.
trim
()))
{
...
@@ -103,7 +104,7 @@ public class PermissionAspect {
...
@@ -103,7 +104,7 @@ public class PermissionAspect {
boolean
hasRole
;
boolean
hasRole
;
if
(
mode
==
RequiresPermissions
.
RequireMode
.
ALL
)
{
if
(
mode
==
RequiresPermissions
.
RequireMode
.
ALL
)
{
// 必须拥有所有角色
// 必须拥有所有角色
String
[]
roleArray
=
roles
.
split
(
","
);
String
[]
roleArray
=
roles
.
split
(
Constants
.
COMMA
);
hasRole
=
true
;
hasRole
=
true
;
for
(
String
r
:
roleArray
)
{
for
(
String
r
:
roleArray
)
{
if
(!
permissionService
.
hasRole
(
r
.
trim
()))
{
if
(!
permissionService
.
hasRole
(
r
.
trim
()))
{
...
...
custom-server-app/src/main/java/com/jomalls/custom/app/constant/Constants.java
View file @
c701c5ab
...
@@ -11,4 +11,13 @@ public class Constants {
...
@@ -11,4 +11,13 @@ public class Constants {
* map初始化大小
* map初始化大小
*/
*/
public
static
final
int
DEFAULT_INITIAL_CAPACITY
=
1
<<
4
;
public
static
final
int
DEFAULT_INITIAL_CAPACITY
=
1
<<
4
;
/** 并行查询超时时间(秒) */
public
static
final
long
QUERY_TIMEOUT_SECONDS
=
30
;
/** 默认编码 */
public
static
final
String
DEFAULT_CHARSET
=
"UTF-8"
;
/** 逗号 */
public
static
final
String
COMMA
=
","
;
}
}
custom-server-app/src/main/java/com/jomalls/custom/app/dto/CustomProductInfoQuerySnakeDTO.java
View file @
c701c5ab
package
com
.
jomalls
.
custom
.
app
.
dto
;
package
com
.
jomalls
.
custom
.
app
.
dto
;
import
com.fasterxml.jackson.annotation.JsonSetter
;
import
com.fasterxml.jackson.annotation.JsonSetter
;
import
com.jomalls.custom.app.constant.Constants
;
import
com.jomalls.custom.page.PageRequest
;
import
com.jomalls.custom.page.PageRequest
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
jakarta.validation.constraints.*
;
import
jakarta.validation.constraints.*
;
...
@@ -147,9 +148,9 @@ public class CustomProductInfoQuerySnakeDTO extends PageRequest {
...
@@ -147,9 +148,9 @@ public class CustomProductInfoQuerySnakeDTO extends PageRequest {
/** 兼容逗号分隔多值与单值 */
/** 兼容逗号分隔多值与单值 */
@JsonSetter
(
"status"
)
@JsonSetter
(
"status"
)
public
void
setStatusValue
(
Object
value
)
{
public
void
setStatusValue
(
Object
value
)
{
if
(
value
instanceof
String
s
&&
s
.
contains
(
","
))
{
if
(
value
instanceof
String
s
&&
s
.
contains
(
Constants
.
COMMA
))
{
try
{
try
{
this
.
statusList
=
Arrays
.
stream
(
s
.
split
(
","
))
this
.
statusList
=
Arrays
.
stream
(
s
.
split
(
Constants
.
COMMA
))
.
map
(
String:
:
trim
).
filter
(
v
->
!
v
.
isEmpty
())
.
map
(
String:
:
trim
).
filter
(
v
->
!
v
.
isEmpty
())
.
map
(
Integer:
:
parseInt
).
collect
(
Collectors
.
toList
());
.
map
(
Integer:
:
parseInt
).
collect
(
Collectors
.
toList
());
}
catch
(
NumberFormatException
ignored
)
{
}
catch
(
NumberFormatException
ignored
)
{
...
...
custom-server-app/src/main/java/com/jomalls/custom/app/service/DiyUserService.java
View file @
c701c5ab
package
com
.
jomalls
.
custom
.
app
.
service
;
package
com
.
jomalls
.
custom
.
app
.
service
;
import
com.jomalls.custom.app.vo.CustomProductFactoryPriceRelSnakeVO
;
import
com.jomalls.custom.app.vo.*
;
import
com.jomalls.custom.app.vo.CustomProductInfoPageSnakeVO
;
import
com.jomalls.custom.app.vo.CustomProductInfoSnakeVO
;
import
com.jomalls.custom.app.vo.CustomProductItemSnakeVO
;
import
com.jomalls.custom.dal.entity.DbDiyUserEntity
;
import
com.jomalls.custom.dal.entity.DbDiyUserEntity
;
import
java.util.List
;
import
java.util.List
;
...
...
custom-server-app/src/main/java/com/jomalls/custom/app/service/impl/CustomProductInfoServiceImpl.java
View file @
c701c5ab
...
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
...
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import
com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.jomalls.custom.app.constant.Constants
;
import
com.jomalls.custom.app.dto.*
;
import
com.jomalls.custom.app.dto.*
;
import
com.jomalls.custom.app.enums.ProcessingStatus
;
import
com.jomalls.custom.app.enums.ProcessingStatus
;
import
com.jomalls.custom.app.enums.SkuGenerateEnums
;
import
com.jomalls.custom.app.enums.SkuGenerateEnums
;
...
@@ -80,12 +81,8 @@ public class CustomProductInfoServiceImpl implements CustomProductInfoService {
...
@@ -80,12 +81,8 @@ public class CustomProductInfoServiceImpl implements CustomProductInfoService {
private
static
final
int
IMAGE_TYPE_NORMAL
=
0
;
private
static
final
int
IMAGE_TYPE_NORMAL
=
0
;
/** 图片类型:尺码图 */
/** 图片类型:尺码图 */
private
static
final
int
IMAGE_TYPE_SIZE
=
1
;
private
static
final
int
IMAGE_TYPE_SIZE
=
1
;
/** 并行查询超时时间(秒) */
private
static
final
long
QUERY_TIMEOUT_SECONDS
=
30
;
/** 最小列表长度 */
/** 最小列表长度 */
private
static
final
int
MIN_LIST_SIZE
=
1
;
private
static
final
int
MIN_LIST_SIZE
=
1
;
/** 负数 1 */
/** 负数 1 */
private
static
final
int
NEGATIVE_ONE
=
-
1
;
private
static
final
int
NEGATIVE_ONE
=
-
1
;
...
@@ -99,7 +96,7 @@ public class CustomProductInfoServiceImpl implements CustomProductInfoService {
...
@@ -99,7 +96,7 @@ public class CustomProductInfoServiceImpl implements CustomProductInfoService {
return
page
.
convert
(
e
->
{
return
page
.
convert
(
e
->
{
CustomProductInfoPageSnakeVO
snakeVO
=
BeanMapper
.
snakeCase
().
convert
(
e
,
CustomProductInfoPageSnakeVO
.
class
);
CustomProductInfoPageSnakeVO
snakeVO
=
BeanMapper
.
snakeCase
().
convert
(
e
,
CustomProductInfoPageSnakeVO
.
class
);
if
(
StringUtils
.
isNotBlank
(
e
.
getColorImages
()))
{
if
(
StringUtils
.
isNotBlank
(
e
.
getColorImages
()))
{
snakeVO
.
setColorImageList
(
Arrays
.
asList
(
e
.
getColorImages
().
split
(
","
)));
snakeVO
.
setColorImageList
(
Arrays
.
asList
(
e
.
getColorImages
().
split
(
Constants
.
COMMA
)));
}
}
return
snakeVO
;
return
snakeVO
;
});
});
...
@@ -129,7 +126,7 @@ public class CustomProductInfoServiceImpl implements CustomProductInfoService {
...
@@ -129,7 +126,7 @@ public class CustomProductInfoServiceImpl implements CustomProductInfoService {
String
pids
=
String
.
valueOf
(
cate
.
getId
());
String
pids
=
String
.
valueOf
(
cate
.
getId
());
// 获取该类别的父类
// 获取该类别的父类
if
(
StringUtils
.
isNotBlank
(
cate
.
getPids
()))
{
if
(
StringUtils
.
isNotBlank
(
cate
.
getPids
()))
{
pids
=
cate
.
getPids
()
+
","
+
pids
;
pids
=
cate
.
getPids
()
+
Constants
.
COMMA
+
pids
;
}
}
// 父类id,如: 0,19,26,33
// 父类id,如: 0,19,26,33
String
finalPids
=
pids
;
String
finalPids
=
pids
;
...
@@ -137,7 +134,7 @@ public class CustomProductInfoServiceImpl implements CustomProductInfoService {
...
@@ -137,7 +134,7 @@ public class CustomProductInfoServiceImpl implements CustomProductInfoService {
List
<
Integer
>
cateIds
=
cateList
.
stream
()
List
<
Integer
>
cateIds
=
cateList
.
stream
()
.
filter
(
item
->
{
.
filter
(
item
->
{
String
itemPids
=
item
.
getPids
();
String
itemPids
=
item
.
getPids
();
return
finalPids
.
equals
(
itemPids
)
||
(
StringUtils
.
isNotEmpty
(
itemPids
)
&&
itemPids
.
startsWith
(
finalPids
+
","
));
return
finalPids
.
equals
(
itemPids
)
||
(
StringUtils
.
isNotEmpty
(
itemPids
)
&&
itemPids
.
startsWith
(
finalPids
+
Constants
.
COMMA
));
})
})
.
map
(
CategoryInfoModel:
:
getId
).
collect
(
Collectors
.
toList
());
.
map
(
CategoryInfoModel:
:
getId
).
collect
(
Collectors
.
toList
());
cateIds
.
add
(
cate
.
getId
());
cateIds
.
add
(
cate
.
getId
());
...
@@ -180,7 +177,7 @@ public class CustomProductInfoServiceImpl implements CustomProductInfoService {
...
@@ -180,7 +177,7 @@ public class CustomProductInfoServiceImpl implements CustomProductInfoService {
}
}
// sku 支持逗号分隔多值 IN 查询, erpPage查询条件
// sku 支持逗号分隔多值 IN 查询, erpPage查询条件
if
(
StringUtils
.
isNotBlank
(
param
.
getSku
()))
{
if
(
StringUtils
.
isNotBlank
(
param
.
getSku
()))
{
String
[]
skuArr
=
param
.
getSku
().
split
(
","
);
String
[]
skuArr
=
param
.
getSku
().
split
(
Constants
.
COMMA
);
if
(
skuArr
.
length
>
MIN_LIST_SIZE
)
{
if
(
skuArr
.
length
>
MIN_LIST_SIZE
)
{
queryWrapper
.
in
(
CustomProductInfoEntity:
:
getSku
,
(
Object
[])
skuArr
);
queryWrapper
.
in
(
CustomProductInfoEntity:
:
getSku
,
(
Object
[])
skuArr
);
}
else
{
}
else
{
...
@@ -202,7 +199,7 @@ public class CustomProductInfoServiceImpl implements CustomProductInfoService {
...
@@ -202,7 +199,7 @@ public class CustomProductInfoServiceImpl implements CustomProductInfoService {
}
}
// 货号:逗号分隔多值 IN 查询,单个值模糊 LIKE 查询, erpPage查询条件
// 货号:逗号分隔多值 IN 查询,单个值模糊 LIKE 查询, erpPage查询条件
if
(
StringUtils
.
isNotBlank
(
param
.
getProduct_no
()))
{
if
(
StringUtils
.
isNotBlank
(
param
.
getProduct_no
()))
{
String
[]
productNoArr
=
param
.
getProduct_no
().
split
(
","
);
String
[]
productNoArr
=
param
.
getProduct_no
().
split
(
Constants
.
COMMA
);
if
(
productNoArr
.
length
>
MIN_LIST_SIZE
)
{
if
(
productNoArr
.
length
>
MIN_LIST_SIZE
)
{
queryWrapper
.
in
(
CustomProductInfoEntity:
:
getProductNo
,
(
Object
[])
productNoArr
);
queryWrapper
.
in
(
CustomProductInfoEntity:
:
getProductNo
,
(
Object
[])
productNoArr
);
}
else
{
}
else
{
...
@@ -517,7 +514,7 @@ public class CustomProductInfoServiceImpl implements CustomProductInfoService {
...
@@ -517,7 +514,7 @@ public class CustomProductInfoServiceImpl implements CustomProductInfoService {
factoryPriceFuture
,
diyUserIdsFuture
,
craftIdsFuture
,
factoryPriceFuture
,
diyUserIdsFuture
,
craftIdsFuture
,
warehouseIdsFuture
,
remarkFuture
,
cnRemarkFuture
,
warehouseIdsFuture
,
remarkFuture
,
cnRemarkFuture
,
factoryIdsFuture
)
factoryIdsFuture
)
.
orTimeout
(
QUERY_TIMEOUT_SECONDS
,
TimeUnit
.
SECONDS
)
.
orTimeout
(
Constants
.
QUERY_TIMEOUT_SECONDS
,
TimeUnit
.
SECONDS
)
.
join
();
.
join
();
}
catch
(
CompletionException
e
)
{
}
catch
(
CompletionException
e
)
{
cancelAll
(
itemsFuture
,
imagesFuture
,
propertiesFuture
,
cancelAll
(
itemsFuture
,
imagesFuture
,
propertiesFuture
,
...
@@ -573,7 +570,7 @@ public class CustomProductInfoServiceImpl implements CustomProductInfoService {
...
@@ -573,7 +570,7 @@ public class CustomProductInfoServiceImpl implements CustomProductInfoService {
.
convert
(
e
,
CustomProductInfoPropertySnakeVO
.
class
)).
collect
(
Collectors
.
toList
()));
.
convert
(
e
,
CustomProductInfoPropertySnakeVO
.
class
)).
collect
(
Collectors
.
toList
()));
// 收集所有 property_id
// 收集所有 property_id
String
propIds
=
properties
.
stream
().
map
(
p
->
String
.
valueOf
(
p
.
getPropertyId
()))
String
propIds
=
properties
.
stream
().
map
(
p
->
String
.
valueOf
(
p
.
getPropertyId
()))
.
distinct
().
collect
(
Collectors
.
joining
(
","
));
.
distinct
().
collect
(
Collectors
.
joining
(
Constants
.
COMMA
));
if
(
propIds
.
isEmpty
())
{
if
(
propIds
.
isEmpty
())
{
return
;
return
;
}
}
...
@@ -620,7 +617,7 @@ public class CustomProductInfoServiceImpl implements CustomProductInfoService {
...
@@ -620,7 +617,7 @@ public class CustomProductInfoServiceImpl implements CustomProductInfoService {
if
(
CollectionUtils
.
isEmpty
(
diyUsers
)
||
diyUsers
.
size
()
!=
dto
.
getDiyUserIds
().
size
())
{
if
(
CollectionUtils
.
isEmpty
(
diyUsers
)
||
diyUsers
.
size
()
!=
dto
.
getDiyUserIds
().
size
())
{
throw
new
ServiceException
(
"未查询到所选客户"
);
throw
new
ServiceException
(
"未查询到所选客户"
);
}
}
logStr
=
"绑定客户改:"
+
diyUsers
.
stream
().
map
(
DbDiyUserEntity:
:
getName
).
collect
(
Collectors
.
joining
(
","
));
logStr
=
"绑定客户改:"
+
diyUsers
.
stream
().
map
(
DbDiyUserEntity:
:
getName
).
collect
(
Collectors
.
joining
(
Constants
.
COMMA
));
}
else
{
}
else
{
logStr
=
"绑定客户改为空"
;
logStr
=
"绑定客户改为空"
;
}
}
...
@@ -665,7 +662,7 @@ public class CustomProductInfoServiceImpl implements CustomProductInfoService {
...
@@ -665,7 +662,7 @@ public class CustomProductInfoServiceImpl implements CustomProductInfoService {
if
(
diyUsers
==
null
||
diyUsers
.
size
()
!=
dto
.
getDiyUserIds
().
size
())
{
if
(
diyUsers
==
null
||
diyUsers
.
size
()
!=
dto
.
getDiyUserIds
().
size
())
{
throw
new
ServiceException
(
"未查询到所选客户"
);
throw
new
ServiceException
(
"未查询到所选客户"
);
}
}
logStr
=
"黑名单客户改:"
+
diyUsers
.
stream
().
map
(
DbDiyUserEntity:
:
getName
).
collect
(
Collectors
.
joining
(
","
));
logStr
=
"黑名单客户改:"
+
diyUsers
.
stream
().
map
(
DbDiyUserEntity:
:
getName
).
collect
(
Collectors
.
joining
(
Constants
.
COMMA
));
}
else
{
}
else
{
logStr
=
"黑名单客户改为空"
;
logStr
=
"黑名单客户改为空"
;
}
}
...
@@ -865,7 +862,7 @@ public class CustomProductInfoServiceImpl implements CustomProductInfoService {
...
@@ -865,7 +862,7 @@ public class CustomProductInfoServiceImpl implements CustomProductInfoService {
if
(
StringUtils
.
isNotBlank
(
param
.
getSku
()))
{
if
(
StringUtils
.
isNotBlank
(
param
.
getSku
()))
{
List
<
String
>
productSkus
=
new
ArrayList
<>();
List
<
String
>
productSkus
=
new
ArrayList
<>();
List
<
String
>
diySkus
=
new
ArrayList
<>();
List
<
String
>
diySkus
=
new
ArrayList
<>();
for
(
String
s
:
param
.
getSku
().
split
(
","
))
{
for
(
String
s
:
param
.
getSku
().
split
(
Constants
.
COMMA
))
{
String
trimmed
=
s
.
trim
();
String
trimmed
=
s
.
trim
();
if
(
trimmed
.
startsWith
(
"JM"
))
{
if
(
trimmed
.
startsWith
(
"JM"
))
{
productSkus
.
add
(
trimmed
);
productSkus
.
add
(
trimmed
);
...
@@ -873,9 +870,9 @@ public class CustomProductInfoServiceImpl implements CustomProductInfoService {
...
@@ -873,9 +870,9 @@ public class CustomProductInfoServiceImpl implements CustomProductInfoService {
diySkus
.
add
(
trimmed
);
diySkus
.
add
(
trimmed
);
}
}
}
}
param
.
setSku
(
productSkus
.
isEmpty
()
?
null
:
String
.
join
(
","
,
productSkus
));
param
.
setSku
(
productSkus
.
isEmpty
()
?
null
:
String
.
join
(
Constants
.
COMMA
,
productSkus
));
if
(!
diySkus
.
isEmpty
()
&&
StringUtils
.
isBlank
(
param
.
getDiySku
()))
{
if
(!
diySkus
.
isEmpty
()
&&
StringUtils
.
isBlank
(
param
.
getDiySku
()))
{
param
.
setDiySku
(
String
.
join
(
","
,
diySkus
));
param
.
setDiySku
(
String
.
join
(
Constants
.
COMMA
,
diySkus
));
}
}
}
}
...
@@ -978,10 +975,10 @@ public class CustomProductInfoServiceImpl implements CustomProductInfoService {
...
@@ -978,10 +975,10 @@ public class CustomProductInfoServiceImpl implements CustomProductInfoService {
CompletableFuture
<
Map
<
Integer
,
List
<
FactoryPriceIntervalRelSnakeVO
>>>
intervalFuture
=
CompletableFuture
<
Map
<
Integer
,
List
<
FactoryPriceIntervalRelSnakeVO
>>>
intervalFuture
=
CompletableFuture
.
supplyAsync
(()
->
batchLoadFactoryPriceIntervalsByProductIds
(
productIds
),
threadPoolExecutor
);
CompletableFuture
.
supplyAsync
(()
->
batchLoadFactoryPriceIntervalsByProductIds
(
productIds
),
threadPoolExecutor
);
try
{
try
{
diyShelfStatusMap
=
shelfFuture
.
get
(
QUERY_TIMEOUT_SECONDS
,
TimeUnit
.
SECONDS
);
diyShelfStatusMap
=
shelfFuture
.
get
(
Constants
.
QUERY_TIMEOUT_SECONDS
,
TimeUnit
.
SECONDS
);
craftMap
=
craftFuture
.
get
(
QUERY_TIMEOUT_SECONDS
,
TimeUnit
.
SECONDS
);
craftMap
=
craftFuture
.
get
(
Constants
.
QUERY_TIMEOUT_SECONDS
,
TimeUnit
.
SECONDS
);
warehouseMap
=
warehouseFuture
.
get
(
QUERY_TIMEOUT_SECONDS
,
TimeUnit
.
SECONDS
);
warehouseMap
=
warehouseFuture
.
get
(
Constants
.
QUERY_TIMEOUT_SECONDS
,
TimeUnit
.
SECONDS
);
intervalMap
=
intervalFuture
.
get
(
QUERY_TIMEOUT_SECONDS
,
TimeUnit
.
SECONDS
);
intervalMap
=
intervalFuture
.
get
(
Constants
.
QUERY_TIMEOUT_SECONDS
,
TimeUnit
.
SECONDS
);
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
log
.
error
(
"[ erpPage ] 并行查询关联数据失败"
,
ex
);
log
.
error
(
"[ erpPage ] 并行查询关联数据失败"
,
ex
);
throw
new
ServiceException
(
"查询关联数据失败"
);
throw
new
ServiceException
(
"查询关联数据失败"
);
...
@@ -1004,7 +1001,7 @@ public class CustomProductInfoServiceImpl implements CustomProductInfoService {
...
@@ -1004,7 +1001,7 @@ public class CustomProductInfoServiceImpl implements CustomProductInfoService {
// 应用用户折扣(复用 DiyUserService,统一处理 discount=null/1 的判断+主表+价格区间)
// 应用用户折扣(复用 DiyUserService,统一处理 discount=null/1 的判断+主表+价格区间)
diyUserService
.
setProductExternalPrice
(
finalUser
,
vo
);
diyUserService
.
setProductExternalPrice
(
finalUser
,
vo
);
if
(
StringUtils
.
isNotBlank
(
e
.
getColorImages
()))
{
if
(
StringUtils
.
isNotBlank
(
e
.
getColorImages
()))
{
vo
.
setColorImageList
(
Arrays
.
asList
(
e
.
getColorImages
().
split
(
","
)));
vo
.
setColorImageList
(
Arrays
.
asList
(
e
.
getColorImages
().
split
(
Constants
.
COMMA
)));
}
}
// 标记绑定的 DIY 模板是否已上架
// 标记绑定的 DIY 模板是否已上架
vo
.
setDiyShelfStatus
(
diyShelfStatusMap
.
getOrDefault
(
e
.
getDiyId
(),
false
));
vo
.
setDiyShelfStatus
(
diyShelfStatusMap
.
getOrDefault
(
e
.
getDiyId
(),
false
));
...
@@ -1814,7 +1811,7 @@ public class CustomProductInfoServiceImpl implements CustomProductInfoService {
...
@@ -1814,7 +1811,7 @@ public class CustomProductInfoServiceImpl implements CustomProductInfoService {
// 子项(同步主表的 print_type 到每个子项)
// 子项(同步主表的 print_type 到每个子项)
fullVO
.
setProductList
(
items
.
stream
()
fullVO
.
setProductList
(
items
.
stream
()
.
map
(
e
->
{
.
map
(
e
->
{
CustomProductItemSnakeVO
vo
=
BeanMapper
.
snakeCase
().
convert
(
e
,
CustomProductItemSnakeVO
.
class
);
BasicCustomProductItemSnakeModel
vo
=
BeanMapper
.
snakeCase
().
convert
(
e
,
BasicCustomProductItemSnakeModel
.
class
);
// 同步主表 printType 到子项
// 同步主表 printType 到子项
vo
.
setPrint_type
(
entity
.
getPrintType
());
vo
.
setPrint_type
(
entity
.
getPrintType
());
return
vo
;
return
vo
;
...
@@ -1823,7 +1820,7 @@ public class CustomProductInfoServiceImpl implements CustomProductInfoService {
...
@@ -1823,7 +1820,7 @@ public class CustomProductInfoServiceImpl implements CustomProductInfoService {
// 图片拆分:按类型分为普通图和尺码图
// 图片拆分:按类型分为普通图和尺码图
if
(
entity
.
getColorImages
()
!=
null
)
{
if
(
entity
.
getColorImages
()
!=
null
)
{
fullVO
.
setColorImageList
(
Arrays
.
asList
(
entity
.
getColorImages
().
split
(
","
)));
fullVO
.
setColorImageList
(
Arrays
.
asList
(
entity
.
getColorImages
().
split
(
Constants
.
COMMA
)));
}
}
fullVO
.
setImageList
(
images
.
stream
()
fullVO
.
setImageList
(
images
.
stream
()
.
filter
(
img
->
img
.
getType
()
==
null
||
img
.
getType
()
==
IMAGE_TYPE_NORMAL
)
.
filter
(
img
->
img
.
getType
()
==
null
||
img
.
getType
()
==
IMAGE_TYPE_NORMAL
)
...
...
custom-server-app/src/main/java/com/jomalls/custom/app/service/impl/CustomProductItemServiceImpl.java
View file @
c701c5ab
package
com
.
jomalls
.
custom
.
app
.
service
.
impl
;
package
com
.
jomalls
.
custom
.
app
.
service
.
impl
;
import
com.jomalls.custom.app.constant.Constants
;
import
com.jomalls.custom.app.dto.UpdateSalesPriceSnakeDTO
;
import
com.jomalls.custom.app.dto.UpdateSalesPriceSnakeDTO
;
import
com.jomalls.custom.app.exception.ServiceException
;
import
com.jomalls.custom.app.exception.ServiceException
;
import
com.jomalls.custom.app.service.CustomProductItemService
;
import
com.jomalls.custom.app.service.CustomProductItemService
;
import
com.jomalls.custom.app.service.DiyUserService
;
import
com.jomalls.custom.app.service.DiyUserService
;
import
com.jomalls.custom.app.utils.BeanMapper
;
import
com.jomalls.custom.app.utils.BeanMapper
;
import
com.jomalls.custom.app.vo.CustomProductFactoryPriceRelSnakeVO
;
import
com.jomalls.custom.app.vo.*
;
import
com.jomalls.custom.app.vo.CustomProductInfoSnakeVO
;
import
com.jomalls.custom.app.vo.CustomProductItemSnakeVO
;
import
com.jomalls.custom.dal.entity.*
;
import
com.jomalls.custom.dal.entity.*
;
import
com.jomalls.custom.domain.service.*
;
import
com.jomalls.custom.domain.service.*
;
import
com.jomalls.custom.security.SecurityUtils
;
import
com.jomalls.custom.security.SecurityUtils
;
...
@@ -20,7 +19,6 @@ import org.springframework.util.CollectionUtils;
...
@@ -20,7 +19,6 @@ import org.springframework.util.CollectionUtils;
import
org.springframework.util.StringUtils
;
import
org.springframework.util.StringUtils
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.math.RoundingMode
;
import
java.util.*
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -301,7 +299,7 @@ public class CustomProductItemServiceImpl implements CustomProductItemService {
...
@@ -301,7 +299,7 @@ public class CustomProductItemServiceImpl implements CustomProductItemService {
diyUserService
.
setProductItemExternalPrice
(
user
,
vo
,
factoryPriceVOList
,
productInfoVO
);
diyUserService
.
setProductItemExternalPrice
(
user
,
vo
,
factoryPriceVOList
,
productInfoVO
);
}
}
vo
.
setCustomProductInfo
(
productInfoVO
);
vo
.
setCustomProductInfo
(
BeanMapper
.
mapper
().
convert
(
productInfoVO
,
BasicCustomProductInfoSnakeModel
.
class
)
);
vo
.
setFactoryPriceList
(
factoryPriceVOList
);
vo
.
setFactoryPriceList
(
factoryPriceVOList
);
return
vo
;
return
vo
;
}).
collect
(
Collectors
.
toList
());
}).
collect
(
Collectors
.
toList
());
...
@@ -350,7 +348,7 @@ public class CustomProductItemServiceImpl implements CustomProductItemService {
...
@@ -350,7 +348,7 @@ public class CustomProductItemServiceImpl implements CustomProductItemService {
private
CustomProductInfoSnakeVO
buildProductInfoVO
(
CustomProductInfoEntity
entity
)
{
private
CustomProductInfoSnakeVO
buildProductInfoVO
(
CustomProductInfoEntity
entity
)
{
CustomProductInfoSnakeVO
vo
=
BeanMapper
.
snakeCase
().
convert
(
entity
,
CustomProductInfoSnakeVO
.
class
);
CustomProductInfoSnakeVO
vo
=
BeanMapper
.
snakeCase
().
convert
(
entity
,
CustomProductInfoSnakeVO
.
class
);
if
(
StringUtils
.
hasText
(
vo
.
getColor_images
()))
{
if
(
StringUtils
.
hasText
(
vo
.
getColor_images
()))
{
vo
.
setColorImageList
(
Arrays
.
asList
(
vo
.
getColor_images
().
split
(
","
)));
vo
.
setColorImageList
(
Arrays
.
asList
(
vo
.
getColor_images
().
split
(
Constants
.
COMMA
)));
}
}
vo
.
setProductList
(
null
);
vo
.
setProductList
(
null
);
return
vo
;
return
vo
;
...
...
custom-server-app/src/main/java/com/jomalls/custom/app/service/impl/DiyUserServiceImpl.java
View file @
c701c5ab
package
com
.
jomalls
.
custom
.
app
.
service
.
impl
;
package
com
.
jomalls
.
custom
.
app
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.jomalls.custom.app.exception.ServiceException
;
import
com.jomalls.custom.app.service.DiyUserService
;
import
com.jomalls.custom.app.service.DiyUserService
;
import
com.jomalls.custom.app.utils.BeanMapper
;
import
com.jomalls.custom.app.vo.*
;
import
com.jomalls.custom.app.vo.*
;
import
com.jomalls.custom.dal.entity.DbDiyEntity
;
import
com.jomalls.custom.dal.entity.DbDiyUserEntity
;
import
com.jomalls.custom.dal.entity.DbDiyUserEntity
;
import
com.jomalls.custom.domain.service.DbDiyUserDomainService
;
import
com.jomalls.custom.domain.service.DbDiyUserDomainService
;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
...
@@ -17,7 +12,6 @@ import org.springframework.stereotype.Service;
...
@@ -17,7 +12,6 @@ import org.springframework.stereotype.Service;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.math.RoundingMode
;
import
java.math.RoundingMode
;
import
java.util.List
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
/**
* DIY 用户服务实现
* DIY 用户服务实现
...
@@ -75,7 +69,7 @@ public class DiyUserServiceImpl implements DiyUserService {
...
@@ -75,7 +69,7 @@ public class DiyUserServiceImpl implements DiyUserService {
// 子项的 sales_price(对齐 TS:328-332)
// 子项的 sales_price(对齐 TS:328-332)
if
(
vo
.
getProductList
()
!=
null
)
{
if
(
vo
.
getProductList
()
!=
null
)
{
for
(
CustomProductItemSnakeVO
item
:
vo
.
getProductList
())
{
for
(
BasicCustomProductItemSnakeModel
item
:
vo
.
getProductList
())
{
if
(
item
.
getSales_price
()
!=
null
)
{
if
(
item
.
getSales_price
()
!=
null
)
{
item
.
setSales_price
(
item
.
getSales_price
().
multiply
(
discountRate
).
setScale
(
2
,
RoundingMode
.
HALF_UP
));
item
.
setSales_price
(
item
.
getSales_price
().
multiply
(
discountRate
).
setScale
(
2
,
RoundingMode
.
HALF_UP
));
}
}
...
...
custom-server-app/src/main/java/com/jomalls/custom/app/service/impl/ProductTemplateInfoServiceImpl.java
View file @
c701c5ab
package
com
.
jomalls
.
custom
.
app
.
service
.
impl
;
package
com
.
jomalls
.
custom
.
app
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.jomalls.custom.app.constant.Constants
;
import
com.jomalls.custom.app.exception.ServiceException
;
import
com.jomalls.custom.app.exception.ServiceException
;
import
com.jomalls.custom.app.service.ProductTemplateInfoService
;
import
com.jomalls.custom.app.service.ProductTemplateInfoService
;
import
com.jomalls.custom.app.utils.BeanMapper
;
import
com.jomalls.custom.app.utils.BeanMapper
;
...
@@ -13,6 +14,7 @@ import com.jomalls.custom.integrate.model.PropertyValueModel;
...
@@ -13,6 +14,7 @@ import com.jomalls.custom.integrate.model.PropertyValueModel;
import
com.jomalls.custom.integrate.service.SaasAdminService
;
import
com.jomalls.custom.integrate.service.SaasAdminService
;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -36,9 +38,6 @@ import java.util.stream.Collectors;
...
@@ -36,9 +38,6 @@ import java.util.stream.Collectors;
@RequiredArgsConstructor
@RequiredArgsConstructor
public
class
ProductTemplateInfoServiceImpl
implements
ProductTemplateInfoService
{
public
class
ProductTemplateInfoServiceImpl
implements
ProductTemplateInfoService
{
/** 并行查询超时时间(秒) */
private
static
final
long
QUERY_TIMEOUT_SECONDS
=
30
;
private
final
ProductTemplateInfoDomainService
productTemplateInfoDomainService
;
private
final
ProductTemplateInfoDomainService
productTemplateInfoDomainService
;
private
final
ProductTemplateItemDomainService
productTemplateItemDomainService
;
private
final
ProductTemplateItemDomainService
productTemplateItemDomainService
;
private
final
ProductTemplateRemarkDomainService
productTemplateRemarkDomainService
;
private
final
ProductTemplateRemarkDomainService
productTemplateRemarkDomainService
;
...
@@ -49,7 +48,7 @@ public class ProductTemplateInfoServiceImpl implements ProductTemplateInfoServic
...
@@ -49,7 +48,7 @@ public class ProductTemplateInfoServiceImpl implements ProductTemplateInfoServic
private
final
SaasAdminService
saasAdminService
;
private
final
SaasAdminService
saasAdminService
;
private
final
ThreadPoolExecutor
threadPoolExecutor
;
private
final
ThreadPoolExecutor
threadPoolExecutor
;
// ==================== getByIdOrSku ====================
private
static
final
String
UNDER_LINE
=
"_"
;
@Override
@Override
public
ProductTemplateInfoSnakeVO
getByIdOrSku
(
Integer
id
,
String
sku
)
{
public
ProductTemplateInfoSnakeVO
getByIdOrSku
(
Integer
id
,
String
sku
)
{
...
@@ -76,7 +75,7 @@ public class ProductTemplateInfoServiceImpl implements ProductTemplateInfoServic
...
@@ -76,7 +75,7 @@ public class ProductTemplateInfoServiceImpl implements ProductTemplateInfoServic
// 3. 等待所有并行查询完成
// 3. 等待所有并行查询完成
CompletableFuture
.
allOf
(
itemsFuture
,
remarkFuture
,
propertiesFuture
,
specsFuture
)
CompletableFuture
.
allOf
(
itemsFuture
,
remarkFuture
,
propertiesFuture
,
specsFuture
)
.
orTimeout
(
QUERY_TIMEOUT_SECONDS
,
TimeUnit
.
SECONDS
)
.
orTimeout
(
Constants
.
QUERY_TIMEOUT_SECONDS
,
TimeUnit
.
SECONDS
)
.
join
();
.
join
();
List
<
ProductTemplateItemEntity
>
items
=
itemsFuture
.
join
();
List
<
ProductTemplateItemEntity
>
items
=
itemsFuture
.
join
();
...
@@ -85,7 +84,7 @@ public class ProductTemplateInfoServiceImpl implements ProductTemplateInfoServic
...
@@ -85,7 +84,7 @@ public class ProductTemplateInfoServiceImpl implements ProductTemplateInfoServic
List
<
ProductTemplateItemSpecEntity
>
specs
=
specsFuture
.
join
();
List
<
ProductTemplateItemSpecEntity
>
specs
=
specsFuture
.
join
();
// 4. Items 按 sort 排序
// 4. Items 按 sort 排序
if
(
items
!=
null
)
{
if
(
CollectionUtils
.
isNotEmpty
(
items
)
)
{
items
.
sort
(
Comparator
.
comparing
(
ProductTemplateItemEntity:
:
getSort
,
items
.
sort
(
Comparator
.
comparing
(
ProductTemplateItemEntity:
:
getSort
,
Comparator
.
nullsLast
(
Comparator
.
naturalOrder
())));
Comparator
.
nullsLast
(
Comparator
.
naturalOrder
())));
}
}
...
@@ -96,7 +95,7 @@ public class ProductTemplateInfoServiceImpl implements ProductTemplateInfoServic
...
@@ -96,7 +95,7 @@ public class ProductTemplateInfoServiceImpl implements ProductTemplateInfoServic
// 6. 计算字段
// 6. 计算字段
// colorImageList: 由 color_images 逗号分割
// colorImageList: 由 color_images 逗号分割
if
(
StringUtils
.
isNotBlank
(
entity
.
getColorImages
()))
{
if
(
StringUtils
.
isNotBlank
(
entity
.
getColorImages
()))
{
vo
.
setColorImageList
(
Arrays
.
asList
(
entity
.
getColorImages
().
split
(
","
)));
vo
.
setColorImageList
(
Arrays
.
asList
(
entity
.
getColorImages
().
split
(
Constants
.
COMMA
)));
}
else
{
}
else
{
vo
.
setColorImageList
(
Collections
.
emptyList
());
vo
.
setColorImageList
(
Collections
.
emptyList
());
}
}
...
@@ -107,10 +106,10 @@ public class ProductTemplateInfoServiceImpl implements ProductTemplateInfoServic
...
@@ -107,10 +106,10 @@ public class ProductTemplateInfoServiceImpl implements ProductTemplateInfoServic
}
}
// 7. 转换关联数据
// 7. 转换关联数据
if
(
items
!=
null
)
{
if
(
CollectionUtils
.
isNotEmpty
(
items
)
)
{
vo
.
setProductList
(
BeanMapper
.
snakeCase
().
convertList
(
items
,
ProductTemplateItemSnakeVO
.
class
));
vo
.
setProductList
(
BeanMapper
.
snakeCase
().
convertList
(
items
,
ProductTemplateItemSnakeVO
.
class
));
}
}
if
(
properties
!=
null
)
{
if
(
CollectionUtils
.
isNotEmpty
(
properties
)
)
{
vo
.
setProperties
(
BeanMapper
.
snakeCase
().
convertList
(
properties
,
ProductTemplateInfoPropertySnakeVO
.
class
));
vo
.
setProperties
(
BeanMapper
.
snakeCase
().
convertList
(
properties
,
ProductTemplateInfoPropertySnakeVO
.
class
));
}
}
...
@@ -118,15 +117,13 @@ public class ProductTemplateInfoServiceImpl implements ProductTemplateInfoServic
...
@@ -118,15 +117,13 @@ public class ProductTemplateInfoServiceImpl implements ProductTemplateInfoServic
resolveProperties
(
properties
,
vo
);
resolveProperties
(
properties
,
vo
);
// 9. 规格去重(按 face_id + "_" + size)
// 9. 规格去重(按 face_id + "_" + size)
if
(
specs
!=
null
&&
!
specs
.
isEmpty
(
))
{
if
(
CollectionUtils
.
isNotEmpty
(
specs
))
{
vo
.
setSpecList
(
buildSpecList
(
specs
));
vo
.
setSpecList
(
buildSpecList
(
specs
));
}
}
return
vo
;
return
vo
;
}
}
// ==================== bindDetail ====================
@Override
@Override
public
BindDetailVO
bindDetail
(
Integer
id
,
String
sku
)
{
public
BindDetailVO
bindDetail
(
Integer
id
,
String
sku
)
{
// 1. 校验参数并查询主实体
// 1. 校验参数并查询主实体
...
@@ -148,7 +145,7 @@ public class ProductTemplateInfoServiceImpl implements ProductTemplateInfoServic
...
@@ -148,7 +145,7 @@ public class ProductTemplateInfoServiceImpl implements ProductTemplateInfoServic
.
supplyAsync
(()
->
customProductItemDomainService
.
selectByProductId
(
productId
),
threadPoolExecutor
);
.
supplyAsync
(()
->
customProductItemDomainService
.
selectByProductId
(
productId
),
threadPoolExecutor
);
CompletableFuture
.
allOf
(
templateItemsFuture
,
productInfoFuture
,
productItemsFuture
)
CompletableFuture
.
allOf
(
templateItemsFuture
,
productInfoFuture
,
productItemsFuture
)
.
orTimeout
(
QUERY_TIMEOUT_SECONDS
,
TimeUnit
.
SECONDS
)
.
orTimeout
(
Constants
.
QUERY_TIMEOUT_SECONDS
,
TimeUnit
.
SECONDS
)
.
join
();
.
join
();
List
<
ProductTemplateItemEntity
>
templateItems
=
templateItemsFuture
.
join
();
List
<
ProductTemplateItemEntity
>
templateItems
=
templateItemsFuture
.
join
();
...
@@ -160,7 +157,7 @@ public class ProductTemplateInfoServiceImpl implements ProductTemplateInfoServic
...
@@ -160,7 +157,7 @@ public class ProductTemplateInfoServiceImpl implements ProductTemplateInfoServic
// 5. 构建商品明细 Map(key = id)
// 5. 构建商品明细 Map(key = id)
Map
<
Integer
,
CustomProductItemEntity
>
productItemMap
;
Map
<
Integer
,
CustomProductItemEntity
>
productItemMap
;
if
(
productItems
!=
null
&&
!
productItems
.
isEmpty
(
))
{
if
(
CollectionUtils
.
isNotEmpty
(
productItems
))
{
productItemMap
=
productItems
.
stream
()
productItemMap
=
productItems
.
stream
()
.
collect
(
Collectors
.
toMap
(
CustomProductItemEntity:
:
getId
,
item
->
item
,
(
a
,
b
)
->
a
));
.
collect
(
Collectors
.
toMap
(
CustomProductItemEntity:
:
getId
,
item
->
item
,
(
a
,
b
)
->
a
));
}
else
{
}
else
{
...
@@ -168,14 +165,14 @@ public class ProductTemplateInfoServiceImpl implements ProductTemplateInfoServic
...
@@ -168,14 +165,14 @@ public class ProductTemplateInfoServiceImpl implements ProductTemplateInfoServic
}
}
// 6. 模板明细按 sort 排序
// 6. 模板明细按 sort 排序
if
(
templateItems
!=
null
)
{
if
(
CollectionUtils
.
isNotEmpty
(
templateItems
)
)
{
templateItems
.
sort
(
Comparator
.
comparing
(
ProductTemplateItemEntity:
:
getSort
,
templateItems
.
sort
(
Comparator
.
comparing
(
ProductTemplateItemEntity:
:
getSort
,
Comparator
.
nullsLast
(
Comparator
.
naturalOrder
())));
Comparator
.
nullsLast
(
Comparator
.
naturalOrder
())));
}
}
// 7. 构建关联列表
// 7. 构建关联列表
List
<
ProductTemplateAssSnakeVO
>
assList
=
new
ArrayList
<>();
List
<
ProductTemplateAssSnakeVO
>
assList
=
new
ArrayList
<>();
if
(
templateItems
!=
null
)
{
if
(
CollectionUtils
.
isNotEmpty
(
templateItems
)
)
{
for
(
ProductTemplateItemEntity
templateItem
:
templateItems
)
{
for
(
ProductTemplateItemEntity
templateItem
:
templateItems
)
{
ProductTemplateAssSnakeVO
assVO
=
ProductTemplateAssSnakeVO
.
builder
()
ProductTemplateAssSnakeVO
assVO
=
ProductTemplateAssSnakeVO
.
builder
()
.
template_item_id
(
templateItem
.
getId
())
.
template_item_id
(
templateItem
.
getId
())
...
@@ -206,8 +203,6 @@ public class ProductTemplateInfoServiceImpl implements ProductTemplateInfoServic
...
@@ -206,8 +203,6 @@ public class ProductTemplateInfoServiceImpl implements ProductTemplateInfoServic
.
build
();
.
build
();
}
}
// ==================== 私有方法 ====================
/**
/**
* 校验 id/sku 参数并查询主实体
* 校验 id/sku 参数并查询主实体
*
*
...
@@ -238,7 +233,7 @@ public class ProductTemplateInfoServiceImpl implements ProductTemplateInfoServic
...
@@ -238,7 +233,7 @@ public class ProductTemplateInfoServiceImpl implements ProductTemplateInfoServic
* @param vo 目标 VO(结果写入 skuProperties / normalProperties)
* @param vo 目标 VO(结果写入 skuProperties / normalProperties)
*/
*/
private
void
resolveProperties
(
List
<
ProductTemplateInfoPropertyEntity
>
properties
,
ProductTemplateInfoSnakeVO
vo
)
{
private
void
resolveProperties
(
List
<
ProductTemplateInfoPropertyEntity
>
properties
,
ProductTemplateInfoSnakeVO
vo
)
{
if
(
properties
==
null
||
properties
.
isEmpty
(
))
{
if
(
CollectionUtils
.
isNotEmpty
(
properties
))
{
vo
.
setSkuProperties
(
Collections
.
emptyList
());
vo
.
setSkuProperties
(
Collections
.
emptyList
());
vo
.
setNormalProperties
(
Collections
.
emptyList
());
vo
.
setNormalProperties
(
Collections
.
emptyList
());
return
;
return
;
...
@@ -250,9 +245,9 @@ public class ProductTemplateInfoServiceImpl implements ProductTemplateInfoServic
...
@@ -250,9 +245,9 @@ public class ProductTemplateInfoServiceImpl implements ProductTemplateInfoServic
.
filter
(
Objects:
:
nonNull
)
.
filter
(
Objects:
:
nonNull
)
.
map
(
String:
:
valueOf
)
.
map
(
String:
:
valueOf
)
.
distinct
()
.
distinct
()
.
collect
(
Collectors
.
joining
(
","
));
.
collect
(
Collectors
.
joining
(
Constants
.
COMMA
));
if
(
propIds
.
isEmpty
(
))
{
if
(
StringUtils
.
isBlank
(
propIds
))
{
vo
.
setSkuProperties
(
Collections
.
emptyList
());
vo
.
setSkuProperties
(
Collections
.
emptyList
());
vo
.
setNormalProperties
(
Collections
.
emptyList
());
vo
.
setNormalProperties
(
Collections
.
emptyList
());
return
;
return
;
...
@@ -260,7 +255,7 @@ public class ProductTemplateInfoServiceImpl implements ProductTemplateInfoServic
...
@@ -260,7 +255,7 @@ public class ProductTemplateInfoServiceImpl implements ProductTemplateInfoServic
// 调用 baseProperty API 获取属性详情(复用 SaasAdminService)
// 调用 baseProperty API 获取属性详情(复用 SaasAdminService)
List
<
PropertyModel
>
allProperties
=
saasAdminService
.
getPropertyByIds
(
propIds
);
List
<
PropertyModel
>
allProperties
=
saasAdminService
.
getPropertyByIds
(
propIds
);
if
(
allProperties
==
null
||
allProperties
.
isEmpty
(
))
{
if
(
CollectionUtils
.
isNotEmpty
(
allProperties
))
{
vo
.
setSkuProperties
(
Collections
.
emptyList
());
vo
.
setSkuProperties
(
Collections
.
emptyList
());
vo
.
setNormalProperties
(
Collections
.
emptyList
());
vo
.
setNormalProperties
(
Collections
.
emptyList
());
return
;
return
;
...
@@ -306,7 +301,7 @@ public class ProductTemplateInfoServiceImpl implements ProductTemplateInfoServic
...
@@ -306,7 +301,7 @@ public class ProductTemplateInfoServiceImpl implements ProductTemplateInfoServic
private
List
<
ProductTemplateItemSpecSnakeVO
>
buildSpecList
(
List
<
ProductTemplateItemSpecEntity
>
specs
)
{
private
List
<
ProductTemplateItemSpecSnakeVO
>
buildSpecList
(
List
<
ProductTemplateItemSpecEntity
>
specs
)
{
Map
<
String
,
ProductTemplateItemSpecEntity
>
uniqueMap
=
new
LinkedHashMap
<>();
Map
<
String
,
ProductTemplateItemSpecEntity
>
uniqueMap
=
new
LinkedHashMap
<>();
for
(
ProductTemplateItemSpecEntity
spec
:
specs
)
{
for
(
ProductTemplateItemSpecEntity
spec
:
specs
)
{
String
key
=
spec
.
getFaceId
()
+
"_"
+
spec
.
getSize
();
String
key
=
spec
.
getFaceId
()
+
UNDER_LINE
+
spec
.
getSize
();
uniqueMap
.
putIfAbsent
(
key
,
spec
);
uniqueMap
.
putIfAbsent
(
key
,
spec
);
}
}
return
uniqueMap
.
values
().
stream
()
return
uniqueMap
.
values
().
stream
()
...
...
custom-server-app/src/main/java/com/jomalls/custom/app/vo/BasicCustomProductInfoSnakeModel.java
View file @
c701c5ab
...
@@ -127,34 +127,6 @@ public class BasicCustomProductInfoSnakeModel {
...
@@ -127,34 +127,6 @@ public class BasicCustomProductInfoSnakeModel {
@Schema
(
description
=
"默认模SKU"
)
@Schema
(
description
=
"默认模SKU"
)
private
String
diy_sku
;
private
String
diy_sku
;
@Schema
(
description
=
"普通图片列表(type=0)"
)
private
List
<
CustomProductImageSnakeVO
>
imageList
;
@Schema
(
description
=
"商品描述"
)
private
ProductRemarkSnakeVO
productRemark
;
@Schema
(
description
=
"商品中文描述"
)
private
ProductRemarkSnakeVO
productCnRemark
;
@Schema
(
description
=
"工厂价格关联列表"
)
private
List
<
CustomProductFactoryPriceRelSnakeVO
>
factoryPriceList
;
@Schema
(
description
=
"尺码图片列表(type=1)"
)
private
List
<
CustomProductImageSnakeVO
>
sizeList
;
@Schema
(
description
=
"DIY 用户 ID 列表"
)
private
List
<
Integer
>
diyUserIds
;
@Schema
(
description
=
"工艺 ID 列表"
)
private
List
<
String
>
craftIds
;
@Schema
(
description
=
"工厂 ID 列表"
)
private
List
<
Integer
>
factoryIds
;
@Schema
(
description
=
"仓库 ID 列表"
)
private
List
<
Integer
>
warehouseIds
;
@Schema
(
description
=
"英文备注内容"
)
@Schema
(
description
=
"英文备注内容"
)
private
String
remark
;
private
String
remark
;
...
...
custom-server-app/src/main/java/com/jomalls/custom/app/vo/BasicCustomProductItemSnakeModel.java
0 → 100644
View file @
c701c5ab
package
com
.
jomalls
.
custom
.
app
.
vo
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
import
java.util.Date
;
/**
* Model
*
* @author Lizh
* @date 2026-06-03 11:57:04
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Schema
(
description
=
"VO"
)
public
class
BasicCustomProductItemSnakeModel
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
1L
;
/**
*
*/
@Schema
(
description
=
""
)
private
Integer
id
;
/**
* 商品ID
*/
@Schema
(
description
=
"商品ID"
)
private
Integer
product_id
;
/**
* sku
*/
@Schema
(
description
=
"sku"
)
private
String
sku
;
/**
* sku商品名称
*/
@Schema
(
description
=
"sku商品名称"
)
private
String
sku_name
;
/**
* 货号
*/
@Schema
(
description
=
"货号"
)
private
String
product_no
;
/**
* 封面图
*/
@Schema
(
description
=
"封面图"
)
private
String
image
;
/**
* 图片集
*/
@Schema
(
description
=
"图片集"
)
private
String
image_ary
;
/**
* 属性分类ID1
*/
@Schema
(
description
=
"属性分类ID1"
)
private
Integer
property_cate_id1
;
/**
* 属性分类ID2
*/
@Schema
(
description
=
"属性分类ID2"
)
private
Integer
property_cate_id2
;
/**
* 属性分类ID3
*/
@Schema
(
description
=
"属性分类ID3"
)
private
Integer
property_cate_id3
;
/**
*
*/
@Schema
(
description
=
""
)
private
Integer
property1_id
;
/**
*
*/
@Schema
(
description
=
""
)
private
Integer
property2_id
;
/**
*
*/
@Schema
(
description
=
""
)
private
Integer
property3_id
;
/**
* 属性编码1
*/
@Schema
(
description
=
"属性编码1"
)
private
String
property_code1
;
/**
* 属性编码2
*/
@Schema
(
description
=
"属性编码2"
)
private
String
property_code2
;
/**
*
*/
@Schema
(
description
=
""
)
private
String
property_code3
;
/**
* 属性名称1
*/
@Schema
(
description
=
"属性名称1"
)
private
String
option_enname1
;
/**
* 属性名称2
*/
@Schema
(
description
=
"属性名称2"
)
private
String
option_enname2
;
/**
*
*/
@Schema
(
description
=
""
)
private
String
option_enname3
;
/**
*
*/
@Schema
(
description
=
""
)
private
String
custom_value1
;
/**
*
*/
@Schema
(
description
=
""
)
private
String
custom_value2
;
/**
*
*/
@Schema
(
description
=
""
)
private
String
custom_value3
;
/**
* 工厂价
*/
@Schema
(
description
=
"工厂价"
)
private
BigDecimal
factory_price
;
/**
* 销售价
*/
@Schema
(
description
=
"销售价"
)
private
BigDecimal
sales_price
;
/**
* sku克重
*/
@Schema
(
description
=
"sku克重"
)
private
BigDecimal
sku_weight
;
/**
* 印花类型 0满印 1局部印
*/
@Schema
(
description
=
"印花类型 0满印 1局部印"
)
private
Integer
print_type
;
/**
* 1正常码 2大码
*/
@Schema
(
description
=
"1正常码 2大码"
)
private
Integer
size_type
;
/**
* 排序
*/
@Schema
(
description
=
"排序"
)
private
Integer
sort
;
/**
* 创建时间
*/
@Schema
(
description
=
"创建时间"
)
private
Date
create_time
;
}
custom-server-app/src/main/java/com/jomalls/custom/app/vo/CraftCenterSnakeVO.java
View file @
c701c5ab
...
@@ -67,5 +67,5 @@ public class CraftCenterSnakeVO implements Serializable {
...
@@ -67,5 +67,5 @@ public class CraftCenterSnakeVO implements Serializable {
private
Date
update_time
;
private
Date
update_time
;
@Schema
(
description
=
"工艺与商品的关联数据(对齐 TS CustomProductCraftRel)"
)
@Schema
(
description
=
"工艺与商品的关联数据(对齐 TS CustomProductCraftRel)"
)
private
CustomProductCraftRelSnakeVO
c
ustomProductCraftRel
;
private
CustomProductCraftRelSnakeVO
C
ustomProductCraftRel
;
}
}
custom-server-app/src/main/java/com/jomalls/custom/app/vo/CustomProductInfoSnakeVO.java
View file @
c701c5ab
...
@@ -23,8 +23,35 @@ import java.util.List;
...
@@ -23,8 +23,35 @@ import java.util.List;
@Schema
(
description
=
"商品完整详情"
)
@Schema
(
description
=
"商品完整详情"
)
public
class
CustomProductInfoSnakeVO
extends
BasicCustomProductInfoSnakeModel
implements
Serializable
{
public
class
CustomProductInfoSnakeVO
extends
BasicCustomProductInfoSnakeModel
implements
Serializable
{
@Schema
(
description
=
"仓库 ID 列表"
)
private
List
<
Integer
>
warehouseIds
;
@Schema
(
description
=
"工艺 ID 列表"
)
private
List
<
String
>
craftIds
;
@Schema
(
description
=
"尺码图片列表(type=1)"
)
private
List
<
CustomProductImageSnakeVO
>
sizeList
;
@Schema
(
description
=
"商品描述"
)
private
ProductRemarkSnakeVO
productRemark
;
@Schema
(
description
=
"商品中文描述"
)
private
ProductRemarkSnakeVO
productCnRemark
;
@Schema
(
description
=
"普通图片列表(type=0)"
)
private
List
<
CustomProductImageSnakeVO
>
imageList
;
@Schema
(
description
=
"DIY 用户 ID 列表"
)
private
List
<
Integer
>
diyUserIds
;
@Schema
(
description
=
"工厂 ID 列表"
)
private
List
<
Integer
>
factoryIds
;
@Schema
(
description
=
"工厂价格关联列表"
)
private
List
<
CustomProductFactoryPriceRelSnakeVO
>
factoryPriceList
;
@Schema
(
description
=
"SKU 子项列表"
)
@Schema
(
description
=
"SKU 子项列表"
)
private
List
<
CustomProductItemSnakeVO
>
productList
;
private
List
<
BasicCustomProductItemSnakeModel
>
productList
;
@Schema
(
description
=
"普通属性列表"
)
@Schema
(
description
=
"普通属性列表"
)
private
List
<
CustomProductInfoPropertySnakeVO
>
properties
;
private
List
<
CustomProductInfoPropertySnakeVO
>
properties
;
...
...
custom-server-app/src/main/java/com/jomalls/custom/app/vo/CustomProductItemSnakeVO.java
View file @
c701c5ab
package
com
.
jomalls
.
custom
.
app
.
vo
;
package
com
.
jomalls
.
custom
.
app
.
vo
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.AllArgsConstructor
;
import
lombok.*
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -23,172 +16,8 @@ import java.util.List;
...
@@ -23,172 +16,8 @@ import java.util.List;
@NoArgsConstructor
@NoArgsConstructor
@AllArgsConstructor
@AllArgsConstructor
@Schema
(
description
=
"VO"
)
@Schema
(
description
=
"VO"
)
public
class
CustomProductItemSnakeVO
implements
Serializable
{
@EqualsAndHashCode
(
callSuper
=
true
)
@Serial
public
class
CustomProductItemSnakeVO
extends
BasicCustomProductItemSnakeModel
{
private
static
final
long
serialVersionUID
=
1L
;
/**
*
*/
@Schema
(
description
=
""
)
private
Integer
id
;
/**
* 商品ID
*/
@Schema
(
description
=
"商品ID"
)
private
Integer
product_id
;
/**
* sku
*/
@Schema
(
description
=
"sku"
)
private
String
sku
;
/**
* sku商品名称
*/
@Schema
(
description
=
"sku商品名称"
)
private
String
sku_name
;
/**
* 货号
*/
@Schema
(
description
=
"货号"
)
private
String
product_no
;
/**
* 封面图
*/
@Schema
(
description
=
"封面图"
)
private
String
image
;
/**
* 图片集
*/
@Schema
(
description
=
"图片集"
)
private
String
image_ary
;
/**
* 属性分类ID1
*/
@Schema
(
description
=
"属性分类ID1"
)
private
Integer
property_cate_id1
;
/**
* 属性分类ID2
*/
@Schema
(
description
=
"属性分类ID2"
)
private
Integer
property_cate_id2
;
/**
* 属性分类ID3
*/
@Schema
(
description
=
"属性分类ID3"
)
private
Integer
property_cate_id3
;
/**
*
*/
@Schema
(
description
=
""
)
private
Integer
property1_id
;
/**
*
*/
@Schema
(
description
=
""
)
private
Integer
property2_id
;
/**
*
*/
@Schema
(
description
=
""
)
private
Integer
property3_id
;
/**
* 属性编码1
*/
@Schema
(
description
=
"属性编码1"
)
private
String
property_code1
;
/**
* 属性编码2
*/
@Schema
(
description
=
"属性编码2"
)
private
String
property_code2
;
/**
*
*/
@Schema
(
description
=
""
)
private
String
property_code3
;
/**
* 属性名称1
*/
@Schema
(
description
=
"属性名称1"
)
private
String
option_enname1
;
/**
* 属性名称2
*/
@Schema
(
description
=
"属性名称2"
)
private
String
option_enname2
;
/**
*
*/
@Schema
(
description
=
""
)
private
String
option_enname3
;
/**
*
*/
@Schema
(
description
=
""
)
private
String
custom_value1
;
/**
*
*/
@Schema
(
description
=
""
)
private
String
custom_value2
;
/**
*
*/
@Schema
(
description
=
""
)
private
String
custom_value3
;
/**
* 工厂价
*/
@Schema
(
description
=
"工厂价"
)
private
BigDecimal
factory_price
;
/**
* 销售价
*/
@Schema
(
description
=
"销售价"
)
private
BigDecimal
sales_price
;
/**
* sku克重
*/
@Schema
(
description
=
"sku克重"
)
private
BigDecimal
sku_weight
;
/**
* 印花类型 0满印 1局部印
*/
@Schema
(
description
=
"印花类型 0满印 1局部印"
)
private
Integer
print_type
;
/**
* 1正常码 2大码
*/
@Schema
(
description
=
"1正常码 2大码"
)
private
Integer
size_type
;
/**
/**
* 关联商品信息的工厂ID(仅 getBySkus 接口填充,非表字段)
* 关联商品信息的工厂ID(仅 getBySkus 接口填充,非表字段)
*/
*/
...
@@ -202,22 +31,10 @@ public class CustomProductItemSnakeVO implements Serializable {
...
@@ -202,22 +31,10 @@ public class CustomProductItemSnakeVO implements Serializable {
private
String
factory_code
;
private
String
factory_code
;
/**
/**
* 排序
*/
@Schema
(
description
=
"排序"
)
private
Integer
sort
;
/**
* 创建时间
*/
@Schema
(
description
=
"创建时间"
)
private
Date
create_time
;
/**
* 关联商品信息(仅 getBySkus 接口填充,对齐 TS include CustomProductInfo)
* 关联商品信息(仅 getBySkus 接口填充,对齐 TS include CustomProductInfo)
*/
*/
@Schema
(
description
=
"关联商品信息"
)
@Schema
(
description
=
"关联商品信息"
)
private
CustomProductInfoSnakeVO
customProductInfo
;
private
BasicCustomProductInfoSnakeModel
customProductInfo
;
/**
/**
* 工厂价格列表(仅 getBySkus 接口填充,对齐 TS include CustomProductFactoryPriceRel)
* 工厂价格列表(仅 getBySkus 接口填充,对齐 TS include CustomProductFactoryPriceRel)
...
...
custom-server-app/src/main/java/com/jomalls/custom/app/vo/CustomWarehouseInfoSnakeVO.java
View file @
c701c5ab
...
@@ -233,6 +233,6 @@ public class CustomWarehouseInfoSnakeVO implements Serializable {
...
@@ -233,6 +233,6 @@ public class CustomWarehouseInfoSnakeVO implements Serializable {
private
String
company_name_cn
;
private
String
company_name_cn
;
@Schema
(
description
=
"仓库与商品的关联数据(对齐 TS CustomProductWarehouseRel)"
)
@Schema
(
description
=
"仓库与商品的关联数据(对齐 TS CustomProductWarehouseRel)"
)
private
CustomProductWarehouseRelSnakeVO
c
ustomProductWarehouseRel
;
private
CustomProductWarehouseRelSnakeVO
C
ustomProductWarehouseRel
;
}
}
custom-server-webapp/src/main/java/com/jomalls/custom/webapp/controller/CustomProductItemController.java
View file @
c701c5ab
package
com
.
jomalls
.
custom
.
webapp
.
controller
;
package
com
.
jomalls
.
custom
.
webapp
.
controller
;
import
com.jomalls.custom.app.constant.Constants
;
import
com.jomalls.custom.app.dto.UpdateSalesPriceSnakeDTO
;
import
com.jomalls.custom.app.dto.UpdateSalesPriceSnakeDTO
;
import
com.jomalls.custom.app.service.CustomProductItemService
;
import
com.jomalls.custom.app.service.CustomProductItemService
;
import
com.jomalls.custom.app.vo.CustomProductItemSnakeVO
;
import
com.jomalls.custom.app.vo.CustomProductItemSnakeVO
;
...
@@ -74,7 +75,7 @@ public class CustomProductItemController {
...
@@ -74,7 +75,7 @@ public class CustomProductItemController {
public
List
<
CustomProductItemSnakeVO
>
getBySkus
(
public
List
<
CustomProductItemSnakeVO
>
getBySkus
(
@Parameter
(
description
=
"SKU列表(逗号分隔)"
,
required
=
true
)
@RequestParam
(
"skus"
)
String
skus
,
@Parameter
(
description
=
"SKU列表(逗号分隔)"
,
required
=
true
)
@RequestParam
(
"skus"
)
String
skus
,
@Parameter
(
description
=
"用户namespace(可选)"
)
@RequestParam
(
value
=
"namespace"
,
required
=
false
)
String
namespace
)
{
@Parameter
(
description
=
"用户namespace(可选)"
)
@RequestParam
(
value
=
"namespace"
,
required
=
false
)
String
namespace
)
{
List
<
String
>
skuList
=
Arrays
.
asList
(
skus
.
split
(
","
));
List
<
String
>
skuList
=
Arrays
.
asList
(
skus
.
split
(
Constants
.
COMMA
));
return
customProductItemService
.
getBySkus
(
skuList
,
namespace
);
return
customProductItemService
.
getBySkus
(
skuList
,
namespace
);
}
}
}
}
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