记得上下班打卡 | 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
453959e3
Commit
453959e3
authored
Jan 31, 2024
by
zhangguobing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
~api:券商品业务-关联人实名限购处理;
parent
b3a47a0a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
50 additions
and
2 deletions
+50
-2
GoblinRedisConst.java
...m/liquidnet/service/goblin/constant/GoblinRedisConst.java
+2
-0
AbstractOrderCloseReceiver.java
...e/consumer/order/receiver/AbstractOrderCloseReceiver.java
+13
-0
GoblinOrderServiceImpl.java
...et/service/order/service/impl/GoblinOrderServiceImpl.java
+29
-1
GoblinRedisUtils.java
...a/com/liquidnet/service/order/utils/GoblinRedisUtils.java
+6
-1
No files found.
liquidnet-bus-api/liquidnet-service-goblin-api/src/main/java/com/liquidnet/service/goblin/constant/GoblinRedisConst.java
View file @
453959e3
...
@@ -118,6 +118,8 @@ public class GoblinRedisConst {
...
@@ -118,6 +118,8 @@ public class GoblinRedisConst {
public
static
final
String
REDIS_GOBLIN_STORE_MARKET_ISCONFIG
=
PREFIX
.
concat
(
"store:is_config:"
);
//商铺活动-该活动配置了款式的商品
public
static
final
String
REDIS_GOBLIN_STORE_MARKET_ISCONFIG
=
PREFIX
.
concat
(
"store:is_config:"
);
//商铺活动-该活动配置了款式的商品
public
static
final
String
REDIS_GOBLIN_BUY_COUNT
=
PREFIX
.
concat
(
"uid:"
);
//用户sku购买数量 key:uid:skuId:$skuId
public
static
final
String
REDIS_GOBLIN_BUY_COUNT
=
PREFIX
.
concat
(
"uid:"
);
//用户sku购买数量 key:uid:skuId:$skuId
public
static
final
String
REDIS_GOBLIN_BUY_COUNT_IDNO
=
PREFIX
.
concat
(
"idno:%s:%s:%s"
);
// 实名sku购买数量 key:$idType:$idNo:$skuId
public
static
final
String
REDIS_GOBLIN_SALE_COUNT
=
PREFIX
.
concat
(
"sale:skuId:"
);
//用户sku购买数量 key:sale:skuId:$skuId
public
static
final
String
REDIS_GOBLIN_SALE_COUNT
=
PREFIX
.
concat
(
"sale:skuId:"
);
//用户sku购买数量 key:sale:skuId:$skuId
public
static
final
String
REDIS_GOBLIN_SALE_SPU_COUNT
=
PREFIX
.
concat
(
"sale:spuId:"
);
//用户sku购买数量 key:sale:skuId:$spuId
public
static
final
String
REDIS_GOBLIN_SALE_SPU_COUNT
=
PREFIX
.
concat
(
"sale:spuId:"
);
//用户sku购买数量 key:sale:skuId:$spuId
public
static
final
String
REDIS_GOBLIN_ORDER
=
PREFIX
.
concat
(
"order:"
);
//用户sku购买数量 key:$orderId
public
static
final
String
REDIS_GOBLIN_ORDER
=
PREFIX
.
concat
(
"order:"
);
//用户sku购买数量 key:$orderId
...
...
liquidnet-bus-service/liquidnet-service-consumer-all/liquidnet-service-consumer-order/src/main/java/com/liquidnet/service/consumer/order/receiver/AbstractOrderCloseReceiver.java
View file @
453959e3
...
@@ -141,6 +141,14 @@ public abstract class AbstractOrderCloseReceiver implements StreamListener<Strin
...
@@ -141,6 +141,14 @@ public abstract class AbstractOrderCloseReceiver implements StreamListener<Strin
String
pre
=
GoblinStatusConst
.
MarketPreStatus
.
getPre
(
skuVo
.
getSkuId
());
String
pre
=
GoblinStatusConst
.
MarketPreStatus
.
getPre
(
skuVo
.
getSkuId
());
incrSkuStock
(
pre
,
skuVo
.
getSkuId
(),
skuVo
.
getNum
());
incrSkuStock
(
pre
,
skuVo
.
getSkuId
(),
skuVo
.
getNum
());
decrSkuCountByUid
(
orderVo
.
getUserId
(),
skuVo
.
getSkuId
(),
skuVo
.
getNum
());
decrSkuCountByUid
(
orderVo
.
getUserId
(),
skuVo
.
getSkuId
(),
skuVo
.
getNum
());
if
(
Objects
.
equals
(
skuVo
.
getSkuType
(),
2
))
{
// 券类商品
if
(
Objects
.
equals
(
skuVo
.
getIsTrueName
(),
1
))
{
// 需关联实名人
// 这里默认券类商品需要关联实名人且都要求关联实名人限购
decrSkuCountByIdNo
(
skuVo
.
getIdType
(),
skuVo
.
getIdNo
(),
skuVo
.
getSkuId
(),
skuVo
.
getNum
());
}
}
//mysql
//mysql
sqlDataSku
.
add
(
new
Object
[]{
sqlDataSku
.
add
(
new
Object
[]{
skuVo
.
getStatus
(),
now
,
skuVo
.
getOrderSkuId
(),
now
,
now
skuVo
.
getStatus
(),
now
,
skuVo
.
getOrderSkuId
(),
now
,
now
...
@@ -475,6 +483,11 @@ public abstract class AbstractOrderCloseReceiver implements StreamListener<Strin
...
@@ -475,6 +483,11 @@ public abstract class AbstractOrderCloseReceiver implements StreamListener<Strin
return
(
int
)
redisDataSourceUtil
.
getRedisKylinUtil
().
decr
(
redisKey
,
number
);
return
(
int
)
redisDataSourceUtil
.
getRedisKylinUtil
().
decr
(
redisKey
,
number
);
}
}
// 减少 关联实名人sku购买个数
public
long
decrSkuCountByIdNo
(
int
idType
,
String
idNo
,
String
skuId
,
int
number
)
{
return
redisDataSourceUtil
.
getRedisKylinUtil
().
decr
(
String
.
format
(
GoblinRedisConst
.
REDIS_GOBLIN_BUY_COUNT_IDNO
,
idType
,
idNo
,
skuId
),
number
);
}
// 赋值 订单相关vo
// 赋值 订单相关vo
public
void
setGoblinOrder
(
String
orderId
,
GoblinStoreOrderVo
vo
)
{
public
void
setGoblinOrder
(
String
orderId
,
GoblinStoreOrderVo
vo
)
{
String
redisKey
=
GoblinRedisConst
.
REDIS_GOBLIN_ORDER
.
concat
(
orderId
);
String
redisKey
=
GoblinRedisConst
.
REDIS_GOBLIN_ORDER
.
concat
(
orderId
);
...
...
liquidnet-bus-service/liquidnet-service-order/liquidnet-service-order-impl/src/main/java/com/liquidnet/service/order/service/impl/GoblinOrderServiceImpl.java
View file @
453959e3
...
@@ -19,6 +19,7 @@ import com.liquidnet.service.dragon.dto.DragonPayBaseReqDto;
...
@@ -19,6 +19,7 @@ import com.liquidnet.service.dragon.dto.DragonPayBaseReqDto;
import
com.liquidnet.service.dragon.dto.DragonPayBaseRespDto
;
import
com.liquidnet.service.dragon.dto.DragonPayBaseRespDto
;
import
com.liquidnet.service.dragon.dto.DragonPayOrderQueryRespDto
;
import
com.liquidnet.service.dragon.dto.DragonPayOrderQueryRespDto
;
import
com.liquidnet.service.dragon.service.IDragonOrdersService
;
import
com.liquidnet.service.dragon.service.IDragonOrdersService
;
import
com.liquidnet.service.goblin.constant.GoblinRedisConst
;
import
com.liquidnet.service.goblin.constant.GoblinStatusConst
;
import
com.liquidnet.service.goblin.constant.GoblinStatusConst
;
import
com.liquidnet.service.goblin.dto.manage.AddressVo
;
import
com.liquidnet.service.goblin.dto.manage.AddressVo
;
import
com.liquidnet.service.goblin.dto.manage.GoblinOrderParam
;
import
com.liquidnet.service.goblin.dto.manage.GoblinOrderParam
;
...
@@ -37,6 +38,7 @@ import org.apache.commons.lang.StringUtils;
...
@@ -37,6 +38,7 @@ import org.apache.commons.lang.StringUtils;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.LinkedMultiValueMap
;
import
org.springframework.util.LinkedMultiValueMap
;
import
org.springframework.util.MultiValueMap
;
import
org.springframework.util.MultiValueMap
;
...
@@ -92,6 +94,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
...
@@ -92,6 +94,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
preParam
.
setStoreName
(
""
);
preParam
.
setStoreName
(
""
);
preParam
.
setSkuName
(
""
);
preParam
.
setSkuName
(
""
);
preParam
.
setOrderIdList
(
""
);
preParam
.
setOrderIdList
(
""
);
HashMap
<
String
,
Integer
>
couponSkuIdNoBuyLimitMap
=
CollectionUtil
.
mapStringInteger
();
// 记录券类商品关联人限购KEY:NUM
try
{
try
{
List
<
GoblinOrderStoreParam
>
goblinOrderStoreParamList
=
param
.
getGoblinOrderStoreParamList
();
//分订单
List
<
GoblinOrderStoreParam
>
goblinOrderStoreParamList
=
param
.
getGoblinOrderStoreParamList
();
//分订单
boolean
isMember
;
boolean
isMember
;
...
@@ -124,6 +127,20 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
...
@@ -124,6 +127,20 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
int
limitCount
=
skuVo
.
getBuyLimit
()
==
0
?
Integer
.
MAX_VALUE
:
skuVo
.
getBuyLimit
();
int
limitCount
=
skuVo
.
getBuyLimit
()
==
0
?
Integer
.
MAX_VALUE
:
skuVo
.
getBuyLimit
();
//判断限购
//判断限购
if
(
orderUtils
.
noZhengzaiOrder
(
uid
))
{
if
(
orderUtils
.
noZhengzaiOrder
(
uid
))
{
if
(
Objects
.
equals
(
skuVo
.
getSkuType
(),
2
))
{
// 券类商品
if
(
skuParam
.
getNumber
()
>
1
)
{
// 券类商品单次下单限购1
throw
new
LiquidnetServiceException
(
"-1"
,
String
.
format
(
"代金券商品单次下单限购%d张"
,
1
));
}
if
(
Objects
.
equals
(
skuVo
.
getIsTrueName
(),
1
))
{
// 需关联实名人
int
idNoLimitCount
=
1
;
// 这里默认券类商品需要关联实名人且都要求关联实名人限购,限购数量为1
String
couponSkuIdNoBuyLimitKey
=
String
.
format
(
GoblinRedisConst
.
REDIS_GOBLIN_BUY_COUNT_IDNO
,
skuParam
.
getIdType
(),
skuParam
.
getIdNo
(),
skuId
,
skuParam
.
getNumber
());
couponSkuIdNoBuyLimitMap
.
put
(
couponSkuIdNoBuyLimitKey
,
skuParam
.
getNumber
());
if
(
redisUtils
.
redisUtil
.
incr
(
couponSkuIdNoBuyLimitKey
,
skuParam
.
getNumber
())
>
idNoLimitCount
)
{
throw
new
LiquidnetServiceException
(
"-1"
,
String
.
format
(
"超出限购数量,一份证件限购%d张"
,
idNoLimitCount
));
}
}
}
String
res1
=
orderUtils
.
judgeOrderLimit
(
uid
,
skuParam
.
getSkuId
(),
skuParam
.
getNumber
(),
limitCount
);
String
res1
=
orderUtils
.
judgeOrderLimit
(
uid
,
skuParam
.
getSkuId
(),
skuParam
.
getNumber
(),
limitCount
);
if
(!
res1
.
equals
(
""
))
{
if
(!
res1
.
equals
(
""
))
{
throw
new
Exception
(
"已超出限购数量"
);
throw
new
Exception
(
"已超出限购数量"
);
...
@@ -194,6 +211,11 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
...
@@ -194,6 +211,11 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
if
(
params
.
size
()
>
0
)
{
if
(
params
.
size
()
>
0
)
{
orderUtils
.
backStoreCoupon
(
params
);
orderUtils
.
backStoreCoupon
(
params
);
}
}
if
(!
CollectionUtils
.
isEmpty
(
couponSkuIdNoBuyLimitMap
))
{
couponSkuIdNoBuyLimitMap
.
forEach
((
couponSkuIdNoBuyLimitKey
,
number
)
->
{
redisUtils
.
redisUtil
.
decr
(
couponSkuIdNoBuyLimitKey
,
number
);
});
}
if
(
e
instanceof
LiquidnetServiceException
)
{
if
(
e
instanceof
LiquidnetServiceException
)
{
LiquidnetServiceException
lsEx
=
(
LiquidnetServiceException
)
e
;
LiquidnetServiceException
lsEx
=
(
LiquidnetServiceException
)
e
;
return
ResponseDto
.
failure
(
lsEx
.
getCode
(),
lsEx
.
getMessage
());
return
ResponseDto
.
failure
(
lsEx
.
getCode
(),
lsEx
.
getMessage
());
...
@@ -258,7 +280,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
...
@@ -258,7 +280,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
throw
new
Exception
(
"不可购买"
);
throw
new
Exception
(
"不可购买"
);
}
}
if
(
Objects
.
equals
(
skuVo
.
getSkuType
(),
2
))
{
// 券类商品
if
(
Objects
.
equals
(
skuVo
.
getSkuType
(),
2
))
{
// 券类商品
if
(
Objects
.
equals
(
skuVo
.
getIsTrueName
(),
1
))
{
// 需
要实名关联
if
(
Objects
.
equals
(
skuVo
.
getIsTrueName
(),
1
))
{
// 需
关联实名人
if
(
Objects
.
isNull
(
skuParam
.
getIdType
())
||
Objects
.
isNull
(
skuParam
.
getIdName
())
||
Objects
.
isNull
(
skuParam
.
getIdNo
()))
{
if
(
Objects
.
isNull
(
skuParam
.
getIdType
())
||
Objects
.
isNull
(
skuParam
.
getIdName
())
||
Objects
.
isNull
(
skuParam
.
getIdNo
()))
{
throw
new
LiquidnetServiceException
(
"-1"
,
"关联人信息缺失,请核实"
);
throw
new
LiquidnetServiceException
(
"-1"
,
"关联人信息缺失,请核实"
);
}
}
...
@@ -1195,6 +1217,12 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
...
@@ -1195,6 +1217,12 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
if
(!
"超时支付自动退款"
.
equals
(
backOrderVo
.
getDescribes
()))
{
if
(!
"超时支付自动退款"
.
equals
(
backOrderVo
.
getDescribes
()))
{
redisUtils
.
incrSkuStock
(
pre
,
skuId
,
orderSkuVo
.
getNum
());
redisUtils
.
incrSkuStock
(
pre
,
skuId
,
orderSkuVo
.
getNum
());
redisUtils
.
decrSkuCountByUid
(
orderVo
.
getUserId
(),
skuId
,
orderSkuVo
.
getNum
());
redisUtils
.
decrSkuCountByUid
(
orderVo
.
getUserId
(),
skuId
,
orderSkuVo
.
getNum
());
if
(
Objects
.
equals
(
orderSkuVo
.
getSkuType
(),
2
))
{
// 券类商品
if
(
Objects
.
equals
(
orderSkuVo
.
getIsTrueName
(),
1
))
{
// 需关联实名人
redisUtils
.
decrSkuCountByIdNo
(
orderSkuVo
.
getIdType
(),
orderSkuVo
.
getIdNo
(),
orderSkuVo
.
getSkuId
(),
orderSkuVo
.
getNum
());
}
}
}
}
}
}
...
...
liquidnet-bus-service/liquidnet-service-order/liquidnet-service-order-impl/src/main/java/com/liquidnet/service/order/utils/GoblinRedisUtils.java
View file @
453959e3
...
@@ -25,7 +25,7 @@ import java.util.stream.Collectors;
...
@@ -25,7 +25,7 @@ import java.util.stream.Collectors;
@Component
@Component
public
class
GoblinRedisUtils
{
public
class
GoblinRedisUtils
{
@Autowired
@Autowired
RedisUtil
redisUtil
;
public
RedisUtil
redisUtil
;
@Autowired
@Autowired
GoblinMongoUtils
goblinMongoUtils
;
GoblinMongoUtils
goblinMongoUtils
;
...
@@ -361,6 +361,11 @@ public class GoblinRedisUtils {
...
@@ -361,6 +361,11 @@ public class GoblinRedisUtils {
return
(
int
)
redisUtil
.
decr
(
redisKey
,
number
);
return
(
int
)
redisUtil
.
decr
(
redisKey
,
number
);
}
}
// 减少 关联实名人sku购买个数
public
long
decrSkuCountByIdNo
(
int
idType
,
String
idNo
,
String
skuId
,
int
number
)
{
return
redisUtil
.
decr
(
String
.
format
(
GoblinRedisConst
.
REDIS_GOBLIN_BUY_COUNT_IDNO
,
idType
,
idNo
,
skuId
),
number
);
}
// 增加 sku销量
// 增加 sku销量
public
int
incrSkuSaleCount
(
String
spuId
,
String
skuId
,
int
number
)
{
public
int
incrSkuSaleCount
(
String
spuId
,
String
skuId
,
int
number
)
{
String
redisKey
=
GoblinRedisConst
.
REDIS_GOBLIN_SALE_COUNT
.
concat
(
skuId
);
String
redisKey
=
GoblinRedisConst
.
REDIS_GOBLIN_SALE_COUNT
.
concat
(
skuId
);
...
...
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