记得上下班打卡 | 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
88f5dda7
Commit
88f5dda7
authored
Dec 14, 2021
by
liuran
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/dev_draw_change' into dev_draw_change
parents
3f576b6e
f71507a8
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
137 additions
and
27 deletions
+137
-27
StoneConstant.java
...a/com/liquidnet/service/stone/constant/StoneConstant.java
+11
-6
IStoneScoreItemsService.java
...uidnet/service/stone/service/IStoneScoreItemsService.java
+2
-0
ItemServiceImpl.java
...nt/admin/zhengzai/stone/service/impl/ItemServiceImpl.java
+3
-1
StoneRedisUtils.java
...t/admin/zhengzai/stone/service/utils/StoneRedisUtils.java
+12
-0
StoneItemController.java
...quidnet/service/stone/controller/StoneItemController.java
+7
-0
StoneScoreItemsServiceImpl.java
...ervice/stone/service/impl/StoneScoreItemsServiceImpl.java
+50
-8
StoneMongoUtils.java
...ava/com/liquidnet/service/stone/util/StoneMongoUtils.java
+14
-8
StoneRedisUtils.java
...ava/com/liquidnet/service/stone/util/StoneRedisUtils.java
+38
-4
No files found.
liquidnet-bus-api/liquidnet-service-stone-api/src/main/java/com/liquidnet/service/stone/constant/StoneConstant.java
View file @
88f5dda7
...
...
@@ -2,17 +2,22 @@ package com.liquidnet.service.stone.constant;
public
class
StoneConstant
{
//ctx
private
static
final
String
CTX
=
"stone:"
;
private
static
final
String
CTX
=
"stone:"
;
//user
public
static
final
String
USER
=
CTX
.
concat
(
"user:"
);
public
static
final
String
USER
=
CTX
.
concat
(
"user:"
);
//item
public
static
final
String
ITEM
=
CTX
.
concat
(
"item:"
);
public
static
final
String
ITEM
=
CTX
.
concat
(
"item:"
);
//logsList 积分日志列表
public
static
final
String
LOGS_LIST
=
ITEM
.
concat
(
"logs:list:"
);
public
static
final
String
LOGS_LIST
=
ITEM
.
concat
(
"logs:list:"
);
//orderList 积分订单列表
public
static
final
String
ORDER_LIST
=
ITEM
.
concat
(
"order:list:"
);
public
static
final
String
ORDER_LIST
=
ITEM
.
concat
(
"order:list:"
);
//orderList 积分订单列表
public
static
final
String
ORDER_DETAILS
=
ITEM
.
concat
(
"order:details:"
);
public
static
final
String
ORDER_DETAILS
=
ITEM
.
concat
(
"order:details:"
);
//商品列表
public
static
final
String
ITEM_LIST
=
ITEM
.
concat
(
"list"
);
//商品列表分类
public
static
final
String
ITEM_LIST_SIMPLE
=
ITEM
.
concat
(
"list:simpleType:"
);
//剩余库存
public
static
final
String
SURPLUS_GENERAL
=
":surplusGeneral"
;
...
...
liquidnet-bus-api/liquidnet-service-stone-api/src/main/java/com/liquidnet/service/stone/service/IStoneScoreItemsService.java
View file @
88f5dda7
...
...
@@ -21,6 +21,8 @@ public interface IStoneScoreItemsService {
PageInfo
<
List
<
StoneItemListVo
>>
itemList
(
Integer
page
,
Integer
size
);
PageInfo
<
List
<
StoneItemListVo
>>
itemListSimpleType
(
Integer
simpleType
,
Integer
page
,
Integer
size
);
ResponseDto
<
StoneScoreItemVo
>
itemDetails
(
String
itemId
);
}
liquidnet-bus-client/liquidnet-client-admin/liquidnet-client-admin-zhengzai/src/main/java/com/liquidnet/client/admin/zhengzai/stone/service/impl/ItemServiceImpl.java
View file @
88f5dda7
...
...
@@ -158,6 +158,7 @@ public class ItemServiceImpl implements IItemService {
if
(
count
<=
0
)
{
return
"创建失败"
;
}
redisUtils
.
delList
(
param
.
getSimpleType
().
toString
());
return
"创建成功"
;
}
...
...
@@ -191,6 +192,7 @@ public class ItemServiceImpl implements IItemService {
if
(
count
<=
0
)
{
return
"修改失败"
;
}
redisUtils
.
delList
(
param
.
getSimpleType
().
toString
());
return
"修改成功"
;
}
...
...
@@ -205,7 +207,7 @@ public class ItemServiceImpl implements IItemService {
data
.
setTargetId
(
param
.
getTargetId
());
data
.
setTargetTitle
(
param
.
getTargetTitle
());
data
.
setType
(
param
.
getType
());
data
.
setType
(
param
.
getSimpleType
());
data
.
set
Simple
Type
(
param
.
getSimpleType
());
data
.
setImg
(
param
.
getImg
());
data
.
setScore
(
param
.
getScore
());
data
.
setPrice
(
BigDecimal
.
ZERO
);
...
...
liquidnet-bus-client/liquidnet-client-admin/liquidnet-client-admin-zhengzai/src/main/java/com/liquidnet/client/admin/zhengzai/stone/service/utils/StoneRedisUtils.java
View file @
88f5dda7
...
...
@@ -102,4 +102,16 @@ public class StoneRedisUtils {
}
}
/**
* 删除 积分商品列表缓存
*
* @param simpleType
*/
public
void
delList
(
String
simpleType
)
{
String
redisKey
=
StoneConstant
.
ITEM_LIST
;
String
redisSimpleKey
=
StoneConstant
.
ITEM_LIST_SIMPLE
.
concat
(
simpleType
);
redisDataSourceUtil
.
getRedisStoneUtil
().
del
(
redisKey
);
redisDataSourceUtil
.
getRedisStoneUtil
().
del
(
redisSimpleKey
);
}
}
liquidnet-bus-service/liquidnet-service-stone/liquidnet-service-stone-impl/src/main/java/com/liquidnet/service/stone/controller/StoneItemController.java
View file @
88f5dda7
...
...
@@ -31,6 +31,13 @@ public class StoneItemController {
return
ResponseDto
.
success
(
stoneScoreItemsService
.
itemList
(
page
,
40
));
}
@GetMapping
(
"list/simpleType"
)
@ApiOperation
(
"积分商品列表(simpleType)"
)
@ApiResponse
(
code
=
200
,
message
=
"接口返回对象参数"
)
public
ResponseDto
<
PageInfo
<
List
<
StoneItemListVo
>>>
itemListSimpleType
(
@RequestParam
(
"page"
)
@Valid
Integer
page
,
@RequestParam
(
"simpleType"
)
@Valid
Integer
simpleType
)
{
return
ResponseDto
.
success
(
stoneScoreItemsService
.
itemListSimpleType
(
simpleType
,
page
,
40
));
}
@GetMapping
(
"details"
)
@ApiOperation
(
"积分商品详情"
)
@ApiResponse
(
code
=
200
,
message
=
"接口返回对象参数"
)
...
...
liquidnet-bus-service/liquidnet-service-stone/liquidnet-service-stone-impl/src/main/java/com/liquidnet/service/stone/service/impl/StoneScoreItemsServiceImpl.java
View file @
88f5dda7
...
...
@@ -46,15 +46,57 @@ public class StoneScoreItemsServiceImpl implements IStoneScoreItemsService {
page
=
1
;
}
List
<
StoneScoreItems
>
voList
;
HashMap
<
String
,
Object
>
info
=
mongoUtils
.
itemListPage
(
page
,
size
);
long
count
;
if
(
page
==
1
)
{
voList
=
redisUtils
.
getList
();
count
=
voList
.
size
();
}
else
{
HashMap
<
String
,
Object
>
info
=
mongoUtils
.
itemListPage
(
page
,
size
,
null
);
try
{
voList
=
(
List
<
StoneScoreItems
>)
info
.
get
(
"data"
);
}
catch
(
Exception
e
)
{
voList
=
new
ArrayList
();
e
.
printStackTrace
();
}
long
count
=
(
long
)
info
.
get
(
"total"
);
count
=
40
+
(
long
)
info
.
get
(
"total"
);
}
List
<
StoneItemListVo
>
returnVoList
=
ObjectUtils
.
getStoneItemListVoArrayList
();
for
(
int
i
=
0
;
i
<
voList
.
size
();
i
++)
{
StoneScoreItems
vo
=
voList
.
get
(
i
);
StoneItemListVo
returnVo
=
StoneItemListVo
.
getNew
().
copy
(
vo
);
returnVoList
.
add
(
returnVo
);
}
mPageInfo
=
new
PageInfo
(
returnVoList
);
mPageInfo
.
setTotal
(
count
);
log
.
info
(
UserPathDto
.
setData
(
"积分商品列表"
,
""
,
voList
));
return
mPageInfo
;
}
@Override
public
PageInfo
<
List
<
StoneItemListVo
>>
itemListSimpleType
(
Integer
simpleType
,
Integer
page
,
Integer
size
)
{
PageInfo
<
List
<
StoneItemListVo
>>
mPageInfo
;
size
=
40
;
if
(
page
==
null
||
page
==
1
||
page
==
0
)
{
page
=
1
;
}
List
<
StoneScoreItems
>
voList
;
long
count
;
if
(
page
==
1
)
{
voList
=
redisUtils
.
getListSimple
(
simpleType
.
toString
());
count
=
voList
.
size
();
}
else
{
HashMap
<
String
,
Object
>
info
=
mongoUtils
.
itemListPage
(
page
,
size
,
simpleType
.
toString
());
try
{
voList
=
(
List
<
StoneScoreItems
>)
info
.
get
(
"data"
);
}
catch
(
Exception
e
)
{
voList
=
new
ArrayList
();
e
.
printStackTrace
();
}
count
=
40
+
(
long
)
info
.
get
(
"total"
);
}
List
<
StoneItemListVo
>
returnVoList
=
ObjectUtils
.
getStoneItemListVoArrayList
();
for
(
int
i
=
0
;
i
<
voList
.
size
();
i
++)
{
...
...
@@ -99,7 +141,7 @@ public class StoneScoreItemsServiceImpl implements IStoneScoreItemsService {
}
else
{
limitStatus
=
1
;
}
StoneScoreItemVo
vo
=
StoneScoreItemVo
.
getNew
().
copy
(
data
,
scoreStatus
,
limitStatus
);
StoneScoreItemVo
vo
=
StoneScoreItemVo
.
getNew
().
copy
(
data
,
scoreStatus
,
limitStatus
);
return
ResponseDto
.
success
(
vo
);
}
}
liquidnet-bus-service/liquidnet-service-stone/liquidnet-service-stone-impl/src/main/java/com/liquidnet/service/stone/util/StoneMongoUtils.java
View file @
88f5dda7
...
...
@@ -46,13 +46,17 @@ public class StoneMongoUtils {
*
* @return
*/
public
HashMap
<
String
,
Object
>
itemListPage
(
int
page
,
int
size
)
{
public
HashMap
<
String
,
Object
>
itemListPage
(
int
page
,
int
size
,
String
simpleType
)
{
LocalDateTime
now
=
LocalDateTime
.
now
();
HashMap
<
String
,
Object
>
info
=
CollectionUtil
.
mapStringObject
();
// 排序 分页
Pageable
pageable
=
PageRequest
.
of
(
page
-
1
,
size
,
Sort
.
by
(
Sort
.
Direction
.
DESC
,
"createdAt"
));
//条件
Query
query
=
Query
.
query
(
new
Criteria
().
orOperator
(
Criteria
.
where
(
"status"
).
is
(
1
),
Criteria
.
where
(
"status"
).
is
(
2
).
and
(
"startTime"
).
lte
(
now
).
and
(
"endTime"
).
gte
(
now
)));
Criteria
criteria
=
new
Criteria
().
orOperator
(
Criteria
.
where
(
"status"
).
is
(
1
),
Criteria
.
where
(
"status"
).
is
(
2
).
and
(
"startTime"
).
lte
(
now
).
and
(
"endTime"
).
gte
(
now
));
if
(
simpleType
!=
null
)
{
criteria
.
and
(
"simpleType"
).
is
(
simpleType
);
}
Query
query
=
Query
.
query
(
criteria
);
// 查询总数
long
count
=
mongoTemplate
.
count
(
query
,
StoneScoreItems
.
class
,
StoneScoreItems
.
class
.
getSimpleName
());
query
.
with
(
pageable
);
...
...
@@ -80,7 +84,7 @@ public class StoneMongoUtils {
*/
public
StoneUserVo
userGet
(
String
uid
)
{
Query
query
=
Query
.
query
(
Criteria
.
where
(
"uid"
).
is
(
uid
));
StoneUserVo
vo
=
mongoTemplate
.
findOne
(
query
,
StoneUserVo
.
class
,
StoneUserVo
.
class
.
getSimpleName
());
StoneUserVo
vo
=
mongoTemplate
.
findOne
(
query
,
StoneUserVo
.
class
,
StoneUserVo
.
class
.
getSimpleName
());
return
vo
;
}
...
...
@@ -109,12 +113,13 @@ public class StoneMongoUtils {
/**
* 获取 用户积分日志 列表
*
* @param uid
* @param page
* @param size
* @return
*/
public
HashMap
<
String
,
Object
>
logList
(
String
uid
,
int
page
,
int
size
)
{
public
HashMap
<
String
,
Object
>
logList
(
String
uid
,
int
page
,
int
size
)
{
LocalDateTime
now
=
LocalDateTime
.
now
();
HashMap
<
String
,
Object
>
info
=
CollectionUtil
.
mapStringObject
();
// 排序 分页
...
...
@@ -143,12 +148,13 @@ public class StoneMongoUtils {
/**
* 获取 用户订单 列表
*
* @param uid
* @param page
* @param size
* @return
*/
public
HashMap
<
String
,
Object
>
orderList
(
String
uid
,
int
page
,
int
size
)
{
public
HashMap
<
String
,
Object
>
orderList
(
String
uid
,
int
page
,
int
size
)
{
LocalDateTime
now
=
LocalDateTime
.
now
();
HashMap
<
String
,
Object
>
info
=
CollectionUtil
.
mapStringObject
();
// 排序 分页
...
...
liquidnet-bus-service/liquidnet-service-stone/liquidnet-service-stone-impl/src/main/java/com/liquidnet/service/stone/util/StoneRedisUtils.java
View file @
88f5dda7
...
...
@@ -9,6 +9,7 @@ import com.liquidnet.service.stone.vo.StoneUserVo;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
java.util.ArrayList
;
import
java.util.List
;
@Component
...
...
@@ -19,6 +20,39 @@ public class StoneRedisUtils {
@Autowired
private
StoneMongoUtils
mongoUtils
;
public
List
<
StoneScoreItems
>
getList
()
{
try
{
String
redisKey
=
StoneConstant
.
ITEM_LIST
;
Object
obj
=
redisUtil
.
get
(
redisKey
);
if
(
obj
==
null
)
{
List
<
StoneScoreItems
>
list
=
(
List
<
StoneScoreItems
>)
mongoUtils
.
itemListPage
(
1
,
40
,
null
).
get
(
"data"
);
redisUtil
.
set
(
redisKey
,
list
);
return
list
;
}
else
{
return
(
List
<
StoneScoreItems
>)
obj
;
}
}
catch
(
Exception
e
){
return
new
ArrayList
();
}
}
public
List
<
StoneScoreItems
>
getListSimple
(
String
simpleType
)
{
try
{
String
redisKey
=
StoneConstant
.
ITEM_LIST_SIMPLE
.
concat
(
simpleType
);
Object
obj
=
redisUtil
.
get
(
redisKey
);
if
(
obj
==
null
)
{
List
<
StoneScoreItems
>
list
=
(
List
<
StoneScoreItems
>)
mongoUtils
.
itemListPage
(
1
,
40
,
simpleType
).
get
(
"data"
);
redisUtil
.
set
(
redisKey
,
list
);
return
list
;
}
else
{
return
(
List
<
StoneScoreItems
>)
obj
;
}
}
catch
(
Exception
e
){
return
new
ArrayList
();
}
}
/**
* 获取 积分物品 剩余库存
*
...
...
@@ -202,7 +236,7 @@ public class StoneRedisUtils {
Object
obj
=
redisUtil
.
get
(
redisKey
);
if
(
obj
==
null
)
{
List
<
StoneScoreLogs
>
getLogsList
=
(
List
<
StoneScoreLogs
>)
mongoUtils
.
logList
(
uid
,
1
,
40
).
get
(
"data"
);
redisUtil
.
set
(
redisKey
,
getLogsList
);
redisUtil
.
set
(
redisKey
,
getLogsList
);
return
getLogsList
;
}
else
{
return
(
List
<
StoneScoreLogs
>)
obj
;
...
...
@@ -314,12 +348,12 @@ public class StoneRedisUtils {
}
public
boolean
lockUid
(
String
uid
){
public
boolean
lockUid
(
String
uid
)
{
String
redisKey
=
StoneConstant
.
LOCK
.
concat
(
uid
);
return
redisUtil
.
lock
(
uid
,
1
,
1
);
return
redisUtil
.
lock
(
uid
,
1
,
1
);
}
public
void
unLockUid
(
String
uid
){
public
void
unLockUid
(
String
uid
)
{
String
redisKey
=
StoneConstant
.
LOCK
.
concat
(
uid
);
redisUtil
.
uLock
(
redisKey
);
}
...
...
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