记得上下班打卡 | git大法好,push需谨慎
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liquidnet-bus-v1
Project
Project
Details
Activity
Releases
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
董敬伟
liquidnet-bus-v1
Commits
2787a95e
Commit
2787a95e
authored
Mar 04, 2022
by
张国柄
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
~OPT:商品编辑:SPU添加、编辑;
parent
8b4e2598
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
139 additions
and
79 deletions
+139
-79
GoblinStoreMgtGoodsController.java
...blin/controller/manage/GoblinStoreMgtGoodsController.java
+139
-79
No files found.
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/controller/manage/GoblinStoreMgtGoodsController.java
View file @
2787a95e
...
@@ -218,9 +218,11 @@ public class GoblinStoreMgtGoodsController {
...
@@ -218,9 +218,11 @@ public class GoblinStoreMgtGoodsController {
if
(
CollectionUtils
.
isEmpty
(
storeMgtGoodsAddParam
.
getImageList
()))
{
if
(
CollectionUtils
.
isEmpty
(
storeMgtGoodsAddParam
.
getImageList
()))
{
return
ResponseDto
.
failure
(
ErrorCode
.
HTTP_PARAM_ERROR
.
getCode
(),
"商品图片不能为空"
);
return
ResponseDto
.
failure
(
ErrorCode
.
HTTP_PARAM_ERROR
.
getCode
(),
"商品图片不能为空"
);
}
}
{
// 分类、ISBN校验
String
cateSid
=
storeMgtGoodsAddParam
.
getCateSid
(),
cateTid
=
storeMgtGoodsAddParam
.
getCateTid
();
String
cateSid
=
storeMgtGoodsAddParam
.
getCateSid
(),
cateTid
=
storeMgtGoodsAddParam
.
getCateTid
();
List
<
GoblinSelfGoodsCategoryVo
>
selfGoodsCategoryVos
=
goblinStoreMgtExtraService
.
listCategoryVo
();
List
<
GoblinSelfGoodsCategoryVo
>
selfGoodsCategoryVos
=
goblinStoreMgtExtraService
.
listCategoryVo
();
Optional
<
GoblinSelfGoodsCategoryVo
>
categoryVoOptional
=
selfGoodsCategoryVos
.
stream
().
filter
(
r
->
r
.
getCateId
().
equals
(
storeMgtGoodsAddParam
.
getCateFid
())
&&
r
.
getGrade
().
equals
(
"1"
)).
findAny
();
Optional
<
GoblinSelfGoodsCategoryVo
>
categoryVoOptional
=
selfGoodsCategoryVos
.
stream
()
.
filter
(
r
->
r
.
getCateId
().
equals
(
storeMgtGoodsAddParam
.
getCateFid
())
&&
r
.
getGrade
().
equals
(
"1"
)).
findAny
();
if
(!
categoryVoOptional
.
isPresent
())
{
if
(!
categoryVoOptional
.
isPresent
())
{
return
ResponseDto
.
failure
(
ErrorCode
.
HTTP_PARAM_ERROR
.
getCode
(),
"商品一级分类无效"
);
return
ResponseDto
.
failure
(
ErrorCode
.
HTTP_PARAM_ERROR
.
getCode
(),
"商品一级分类无效"
);
}
}
...
@@ -255,6 +257,7 @@ public class GoblinStoreMgtGoodsController {
...
@@ -255,6 +257,7 @@ public class GoblinStoreMgtGoodsController {
// if (StringUtils.isNotBlank(cateTid) && selfGoodsCategoryVos.stream().noneMatch(r -> r.getCateId().equals(cateTid) && r.getGrade().equals("3"))) {
// if (StringUtils.isNotBlank(cateTid) && selfGoodsCategoryVos.stream().noneMatch(r -> r.getCateId().equals(cateTid) && r.getGrade().equals("3"))) {
// return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "商品三级分类无效");
// return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "商品三级分类无效");
// }
// }
}
GoblinGoodsInfoVo
mgtGoodsInfoVo
=
goblinMongoUtils
.
getMgtGoodsInfoVo
(
storeId
,
storeMgtGoodsAddParam
.
getName
());
GoblinGoodsInfoVo
mgtGoodsInfoVo
=
goblinMongoUtils
.
getMgtGoodsInfoVo
(
storeId
,
storeMgtGoodsAddParam
.
getName
());
if
(
null
!=
mgtGoodsInfoVo
)
{
if
(
null
!=
mgtGoodsInfoVo
)
{
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"149007"
));
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"149007"
));
...
@@ -344,25 +347,33 @@ public class GoblinStoreMgtGoodsController {
...
@@ -344,25 +347,33 @@ public class GoblinStoreMgtGoodsController {
@ApiOperationSupport
(
order
=
6
)
@ApiOperationSupport
(
order
=
6
)
@ApiOperation
(
value
=
"商品编辑:SPU编辑"
,
notes
=
"只修改商品信息,不包含规格相关信息"
)
@ApiOperation
(
value
=
"商品编辑:SPU编辑"
,
notes
=
"只修改商品信息,不包含规格相关信息"
)
@PostMapping
(
"edit_spu"
)
@PostMapping
(
"edit_spu"
)
public
ResponseDto
<
Object
>
editSpu
(
@Valid
@RequestBody
GoblinStoreMgtGoodsAddParam
storeMgtGoodsAddParam
)
{
public
ResponseDto
<
Object
>
editSpu
(
@Valid
@RequestBody
GoblinStoreMgtGoodsAddParam
mgtGoodsAddParam
)
{
String
currentUid
=
CurrentUtil
.
getCurrentUid
();
String
currentUid
=
CurrentUtil
.
getCurrentUid
(),
storeId
=
mgtGoodsAddParam
.
getStoreId
();
String
storeId
=
storeMgtGoodsAddParam
.
getStoreId
();
if
(!
goblinRedisUtils
.
hasStoreId
(
currentUid
,
storeId
))
{
if
(!
goblinRedisUtils
.
hasStoreId
(
currentUid
,
storeId
))
{
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"149002"
));
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"149002"
));
}
}
if
(
CollectionUtils
.
isEmpty
(
storeM
gtGoodsAddParam
.
getImageList
()))
{
if
(
CollectionUtils
.
isEmpty
(
m
gtGoodsAddParam
.
getImageList
()))
{
return
ResponseDto
.
failure
(
ErrorCode
.
HTTP_PARAM_ERROR
.
getCode
(),
"商品图片不能为空"
);
return
ResponseDto
.
failure
(
ErrorCode
.
HTTP_PARAM_ERROR
.
getCode
(),
"商品图片不能为空"
);
}
}
GoblinGoodsInfoVo
mgtGoodsInfoVo
=
goblinMongoUtils
.
getMgtGoodsInfoVo
(
storeId
,
storeMgtGoodsAddParam
.
getName
());
GoblinGoodsInfoVo
mgtGoodsInfoVo
;
if
(
null
!=
mgtGoodsInfoVo
&&
!
mgtGoodsInfoVo
.
getSpuId
().
equals
(
storeMgtGoodsAddParam
.
getSpuId
()))
{
if
(
StringUtils
.
isBlank
(
mgtGoodsAddParam
.
getSpuId
())
||
null
==
(
mgtGoodsInfoVo
=
goblinRedisUtils
.
getGoodsInfoVo
(
mgtGoodsAddParam
.
getSpuId
()))
||
!
mgtGoodsInfoVo
.
getStoreId
().
equals
(
storeId
)
||
!
mgtGoodsInfoVo
.
getDelFlg
().
equals
(
"0"
))
{
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"149010"
));
}
if
(!
mgtGoodsInfoVo
.
getName
().
equals
(
mgtGoodsAddParam
.
getName
())
&&
null
!=
goblinMongoUtils
.
getMgtGoodsInfoVo
(
storeId
,
mgtGoodsAddParam
.
getName
()))
{
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"149007"
));
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"149007"
));
}
}
List
<
GoblinGoodsSkuInfoVo
>
goodsSkuInfoVos
=
goblinMongoUtils
.
getGoodsSkuInfoVos
(
mgtGoodsInfoVo
.
getSkuIdList
());
List
<
String
>
skuIdList
=
mgtGoodsInfoVo
.
getSkuIdList
();
boolean
hasSkuFlg
=
CollectionUtils
.
isEmpty
(
goodsSkuInfoVos
);
List
<
GoblinGoodsSkuInfoVo
>
goodsSkuInfoVos
=
CollectionUtils
.
isEmpty
(
skuIdList
)
?
null
:
goblinMongoUtils
.
getGoodsSkuInfoVos
(
skuIdList
);
boolean
hasSkuFlg
=
!
CollectionUtils
.
isEmpty
(
goodsSkuInfoVos
);
String
cateSid
=
storeMgtGoodsAddParam
.
getCateSid
(),
cateTid
=
storeMgtGoodsAddParam
.
getCateTid
();
{
// 分类、ISBN校验
String
cateSid
=
mgtGoodsAddParam
.
getCateSid
(),
cateTid
=
mgtGoodsAddParam
.
getCateTid
();
List
<
GoblinSelfGoodsCategoryVo
>
selfGoodsCategoryVos
=
goblinStoreMgtExtraService
.
listCategoryVo
();
List
<
GoblinSelfGoodsCategoryVo
>
selfGoodsCategoryVos
=
goblinStoreMgtExtraService
.
listCategoryVo
();
Optional
<
GoblinSelfGoodsCategoryVo
>
categoryVoOptional
=
selfGoodsCategoryVos
.
stream
().
filter
(
r
->
r
.
getCateId
().
equals
(
storeMgtGoodsAddParam
.
getCateFid
())
&&
r
.
getGrade
().
equals
(
"1"
)).
findAny
();
Optional
<
GoblinSelfGoodsCategoryVo
>
categoryVoOptional
=
selfGoodsCategoryVos
.
stream
()
.
filter
(
r
->
r
.
getCateId
().
equals
(
mgtGoodsAddParam
.
getCateFid
())
&&
r
.
getGrade
().
equals
(
"1"
)).
findAny
();
if
(!
categoryVoOptional
.
isPresent
())
{
if
(!
categoryVoOptional
.
isPresent
())
{
return
ResponseDto
.
failure
(
ErrorCode
.
HTTP_PARAM_ERROR
.
getCode
(),
"商品一级分类无效"
);
return
ResponseDto
.
failure
(
ErrorCode
.
HTTP_PARAM_ERROR
.
getCode
(),
"商品一级分类无效"
);
}
}
...
@@ -388,7 +399,7 @@ public class GoblinStoreMgtGoodsController {
...
@@ -388,7 +399,7 @@ public class GoblinStoreMgtGoodsController {
return
ResponseDto
.
failure
(
ErrorCode
.
HTTP_PARAM_ERROR
.
getCode
(),
"请核实输入ISBN"
);
return
ResponseDto
.
failure
(
ErrorCode
.
HTTP_PARAM_ERROR
.
getCode
(),
"请核实输入ISBN"
);
}
}
}
}
// if (selfGoodsCategoryVos.stream().noneMatch(r -> r.getCateId().equals(
storeM
gtGoodsAddParam.getCateFid()) && r.getGrade().equals("1"))) {
// if (selfGoodsCategoryVos.stream().noneMatch(r -> r.getCateId().equals(
m
gtGoodsAddParam.getCateFid()) && r.getGrade().equals("1"))) {
// return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "商品分类1无效");
// return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "商品分类1无效");
// }
// }
// if (StringUtils.isNotBlank(cateSid) && selfGoodsCategoryVos.stream().noneMatch(r -> r.getCateId().equals(cateSid) && r.getGrade().equals("2"))) {
// if (StringUtils.isNotBlank(cateSid) && selfGoodsCategoryVos.stream().noneMatch(r -> r.getCateId().equals(cateSid) && r.getGrade().equals("2"))) {
...
@@ -397,16 +408,11 @@ public class GoblinStoreMgtGoodsController {
...
@@ -397,16 +408,11 @@ public class GoblinStoreMgtGoodsController {
// if (StringUtils.isNotBlank(cateTid) && selfGoodsCategoryVos.stream().noneMatch(r -> r.getCateId().equals(cateTid) && r.getGrade().equals("3"))) {
// if (StringUtils.isNotBlank(cateTid) && selfGoodsCategoryVos.stream().noneMatch(r -> r.getCateId().equals(cateTid) && r.getGrade().equals("3"))) {
// return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "商品分类3无效");
// return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "商品分类3无效");
// }
// }
GoblinGoodsInfoVo
goodsInfoVo
;
if
(
StringUtils
.
isBlank
(
storeMgtGoodsAddParam
.
getSpuId
())
||
null
==
(
goodsInfoVo
=
goblinRedisUtils
.
getGoodsInfoVo
(
storeMgtGoodsAddParam
.
getSpuId
()))
||
!
goodsInfoVo
.
getDelFlg
().
equals
(
"0"
))
{
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"149010"
));
}
}
if
(
log
.
isDebugEnabled
())
{
if
(
log
.
isDebugEnabled
())
{
log
.
debug
(
"商品管理:商品编辑:SPU编辑:[GoblinStoreMgtGoodsAddParam={}]"
,
JsonUtils
.
toJson
(
storeM
gtGoodsAddParam
));
log
.
debug
(
"商品管理:商品编辑:SPU编辑:[GoblinStoreMgtGoodsAddParam={}]"
,
JsonUtils
.
toJson
(
m
gtGoodsAddParam
));
}
}
return
ResponseDto
.
success
(
goblinstoreMgtGoodsService
.
goodsEditSpu
(
currentUid
,
storeMgtGoodsAddParam
,
g
oodsInfoVo
));
return
ResponseDto
.
success
(
goblinstoreMgtGoodsService
.
goodsEditSpu
(
currentUid
,
mgtGoodsAddParam
,
mgtG
oodsInfoVo
));
}
}
@ApiOperationSupport
(
order
=
7
)
@ApiOperationSupport
(
order
=
7
)
...
@@ -417,20 +423,46 @@ public class GoblinStoreMgtGoodsController {
...
@@ -417,20 +423,46 @@ public class GoblinStoreMgtGoodsController {
if
(!
goblinRedisUtils
.
hasStoreId
(
currentUid
,
storeId
))
{
if
(!
goblinRedisUtils
.
hasStoreId
(
currentUid
,
storeId
))
{
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"149002"
));
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"149002"
));
}
}
// TODO: 2022/1/5 zhanggb +分类-ISBN校验
String
paramSkuId
=
mgtGoodsEditSkuParam
.
getSkuId
();
String
paramSkuId
=
mgtGoodsEditSkuParam
.
getSkuId
();
GoblinGoodsSkuInfoVo
mgtGoodsSkuInfoVo
;
GoblinGoodsSkuInfoVo
mgtGoodsSkuInfoVo
;
if
(
StringUtils
.
isBlank
(
paramSkuId
)
if
(
StringUtils
.
isBlank
(
paramSkuId
)
||
null
==
(
mgtGoodsSkuInfoVo
=
goblinRedisUtils
.
getGoodsSkuInfoVo
(
paramSkuId
))
||
!
mgtGoodsSkuInfoVo
.
getDelFlg
().
equals
(
"0"
)
||
null
==
(
mgtGoodsSkuInfoVo
=
goblinRedisUtils
.
getGoodsSkuInfoVo
(
paramSkuId
))
||
!
mgtGoodsSkuInfoVo
.
getStoreId
().
equals
(
storeId
))
{
||
!
mgtGoodsSkuInfoVo
.
getStoreId
().
equals
(
storeId
)
||
!
mgtGoodsSkuInfoVo
.
getDelFlg
().
equals
(
"0"
))
{
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"149011"
));
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"149011"
));
}
}
GoblinGoodsInfoVo
goodsInfoVo
=
goblinRedisUtils
.
getGoodsInfoVo
(
mgtGoodsSkuInfoVo
.
getSpuId
());
GoblinGoodsInfoVo
goodsInfoVo
=
goblinRedisUtils
.
getGoodsInfoVo
(
mgtGoodsSkuInfoVo
.
getSpuId
());
if
(
null
==
goodsInfoVo
||
!
goodsInfoVo
.
getDelFlg
().
equals
(
"0"
))
{
if
(
null
==
goodsInfoVo
||
!
goodsInfoVo
.
getDelFlg
().
equals
(
"0"
))
{
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"149010"
));
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"149010"
));
}
}
{
// 分类、ISBN校验
String
cateFid
=
goodsInfoVo
.
getCateFid
(),
cateSid
=
goodsInfoVo
.
getCateSid
(),
cateTid
=
goodsInfoVo
.
getCateTid
();
List
<
GoblinSelfGoodsCategoryVo
>
selfGoodsCategoryVos
=
goblinStoreMgtExtraService
.
listCategoryVo
();
Optional
<
GoblinSelfGoodsCategoryVo
>
categoryVoOptional
=
selfGoodsCategoryVos
.
stream
()
.
filter
(
r
->
r
.
getCateId
().
equals
(
cateFid
)
&&
r
.
getGrade
().
equals
(
"1"
)).
findAny
();
if
(!
categoryVoOptional
.
isPresent
())
{
return
ResponseDto
.
failure
(
ErrorCode
.
HTTP_PARAM_ERROR
.
getCode
(),
"商品一级分类无效"
);
}
if
(
categoryVoOptional
.
get
().
getNeIsbn
().
equals
(
"1"
)
&&
StringUtils
.
isBlank
(
mgtGoodsEditSkuParam
.
getSkuIsbn
()))
{
return
ResponseDto
.
failure
(
ErrorCode
.
HTTP_PARAM_ERROR
.
getCode
(),
"请核实输入ISBN"
);
}
if
(
StringUtils
.
isNotBlank
(
cateSid
))
{
if
(!(
categoryVoOptional
=
selfGoodsCategoryVos
.
stream
().
filter
(
r
->
r
.
getCateId
().
equals
(
cateSid
)
&&
r
.
getGrade
().
equals
(
"2"
)).
findAny
()).
isPresent
())
{
return
ResponseDto
.
failure
(
ErrorCode
.
HTTP_PARAM_ERROR
.
getCode
(),
"商品二级分类无效"
);
}
if
(
categoryVoOptional
.
get
().
getNeIsbn
().
equals
(
"1"
)
&&
StringUtils
.
isBlank
(
mgtGoodsEditSkuParam
.
getSkuIsbn
()))
{
return
ResponseDto
.
failure
(
ErrorCode
.
HTTP_PARAM_ERROR
.
getCode
(),
"请核实输入ISBN"
);
}
}
if
(
StringUtils
.
isNotBlank
(
cateTid
))
{
if
(!(
categoryVoOptional
=
selfGoodsCategoryVos
.
stream
().
filter
(
r
->
r
.
getCateId
().
equals
(
cateTid
)
&&
r
.
getGrade
().
equals
(
"3"
)).
findAny
()).
isPresent
())
{
return
ResponseDto
.
failure
(
ErrorCode
.
HTTP_PARAM_ERROR
.
getCode
(),
"商品三级分类无效"
);
}
if
(
categoryVoOptional
.
get
().
getNeIsbn
().
equals
(
"1"
)
&&
StringUtils
.
isBlank
(
mgtGoodsEditSkuParam
.
getSkuIsbn
()))
{
return
ResponseDto
.
failure
(
ErrorCode
.
HTTP_PARAM_ERROR
.
getCode
(),
"请核实输入ISBN"
);
}
}
}
if
(
log
.
isDebugEnabled
())
{
if
(
log
.
isDebugEnabled
())
{
log
.
debug
(
"商品管理:商品编辑:SKU编辑:[GoblinStoreMgtGoodsEditSkuParam={}]"
,
JsonUtils
.
toJson
(
mgtGoodsEditSkuParam
));
log
.
debug
(
"商品管理:商品编辑:SKU编辑:[GoblinStoreMgtGoodsEditSkuParam={}]"
,
JsonUtils
.
toJson
(
mgtGoodsEditSkuParam
));
}
}
...
@@ -563,25 +595,53 @@ public class GoblinStoreMgtGoodsController {
...
@@ -563,25 +595,53 @@ public class GoblinStoreMgtGoodsController {
@ApiOperationSupport
(
order
=
8
)
@ApiOperationSupport
(
order
=
8
)
@ApiOperation
(
value
=
"商品编辑:SKU添加"
)
@ApiOperation
(
value
=
"商品编辑:SKU添加"
)
@PutMapping
(
"edit_sku/add"
)
@PutMapping
(
"edit_sku/add"
)
public
ResponseDto
<
Object
>
editSkuAdd
(
@Valid
@RequestBody
GoblinStoreMgtGoodsEditSkuParam
storeM
gtGoodsEditSkuParam
)
{
public
ResponseDto
<
Object
>
editSkuAdd
(
@Valid
@RequestBody
GoblinStoreMgtGoodsEditSkuParam
m
gtGoodsEditSkuParam
)
{
String
currentUid
=
CurrentUtil
.
getCurrentUid
();
String
currentUid
=
CurrentUtil
.
getCurrentUid
()
,
storeId
=
mgtGoodsEditSkuParam
.
getStoreId
()
;
if
(!
goblinRedisUtils
.
hasStoreId
(
currentUid
,
store
MgtGoodsEditSkuParam
.
getStoreId
()
))
{
if
(!
goblinRedisUtils
.
hasStoreId
(
currentUid
,
store
Id
))
{
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"149002"
));
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"149002"
));
}
}
if
(
storeM
gtGoodsEditSkuParam
.
getPrice
().
compareTo
(
BigDecimal
.
ZERO
)
<=
0
if
(
m
gtGoodsEditSkuParam
.
getPrice
().
compareTo
(
BigDecimal
.
ZERO
)
<=
0
||
storeM
gtGoodsEditSkuParam
.
getPriceMember
().
compareTo
(
BigDecimal
.
ZERO
)
<=
0
)
{
||
m
gtGoodsEditSkuParam
.
getPriceMember
().
compareTo
(
BigDecimal
.
ZERO
)
<=
0
)
{
return
ResponseDto
.
failure
(
ErrorCode
.
HTTP_PARAM_ERROR
.
getCode
(),
"价格无效"
);
return
ResponseDto
.
failure
(
ErrorCode
.
HTTP_PARAM_ERROR
.
getCode
(),
"价格无效"
);
}
}
if
(
null
==
storeMgtGoodsEditSkuParam
.
getStock
()
||
storeM
gtGoodsEditSkuParam
.
getStock
()
<=
0
)
{
if
(
null
==
mgtGoodsEditSkuParam
.
getStock
()
||
m
gtGoodsEditSkuParam
.
getStock
()
<=
0
)
{
return
ResponseDto
.
failure
(
ErrorCode
.
HTTP_PARAM_ERROR
.
getCode
(),
"库存无效"
);
return
ResponseDto
.
failure
(
ErrorCode
.
HTTP_PARAM_ERROR
.
getCode
(),
"库存无效"
);
}
}
GoblinGoodsInfoVo
goodsInfoVo
=
goblinRedisUtils
.
getGoodsInfoVo
(
storeM
gtGoodsEditSkuParam
.
getSpuId
());
GoblinGoodsInfoVo
goodsInfoVo
=
goblinRedisUtils
.
getGoodsInfoVo
(
m
gtGoodsEditSkuParam
.
getSpuId
());
if
(
null
==
goodsInfoVo
||
!
goodsInfoVo
.
getDelFlg
().
equals
(
"0"
)
if
(
null
==
goodsInfoVo
||
!
goodsInfoVo
.
getDelFlg
().
equals
(
"0"
)
||
!
goodsInfoVo
.
getStoreId
().
equals
(
store
MgtGoodsEditSkuParam
.
getStoreId
()
))
{
||
!
goodsInfoVo
.
getStoreId
().
equals
(
store
Id
))
{
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"149010"
));
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"149010"
));
}
}
{
// 分类、ISBN校验
String
cateFid
=
goodsInfoVo
.
getCateFid
(),
cateSid
=
goodsInfoVo
.
getCateSid
(),
cateTid
=
goodsInfoVo
.
getCateTid
();
List
<
GoblinSelfGoodsCategoryVo
>
selfGoodsCategoryVos
=
goblinStoreMgtExtraService
.
listCategoryVo
();
Optional
<
GoblinSelfGoodsCategoryVo
>
categoryVoOptional
=
selfGoodsCategoryVos
.
stream
()
.
filter
(
r
->
r
.
getCateId
().
equals
(
cateFid
)
&&
r
.
getGrade
().
equals
(
"1"
)).
findAny
();
if
(!
categoryVoOptional
.
isPresent
())
{
return
ResponseDto
.
failure
(
ErrorCode
.
HTTP_PARAM_ERROR
.
getCode
(),
"商品一级分类无效"
);
}
if
(
categoryVoOptional
.
get
().
getNeIsbn
().
equals
(
"1"
)
&&
StringUtils
.
isBlank
(
mgtGoodsEditSkuParam
.
getSkuIsbn
()))
{
return
ResponseDto
.
failure
(
ErrorCode
.
HTTP_PARAM_ERROR
.
getCode
(),
"请核实输入ISBN"
);
}
if
(
StringUtils
.
isNotBlank
(
cateSid
))
{
if
(!(
categoryVoOptional
=
selfGoodsCategoryVos
.
stream
().
filter
(
r
->
r
.
getCateId
().
equals
(
cateSid
)
&&
r
.
getGrade
().
equals
(
"2"
)).
findAny
()).
isPresent
())
{
return
ResponseDto
.
failure
(
ErrorCode
.
HTTP_PARAM_ERROR
.
getCode
(),
"商品二级分类无效"
);
}
if
(
categoryVoOptional
.
get
().
getNeIsbn
().
equals
(
"1"
)
&&
StringUtils
.
isBlank
(
mgtGoodsEditSkuParam
.
getSkuIsbn
()))
{
return
ResponseDto
.
failure
(
ErrorCode
.
HTTP_PARAM_ERROR
.
getCode
(),
"请核实输入ISBN"
);
}
}
if
(
StringUtils
.
isNotBlank
(
cateTid
))
{
if
(!(
categoryVoOptional
=
selfGoodsCategoryVos
.
stream
().
filter
(
r
->
r
.
getCateId
().
equals
(
cateTid
)
&&
r
.
getGrade
().
equals
(
"3"
)).
findAny
()).
isPresent
())
{
return
ResponseDto
.
failure
(
ErrorCode
.
HTTP_PARAM_ERROR
.
getCode
(),
"商品三级分类无效"
);
}
if
(
categoryVoOptional
.
get
().
getNeIsbn
().
equals
(
"1"
)
&&
StringUtils
.
isBlank
(
mgtGoodsEditSkuParam
.
getSkuIsbn
()))
{
return
ResponseDto
.
failure
(
ErrorCode
.
HTTP_PARAM_ERROR
.
getCode
(),
"请核实输入ISBN"
);
}
}
}
List
<
String
>
skuIdList
=
goodsInfoVo
.
getSkuIdList
();
List
<
String
>
skuIdList
=
goodsInfoVo
.
getSkuIdList
();
List
<
GoblinGoodsSpecDto
>
paramSkuSpecDtoList
=
storeM
gtGoodsEditSkuParam
.
getSkuSpecList
();
List
<
GoblinGoodsSpecDto
>
paramSkuSpecDtoList
=
m
gtGoodsEditSkuParam
.
getSkuSpecList
();
for
(
String
skuId
:
skuIdList
)
{
// 比对所有SKU规格信息
for
(
String
skuId
:
skuIdList
)
{
// 比对所有SKU规格信息
GoblinGoodsSkuInfoVo
mgtGoodsSkuInfoVo
=
goblinRedisUtils
.
getGoodsSkuInfoVo
(
skuId
);
GoblinGoodsSkuInfoVo
mgtGoodsSkuInfoVo
=
goblinRedisUtils
.
getGoodsSkuInfoVo
(
skuId
);
if
(
mgtGoodsSkuInfoVo
.
getSkuSpecList
().
size
()
!=
paramSkuSpecDtoList
.
size
())
{
if
(
mgtGoodsSkuInfoVo
.
getSkuSpecList
().
size
()
!=
paramSkuSpecDtoList
.
size
())
{
...
@@ -634,9 +694,9 @@ public class GoblinStoreMgtGoodsController {
...
@@ -634,9 +694,9 @@ public class GoblinStoreMgtGoodsController {
}
}
if
(
log
.
isDebugEnabled
())
{
if
(
log
.
isDebugEnabled
())
{
log
.
debug
(
"商品管理:商品编辑:SKU添加:[GoblinStoreMgtGoodsEditSkuParam={}]"
,
JsonUtils
.
toJson
(
storeM
gtGoodsEditSkuParam
));
log
.
debug
(
"商品管理:商品编辑:SKU添加:[GoblinStoreMgtGoodsEditSkuParam={}]"
,
JsonUtils
.
toJson
(
m
gtGoodsEditSkuParam
));
}
}
goblinstoreMgtGoodsService
.
goodsEditSkuAdd
(
currentUid
,
storeM
gtGoodsEditSkuParam
,
goodsInfoVo
);
goblinstoreMgtGoodsService
.
goodsEditSkuAdd
(
currentUid
,
m
gtGoodsEditSkuParam
,
goodsInfoVo
);
return
ResponseDto
.
success
();
return
ResponseDto
.
success
();
}
}
...
...
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