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
941000a0
Commit
941000a0
authored
Feb 23, 2024
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改用户验劵接口,团购绑定的id改为门店id
parent
82880f41
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
28 additions
and
45 deletions
+28
-45
QPController.java
...c/main/java/share/web/controller/system/QPController.java
+9
-8
TiktokController.java
...in/java/share/web/controller/system/TiktokController.java
+2
-2
SStore.java
share-system/src/main/java/share/system/domain/SStore.java
+1
-0
TuangouReceiptPrepareResponseEntityVo.java
...stem/domain/vo/TuangouReceiptPrepareResponseEntityVo.java
+0
-10
QPService.java
...-system/src/main/java/share/system/service/QPService.java
+1
-2
TiktokService.java
...tem/src/main/java/share/system/service/TiktokService.java
+1
-1
QPServiceImpl.java
...rc/main/java/share/system/service/impl/QPServiceImpl.java
+10
-18
TiktokServiceImpl.java
...ain/java/share/system/service/impl/TiktokServiceImpl.java
+4
-4
No files found.
share-front/src/main/java/share/web/controller/system/QPController.java
View file @
941000a0
...
...
@@ -3,15 +3,13 @@ package share.web.controller.system;
import
com.dianping.openapi.sdk.api.tuangou.entity.*
;
import
io.swagger.annotations.Api
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
share.common.core.domain.R
;
import
share.common.enums.ConsumerCouponStatusEnum
;
import
share.system.domain.vo.TuangouReceiptPrepareResponseEntityVo
;
import
share.system.service.QPService
;
import
share.system.service.TiktokService
;
import
java.util.List
;
...
...
@@ -21,6 +19,8 @@ import java.util.List;
public
class
QPController
{
@Autowired
private
QPService
qpService
;
@Autowired
private
TiktokService
tiktokService
;
//输码验券校验接口
@GetMapping
(
"/prepare"
)
...
...
@@ -48,12 +48,13 @@ public class QPController {
//用户验券接口
@GetMapping
(
"/consumeByUser"
)
public
R
<
TuangouReceiptPrepareResponseEntityVo
>
consumeByUser
(
String
code
,
String
openShopUuid
)
{
TuangouReceiptPrepareResponseEntityVo
tuangouReceiptPrepareResponseEntityVo
=
qpService
.
consumeByUser
(
code
,
openShopUuid
,
ConsumerCouponStatusEnum
.
CONTROLLER
.
getCode
());
if
(
ObjectUtils
.
isEmpty
(
tuangouReceiptPrepareResponseEntityVo
))
{
return
R
.
fail
(
tuangouReceiptPrepareResponseEntityVo
,
"该券码已被使用"
);
public
R
<
String
>
consumeByUser
(
String
code
,
String
storeId
)
{
if
(
code
.
length
()
==
10
)
{
return
R
.
ok
(
qpService
.
consumeByUser
(
code
,
storeId
,
ConsumerCouponStatusEnum
.
CONTROLLER
.
getCode
()));
}
else
if
(
code
.
startsWith
(
"https://v.douyin.com/"
)
|
code
.
length
()
==
15
)
{
return
R
.
ok
(
tiktokService
.
consumeByUser
(
code
,
storeId
));
}
else
{
return
R
.
ok
(
tuangouReceiptPrepareResponseEntityVo
);
return
R
.
fail
(
"请输入正确的券码"
);
}
}
...
...
share-front/src/main/java/share/web/controller/system/TiktokController.java
View file @
941000a0
...
...
@@ -64,7 +64,7 @@ public class TiktokController {
//用户验券接口
@GetMapping
(
"/consumeByUser"
)
public
AjaxResult
consumeByUser
(
String
code
,
String
poi
Id
)
{
return
success
(
tiktokService
.
consumeByUser
(
code
,
poi
Id
));
public
AjaxResult
consumeByUser
(
String
code
,
String
store
Id
)
{
return
success
(
tiktokService
.
consumeByUser
(
code
,
store
Id
));
}
}
share-system/src/main/java/share/system/domain/SStore.java
View file @
941000a0
...
...
@@ -22,6 +22,7 @@ public class SStore extends BaseEntity
private
static
final
long
serialVersionUID
=
1L
;
/** 门店ID */
@Excel
(
name
=
"门店ID"
)
@TableId
(
type
=
IdType
.
AUTO
)
private
Long
id
;
...
...
share-system/src/main/java/share/system/domain/vo/TuangouReceiptPrepareResponseEntityVo.java
deleted
100644 → 0
View file @
82880f41
package
share
.
system
.
domain
.
vo
;
import
com.dianping.openapi.sdk.api.tuangou.entity.TuangouReceiptPrepareResponseEntity
;
import
lombok.Data
;
@Data
public
class
TuangouReceiptPrepareResponseEntityVo
extends
TuangouReceiptPrepareResponseEntity
{
private
String
expirationTime
;
private
Long
consumerCouponId
;
}
share-system/src/main/java/share/system/service/QPService.java
View file @
941000a0
...
...
@@ -4,7 +4,6 @@ import com.dianping.openapi.sdk.api.customerauth.session.entity.CustomerKeyShopS
import
com.dianping.openapi.sdk.api.oauth.entity.CustomerRefreshTokenResponse
;
import
com.dianping.openapi.sdk.api.tuangou.entity.*
;
import
share.system.domain.vo.SessionVo
;
import
share.system.domain.vo.TuangouReceiptPrepareResponseEntityVo
;
import
java.util.List
;
...
...
@@ -17,7 +16,7 @@ public interface QPService {
TuangouReceiptGetConsumedReponseEntity
getconsumed
(
String
code
,
String
openShopUuid
);
TuangouReceiptPrepareResponseEntityVo
consumeByUser
(
String
code
,
String
openShopUui
d
,
String
status
);
String
consumeByUser
(
String
code
,
String
storeI
d
,
String
status
);
List
<
TuangouReceiptReverseConsumeResponseEntity
>
reverseconsumeByUser
(
Long
id
);
...
...
share-system/src/main/java/share/system/service/TiktokService.java
View file @
941000a0
...
...
@@ -24,7 +24,7 @@ public interface TiktokService {
JSONObject
onlineGet
(
String
productIds
,
String
accountId
);
String
consumeByUser
(
String
code
,
String
poi
Id
);
String
consumeByUser
(
String
code
,
String
store
Id
);
List
<
TiktokPoi
>
poiList
();
}
share-system/src/main/java/share/system/service/impl/QPServiceImpl.java
View file @
941000a0
...
...
@@ -23,11 +23,8 @@ import org.apache.commons.lang3.ObjectUtils;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
share.common.core.redis.RedisUtil
;
...
...
@@ -39,7 +36,6 @@ import share.system.domain.SCoupon;
import
share.system.domain.SStore
;
import
share.system.domain.vo.FrontTokenComponent
;
import
share.system.domain.vo.SessionVo
;
import
share.system.domain.vo.TuangouReceiptPrepareResponseEntityVo
;
import
share.system.service.ISConsumerCouponService
;
import
share.system.service.ISCouponService
;
import
share.system.service.ISStoreService
;
...
...
@@ -47,7 +43,10 @@ import share.system.service.QPService;
import
java.math.BigDecimal
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Optional
;
import
java.util.UUID
;
import
java.util.concurrent.TimeUnit
;
@Service
...
...
@@ -91,16 +90,15 @@ public class QPServiceImpl implements QPService {
* 用户验卷接口
*/
@Override
public
TuangouReceiptPrepareResponseEntityVo
consumeByUser
(
String
code
,
String
openShopUui
d
,
String
status
)
{
public
String
consumeByUser
(
String
code
,
String
storeI
d
,
String
status
)
{
LambdaQueryWrapper
<
SStore
>
sStoreLambdaQueryWrapper
=
new
LambdaQueryWrapper
<>();
sStoreLambdaQueryWrapper
.
eq
(
SStore:
:
get
OpenShopUuid
,
openShopUui
d
);
sStoreLambdaQueryWrapper
.
eq
(
SStore:
:
get
Id
,
storeI
d
);
SStore
sStore
=
storeService
.
getOne
(
sStoreLambdaQueryWrapper
);
if
(
ObjectUtils
.
isEmpty
(
sStore
)
||
StoreStatusEnum
.
STOP
.
getIndex
().
equals
(
sStore
.
getStatus
()))
{
throw
new
RuntimeException
(
"门店状态异常,请联系管理员"
);
}
//验券准备
TuangouReceiptPrepareResponseEntity
prepare
=
prepare
(
code
.
trim
(),
openShopUuid
,
status
);
TuangouReceiptPrepareResponseEntity
prepare
=
prepare
(
code
.
trim
(),
sStore
.
getOpenShopUuid
()
,
status
);
//获取用户信息
SConsumer
user
=
FrontTokenComponent
.
getWxSConsumerEntry
();
//查询领取记录表
...
...
@@ -113,7 +111,6 @@ public class QPServiceImpl implements QPService {
throw
new
RuntimeException
(
"该券已被领取"
);
}
//根据优惠卷名称查询优惠劵配置 查询list,取第一个
TuangouReceiptPrepareResponseEntityVo
response
=
new
TuangouReceiptPrepareResponseEntityVo
();
SConsumerCoupon
sConsumerCoupon
=
new
SConsumerCoupon
();
sConsumerCoupon
.
setConsumerId
(
user
.
getId
());
sConsumerCoupon
.
setDealId
(
prepare
.
getDeal_id
());
...
...
@@ -127,7 +124,7 @@ public class QPServiceImpl implements QPService {
sConsumerCoupon
.
setCreateTime
(
new
Date
());
sConsumerCoupon
.
setSubPrice
(
BigDecimal
.
valueOf
(
prepare
.
getDeal_marketprice
()));
//查询美团团购信息
List
<
TuangouDealQueryShopDealResponseEntity
>
groupActivities
=
queryshopdeal
(
openShopUuid
);
List
<
TuangouDealQueryShopDealResponseEntity
>
groupActivities
=
queryshopdeal
(
sStore
.
getOpenShopUuid
()
);
groupActivities
.
forEach
(
o
->
{
//套餐名称相同并且在售卖中
if
(
prepare
.
getDealgroup_id
().
equals
(
o
.
getDealgroup_id
())
&&
saleStatusEnum
.
SELLING
.
getCode
().
equals
(
o
.
getSale_status
()))
{
...
...
@@ -173,14 +170,9 @@ public class QPServiceImpl implements QPService {
sConsumerCoupon
.
setRemark
(
sCoupon
.
getRemark
());
}
isConsumerCouponService
.
insertSConsumerCoupon
(
sConsumerCoupon
);
response
.
setConsumerCouponId
(
sConsumerCoupon
.
getId
());
String
output1
=
DateUtil
.
format
(
prepare
.
getReceiptEndDate
(),
DatePattern
.
NORM_DATETIME_PATTERN
);
BeanUtils
.
copyProperties
(
prepare
,
response
);
response
.
setExpirationTime
(
output1
);
//核销美团券
consume
(
code
.
trim
(),
1
,
openShopUuid
,
ConsumerCouponStatusEnum
.
ORDER
.
getCode
()
);
return
response
;
consume
(
code
.
trim
(),
1
,
sStore
.
getOpenShopUuid
(),
status
);
return
"验劵成功"
;
}
@Override
...
...
share-system/src/main/java/share/system/service/impl/TiktokServiceImpl.java
View file @
941000a0
...
...
@@ -302,9 +302,9 @@ public class TiktokServiceImpl implements TiktokService {
}
@Override
public
String
consumeByUser
(
String
code
,
String
poi
Id
)
{
public
String
consumeByUser
(
String
code
,
String
store
Id
)
{
LambdaQueryWrapper
<
SStore
>
sStoreLambdaQueryWrapper
=
new
LambdaQueryWrapper
<>();
sStoreLambdaQueryWrapper
.
eq
(
SStore:
:
get
TiktokPoiId
,
poi
Id
);
sStoreLambdaQueryWrapper
.
eq
(
SStore:
:
get
Id
,
store
Id
);
SStore
sStore
=
storeService
.
getOne
(
sStoreLambdaQueryWrapper
);
if
(
ObjectUtils
.
isEmpty
(
sStore
)
||
StoreStatusEnum
.
STOP
.
getIndex
().
equals
(
sStore
.
getStatus
()))
{
throw
new
RuntimeException
(
"门店状态异常,请联系管理员"
);
...
...
@@ -317,7 +317,7 @@ public class TiktokServiceImpl implements TiktokService {
}
else
{
tiktokCouponDto
.
setCode
(
code
);
}
tiktokCouponDto
.
setPoiId
(
poiId
);
tiktokCouponDto
.
setPoiId
(
sStore
.
getTiktokPoiId
()
);
JSONObject
prepare
=
prepare
(
tiktokCouponDto
);
JSONArray
certificates
=
prepare
.
getJSONArray
(
"certificates"
);
Object
o
=
certificates
.
get
(
0
);
...
...
@@ -388,7 +388,7 @@ public class TiktokServiceImpl implements TiktokService {
isConsumerCouponService
.
insertSConsumerCoupon
(
sConsumerCoupon
);
TiktokCouponDto
couponDto
=
new
TiktokCouponDto
();
couponDto
.
setVerifyToken
(
prepare
.
getStr
(
"verify_token"
));
couponDto
.
setPoiId
(
poiId
);
couponDto
.
setPoiId
(
sStore
.
getTiktokPoiId
()
);
List
<
String
>
codes
=
new
ArrayList
<>();
List
<
JSONObject
>
list
=
certificates
.
toList
(
JSONObject
.
class
);
//获取List中的encrypted_code
...
...
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