记得上下班打卡 | 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
e2db9c6e
Commit
e2db9c6e
authored
Mar 04, 2022
by
张国柄
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
~API:商品编辑:SKU删除:规格数据更新调整;
parent
fabdc948
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
14 deletions
+49
-14
CollectionUtil.java
.../java/com/liquidnet/commons/lang/util/CollectionUtil.java
+5
-0
GoblinStoreMgtGoodsServiceImpl.java
...n/service/impl/manage/GoblinStoreMgtGoodsServiceImpl.java
+40
-14
GoblinMongoUtils.java
...a/com/liquidnet/service/goblin/util/GoblinMongoUtils.java
+4
-0
No files found.
liquidnet-bus-common/liquidnet-common-base/src/main/java/com/liquidnet/commons/lang/util/CollectionUtil.java
View file @
e2db9c6e
...
@@ -14,6 +14,7 @@ public class CollectionUtil {
...
@@ -14,6 +14,7 @@ public class CollectionUtil {
private
static
final
LinkedList
<
Object
[]>
OBJECTS_LINKED_LIST
=
new
LinkedList
<>();
private
static
final
LinkedList
<
Object
[]>
OBJECTS_LINKED_LIST
=
new
LinkedList
<>();
private
static
final
LinkedMultiValueMap
<
String
,
String
>
STRING_STRING_LINKED_MULTI_VALUE_MAP
=
new
LinkedMultiValueMap
<>();
private
static
final
LinkedMultiValueMap
<
String
,
String
>
STRING_STRING_LINKED_MULTI_VALUE_MAP
=
new
LinkedMultiValueMap
<>();
private
static
final
ArrayList
<
String
>
STRING_ARRAY_LIST
=
new
ArrayList
<>();
private
static
final
ArrayList
<
String
>
STRING_ARRAY_LIST
=
new
ArrayList
<>();
private
static
final
HashSet
<
String
>
STRING_ARRAY_SET
=
new
HashSet
<>();
private
static
final
ArrayList
<
Integer
>
INTEGER_ARRAY_LIST
=
new
ArrayList
<>();
private
static
final
ArrayList
<
Integer
>
INTEGER_ARRAY_LIST
=
new
ArrayList
<>();
private
static
final
ArrayList
<
Object
>
OBJECT_ARRAY_LIST
=
new
ArrayList
<>();
private
static
final
ArrayList
<
Object
>
OBJECT_ARRAY_LIST
=
new
ArrayList
<>();
private
static
final
ArrayList
<
BigDecimal
>
BIG_DECIMALS_ARRAY_LIST
=
new
ArrayList
<>();
private
static
final
ArrayList
<
BigDecimal
>
BIG_DECIMALS_ARRAY_LIST
=
new
ArrayList
<>();
...
@@ -52,6 +53,10 @@ public class CollectionUtil {
...
@@ -52,6 +53,10 @@ public class CollectionUtil {
return
(
ArrayList
<
String
>)
STRING_ARRAY_LIST
.
clone
();
return
(
ArrayList
<
String
>)
STRING_ARRAY_LIST
.
clone
();
}
}
public
static
HashSet
<
String
>
getStringArraySet
()
{
return
(
HashSet
<
String
>)
STRING_ARRAY_SET
.
clone
();
}
public
static
ArrayList
<
Integer
>
arrayListInteger
()
{
public
static
ArrayList
<
Integer
>
arrayListInteger
()
{
return
(
ArrayList
<
Integer
>)
INTEGER_ARRAY_LIST
.
clone
();
return
(
ArrayList
<
Integer
>)
INTEGER_ARRAY_LIST
.
clone
();
}
}
...
...
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/service/impl/manage/GoblinStoreMgtGoodsServiceImpl.java
View file @
e2db9c6e
...
@@ -757,7 +757,24 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi
...
@@ -757,7 +757,24 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi
String
spuId
=
goodsSkuInfoVo
.
getSpuId
();
String
spuId
=
goodsSkuInfoVo
.
getSpuId
();
String
delSkuId
=
goodsSkuInfoVo
.
getSkuId
();
String
delSkuId
=
goodsSkuInfoVo
.
getSkuId
();
mgtGoodsInfoVo
.
getSkuIdList
().
removeIf
(
r
->
r
.
equals
(
delSkuId
));
List
<
String
>
skuIdList
=
mgtGoodsInfoVo
.
getSkuIdList
();
skuIdList
.
removeIf
(
r
->
r
.
equals
(
delSkuId
));
List
<
GoblinGoodsSkuInfoVo
>
goodsSkuInfoVos
=
goblinMongoUtils
.
getGoodsSkuInfoVos
(
skuIdList
);
List
<
List
<
GoblinGoodsSpecDto
>>
remainSkuSpecDtoList
=
goodsSkuInfoVos
.
stream
()
.
filter
(
r
->
r
.
getDelFlg
().
equals
(
"0"
)).
map
(
GoblinGoodsSkuInfoVo:
:
getSkuSpecList
).
collect
(
Collectors
.
toList
());
Map
<
String
,
Set
<
String
>>
remainSkuSpecMap
=
new
HashMap
<>();
for
(
List
<
GoblinGoodsSpecDto
>
goblinGoodsSpecDtos
:
remainSkuSpecDtoList
)
{
for
(
GoblinGoodsSpecDto
goblinGoodsSpecDto
:
goblinGoodsSpecDtos
)
{
String
specName
=
goblinGoodsSpecDto
.
getSpecName
(),
specVname
=
goblinGoodsSpecDto
.
getSpecVname
();
Set
<
String
>
specVnameSet
=
remainSkuSpecMap
.
get
(
specName
);
if
(
CollectionUtils
.
isEmpty
(
specVnameSet
))
{
specVnameSet
=
CollectionUtil
.
getStringArraySet
();
}
specVnameSet
.
add
(
specVname
);
remainSkuSpecMap
.
put
(
specName
,
specVnameSet
);
}
}
List
<
GoblinGoodsSpecVo
>
specVoList
=
mgtGoodsInfoVo
.
getSpecVoList
();
List
<
GoblinGoodsSpecVo
>
specVoList
=
mgtGoodsInfoVo
.
getSpecVoList
();
Map
<
String
,
String
>
delGoodsSkuSpecMap
=
goodsSkuInfoVo
.
getSkuSpecList
().
stream
()
Map
<
String
,
String
>
delGoodsSkuSpecMap
=
goodsSkuInfoVo
.
getSkuSpecList
().
stream
()
...
@@ -767,21 +784,32 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi
...
@@ -767,21 +784,32 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi
GoblinGoodsSpecVo
specVo
=
specVoList
.
get
(
i
);
// 商品指定规格
GoblinGoodsSpecVo
specVo
=
specVoList
.
get
(
i
);
// 商品指定规格
List
<
GoblinGoodsSpecValueVo
>
modifySpecValues
=
ObjectUtil
.
getGoblinGoodsSpecValueVoArrayList
();
List
<
GoblinGoodsSpecValueVo
>
modifySpecValues
=
ObjectUtil
.
getGoblinGoodsSpecValueVoArrayList
();
String
delSpecVname
=
delGoodsSkuSpecMap
.
get
(
specVo
.
getSpecName
());
// 需要删除的SKU下指定规格的规格值
String
specName
=
specVo
.
getSpecName
();
// 商品指定规格的名
Set
<
String
>
specVnameSet
=
remainSkuSpecMap
.
get
(
specName
);
// 剩余SKU指定规格的值集合
String
delSpecVname
=
delGoodsSkuSpecMap
.
get
(
specName
);
// 需要删除的SKU下指定规格的规格值
List
<
GoblinGoodsSpecValueVo
>
specValues
=
specVo
.
getSpecValues
();
// 商品指定规格下所有规格值
List
<
GoblinGoodsSpecValueVo
>
specValues
=
specVo
.
getSpecValues
();
// 商品指定规格下所有规格值
Integer
rmIdx
=
null
;
Integer
rmIdx
=
null
;
specValues
.
sort
(
Comparator
.
comparing
(
GoblinGoodsSpecValueVo:
:
getSpecVsort
));
for
(
GoblinGoodsSpecValueVo
specValue
:
specValues
)
{
// 遍历指定规格下每个规格值
for
(
GoblinGoodsSpecValueVo
specValue
:
specValues
)
{
// 遍历指定规格下每个规格值
if
(
specValue
.
getSpecVname
().
equals
(
delSpecVname
))
{
String
specVname
=
specValue
.
getSpecVname
();
// modifySpecValues.remove(specValue);
int
specVsort
=
specValue
.
getSpecVsort
();
rmIdx
=
specValue
.
getSpecVsort
();
updateGoodsSpuSpecObjs
.
add
(
new
Object
[]{
0
,
"1"
,
spuId
,
specVo
.
getSpecName
(),
delSpecVname
});
if
(
specVname
.
equals
(
delSpecVname
))
{
}
else
{
if
(
CollectionUtils
.
isEmpty
(
specVnameSet
))
break
;
modifySpecValues
.
add
(
specValue
);
if
(
specVnameSet
.
contains
(
delSpecVname
))
{
// 剩余SKU指定规格的值集合,包含当前删除的规格值,则不做处理
modifySpecValues
.
addAll
(
specValues
);
break
;
}
else
{
// 剩余SKU指定规格的值集合,不包含当前删除的规格值,则可以删除且记录排序以处理其他规格值排序
rmIdx
=
specVsort
;
updateGoodsSpuSpecObjs
.
add
(
new
Object
[]{
0
,
"1"
,
spuId
,
specName
,
delSpecVname
});
continue
;
}
}
}
if
(
null
!=
rmIdx
&&
specV
alue
.
getSpecVsort
()
>
rmIdx
)
{
if
(
null
!=
rmIdx
&&
specV
sort
>
rmIdx
)
{
specValue
.
setSpecVsort
(
specV
alue
.
getSpecVsort
()
-
1
);
specValue
.
setSpecVsort
(
specV
sort
-
1
);
updateGoodsSpuSpecObjs
.
add
(
new
Object
[]{
specV
alue
.
getSpecVsort
(),
"0"
,
spuId
,
specVo
.
getSpecName
(),
specValue
.
getSpecVname
()
});
updateGoodsSpuSpecObjs
.
add
(
new
Object
[]{
specV
sort
,
"0"
,
spuId
,
specName
,
specVname
});
}
}
modifySpecValues
.
add
(
specValue
);
}
}
specVo
.
setSpecValues
(
modifySpecValues
);
specVo
.
setSpecValues
(
modifySpecValues
);
}
}
...
@@ -795,15 +823,13 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi
...
@@ -795,15 +823,13 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi
delSkuIdList
=
null
==
delSkuIdList
?
CollectionUtil
.
arrayListString
()
:
delSkuIdList
;
delSkuIdList
=
null
==
delSkuIdList
?
CollectionUtil
.
arrayListString
()
:
delSkuIdList
;
delSkuIdList
.
add
(
delSkuId
);
delSkuIdList
.
add
(
delSkuId
);
if
(
goblinMongoUtils
.
delGoodsSkuInfoVo
(
goodsSkuInfoVo
,
delSkuIdList
))
{
if
(
goblinMongoUtils
.
delGoodsSkuInfoVo
(
goodsSkuInfoVo
,
delSkuIdList
))
{
// goblinRedisUtils.delGoodsSkuInfoVo(delSkuId);
// goblinRedisUtils.delGoodsSkuInfoVoByUnShelves(delSkuId);
delSkuIdList
.
forEach
(
skuId
->
{
delSkuIdList
.
forEach
(
skuId
->
{
goblinRedisUtils
.
delGoodsSkuInfoVo
(
skuId
);
goblinRedisUtils
.
delGoodsSkuInfoVo
(
skuId
);
goblinRedisUtils
.
delGoodsSkuInfoVoByUnShelves
(
skuId
);
goblinRedisUtils
.
delGoodsSkuInfoVoByUnShelves
(
skuId
);
});
});
BigDecimal
priceGe
=
BigDecimal
.
ZERO
,
priceLe
=
BigDecimal
.
ZERO
;
BigDecimal
priceGe
=
BigDecimal
.
ZERO
,
priceLe
=
BigDecimal
.
ZERO
;
for
(
String
skuId
:
mgtGoodsInfoVo
.
getSkuIdList
()
)
{
for
(
String
skuId
:
skuIdList
)
{
GoblinGoodsSkuInfoVo
skuInfoVo
=
goblinRedisUtils
.
getGoodsSkuInfoVo
(
skuId
);
GoblinGoodsSkuInfoVo
skuInfoVo
=
goblinRedisUtils
.
getGoodsSkuInfoVo
(
skuId
);
if
(
null
!=
skuInfoVo
&&
skuInfoVo
.
getDelFlg
().
equals
(
"0"
))
{
if
(
null
!=
skuInfoVo
&&
skuInfoVo
.
getDelFlg
().
equals
(
"0"
))
{
priceGe
=
priceGe
.
compareTo
(
BigDecimal
.
ZERO
)
==
0
?
skuInfoVo
.
getPrice
()
:
(
priceGe
.
compareTo
(
skuInfoVo
.
getPrice
())
>
0
?
skuInfoVo
.
getPrice
()
:
priceGe
);
priceGe
=
priceGe
.
compareTo
(
BigDecimal
.
ZERO
)
==
0
?
skuInfoVo
.
getPrice
()
:
(
priceGe
.
compareTo
(
skuInfoVo
.
getPrice
())
>
0
?
skuInfoVo
.
getPrice
()
:
priceGe
);
...
...
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/util/GoblinMongoUtils.java
View file @
e2db9c6e
...
@@ -555,6 +555,10 @@ public class GoblinMongoUtils {
...
@@ -555,6 +555,10 @@ public class GoblinMongoUtils {
return
mongoTemplate
.
findOne
(
Query
.
query
(
Criteria
.
where
(
"skuId"
).
is
(
skuId
)),
return
mongoTemplate
.
findOne
(
Query
.
query
(
Criteria
.
where
(
"skuId"
).
is
(
skuId
)),
GoblinGoodsSkuInfoVo
.
class
,
GoblinGoodsSkuInfoVo
.
class
.
getSimpleName
());
GoblinGoodsSkuInfoVo
.
class
,
GoblinGoodsSkuInfoVo
.
class
.
getSimpleName
());
}
}
public
List
<
GoblinGoodsSkuInfoVo
>
getGoodsSkuInfoVos
(
List
<
String
>
skuIds
)
{
return
mongoTemplate
.
find
(
Query
.
query
(
Criteria
.
where
(
"skuId"
).
in
(
skuIds
)),
GoblinGoodsSkuInfoVo
.
class
,
GoblinGoodsSkuInfoVo
.
class
.
getSimpleName
());
}
// SKU信息
// SKU信息
public
List
<
String
>
getMgtGoodsSkuIds
(
String
storeId
,
List
<
String
>
spuIdList
)
{
public
List
<
String
>
getMgtGoodsSkuIds
(
String
storeId
,
List
<
String
>
spuIdList
)
{
...
...
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