记得上下班打卡 | 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
8ffa0dac
Commit
8ffa0dac
authored
Jan 21, 2022
by
张国柄
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
~API:商品管理:+商品名称重复校验;
parent
7ab7d5ca
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
78 additions
and
12 deletions
+78
-12
GoblinStoreMgtCategoryController.java
...n/controller/manage/GoblinStoreMgtCategoryController.java
+1
-1
GoblinStoreMgtGoodsController.java
...blin/controller/manage/GoblinStoreMgtGoodsController.java
+38
-3
GoblinStoreMgtExtraServiceImpl.java
...n/service/impl/manage/GoblinStoreMgtExtraServiceImpl.java
+1
-1
GoblinStoreMgtGoodsServiceImpl.java
...n/service/impl/manage/GoblinStoreMgtGoodsServiceImpl.java
+30
-5
GoblinMongoUtils.java
...a/com/liquidnet/service/goblin/util/GoblinMongoUtils.java
+6
-0
errors.properties
...-service-goblin-impl/src/main/resources/errors.properties
+2
-2
No files found.
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/controller/manage/GoblinStoreMgtCategoryController.java
View file @
8ffa0dac
...
@@ -102,7 +102,7 @@ public class GoblinStoreMgtCategoryController {
...
@@ -102,7 +102,7 @@ public class GoblinStoreMgtCategoryController {
}
else
{
// 存在则判断,是否为已存在的父级分类
}
else
{
// 存在则判断,是否为已存在的父级分类
if
(
storeGoodsCategoryVosCache
.
stream
().
anyMatch
(
r
->
r
.
getName
().
equals
(
catename
)))
{
if
(
storeGoodsCategoryVosCache
.
stream
().
anyMatch
(
r
->
r
.
getName
().
equals
(
catename
)))
{
log
.
warn
(
"店铺商品分类管理:添加:分类名称重复[UID={},storeId={},catefid={},catesid={},catename={}]"
,
currentUid
,
storeId
,
catefid
,
catesid
,
catename
);
log
.
warn
(
"店铺商品分类管理:添加:分类名称重复[UID={},storeId={},catefid={},catesid={},catename={}]"
,
currentUid
,
storeId
,
catefid
,
catesid
,
catename
);
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"14900
7
"
));
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"14900
8
"
));
}
}
Map
<
String
,
GoblinStoreGoodsCategoryVo
>
existFilterMap
=
storeGoodsCategoryVosCache
.
stream
().
filter
(
r
->
catePidList
.
contains
(
r
.
getCateId
()))
Map
<
String
,
GoblinStoreGoodsCategoryVo
>
existFilterMap
=
storeGoodsCategoryVosCache
.
stream
().
filter
(
r
->
catePidList
.
contains
(
r
.
getCateId
()))
...
...
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/controller/manage/GoblinStoreMgtGoodsController.java
View file @
8ffa0dac
...
@@ -17,6 +17,7 @@ import com.liquidnet.service.goblin.dto.manage.GoblinStoreMgtGoodsFilterParam;
...
@@ -17,6 +17,7 @@ import com.liquidnet.service.goblin.dto.manage.GoblinStoreMgtGoodsFilterParam;
import
com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtGoodsInfoVo
;
import
com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtGoodsInfoVo
;
import
com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtGoodsListVo
;
import
com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtGoodsListVo
;
import
com.liquidnet.service.goblin.dto.vo.*
;
import
com.liquidnet.service.goblin.dto.vo.*
;
import
com.liquidnet.service.goblin.service.manage.IGoblinStoreMgtExtraService
;
import
com.liquidnet.service.goblin.service.manage.IGoblinstoreMgtGoodsService
;
import
com.liquidnet.service.goblin.service.manage.IGoblinstoreMgtGoodsService
;
import
com.liquidnet.service.goblin.util.GoblinMongoUtils
;
import
com.liquidnet.service.goblin.util.GoblinMongoUtils
;
import
com.liquidnet.service.goblin.util.GoblinRedisUtils
;
import
com.liquidnet.service.goblin.util.GoblinRedisUtils
;
...
@@ -50,6 +51,8 @@ public class GoblinStoreMgtGoodsController {
...
@@ -50,6 +51,8 @@ public class GoblinStoreMgtGoodsController {
@Autowired
@Autowired
IGoblinstoreMgtGoodsService
goblinstoreMgtGoodsService
;
IGoblinstoreMgtGoodsService
goblinstoreMgtGoodsService
;
@Autowired
@Autowired
IGoblinStoreMgtExtraService
goblinStoreMgtExtraService
;
@Autowired
GoblinRedisUtils
goblinRedisUtils
;
GoblinRedisUtils
goblinRedisUtils
;
@Autowired
@Autowired
GoblinMongoUtils
goblinMongoUtils
;
GoblinMongoUtils
goblinMongoUtils
;
...
@@ -125,7 +128,8 @@ public class GoblinStoreMgtGoodsController {
...
@@ -125,7 +128,8 @@ public class GoblinStoreMgtGoodsController {
@PutMapping
(
"add"
)
@PutMapping
(
"add"
)
public
ResponseDto
<
Object
>
add
(
@Valid
@RequestBody
GoblinStoreMgtGoodsAddParam
storeMgtGoodsAddParam
)
{
public
ResponseDto
<
Object
>
add
(
@Valid
@RequestBody
GoblinStoreMgtGoodsAddParam
storeMgtGoodsAddParam
)
{
String
currentUid
=
CurrentUtil
.
getCurrentUid
();
String
currentUid
=
CurrentUtil
.
getCurrentUid
();
if
(!
goblinRedisUtils
.
hasStoreId
(
currentUid
,
storeMgtGoodsAddParam
.
getStoreId
()))
{
String
storeId
=
storeMgtGoodsAddParam
.
getStoreId
();
if
(!
goblinRedisUtils
.
hasStoreId
(
currentUid
,
storeId
))
{
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"149002"
));
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"149002"
));
}
}
if
(
log
.
isDebugEnabled
())
{
if
(
log
.
isDebugEnabled
())
{
...
@@ -137,6 +141,22 @@ public class GoblinStoreMgtGoodsController {
...
@@ -137,6 +141,22 @@ 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
(),
"商品图片不能为空"
);
}
}
String
cateSid
=
storeMgtGoodsAddParam
.
getCateSid
(),
cateTid
=
storeMgtGoodsAddParam
.
getCateTid
();
List
<
GoblinSelfGoodsCategoryVo
>
selfGoodsCategoryVos
=
goblinStoreMgtExtraService
.
listCategoryVo
();
if
(
selfGoodsCategoryVos
.
stream
().
noneMatch
(
r
->
r
.
getCateId
().
equals
(
storeMgtGoodsAddParam
.
getCateFid
())
&&
r
.
getGrade
().
equals
(
"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"
)))
{
return
ResponseDto
.
failure
(
ErrorCode
.
HTTP_PARAM_ERROR
.
getCode
(),
"商品分类2无效"
);
}
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无效"
);
}
GoblinGoodsInfoVo
mgtGoodsInfoVo
=
goblinMongoUtils
.
getMgtGoodsInfoVo
(
storeId
,
storeMgtGoodsAddParam
.
getName
());
if
(
null
!=
mgtGoodsInfoVo
)
{
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"149007"
));
}
LocalDateTime
now
=
LocalDateTime
.
now
();
LocalDateTime
now
=
LocalDateTime
.
now
();
GoblinGoodsInfoVo
goodsInfoVo
=
storeMgtGoodsAddParam
.
initGoodsInfoVo
();
GoblinGoodsInfoVo
goodsInfoVo
=
storeMgtGoodsAddParam
.
initGoodsInfoVo
();
goodsInfoVo
.
setCreatedBy
(
currentUid
);
goodsInfoVo
.
setCreatedBy
(
currentUid
);
...
@@ -202,7 +222,8 @@ public class GoblinStoreMgtGoodsController {
...
@@ -202,7 +222,8 @@ public class GoblinStoreMgtGoodsController {
@PostMapping
(
"edit_spu"
)
@PostMapping
(
"edit_spu"
)
public
ResponseDto
<
Object
>
editSpu
(
@Valid
@RequestBody
GoblinStoreMgtGoodsAddParam
storeMgtGoodsAddParam
)
{
public
ResponseDto
<
Object
>
editSpu
(
@Valid
@RequestBody
GoblinStoreMgtGoodsAddParam
storeMgtGoodsAddParam
)
{
String
currentUid
=
CurrentUtil
.
getCurrentUid
();
String
currentUid
=
CurrentUtil
.
getCurrentUid
();
if
(!
goblinRedisUtils
.
hasStoreId
(
currentUid
,
storeMgtGoodsAddParam
.
getStoreId
()))
{
String
storeId
=
storeMgtGoodsAddParam
.
getStoreId
();
if
(!
goblinRedisUtils
.
hasStoreId
(
currentUid
,
storeId
))
{
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"149002"
));
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"149002"
));
}
}
if
(
StringUtils
.
isBlank
(
storeMgtGoodsAddParam
.
getSpuId
())
||
null
==
goblinRedisUtils
.
getMgtGoodsInfoVo
(
storeMgtGoodsAddParam
.
getSpuId
()))
{
if
(
StringUtils
.
isBlank
(
storeMgtGoodsAddParam
.
getSpuId
())
||
null
==
goblinRedisUtils
.
getMgtGoodsInfoVo
(
storeMgtGoodsAddParam
.
getSpuId
()))
{
...
@@ -211,7 +232,21 @@ public class GoblinStoreMgtGoodsController {
...
@@ -211,7 +232,21 @@ 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
(),
"商品图片不能为空"
);
}
}
// TODO: 2022/1/20 zhanggb==valid category
String
cateSid
=
storeMgtGoodsAddParam
.
getCateSid
(),
cateTid
=
storeMgtGoodsAddParam
.
getCateTid
();
List
<
GoblinSelfGoodsCategoryVo
>
selfGoodsCategoryVos
=
goblinStoreMgtExtraService
.
listCategoryVo
();
if
(
selfGoodsCategoryVos
.
stream
().
noneMatch
(
r
->
r
.
getCateId
().
equals
(
storeMgtGoodsAddParam
.
getCateFid
())
&&
r
.
getGrade
().
equals
(
"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"
)))
{
return
ResponseDto
.
failure
(
ErrorCode
.
HTTP_PARAM_ERROR
.
getCode
(),
"商品分类2无效"
);
}
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无效"
);
}
GoblinGoodsInfoVo
mgtGoodsInfoVo
=
goblinMongoUtils
.
getMgtGoodsInfoVo
(
storeId
,
storeMgtGoodsAddParam
.
getName
());
if
(
null
!=
mgtGoodsInfoVo
&&
!
mgtGoodsInfoVo
.
getSpuId
().
equals
(
storeMgtGoodsAddParam
.
getSpuId
()))
{
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"149007"
));
}
if
(
log
.
isDebugEnabled
())
{
if
(
log
.
isDebugEnabled
())
{
log
.
debug
(
"商品管理:商品编辑:SPU编辑:[GoblinStoreMgtGoodsAddParam={}]"
,
JsonUtils
.
toJson
(
storeMgtGoodsAddParam
));
log
.
debug
(
"商品管理:商品编辑:SPU编辑:[GoblinStoreMgtGoodsAddParam={}]"
,
JsonUtils
.
toJson
(
storeMgtGoodsAddParam
));
}
}
...
...
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/service/impl/manage/GoblinStoreMgtExtraImpl.java
→
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/service/impl/manage/GoblinStoreMgtExtra
Service
Impl.java
View file @
8ffa0dac
...
@@ -13,7 +13,7 @@ import org.springframework.util.CollectionUtils;
...
@@ -13,7 +13,7 @@ import org.springframework.util.CollectionUtils;
import
java.util.List
;
import
java.util.List
;
@Service
@Service
public
class
GoblinStoreMgtExtraImpl
implements
IGoblinStoreMgtExtraService
{
public
class
GoblinStoreMgtExtra
Service
Impl
implements
IGoblinStoreMgtExtraService
{
@Autowired
@Autowired
private
GoblinRedisUtils
goblinRedisUtils
;
private
GoblinRedisUtils
goblinRedisUtils
;
@Autowired
@Autowired
...
...
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/service/impl/manage/GoblinStoreMgtGoodsServiceImpl.java
View file @
8ffa0dac
...
@@ -12,10 +12,8 @@ import com.liquidnet.service.goblin.dto.manage.GoblinStoreMgtGoodsFilterParam;
...
@@ -12,10 +12,8 @@ import com.liquidnet.service.goblin.dto.manage.GoblinStoreMgtGoodsFilterParam;
import
com.liquidnet.service.goblin.dto.manage.vo.GoblinMgtCategorySpecVo
;
import
com.liquidnet.service.goblin.dto.manage.vo.GoblinMgtCategorySpecVo
;
import
com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtGoodsInfoVo
;
import
com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtGoodsInfoVo
;
import
com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtGoodsListVo
;
import
com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtGoodsListVo
;
import
com.liquidnet.service.goblin.dto.vo.GoblinGoodsInfoVo
;
import
com.liquidnet.service.goblin.dto.vo.*
;
import
com.liquidnet.service.goblin.dto.vo.GoblinGoodsSkuInfoVo
;
import
com.liquidnet.service.goblin.service.manage.IGoblinStoreMgtExtraService
;
import
com.liquidnet.service.goblin.dto.vo.GoblinGoodsSpecValueVo
;
import
com.liquidnet.service.goblin.dto.vo.GoblinGoodsSpecVo
;
import
com.liquidnet.service.goblin.service.manage.IGoblinstoreMgtGoodsService
;
import
com.liquidnet.service.goblin.service.manage.IGoblinstoreMgtGoodsService
;
import
com.liquidnet.service.goblin.util.GoblinMongoUtils
;
import
com.liquidnet.service.goblin.util.GoblinMongoUtils
;
import
com.liquidnet.service.goblin.util.GoblinRedisUtils
;
import
com.liquidnet.service.goblin.util.GoblinRedisUtils
;
...
@@ -39,10 +37,37 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi
...
@@ -39,10 +37,37 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi
GoblinRedisUtils
goblinRedisUtils
;
GoblinRedisUtils
goblinRedisUtils
;
@Autowired
@Autowired
GoblinMongoUtils
goblinMongoUtils
;
GoblinMongoUtils
goblinMongoUtils
;
@Autowired
IGoblinStoreMgtExtraService
goblinStoreMgtExtraService
;
@Override
@Override
public
PagedResult
<
GoblinStoreMgtGoodsListVo
>
goodsList
(
GoblinStoreMgtGoodsFilterParam
filterParam
)
{
public
PagedResult
<
GoblinStoreMgtGoodsListVo
>
goodsList
(
GoblinStoreMgtGoodsFilterParam
filterParam
)
{
return
goblinMongoUtils
.
getMgtGoodsInfoVos
(
filterParam
);
PagedResult
<
GoblinStoreMgtGoodsListVo
>
goodsListVoPagedResult
=
goblinMongoUtils
.
getMgtGoodsInfoVos
(
filterParam
);
if
(
goodsListVoPagedResult
.
getTotal
()
>
0
)
{
List
<
GoblinSelfGoodsCategoryVo
>
selfGoodsCategoryVos
=
goblinStoreMgtExtraService
.
listCategoryVo
();
List
<
GoblinStoreMgtGoodsListVo
>
list
=
goodsListVoPagedResult
.
getList
();
list
.
forEach
(
r
->
{
String
cateFid
=
r
.
getCateFid
(),
cateSid
=
r
.
getCateSid
(),
cateTid
=
r
.
getCateTid
();
List
<
GoblinSelfGoodsCategoryVo
>
categoryVoList
=
selfGoodsCategoryVos
.
stream
()
.
filter
(
cr
->
Arrays
.
asList
(
cateFid
,
cateSid
,
cateTid
).
contains
(
cr
.
getCateId
())).
collect
(
Collectors
.
toList
());
categoryVoList
.
forEach
(
cr
->
{
if
(
cr
.
getCateId
().
equals
(
cateFid
))
{
r
.
setCateFid
(
cr
.
getName
());
}
if
(
cr
.
getCateId
().
equals
(
cateSid
))
{
r
.
setCateFid
(
cr
.
getName
());
}
if
(
cr
.
getCateId
().
equals
(
cateSid
))
{
r
.
setCateFid
(
cr
.
getName
());
}
});
});
goodsListVoPagedResult
.
setList
(
list
);
}
return
goodsListVoPagedResult
;
}
}
@Override
@Override
...
...
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/util/GoblinMongoUtils.java
View file @
8ffa0dac
...
@@ -398,6 +398,12 @@ public class GoblinMongoUtils {
...
@@ -398,6 +398,12 @@ public class GoblinMongoUtils {
GoblinGoodsInfoVo
.
class
,
GoblinGoodsInfoVo
.
class
.
getSimpleName
());
GoblinGoodsInfoVo
.
class
,
GoblinGoodsInfoVo
.
class
.
getSimpleName
());
}
}
// SPU信息
public
GoblinGoodsInfoVo
getMgtGoodsInfoVo
(
String
storeId
,
String
name
)
{
return
mongoTemplate
.
findOne
(
Query
.
query
(
Criteria
.
where
(
"name"
).
is
(
name
).
and
(
"delFlg"
).
is
(
"0"
)),
GoblinGoodsInfoVo
.
class
,
GoblinGoodsInfoVo
.
class
.
getSimpleName
());
}
// SPU信息
// SPU信息
public
boolean
updateGoodsInfoVo
(
GoblinGoodsInfoVo
vo
)
{
public
boolean
updateGoodsInfoVo
(
GoblinGoodsInfoVo
vo
)
{
return
mongoTemplate
.
getCollection
(
GoblinGoodsInfoVo
.
class
.
getSimpleName
()).
updateOne
(
return
mongoTemplate
.
getCollection
(
GoblinGoodsInfoVo
.
class
.
getSimpleName
()).
updateOne
(
...
...
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/resources/errors.properties
View file @
8ffa0dac
...
@@ -21,8 +21,8 @@
...
@@ -21,8 +21,8 @@
149004
=
149004
=
149005
=
149005
=
149006
=
添加商品失败,规格信息无效
149006
=
添加商品失败,规格信息无效
149007
=
商品分类名称重复,请核实
149007
=
添加商品失败,商品名称重复
149008
=
149008
=
商品分类名称重复,请核实
149009
=
149009
=
149010
=
商品不存在,请核实
149010
=
商品不存在,请核实
149011
=
SKU不存在,请核实
149011
=
SKU不存在,请核实
...
...
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