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
589e0cb7
Commit
589e0cb7
authored
Oct 23, 2023
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改优惠卷表字段
parent
526d8d18
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
146 additions
and
90 deletions
+146
-90
SCouponController.java
...n/java/share/web/controller/system/SCouponController.java
+10
-0
MTController.java
...c/main/java/share/web/controller/system/MTController.java
+4
-4
SCoupon.java
share-system/src/main/java/share/system/domain/SCoupon.java
+35
-13
SCouponMapper.java
...stem/src/main/java/share/system/mapper/SCouponMapper.java
+2
-0
ISCouponService.java
...m/src/main/java/share/system/service/ISCouponService.java
+7
-0
MTService.java
...-system/src/main/java/share/system/service/MTService.java
+6
-4
MTServiceImpl.java
...rc/main/java/share/system/service/impl/MTServiceImpl.java
+40
-32
SCouponServiceImpl.java
...in/java/share/system/service/impl/SCouponServiceImpl.java
+10
-0
SCouponMapper.xml
...system/src/main/resources/mapper/system/SCouponMapper.xml
+0
-0
SOrderMapper.xml
...-system/src/main/resources/mapper/system/SOrderMapper.xml
+30
-30
share.iml
share.iml
+2
-7
No files found.
share-admin/src/main/java/share/web/controller/system/SCouponController.java
View file @
589e0cb7
...
...
@@ -2,6 +2,8 @@ package share.web.controller.system;
import
java.util.List
;
import
javax.servlet.http.HttpServletResponse
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
...
...
@@ -16,6 +18,8 @@ import share.common.annotation.Log;
import
share.common.core.controller.BaseController
;
import
share.common.core.domain.AjaxResult
;
import
share.common.enums.BusinessType
;
import
share.common.enums.RoomType
;
import
share.common.enums.StoreType
;
import
share.system.domain.SCoupon
;
import
share.system.service.ISCouponService
;
import
share.common.utils.poi.ExcelUtil
;
...
...
@@ -77,6 +81,12 @@ public class SCouponController extends BaseController
@PostMapping
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
));
}
...
...
share-front/src/main/java/share/web/controller/system/MTController.java
View file @
589e0cb7
...
...
@@ -18,27 +18,27 @@ public class MTController {
@GetMapping
(
"/verificationVouchers"
)
@Log
(
title
=
"执行验券"
)
public
String
verificationVouchers
(
String
code
,
int
num
){
return
mtService
.
verificationVouchers
(
code
,
num
);
return
mtService
.
verificationVouchers
(
code
,
num
)
.
getMsg
()
;
}
@GetMapping
(
"/revoke"
)
@Log
(
title
=
"撤销验券"
)
public
String
revoke
(
String
ERPId
,
String
ERPName
,
String
couponCode
){
return
mtService
.
revoke
(
ERPId
,
ERPName
,
couponCode
);
return
mtService
.
revoke
(
ERPId
,
ERPName
,
couponCode
)
.
getMsg
()
;
}
@GetMapping
(
"/preparation"
)
@Log
(
title
=
"验券准备"
)
public
String
preparation
(
String
code
){
return
mtService
.
preparation
(
code
);
return
mtService
.
preparation
(
code
)
.
getMsg
()
;
}
@GetMapping
(
"/consume"
)
@Log
(
title
=
"已验券码查询"
)
public
String
verified
(
String
code
){
return
mtService
.
verified
(
code
);
return
mtService
.
verified
(
code
).
getMsg
(
);
}
}
share-system/src/main/java/share/system/domain/SCoupon.java
View file @
589e0cb7
...
...
@@ -27,6 +27,34 @@ public class SCoupon extends BaseEntity
@Excel
(
name
=
"优惠券名称"
)
private
String
name
;
/** 有效期开始 */
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
)
@Excel
(
name
=
"有效期开始"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd"
)
private
Date
startDate
;
/** 有效期结束 */
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
)
@Excel
(
name
=
"有效期结束"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd"
)
private
Date
endDate
;
/** 有效开始时段 */
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
)
@Excel
(
name
=
"有效开始时段"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd"
)
private
Date
validStartTime
;
/** 有效结束时段 */
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
)
@Excel
(
name
=
"有效结束时段"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd"
)
private
Date
validEndTime
;
//门店类型
@Excel
(
name
=
"门店类型(1:标准店,2:外卖店,3:酒店,4:其他)"
)
private
String
storeType
;
//房间类型
@Excel
(
name
=
"房间类型(1:标间,2:豪华间,3:总统套房,4:商务套房,5:行政套房,6:其他)"
)
private
String
roomType
;
/** 优惠券类型(1:折扣券,2,团购券,3:满减券,4:核销券,5:充值送金额) */
@Excel
(
name
=
"优惠券类型(1:折扣券,2,团购券,3:满减券,4:核销券,5:充值送金额)"
)
private
Integer
couponType
;
...
...
@@ -44,28 +72,22 @@ public class SCoupon extends BaseEntity
private
String
duration
;
/** 满减最小可使用金额 */
@Excel
(
name
=
"
满减最小可使用
金额"
)
@Excel
(
name
=
"
门槛
金额"
)
private
BigDecimal
minPrice
;
/** 减去金额(满减券单位:元,折扣为系数) */
@Excel
(
name
=
"减去金额(满减券单位:元,折扣为系数)"
)
private
BigDecimal
subPrice
;
/**
第三方平台名称
*/
@Excel
(
name
=
"
第三方平台名称
"
)
private
String
platform
;
/**
是否可叠加使用(0:不可叠加,1:可叠加)
*/
@Excel
(
name
=
"
是否可叠加使用(0:不可叠加,1:可叠加)
"
)
private
Integer
isOverlay
;
/** 第三方平台类型(1:美团,2,大众点评) */
@Excel
(
name
=
"第三方平台类型(1:美团,2,大众点评)"
)
private
Integer
platformType
;
/** 有效期开始 */
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
)
@Excel
(
name
=
"有效期开始"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd"
)
private
Date
startDate
;
/** 有效期结束 */
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
)
@Excel
(
name
=
"有效期结束"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd"
)
private
Date
endDate
;
/** 优惠券数量 */
@Excel
(
name
=
"优惠券数量"
)
private
Integer
number
;
}
share-system/src/main/java/share/system/mapper/SCouponMapper.java
View file @
589e0cb7
...
...
@@ -58,4 +58,6 @@ public interface SCouponMapper
* @return 结果
*/
public
int
deleteSCouponByIds
(
Long
[]
ids
);
SCoupon
selectSCouponByName
(
String
dealTitle
);
}
share-system/src/main/java/share/system/service/ISCouponService.java
View file @
589e0cb7
...
...
@@ -58,4 +58,11 @@ public interface ISCouponService
* @return 结果
*/
public
int
deleteSCouponById
(
Long
id
);
/**
* 根据优惠券名称查询优惠券
* @param dealTitle 优惠券名称
* @return 结果
*/
SCoupon
selectSCouponByName
(
String
dealTitle
);
}
share-system/src/main/java/share/system/service/MTService.java
View file @
589e0cb7
package
share
.
system
.
service
;
import
com.meituan.sdk.MeituanResponse
;
public
interface
MTService
{
public
String
verificationVouchers
(
String
code
,
int
num
);
MeituanResponse
verificationVouchers
(
String
code
,
int
num
);
public
String
revoke
(
String
ERPId
,
String
ERPName
,
String
couponCode
);
MeituanResponse
revoke
(
String
ERPId
,
String
ERPName
,
String
couponCode
);
String
preparation
(
String
code
);
MeituanResponse
preparation
(
String
code
);
String
verified
(
String
code
);
MeituanResponse
verified
(
String
code
);
}
share-system/src/main/java/share/system/service/impl/MTServiceImpl.java
View file @
589e0cb7
...
...
@@ -12,8 +12,13 @@ import com.meituan.sdk.model.tuangouNg.coupon.msSuperPrepare.MsSuperPrepareReque
import
com.meituan.sdk.model.tuangouNg.coupon.msSuperPrepare.MsSuperPrepareResponse
;
import
com.meituan.sdk.model.tuangouNg.coupon.queryCouponById.QueryCouponByIdRequest
;
import
com.meituan.sdk.model.tuangouNg.coupon.queryCouponById.QueryCouponByIdResponse
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
share.system.domain.SConsumerCoupon
;
import
share.system.domain.SCoupon
;
import
share.system.service.ISConsumerCouponService
;
import
share.system.service.ISCouponService
;
import
share.system.service.MTService
;
@Service
...
...
@@ -24,9 +29,29 @@ public class MTServiceImpl implements MTService {
private
String
appAuthToken
;
@Value
(
"${meituan.developerId}"
)
private
Long
developerId
;
@Autowired
private
ISCouponService
isCouponService
;
@Autowired
private
ISConsumerCouponService
isConsumerCouponService
;
//执行验券
@Override
public
String
verificationVouchers
(
String
code
,
int
num
)
{
public
MeituanResponse
verificationVouchers
(
String
code
,
int
num
)
{
//验券准备
MeituanResponse
preparation
=
preparation
(
code
);
//验券准备失败
if
(!
preparation
.
isSuccess
()){
throw
new
RuntimeException
(
preparation
.
getMsg
());
}
//返回验券准备数据
MsSuperPrepareResponse
data
=
(
MsSuperPrepareResponse
)
preparation
.
getData
();
SCoupon
sCoupon
=
isCouponService
.
selectSCouponByName
(
data
.
getDealTitle
());
if
(
sCoupon
==
null
){
throw
new
RuntimeException
(
"未找到对应的优惠券"
);
}
//执行验券
//developerId 服务商身份标识 signKey 服务商签名密钥
MeituanClient
meituanClient
=
DefaultMeituanClient
.
builder
(
developerId
,
signKey
).
build
();
MsSuperConsumeRequest
msSuperConsumeRequest
=
new
MsSuperConsumeRequest
();
...
...
@@ -40,18 +65,20 @@ public class MTServiceImpl implements MTService {
}
catch
(
MtSdkException
e
)
{
throw
new
RuntimeException
(
e
);
}
if
(
response
.
isSuccess
())
{
MsSuperConsumeResponse
resp
=
response
.
getData
();
return
resp
.
toString
();
}
else
{
System
.
out
.
println
(
"调用失败"
);
if
(
response
.
isSuccess
()){
SConsumerCoupon
sConsumerCoupon
=
new
SConsumerCoupon
();
sConsumerCoupon
.
setStoreType
(
sCoupon
.
getStoreType
());
sConsumerCoupon
.
setRoomType
(
sCoupon
.
getRoomType
());
isConsumerCouponService
.
insertSConsumerCoupon
(
sConsumerCoupon
);
}
else
{
return
response
;
}
return
null
;
return
response
;
}
//撤销验券
@Override
public
String
revoke
(
String
ERPId
,
String
ERPName
,
String
couponCode
)
{
public
MeituanResponse
revoke
(
String
ERPId
,
String
ERPName
,
String
couponCode
)
{
MeituanClient
meituanClient
=
DefaultMeituanClient
.
builder
(
developerId
,
signKey
).
build
();
CouponCancelRequest
couponCancelRequest
=
new
CouponCancelRequest
();
couponCancelRequest
.
setEId
(
ERPId
);
...
...
@@ -64,18 +91,12 @@ public class MTServiceImpl implements MTService {
}
catch
(
MtSdkException
e
)
{
throw
new
RuntimeException
(
e
);
}
if
(
response
.
isSuccess
())
{
CouponCancelResponse
resp
=
response
.
getData
();
return
resp
.
toString
();
}
else
{
System
.
out
.
println
(
"调用失败"
);
}
return
null
;
return
response
;
}
//验券准备
@Override
public
String
preparation
(
String
code
)
{
public
MeituanResponse
preparation
(
String
code
)
{
MeituanClient
meituanClient
=
DefaultMeituanClient
.
builder
(
developerId
,
signKey
).
build
();
MsSuperPrepareRequest
msSuperPrepareRequest
=
new
MsSuperPrepareRequest
();
msSuperPrepareRequest
.
setCode
(
code
);
...
...
@@ -85,18 +106,12 @@ public class MTServiceImpl implements MTService {
}
catch
(
MtSdkException
e
)
{
throw
new
RuntimeException
(
e
);
}
if
(
response
.
isSuccess
())
{
MsSuperPrepareResponse
resp
=
response
.
getData
();
return
resp
.
toString
();
}
else
{
System
.
out
.
println
(
"调用失败"
);
}
return
null
;
return
response
;
}
//已验券码查询
@Override
public
String
verified
(
String
code
)
{
public
MeituanResponse
verified
(
String
code
)
{
MeituanClient
meituanClient
=
DefaultMeituanClient
.
builder
(
developerId
,
signKey
).
build
();
QueryCouponByIdRequest
queryCouponByIdRequest
=
new
QueryCouponByIdRequest
();
queryCouponByIdRequest
.
setCouponCode
(
code
);
...
...
@@ -106,14 +121,7 @@ public class MTServiceImpl implements MTService {
}
catch
(
MtSdkException
e
)
{
throw
new
RuntimeException
(
e
);
}
if
(
response
.
isSuccess
())
{
QueryCouponByIdResponse
resp
=
response
.
getData
();
return
resp
.
toString
();
}
else
{
System
.
out
.
println
(
"调用失败"
);
}
return
null
;
return
response
;
}
}
share-system/src/main/java/share/system/service/impl/SCouponServiceImpl.java
View file @
589e0cb7
...
...
@@ -93,4 +93,14 @@ public class SCouponServiceImpl implements ISCouponService
{
return
sCouponMapper
.
deleteSCouponById
(
id
);
}
/**
* 根据优惠券名称查询优惠券
* @param dealTitle
* @return
*/
@Override
public
SCoupon
selectSCouponByName
(
String
dealTitle
)
{
return
sCouponMapper
.
selectSCouponByName
(
dealTitle
);
}
}
share-system/src/main/resources/mapper/system/SCouponMapper.xml
View file @
589e0cb7
This diff is collapsed.
Click to expand it.
share-system/src/main/resources/mapper/system/SOrderMapper.xml
View file @
589e0cb7
...
...
@@ -101,35 +101,35 @@
<insert
id=
"insertSOrder"
parameterType=
"SOrder"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into s_order
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"orderNo != null
"
>
order_no = #{orderNo}
,
</if>
<if
test=
"orderType != null
"
>
order_type = #{orderType}
,
</if>
<if
test=
"payType != null
"
>
pay_type = #{payType}
,
</if>
<if
test=
"payStatus != null
"
>
pay_status = #{payStatus}
,
</if>
<if
test=
"storeId != null
"
>
store_id = #{storeId}
,
</if>
<if
test=
"roomId != null
"
>
room_id = #{roomId}
,
</if>
<if
test=
"consumerId != null
"
>
consumer_id = #{consumerId}
,
</if>
<if
test=
"consumerName != null
"
>
consumer_name = #{consumerName}
,
</if>
<if
test=
"consumerPhone != null
"
>
consumer_phone = #{consumerPhone}
,
</if>
<if
test=
"packId != null
"
>
pack_id = #{packId}
,
</if>
<if
test=
"packPrice != null
"
>
pack_price = #{packPrice}
,
</if>
<if
test=
"couponId != null
"
>
coupon_id = #{couponId}
,
</if>
<if
test=
"couponPrice != null
"
>
coupon_price = #{couponPrice}
,
</if>
<if
test=
"totalPrice != null
"
>
total_price = #{totalPrice}
,
</if>
<if
test=
"payPrice != null
"
>
pay_price = #{payPrice}
,
</if>
<if
test=
"payTime != null
"
>
pay_time = #{payTime}
,
</if>
<if
test=
"timeLong != null
"
>
time_long = #{timeLong}
,
</if>
<if
test=
"preStartDate != null
"
>
pre_start_date = #{preStartDate}
,
</if>
<if
test=
"preEndDate != null
"
>
pre_end_date = #{preEndDate}
,
</if>
<if
test=
"startDate != null
"
>
start_date = #{startDate}
,
</if>
<if
test=
"endDate != null
"
>
end_date = #{endDate}
,
</if>
<if
test=
"status != null
"
>
status = #{status}
,
</if>
<if
test=
"refundStatus != null
"
>
refund_status = #{refundStatus}
,
</if>
<if
test=
"refundReason != null
"
>
refund_reason = #{refundReason}
,
</if>
<if
test=
"refundReasonTime != null
"
>
refund_reason_time = #{refundReasonTime}
,
</if>
<if
test=
"refundPrice != null
"
>
refund_price = #{refundPrice}
,
</if>
<if
test=
"isDelete != null
"
>
is_delete = #{isDelete}
,
</if>
<if
test=
"createBy != null
"
>
create_by = #{createBy}
,
</if>
<if
test=
"createTime != null
"
>
create_time = #{createTime}
,
</if>
<if
test=
"orderNo != null
and orderNo != ''"
>
order_no
,
</if>
<if
test=
"orderType != null
and orderType != ''"
>
order_type
,
</if>
<if
test=
"payType != null
and payType != ''"
>
pay_type
,
</if>
<if
test=
"payStatus != null
and payStatus != ''"
>
pay_status
,
</if>
<if
test=
"storeId != null
and storeId != ''"
>
store_id
,
</if>
<if
test=
"roomId != null
and roomId != ''"
>
room_id
,
</if>
<if
test=
"consumerId != null
and consumerId != ''"
>
consumer_id
,
</if>
<if
test=
"consumerName != null
and consumerName != ''"
>
consumer_name
,
</if>
<if
test=
"consumerPhone != null
and consumerPhone != ''"
>
consumer_phone
,
</if>
<if
test=
"packId != null
and packId != ''"
>
pack_id
,
</if>
<if
test=
"packPrice != null
and packPrice != ''"
>
pack_price
,
</if>
<if
test=
"couponId != null
and couponId != ''"
>
coupon_id
,
</if>
<if
test=
"couponPrice != null
and couponPrice != ''"
>
coupon_price
,
</if>
<if
test=
"totalPrice != null
and totalPrice != ''"
>
total_price
,
</if>
<if
test=
"payPrice != null
and payPrice != ''"
>
pay_price
,
</if>
<if
test=
"payTime != null
and payTime != ''"
>
pay_time
,
</if>
<if
test=
"timeLong != null
and timeLong != ''"
>
time_long
,
</if>
<if
test=
"preStartDate != null
and preStartDate != ''"
>
pre_start_date
,
</if>
<if
test=
"preEndDate != null
and preEndDate != ''"
>
pre_end_date
,
</if>
<if
test=
"startDate != null
and startDate != ''"
>
start_date
,
</if>
<if
test=
"endDate != null
and endDate != ''"
>
end_date
,
</if>
<if
test=
"status != null
and status != ''"
>
status
,
</if>
<if
test=
"refundStatus != null
and refundStatus != ''"
>
refund_status
,
</if>
<if
test=
"refundReason != null
and refundReason != ''"
>
refund_reason
,
</if>
<if
test=
"refundReasonTime != null
and refundReasonTime != ''"
>
refund_reason_time
,
</if>
<if
test=
"refundPrice != null
and refundPrice != ''"
>
refund_price
,
</if>
<if
test=
"isDelete != null
and isDelete != ''"
>
is_delete
,
</if>
<if
test=
"createBy != null
and createBy != ''"
>
create_by
,
</if>
<if
test=
"createTime != null
and createTime != ''"
>
create_time
,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"orderNo != null"
>
#{orderNo},
</if>
...
...
@@ -160,7 +160,7 @@
<if
test=
"refundPrice != null"
>
#{refundPrice},
</if>
<if
test=
"isDelete != null"
>
0,
</if>
<if
test=
"createBy != null"
>
#{createBy},
</if>
<if
test=
"createTime != null"
>
NOW()
,
</if>
<if
test=
"createTime != null"
>
#{createTime}
,
</if>
</trim>
</insert>
...
...
share.iml
View file @
589e0cb7
<?xml version="1.0" encoding="UTF-8"?>
<module
org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule=
"true"
type=
"JAVA_MODULE"
version=
"4"
>
<component
name=
"NewModuleRootManager"
LANGUAGE_LEVEL=
"JDK_1_8"
>
<output
url=
"file://$MODULE_DIR$/target/classes"
/>
<output-test
url=
"file://$MODULE_DIR$/target/test-classes"
/>
<content
url=
"file://$MODULE_DIR$"
>
<component
name=
"AdditionalModuleElements"
>
<content
url=
"file://$MODULE_DIR$"
dumb=
"true"
>
<excludeFolder
url=
"file://$MODULE_DIR$/target"
/>
</content>
<orderEntry
type=
"inheritedJdk"
/>
<orderEntry
type=
"sourceFolder"
forTests=
"false"
/>
</component>
</module>
\ No newline at end of file
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