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
81caf6da
Commit
81caf6da
authored
Oct 23, 2023
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
订单表增加商户订单号字段,增加验券逻辑
parent
589e0cb7
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
97 additions
and
27 deletions
+97
-27
SConsumerCouponController.java
...hare/web/controller/system/SConsumerCouponController.java
+18
-6
SCouponController.java
...n/java/share/web/controller/system/SCouponController.java
+10
-0
SOrder.java
share-system/src/main/java/share/system/domain/SOrder.java
+43
-14
MTServiceImpl.java
...rc/main/java/share/system/service/impl/MTServiceImpl.java
+26
-7
SOrderMapper.xml
...-system/src/main/resources/mapper/system/SOrderMapper.xml
+0
-0
No files found.
share-front/src/main/java/share/web/controller/system/SConsumerCouponController.java
View file @
81caf6da
...
@@ -6,8 +6,11 @@ import org.springframework.web.bind.annotation.*;
...
@@ -6,8 +6,11 @@ import org.springframework.web.bind.annotation.*;
import
share.common.core.controller.BaseController
;
import
share.common.core.controller.BaseController
;
import
share.common.core.domain.AjaxResult
;
import
share.common.core.domain.AjaxResult
;
import
share.common.core.page.TableDataInfo
;
import
share.common.core.page.TableDataInfo
;
import
share.system.domain.SConsumer
;
import
share.system.domain.SConsumerCoupon
;
import
share.system.domain.SConsumerCoupon
;
import
share.system.domain.vo.FrontTokenComponent
;
import
share.system.service.ISConsumerCouponService
;
import
share.system.service.ISConsumerCouponService
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -18,8 +21,7 @@ import java.util.List;
...
@@ -18,8 +21,7 @@ import java.util.List;
*/
*/
@RestController
@RestController
@RequestMapping
(
"/front/consumerCoupon"
)
@RequestMapping
(
"/front/consumerCoupon"
)
public
class
SConsumerCouponController
extends
BaseController
public
class
SConsumerCouponController
extends
BaseController
{
{
@Autowired
@Autowired
private
ISConsumerCouponService
sConsumerCouponService
;
private
ISConsumerCouponService
sConsumerCouponService
;
...
@@ -28,8 +30,9 @@ public class SConsumerCouponController extends BaseController
...
@@ -28,8 +30,9 @@ public class SConsumerCouponController extends BaseController
*/
*/
@PreAuthorize
(
"@ss.hasPermi('system:coupon:list')"
)
@PreAuthorize
(
"@ss.hasPermi('system:coupon:list')"
)
@GetMapping
(
"/list"
)
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
SConsumerCoupon
sConsumerCoupon
)
public
TableDataInfo
list
(
SConsumerCoupon
sConsumerCoupon
)
{
{
SConsumer
user
=
FrontTokenComponent
.
getWxSConsumerEntry
();
sConsumerCoupon
.
setConsumerId
(
user
.
getId
());
startPage
();
startPage
();
List
<
SConsumerCoupon
>
list
=
sConsumerCouponService
.
selectSConsumerCouponList
(
sConsumerCoupon
);
List
<
SConsumerCoupon
>
list
=
sConsumerCouponService
.
selectSConsumerCouponList
(
sConsumerCoupon
);
return
getDataTable
(
list
);
return
getDataTable
(
list
);
...
@@ -40,9 +43,18 @@ public class SConsumerCouponController extends BaseController
...
@@ -40,9 +43,18 @@ public class SConsumerCouponController extends BaseController
*/
*/
@PreAuthorize
(
"@ss.hasPermi('system:coupon:query')"
)
@PreAuthorize
(
"@ss.hasPermi('system:coupon:query')"
)
@GetMapping
(
value
=
"/{id}"
)
@GetMapping
(
value
=
"/{id}"
)
public
AjaxResult
getInfo
(
@PathVariable
(
"id"
)
Long
id
)
public
AjaxResult
getInfo
(
@PathVariable
(
"id"
)
Long
id
)
{
{
return
success
(
sConsumerCouponService
.
selectSConsumerCouponById
(
id
));
return
success
(
sConsumerCouponService
.
selectSConsumerCouponById
(
id
));
}
}
@PreAuthorize
(
"@ss.hasPermi('system:coupon:list')"
)
@GetMapping
(
"/query"
)
public
List
<
SConsumerCoupon
>
query
(
SConsumerCoupon
sConsumerCoupon
)
{
SConsumer
user
=
FrontTokenComponent
.
getWxSConsumerEntry
();
sConsumerCoupon
.
setConsumerId
(
user
.
getId
());
return
sConsumerCouponService
.
selectSConsumerCouponList
(
sConsumerCoupon
);
}
}
}
share-front/src/main/java/share/web/controller/system/SCouponController.java
View file @
81caf6da
...
@@ -2,6 +2,8 @@ package share.web.controller.system;
...
@@ -2,6 +2,8 @@ package share.web.controller.system;
import
java.util.List
;
import
java.util.List
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.security.access.prepost.PreAuthorize
;
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
;
...
@@ -16,6 +18,8 @@ import share.common.annotation.Log;
...
@@ -16,6 +18,8 @@ import share.common.annotation.Log;
import
share.common.core.controller.BaseController
;
import
share.common.core.controller.BaseController
;
import
share.common.core.domain.AjaxResult
;
import
share.common.core.domain.AjaxResult
;
import
share.common.enums.BusinessType
;
import
share.common.enums.BusinessType
;
import
share.common.enums.RoomType
;
import
share.common.enums.StoreType
;
import
share.system.domain.SCoupon
;
import
share.system.domain.SCoupon
;
import
share.system.service.ISCouponService
;
import
share.system.service.ISCouponService
;
import
share.common.utils.poi.ExcelUtil
;
import
share.common.utils.poi.ExcelUtil
;
...
@@ -77,6 +81,12 @@ public class SCouponController extends BaseController
...
@@ -77,6 +81,12 @@ public class SCouponController extends BaseController
@PostMapping
@PostMapping
public
AjaxResult
add
(
@RequestBody
SCoupon
sCoupon
)
public
AjaxResult
add
(
@RequestBody
SCoupon
sCoupon
)
{
{
if
(
StringUtils
.
isNotBlank
(
sCoupon
.
getRoomType
())){
sCoupon
.
setRoomType
(
String
.
valueOf
(
RoomType
.
getCodeList
()));
}
if
(
StringUtils
.
isNotBlank
(
sCoupon
.
getStoreType
())){
sCoupon
.
setStoreType
(
String
.
valueOf
(
StoreType
.
getCodeList
()));
}
return
toAjax
(
sCouponService
.
insertSCoupon
(
sCoupon
));
return
toAjax
(
sCouponService
.
insertSCoupon
(
sCoupon
));
}
}
...
...
share-system/src/main/java/share/system/domain/SOrder.java
View file @
81caf6da
...
@@ -22,18 +22,29 @@ import javax.validation.constraints.NotBlank;
...
@@ -22,18 +22,29 @@ import javax.validation.constraints.NotBlank;
* @date 2023-10-09
* @date 2023-10-09
*/
*/
@Data
@Data
public
class
SOrder
extends
BaseEntity
public
class
SOrder
extends
BaseEntity
{
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
/** 订单ID */
/**
* 订单ID
*/
private
Long
id
;
private
Long
id
;
/** 订单流水号 */
/**
* 订单流水号
*/
@Excel
(
name
=
"订单编号"
)
@Excel
(
name
=
"订单编号"
)
private
String
orderNo
;
private
String
orderNo
;
/** 订单类型(0:订房订单,1:续房订单,2:充值订单) */
/**
* 订单流水号
*/
@Excel
(
name
=
"订单编号"
)
private
String
outTradeNo
;
/**
* 订单类型(0:订房订单,1:续房订单,2:充值订单)
*/
@Excel
(
name
=
"订单类型(0:订房订单,1:续房订单,2:充值订单)"
)
@Excel
(
name
=
"订单类型(0:订房订单,1:续房订单,2:充值订单)"
)
private
Integer
orderType
;
private
Integer
orderType
;
...
@@ -49,15 +60,21 @@ public class SOrder extends BaseEntity
...
@@ -49,15 +60,21 @@ public class SOrder extends BaseEntity
@Excel
(
name
=
"房间ID"
)
@Excel
(
name
=
"房间ID"
)
private
Long
roomId
;
private
Long
roomId
;
/** 用户ID */
/**
* 用户ID
*/
@Excel
(
name
=
"用户ID"
)
@Excel
(
name
=
"用户ID"
)
private
Long
consumerId
;
private
Long
consumerId
;
/** 用户名称 */
/**
* 用户名称
*/
@Excel
(
name
=
"用户名称"
)
@Excel
(
name
=
"用户名称"
)
private
String
consumerName
;
private
String
consumerName
;
/** 用户手机号 */
/**
* 用户手机号
*/
@Excel
(
name
=
"用户手机号"
)
@Excel
(
name
=
"用户手机号"
)
private
String
consumerPhone
;
private
String
consumerPhone
;
...
@@ -67,7 +84,9 @@ public class SOrder extends BaseEntity
...
@@ -67,7 +84,9 @@ public class SOrder extends BaseEntity
@ApiModelProperty
(
value
=
"套餐金额"
)
@ApiModelProperty
(
value
=
"套餐金额"
)
private
BigDecimal
packPrice
;
private
BigDecimal
packPrice
;
/** 优惠券id */
/**
* 优惠券id
*/
@Excel
(
name
=
"优惠券id"
)
@Excel
(
name
=
"优惠券id"
)
private
String
couponId
;
private
String
couponId
;
...
@@ -86,27 +105,37 @@ public class SOrder extends BaseEntity
...
@@ -86,27 +105,37 @@ public class SOrder extends BaseEntity
@Excel
(
name
=
"订单时长(H)"
)
@Excel
(
name
=
"订单时长(H)"
)
private
String
timeLong
;
private
String
timeLong
;
/** 预约开始时间 */
/**
* 预约开始时间
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm"
)
@Excel
(
name
=
"预约开始时间"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd HH:mm"
)
@Excel
(
name
=
"预约开始时间"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd HH:mm"
)
private
Date
preStartDate
;
private
Date
preStartDate
;
/** 预约结束时间 */
/**
* 预约结束时间
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm"
)
@Excel
(
name
=
"预约结束时间"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd HH:mm"
)
@Excel
(
name
=
"预约结束时间"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd HH:mm"
)
private
Date
preEndDate
;
private
Date
preEndDate
;
/** 开始时间 */
/**
* 开始时间
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm"
)
@Excel
(
name
=
"开始时间"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd HH:mm"
)
@Excel
(
name
=
"开始时间"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd HH:mm"
)
private
Date
startDate
;
private
Date
startDate
;
/** 结束时间 */
/**
* 结束时间
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm"
)
@Excel
(
name
=
"结束时间"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd HH:mm"
)
@Excel
(
name
=
"结束时间"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd HH:mm"
)
private
Date
endDate
;
private
Date
endDate
;
/** 订单状态(0:待使用/已预约,1:使用中,2:已使用,3:已取消预约/退款中) */
/**
* 订单状态(0:待使用/已预约,1:使用中,2:已使用,3:已取消预约/退款中)
*/
@Excel
(
name
=
"订单状态(0:待使用/已预约,1:使用中,2:已使用)"
)
@Excel
(
name
=
"订单状态(0:待使用/已预约,1:使用中,2:已使用)"
)
private
Integer
status
;
private
Integer
status
;
...
...
share-system/src/main/java/share/system/service/impl/MTServiceImpl.java
View file @
81caf6da
...
@@ -15,8 +15,10 @@ import com.meituan.sdk.model.tuangouNg.coupon.queryCouponById.QueryCouponByIdRes
...
@@ -15,8 +15,10 @@ import com.meituan.sdk.model.tuangouNg.coupon.queryCouponById.QueryCouponByIdRes
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
share.system.domain.SConsumer
;
import
share.system.domain.SConsumerCoupon
;
import
share.system.domain.SConsumerCoupon
;
import
share.system.domain.SCoupon
;
import
share.system.domain.SCoupon
;
import
share.system.domain.vo.FrontTokenComponent
;
import
share.system.service.ISConsumerCouponService
;
import
share.system.service.ISConsumerCouponService
;
import
share.system.service.ISCouponService
;
import
share.system.service.ISCouponService
;
import
share.system.service.MTService
;
import
share.system.service.MTService
;
...
@@ -39,16 +41,17 @@ public class MTServiceImpl implements MTService {
...
@@ -39,16 +41,17 @@ public class MTServiceImpl implements MTService {
//执行验券
//执行验券
@Override
@Override
public
MeituanResponse
verificationVouchers
(
String
code
,
int
num
)
{
public
MeituanResponse
verificationVouchers
(
String
code
,
int
num
)
{
SConsumer
user
=
FrontTokenComponent
.
getWxSConsumerEntry
();
//验券准备
//验券准备
MeituanResponse
preparation
=
preparation
(
code
);
MeituanResponse
preparation
=
preparation
(
code
);
//验券准备失败
//验券准备失败
if
(!
preparation
.
isSuccess
())
{
if
(!
preparation
.
isSuccess
())
{
throw
new
RuntimeException
(
preparation
.
getMsg
());
throw
new
RuntimeException
(
preparation
.
getMsg
());
}
}
//返回验券准备数据
//返回验券准备数据
MsSuperPrepareResponse
data
=
(
MsSuperPrepareResponse
)
preparation
.
getData
();
MsSuperPrepareResponse
data
=
(
MsSuperPrepareResponse
)
preparation
.
getData
();
SCoupon
sCoupon
=
isCouponService
.
selectSCouponByName
(
data
.
getDealTitle
());
SCoupon
sCoupon
=
isCouponService
.
selectSCouponByName
(
data
.
getDealTitle
());
if
(
sCoupon
==
null
)
{
if
(
sCoupon
==
null
)
{
throw
new
RuntimeException
(
"未找到对应的优惠券"
);
throw
new
RuntimeException
(
"未找到对应的优惠券"
);
}
}
//执行验券
//执行验券
...
@@ -65,12 +68,28 @@ public class MTServiceImpl implements MTService {
...
@@ -65,12 +68,28 @@ public class MTServiceImpl implements MTService {
}
catch
(
MtSdkException
e
)
{
}
catch
(
MtSdkException
e
)
{
throw
new
RuntimeException
(
e
);
throw
new
RuntimeException
(
e
);
}
}
if
(
response
.
isSuccess
()){
//验券成功
if
(
response
.
isSuccess
())
{
SConsumerCoupon
sConsumerCoupon
=
new
SConsumerCoupon
();
SConsumerCoupon
sConsumerCoupon
=
new
SConsumerCoupon
();
sConsumerCoupon
.
setConsumerId
(
user
.
getId
());
sConsumerCoupon
.
setCouponId
(
sCoupon
.
getId
());
sConsumerCoupon
.
setCouponCode
(
code
);
sConsumerCoupon
.
setName
(
sCoupon
.
getName
());
sConsumerCoupon
.
setCouponType
(
String
.
valueOf
(
sCoupon
.
getCouponType
()));
sConsumerCoupon
.
setStoreType
(
sCoupon
.
getStoreType
());
sConsumerCoupon
.
setStoreType
(
sCoupon
.
getStoreType
());
sConsumerCoupon
.
setRoomType
(
sCoupon
.
getRoomType
());
sConsumerCoupon
.
setRoomType
(
sCoupon
.
getRoomType
());
sConsumerCoupon
.
setMinDuration
(
sCoupon
.
getMinDuration
());
sConsumerCoupon
.
setMaxDuration
(
sCoupon
.
getMaxDuration
());
sConsumerCoupon
.
setDuration
(
sCoupon
.
getDuration
());
sConsumerCoupon
.
setMinPrice
(
sCoupon
.
getMinPrice
());
sConsumerCoupon
.
setSubPrice
(
sCoupon
.
getSubPrice
());
sConsumerCoupon
.
setSourceType
(
"3"
);
sConsumerCoupon
.
setPlatformType
(
"2"
);
sConsumerCoupon
.
setStartDate
(
sCoupon
.
getStartDate
());
sConsumerCoupon
.
setEndDate
(
sCoupon
.
getEndDate
());
sConsumerCoupon
.
setCreateBy
(
String
.
valueOf
(
user
.
getId
()));
isConsumerCouponService
.
insertSConsumerCoupon
(
sConsumerCoupon
);
isConsumerCouponService
.
insertSConsumerCoupon
(
sConsumerCoupon
);
}
else
{
}
else
{
return
response
;
return
response
;
}
}
return
response
;
return
response
;
...
@@ -79,7 +98,7 @@ public class MTServiceImpl implements MTService {
...
@@ -79,7 +98,7 @@ public class MTServiceImpl implements MTService {
//撤销验券
//撤销验券
@Override
@Override
public
MeituanResponse
revoke
(
String
ERPId
,
String
ERPName
,
String
couponCode
)
{
public
MeituanResponse
revoke
(
String
ERPId
,
String
ERPName
,
String
couponCode
)
{
MeituanClient
meituanClient
=
DefaultMeituanClient
.
builder
(
developerId
,
signKey
).
build
();
MeituanClient
meituanClient
=
DefaultMeituanClient
.
builder
(
developerId
,
signKey
).
build
();
CouponCancelRequest
couponCancelRequest
=
new
CouponCancelRequest
();
CouponCancelRequest
couponCancelRequest
=
new
CouponCancelRequest
();
couponCancelRequest
.
setEId
(
ERPId
);
couponCancelRequest
.
setEId
(
ERPId
);
couponCancelRequest
.
setEName
(
ERPName
);
couponCancelRequest
.
setEName
(
ERPName
);
...
@@ -102,7 +121,7 @@ public class MTServiceImpl implements MTService {
...
@@ -102,7 +121,7 @@ public class MTServiceImpl implements MTService {
msSuperPrepareRequest
.
setCode
(
code
);
msSuperPrepareRequest
.
setCode
(
code
);
MeituanResponse
<
MsSuperPrepareResponse
>
response
=
null
;
MeituanResponse
<
MsSuperPrepareResponse
>
response
=
null
;
try
{
try
{
response
=
meituanClient
.
invokeApi
(
msSuperPrepareRequest
,
appAuthToken
);
response
=
meituanClient
.
invokeApi
(
msSuperPrepareRequest
,
appAuthToken
);
}
catch
(
MtSdkException
e
)
{
}
catch
(
MtSdkException
e
)
{
throw
new
RuntimeException
(
e
);
throw
new
RuntimeException
(
e
);
}
}
...
...
share-system/src/main/resources/mapper/system/SOrderMapper.xml
View file @
81caf6da
This diff is collapsed.
Click to expand it.
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