记得上下班打卡 | 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
8806e550
Commit
8806e550
authored
Nov 09, 2022
by
张国柄
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
~api:店铺商品管理:批量导入数据;
parent
e449cbcf
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
20 deletions
+24
-20
GoblinStoreMgtGoodsImportController.java
...ontroller/manage/GoblinStoreMgtGoodsImportController.java
+5
-1
GoblinStoreMgtGoodsImportService.java
...service/impl/manage/GoblinStoreMgtGoodsImportService.java
+18
-18
GoblinRedisUtils.java
...a/com/liquidnet/service/goblin/util/GoblinRedisUtils.java
+1
-1
No files found.
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/controller/manage/GoblinStoreMgtGoodsImportController.java
View file @
8806e550
...
...
@@ -4,6 +4,7 @@ import com.liquidnet.common.exception.LiquidnetServiceException;
import
com.liquidnet.commons.lang.util.CurrentUtil
;
import
com.liquidnet.service.base.ErrorMapping
;
import
com.liquidnet.service.base.ResponseDto
;
import
com.liquidnet.service.goblin.constant.GoblinRedisConst
;
import
com.liquidnet.service.goblin.service.impl.manage.GoblinStoreMgtGoodsImportService
;
import
com.liquidnet.service.goblin.util.GoblinRedisUtils
;
import
io.swagger.annotations.Api
;
...
...
@@ -32,7 +33,7 @@ public class GoblinStoreMgtGoodsImportController {
private
GoblinStoreMgtGoodsImportService
goblinStoreMgtGoodsImportService
;
@PostMapping
(
"/upload"
)
@ApiOperation
(
value
=
"批量导入数据"
,
notes
=
""
)
@ApiOperation
(
value
=
"批量导入数据"
,
notes
=
"
同一个店铺多次导入数据时间间隔最短30秒
"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
type
=
"form"
,
required
=
true
,
dataType
=
"File"
,
name
=
"file"
,
value
=
"文件"
),
@ApiImplicitParam
(
type
=
"form"
,
required
=
true
,
dataType
=
"Integer"
,
name
=
"dataType"
,
value
=
"导入数据类型[1-商品数据]"
,
example
=
"1"
),
...
...
@@ -44,6 +45,9 @@ public class GoblinStoreMgtGoodsImportController {
if
(!
goblinRedisUtils
.
hasStoreId
(
currentUid
,
storeId
))
{
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"149002"
));
}
if
(!
goblinRedisUtils
.
redisUtil
.
lock
(
GoblinRedisConst
.
BASIC_GOODS_SKU
.
concat
(
"lk"
).
concat
(
storeId
),
1
,
30
))
{
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"140000"
));
}
try
{
switch
(
dataType
)
{
case
1
:
...
...
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/service/impl/manage/GoblinStoreMgtGoodsImportService.java
View file @
8806e550
...
...
@@ -208,24 +208,24 @@ public class GoblinStoreMgtGoodsImportService {
throw
new
LiquidnetServiceException
(
"-1"
,
String
.
format
(
"规格条码与已添加商品条码重复,重复条码如下: %s"
,
StringUtils
.
join
(
existGoodsSkuNoList
,
","
)));
}
goblinMongoUtils
.
insertMgtGoodsInfoVos
(
goodsInfoVos
);
goblinMongoUtils
.
insertMgtGoodsSkuInfoVos
(
goodsSkuInfoVos
);
goodsSkuInfoVos
.
forEach
(
r
->
goblinRedisUtils
.
setSkuStock
(
null
,
r
.
getSkuId
(),
r
.
getSkuStock
()));
LinkedList
<
String
>
toMqSqls
=
CollectionUtil
.
linkedListString
();
toMqSqls
.
add
(
SqlMapping
.
get
(
"goblin_goods.insert"
));
LinkedList
<
Object
[]>
initGoodsObjs
=
CollectionUtil
.
linkedListObjectArr
();
goodsInfoVos
.
forEach
(
r
->
initGoodsObjs
.
add
(
new
Object
[]{
r
.
getSpuId
(),
r
.
getSpuNo
(),
r
.
getName
(),
r
.
getSubtitle
(),
r
.
getSellPrice
(),
r
.
getPriceGe
(),
r
.
getPriceLe
(),
r
.
getIntro
(),
r
.
getDetails
(),
r
.
getCoverPic
(),
r
.
getVideo
(),
r
.
getSpecMode
(),
r
.
getStoreId
(),
r
.
getCateFid
(),
r
.
getCateSid
(),
r
.
getCateTid
(),
r
.
getStoreCateFid
(),
r
.
getStoreCateSid
(),
r
.
getStoreCateTid
(),
r
.
getBrandId
(),
r
.
getShelvesHandle
(),
r
.
getShelvesTime
(),
r
.
getSpuValidity
(),
r
.
getVirtualFlg
(),
r
.
getStatus
(),
r
.
getShelvesStatus
(),
r
.
getSpuAppear
(),
r
.
getShelvesAt
(),
r
.
getCreatedBy
(),
r
.
getCreatedAt
(),
r
.
getLogisticsTemplate
()
}));
toMqSqls
.
add
(
SqlMapping
.
get
(
"goblin_goods_sku.insert"
));
queueUtils
.
sendMsgByRedis
(
MQConst
.
GoblinQueue
.
SQL_GOODS
.
getKey
(),
SqlMapping
.
gets
(
toMqSqls
,
initGoodsObjs
,
initGoodsSkuObjs
));
//
goblinMongoUtils.insertMgtGoodsInfoVos(goodsInfoVos);
//
goblinMongoUtils.insertMgtGoodsSkuInfoVos(goodsSkuInfoVos);
//
goodsSkuInfoVos.forEach(r -> goblinRedisUtils.setSkuStock(null, r.getSkuId(), r.getSkuStock()));
//
//
LinkedList<String> toMqSqls = CollectionUtil.linkedListString();
//
toMqSqls.add(SqlMapping.get("goblin_goods.insert"));
//
LinkedList<Object[]> initGoodsObjs = CollectionUtil.linkedListObjectArr();
//
goodsInfoVos.forEach(r -> initGoodsObjs.add(new Object[]{
//
r.getSpuId(), r.getSpuNo(), r.getName(), r.getSubtitle(), r.getSellPrice(),
//
r.getPriceGe(), r.getPriceLe(), r.getIntro(), r.getDetails(), r.getCoverPic(),
//
r.getVideo(), r.getSpecMode(), r.getStoreId(), r.getCateFid(), r.getCateSid(),
//
r.getCateTid(), r.getStoreCateFid(), r.getStoreCateSid(), r.getStoreCateTid(), r.getBrandId(),
//
r.getShelvesHandle(), r.getShelvesTime(), r.getSpuValidity(), r.getVirtualFlg(), r.getStatus(),
//
r.getShelvesStatus(), r.getSpuAppear(), r.getShelvesAt(), r.getCreatedBy(), r.getCreatedAt(),
//
r.getLogisticsTemplate()
//
}));
//
toMqSqls.add(SqlMapping.get("goblin_goods_sku.insert"));
//
queueUtils.sendMsgByRedis(MQConst.GoblinQueue.SQL_GOODS.getKey(), SqlMapping.gets(toMqSqls, initGoodsObjs, initGoodsSkuObjs));
}
}
).
sheet
(
0
).
doReadSync
();
...
...
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/util/GoblinRedisUtils.java
View file @
8806e550
...
...
@@ -43,7 +43,7 @@ import static com.liquidnet.service.goblin.constant.GoblinRedisConst.REDIS_GOBLI
@Component
public
class
GoblinRedisUtils
{
@Autowired
RedisUtil
redisUtil
;
public
RedisUtil
redisUtil
;
@Autowired
GoblinMongoUtils
goblinMongoUtils
;
@Autowired
...
...
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