记得上下班打卡 | 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
667d41a3
Commit
667d41a3
authored
Oct 25, 2021
by
胡佳晨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
商品列表
parent
6884701e
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
116 additions
and
39 deletions
+116
-39
StoneConstant.java
...a/com/liquidnet/service/stone/constant/StoneConstant.java
+3
-0
IStoneScoreOrderService.java
...uidnet/service/stone/service/IStoneScoreOrderService.java
+1
-1
liquidnet-service-stone.yml
...t-bus-config/liquidnet-config/liquidnet-service-stone.yml
+3
-25
StoneWebMvcConfig.java
...com/liquidnet/service/stone/config/StoneWebMvcConfig.java
+19
-0
StoneScoreItemsServiceImpl.java
...ervice/stone/service/impl/StoneScoreItemsServiceImpl.java
+3
-2
StoneScoreLogsServiceImpl.java
...service/stone/service/impl/StoneScoreLogsServiceImpl.java
+2
-2
StoneScoreOrderServiceImpl.java
...ervice/stone/service/impl/StoneScoreOrderServiceImpl.java
+51
-1
StoneMongoUtils.java
...ava/com/liquidnet/service/stone/util/StoneMongoUtils.java
+1
-1
StoneRedisUtils.java
...ava/com/liquidnet/service/stone/util/StoneRedisUtils.java
+33
-7
No files found.
liquidnet-bus-api/liquidnet-service-stone-api/src/main/java/com/liquidnet/service/stone/constant/StoneConstant.java
View file @
667d41a3
...
@@ -17,4 +17,7 @@ public class StoneConstant {
...
@@ -17,4 +17,7 @@ public class StoneConstant {
//已用积分
//已用积分
public
static
final
String
USE_SCORE
=
"useScore"
;
public
static
final
String
USE_SCORE
=
"useScore"
;
//限购
public
static
final
String
ITEM_LIMIT
=
ITEM
.
concat
(
"limit:"
);
}
}
liquidnet-bus-api/liquidnet-service-stone-api/src/main/java/com/liquidnet/service/stone/service/IStoneScoreOrderService.java
View file @
667d41a3
...
@@ -19,5 +19,5 @@ import java.util.List;
...
@@ -19,5 +19,5 @@ import java.util.List;
public
interface
IStoneScoreOrderService
{
public
interface
IStoneScoreOrderService
{
ResponseDto
<
String
>
order
(
String
itemId
,
Integer
number
);
ResponseDto
<
String
>
order
(
String
itemId
,
Integer
number
);
ResponseDto
<
PageInfo
<
List
<
StoneOrderListVo
>
>>
orderList
(
Integer
page
);
PageInfo
<
List
<
StoneOrderListVo
>>
orderList
(
Integer
page
);
}
}
liquidnet-bus-config/liquidnet-config/liquidnet-service-stone.yml
View file @
667d41a3
...
@@ -121,32 +121,10 @@ global-auth:
...
@@ -121,32 +121,10 @@ global-auth:
-
${liquidnet.info.context}/webjars/**
-
${liquidnet.info.context}/webjars/**
-
${liquidnet.info.context}/swagger-resources/**
-
${liquidnet.info.context}/swagger-resources/**
-
${liquidnet.info.context}/v2/api-docs*
-
${liquidnet.info.context}/v2/api-docs*
-
${liquidnet.info.context}/station/login
-
${liquidnet.info.context}/station/login/sms
# -
# -
-
${liquidnet.info.context}/partner/buyNotice/**
-
${liquidnet.info.context}/item/**
-
${liquidnet.info.context}/partner/checkUser/**
-
${liquidnet.info.context}/partner/checkUser/performance/**
-
${liquidnet.info.context}/partner/ticket/**
-
${liquidnet.info.context}/partner/times/**
-
${liquidnet.info.context}/partner/performance/**
# banner
-
${liquidnet.info.context}/banners/**
-
${liquidnet.info.context}/order/checkOrderTime
-
${liquidnet.info.context}/order/syncOrder
# 退款回掉
-
${liquidnet.info.context}/refund/callback
# 演出
-
${liquidnet.info.context}/performance/localList
-
${liquidnet.info.context}/performance/noticeList
-
${liquidnet.info.context}/performance/roadList/**
-
${liquidnet.info.context}/performance/recommendList
-
${liquidnet.info.context}/performance/exclusiveList
-
${liquidnet.info.context}/performance/search
-
${liquidnet.info.context}/performance/list
-
${liquidnet.info.context}/performance/calendar
-
${liquidnet.info.context}/performance/calendarPerformances
-
${liquidnet.info.context}/performance/*
# -----------------------------------------------------------
# -----------------------------------------------------------
...
...
liquidnet-bus-service/liquidnet-service-stone/liquidnet-service-stone-impl/src/main/java/com/liquidnet/service/stone/config/StoneWebMvcConfig.java
0 → 100644
View file @
667d41a3
package
com
.
liquidnet
.
service
.
stone
.
config
;
import
com.liquidnet.common.web.config.WebMvcConfig
;
import
com.liquidnet.common.web.filter.GlobalAuthorityInterceptor
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.web.servlet.config.annotation.InterceptorRegistry
;
@Configuration
public
class
StoneWebMvcConfig
extends
WebMvcConfig
{
@Autowired
GlobalAuthorityInterceptor
globalAuthorityInterceptor
;
@Override
protected
void
addInterceptors
(
InterceptorRegistry
registry
)
{
registry
.
addInterceptor
(
globalAuthorityInterceptor
).
addPathPatterns
(
"/**"
);
super
.
addInterceptors
(
registry
);
}
}
liquidnet-bus-service/liquidnet-service-stone/liquidnet-service-stone-impl/src/main/java/com/liquidnet/service/stone/service/impl/StoneScoreItemsServiceImpl.java
View file @
667d41a3
...
@@ -47,11 +47,12 @@ public class StoneScoreItemsServiceImpl implements IStoneScoreItemsService {
...
@@ -47,11 +47,12 @@ public class StoneScoreItemsServiceImpl implements IStoneScoreItemsService {
List
<
StoneScoreItems
>
voList
;
List
<
StoneScoreItems
>
voList
;
HashMap
<
String
,
Object
>
info
=
mongoUtils
.
itemListPage
(
page
,
size
);
HashMap
<
String
,
Object
>
info
=
mongoUtils
.
itemListPage
(
page
,
size
);
try
{
try
{
voList
=
(
List
<
StoneScoreItems
>)
info
.
get
(
"
total
"
);
voList
=
(
List
<
StoneScoreItems
>)
info
.
get
(
"
data
"
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
voList
=
new
ArrayList
();
voList
=
new
ArrayList
();
e
.
printStackTrace
();
}
}
long
count
=
(
long
)
info
.
get
(
"
data
"
);
long
count
=
(
long
)
info
.
get
(
"
total
"
);
List
<
StoneItemListVo
>
returnVoList
=
ObjectUtils
.
getStoneItemListVoArrayList
();
List
<
StoneItemListVo
>
returnVoList
=
ObjectUtils
.
getStoneItemListVoArrayList
();
...
...
liquidnet-bus-service/liquidnet-service-stone/liquidnet-service-stone-impl/src/main/java/com/liquidnet/service/stone/service/impl/StoneScoreLogsServiceImpl.java
View file @
667d41a3
...
@@ -156,8 +156,8 @@ public class StoneScoreLogsServiceImpl implements IStoneScoreLogsService {
...
@@ -156,8 +156,8 @@ public class StoneScoreLogsServiceImpl implements IStoneScoreLogsService {
}
else
{
}
else
{
HashMap
<
String
,
Object
>
info
=
stoneMongoUtils
.
itemListPage
(
page
,
size
);
HashMap
<
String
,
Object
>
info
=
stoneMongoUtils
.
itemListPage
(
page
,
size
);
try
{
try
{
voList
=
(
List
<
StoneScoreLogs
>)
info
.
get
(
"
total
"
);
voList
=
(
List
<
StoneScoreLogs
>)
info
.
get
(
"
data
"
);
count
=
(
long
)
info
.
get
(
"
data
"
);
count
=
(
long
)
info
.
get
(
"
total
"
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
voList
=
new
ArrayList
();
voList
=
new
ArrayList
();
count
=
0
;
count
=
0
;
...
...
liquidnet-bus-service/liquidnet-service-stone/liquidnet-service-stone-impl/src/main/java/com/liquidnet/service/stone/service/impl/StoneScoreOrderServiceImpl.java
View file @
667d41a3
package
com
.
liquidnet
.
service
.
stone
.
service
.
impl
;
package
com
.
liquidnet
.
service
.
stone
.
service
.
impl
;
import
com.github.pagehelper.PageInfo
;
import
com.github.pagehelper.PageInfo
;
import
com.liquidnet.commons.lang.util.CurrentUtil
;
import
com.liquidnet.service.base.ResponseDto
;
import
com.liquidnet.service.base.ResponseDto
;
import
com.liquidnet.service.base.UserPathDto
;
import
com.liquidnet.service.stone.entity.StoneScoreItems
;
import
com.liquidnet.service.stone.entity.StoneScoreItems
;
import
com.liquidnet.service.stone.entity.StoneScoreLogs
;
import
com.liquidnet.service.stone.service.IStoneScoreOrderService
;
import
com.liquidnet.service.stone.service.IStoneScoreOrderService
;
import
com.liquidnet.service.stone.util.ObjectUtils
;
import
com.liquidnet.service.stone.util.StoneRedisUtils
;
import
com.liquidnet.service.stone.util.StoneRedisUtils
;
import
com.liquidnet.service.stone.vo.StoneItemListVo
;
import
com.liquidnet.service.stone.vo.StoneItemListVo
;
import
com.liquidnet.service.stone.vo.StoneLogsListVo
;
import
com.liquidnet.service.stone.vo.StoneOrderListVo
;
import
com.liquidnet.service.stone.vo.StoneOrderListVo
;
import
com.liquidnet.service.stone.vo.StoneScoreItemVo
;
import
com.liquidnet.service.stone.vo.StoneScoreItemVo
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -22,6 +30,7 @@ import java.util.List;
...
@@ -22,6 +30,7 @@ import java.util.List;
* @since 2021-10-19
* @since 2021-10-19
*/
*/
@Service
@Service
@Slf4j
public
class
StoneScoreOrderServiceImpl
implements
IStoneScoreOrderService
{
public
class
StoneScoreOrderServiceImpl
implements
IStoneScoreOrderService
{
@Autowired
@Autowired
...
@@ -30,6 +39,7 @@ public class StoneScoreOrderServiceImpl implements IStoneScoreOrderService {
...
@@ -30,6 +39,7 @@ public class StoneScoreOrderServiceImpl implements IStoneScoreOrderService {
@Override
@Override
public
ResponseDto
<
String
>
order
(
String
itemId
,
Integer
number
)
{
public
ResponseDto
<
String
>
order
(
String
itemId
,
Integer
number
)
{
//判断状态 库存
//判断状态 库存
String
uid
=
CurrentUtil
.
getCurrentUid
();
StoneScoreItems
data
=
stoneRedisUtils
.
getItemData
(
itemId
);
StoneScoreItems
data
=
stoneRedisUtils
.
getItemData
(
itemId
);
if
(
data
==
null
){
if
(
data
==
null
){
return
ResponseDto
.
failure
(
"参数异常"
);
return
ResponseDto
.
failure
(
"参数异常"
);
...
@@ -43,13 +53,53 @@ public class StoneScoreOrderServiceImpl implements IStoneScoreOrderService {
...
@@ -43,13 +53,53 @@ public class StoneScoreOrderServiceImpl implements IStoneScoreOrderService {
}
}
//获取积分
//获取积分
int
needScore
=
data
.
getScore
().
intValue
();
if
(
stoneRedisUtils
.
getUserScoreRest
(
uid
)<
needScore
){
return
ResponseDto
.
failure
(
"剩余积分不足"
);
}
//获取限购
//获取限购
int
buyCount
=
stoneRedisUtils
.
getItemLimit
(
uid
,
itemId
);
if
((
buyCount
+
number
)>
data
.
getLimitCount
()
&&
data
.
getLimitCount
()>
0
){
return
ResponseDto
.
failure
(
"超出限购数量"
);
}
stoneRedisUtils
.
addItemLimit
(
uid
,
itemId
,
number
);
//下单
//下单
return
null
;
return
null
;
}
}
@Override
@Override
public
ResponseDto
<
PageInfo
<
List
<
StoneOrderListVo
>>>
orderList
(
Integer
page
)
{
public
PageInfo
<
List
<
StoneOrderListVo
>>
orderList
(
Integer
page
)
{
// String uid = CurrentUtil.getCurrentUid();
// PageInfo<List<StoneOrderListVo>> mPageInfo;
// int size = 40;
// if (page == null || page == 1 || page == 0) {
// page = 1;
// }
// List<StoneScoreLogs> voList;
// long count;
// if (page == 1) {
// voList = stoneRedisUtils.getLogsList(uid);
// count = voList.size();
// } else {
// HashMap<String, Object> info = stoneMongoUtils.itemListPage(page, size);
// try {
// voList = (List<StoneScoreLogs>) info.get("total");
// count = (long) info.get("data");
// } catch (Exception e) {
// voList = new ArrayList();
// count = 0;
// }
// }
// List<StoneLogsListVo> returnVoList = ObjectUtils.getStoneLogsListVoArrayList();
// for (int i = 0; i < voList.size(); i++) {
// StoneScoreLogs vo = voList.get(i);
// StoneLogsListVo returnVo = StoneLogsListVo.getNew().copy(vo);
// returnVoList.add(returnVo);
// }
// mPageInfo = new PageInfo(returnVoList);
// mPageInfo.setTotal(count);
// log.info(UserPathDto.setData("积分日志列表", "", voList));
// return mPageInfo;
return
null
;
return
null
;
}
}
}
}
liquidnet-bus-service/liquidnet-service-stone/liquidnet-service-stone-impl/src/main/java/com/liquidnet/service/stone/util/StoneMongoUtils.java
View file @
667d41a3
...
@@ -75,7 +75,7 @@ public class StoneMongoUtils {
...
@@ -75,7 +75,7 @@ public class StoneMongoUtils {
// 排序 分页
// 排序 分页
Pageable
pageable
=
PageRequest
.
of
(
page
-
1
,
size
,
Sort
.
by
(
Sort
.
Direction
.
DESC
,
"createdAt"
));
Pageable
pageable
=
PageRequest
.
of
(
page
-
1
,
size
,
Sort
.
by
(
Sort
.
Direction
.
DESC
,
"createdAt"
));
//条件
//条件
Query
query
=
Query
.
query
(
Criteria
.
where
(
"status"
).
is
(
1
).
orOperator
(
Criteria
.
where
(
"status"
).
is
(
2
).
and
(
"startTime"
).
lt
(
now
).
and
(
"endTime"
).
gt
(
now
)));
Query
query
=
Query
.
query
(
Criteria
.
where
(
"status"
).
is
(
1
)
);
//
.orOperator(Criteria.where("status").is(2).and("startTime").lt(now).and("endTime").gt(now)));
// 查询总数
// 查询总数
long
count
=
mongoTemplate
.
count
(
query
,
StoneScoreItems
.
class
,
StoneScoreItems
.
class
.
getSimpleName
());
long
count
=
mongoTemplate
.
count
(
query
,
StoneScoreItems
.
class
,
StoneScoreItems
.
class
.
getSimpleName
());
query
.
with
(
pageable
);
query
.
with
(
pageable
);
...
...
liquidnet-bus-service/liquidnet-service-stone/liquidnet-service-stone-impl/src/main/java/com/liquidnet/service/stone/util/StoneRedisUtils.java
View file @
667d41a3
...
@@ -55,7 +55,7 @@ public class StoneRedisUtils {
...
@@ -55,7 +55,7 @@ public class StoneRedisUtils {
/**
/**
* 获取 用户积分 可用
* 获取 用户积分 可用
*
*
* @param uid
ID
* @param uid ID
* @return
* @return
*/
*/
public
Integer
getUserScoreRest
(
String
uid
)
{
public
Integer
getUserScoreRest
(
String
uid
)
{
...
@@ -71,7 +71,7 @@ public class StoneRedisUtils {
...
@@ -71,7 +71,7 @@ public class StoneRedisUtils {
/**
/**
* 获取 用户积分 可用
* 获取 用户积分 可用
*
*
* @param uid
ID
* @param uid ID
* @return
* @return
*/
*/
public
Integer
getUserScoreUse
(
String
uid
)
{
public
Integer
getUserScoreUse
(
String
uid
)
{
...
@@ -87,7 +87,7 @@ public class StoneRedisUtils {
...
@@ -87,7 +87,7 @@ public class StoneRedisUtils {
/**
/**
* 修改 用户积分 使用
* 修改 用户积分 使用
*
*
* @param uid
ID
* @param uid ID
* @return
* @return
*/
*/
public
Integer
changeUserScoreUse
(
String
uid
,
Integer
general
)
{
public
Integer
changeUserScoreUse
(
String
uid
,
Integer
general
)
{
...
@@ -104,7 +104,7 @@ public class StoneRedisUtils {
...
@@ -104,7 +104,7 @@ public class StoneRedisUtils {
/**
/**
* 修改 用户积分 剩余
* 修改 用户积分 剩余
*
*
* @param uid
ID
* @param uid ID
* @return
* @return
*/
*/
public
Integer
changeUserScoreRest
(
String
uid
,
Integer
general
)
{
public
Integer
changeUserScoreRest
(
String
uid
,
Integer
general
)
{
...
@@ -174,12 +174,12 @@ public class StoneRedisUtils {
...
@@ -174,12 +174,12 @@ public class StoneRedisUtils {
*
*
* @param data
* @param data
*/
*/
public
void
addLogsList
(
String
uid
,
StoneScoreLogs
data
)
{
public
void
addLogsList
(
String
uid
,
StoneScoreLogs
data
)
{
String
redisKey
=
StoneConstant
.
LOGS_LIST
.
concat
(
uid
);
String
redisKey
=
StoneConstant
.
LOGS_LIST
.
concat
(
uid
);
Object
obj
=
redisUtil
.
get
(
redisKey
);
Object
obj
=
redisUtil
.
get
(
redisKey
);
List
<
StoneScoreLogs
>
dataList
;
List
<
StoneScoreLogs
>
dataList
;
if
(
obj
==
null
)
{
if
(
obj
==
null
)
{
dataList
=
(
List
<
StoneScoreLogs
>)
mongoUtils
.
logList
(
uid
,
1
,
40
).
get
(
"data"
);
dataList
=
(
List
<
StoneScoreLogs
>)
mongoUtils
.
logList
(
uid
,
1
,
40
).
get
(
"data"
);
}
else
{
}
else
{
dataList
=
(
List
<
StoneScoreLogs
>)
obj
;
dataList
=
(
List
<
StoneScoreLogs
>)
obj
;
}
}
...
@@ -200,7 +200,7 @@ public class StoneRedisUtils {
...
@@ -200,7 +200,7 @@ public class StoneRedisUtils {
String
redisKey
=
StoneConstant
.
LOGS_LIST
.
concat
(
uid
);
String
redisKey
=
StoneConstant
.
LOGS_LIST
.
concat
(
uid
);
Object
obj
=
redisUtil
.
get
(
redisKey
);
Object
obj
=
redisUtil
.
get
(
redisKey
);
if
(
obj
==
null
)
{
if
(
obj
==
null
)
{
return
(
List
<
StoneScoreLogs
>)
mongoUtils
.
logList
(
uid
,
1
,
40
).
get
(
"data"
);
return
(
List
<
StoneScoreLogs
>)
mongoUtils
.
logList
(
uid
,
1
,
40
).
get
(
"data"
);
}
else
{
}
else
{
return
(
List
<
StoneScoreLogs
>)
obj
;
return
(
List
<
StoneScoreLogs
>)
obj
;
}
}
...
@@ -232,4 +232,30 @@ public class StoneRedisUtils {
...
@@ -232,4 +232,30 @@ public class StoneRedisUtils {
}
}
}
}
/**
* 获取商品 购买数量
* @param uid
* @param itemId
* @return
*/
public
int
getItemLimit
(
String
uid
,
String
itemId
)
{
String
redisKey
=
StoneConstant
.
ITEM_LIMIT
.
concat
(
uid
).
concat
(
":"
+
itemId
);
Object
obj
=
redisUtil
.
get
(
redisKey
);
if
(
obj
==
null
)
{
return
0
;
}
else
{
return
(
int
)
obj
;
}
}
/**
* 添加商品 购买数量
* @param uid
* @param itemId
* @param number
*/
public
void
addItemLimit
(
String
uid
,
String
itemId
,
Integer
number
)
{
String
redisKey
=
StoneConstant
.
ITEM_LIMIT
.
concat
(
uid
).
concat
(
":"
+
itemId
);
redisUtil
.
incr
(
redisKey
,
number
);
}
}
}
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