Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gxpt_ht
Overview
Overview
Details
Activity
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
pseer
gxpt_ht
Commits
c8b8b80e
Commit
c8b8b80e
authored
Apr 08, 2024
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加根据优惠券券码获取适用门店
parent
80feb08e
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
118 additions
and
5 deletions
+118
-5
QPController.java
...c/main/java/share/web/controller/system/QPController.java
+13
-0
QPService.java
...-system/src/main/java/share/system/service/QPService.java
+6
-0
TiktokService.java
...tem/src/main/java/share/system/service/TiktokService.java
+3
-0
QPServiceImpl.java
...rc/main/java/share/system/service/impl/QPServiceImpl.java
+48
-1
SCouponServiceImpl.java
...in/java/share/system/service/impl/SCouponServiceImpl.java
+2
-0
TiktokServiceImpl.java
...ain/java/share/system/service/impl/TiktokServiceImpl.java
+46
-4
No files found.
share-front/src/main/java/share/web/controller/system/QPController.java
View file @
c8b8b80e
...
@@ -8,6 +8,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
...
@@ -8,6 +8,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
share.common.core.domain.R
;
import
share.common.core.domain.R
;
import
share.common.enums.ConsumerCouponStatusEnum
;
import
share.common.enums.ConsumerCouponStatusEnum
;
import
share.system.domain.SStore
;
import
share.system.service.QPService
;
import
share.system.service.QPService
;
import
share.system.service.TiktokService
;
import
share.system.service.TiktokService
;
...
@@ -75,4 +76,16 @@ public class QPController {
...
@@ -75,4 +76,16 @@ public class QPController {
public
R
<
List
<
TuangouDealQueryShopDealResponseEntity
>>
queryshopdeal
(
String
openShopUuid
)
{
public
R
<
List
<
TuangouDealQueryShopDealResponseEntity
>>
queryshopdeal
(
String
openShopUuid
)
{
return
R
.
ok
(
qpService
.
queryshopdeal
(
openShopUuid
));
return
R
.
ok
(
qpService
.
queryshopdeal
(
openShopUuid
));
}
}
//查询当前优惠券适用门店
@GetMapping
(
"/queryshop"
)
public
R
<
List
<
SStore
>>
queryshop
(
String
code
)
{
if
(
code
.
length
()
==
10
)
{
return
R
.
ok
(
qpService
.
queryshop
(
code
));
}
else
if
(
code
.
startsWith
(
"https://v.douyin.com/"
)
|
code
.
length
()
==
15
|
code
.
length
()
==
12
)
{
return
R
.
ok
(
tiktokService
.
queryshop
(
code
));
}
else
{
return
R
.
fail
(
"请输入正确的券码"
);
}
}
}
}
share-system/src/main/java/share/system/service/QPService.java
View file @
c8b8b80e
...
@@ -3,6 +3,8 @@ package share.system.service;
...
@@ -3,6 +3,8 @@ package share.system.service;
import
com.dianping.openapi.sdk.api.customerauth.session.entity.CustomerKeyShopScopeResponseEntity
;
import
com.dianping.openapi.sdk.api.customerauth.session.entity.CustomerKeyShopScopeResponseEntity
;
import
com.dianping.openapi.sdk.api.oauth.entity.CustomerRefreshTokenResponse
;
import
com.dianping.openapi.sdk.api.oauth.entity.CustomerRefreshTokenResponse
;
import
com.dianping.openapi.sdk.api.tuangou.entity.*
;
import
com.dianping.openapi.sdk.api.tuangou.entity.*
;
import
share.system.domain.SCoupon
;
import
share.system.domain.SStore
;
import
share.system.domain.vo.SessionVo
;
import
share.system.domain.vo.SessionVo
;
import
java.util.List
;
import
java.util.List
;
...
@@ -29,4 +31,8 @@ public interface QPService {
...
@@ -29,4 +31,8 @@ public interface QPService {
SessionVo
queryKey
();
SessionVo
queryKey
();
List
<
CustomerKeyShopScopeResponseEntity
>
scope
();
List
<
CustomerKeyShopScopeResponseEntity
>
scope
();
List
<
SStore
>
queryshop
(
String
code
);
List
<
SStore
>
getsStores
(
List
<
SStore
>
sStoreList
,
SCoupon
sCoupon
);
}
}
share-system/src/main/java/share/system/service/TiktokService.java
View file @
c8b8b80e
package
share
.
system
.
service
;
package
share
.
system
.
service
;
import
cn.hutool.json.JSONObject
;
import
cn.hutool.json.JSONObject
;
import
share.system.domain.SStore
;
import
share.system.domain.tiktok.TiktokCouponDto
;
import
share.system.domain.tiktok.TiktokCouponDto
;
import
share.system.domain.tiktok.TiktokPoi
;
import
share.system.domain.tiktok.TiktokPoi
;
import
share.system.domain.vo.OnlineQueryDto
;
import
share.system.domain.vo.OnlineQueryDto
;
...
@@ -27,4 +28,6 @@ public interface TiktokService {
...
@@ -27,4 +28,6 @@ public interface TiktokService {
String
consumeByUser
(
String
code
,
String
storeId
);
String
consumeByUser
(
String
code
,
String
storeId
);
List
<
TiktokPoi
>
poiList
();
List
<
TiktokPoi
>
poiList
();
List
<
SStore
>
queryshop
(
String
code
);
}
}
share-system/src/main/java/share/system/service/impl/QPServiceImpl.java
View file @
c8b8b80e
...
@@ -46,6 +46,7 @@ import java.math.BigDecimal;
...
@@ -46,6 +46,7 @@ import java.math.BigDecimal;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.*
;
import
java.util.concurrent.TimeUnit
;
import
java.util.concurrent.TimeUnit
;
import
java.util.stream.Collectors
;
@Service
@Service
public
class
QPServiceImpl
implements
QPService
{
public
class
QPServiceImpl
implements
QPService
{
...
@@ -239,7 +240,7 @@ public class QPServiceImpl implements QPService {
...
@@ -239,7 +240,7 @@ public class QPServiceImpl implements QPService {
logger
.
error
(
"验卷准备失败:{}"
,
invoke
.
getMsg
());
logger
.
error
(
"验卷准备失败:{}"
,
invoke
.
getMsg
());
throw
new
RuntimeException
(
invoke
.
getMsg
());
throw
new
RuntimeException
(
invoke
.
getMsg
());
}
}
logger
.
info
(
"验卷准备结束:{}"
,
invoke
.
getData
());
logger
.
info
(
"验卷准备结束:{}"
,
invoke
.
getData
()
.
toString
()
);
return
invoke
.
getData
();
return
invoke
.
getData
();
}
}
...
@@ -418,4 +419,50 @@ public class QPServiceImpl implements QPService {
...
@@ -418,4 +419,50 @@ public class QPServiceImpl implements QPService {
return
collect
;
return
collect
;
}
}
@Override
public
List
<
SStore
>
queryshop
(
String
code
)
{
LambdaQueryWrapper
<
SStore
>
sStoreLambdaQueryWrapper
=
new
LambdaQueryWrapper
<>(
SStore
.
class
);
sStoreLambdaQueryWrapper
.
eq
(
SStore:
:
getStoreType
,
StoreType
.
HOTEL
.
getCode
());
List
<
SStore
>
sStoreList
=
storeService
.
list
(
sStoreLambdaQueryWrapper
);
//验券准备
TuangouReceiptPrepareResponseEntity
prepare
=
prepare
(
code
.
trim
(),
sStoreList
.
get
(
0
).
getOpenShopUuid
(),
""
);
sStoreList
=
storeService
.
list
(
new
LambdaQueryWrapper
<>(
SStore
.
class
).
isNotNull
(
SStore:
:
getOpenShopUuid
));
SCoupon
sCoupon
=
isCouponService
.
getOne
(
new
LambdaQueryWrapper
<>(
SCoupon
.
class
).
eq
(
SCoupon:
:
getCouponType
,
CouponTypeEnum
.
CASH
.
getCode
()).
eq
(
SCoupon:
:
getDealgroupId
,
prepare
.
getDealgroup_id
()).
eq
(
SCoupon:
:
getPlatformType
,
PlatformTypeEnum
.
MEITUAN
.
getCode
()));
if
(!
ObjectUtils
.
isEmpty
(
sCoupon
))
{
//过滤不存在sCoupon.getstoreIds()的门店
return
getsStores
(
sStoreList
,
sCoupon
);
}
else
{
List
<
SCoupon
>
coupons
=
isCouponService
.
queryShopDeal
();
SCoupon
scoupon
=
coupons
.
stream
().
filter
(
o
->
o
.
getDealgroupId
().
equals
(
prepare
.
getDealgroup_id
())).
findFirst
().
get
();
if
(
ObjectUtils
.
isEmpty
(
scoupon
))
{
throw
new
RuntimeException
(
"当前优惠券异常,请联系客服"
);
}
isCouponService
.
save
(
scoupon
);
//过滤不存在sCoupon.getstoreIds()的门店
return
getsStores
(
sStoreList
,
scoupon
);
}
}
public
List
<
SStore
>
getsStores
(
List
<
SStore
>
sStoreList
,
SCoupon
sCoupon
)
{
List
<
SStore
>
collect
=
sStoreList
.
stream
().
filter
(
o
->
{
String
storeIds
=
sCoupon
.
getStoreIds
();
if
(
StringUtils
.
isEmpty
(
storeIds
))
{
return
true
;
}
String
[]
split
=
storeIds
.
split
(
","
);
for
(
String
s
:
split
)
{
if
(
o
.
getId
().
equals
(
Long
.
valueOf
(
s
)))
{
return
true
;
}
}
return
false
;
}).
collect
(
Collectors
.
toList
());
if
(
CollectionUtils
.
isEmpty
(
collect
))
{
return
sStoreList
;
}
return
collect
;
}
}
}
share-system/src/main/java/share/system/service/impl/SCouponServiceImpl.java
View file @
c8b8b80e
...
@@ -220,6 +220,7 @@ public class SCouponServiceImpl extends ServiceImpl<SCouponMapper, SCoupon> impl
...
@@ -220,6 +220,7 @@ public class SCouponServiceImpl extends ServiceImpl<SCouponMapper, SCoupon> impl
}
catch
(
ParseException
e
)
{
}
catch
(
ParseException
e
)
{
throw
new
RuntimeException
(
e
);
throw
new
RuntimeException
(
e
);
}
}
sCoupon
.
setPlatformType
(
PlatformTypeEnum
.
MEITUAN
.
getCode
());
sCoupon
.
setRoomType
(
RoomType
.
getCodeList
());
sCoupon
.
setRoomType
(
RoomType
.
getCodeList
());
sCoupon
.
setStoreType
(
StoreType
.
getCodeList
());
sCoupon
.
setStoreType
(
StoreType
.
getCodeList
());
sCoupon
.
setValidStartTime
(
DEFAULT_START_TIME
);
sCoupon
.
setValidStartTime
(
DEFAULT_START_TIME
);
...
@@ -318,6 +319,7 @@ public class SCouponServiceImpl extends ServiceImpl<SCouponMapper, SCoupon> impl
...
@@ -318,6 +319,7 @@ public class SCouponServiceImpl extends ServiceImpl<SCouponMapper, SCoupon> impl
sCoupon
.
setEndDate
(
new
Date
(
product
.
getInt
(
"sold_end_time"
)
*
1000L
));
sCoupon
.
setEndDate
(
new
Date
(
product
.
getInt
(
"sold_end_time"
)
*
1000L
));
sCoupon
.
setSubPrice
(
sku
.
getBigDecimal
(
"origin_amount"
).
divide
(
new
BigDecimal
(
"100"
)));
sCoupon
.
setSubPrice
(
sku
.
getBigDecimal
(
"origin_amount"
).
divide
(
new
BigDecimal
(
"100"
)));
sCoupon
.
setRoomType
(
RoomType
.
getCodeList
());
sCoupon
.
setRoomType
(
RoomType
.
getCodeList
());
sCoupon
.
setPlatformType
(
PlatformTypeEnum
.
TIKTOK
.
getCode
());
sCoupon
.
setStoreType
(
StoreType
.
getCodeList
());
sCoupon
.
setStoreType
(
StoreType
.
getCodeList
());
sCoupon
.
setValidStartTime
(
DEFAULT_START_TIME
);
sCoupon
.
setValidStartTime
(
DEFAULT_START_TIME
);
sCoupon
.
setValidEndTime
(
DEFAULT_END_TIME
);
sCoupon
.
setValidEndTime
(
DEFAULT_END_TIME
);
...
...
share-system/src/main/java/share/system/service/impl/TiktokServiceImpl.java
View file @
c8b8b80e
...
@@ -27,10 +27,7 @@ import share.system.domain.tiktok.TiktokCouponDto;
...
@@ -27,10 +27,7 @@ import share.system.domain.tiktok.TiktokCouponDto;
import
share.system.domain.tiktok.TiktokPoi
;
import
share.system.domain.tiktok.TiktokPoi
;
import
share.system.domain.vo.FrontTokenComponent
;
import
share.system.domain.vo.FrontTokenComponent
;
import
share.system.domain.vo.OnlineQueryDto
;
import
share.system.domain.vo.OnlineQueryDto
;
import
share.system.service.ISConsumerCouponService
;
import
share.system.service.*
;
import
share.system.service.ISCouponService
;
import
share.system.service.ISStoreService
;
import
share.system.service.TiktokService
;
import
java.io.UnsupportedEncodingException
;
import
java.io.UnsupportedEncodingException
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
...
@@ -62,6 +59,9 @@ public class TiktokServiceImpl implements TiktokService {
...
@@ -62,6 +59,9 @@ public class TiktokServiceImpl implements TiktokService {
@Autowired
@Autowired
private
ISCouponService
isCouponService
;
private
ISCouponService
isCouponService
;
@Autowired
private
QPService
qpService
;
//默认门槛时长
//默认门槛时长
private
static
final
String
DEFAULT_MIN_DURATION
=
"0"
;
private
static
final
String
DEFAULT_MIN_DURATION
=
"0"
;
//默认时长
//默认时长
...
@@ -467,6 +467,48 @@ public class TiktokServiceImpl implements TiktokService {
...
@@ -467,6 +467,48 @@ public class TiktokServiceImpl implements TiktokService {
return
collect
;
return
collect
;
}
}
@Override
public
List
<
SStore
>
queryshop
(
String
code
)
{
LambdaQueryWrapper
<
SStore
>
sStoreLambdaQueryWrapper
=
new
LambdaQueryWrapper
<>(
SStore
.
class
);
sStoreLambdaQueryWrapper
.
eq
(
SStore:
:
getStoreType
,
StoreType
.
HOTEL
.
getCode
());
List
<
SStore
>
sStoreList
=
storeService
.
list
(
sStoreLambdaQueryWrapper
);
if
(
code
.
startsWith
(
"https://v.douyin.com/"
)
|
code
.
length
()
==
15
|
code
.
length
()
==
12
)
{
try
{
TiktokCouponDto
tiktokCouponDto
=
new
TiktokCouponDto
();
if
(
code
.
startsWith
(
"https://v.douyin.com/"
))
{
tiktokCouponDto
.
setEncryptedData
(
code
);
}
else
{
tiktokCouponDto
.
setCode
(
code
);
}
tiktokCouponDto
.
setPoiId
(
sStoreList
.
get
(
0
).
getTiktokPoiId
());
JSONObject
prepare
=
prepare
(
tiktokCouponDto
);
JSONArray
certificates
=
prepare
.
getJSONArray
(
"certificates"
);
Object
o
=
certificates
.
get
(
0
);
JSONObject
entries
=
new
JSONObject
(
o
);
JSONObject
sku
=
entries
.
getJSONObject
(
"sku"
);
SCoupon
sCoupon
=
isCouponService
.
getOne
(
new
LambdaQueryWrapper
<>(
SCoupon
.
class
).
eq
(
SCoupon:
:
getCouponType
,
CouponTypeEnum
.
CASH
.
getCode
()).
eq
(
SCoupon:
:
getTiktokSkuId
,
sku
.
getStr
(
"sku_id"
)).
eq
(
SCoupon:
:
getPlatformType
,
PlatformTypeEnum
.
TIKTOK
.
getCode
()));
sStoreList
=
storeService
.
list
(
new
LambdaQueryWrapper
<>(
SStore
.
class
).
isNotNull
(
SStore:
:
getTiktokPoiId
));
if
(!
ObjectUtils
.
isEmpty
(
sCoupon
))
{
return
qpService
.
getsStores
(
sStoreList
,
sCoupon
);
}
else
{
List
<
SCoupon
>
coupons
=
isCouponService
.
querySkuPoiList
();
SCoupon
scoupon
=
coupons
.
stream
().
filter
(
s
->
s
.
getTiktokSkuId
().
equals
(
sku
.
getStr
(
"sku_id"
))).
findFirst
().
get
();
if
(
ObjectUtils
.
isEmpty
(
scoupon
))
{
throw
new
RuntimeException
(
"当前优惠券异常,请联系客服"
);
}
isCouponService
.
save
(
scoupon
);
return
qpService
.
getsStores
(
sStoreList
,
scoupon
);
}
}
catch
(
RuntimeException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
return
Collections
.
emptyList
();
}
public
String
obtain
()
{
public
String
obtain
()
{
String
o
;
String
o
;
o
=
redisUtil
.
get
(
ReceiptRdeisEnum
.
TIKTOK_CLIENT_TOKEN
.
getValue
());
o
=
redisUtil
.
get
(
ReceiptRdeisEnum
.
TIKTOK_CLIENT_TOKEN
.
getValue
());
...
...
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