记得上下班打卡 | 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
7d7e257a
Commit
7d7e257a
authored
Feb 16, 2022
by
胡佳晨
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/dev_goblin' into dev_goblin
parents
cdee87ec
3b100546
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
49 additions
and
36 deletions
+49
-36
GoblinStoreMgtGoodsController.java
...blin/controller/manage/GoblinStoreMgtGoodsController.java
+29
-31
GoblinStoreMgtGoodsListVoExcel.java
...et/service/goblin/dto/GoblinStoreMgtGoodsListVoExcel.java
+3
-1
GoblinFrontServiceImpl.java
...t/service/goblin/service/impl/GoblinFrontServiceImpl.java
+1
-4
GoblinMongoUtils.java
...a/com/liquidnet/service/goblin/util/GoblinMongoUtils.java
+6
-0
GoblinRedisUtils.java
...a/com/liquidnet/service/goblin/util/GoblinRedisUtils.java
+10
-0
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 @
7d7e257a
...
...
@@ -6,7 +6,6 @@ import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import
com.liquidnet.common.exception.constant.ErrorCode
;
import
com.liquidnet.commons.lang.util.CollectionUtil
;
import
com.liquidnet.commons.lang.util.CurrentUtil
;
import
com.liquidnet.commons.lang.util.DateUtil
;
import
com.liquidnet.commons.lang.util.JsonUtils
;
import
com.liquidnet.service.base.ErrorMapping
;
import
com.liquidnet.service.base.PagedResult
;
...
...
@@ -78,42 +77,41 @@ public class GoblinStoreMgtGoodsController {
}
@ApiOperationSupport
(
order
=
2
)
@ApiOperation
(
value
=
"SPU导出"
)
@ApiOperation
(
value
=
"SPU导出"
,
notes
=
"#以POST模拟FORM表单请求该接口"
)
@PostMapping
(
"export"
)
public
void
export
(
@Valid
@RequestBody
GoblinStoreMgtGoodsFilterParam
storeMgtGoodsFilterParam
,
HttpServletResponse
response
)
{
public
void
export
(
@Valid
GoblinStoreMgtGoodsFilterParam
storeMgtGoodsFilterParam
,
HttpServletResponse
response
)
{
String
currentUid
=
CurrentUtil
.
getCurrentUid
();
List
<
String
>
storeIds
=
goblinRedisUtils
.
getStoreIds
(
currentUid
);
String
storeId
=
storeMgtGoodsFilterParam
.
getStoreId
();
boolean
storeIdIsBlank
=
StringUtils
.
isBlank
(
storeId
);
if
(
CollectionUtils
.
isEmpty
(
storeIds
)
||
(
!
storeIdIsBlank
&&
!
goblinRedisUtils
.
hasStoreId
(
currentUid
,
storeId
)
))
{
return
;
}
if
(
log
.
isDebugEnabled
())
{
log
.
debug
(
"商品管理:SPU导出:[UID={},GoblinStoreMgtGoodsFilterParam={}]"
,
currentUid
,
JsonUtils
.
toJson
(
storeMgtGoodsFilterParam
));
}
if
(
storeIdIsBlank
)
{
storeMgtGoodsFilterParam
.
setStoreId
(
storeIds
.
get
(
0
));
}
try
{
List
<
String
>
storeIds
=
goblinRedisUtils
.
getStoreIds
(
currentUid
);
String
storeId
=
storeMgtGoodsFilterParam
.
getStoreId
();
boolean
storeIdIsBlank
=
StringUtils
.
isBlank
(
storeId
);
if
(
CollectionUtils
.
isEmpty
(
storeIds
)
||
(
!
storeIdIsBlank
&&
!
goblinRedisUtils
.
hasStoreId
(
currentUid
,
storeId
)
))
{
return
;
}
if
(
log
.
isDebugEnabled
())
{
log
.
debug
(
"商品管理:SPU导出:[UID={},GoblinStoreMgtGoodsFilterParam={}]"
,
currentUid
,
JsonUtils
.
toJson
(
storeMgtGoodsFilterParam
));
}
if
(
storeIdIsBlank
)
{
storeMgtGoodsFilterParam
.
setStoreId
(
storeIds
.
get
(
0
));
}
storeMgtGoodsFilterParam
.
setPageNum
(
1
);
storeMgtGoodsFilterParam
.
setPageSize
(
2000
);
PagedResult
<
GoblinStoreMgtGoodsListVo
>
pagedResult
=
goblinstoreMgtGoodsService
.
goodsList
(
storeMgtGoodsFilterParam
);
List
<
GoblinStoreMgtGoodsListVo
>
rows
=
pagedResult
.
getList
();
Array
List
<
GoblinStoreMgtGoodsListVoExcel
>
rowsToExcels
=
ObjectUtil
.
getGoblinStoreMgtGoodsListVoExcelArrayList
();
rows
.
forEach
(
row
->
rowsToExcels
.
add
(
GoblinStoreMgtGoodsListVoExcel
.
getNew
().
copy
(
row
)));
storeMgtGoodsFilterParam
.
setPageNum
(
1
);
storeMgtGoodsFilterParam
.
setPageSize
(
2000
);
PagedResult
<
GoblinStoreMgtGoodsListVo
>
pagedResult
=
goblinstoreMgtGoodsService
.
goodsList
(
storeMgtGoodsFilterParam
);
List
<
GoblinStoreMgtGoodsListVo
>
rows
=
pagedResult
.
getList
();
List
<
GoblinStoreMgtGoodsListVoExcel
>
rowsToExcels
=
ObjectUtil
.
getGoblinStoreMgtGoodsListVoExcelArrayList
();
rows
.
forEach
(
row
->
rowsToExcels
.
add
(
GoblinStoreMgtGoodsListVoExcel
.
getNew
().
copy
(
row
)));
response
.
setContentType
(
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
);
response
.
setCharacterEncoding
(
"utf-8"
);
String
fileName
=
"商品数据"
+
DateUtil
.
Formatter
.
yyyyMMddHHmmssTrim
.
format
(
LocalDateTime
.
now
()
);
response
.
setHeader
(
"Content-disposition"
,
"attachment;filename*=utf-8''"
+
fileName
+
".xlsx"
);
response
.
setContentType
(
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
);
response
.
setCharacterEncoding
(
"utf-8"
);
String
fileName
=
URLEncoder
.
encode
(
"商品数据"
,
"UTF-8"
).
replaceAll
(
"\\+"
,
"%20"
);
response
.
setHeader
(
"Content-disposition"
,
"attachment;filename*=utf-8''"
+
fileName
+
".xlsx"
);
try
{
EasyExcel
.
write
(
response
.
getOutputStream
()).
sheet
(
"SPU"
).
doWrite
(
rows
);
EasyExcel
.
write
(
response
.
getOutputStream
(),
GoblinStoreMgtGoodsListVoExcel
.
class
).
sheet
(
"SPU"
).
doWrite
(
rowsToExcels
);
}
catch
(
IOException
e
)
{
log
.
error
(
"商品管理:SPU导出:异常[UID={},
storeId={},ex.msg={}]"
,
currentUid
,
storeI
d
,
e
.
getLocalizedMessage
());
log
.
error
(
"商品管理:SPU导出:异常[UID={},
ex.msg={}]"
,
currentUi
d
,
e
.
getLocalizedMessage
());
}
}
...
...
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/dto/GoblinStoreMgtGoodsListVoExcel.java
View file @
7d7e257a
...
...
@@ -61,7 +61,9 @@ public class GoblinStoreMgtGoodsListVoExcel implements Serializable, Cloneable {
this
.
setSpuNo
(
source
.
getSpuNo
());
this
.
setCoverPic
(
source
.
getCoverPic
());
this
.
setName
(
source
.
getName
());
this
.
setCateMerge
(
source
.
getCateFid
()
+
"/"
+
source
.
getCateSid
()
+
"/"
+
source
.
getCateTid
());
this
.
setCateMerge
(
StringUtils
.
defaultString
(
source
.
getCateFid
(),
""
)
+
"/"
+
StringUtils
.
defaultString
(
source
.
getCateSid
(),
""
)
+
"/"
+
StringUtils
.
defaultString
(
source
.
getCateTid
(),
""
));
this
.
setPriceRange
(
"¥"
+
source
.
getPriceGe
().
toString
()
+
" - ¥"
+
source
.
getPriceLe
().
toString
());
switch
(
source
.
getShelvesStatus
())
{
case
"0"
:
...
...
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/service/impl/GoblinFrontServiceImpl.java
View file @
7d7e257a
...
...
@@ -109,12 +109,9 @@ public class GoblinFrontServiceImpl implements GoblinFrontService {
@Override
public
GoblinFrontHotWord
getHotWord
()
{
if
(!
redisUtil
.
hasKey
(
GoblinRedisConst
.
FRONT_HOTWORD
)){
return
null
;
}
List
<
GoblinFrontHotWord
>
list
=
goblinRedisUtils
.
getHotWord
();
// int index= (int) redisUtil.get(GoblinRedisConst.FRONT_HOTWORD_INDEX);
//获得value
List
<
GoblinFrontHotWord
>
list
=
(
List
<
GoblinFrontHotWord
>)
redisUtil
.
get
(
GoblinRedisConst
.
FRONT_HOTWORD
);
/* index++;
String hotWord="";
redisUtil.set(GoblinRedisConst.FRONT_HOTWORD_INDEX,index);
...
...
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/util/GoblinMongoUtils.java
View file @
7d7e257a
...
...
@@ -10,6 +10,7 @@ import com.liquidnet.service.goblin.dto.manage.vo.GoblinMgtCategorySpecVo;
import
com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtGoodsListVo
;
import
com.liquidnet.service.goblin.dto.vo.*
;
import
com.liquidnet.service.goblin.entity.GoblinFrontBanner
;
import
com.liquidnet.service.goblin.entity.GoblinFrontHotWord
;
import
com.mongodb.BasicDBObject
;
import
com.mongodb.client.model.UpdateOneModel
;
import
com.mongodb.client.model.WriteModel
;
...
...
@@ -896,4 +897,9 @@ public class GoblinMongoUtils {
GoblinFrontBanner
.
class
,
GoblinFrontBanner
.
class
.
getSimpleName
());
}
public
List
<
GoblinFrontHotWord
>
getHotWord
()
{
Query
query
=
Query
.
query
(
Criteria
.
where
(
"delTag"
).
is
(
0
));
return
mongoTemplate
.
find
(
query
,
GoblinFrontHotWord
.
class
,
GoblinFrontHotWord
.
class
.
getSimpleName
());
}
}
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/util/GoblinRedisUtils.java
View file @
7d7e257a
...
...
@@ -9,6 +9,7 @@ import com.liquidnet.service.goblin.constant.GoblinRedisConst;
import
com.liquidnet.service.goblin.dto.manage.vo.GoblinMgtCategorySpecVo
;
import
com.liquidnet.service.goblin.dto.vo.*
;
import
com.liquidnet.service.goblin.entity.GoblinFrontBanner
;
import
com.liquidnet.service.goblin.entity.GoblinFrontHotWord
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.CollectionUtils
;
...
...
@@ -884,6 +885,15 @@ public class GoblinRedisUtils {
}
return
vo
;
}
// 热词降级
public
List
<
GoblinFrontHotWord
>
getHotWord
()
{
List
<
GoblinFrontHotWord
>
vo
=
(
List
<
GoblinFrontHotWord
>)
redisUtil
.
get
(
GoblinRedisConst
.
FRONT_HOTWORD
);
if
(
null
==
vo
)
{
//降级
return
goblinMongoUtils
.
getHotWord
();
}
return
vo
;
}
}
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