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
4b7ef484
Commit
4b7ef484
authored
Apr 12, 2024
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
券码查询获取适用门店增加经纬度和距离
parent
53338875
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
78 additions
and
26 deletions
+78
-26
QPController.java
...c/main/java/share/web/controller/system/QPController.java
+12
-7
SStoreDto.java
...ystem/src/main/java/share/system/domain/vo/SStoreDto.java
+22
-0
ISStoreService.java
...em/src/main/java/share/system/service/ISStoreService.java
+8
-4
QPService.java
...-system/src/main/java/share/system/service/QPService.java
+4
-2
TiktokService.java
...tem/src/main/java/share/system/service/TiktokService.java
+3
-2
QPServiceImpl.java
...rc/main/java/share/system/service/impl/QPServiceImpl.java
+16
-6
SStoreServiceImpl.java
...ain/java/share/system/service/impl/SStoreServiceImpl.java
+4
-2
TiktokServiceImpl.java
...ain/java/share/system/service/impl/TiktokServiceImpl.java
+9
-3
No files found.
share-front/src/main/java/share/web/controller/system/QPController.java
View file @
4b7ef484
...
@@ -2,13 +2,15 @@ package share.web.controller.system;
...
@@ -2,13 +2,15 @@ package share.web.controller.system;
import
com.dianping.openapi.sdk.api.tuangou.entity.*
;
import
com.dianping.openapi.sdk.api.tuangou.entity.*
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
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.domain.vo.SStoreDto
;
import
share.system.domain.vo.SStoreVo
;
import
share.system.service.QPService
;
import
share.system.service.QPService
;
import
share.system.service.TiktokService
;
import
share.system.service.TiktokService
;
...
@@ -79,13 +81,16 @@ public class QPController {
...
@@ -79,13 +81,16 @@ public class QPController {
//查询当前优惠券适用门店
//查询当前优惠券适用门店
@GetMapping
(
"/queryshop"
)
@GetMapping
(
"/queryshop"
)
public
R
<
List
<
SStore
>>
queryshop
(
String
code
)
{
public
R
<
List
<
SStoreVo
>>
queryshop
(
SStoreDto
dto
)
{
if
(
code
.
length
()
==
10
)
{
if
(
StringUtils
.
isEmpty
(
dto
.
getCode
()))
{
return
R
.
ok
(
qpService
.
queryshop
(
code
));
throw
new
RuntimeException
(
"券码缺失"
);
}
else
if
(
code
.
startsWith
(
"https://v.douyin.com/"
)
|
code
.
length
()
==
15
|
code
.
length
()
==
12
)
{
}
return
R
.
ok
(
tiktokService
.
queryshop
(
code
));
if
(
dto
.
getCode
().
length
()
==
10
)
{
return
R
.
ok
(
qpService
.
queryshop
(
dto
));
}
else
if
(
dto
.
getCode
().
startsWith
(
"https://v.douyin.com/"
)
|
dto
.
getCode
().
length
()
==
15
|
dto
.
getCode
().
length
()
==
12
)
{
return
R
.
ok
(
tiktokService
.
queryshop
(
dto
));
}
else
{
}
else
{
return
R
.
fail
(
"请输入正确的券码"
);
throw
new
RuntimeException
(
"请输入正确的券码"
);
}
}
}
}
}
}
share-system/src/main/java/share/system/domain/vo/SStoreDto.java
0 → 100644
View file @
4b7ef484
package
share
.
system
.
domain
.
vo
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
share.common.core.domain.BaseEntity
;
@Data
public
class
SStoreDto
extends
BaseEntity
{
/**
* 经度
*/
@ApiModelProperty
(
value
=
"经度"
)
private
String
longitude
;
/**
* 纬度
*/
@ApiModelProperty
(
value
=
"纬度"
)
private
String
latitude
;
private
String
code
;
}
share-system/src/main/java/share/system/service/ISStoreService.java
View file @
4b7ef484
package
share
.
system
.
service
;
package
share
.
system
.
service
;
import
java.util.List
;
import
java.util.Map
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
share.system.domain.SStore
;
import
share.system.domain.SStore
;
import
share.system.domain.SStoreConsumer
;
import
share.system.domain.vo.SStoreConsumerVo
;
import
share.system.domain.vo.SStoreConsumerVo
;
import
share.system.domain.vo.SStoreVo
;
import
share.system.domain.vo.SStoreVo
;
import
share.system.request.SStoreRequest
;
import
share.system.request.SStoreRequest
;
import
share.system.domain.SStoreConsumer
;
import
java.util.List
;
import
java.util.Map
;
/**
/**
* 门店Service接口
* 门店Service接口
...
@@ -101,4 +101,8 @@ public interface ISStoreService extends IService<SStore>
...
@@ -101,4 +101,8 @@ public interface ISStoreService extends IService<SStore>
List
<
SStoreVo
>
storeList
();
List
<
SStoreVo
>
storeList
();
List
<
SStoreVo
>
convertDosToVos
(
List
<
SStore
>
storeList
);
List
<
SStoreVo
>
convertDosToVosSortByDst
(
List
<
SStore
>
storeList
,
SStoreRequest
request
);
}
}
share-system/src/main/java/share/system/service/QPService.java
View file @
4b7ef484
...
@@ -5,6 +5,8 @@ import com.dianping.openapi.sdk.api.oauth.entity.CustomerRefreshTokenResponse;
...
@@ -5,6 +5,8 @@ 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.SCoupon
;
import
share.system.domain.SStore
;
import
share.system.domain.SStore
;
import
share.system.domain.vo.SStoreDto
;
import
share.system.domain.vo.SStoreVo
;
import
share.system.domain.vo.SessionVo
;
import
share.system.domain.vo.SessionVo
;
import
java.util.List
;
import
java.util.List
;
...
@@ -32,7 +34,7 @@ public interface QPService {
...
@@ -32,7 +34,7 @@ public interface QPService {
List
<
CustomerKeyShopScopeResponseEntity
>
scope
();
List
<
CustomerKeyShopScopeResponseEntity
>
scope
();
List
<
SStore
>
queryshop
(
String
code
);
List
<
SStore
Vo
>
queryshop
(
SStoreDto
dto
);
List
<
SStore
>
getsStores
(
List
<
SStore
>
sStoreList
,
SCoupon
sCoupon
);
List
<
SStore
Vo
>
getsStores
(
List
<
SStore
>
sStoreList
,
SCoupon
sCoupon
,
SStoreDto
dto
);
}
}
share-system/src/main/java/share/system/service/TiktokService.java
View file @
4b7ef484
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
;
import
share.system.domain.vo.SStoreDto
;
import
share.system.domain.vo.SStoreVo
;
import
java.util.List
;
import
java.util.List
;
...
@@ -29,5 +30,5 @@ public interface TiktokService {
...
@@ -29,5 +30,5 @@ public interface TiktokService {
List
<
TiktokPoi
>
poiList
();
List
<
TiktokPoi
>
poiList
();
List
<
SStore
>
queryshop
(
String
code
);
List
<
SStore
Vo
>
queryshop
(
SStoreDto
dto
);
}
}
share-system/src/main/java/share/system/service/impl/QPServiceImpl.java
View file @
4b7ef484
...
@@ -35,7 +35,10 @@ import share.system.domain.SConsumerCoupon;
...
@@ -35,7 +35,10 @@ import share.system.domain.SConsumerCoupon;
import
share.system.domain.SCoupon
;
import
share.system.domain.SCoupon
;
import
share.system.domain.SStore
;
import
share.system.domain.SStore
;
import
share.system.domain.vo.FrontTokenComponent
;
import
share.system.domain.vo.FrontTokenComponent
;
import
share.system.domain.vo.SStoreDto
;
import
share.system.domain.vo.SStoreVo
;
import
share.system.domain.vo.SessionVo
;
import
share.system.domain.vo.SessionVo
;
import
share.system.request.SStoreRequest
;
import
share.system.service.ISConsumerCouponService
;
import
share.system.service.ISConsumerCouponService
;
import
share.system.service.ISCouponService
;
import
share.system.service.ISCouponService
;
import
share.system.service.ISStoreService
;
import
share.system.service.ISStoreService
;
...
@@ -420,7 +423,11 @@ public class QPServiceImpl implements QPService {
...
@@ -420,7 +423,11 @@ public class QPServiceImpl implements QPService {
}
}
@Override
@Override
public
List
<
SStore
>
queryshop
(
String
code
)
{
public
List
<
SStoreVo
>
queryshop
(
SStoreDto
dto
)
{
String
code
=
dto
.
getCode
();
if
(
StringUtils
.
isEmpty
(
dto
.
getLatitude
())
||
StringUtils
.
isEmpty
(
dto
.
getLongitude
()))
{
throw
new
RuntimeException
(
"经纬度不能为空"
);
}
LambdaQueryWrapper
<
SStore
>
sStoreLambdaQueryWrapper
=
new
LambdaQueryWrapper
<>(
SStore
.
class
);
LambdaQueryWrapper
<
SStore
>
sStoreLambdaQueryWrapper
=
new
LambdaQueryWrapper
<>(
SStore
.
class
);
sStoreLambdaQueryWrapper
.
eq
(
SStore:
:
getStoreType
,
StoreType
.
HOTEL
.
getCode
());
sStoreLambdaQueryWrapper
.
eq
(
SStore:
:
getStoreType
,
StoreType
.
HOTEL
.
getCode
());
List
<
SStore
>
sStoreList
=
storeService
.
list
(
sStoreLambdaQueryWrapper
);
List
<
SStore
>
sStoreList
=
storeService
.
list
(
sStoreLambdaQueryWrapper
);
...
@@ -433,7 +440,7 @@ public class QPServiceImpl implements QPService {
...
@@ -433,7 +440,7 @@ public class QPServiceImpl implements QPService {
eq
(
SCoupon:
:
getPlatformType
,
PlatformTypeEnum
.
MEITUAN
.
getCode
()));
eq
(
SCoupon:
:
getPlatformType
,
PlatformTypeEnum
.
MEITUAN
.
getCode
()));
if
(!
ObjectUtils
.
isEmpty
(
sCoupon
))
{
if
(!
ObjectUtils
.
isEmpty
(
sCoupon
))
{
//过滤不存在sCoupon.getstoreIds()的门店
//过滤不存在sCoupon.getstoreIds()的门店
return
getsStores
(
sStoreList
,
sCoupon
);
return
getsStores
(
sStoreList
,
sCoupon
,
dto
);
}
else
{
}
else
{
List
<
SCoupon
>
coupons
=
isCouponService
.
queryShopDeal
();
List
<
SCoupon
>
coupons
=
isCouponService
.
queryShopDeal
();
SCoupon
scoupon
=
coupons
.
stream
().
filter
(
o
->
o
.
getDealgroupId
().
equals
(
prepare
.
getDealgroup_id
())).
findFirst
().
get
();
SCoupon
scoupon
=
coupons
.
stream
().
filter
(
o
->
o
.
getDealgroupId
().
equals
(
prepare
.
getDealgroup_id
())).
findFirst
().
get
();
...
@@ -442,12 +449,12 @@ public class QPServiceImpl implements QPService {
...
@@ -442,12 +449,12 @@ public class QPServiceImpl implements QPService {
}
}
isCouponService
.
save
(
scoupon
);
isCouponService
.
save
(
scoupon
);
//过滤不存在sCoupon.getstoreIds()的门店
//过滤不存在sCoupon.getstoreIds()的门店
return
getsStores
(
sStoreList
,
scoupon
);
return
getsStores
(
sStoreList
,
scoupon
,
dto
);
}
}
}
}
@Override
@Override
public
List
<
SStore
>
getsStores
(
List
<
SStore
>
sStoreList
,
SCoupon
sCoupon
)
{
public
List
<
SStore
Vo
>
getsStores
(
List
<
SStore
>
sStoreList
,
SCoupon
sCoupon
,
SStoreDto
dto
)
{
List
<
SStore
>
collect
=
sStoreList
.
stream
().
filter
(
o
->
{
List
<
SStore
>
collect
=
sStoreList
.
stream
().
filter
(
o
->
{
String
storeIds
=
sCoupon
.
getStoreIds
();
String
storeIds
=
sCoupon
.
getStoreIds
();
if
(
StringUtils
.
isEmpty
(
storeIds
))
{
if
(
StringUtils
.
isEmpty
(
storeIds
))
{
...
@@ -462,8 +469,11 @@ public class QPServiceImpl implements QPService {
...
@@ -462,8 +469,11 @@ public class QPServiceImpl implements QPService {
return
false
;
return
false
;
}).
collect
(
Collectors
.
toList
());
}).
collect
(
Collectors
.
toList
());
if
(
CollectionUtils
.
isEmpty
(
collect
))
{
if
(
CollectionUtils
.
isEmpty
(
collect
))
{
return
s
StoreList
;
return
s
toreService
.
convertDosToVos
(
sStoreList
)
;
}
}
return
collect
;
SStoreRequest
request
=
new
SStoreRequest
();
request
.
setNowLatitude
(
dto
.
getLatitude
());
request
.
setNowLongitude
(
dto
.
getLongitude
());
return
storeService
.
convertDosToVosSortByDst
(
collect
,
request
);
}
}
}
}
share-system/src/main/java/share/system/service/impl/SStoreServiceImpl.java
View file @
4b7ef484
...
@@ -301,7 +301,8 @@ public class SStoreServiceImpl extends ServiceImpl<SStoreMapper, SStore> impleme
...
@@ -301,7 +301,8 @@ public class SStoreServiceImpl extends ServiceImpl<SStoreMapper, SStore> impleme
* @param request
* @param request
* @return
* @return
*/
*/
private
List
<
SStoreVo
>
convertDosToVosSortByDst
(
List
<
SStore
>
storeList
,
SStoreRequest
request
)
{
@Override
public
List
<
SStoreVo
>
convertDosToVosSortByDst
(
List
<
SStore
>
storeList
,
SStoreRequest
request
)
{
List
<
SStoreVo
>
voList
=
new
ArrayList
<>();
List
<
SStoreVo
>
voList
=
new
ArrayList
<>();
if
(
CollectionUtils
.
isNotEmpty
(
storeList
))
{
if
(
CollectionUtils
.
isNotEmpty
(
storeList
))
{
// 查询每一个房间最后一条预定订单下单时间
// 查询每一个房间最后一条预定订单下单时间
...
@@ -350,7 +351,8 @@ public class SStoreServiceImpl extends ServiceImpl<SStoreMapper, SStore> impleme
...
@@ -350,7 +351,8 @@ public class SStoreServiceImpl extends ServiceImpl<SStoreMapper, SStore> impleme
* @param storeList
* @param storeList
* @return
* @return
*/
*/
private
List
<
SStoreVo
>
convertDosToVos
(
List
<
SStore
>
storeList
)
{
@Override
public
List
<
SStoreVo
>
convertDosToVos
(
List
<
SStore
>
storeList
)
{
List
<
SStoreVo
>
voList
=
new
ArrayList
<>();
List
<
SStoreVo
>
voList
=
new
ArrayList
<>();
if
(
CollectionUtils
.
isNotEmpty
(
storeList
))
{
if
(
CollectionUtils
.
isNotEmpty
(
storeList
))
{
// 查询每一个房间最后一条预定订单下单时间
// 查询每一个房间最后一条预定订单下单时间
...
...
share-system/src/main/java/share/system/service/impl/TiktokServiceImpl.java
View file @
4b7ef484
...
@@ -27,6 +27,8 @@ import share.system.domain.tiktok.TiktokCouponDto;
...
@@ -27,6 +27,8 @@ 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.domain.vo.SStoreDto
;
import
share.system.domain.vo.SStoreVo
;
import
share.system.service.*
;
import
share.system.service.*
;
import
java.io.UnsupportedEncodingException
;
import
java.io.UnsupportedEncodingException
;
...
@@ -468,7 +470,11 @@ public class TiktokServiceImpl implements TiktokService {
...
@@ -468,7 +470,11 @@ public class TiktokServiceImpl implements TiktokService {
}
}
@Override
@Override
public
List
<
SStore
>
queryshop
(
String
code
)
{
public
List
<
SStoreVo
>
queryshop
(
SStoreDto
dto
)
{
String
code
=
dto
.
getCode
();
if
(
StringUtils
.
isEmpty
(
dto
.
getLatitude
())
||
StringUtils
.
isEmpty
(
dto
.
getLongitude
()))
{
throw
new
RuntimeException
(
"经纬度不能为空"
);
}
LambdaQueryWrapper
<
SStore
>
sStoreLambdaQueryWrapper
=
new
LambdaQueryWrapper
<>(
SStore
.
class
);
LambdaQueryWrapper
<
SStore
>
sStoreLambdaQueryWrapper
=
new
LambdaQueryWrapper
<>(
SStore
.
class
);
sStoreLambdaQueryWrapper
.
eq
(
SStore:
:
getStoreType
,
StoreType
.
HOTEL
.
getCode
());
sStoreLambdaQueryWrapper
.
eq
(
SStore:
:
getStoreType
,
StoreType
.
HOTEL
.
getCode
());
List
<
SStore
>
sStoreList
=
storeService
.
list
(
sStoreLambdaQueryWrapper
);
List
<
SStore
>
sStoreList
=
storeService
.
list
(
sStoreLambdaQueryWrapper
);
...
@@ -492,7 +498,7 @@ public class TiktokServiceImpl implements TiktokService {
...
@@ -492,7 +498,7 @@ public class TiktokServiceImpl implements TiktokService {
eq
(
SCoupon:
:
getPlatformType
,
PlatformTypeEnum
.
TIKTOK
.
getCode
()));
eq
(
SCoupon:
:
getPlatformType
,
PlatformTypeEnum
.
TIKTOK
.
getCode
()));
sStoreList
=
storeService
.
list
(
new
LambdaQueryWrapper
<>(
SStore
.
class
).
isNotNull
(
SStore:
:
getTiktokPoiId
));
sStoreList
=
storeService
.
list
(
new
LambdaQueryWrapper
<>(
SStore
.
class
).
isNotNull
(
SStore:
:
getTiktokPoiId
));
if
(!
ObjectUtils
.
isEmpty
(
sCoupon
))
{
if
(!
ObjectUtils
.
isEmpty
(
sCoupon
))
{
return
qpService
.
getsStores
(
sStoreList
,
sCoupon
);
return
qpService
.
getsStores
(
sStoreList
,
sCoupon
,
dto
);
}
else
{
}
else
{
List
<
SCoupon
>
coupons
=
isCouponService
.
querySkuPoiList
();
List
<
SCoupon
>
coupons
=
isCouponService
.
querySkuPoiList
();
SCoupon
scoupon
=
coupons
.
stream
().
filter
(
s
->
s
.
getTiktokSkuId
().
equals
(
sku
.
getStr
(
"sku_id"
))).
findFirst
().
get
();
SCoupon
scoupon
=
coupons
.
stream
().
filter
(
s
->
s
.
getTiktokSkuId
().
equals
(
sku
.
getStr
(
"sku_id"
))).
findFirst
().
get
();
...
@@ -500,7 +506,7 @@ public class TiktokServiceImpl implements TiktokService {
...
@@ -500,7 +506,7 @@ public class TiktokServiceImpl implements TiktokService {
throw
new
RuntimeException
(
"当前优惠券异常,请联系客服"
);
throw
new
RuntimeException
(
"当前优惠券异常,请联系客服"
);
}
}
isCouponService
.
save
(
scoupon
);
isCouponService
.
save
(
scoupon
);
return
qpService
.
getsStores
(
sStoreList
,
scoupon
);
return
qpService
.
getsStores
(
sStoreList
,
scoupon
,
dto
);
}
}
}
catch
(
RuntimeException
e
)
{
}
catch
(
RuntimeException
e
)
{
throw
new
RuntimeException
(
e
);
throw
new
RuntimeException
(
e
);
...
...
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