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
8cf074a9
Commit
8cf074a9
authored
Jan 15, 2024
by
wuwenlong
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' into test
parents
39500838
cb3069d8
Hide whitespace changes
Inline
Side-by-side
Showing
39 changed files
with
1262 additions
and
269 deletions
+1262
-269
SConsumerController.java
...java/share/web/controller/system/SConsumerController.java
+5
-0
SConsumerCouponController.java
...hare/web/controller/system/SConsumerCouponController.java
+26
-2
SCouponController.java
...n/java/share/web/controller/system/SCouponController.java
+12
-1
Constants.java
...common/src/main/java/share/common/constant/Constants.java
+1
-1
ConsumerCouponStatusEnum.java
...ain/java/share/common/enums/ConsumerCouponStatusEnum.java
+2
-0
StoreStatusEnum.java
...mon/src/main/java/share/common/enums/StoreStatusEnum.java
+35
-0
WeekEnum.java
share-common/src/main/java/share/common/enums/WeekEnum.java
+94
-0
DateUtils.java
share-common/src/main/java/share/common/utils/DateUtils.java
+2
-0
QPServiceImplAspect.java
...ain/java/share/framework/aspectj/QPServiceImplAspect.java
+12
-10
DeviceController.java
...in/java/share/web/controller/system/DeviceController.java
+2
-3
OpenInterfaceController.java
.../share/web/controller/system/OpenInterfaceController.java
+26
-0
SConsumerCouponController.java
...hare/web/controller/system/SConsumerCouponController.java
+1
-7
SCouponController.java
...n/java/share/web/controller/system/SCouponController.java
+0
-6
CouponRetryTask.java
...artz/src/main/java/share/quartz/task/CouponRetryTask.java
+95
-0
OrderTask.java
share-quartz/src/main/java/share/quartz/task/OrderTask.java
+15
-7
RedisTask.java
share-quartz/src/main/java/share/quartz/task/RedisTask.java
+13
-10
CouponLog.java
...e-system/src/main/java/share/system/domain/CouponLog.java
+19
-18
SConsumerCoupon.java
...em/src/main/java/share/system/domain/SConsumerCoupon.java
+30
-0
SCoupon.java
share-system/src/main/java/share/system/domain/SCoupon.java
+18
-0
OrderVo.java
...-system/src/main/java/share/system/domain/vo/OrderVo.java
+109
-0
SCouponMapper.java
...stem/src/main/java/share/system/mapper/SCouponMapper.java
+6
-0
CouponRequest.java
...tem/src/main/java/share/system/request/CouponRequest.java
+8
-0
ISConsumerCouponService.java
...in/java/share/system/service/ISConsumerCouponService.java
+7
-0
ISConsumptionRecordsService.java
...ava/share/system/service/ISConsumptionRecordsService.java
+8
-0
ISCouponService.java
...m/src/main/java/share/system/service/ISCouponService.java
+6
-0
ISOrderService.java
...em/src/main/java/share/system/service/ISOrderService.java
+9
-0
OpenInterfaceService.java
.../main/java/share/system/service/OpenInterfaceService.java
+9
-0
OpenInterfaceServiceImpl.java
...a/share/system/service/impl/OpenInterfaceServiceImpl.java
+107
-0
QPServiceImpl.java
...rc/main/java/share/system/service/impl/QPServiceImpl.java
+32
-8
RoomStatusServiceImpl.java
...java/share/system/service/impl/RoomStatusServiceImpl.java
+35
-14
SCleanRecordsServiceImpl.java
...a/share/system/service/impl/SCleanRecordsServiceImpl.java
+1
-1
SConsumerCouponServiceImpl.java
...share/system/service/impl/SConsumerCouponServiceImpl.java
+207
-59
SConsumptionRecordsServiceImpl.java
...e/system/service/impl/SConsumptionRecordsServiceImpl.java
+16
-0
SCouponServiceImpl.java
...in/java/share/system/service/impl/SCouponServiceImpl.java
+114
-28
SOrderServiceImpl.java
...ain/java/share/system/service/impl/SOrderServiceImpl.java
+112
-88
SStoreServiceImpl.java
...ain/java/share/system/service/impl/SStoreServiceImpl.java
+8
-0
CouponLogMapper.xml
...stem/src/main/resources/mapper/system/CouponLogMapper.xml
+6
-0
SConsumerCouponMapper.xml
...rc/main/resources/mapper/system/SConsumerCouponMapper.xml
+18
-2
SCouponMapper.xml
...system/src/main/resources/mapper/system/SCouponMapper.xml
+36
-4
No files found.
share-admin/src/main/java/share/web/controller/system/SConsumerController.java
View file @
8cf074a9
...
@@ -46,6 +46,11 @@ public class SConsumerController extends BaseController
...
@@ -46,6 +46,11 @@ public class SConsumerController extends BaseController
return
getDataTable
(
list
);
return
getDataTable
(
list
);
}
}
@GetMapping
(
"/query"
)
public
AjaxResult
query
()
{
return
success
(
sConsumerService
.
selectSConsumerList
(
new
SConsumer
()));
}
/**
/**
* 导出会员用户列表
* 导出会员用户列表
*/
*/
...
...
share-admin/src/main/java/share/web/controller/system/SConsumerCouponController.java
View file @
8cf074a9
package
share
.
web
.
controller
.
system
;
package
share
.
web
.
controller
.
system
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.List
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
...
@@ -7,6 +8,7 @@ import javax.servlet.http.HttpServletResponse;
...
@@ -7,6 +8,7 @@ import javax.servlet.http.HttpServletResponse;
import
org.apache.commons.lang3.StringUtils
;
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.util.ObjectUtils
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PutMapping
;
import
org.springframework.web.bind.annotation.PutMapping
;
...
@@ -21,10 +23,12 @@ import share.common.core.domain.AjaxResult;
...
@@ -21,10 +23,12 @@ 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.RoomType
;
import
share.common.enums.StoreType
;
import
share.common.enums.StoreType
;
import
share.system.domain.SConsumer
;
import
share.system.domain.SConsumerCoupon
;
import
share.system.domain.SConsumerCoupon
;
import
share.system.service.ISConsumerCouponService
;
import
share.system.service.ISConsumerCouponService
;
import
share.common.utils.poi.ExcelUtil
;
import
share.common.utils.poi.ExcelUtil
;
import
share.common.core.page.TableDataInfo
;
import
share.common.core.page.TableDataInfo
;
import
share.system.service.SConsumerService
;
/**
/**
* 优惠券领取记录Controller
* 优惠券领取记录Controller
...
@@ -39,6 +43,9 @@ public class SConsumerCouponController extends BaseController
...
@@ -39,6 +43,9 @@ public class SConsumerCouponController extends BaseController
@Autowired
@Autowired
private
ISConsumerCouponService
sConsumerCouponService
;
private
ISConsumerCouponService
sConsumerCouponService
;
@Autowired
private
SConsumerService
sConsumerService
;
/**
/**
* 查询优惠券领取记录列表
* 查询优惠券领取记录列表
*/
*/
...
@@ -46,9 +53,26 @@ public class SConsumerCouponController extends BaseController
...
@@ -46,9 +53,26 @@ public class SConsumerCouponController extends BaseController
@GetMapping
(
"/list"
)
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
SConsumerCoupon
sConsumerCoupon
)
public
TableDataInfo
list
(
SConsumerCoupon
sConsumerCoupon
)
{
{
List
<
SConsumer
>
list
=
sConsumerService
.
list
();
startPage
();
startPage
();
List
<
SConsumerCoupon
>
list
=
sConsumerCouponService
.
selectSConsumerCouponList
(
sConsumerCoupon
);
if
(
share
.
common
.
utils
.
StringUtils
.
isNotBlank
(
sConsumerCoupon
.
getPhone
()))
{
return
getDataTable
(
list
);
SConsumer
sConsumer
=
list
.
stream
().
filter
(
obj
->
obj
.
getPhone
().
equals
(
sConsumerCoupon
.
getPhone
())).
findFirst
().
orElse
(
null
);
if
(!
ObjectUtils
.
isEmpty
(
sConsumer
))
{
sConsumerCoupon
.
setConsumerId
(
sConsumer
.
getId
());
}
else
{
return
getDataTable
(
new
ArrayList
<>());
}
}
if
(
share
.
common
.
utils
.
StringUtils
.
isNotBlank
(
sConsumerCoupon
.
getNickName
()))
{
SConsumer
sConsumer
=
list
.
stream
().
filter
(
obj
->
share
.
common
.
utils
.
StringUtils
.
isNotBlank
(
obj
.
getNickName
())
&&
obj
.
getNickName
().
equals
(
sConsumerCoupon
.
getNickName
())).
findFirst
().
orElse
(
null
);
if
(!
ObjectUtils
.
isEmpty
(
sConsumer
))
{
sConsumerCoupon
.
setConsumerId
(
sConsumer
.
getId
());
}
else
{
return
getDataTable
(
new
ArrayList
<>());
}
}
List
<
SConsumerCoupon
>
sConsumerCoupons
=
sConsumerCouponService
.
selectSConsumerCouponList
(
sConsumerCoupon
);
return
getDataTable
(
sConsumerCoupons
);
}
}
...
...
share-admin/src/main/java/share/web/controller/system/SCouponController.java
View file @
8cf074a9
package
share
.
web
.
controller
.
system
;
package
share
.
web
.
controller
.
system
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
...
@@ -59,7 +60,7 @@ public class SCouponController extends BaseController
...
@@ -59,7 +60,7 @@ public class SCouponController extends BaseController
public
TableDataInfo
listDuration
(
SCoupon
sCoupon
)
{
public
TableDataInfo
listDuration
(
SCoupon
sCoupon
)
{
startPage
();
startPage
();
sCoupon
.
setCouponType
(
CouponTypeEnum
.
DURATION
.
getCode
());
sCoupon
.
setCouponType
(
CouponTypeEnum
.
DURATION
.
getCode
());
List
<
SCoupon
>
list
=
sCouponService
.
selectSCouponList
(
sCoupon
);
List
<
SCoupon
>
list
=
sCouponService
.
listDuration
(
sCoupon
);
return
getDataTable
(
list
);
return
getDataTable
(
list
);
}
}
...
@@ -132,4 +133,14 @@ public class SCouponController extends BaseController
...
@@ -132,4 +133,14 @@ public class SCouponController extends BaseController
{
{
return
toAjax
(
sCouponService
.
deleteSCouponByIds
(
ids
));
return
toAjax
(
sCouponService
.
deleteSCouponByIds
(
ids
));
}
}
/**
* 查询美团所有优惠卷的适用门店
*/
@GetMapping
(
"/queryshopdeal"
)
public
AjaxResult
queryShopDeal
()
{
return
success
(
sCouponService
.
queryShopDeal
());
}
}
}
share-common/src/main/java/share/common/constant/Constants.java
View file @
8cf074a9
...
@@ -20,7 +20,7 @@ public class Constants
...
@@ -20,7 +20,7 @@ public class Constants
public
final
static
Integer
ROMM_LOCK_LAZY_MINUTE
=
0
;
public
final
static
Integer
ROMM_LOCK_LAZY_MINUTE
=
0
;
public
static
final
String
CONFIG_KEY_SITE_URL
=
"https://
www.coujio.com
"
;
//域名
public
static
final
String
CONFIG_KEY_SITE_URL
=
"https://
coujiao.pseer.com/
"
;
//域名
public
static
final
String
CONFIG_KEY_API_URL
=
"https://www.coujio.com"
;
//admin接口地址
public
static
final
String
CONFIG_KEY_API_URL
=
"https://www.coujio.com"
;
//admin接口地址
// 订单取消Key
// 订单取消Key
public
static
final
String
ORDER_AUTO_CANCEL_KEY
=
"order_auto_cancel_key"
;
public
static
final
String
ORDER_AUTO_CANCEL_KEY
=
"order_auto_cancel_key"
;
...
...
share-common/src/main/java/share/common/enums/ConsumerCouponStatusEnum.java
View file @
8cf074a9
...
@@ -5,6 +5,8 @@ public enum ConsumerCouponStatusEnum {
...
@@ -5,6 +5,8 @@ public enum ConsumerCouponStatusEnum {
WECHAT
(
"2"
,
"微信回调"
),
WECHAT
(
"2"
,
"微信回调"
),
SERVICE
(
"3"
,
"SERVICE回调"
),
SERVICE
(
"3"
,
"SERVICE回调"
),
ORDER
(
"4"
,
"订单下单"
),
ORDER
(
"4"
,
"订单下单"
),
//任务
TASK
(
"5"
,
"任务"
),
;
;
ConsumerCouponStatusEnum
()
{
ConsumerCouponStatusEnum
()
{
...
...
share-common/src/main/java/share/common/enums/StoreStatusEnum.java
0 → 100644
View file @
8cf074a9
package
share
.
common
.
enums
;
public
enum
StoreStatusEnum
{
// 0:停业 1:正常营业
STOP
(
"0"
,
"停业"
),
NORMAL
(
"1"
,
"正常营业"
),
;
private
String
index
;
private
String
value
;
StoreStatusEnum
()
{
}
StoreStatusEnum
(
String
index
,
String
value
)
{
this
.
index
=
index
;
this
.
value
=
value
;
}
public
String
getIndex
()
{
return
index
;
}
public
void
setIndex
(
String
index
)
{
this
.
index
=
index
;
}
public
String
getValue
()
{
return
value
;
}
public
void
setValue
(
String
value
)
{
this
.
value
=
value
;
}
}
share-common/src/main/java/share/common/enums/WeekEnum.java
0 → 100644
View file @
8cf074a9
package
share
.
common
.
enums
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Objects
;
/**
* @Author wwl
* @Date 2024/1/15 13:27
*/
public
enum
WeekEnum
{
MONDAY
(
1
,
"周一"
),
TUESDAY
(
2
,
"周二"
),
WEDNESDAY
(
3
,
"周三"
),
THURSDAY
(
4
,
"周四"
),
FRIDAY
(
5
,
"周五"
),
SATURDAY
(
6
,
"周六"
),
SUNDAY
(
7
,
"周日"
);
private
Integer
code
;
private
String
value
;
WeekEnum
(
Integer
code
,
String
value
)
{
this
.
code
=
code
;
this
.
value
=
value
;
}
public
Integer
getCode
()
{
return
code
;
}
public
void
setCode
(
Integer
code
)
{
this
.
code
=
code
;
}
public
String
getValue
()
{
return
value
;
}
public
void
setValue
(
String
value
)
{
this
.
value
=
value
;
}
public
static
String
getValueByCode
(
Integer
code
){
WeekEnum
week
=
getEnumByCode
(
code
);
if
(
Objects
.
nonNull
(
week
)){
return
week
.
value
;
}
return
""
;
}
public
static
WeekEnum
getEnumByCode
(
Integer
code
){
for
(
WeekEnum
week
:
WeekEnum
.
values
())
{
if
(
week
.
code
.
compareTo
(
code
)==
0
)
{
return
week
;
}
}
return
null
;
}
public
static
Boolean
isSundays
(
ArrayList
<
Integer
>
weeks
){
List
<
Integer
>
sundays
=
new
ArrayList
<
Integer
>(){{
add
(
SATURDAY
.
code
);
add
(
SUNDAY
.
code
);
}};
if
(
weeks
.
size
()==
2
&&
sundays
.
contains
(
weeks
.
get
(
0
))
&&
sundays
.
contains
(
weeks
.
get
(
1
))){
return
true
;
}
return
false
;
}
public
static
Boolean
isAllWorkDays
(
ArrayList
<
Integer
>
weeks
){
List
<
Integer
>
workDays
=
new
ArrayList
<
Integer
>(){{
add
(
MONDAY
.
code
);
add
(
TUESDAY
.
code
);
add
(
WEDNESDAY
.
code
);
add
(
THURSDAY
.
code
);
add
(
FRIDAY
.
code
);
}};
if
(
weeks
.
size
()==
5
&&
workDays
.
contains
(
weeks
.
get
(
0
))
&&
workDays
.
contains
(
weeks
.
get
(
1
))
&&
workDays
.
contains
(
weeks
.
get
(
2
))
&&
workDays
.
contains
(
weeks
.
get
(
3
))
&&
workDays
.
contains
(
weeks
.
get
(
4
))){
return
true
;
}
return
false
;
}
}
share-common/src/main/java/share/common/utils/DateUtils.java
View file @
8cf074a9
...
@@ -28,6 +28,8 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
...
@@ -28,6 +28,8 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
public
static
String
YYYY_MM_DD_HH
=
"yyyy-MM-dd HH"
;
public
static
String
YYYY_MM_DD_HH
=
"yyyy-MM-dd HH"
;
public
static
String
YYYY_MM_DD_HH_MM
=
"yyyy-MM-dd HH:mm"
;
public
static
String
YYYYMMDDHHMMSS
=
"yyyyMMddHHmmss"
;
public
static
String
YYYYMMDDHHMMSS
=
"yyyyMMddHHmmss"
;
public
static
String
YYYY_MM_DD_HH_MM_SS
=
"yyyy-MM-dd HH:mm:ss"
;
public
static
String
YYYY_MM_DD_HH_MM_SS
=
"yyyy-MM-dd HH:mm:ss"
;
...
...
share-framework/src/main/java/share/framework/aspectj/QPServiceImplAspect.java
View file @
8cf074a9
...
@@ -39,12 +39,14 @@ public class QPServiceImplAspect {
...
@@ -39,12 +39,14 @@ public class QPServiceImplAspect {
@Autowired
@Autowired
private
ISStoreService
sStoreService
;
private
ISStoreService
sStoreService
;
private
static
final
Integer
TRY_NUMBER
=
3
;
/**
/**
* 切点函数,用于标识需要记录操作日志的方法。
* 切点函数,用于标识需要记录操作日志的方法。
* 切点表达式为:execution(* share.system.service.impl.QPServiceImpl.*(..)),表示匹配所有在share.system.service.impl.QPServiceImpl类中定义的方法。
* 切点表达式为:execution(* share.system.service.impl.QPServiceImpl.*(..)),表示匹配所有在share.system.service.impl.QPServiceImpl类中定义的方法。
*/
*/
@Pointcut
(
"execution(* share.system.service.impl.QPServiceImpl.
*
(..))"
)
@Pointcut
(
"execution(* share.system.service.impl.QPServiceImpl.
consume
(..))"
)
public
void
operLogPoinCut
()
{
public
void
operLogPoinCut
()
{
}
}
...
@@ -53,7 +55,7 @@ public class QPServiceImplAspect {
...
@@ -53,7 +55,7 @@ public class QPServiceImplAspect {
public
void
beforMethod
(
JoinPoint
point
)
{
public
void
beforMethod
(
JoinPoint
point
)
{
}
}
@Pointcut
(
"execution(* share.system.service.impl.QPServiceImpl.
*
(..))"
)
@Pointcut
(
"execution(* share.system.service.impl.QPServiceImpl.
consume
(..))"
)
public
void
operExceptionLogPoinCut
()
{
public
void
operExceptionLogPoinCut
()
{
}
}
...
@@ -87,7 +89,6 @@ public class QPServiceImplAspect {
...
@@ -87,7 +89,6 @@ public class QPServiceImplAspect {
JSONObject
jsonObject
=
JSON
.
parseObject
(
params
);
JSONObject
jsonObject
=
JSON
.
parseObject
(
params
);
//获得出参
//获得出参
String
outParams
=
JSON
.
toJSONString
(
result
);
String
outParams
=
JSON
.
toJSONString
(
result
);
// if(methodName.equals("consume")){
saveLog
(
couponLog
,
jsonObject
);
saveLog
(
couponLog
,
jsonObject
);
couponLog
.
setStatus
(
YesNoEnum
.
yes
.
getDisplay_3
());
couponLog
.
setStatus
(
YesNoEnum
.
yes
.
getDisplay_3
());
couponLog
.
setMessage
(
outParams
);
couponLog
.
setMessage
(
outParams
);
...
@@ -112,6 +113,7 @@ public class QPServiceImplAspect {
...
@@ -112,6 +113,7 @@ public class QPServiceImplAspect {
*/
*/
@AfterThrowing
(
pointcut
=
"operExceptionLogPoinCut()"
,
throwing
=
"e"
)
@AfterThrowing
(
pointcut
=
"operExceptionLogPoinCut()"
,
throwing
=
"e"
)
public
void
saveExceptionLog
(
JoinPoint
joinPoint
,
Throwable
e
)
{
public
void
saveExceptionLog
(
JoinPoint
joinPoint
,
Throwable
e
)
{
CouponLog
couponLog
=
new
CouponLog
();
try
{
try
{
// 从切面织入点处通过反射机制获取织入点处的方法
// 从切面织入点处通过反射机制获取织入点处的方法
MethodSignature
signature
=
(
MethodSignature
)
joinPoint
.
getSignature
();
MethodSignature
signature
=
(
MethodSignature
)
joinPoint
.
getSignature
();
...
@@ -119,18 +121,21 @@ public class QPServiceImplAspect {
...
@@ -119,18 +121,21 @@ public class QPServiceImplAspect {
Method
method
=
signature
.
getMethod
();
Method
method
=
signature
.
getMethod
();
//获得方法名
//获得方法名
String
methodName
=
method
.
getName
();
String
methodName
=
method
.
getName
();
CouponLog
couponLog
=
new
CouponLog
();
// 将入参转换成json // 请求参数
// 将入参转换成json // 请求参数
String
[]
paramNames
=
((
MethodSignature
)
joinPoint
.
getSignature
()).
getParameterNames
();
String
[]
paramNames
=
((
MethodSignature
)
joinPoint
.
getSignature
()).
getParameterNames
();
String
params
=
argsArrayToString
(
paramNames
,
joinPoint
.
getArgs
());
String
params
=
argsArrayToString
(
paramNames
,
joinPoint
.
getArgs
());
//转JSON
//转JSON
JSONObject
jsonObject
=
JSON
.
parseObject
(
params
);
JSONObject
jsonObject
=
JSON
.
parseObject
(
params
);
// if(methodName.equals("consume")) {
saveLog
(
couponLog
,
jsonObject
);
saveLog
(
couponLog
,
jsonObject
);
couponLog
.
setStatus
(
YesNoEnum
.
no
.
getDisplay_3
());
couponLog
.
setStatus
(
YesNoEnum
.
no
.
getDisplay_3
());
couponLog
.
set
Message
(
stackTraceToString
(
e
.
getClass
().
getName
(),
e
.
getMessage
(),
e
.
getStackTrace
())
);
couponLog
.
set
Number
(
TRY_NUMBER
);
couponLog
.
setCreateTime
(
new
Date
());
couponLog
.
setCreateTime
(
new
Date
());
// 异步执行
couponLog
.
setMessage
(
e
.
getMessage
());
}
catch
(
Exception
e2
)
{
e2
.
printStackTrace
();
}
finally
{
CompletableFuture
.
supplyAsync
(()
->
{
CompletableFuture
.
supplyAsync
(()
->
{
int
i
=
couponLogService
.
insertCouponLog
(
couponLog
);
int
i
=
couponLogService
.
insertCouponLog
(
couponLog
);
if
(
i
>
0
)
{
if
(
i
>
0
)
{
...
@@ -139,9 +144,6 @@ public class QPServiceImplAspect {
...
@@ -139,9 +144,6 @@ public class QPServiceImplAspect {
return
false
;
return
false
;
}
}
});
});
// }
}
catch
(
Exception
e2
)
{
e2
.
printStackTrace
();
}
}
}
}
...
...
share-front/src/main/java/share/web/controller/system/DeviceController.java
View file @
8cf074a9
...
@@ -46,15 +46,14 @@ public class DeviceController extends BaseController {
...
@@ -46,15 +46,14 @@ public class DeviceController extends BaseController {
/**
/**
* 开门、关门、取电、断电
* 开门、关门、取电、断电
*/
*/
@Log
(
title
=
"设备信息"
,
businessType
=
BusinessType
.
UPDATE
)
@PostMapping
(
value
=
"/openOrClose"
)
@PostMapping
(
value
=
"/openOrClose"
)
public
AjaxResult
openOrClose
(
@RequestBody
DeviceParamVo
deviceParam
)
{
public
AjaxResult
openOrClose
(
@RequestBody
DeviceParamVo
deviceParam
)
{
SConsumer
user
=
consumerService
.
getInfo
();
// 获取mqtt的topic、payload
// 获取mqtt的topic、payload
MqttxVo
mqttxVo
=
mqttxService
.
openOrCloseDevice
(
deviceParam
.
getDevId
(),
MqttxVo
mqttxVo
=
mqttxService
.
openOrCloseDevice
(
deviceParam
.
getDevId
(),
SecurityUtils
.
getUsername
(),
deviceParam
.
getOpType
());
user
.
getAccount
(),
deviceParam
.
getOpType
());
// 发送mqtt消息
// 发送mqtt消息
mqttGatewayComponent
.
sendToMqtt
(
mqttxVo
.
getTopic
(),
0
,
mqttxVo
.
getPayload
());
mqttGatewayComponent
.
sendToMqtt
(
mqttxVo
.
getTopic
(),
0
,
mqttxVo
.
getPayload
());
SConsumer
user
=
consumerService
.
getInfo
();
// 写日志记录
// 写日志记录
int
result
=
deviceLogService
.
addDeviceLog
(
mqttxVo
,
user
.
getAccount
());
int
result
=
deviceLogService
.
addDeviceLog
(
mqttxVo
,
user
.
getAccount
());
return
toAjax
(
result
);
return
toAjax
(
result
);
...
...
share-front/src/main/java/share/web/controller/system/OpenInterfaceController.java
0 → 100644
View file @
8cf074a9
package
share
.
web
.
controller
.
system
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
share.common.core.domain.AjaxResult
;
import
share.common.core.domain.R
;
import
share.system.service.ISOrderService
;
import
share.system.service.OpenInterfaceService
;
@RestController
@RequestMapping
(
"/openInterface"
)
public
class
OpenInterfaceController
{
@Autowired
private
OpenInterfaceService
openInterfaceService
;
@GetMapping
(
"/order/info"
)
public
AjaxResult
orderInfo
(
@RequestParam
(
"orderNo"
)
String
orderNo
)
{
return
AjaxResult
.
success
(
openInterfaceService
.
orderInfo
(
orderNo
));
}
@RequestMapping
(
value
=
"/open/door"
,
method
=
RequestMethod
.
GET
)
public
R
<
String
>
openDoor
(
@RequestParam
(
"orderNo"
)
String
orderNo
)
{
return
R
.
ok
(
openInterfaceService
.
openDoor
(
orderNo
));
}
}
share-front/src/main/java/share/web/controller/system/SConsumerCouponController.java
View file @
8cf074a9
...
@@ -38,14 +38,8 @@ public class SConsumerCouponController extends BaseController {
...
@@ -38,14 +38,8 @@ public class SConsumerCouponController extends BaseController {
// @PreAuthorize("@ss.hasPermi('system:coupon:list')")
// @PreAuthorize("@ss.hasPermi('system:coupon:list')")
@GetMapping
(
"/list"
)
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
String
useStatus
)
{
public
TableDataInfo
list
(
String
useStatus
)
{
SConsumerCoupon
sConsumerCoupon
=
new
SConsumerCoupon
();
if
(
StringUtils
.
isNotBlank
(
useStatus
)){
sConsumerCoupon
.
setUseStatus
(
Integer
.
valueOf
(
useStatus
));
}
SConsumer
user
=
FrontTokenComponent
.
getWxSConsumerEntry
();
sConsumerCoupon
.
setConsumerId
(
user
.
getId
());
startPage
();
startPage
();
List
<
SConsumerCoupon
>
list
=
sConsumerCouponService
.
selectSConsumerCouponList
(
sConsumerCoupon
);
List
<
SConsumerCoupon
>
list
=
sConsumerCouponService
.
listByUseStatus
(
Integer
.
valueOf
(
useStatus
)
);
return
getDataTable
(
list
);
return
getDataTable
(
list
);
}
}
...
...
share-front/src/main/java/share/web/controller/system/SCouponController.java
View file @
8cf074a9
...
@@ -77,12 +77,6 @@ public class SCouponController extends BaseController
...
@@ -77,12 +77,6 @@ public class SCouponController extends BaseController
@PostMapping
@PostMapping
public
AjaxResult
add
(
@RequestBody
SCoupon
sCoupon
)
public
AjaxResult
add
(
@RequestBody
SCoupon
sCoupon
)
{
{
if
(
StringUtils
.
isBlank
(
sCoupon
.
getRoomType
()))
{
sCoupon
.
setRoomType
(
RoomType
.
getCodeList
());
}
if
(
StringUtils
.
isBlank
(
sCoupon
.
getStoreType
()))
{
sCoupon
.
setStoreType
(
StoreType
.
getCodeList
());
}
return
toAjax
(
sCouponService
.
insertSCoupon
(
sCoupon
));
return
toAjax
(
sCouponService
.
insertSCoupon
(
sCoupon
));
}
}
...
...
share-quartz/src/main/java/share/quartz/task/CouponRetryTask.java
0 → 100644
View file @
8cf074a9
package
share
.
quartz
.
task
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.CollectionUtils
;
import
share.common.enums.ConsumerCouponStatusEnum
;
import
share.common.enums.UserStatusEnum
;
import
share.common.enums.YesNoEnum
;
import
share.system.domain.CouponLog
;
import
share.system.domain.SConsumerCoupon
;
import
share.system.domain.SStore
;
import
share.system.service.CouponLogService
;
import
share.system.service.ISConsumerCouponService
;
import
share.system.service.ISStoreService
;
import
share.system.service.QPService
;
import
share.system.service.impl.QPServiceImpl
;
import
java.util.*
;
import
java.util.stream.Collectors
;
@Component
(
"couponRetryTask"
)
public
class
CouponRetryTask
{
@Autowired
private
CouponLogService
couponLogService
;
@Autowired
private
QPService
qpService
;
@Autowired
private
ISStoreService
sStoreService
;
@Autowired
private
ISConsumerCouponService
sConsumerCouponService
;
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
QPServiceImpl
.
class
);
private
static
final
Integer
TRY_NUMBER
=
3
;
public
void
AuToRetryCoupon
()
{
LambdaQueryWrapper
<
SConsumerCoupon
>
consumerCouponWrapper
=
new
LambdaQueryWrapper
<>();
consumerCouponWrapper
.
eq
(
SConsumerCoupon:
:
getUseStatus
,
UserStatusEnum
.
UNUSED
.
getCode
());
List
<
SConsumerCoupon
>
sConsumerCoupons
=
sConsumerCouponService
.
list
(
consumerCouponWrapper
);
List
<
SConsumerCoupon
>
expiredSConsumerCounpons
=
Optional
.
ofNullable
(
sConsumerCoupons
).
orElse
(
new
ArrayList
<>()).
stream
().
filter
(
item
->
{
if
(
item
.
getEndDate
().
compareTo
(
new
Date
())
<
0
)
{
item
.
setUseStatus
(
UserStatusEnum
.
EXPIRED
.
getCode
());
return
true
;
}
return
false
;
}).
collect
(
Collectors
.
toList
());
if
(!
CollectionUtils
.
isEmpty
(
expiredSConsumerCounpons
))
{
sConsumerCouponService
.
updateBatchById
(
expiredSConsumerCounpons
);
}
LambdaQueryWrapper
<
CouponLog
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
CouponLog:
:
getStatus
,
YesNoEnum
.
no
.
getDisplay_3
());
queryWrapper
.
eq
(
CouponLog:
:
getNumber
,
TRY_NUMBER
);
List
<
CouponLog
>
list
=
couponLogService
.
list
(
queryWrapper
);
if
(
CollectionUtils
.
isEmpty
(
list
))
{
return
;
}
//根据code分组
Map
<
String
,
List
<
CouponLog
>>
collect
=
list
.
stream
().
collect
(
Collectors
.
groupingBy
(
CouponLog:
:
getCode
));
//门店id集合
List
<
Long
>
storeIds
=
list
.
stream
().
map
(
CouponLog:
:
getStoreId
).
distinct
().
collect
(
Collectors
.
toList
());
List
<
SStore
>
sStoreList
=
sStoreService
.
listByIds
(
storeIds
);
//遍历Map
collect
.
forEach
((
k
,
v
)
->
{
CouponLog
couponLog
=
v
.
get
(
0
);
SStore
sStore
=
sStoreList
.
stream
().
filter
(
s
->
s
.
getId
().
equals
(
couponLog
.
getStoreId
())).
findFirst
().
get
();
if
(
couponLog
.
getNumber
().
equals
(
TRY_NUMBER
))
{
for
(
int
i
=
0
;
i
<
TRY_NUMBER
;
i
++)
{
try
{
qpService
.
consume
(
couponLog
.
getCode
(),
1
,
sStore
.
getOpenShopUuid
(),
ConsumerCouponStatusEnum
.
TASK
.
getCode
());
}
catch
(
Exception
e
)
{
logger
.
error
(
"验卷失败:{}"
,
e
.
getMessage
());
}
finally
{
couponLog
.
setNumber
(
couponLog
.
getNumber
()
-
1
);
couponLogService
.
updateById
(
couponLog
);
}
}
//根据code批量更新状态
LambdaUpdateWrapper
<
CouponLog
>
updateWrapper
=
new
LambdaUpdateWrapper
<>();
updateWrapper
.
eq
(
CouponLog:
:
getCode
,
k
);
//设置number为0
updateWrapper
.
set
(
CouponLog:
:
getNumber
,
0
);
couponLogService
.
update
(
updateWrapper
);
//更新优惠卷领取状态
SConsumerCoupon
sConsumerCoupon
=
new
SConsumerCoupon
();
sConsumerCoupon
.
setId
(
couponLog
.
getCouponId
());
sConsumerCoupon
.
setUseStatus
(
UserStatusEnum
.
EXPIRED
.
getCode
());
sConsumerCouponService
.
updateById
(
sConsumerCoupon
);
}
});
}
}
share-quartz/src/main/java/share/quartz/task/OrderTask.java
View file @
8cf074a9
...
@@ -215,8 +215,10 @@ public class OrderTask {
...
@@ -215,8 +215,10 @@ public class OrderTask {
// 退优惠券
// 退优惠券
if
(
ObjectUtil
.
isNotNull
(
sOrder
.
getCouponId
()))
{
if
(
ObjectUtil
.
isNotNull
(
sOrder
.
getCouponId
()))
{
SConsumerCoupon
couponUser
=
consumerCouponService
.
getById
(
sOrder
.
getCouponId
());
SConsumerCoupon
couponUser
=
consumerCouponService
.
getById
(
sOrder
.
getCouponId
());
couponUser
.
setUseStatus
(
CouponStatusEnum
.
NORMAL
.
getValue
());
if
(
Objects
.
nonNull
(
couponUser
))
{
consumerCouponService
.
updateById
(
couponUser
);
couponUser
.
setUseStatus
(
CouponStatusEnum
.
NORMAL
.
getValue
());
consumerCouponService
.
updateById
(
couponUser
);
}
}
}
return
true
;
return
true
;
});
});
...
@@ -240,6 +242,12 @@ public class OrderTask {
...
@@ -240,6 +242,12 @@ public class OrderTask {
JSONObject
jsonObject
=
new
JSONObject
(
value
);
JSONObject
jsonObject
=
new
JSONObject
(
value
);
Date
expirationTime
=
jsonObject
.
getDate
(
"expirationTime"
);
Date
expirationTime
=
jsonObject
.
getDate
(
"expirationTime"
);
String
orderNo
=
jsonObject
.
getStr
(
"orderNo"
);
String
orderNo
=
jsonObject
.
getStr
(
"orderNo"
);
SOrder
byOrderNo
=
orderService
.
getByOrderNo
(
String
.
valueOf
(
orderNo
));
if
(
ObjectUtil
.
isEmpty
(
byOrderNo
))
{
redisUtil
.
delete
(
o
);
logger
.
info
(
"订单号为:"
+
jsonObject
.
getStr
(
"orderNo"
)
+
"的订单不存在"
);
return
;
}
//时间到期前10分钟到9分
//时间到期前10分钟到9分
long
expire
=
(
expirationTime
.
getTime
()
-
new
Date
().
getTime
())
/
1000
;
long
expire
=
(
expirationTime
.
getTime
()
-
new
Date
().
getTime
())
/
1000
;
// if (expire < TEN_MINUTES && expire > NINE_MINUTES) {
// if (expire < TEN_MINUTES && expire > NINE_MINUTES) {
...
@@ -248,14 +256,14 @@ public class OrderTask {
...
@@ -248,14 +256,14 @@ public class OrderTask {
// }
// }
//判断时间是否在15分钟到14分钟
//判断时间是否在15分钟到14分钟
if
(
expire
<
FIFTEEN_MINUTES
&&
expire
>
FOURTEEN_MINUTES
)
{
if
(
expire
<
FIFTEEN_MINUTES
&&
expire
>
FOURTEEN_MINUTES
)
{
SOrder
byOrderNo
=
orderService
.
getByOrderNo
(
String
.
valueOf
(
orderNo
));
// SStore sStore = storeService.getById(byOrderNo.getStoreId(
));
SStore
sStore
=
storeService
.
getById
(
byOrderNo
.
getStore
Id
());
// SRoom sRoom = roomService.getById(byOrderNo.getRoom
Id());
SRoom
sRoom
=
roomService
.
getById
(
byOrderNo
.
getRoomId
()
);
// smsService.sendSmsOrderStartRemind(byOrderNo.getConsumerPhone(), sStore, sRoom
);
smsService
.
sendSmsOrderStartRemind
(
byOrderNo
.
getConsumerPhone
(),
sStore
,
sRoom
);
logger
.
info
(
"订单号为:"
+
jsonObject
.
getStr
(
"orderNo"
)
+
"的订单开始预定时间到15分钟"
);
return
;
return
;
}
}
if
(
expirationTime
.
getTime
()
<
new
Date
().
getTime
())
{
if
(
expirationTime
.
getTime
()
<
new
Date
().
getTime
())
{
sOrders
.
add
(
orderService
.
getByOrderNo
(
String
.
valueOf
(
orderNo
))
);
sOrders
.
add
(
byOrderNo
);
}
}
});
});
if
(
CollectionUtils
.
isEmpty
(
sOrders
))
{
if
(
CollectionUtils
.
isEmpty
(
sOrders
))
{
...
...
share-quartz/src/main/java/share/quartz/task/RedisTask.java
View file @
8cf074a9
...
@@ -209,6 +209,7 @@ public class RedisTask {
...
@@ -209,6 +209,7 @@ public class RedisTask {
SOrder
sOrder
=
sOrders
.
stream
().
filter
(
item
->
item
.
getOrderNo
().
equals
(
jsonObject
.
getStr
(
"orderNo"
))).
findFirst
().
orElse
(
null
);
SOrder
sOrder
=
sOrders
.
stream
().
filter
(
item
->
item
.
getOrderNo
().
equals
(
jsonObject
.
getStr
(
"orderNo"
))).
findFirst
().
orElse
(
null
);
if
(
ObjectUtils
.
isEmpty
(
sOrder
))
{
if
(
ObjectUtils
.
isEmpty
(
sOrder
))
{
redisUtil
.
delete
(
o
);
redisUtil
.
delete
(
o
);
logger
.
info
(
"订单号为:"
+
jsonObject
.
getStr
(
"orderNo"
)
+
"的订单不存在"
);
throw
new
BaseException
(
"订单不存在!"
);
throw
new
BaseException
(
"订单不存在!"
);
}
}
long
expire
=
(
expirationTime
.
getTime
()
-
new
Date
().
getTime
())
/
1000
;
long
expire
=
(
expirationTime
.
getTime
()
-
new
Date
().
getTime
())
/
1000
;
...
@@ -218,18 +219,18 @@ public class RedisTask {
...
@@ -218,18 +219,18 @@ public class RedisTask {
deviceOpService
.
actionExecute
(
sOrder
.
getRoomId
(),
sOrder
.
getConsumerPhone
(),
VoiceEnum
.
RENEWAL_REMINDER1
.
getCode
(),
deviceOpService
.
actionExecute
(
sOrder
.
getRoomId
(),
sOrder
.
getConsumerPhone
(),
VoiceEnum
.
RENEWAL_REMINDER1
.
getCode
(),
DateUtil
.
format
(
new
Date
(),
DatePattern
.
NORM_DATETIME_PATTERN
),
DateUtil
.
format
(
new
Date
(),
DatePattern
.
NORM_DATETIME_PATTERN
),
DateUtil
.
format
(
DateUtil
.
offsetMinute
(
new
Date
(),
1
),
DatePattern
.
NORM_DATETIME_PATTERN
),
"1"
);
DateUtil
.
format
(
DateUtil
.
offsetMinute
(
new
Date
(),
1
),
DatePattern
.
NORM_DATETIME_PATTERN
),
"1"
);
logger
.
info
(
"订单号为:"
+
sOrder
.
getOrderNo
()
+
"的订单距离结束时间还有15分钟"
);
//从门店集合中判断门店id相同的门店对象
//从门店集合中判断门店id相同的门店对象
SStore
sStore
=
sStoreList
.
stream
().
filter
(
item
->
item
.
getId
().
equals
(
sOrder
.
getStoreId
())).
findFirst
().
orElse
(
null
);
//
SStore sStore = sStoreList.stream().filter(item -> item.getId().equals(sOrder.getStoreId())).findFirst().orElse(null);
//从房间集合中判断房间id相同的房间对象
//从房间集合中判断房间id相同的房间对象
SRoom
sRoom
=
sRoomList
.
stream
().
filter
(
item
->
item
.
getId
().
equals
(
sOrder
.
getRoomId
())).
findFirst
().
orElse
(
null
);
// SRoom sRoom = sRoomList.stream().filter(item -> item.getId().equals(sOrder.getRoomId())).findFirst().orElse(null);
// smsService.sendSmsCleanRecordsRemind15(byOrderNo.getConsumerPhone(), sStore, sRoom);
//通知用户
//通知用户
smsService
.
sendSmsOrderEndRemind
(
sOrder
.
getConsumerPhone
(),
sStore
,
sRoom
);
//
smsService.sendSmsOrderEndRemind(sOrder.getConsumerPhone(), sStore, sRoom);
//通知保洁人员
//
//通知保洁人员
sConsumerService
.
selectListByStoreId
(
sOrder
.
getStoreId
()).
stream
().
forEach
(
item
->
{
//
sConsumerService.selectListByStoreId(sOrder.getStoreId()).stream().forEach(item -> {
// 循环发送短信提示门店保洁打扫卫生
//
// 循环发送短信提示门店保洁打扫卫生
smsService
.
sendSmsCleanRecordsRemind15
(
item
.
getPhone
(),
sStore
,
sRoom
);
//
smsService.sendSmsCleanRecordsRemind15(item.getPhone(), sStore, sRoom);
});
//
});
return
;
return
;
}
}
//判断时间是否在5分钟到4分钟
//判断时间是否在5分钟到4分钟
...
@@ -238,6 +239,7 @@ public class RedisTask {
...
@@ -238,6 +239,7 @@ public class RedisTask {
deviceOpService
.
actionExecute
(
sOrder
.
getRoomId
(),
sOrder
.
getConsumerPhone
(),
VoiceEnum
.
RENEWAL_REMINDER2
.
getCode
(),
deviceOpService
.
actionExecute
(
sOrder
.
getRoomId
(),
sOrder
.
getConsumerPhone
(),
VoiceEnum
.
RENEWAL_REMINDER2
.
getCode
(),
DateUtil
.
format
(
new
Date
(),
DatePattern
.
NORM_DATETIME_PATTERN
),
DateUtil
.
format
(
new
Date
(),
DatePattern
.
NORM_DATETIME_PATTERN
),
DateUtil
.
format
(
DateUtil
.
offsetMinute
(
new
Date
(),
1
),
DatePattern
.
NORM_DATETIME_PATTERN
),
"1"
);
DateUtil
.
format
(
DateUtil
.
offsetMinute
(
new
Date
(),
1
),
DatePattern
.
NORM_DATETIME_PATTERN
),
"1"
);
logger
.
info
(
"订单号为:"
+
sOrder
.
getOrderNo
()
+
"的订单距离结束时间还有5分钟"
);
}
}
//判断是否过期
//判断是否过期
if
(
expirationTime
.
getTime
()
<
new
Date
().
getTime
())
{
if
(
expirationTime
.
getTime
()
<
new
Date
().
getTime
())
{
...
@@ -268,7 +270,7 @@ public class RedisTask {
...
@@ -268,7 +270,7 @@ public class RedisTask {
DateUtil
.
format
(
DateUtil
.
offsetMinute
(
new
Date
(),
1
),
DatePattern
.
NORM_DATETIME_PATTERN
),
"1"
);
DateUtil
.
format
(
DateUtil
.
offsetMinute
(
new
Date
(),
1
),
DatePattern
.
NORM_DATETIME_PATTERN
),
"1"
);
//延时3分钟断电
//延时3分钟断电
deviceOpService
.
openOrCloseDevice
(
sOrder
.
getRoomId
(),
sOrder
.
getConsumerPhone
(),
OpTypeEnum
.
CUT_ELECTRIC
.
getCode
(),
true
,
THREE_MINUTES
);
deviceOpService
.
openOrCloseDevice
(
sOrder
.
getRoomId
(),
sOrder
.
getConsumerPhone
(),
OpTypeEnum
.
CUT_ELECTRIC
.
getCode
(),
true
,
THREE_MINUTES
);
logger
.
info
(
"订单号为:"
+
sOrder
.
getOrderNo
()
+
"的订单已结束,更改订单状态为已使用"
);
}
}
});
});
...
@@ -289,6 +291,7 @@ public class RedisTask {
...
@@ -289,6 +291,7 @@ public class RedisTask {
//更改订单状态
//更改订单状态
sOrder
.
setStatus
(
OrderStatusEnum
.
USED
.
getCode
());
sOrder
.
setStatus
(
OrderStatusEnum
.
USED
.
getCode
());
isOrderService
.
updateById
(
sOrder
);
isOrderService
.
updateById
(
sOrder
);
logger
.
info
(
"订单号为:"
+
sOrder
.
getOrderNo
()
+
"的订单已有续单,更改订单状态为已使用"
);
return
true
;
return
true
;
}
}
return
false
;
return
false
;
...
...
share-system/src/main/java/share/system/domain/CouponLog.java
View file @
8cf074a9
...
@@ -52,6 +52,12 @@ public class CouponLog extends BaseEntity {
...
@@ -52,6 +52,12 @@ public class CouponLog extends BaseEntity {
private
Long
couponId
;
private
Long
couponId
;
/**
/**
* 数量
*/
@Excel
(
name
=
"数量"
)
private
Integer
number
;
/**
* 优惠券名称
* 优惠券名称
*/
*/
@Excel
(
name
=
"优惠券名称"
)
@Excel
(
name
=
"优惠券名称"
)
...
@@ -81,25 +87,20 @@ public class CouponLog extends BaseEntity {
...
@@ -81,25 +87,20 @@ public class CouponLog extends BaseEntity {
@Excel
(
name
=
"消息"
)
@Excel
(
name
=
"消息"
)
private
String
message
;
private
String
message
;
@Override
@Override
public
String
toString
()
{
public
String
toString
()
{
return
new
ToStringBuilder
(
this
,
ToStringStyle
.
MULTI_LINE_STYLE
)
return
"CouponLog{"
+
.
append
(
"id"
,
getId
())
"id="
+
id
+
.
append
(
"code"
,
getCode
())
", code='"
+
code
+
'\''
+
.
append
(
"consumerId"
,
getConsumerId
())
", consumerId="
+
consumerId
+
.
append
(
"storeId"
,
getStoreId
())
", storeId="
+
storeId
+
.
append
(
"couponId"
,
getCouponId
())
", couponId="
+
couponId
+
.
append
(
"couponName"
,
getCouponName
())
", number="
+
number
+
.
append
(
"couponType"
,
getCouponType
())
", couponName='"
+
couponName
+
'\''
+
.
append
(
"couponValue"
,
getCouponValue
())
", couponType='"
+
couponType
+
'\''
+
.
append
(
"status"
,
getStatus
())
", couponValue="
+
couponValue
+
.
append
(
"message"
,
getMessage
())
", status='"
+
status
+
'\''
+
.
append
(
"createBy"
,
getCreateBy
())
", message='"
+
message
+
'\''
+
.
append
(
"createTime"
,
getCreateTime
())
'}'
;
.
append
(
"updateBy"
,
getUpdateBy
())
.
append
(
"updateTime"
,
getUpdateTime
())
.
append
(
"remark"
,
getRemark
())
.
toString
();
}
}
}
}
share-system/src/main/java/share/system/domain/SConsumerCoupon.java
View file @
8cf074a9
...
@@ -48,6 +48,18 @@ public class SConsumerCoupon extends BaseEntity
...
@@ -48,6 +48,18 @@ public class SConsumerCoupon extends BaseEntity
@Excel
(
name
=
"套餐ID"
)
@Excel
(
name
=
"套餐ID"
)
private
Long
dealId
;
private
Long
dealId
;
/**
* 团购ID
*/
@Excel
(
name
=
"团购ID"
)
private
Long
dealgroupId
;
/**
* 适用门店id
*/
@Excel
(
name
=
"适用门店id"
)
private
String
storeIds
;
/** 优惠券编码 */
/** 优惠券编码 */
@Excel
(
name
=
"优惠券编码"
)
@Excel
(
name
=
"优惠券编码"
)
private
String
couponCode
;
private
String
couponCode
;
...
@@ -143,6 +155,12 @@ public class SConsumerCoupon extends BaseEntity
...
@@ -143,6 +155,12 @@ public class SConsumerCoupon extends BaseEntity
@TableField
(
select
=
false
)
@TableField
(
select
=
false
)
private
Integer
isDelete
;
private
Integer
isDelete
;
/**
* 适用星期列表(1:周一,2:周二,3:周三,4:周四,5:周五,6:周六,7:周日)
*/
@Excel
(
name
=
"适用星期列表"
)
private
String
weeks
;
/** 更新者 */
/** 更新者 */
@Excel
(
name
=
"更新者"
)
@Excel
(
name
=
"更新者"
)
private
String
deleteBy
;
private
String
deleteBy
;
...
@@ -164,4 +182,16 @@ public class SConsumerCoupon extends BaseEntity
...
@@ -164,4 +182,16 @@ public class SConsumerCoupon extends BaseEntity
*/
*/
@TableField
(
select
=
false
)
@TableField
(
select
=
false
)
private
String
reason
;
private
String
reason
;
/**
* 手机号
*/
@TableField
(
select
=
false
)
private
String
phone
;
/**
* 昵称
*/
@TableField
(
select
=
false
)
private
String
nickName
;
}
}
share-system/src/main/java/share/system/domain/SCoupon.java
View file @
8cf074a9
...
@@ -95,11 +95,29 @@ public class SCoupon extends BaseEntity
...
@@ -95,11 +95,29 @@ public class SCoupon extends BaseEntity
@Excel
(
name
=
"绑定套餐ID"
)
@Excel
(
name
=
"绑定套餐ID"
)
private
Long
packageId
;
private
Long
packageId
;
/**
* 团购ID
*/
@Excel
(
name
=
"团购ID"
)
private
Long
dealgroupId
;
/**
* 适用门店id
*/
@Excel
(
name
=
"适用门店id"
)
private
String
storeIds
;
/** 是否可叠加使用(0:不可叠加,1:可叠加) */
/** 是否可叠加使用(0:不可叠加,1:可叠加) */
@Excel
(
name
=
"是否可叠加使用(0:不可叠加,1:可叠加)"
)
@Excel
(
name
=
"是否可叠加使用(0:不可叠加,1:可叠加)"
)
private
Integer
isOverlay
;
private
Integer
isOverlay
;
/**
/**
* 适用星期列表(1:周一,2:周二,3:周三,4:周四,5:周五,6:周六,7:周日)
*/
@Excel
(
name
=
"适用星期列表"
)
private
String
weeks
;
/**
* 第三方平台类型(1:自营,2:美团)
* 第三方平台类型(1:自营,2:美团)
*/
*/
@Excel
(
name
=
"第三方平台类型(1:自营,2:美团)"
)
@Excel
(
name
=
"第三方平台类型(1:自营,2:美团)"
)
...
...
share-system/src/main/java/share/system/domain/vo/OrderVo.java
0 → 100644
View file @
8cf074a9
package
share
.
system
.
domain
.
vo
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.Date
;
@Data
public
class
OrderVo
{
/**
* 订单编号
*/
private
String
orderNo
;
/**
* 支付类型(1:微信,2:支付宝)
*/
private
Integer
payType
;
/**
* 支付时间
*/
private
Date
payTime
;
/**
* 订单时长
*/
private
String
timeLong
;
/**
* 预约开始时间
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm"
)
private
Date
preStartDate
;
/**
* 预约结束时间
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm"
)
private
Date
preEndDate
;
/**
* 开始时间
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm"
)
private
Date
startDate
;
/**
* 结束时间
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm"
)
private
Date
endDate
;
/**
* 门店名称
*/
private
String
storeName
;
/**
* 房间名称
*/
private
String
roomName
;
//房间图片
private
String
roomImages
;
//房间类型
private
String
roomType
;
//房间类型名称
private
String
roomTypeName
;
/**
* 门店地址
*/
private
String
address
;
/**
* 经度
*/
private
String
longitude
;
/**
* 纬度
*/
private
String
latitude
;
//是否可以申请退款
private
Boolean
isRefund
;
//套餐名称
private
String
packName
;
//优惠卷名称
private
String
couponName
;
//订单状态
private
Integer
orderType
;
/**
* 创建时间
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
createTime
;
/**
* 更新时间
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
updateTime
;
private
Integer
status
;
}
share-system/src/main/java/share/system/mapper/SCouponMapper.java
View file @
8cf074a9
...
@@ -62,4 +62,10 @@ public interface SCouponMapper
...
@@ -62,4 +62,10 @@ public interface SCouponMapper
List
<
SCoupon
>
selectSCouponByName
(
String
dealTitle
);
List
<
SCoupon
>
selectSCouponByName
(
String
dealTitle
);
List
<
SCoupon
>
selectSCouponByIds
(
Long
[]
couponIds
);
List
<
SCoupon
>
selectSCouponByIds
(
Long
[]
couponIds
);
List
<
SCoupon
>
listDuration
(
SCoupon
sCoupon
);
List
<
SCoupon
>
selectSCouponByDealgroupId
(
Long
dealgroupId
);
SCoupon
selectByDealgroupId
(
Long
dealgroupId
);
}
}
share-system/src/main/java/share/system/request/CouponRequest.java
View file @
8cf074a9
...
@@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModelProperty;
...
@@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModelProperty;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
lombok.experimental.Accessors
;
import
share.common.annotation.Excel
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotEmpty
;
import
javax.validation.constraints.NotEmpty
;
...
@@ -29,6 +30,13 @@ public class CouponRequest {
...
@@ -29,6 +30,13 @@ public class CouponRequest {
@NotNull
(
message
=
"下单模式不能为空"
)
@NotNull
(
message
=
"下单模式不能为空"
)
private
Integer
orderMode
;
private
Integer
orderMode
;
@ApiModelProperty
(
value
=
"下单类型(1:预定,2:续单)"
,
required
=
true
)
@NotNull
(
message
=
"下单类型不能为空"
)
private
Integer
orderType
;
@ApiModelProperty
(
value
=
"套餐ID"
)
private
Long
packageId
;
/**
/**
* 预约开始时间
* 预约开始时间
*/
*/
...
...
share-system/src/main/java/share/system/service/ISConsumerCouponService.java
View file @
8cf074a9
...
@@ -28,6 +28,13 @@ public interface ISConsumerCouponService extends IService<SConsumerCoupon>
...
@@ -28,6 +28,13 @@ public interface ISConsumerCouponService extends IService<SConsumerCoupon>
* @return 优惠券领取记录集合
* @return 优惠券领取记录集合
*/
*/
public
List
<
SConsumerCoupon
>
selectSConsumerCouponList
(
SConsumerCoupon
sConsumerCoupon
);
public
List
<
SConsumerCoupon
>
selectSConsumerCouponList
(
SConsumerCoupon
sConsumerCoupon
);
/**
* 查询优惠券领取记录列表
*
* @param useStatus 优惠券领取记录
* @return 优惠券领取记录集合
*/
public
List
<
SConsumerCoupon
>
listByUseStatus
(
Integer
useStatus
);
/**
/**
* 新增优惠券领取记录
* 新增优惠券领取记录
...
...
share-system/src/main/java/share/system/service/ISConsumptionRecordsService.java
View file @
8cf074a9
...
@@ -2,6 +2,7 @@ package share.system.service;
...
@@ -2,6 +2,7 @@ package share.system.service;
import
java.util.List
;
import
java.util.List
;
import
share.system.domain.SConsumptionRecords
;
import
share.system.domain.SConsumptionRecords
;
import
share.system.domain.SOrder
;
import
share.system.domain.vo.SConsumptionRecordsVo
;
import
share.system.domain.vo.SConsumptionRecordsVo
;
/**
/**
...
@@ -37,6 +38,13 @@ public interface ISConsumptionRecordsService
...
@@ -37,6 +38,13 @@ public interface ISConsumptionRecordsService
public
int
insertSConsumptionRecords
(
SConsumptionRecords
sConsumptionRecords
);
public
int
insertSConsumptionRecords
(
SConsumptionRecords
sConsumptionRecords
);
/**
/**
* 新增消费记录
*
* @param sOrder 消费记录
* @return 结果
*/
public
int
insertSConsumptionRecords
(
SOrder
sOrder
);
/**
* 修改消费记录
* 修改消费记录
*
*
* @param sConsumptionRecords 消费记录
* @param sConsumptionRecords 消费记录
...
...
share-system/src/main/java/share/system/service/ISCouponService.java
View file @
8cf074a9
...
@@ -67,4 +67,10 @@ public interface ISCouponService
...
@@ -67,4 +67,10 @@ public interface ISCouponService
List
<
SCoupon
>
selectSCouponByName
(
String
dealTitle
);
List
<
SCoupon
>
selectSCouponByName
(
String
dealTitle
);
List
<
SCoupon
>
selectSCouponByIds
(
Long
[]
couponIds
);
List
<
SCoupon
>
selectSCouponByIds
(
Long
[]
couponIds
);
List
<
SCoupon
>
queryShopDeal
();
List
<
SCoupon
>
listDuration
(
SCoupon
sCoupon
);
List
<
SCoupon
>
selectSCouponByDealgroupId
(
Long
dealgroupId
);
}
}
share-system/src/main/java/share/system/service/ISOrderService.java
View file @
8cf074a9
...
@@ -4,7 +4,9 @@ import java.util.Date;
...
@@ -4,7 +4,9 @@ import java.util.Date;
import
java.util.List
;
import
java.util.List
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
share.system.domain.SConsumerCoupon
;
import
share.system.domain.SOrder
;
import
share.system.domain.SOrder
;
import
share.system.domain.vo.OrderVo
;
import
share.system.domain.vo.SOrderVo
;
import
share.system.domain.vo.SOrderVo
;
import
share.system.request.CreateOrderRequest
;
import
share.system.request.CreateOrderRequest
;
import
share.system.request.OrderComputedPriceRequest
;
import
share.system.request.OrderComputedPriceRequest
;
...
@@ -171,4 +173,11 @@ public interface ISOrderService extends IService<SOrder>
...
@@ -171,4 +173,11 @@ public interface ISOrderService extends IService<SOrder>
* @return
* @return
*/
*/
List
<
SOrder
>
payedUnrefundListByUserId
(
Long
userId
);
List
<
SOrder
>
payedUnrefundListByUserId
(
Long
userId
);
boolean
isRefund
(
SOrderVo
orderVo
,
SConsumerCoupon
coupon
);
boolean
isRefund
(
SOrder
order
,
SConsumerCoupon
coupon
);
}
}
share-system/src/main/java/share/system/service/OpenInterfaceService.java
0 → 100644
View file @
8cf074a9
package
share
.
system
.
service
;
import
share.system.domain.vo.OrderVo
;
public
interface
OpenInterfaceService
{
OrderVo
orderInfo
(
String
orderNo
);
String
openDoor
(
String
orderNo
);
}
share-system/src/main/java/share/system/service/impl/OpenInterfaceServiceImpl.java
0 → 100644
View file @
8cf074a9
package
share
.
system
.
service
.
impl
;
import
cn.hutool.core.util.ObjectUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
share.common.enums.DeviceType
;
import
share.common.enums.RoomType
;
import
share.common.exception.base.BaseException
;
import
share.common.utils.bean.BeanUtils
;
import
share.system.domain.*
;
import
share.system.domain.vo.OrderVo
;
import
share.system.domain.vo.SRoomVo
;
import
share.system.service.*
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.stream.Collectors
;
@Service
public
class
OpenInterfaceServiceImpl
implements
OpenInterfaceService
{
@Autowired
private
ISConsumerCouponService
consumerCouponService
;
@Autowired
private
ISStoreService
storeService
;
@Autowired
private
ISRoomService
roomService
;
@Autowired
private
ISOrderService
orderService
;
@Autowired
private
IPackService
packService
;
@Autowired
private
DeviceService
deviceService
;
@Autowired
private
DeviceOpService
deviceOpService
;
@Override
public
OrderVo
orderInfo
(
String
orderNo
)
{
SOrder
en
=
orderService
.
getByOrderNo
(
orderNo
);
OrderVo
vo
=
new
OrderVo
();
BeanUtils
.
copyProperties
(
en
,
vo
);
SStore
store
=
storeService
.
getById
(
en
.
getStoreId
());
SRoom
room
=
roomService
.
getById
(
en
.
getRoomId
());
vo
.
setStoreName
(
store
.
getName
());
vo
.
setAddress
(
store
.
getAddress
());
vo
.
setRoomImages
(
room
.
getImages
());
vo
.
setRoomName
(
room
.
getName
());
vo
.
setRoomType
(
room
.
getRoomType
());
vo
.
setRoomTypeName
(
RoomType
.
getNameByCode
(
room
.
getRoomType
()));
vo
.
setLongitude
(
store
.
getLongitude
());
vo
.
setLatitude
(
store
.
getLatitude
());
if
(
ObjectUtil
.
isNotEmpty
(
en
.
getCouponId
()))
{
SConsumerCoupon
consumerCoupon
=
consumerCouponService
.
getById
(
en
.
getCouponId
());
vo
.
setCouponName
(
consumerCoupon
.
getName
());
// 判断是否可以退款
vo
.
setIsRefund
(
orderService
.
isRefund
(
en
,
consumerCoupon
));
}
else
{
// 判断是否可以退款
vo
.
setIsRefund
(
orderService
.
isRefund
(
en
,
null
));
}
if
(
ObjectUtil
.
isNotEmpty
(
en
.
getPackId
()))
{
SPack
byId
=
packService
.
getById
(
en
.
getPackId
());
vo
.
setPackName
(
byId
.
getName
());
}
return
vo
;
}
@Override
public
String
openDoor
(
String
orderNo
)
{
LambdaQueryWrapper
<
SOrder
>
orderLambdaQueryWrapper
=
new
LambdaQueryWrapper
<>();
orderLambdaQueryWrapper
.
eq
(
SOrder:
:
getOrderNo
,
orderNo
);
SOrder
sOrder
=
orderService
.
getOne
(
orderLambdaQueryWrapper
);
if
(
Objects
.
isNull
(
sOrder
))
{
throw
new
BaseException
(
"订单不存在!"
);
}
SRoomVo
sRoomVo
=
roomService
.
selectSRoomById
(
sOrder
.
getRoomId
());
if
(
Objects
.
isNull
(
sRoomVo
))
{
throw
new
BaseException
(
"房间不存在!"
);
}
LambdaQueryWrapper
<
Device
>
deviceLambdaQueryWrapper
=
new
LambdaQueryWrapper
<>();
deviceLambdaQueryWrapper
.
eq
(
Device:
:
getRoomId
,
sOrder
.
getRoomId
());
deviceLambdaQueryWrapper
.
in
(
Device:
:
getDevType
,
DeviceType
.
DEVICE_CCEE
.
getCode
(),
DeviceType
.
DEVICE_0001
.
getCode
());
List
<
Device
>
deviceList
=
deviceService
.
list
(
deviceLambdaQueryWrapper
);
if
(
CollectionUtils
.
isEmpty
(
deviceList
))
{
throw
new
BaseException
(
"房间设备缺失!"
);
}
if
(
deviceList
.
stream
().
filter
(
device
->
device
.
getDevType
().
equals
(
DeviceType
.
DEVICE_CCEE
.
getCode
())
).
collect
(
Collectors
.
toList
()).
isEmpty
())
{
throw
new
BaseException
(
"房间门锁设备不存在!"
);
}
if
(
deviceList
.
stream
().
filter
(
item
->
item
.
getDevType
().
equals
(
DeviceType
.
DEVICE_0001
.
getCode
())
).
collect
(
Collectors
.
toList
()).
isEmpty
())
{
throw
new
BaseException
(
"房间取电设备不存在!"
);
}
deviceOpService
.
openDoor
(
sRoomVo
.
getId
(),
sOrder
.
getConsumerPhone
());
return
"开锁成功"
;
}
}
share-system/src/main/java/share/system/service/impl/QPServiceImpl.java
View file @
8cf074a9
...
@@ -81,13 +81,17 @@ public class QPServiceImpl implements QPService {
...
@@ -81,13 +81,17 @@ public class QPServiceImpl implements QPService {
//默认门槛金额
//默认门槛金额
private
static
final
BigDecimal
DEFAULT_MIN_PRICE
=
BigDecimal
.
valueOf
(
0.00
);
private
static
final
BigDecimal
DEFAULT_MIN_PRICE
=
BigDecimal
.
valueOf
(
0.00
);
private
static
final
String
ACCOUNT
=
"13888888888"
;
private
static
final
String
NAME
=
"管理人员"
;
/**
/**
* 用户验卷接口
* 用户验卷接口
*/
*/
@Override
@Override
public
TuangouReceiptPrepareResponseEntityVo
consumeByUser
(
String
code
,
String
openShopUuid
,
String
status
)
{
public
TuangouReceiptPrepareResponseEntityVo
consumeByUser
(
String
code
,
String
openShopUuid
,
String
status
)
{
//验券准备
//验券准备
TuangouReceiptPrepareResponseEntity
prepare
=
prepare
(
code
,
openShopUuid
,
status
);
TuangouReceiptPrepareResponseEntity
prepare
=
prepare
(
code
.
trim
()
,
openShopUuid
,
status
);
//获取用户信息
//获取用户信息
SConsumer
user
=
FrontTokenComponent
.
getWxSConsumerEntry
();
SConsumer
user
=
FrontTokenComponent
.
getWxSConsumerEntry
();
//查询领取记录表
//查询领取记录表
...
@@ -99,6 +103,12 @@ public class QPServiceImpl implements QPService {
...
@@ -99,6 +103,12 @@ public class QPServiceImpl implements QPService {
LambdaQueryWrapper
<
SStore
>
sStoreLambdaQueryWrapper
=
new
LambdaQueryWrapper
<>();
LambdaQueryWrapper
<
SStore
>
sStoreLambdaQueryWrapper
=
new
LambdaQueryWrapper
<>();
sStoreLambdaQueryWrapper
.
eq
(
SStore:
:
getOpenShopUuid
,
openShopUuid
);
sStoreLambdaQueryWrapper
.
eq
(
SStore:
:
getOpenShopUuid
,
openShopUuid
);
SStore
sStore
=
storeService
.
getOne
(
sStoreLambdaQueryWrapper
);
SStore
sStore
=
storeService
.
getOne
(
sStoreLambdaQueryWrapper
);
if
(
ObjectUtils
.
isEmpty
(
sStore
))
{
throw
new
RuntimeException
(
"门店不存在"
);
}
if
(
sStore
.
getStatus
().
equals
(
StoreStatusEnum
.
STOP
.
getIndex
()))
{
throw
new
RuntimeException
(
"门店已停止"
);
}
if
(
ObjectUtils
.
isNotEmpty
(
couponTwo
))
{
if
(
ObjectUtils
.
isNotEmpty
(
couponTwo
))
{
//判断是否本人领取过
//判断是否本人领取过
if
(
couponTwo
.
getConsumerId
().
equals
(
user
.
getId
()))
{
if
(
couponTwo
.
getConsumerId
().
equals
(
user
.
getId
()))
{
...
@@ -114,8 +124,8 @@ public class QPServiceImpl implements QPService {
...
@@ -114,8 +124,8 @@ public class QPServiceImpl implements QPService {
TuangouReceiptPrepareResponseEntityVo
response
=
new
TuangouReceiptPrepareResponseEntityVo
();
TuangouReceiptPrepareResponseEntityVo
response
=
new
TuangouReceiptPrepareResponseEntityVo
();
SConsumerCoupon
sConsumerCoupon
=
new
SConsumerCoupon
();
SConsumerCoupon
sConsumerCoupon
=
new
SConsumerCoupon
();
sConsumerCoupon
.
setConsumerId
(
user
.
getId
());
sConsumerCoupon
.
setConsumerId
(
user
.
getId
());
sConsumerCoupon
.
setStoreId
(
sStore
.
getId
());
sConsumerCoupon
.
setDealId
(
prepare
.
getDeal_id
());
sConsumerCoupon
.
setDealId
(
prepare
.
getDeal_id
());
sConsumerCoupon
.
setStoreId
(
sStore
.
getId
());
sConsumerCoupon
.
setCouponCode
(
code
);
sConsumerCoupon
.
setCouponCode
(
code
);
sConsumerCoupon
.
setName
(
prepare
.
getDeal_title
());
sConsumerCoupon
.
setName
(
prepare
.
getDeal_title
());
sConsumerCoupon
.
setSourceType
(
SourceTypeEnum
.
CHECK
.
getCode
());
sConsumerCoupon
.
setSourceType
(
SourceTypeEnum
.
CHECK
.
getCode
());
...
@@ -141,10 +151,10 @@ public class QPServiceImpl implements QPService {
...
@@ -141,10 +151,10 @@ public class QPServiceImpl implements QPService {
}
}
});
});
List
<
SCoupon
>
sCoupons
=
isCouponService
.
selectSCouponBy
Name
(
prepare
.
getDeal_title
());
List
<
SCoupon
>
sCoupons
=
isCouponService
.
selectSCouponBy
DealgroupId
(
prepare
.
getDealgroup_id
());
SCoupon
sCoupon
=
null
;
SCoupon
sCoupon
=
null
;
if
(!
CollectionUtils
.
isEmpty
(
sCoupons
))
{
if
(!
CollectionUtils
.
isEmpty
(
sCoupons
))
{
sCoupon
=
isCouponService
.
selectSCouponByName
(
prepare
.
getDeal_title
())
.
get
(
0
);
sCoupon
=
sCoupons
.
get
(
0
);
}
}
if
(
ObjectUtils
.
isEmpty
(
sCoupon
))
{
if
(
ObjectUtils
.
isEmpty
(
sCoupon
))
{
sConsumerCoupon
.
setCouponType
(
CouponTypeEnum
.
CASH
.
getCode
());
sConsumerCoupon
.
setCouponType
(
CouponTypeEnum
.
CASH
.
getCode
());
...
@@ -169,7 +179,10 @@ public class QPServiceImpl implements QPService {
...
@@ -169,7 +179,10 @@ public class QPServiceImpl implements QPService {
sConsumerCoupon
.
setCouponTimeStart
(
sCoupon
.
getValidStartTime
());
sConsumerCoupon
.
setCouponTimeStart
(
sCoupon
.
getValidStartTime
());
sConsumerCoupon
.
setCouponTimeEnd
(
sCoupon
.
getValidEndTime
());
sConsumerCoupon
.
setCouponTimeEnd
(
sCoupon
.
getValidEndTime
());
sConsumerCoupon
.
setOrderType
(
sCoupon
.
getOrderType
());
sConsumerCoupon
.
setOrderType
(
sCoupon
.
getOrderType
());
sConsumerCoupon
.
setDealgroupId
(
sCoupon
.
getDealgroupId
());
sConsumerCoupon
.
setStoreIds
(
sCoupon
.
getStoreIds
());
sConsumerCoupon
.
setPackageId
(
sCoupon
.
getPackageId
());
sConsumerCoupon
.
setPackageId
(
sCoupon
.
getPackageId
());
sConsumerCoupon
.
setWeeks
(
sCoupon
.
getWeeks
());
sConsumerCoupon
.
setRemark
(
sCoupon
.
getRemark
());
sConsumerCoupon
.
setRemark
(
sCoupon
.
getRemark
());
}
}
isConsumerCouponService
.
insertSConsumerCoupon
(
sConsumerCoupon
);
isConsumerCouponService
.
insertSConsumerCoupon
(
sConsumerCoupon
);
...
@@ -253,12 +266,19 @@ public class QPServiceImpl implements QPService {
...
@@ -253,12 +266,19 @@ public class QPServiceImpl implements QPService {
String
session
=
(
String
)
sessionKey
.
get
(
"access_token"
);
String
session
=
(
String
)
sessionKey
.
get
(
"access_token"
);
SConsumer
user
=
FrontTokenComponent
.
getWxSConsumerEntry
();
SConsumer
user
=
FrontTokenComponent
.
getWxSConsumerEntry
();
String
requestid
=
UUID
.
randomUUID
().
toString
();
String
requestid
=
UUID
.
randomUUID
().
toString
();
TuangouReceiptConsumeRequest
request
=
new
TuangouReceiptConsumeRequest
(
APP_KEY
,
APP_SECRET
,
session
,
TuangouReceiptConsumeRequest
request
=
null
;
requestid
,
code
,
count
,
""
,
user
.
getAccount
(),
user
.
getNickName
(),
openShopUuid
);
if
(
ObjectUtils
.
isEmpty
(
user
))
{
request
=
new
TuangouReceiptConsumeRequest
(
APP_KEY
,
APP_SECRET
,
session
,
requestid
,
code
,
count
,
""
,
ACCOUNT
,
NAME
,
openShopUuid
);
}
else
{
request
=
new
TuangouReceiptConsumeRequest
(
APP_KEY
,
APP_SECRET
,
session
,
requestid
,
code
,
count
,
""
,
user
.
getAccount
(),
user
.
getNickName
(),
openShopUuid
);
}
DefaultOpenAPIClient
openAPIClient
=
new
DefaultOpenAPIClient
();
DefaultOpenAPIClient
openAPIClient
=
new
DefaultOpenAPIClient
();
TuangouReceiptConsume
tuangouReceiptConsume
=
new
TuangouReceiptConsume
(
request
);
TuangouReceiptConsume
tuangouReceiptConsume
=
new
TuangouReceiptConsume
(
request
);
TuangouReceiptConsumeResponse
invoke
=
openAPIClient
.
invoke
(
tuangouReceiptConsume
);
TuangouReceiptConsumeResponse
invoke
=
openAPIClient
.
invoke
(
tuangouReceiptConsume
);
if
(
invoke
.
getCode
()
!=
200
)
{
if
(
invoke
.
getCode
()
!=
200
)
{
redisUtil
.
delete
(
ReceiptRdeisEnum
.
PREPARE
.
getValue
()
+
code
);
logger
.
error
(
"验卷失败:{}"
,
invoke
.
getMsg
());
logger
.
error
(
"验卷失败:{}"
,
invoke
.
getMsg
());
throw
new
RuntimeException
(
invoke
.
getMsg
());
throw
new
RuntimeException
(
invoke
.
getMsg
());
}
}
...
@@ -339,8 +359,9 @@ public class QPServiceImpl implements QPService {
...
@@ -339,8 +359,9 @@ public class QPServiceImpl implements QPService {
TuangouDealQueryShopDeal
tuangouDealQueryShopDeal
=
new
TuangouDealQueryShopDeal
(
request
);
TuangouDealQueryShopDeal
tuangouDealQueryShopDeal
=
new
TuangouDealQueryShopDeal
(
request
);
TuangouDealQueryShopDealResponse
response
=
openAPIClient
.
invoke
(
tuangouDealQueryShopDeal
);
TuangouDealQueryShopDealResponse
response
=
openAPIClient
.
invoke
(
tuangouDealQueryShopDeal
);
if
(
response
.
getCode
()
!=
200
)
{
if
(
response
.
getCode
()
!=
200
)
{
throw
new
RuntimeException
(
response
.
getMsg
());
logger
.
error
(
"门店团购信息:{}"
,
response
.
getMsg
());
}
}
logger
.
error
(
"门店团购信息:{}"
,
response
.
getData
());
return
response
.
getData
();
return
response
.
getData
();
}
}
...
@@ -386,10 +407,13 @@ public class QPServiceImpl implements QPService {
...
@@ -386,10 +407,13 @@ public class QPServiceImpl implements QPService {
JSONObject
sessionKey
=
new
JSONObject
(
o
);
JSONObject
sessionKey
=
new
JSONObject
(
o
);
String
session
=
(
String
)
sessionKey
.
get
(
"access_token"
);
String
session
=
(
String
)
sessionKey
.
get
(
"access_token"
);
String
bid
=
(
String
)
sessionKey
.
get
(
"bid"
);
String
bid
=
(
String
)
sessionKey
.
get
(
"bid"
);
// CustomerKeyShopScopeRequest request = new CustomerKeyShopScopeRequest(APP_KEY, APP_SECRET, "13ff8a38219075fafbbdeea6839450ed6bea1b9b","f1fd23c1c413862137b895bdcfc10ef8");
CustomerKeyShopScopeRequest
request
=
new
CustomerKeyShopScopeRequest
(
APP_KEY
,
APP_SECRET
,
session
,
bid
);
CustomerKeyShopScopeRequest
request
=
new
CustomerKeyShopScopeRequest
(
APP_KEY
,
APP_SECRET
,
session
,
bid
);
CustomerKeyShopScopeQuery
shopScopeQuery
=
new
CustomerKeyShopScopeQuery
(
request
);
CustomerKeyShopScopeQuery
shopScopeQuery
=
new
CustomerKeyShopScopeQuery
(
request
);
CustomerKeyShopScopeResponse
response
=
openAPIClient
.
invoke
(
shopScopeQuery
);
CustomerKeyShopScopeResponse
response
=
openAPIClient
.
invoke
(
shopScopeQuery
);
if
(
response
.
getCode
()
!=
200
)
{
logger
.
error
(
"适用店铺查询接口:{}"
,
response
.
getMsg
());
throw
new
RuntimeException
(
response
.
getMsg
());
}
return
response
.
getData
();
return
response
.
getData
();
}
}
...
...
share-system/src/main/java/share/system/service/impl/RoomStatusServiceImpl.java
View file @
8cf074a9
...
@@ -87,47 +87,68 @@ public class RoomStatusServiceImpl implements RoomStatusService {
...
@@ -87,47 +87,68 @@ public class RoomStatusServiceImpl implements RoomStatusService {
//设置时间段房间可预约状态(可预约:大于营业开始时间,小于营业结束时间,大于当前时间,当前时间没有订单)
//设置时间段房间可预约状态(可预约:大于营业开始时间,小于营业结束时间,大于当前时间,当前时间没有订单)
private
void
setTimeHourStatus
(
RoomStatusVo
vo
,
Date
timeHourDate
,
SStore
store
,
List
<
SOrder
>
orderList
,
String
day
,
String
finalNowTime
,
Boolean
isToday
,
Integer
orderType
){
private
void
setTimeHourStatus
(
RoomStatusVo
vo
,
Date
timeHourDate
,
SStore
store
,
List
<
SOrder
>
orderList
,
String
day
,
String
finalNowTime
,
Boolean
isToday
,
Integer
orderType
){
vo
.
setStatus
(
RoomStatusEnum
.
FREE
.
getValue
());
vo
.
setStatus
(
RoomStatusEnum
.
FREE
.
getValue
());
checkTimeHourToSysDate
(
vo
,
timeHourDate
,
day
,
finalNowTime
,
isToday
);
checkTimeHourToBusiness
(
vo
,
timeHourDate
,
store
,
day
);
checkTimeHourToOrder
(
vo
,
timeHourDate
,
orderList
,
orderType
);
}
private
void
changeEndHoldTime
(
RoomStatusVo
vo
,
Date
date
){
if
(
Objects
.
isNull
(
vo
.
getEndHoldTime
())||
vo
.
getEndHoldTime
().
compareTo
(
date
)<
0
){
vo
.
setEndHoldTime
(
date
);
}
}
private
void
changeStartHoldTime
(
RoomStatusVo
vo
,
Date
date
){
if
(
Objects
.
isNull
(
vo
.
getStartHoldTime
())||
vo
.
getStartHoldTime
().
compareTo
(
date
)>
0
){
vo
.
setStartHoldTime
(
date
);
}
}
private
void
checkTimeHourToBusiness
(
RoomStatusVo
vo
,
Date
timeHourDate
,
SStore
store
,
String
day
){
//门店存在营业时间
//门店存在营业时间
if
(
StringUtils
.
isNotBlank
(
store
.
getOpenStartTime
()))
{
if
(
StringUtils
.
isNotBlank
(
store
.
getOpenStartTime
()))
{
//当前时段小于营业开始时间
//当前时段小于营业开始时间
if
(
timeHourDate
.
compareTo
(
DateUtils
.
parseDate
(
day
+
" "
+
store
.
getOpenStartTime
()))
==
-
1
)
{
if
(
timeHourDate
.
compareTo
(
DateUtils
.
parseDate
(
day
+
" "
+
store
.
getOpenStartTime
()))
==
-
1
)
{
vo
.
setStatus
(
RoomStatusEnum
.
HOLD
.
getValue
());
vo
.
setStatus
(
RoomStatusEnum
.
HOLD
.
getValue
());
vo
.
setStartHoldTime
(
timeHourDate
);
changeStartHoldTime
(
vo
,
timeHourDate
);
//判断是否是同一个小时,如果是同一个小时,占用结束时间为营业开始时间
//判断是否是同一个小时,如果是同一个小时,占用结束时间为营业开始时间
if
(
timeHourDate
.
compareTo
(
DateUtils
.
parseDate
(
day
+
" "
+
store
.
getOpenStartTime
().
split
(
":"
)[
0
]))
==
0
)
{
if
(
timeHourDate
.
compareTo
(
DateUtils
.
parseDate
(
day
+
" "
+
store
.
getOpenStartTime
().
split
(
":"
)[
0
]))
==
0
)
{
vo
.
setEndHoldTime
(
DateUtils
.
parseDate
(
day
+
" "
+
store
.
getOpenStartTime
()));
changeEndHoldTime
(
vo
,
DateUtils
.
parseDate
(
day
+
" "
+
store
.
getOpenStartTime
()));
}
else
{
}
else
{
//占用结束时间为当前时段59分59秒
//占用结束时间为当前时段59分59秒
vo
.
setEndHoldTime
(
DateUtils
.
addSeconds
(
timeHourDate
,
59
*
60
+
59
));
changeEndHoldTime
(
vo
,
DateUtils
.
addSeconds
(
timeHourDate
,
59
*
60
+
59
));
}
}
}
}
//当前时段大于营业结束时间
//当前时段大于营业结束时间
if
(
timeHourDate
.
compareTo
(
DateUtils
.
parseDate
(
day
+
" "
+
store
.
getOpenEndTime
()))
==
1
&&
!
StringUtils
.
equals
(
store
.
getOpenStartTime
(),
"00:00"
))
{
if
(
timeHourDate
.
compareTo
(
DateUtils
.
parseDate
(
day
+
" "
+
store
.
getOpenEndTime
()))
==
1
&&
!
StringUtils
.
equals
(
store
.
getOpenStartTime
(),
"00:00"
))
{
vo
.
setStatus
(
RoomStatusEnum
.
HOLD
.
getValue
());
vo
.
setStatus
(
RoomStatusEnum
.
HOLD
.
getValue
());
//占用结束时间为当前时段59分59秒
//占用结束时间为当前时段59分59秒
vo
.
setEndHoldTime
(
DateUtils
.
addSeconds
(
timeHourDate
,
59
*
60
+
59
));
changeEndHoldTime
(
vo
,
DateUtils
.
addSeconds
(
timeHourDate
,
59
*
60
+
59
));
//判断是否是同一个小时,如果是同一个小时,占用开始时间为营业结束时间
//判断是否是同一个小时,如果是同一个小时,占用开始时间为营业结束时间
if
(
timeHourDate
.
compareTo
(
DateUtils
.
parseDate
(
day
+
" "
+
store
.
getOpenEndTime
().
split
(
":"
)[
0
]))
==
0
)
{
if
(
timeHourDate
.
compareTo
(
DateUtils
.
parseDate
(
day
+
" "
+
store
.
getOpenEndTime
().
split
(
":"
)[
0
]))
==
0
)
{
vo
.
setStartHoldTime
(
DateUtils
.
parseDate
(
day
+
" "
+
store
.
getOpenEndTime
()));
changeStartHoldTime
(
vo
,
DateUtils
.
parseDate
(
day
+
" "
+
store
.
getOpenEndTime
()));
}
else
{
}
else
{
//占用开始时间为当前时段0分0秒
//占用开始时间为当前时段0分0秒
vo
.
setStartHoldTime
(
timeHourDate
);
changeStartHoldTime
(
vo
,
timeHourDate
);
}
}
}
}
}
}
}
private
void
checkTimeHourToSysDate
(
RoomStatusVo
vo
,
Date
timeHourDate
,
String
day
,
String
finalNowTime
,
Boolean
isToday
){
//当前时段小于当前时间
//当前时段小于当前时间
if
(
isToday
&&
timeHourDate
.
compareTo
(
DateUtils
.
parseDate
(
day
+
" "
+
finalNowTime
))==-
1
){
if
(
isToday
&&
timeHourDate
.
compareTo
(
DateUtils
.
parseDate
(
day
+
" "
+
finalNowTime
))==-
1
){
vo
.
setStatus
(
RoomStatusEnum
.
HOLD
.
getValue
());
vo
.
setStatus
(
RoomStatusEnum
.
HOLD
.
getValue
());
vo
.
setStartHoldTime
(
timeHourDate
);
changeStartHoldTime
(
vo
,
timeHourDate
);
//判断是否是同一个小时,如果是同一个小时,占用结束时间为当前时间
//判断是否是同一个小时,如果是同一个小时,占用结束时间为当前时间
if
(
timeHourDate
.
compareTo
(
DateUtils
.
parseDate
(
day
+
" "
+
finalNowTime
.
split
(
":"
)[
0
]))
==
0
){
if
(
timeHourDate
.
compareTo
(
DateUtils
.
parseDate
(
day
+
" "
+
finalNowTime
.
split
(
":"
)[
0
]))
==
0
){
vo
.
setEndHoldTime
(
DateUtils
.
parseDate
(
day
+
" "
+
finalNowTime
));
changeEndHoldTime
(
vo
,
DateUtils
.
parseDate
(
day
+
" "
+
finalNowTime
));
}
else
{
}
else
{
//占用结束时间为当前时段59分59秒
//占用结束时间为当前时段59分59秒
vo
.
setEndHoldTime
(
DateUtils
.
addSeconds
(
timeHourDate
,
59
*
60
+
59
));
changeEndHoldTime
(
vo
,
DateUtils
.
addSeconds
(
timeHourDate
,
59
*
60
+
59
));
}
}
}
}
checkTimeHourToOrder
(
vo
,
timeHourDate
,
orderList
,
orderType
);
}
}
private
void
checkTimeHourToOrder
(
RoomStatusVo
vo
,
Date
timeHourDate
,
List
<
SOrder
>
orderList
,
Integer
orderType
){
private
void
checkTimeHourToOrder
(
RoomStatusVo
vo
,
Date
timeHourDate
,
List
<
SOrder
>
orderList
,
Integer
orderType
){
...
@@ -149,18 +170,18 @@ public class RoomStatusServiceImpl implements RoomStatusService {
...
@@ -149,18 +170,18 @@ public class RoomStatusServiceImpl implements RoomStatusService {
//判断订单开始时间是否是同一个小时,如果是同一个小时,占用开始时间为订单开始时间
//判断订单开始时间是否是同一个小时,如果是同一个小时,占用开始时间为订单开始时间
if
(
StringUtils
.
equals
(
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD_HH
,
timeHourDate
)
if
(
StringUtils
.
equals
(
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD_HH
,
timeHourDate
)
,
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD_HH
,
orderStartDate
))){
,
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD_HH
,
orderStartDate
))){
vo
.
setStartHoldTime
(
orderStartDate
);
changeStartHoldTime
(
vo
,
orderStartDate
);
}
else
{
}
else
{
//占用开始时间为当前时段0分0秒
//占用开始时间为当前时段0分0秒
vo
.
setStartHoldTime
(
timeHourDate
);
changeStartHoldTime
(
vo
,
timeHourDate
);
}
}
//判断订单结束时间是否是同一个小时,如果是同一个小时,占用结束时间为订单结束时间
//判断订单结束时间是否是同一个小时,如果是同一个小时,占用结束时间为订单结束时间
if
(
StringUtils
.
equals
(
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD_HH
,
timeHourDate
)
if
(
StringUtils
.
equals
(
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD_HH
,
timeHourDate
)
,
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD_HH
,
orderEndDate
))){
,
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD_HH
,
orderEndDate
))){
vo
.
setEndHoldTime
(
orderEndDate
);
changeEndHoldTime
(
vo
,
orderEndDate
);
}
else
{
}
else
{
//占用结束时间为当前时段59分59秒
//占用结束时间为当前时段59分59秒
vo
.
setEndHoldTime
(
DateUtils
.
addSeconds
(
timeHourDate
,
59
*
60
+
59
));
changeEndHoldTime
(
vo
,
DateUtils
.
addSeconds
(
timeHourDate
,
59
*
60
+
59
));
}
}
}
}
});
});
...
...
share-system/src/main/java/share/system/service/impl/SCleanRecordsServiceImpl.java
View file @
8cf074a9
...
@@ -199,7 +199,7 @@ public class SCleanRecordsServiceImpl extends ServiceImpl<SCleanRecordsMapper,SC
...
@@ -199,7 +199,7 @@ public class SCleanRecordsServiceImpl extends ServiceImpl<SCleanRecordsMapper,SC
public
boolean
finishCleanRecords
()
{
public
boolean
finishCleanRecords
()
{
Date
now
=
DateUtil
.
date
();
Date
now
=
DateUtil
.
date
();
LambdaQueryWrapper
<
SCleanRecords
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
LambdaQueryWrapper
<
SCleanRecords
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
SCleanRecords:
:
getStatus
,
0
);
queryWrapper
.
in
(
SCleanRecords:
:
getStatus
,
CleaningStatusEnum
.
UNCLEAN
.
getCode
(),
CleaningStatusEnum
.
CLEANING
.
getCode
()
);
queryWrapper
.
le
(
SCleanRecords:
:
getCreateTime
,
DateUtil
.
offsetMinute
(
now
,
-
Constants
.
ROOM_LOCK_DELAY_MINUTE
));
queryWrapper
.
le
(
SCleanRecords:
:
getCreateTime
,
DateUtil
.
offsetMinute
(
now
,
-
Constants
.
ROOM_LOCK_DELAY_MINUTE
));
List
<
SCleanRecords
>
list
=
baseMapper
.
selectList
(
queryWrapper
);
List
<
SCleanRecords
>
list
=
baseMapper
.
selectList
(
queryWrapper
);
if
(
list
.
size
()
==
0
)
{
if
(
list
.
size
()
==
0
)
{
...
...
share-system/src/main/java/share/system/service/impl/SConsumerCouponServiceImpl.java
View file @
8cf074a9
...
@@ -2,11 +2,11 @@ package share.system.service.impl;
...
@@ -2,11 +2,11 @@ package share.system.service.impl;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.*
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.stream.Collectors
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.json.JSONArray
;
import
cn.hutool.json.JSONArray
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
...
@@ -16,14 +16,12 @@ import share.common.enums.*;
...
@@ -16,14 +16,12 @@ import share.common.enums.*;
import
share.common.utils.DateUtils
;
import
share.common.utils.DateUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
share.common.utils.StringUtils
;
import
share.system.domain.*
;
import
share.system.domain.*
;
import
share.system.domain.vo.FrontTokenComponent
;
import
share.system.domain.vo.FrontTokenComponent
;
import
share.system.mapper.SConsumerCouponMapper
;
import
share.system.mapper.SConsumerCouponMapper
;
import
share.system.request.CouponRequest
;
import
share.system.request.CouponRequest
;
import
share.system.service.ISConsumerCouponService
;
import
share.system.service.*
;
import
share.system.service.ISCouponService
;
import
share.system.service.ISRoomService
;
import
share.system.service.ISStoreService
;
/**
/**
* 优惠券领取记录Service业务层处理
* 优惠券领取记录Service业务层处理
...
@@ -33,8 +31,6 @@ import share.system.service.ISStoreService;
...
@@ -33,8 +31,6 @@ import share.system.service.ISStoreService;
*/
*/
@Service
@Service
public
class
SConsumerCouponServiceImpl
extends
ServiceImpl
<
SConsumerCouponMapper
,
SConsumerCoupon
>
implements
ISConsumerCouponService
{
public
class
SConsumerCouponServiceImpl
extends
ServiceImpl
<
SConsumerCouponMapper
,
SConsumerCoupon
>
implements
ISConsumerCouponService
{
@Autowired
private
SConsumerCouponMapper
sConsumerCouponMapper
;
@Autowired
@Autowired
private
ISRoomService
sRoomService
;
private
ISRoomService
sRoomService
;
...
@@ -45,6 +41,13 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
...
@@ -45,6 +41,13 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
@Autowired
@Autowired
private
ISCouponService
sCouponService
;
private
ISCouponService
sCouponService
;
@Autowired
private
IPackService
packService
;
@Autowired
private
SConsumerService
sConsumerService
;
private
static
final
Integer
ZERO
=
0
;
private
static
final
Integer
ZERO
=
0
;
/**
/**
...
@@ -55,7 +58,7 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
...
@@ -55,7 +58,7 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
*/
*/
@Override
@Override
public
SConsumerCoupon
selectSConsumerCouponById
(
Long
id
)
{
public
SConsumerCoupon
selectSConsumerCouponById
(
Long
id
)
{
return
sConsumerCoupon
Mapper
.
selectSConsumerCouponById
(
id
);
return
base
Mapper
.
selectSConsumerCouponById
(
id
);
}
}
/**
/**
...
@@ -66,18 +69,36 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
...
@@ -66,18 +69,36 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
*/
*/
@Override
@Override
public
List
<
SConsumerCoupon
>
selectSConsumerCouponList
(
SConsumerCoupon
sConsumerCoupon
)
{
public
List
<
SConsumerCoupon
>
selectSConsumerCouponList
(
SConsumerCoupon
sConsumerCoupon
)
{
List
<
SConsumerCoupon
>
sConsumerCoupons
=
sConsumerCouponMapper
.
selectSConsumerCouponList
(
sConsumerCoupon
);
List
<
SConsumerCoupon
>
sConsumerCoupons
=
baseMapper
.
selectSConsumerCouponList
(
sConsumerCoupon
);
sConsumerCoupons
.
forEach
(
item
->
{
sConsumerCoupons
.
forEach
(
item
->
{
if
(
item
.
getUseStatus
().
equals
(
UserStatusEnum
.
UNUSED
.
getCode
()))
{
List
<
SConsumer
>
list
=
sConsumerService
.
list
();
if
(
item
.
getEndDate
().
compareTo
(
new
Date
())
<
0
)
{
if
(
list
.
stream
().
filter
(
obj
->
obj
.
getId
().
equals
(
item
.
getConsumerId
())).
findFirst
().
isPresent
())
{
item
.
setUseStatus
(
UserStatusEnum
.
EXPIRED
.
getCode
());
item
.
setPhone
(
list
.
stream
().
filter
(
obj
->
obj
.
getId
().
equals
(
item
.
getConsumerId
())).
findFirst
().
get
().
getPhone
());
sConsumerCouponMapper
.
updateSConsumerCoupon
(
item
);
if
(
StringUtils
.
isNotBlank
(
list
.
stream
().
filter
(
obj
->
obj
.
getId
().
equals
(
item
.
getConsumerId
())).
findFirst
().
get
().
getNickName
()))
{
item
.
setNickName
(
list
.
stream
().
filter
(
obj
->
obj
.
getId
().
equals
(
item
.
getConsumerId
())).
findFirst
().
get
().
getNickName
());
}
}
}
}
});
});
return
sConsumerCoupons
;
return
sConsumerCoupons
;
}
}
@Override
public
List
<
SConsumerCoupon
>
listByUseStatus
(
Integer
useStatus
)
{
SConsumer
user
=
FrontTokenComponent
.
getWxSConsumerEntry
();
LambdaQueryWrapper
<
SConsumerCoupon
>
queryWrapper
=
new
LambdaQueryWrapper
<
SConsumerCoupon
>();
queryWrapper
.
eq
(
SConsumerCoupon:
:
getConsumerId
,
user
.
getId
());
queryWrapper
.
eq
(
SConsumerCoupon:
:
getUseStatus
,
useStatus
);
if
(
UserStatusEnum
.
EXPIRED
.
getCode
().
compareTo
(
useStatus
)==
0
){
//已过期查询3个月以内的
queryWrapper
.
gt
(
SConsumerCoupon:
:
getEndDate
,
DateUtils
.
addMonths
(
new
Date
(),-
3
));
}
queryWrapper
.
orderByDesc
(
SConsumerCoupon:
:
getCreateTime
);
List
<
SConsumerCoupon
>
sConsumerCoupons
=
baseMapper
.
selectList
(
queryWrapper
);
return
sConsumerCoupons
;
}
/**
/**
* 新增优惠券领取记录
* 新增优惠券领取记录
*
*
...
@@ -88,7 +109,7 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
...
@@ -88,7 +109,7 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
public
int
insertSConsumerCoupon
(
SConsumerCoupon
sConsumerCoupon
)
{
public
int
insertSConsumerCoupon
(
SConsumerCoupon
sConsumerCoupon
)
{
sConsumerCoupon
.
setCreateTime
(
DateUtils
.
getNowDate
());
sConsumerCoupon
.
setCreateTime
(
DateUtils
.
getNowDate
());
sConsumerCoupon
.
setUseStatus
(
UserStatusEnum
.
UNUSED
.
getCode
());
sConsumerCoupon
.
setUseStatus
(
UserStatusEnum
.
UNUSED
.
getCode
());
return
sConsumerCoupon
Mapper
.
insertSConsumerCoupon
(
sConsumerCoupon
);
return
base
Mapper
.
insertSConsumerCoupon
(
sConsumerCoupon
);
}
}
/**
/**
...
@@ -100,7 +121,7 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
...
@@ -100,7 +121,7 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
@Override
@Override
public
int
updateSConsumerCoupon
(
SConsumerCoupon
sConsumerCoupon
)
{
public
int
updateSConsumerCoupon
(
SConsumerCoupon
sConsumerCoupon
)
{
sConsumerCoupon
.
setUpdateTime
(
DateUtils
.
getNowDate
());
sConsumerCoupon
.
setUpdateTime
(
DateUtils
.
getNowDate
());
return
sConsumerCoupon
Mapper
.
updateSConsumerCoupon
(
sConsumerCoupon
);
return
base
Mapper
.
updateSConsumerCoupon
(
sConsumerCoupon
);
}
}
/**
/**
...
@@ -113,7 +134,7 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
...
@@ -113,7 +134,7 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
public
int
deleteSConsumerCouponByIds
(
Long
[]
ids
)
{
public
int
deleteSConsumerCouponByIds
(
Long
[]
ids
)
{
LambdaQueryWrapper
<
SConsumerCoupon
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
LambdaQueryWrapper
<
SConsumerCoupon
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
in
(
SConsumerCoupon:
:
getId
,
ids
);
queryWrapper
.
in
(
SConsumerCoupon:
:
getId
,
ids
);
List
<
SConsumerCoupon
>
sConsumerCoupons
=
sConsumerCoupon
Mapper
.
selectList
(
queryWrapper
);
List
<
SConsumerCoupon
>
sConsumerCoupons
=
base
Mapper
.
selectList
(
queryWrapper
);
//获取sConsumerCoupons里的优惠券id
//获取sConsumerCoupons里的优惠券id
Long
[]
couponIds
=
sConsumerCoupons
.
stream
().
map
(
SConsumerCoupon:
:
getCouponId
).
toArray
(
Long
[]::
new
);
Long
[]
couponIds
=
sConsumerCoupons
.
stream
().
map
(
SConsumerCoupon:
:
getCouponId
).
toArray
(
Long
[]::
new
);
//根据优惠券id查询优惠券信息
//根据优惠券id查询优惠券信息
...
@@ -128,7 +149,7 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
...
@@ -128,7 +149,7 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
}
}
});
});
return
sConsumerCoupon
Mapper
.
deleteSConsumerCouponByIds
(
ids
);
return
base
Mapper
.
deleteSConsumerCouponByIds
(
ids
);
}
}
/**
/**
...
@@ -139,12 +160,12 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
...
@@ -139,12 +160,12 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
*/
*/
@Override
@Override
public
int
deleteSConsumerCouponById
(
Long
id
)
{
public
int
deleteSConsumerCouponById
(
Long
id
)
{
return
sConsumerCoupon
Mapper
.
deleteSConsumerCouponById
(
id
);
return
base
Mapper
.
deleteSConsumerCouponById
(
id
);
}
}
@Override
@Override
public
int
selectSConsumerCouponConut
(
SConsumerCoupon
sConsumerCoupon
)
{
public
int
selectSConsumerCouponConut
(
SConsumerCoupon
sConsumerCoupon
)
{
return
sConsumerCoupon
Mapper
.
selectSConsumerCouponConut
(
sConsumerCoupon
);
return
base
Mapper
.
selectSConsumerCouponConut
(
sConsumerCoupon
);
}
}
@Override
@Override
...
@@ -154,9 +175,9 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
...
@@ -154,9 +175,9 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
sConsumerCoupon
.
setUseStatus
(
ConsumerCouponUseStatusEnum
.
WAIT_USE
.
getCode
());
sConsumerCoupon
.
setUseStatus
(
ConsumerCouponUseStatusEnum
.
WAIT_USE
.
getCode
());
sConsumerCoupon
.
setConsumerId
(
user
.
getId
());
sConsumerCoupon
.
setConsumerId
(
user
.
getId
());
//查询用户未使用的优惠券
//查询用户未使用的优惠券
List
<
SConsumerCoupon
>
sConsumerCoupons
=
sConsumerCoupon
Mapper
.
querySConsumerCouponList
(
sConsumerCoupon
);
List
<
SConsumerCoupon
>
sConsumerCoupons
=
base
Mapper
.
querySConsumerCouponList
(
sConsumerCoupon
);
//计算时长
//计算时长
BigDecimal
bigDecimal
=
DateUtils
.
differentHour
(
couponRequest
.
getPreStartDate
(),
couponRequest
.
getPreEndDate
());
BigDecimal
timeLong
=
DateUtils
.
differentHour
(
couponRequest
.
getPreStartDate
(),
couponRequest
.
getPreEndDate
());
if
(
CollectionUtils
.
isEmpty
(
sConsumerCoupons
))
{
if
(
CollectionUtils
.
isEmpty
(
sConsumerCoupons
))
{
return
sConsumerCoupons
;
return
sConsumerCoupons
;
}
}
...
@@ -164,45 +185,171 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
...
@@ -164,45 +185,171 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
List
<
SStore
>
sStores
=
sStoreService
.
list
();
List
<
SStore
>
sStores
=
sStoreService
.
list
();
//查询所有房间
//查询所有房间
List
<
SRoom
>
sRooms
=
sRoomService
.
list
();
List
<
SRoom
>
sRooms
=
sRoomService
.
list
();
//查询所有的套餐
List
<
SPack
>
sPacks
=
packService
.
list
();
//迭代
//迭代
sConsumerCoupons
.
forEach
(
item
->
{
sConsumerCoupons
.
forEach
(
item
->
{
if
(
item
.
getStartDate
().
compareTo
(
couponRequest
.
getPreStartDate
())
<=
0
&&
item
.
getEndDate
().
compareTo
(
couponRequest
.
getPreEndDate
())
>=
0
)
{
checkCoupon
(
item
,
couponRequest
,
sStores
,
sRooms
,
sPacks
,
timeLong
);
SimpleDateFormat
sdf1
=
new
SimpleDateFormat
(
"HH:mm"
);
});
String
proStartTime
=
sdf1
.
format
(
couponRequest
.
getPreStartDate
());
return
sConsumerCoupons
;
if
(
proStartTime
.
compareTo
(
item
.
getCouponTimeStart
())
>=
0
)
{
}
SStore
sStore
=
sStores
.
stream
().
filter
(
store
->
store
.
getId
().
equals
(
couponRequest
.
getStoreId
())).
findFirst
().
orElse
(
null
);
SRoom
byId
=
sRooms
.
stream
().
filter
(
room
->
room
.
getId
().
equals
(
couponRequest
.
getRoomId
())).
findFirst
().
orElse
(
null
);
private
Boolean
checkCoupon
(
SConsumerCoupon
item
,
CouponRequest
couponRequest
BigDecimal
subtract
=
new
BigDecimal
(
item
.
getMinDuration
());
,
List
<
SStore
>
sStores
,
List
<
SRoom
>
sRooms
,
List
<
SPack
>
sPacks
,
BigDecimal
timeLong
){
if
(
item
.
getCouponType
().
equals
(
CouponTypeEnum
.
PACKAGE
.
getCode
()))
{
item
.
setIsAvailable
(
AvailableEnum
.
AVAILABLE
.
getCode
());
if
(
couponRequest
.
getOrderMode
().
equals
(
BuyTypeEnum
.
PACK
.
getCode
()))
{
return
checkAvailableDate
(
item
,
couponRequest
)
//计算价格
&&
checkCouponPeriod
(
item
,
couponRequest
)
extracted
(
item
,
bigDecimal
,
byId
,
subtract
,
sStore
);
&&
checkStore
(
item
,
couponRequest
,
sStores
)
}
else
{
&&
checkCouponType
(
item
,
couponRequest
,
sStores
,
sRooms
,
timeLong
)
item
.
setIsAvailable
(
AvailableEnum
.
UNAVAILABLE
.
getCode
());
&&
checkOrderType
(
item
,
couponRequest
)
item
.
setReason
(
"仅支持套餐模式下单使用"
);
&&
checkPack
(
item
,
couponRequest
,
sPacks
)
}
&&
chekcWeeks
(
item
,
couponRequest
);
}
else
if
(
item
.
getCouponType
().
equals
(
CouponTypeEnum
.
DURATION
.
getCode
()))
{
}
//判断门槛时长
if
(
bigDecimal
.
compareTo
(
subtract
)
>=
0
)
{
private
Boolean
chekcWeeks
(
SConsumerCoupon
item
,
CouponRequest
couponRequest
)
{
//判断门店类型
if
(
StringUtils
.
isNotBlank
(
item
.
getWeeks
()))
{
isStoreType
(
item
,
sStore
,
byId
);
Integer
startWeek
=
DateUtil
.
dayOfWeek
(
DateUtils
.
addDays
(
couponRequest
.
getPreStartDate
(),
-
1
));
}
else
{
Integer
endWeek
=
DateUtil
.
dayOfWeek
(
DateUtils
.
addDays
(
couponRequest
.
getPreEndDate
(),
-
1
));
item
.
setIsAvailable
(
AvailableEnum
.
UNAVAILABLE
.
getCode
());
ArrayList
<
Integer
>
weeks
=
(
ArrayList
<
Integer
>)
Arrays
.
stream
(
item
.
getWeeks
().
split
(
","
))
item
.
setReason
(
"下单时长等于"
+
bigDecimal
+
"小时,不满足优惠券门槛时长"
);
.
map
(
Integer:
:
parseInt
).
collect
(
Collectors
.
toList
());
if
(!
weeks
.
contains
(
startWeek
)||!
weeks
.
contains
(
endWeek
)){
item
.
setIsAvailable
(
AvailableEnum
.
UNAVAILABLE
.
getCode
());
if
(
checkIfArrayIsContinuous
(
weeks
.
stream
().
mapToInt
(
i
->
i
.
intValue
()).
toArray
())){
if
(
weeks
.
size
()==
1
)
{
item
.
setReason
(
"优惠卷"
+
WeekEnum
.
getValueByCode
(
weeks
.
get
(
0
))
+
"可用"
);
}
else
if
(
WeekEnum
.
isSundays
(
weeks
)){
item
.
setReason
(
"优惠卷周末可用"
);
}
else
if
(
WeekEnum
.
isAllWorkDays
(
weeks
)){
item
.
setReason
(
"优惠卷周一至周五可用"
);
}
else
{
item
.
setReason
(
"优惠卷"
+
WeekEnum
.
getValueByCode
(
weeks
.
get
(
0
))
+
"至"
+
WeekEnum
.
getValueByCode
(
weeks
.
get
(
weeks
.
size
()-
1
))+
"可用"
);
}
}
else
{
StringBuffer
buf
=
new
StringBuffer
(
"优惠券"
);
for
(
int
index
=
0
;
index
<
weeks
.
size
();
index
++){
buf
.
append
(
WeekEnum
.
getValueByCode
(
weeks
.
get
(
index
)));
if
(
index
<
weeks
.
size
())
{
buf
.
append
(
"可用"
);
//最后一个不加逗号
if
(
index
<
weeks
.
size
()
-
1
)
{
buf
.
append
(
","
);
}
}
}
}
else
{
extracted
(
item
,
bigDecimal
,
byId
,
subtract
,
sStore
);
}
}
item
.
setReason
(
buf
.
toString
());
}
}
}
return
item
.
getIsAvailable
()
==
0
;
}
private
static
boolean
checkIfArrayIsContinuous
(
int
[]
array
)
{
if
(
array
==
null
||
array
.
length
<
2
)
{
return
true
;
// 空数组或只有一个元素时认为是连续的
}
Arrays
.
sort
(
array
);
// 先对数组进行排序
for
(
int
i
=
0
;
i
<
array
.
length
-
1
;
i
++)
{
if
(
array
[
i
]
!=
array
[
i
+
1
])
{
return
false
;
// 如果相邻两个元素之间存在跨度大于1的情况则返回false
}
}
return
true
;
// 没有发现跨度大于1的情况则返回true
}
private
Boolean
checkPack
(
SConsumerCoupon
item
,
CouponRequest
couponRequest
,
List
<
SPack
>
sPacks
){
if
(
Objects
.
nonNull
(
item
.
getPackageId
())&&
item
.
getPackageId
().
compareTo
(
couponRequest
.
getPackageId
())!=
0
){
SPack
pack
=
sPacks
.
stream
().
filter
(
obj
->
obj
.
getId
().
compareTo
(
item
.
getPackageId
())==
0
).
findFirst
().
orElse
(
null
);
item
.
setIsAvailable
(
AvailableEnum
.
UNAVAILABLE
.
getCode
());
item
.
setReason
(
"优惠卷当前套餐不可用,【"
+
pack
.
getName
()+
"】套餐可用"
);
}
return
item
.
getIsAvailable
()==
0
;
}
private
Boolean
checkOrderType
(
SConsumerCoupon
item
,
CouponRequest
couponRequest
){
if
(
Objects
.
nonNull
(
item
.
getOrderType
())&&
item
.
getOrderType
().
compareTo
(
couponRequest
.
getOrderType
())!=
0
){
item
.
setIsAvailable
(
AvailableEnum
.
UNAVAILABLE
.
getCode
());
item
.
setReason
(
"优惠卷"
+
OrderTypeEnum
.
getEnumByCode
(
item
.
getOrderType
()).
getName
()+
"可用"
);
}
return
item
.
getIsAvailable
()==
0
;
}
private
Boolean
checkAvailableDate
(
SConsumerCoupon
item
,
CouponRequest
couponRequest
){
if
((
Objects
.
nonNull
(
item
.
getStartDate
())&&
Objects
.
nonNull
(
item
.
getEndDate
()))
&&(
item
.
getStartDate
().
compareTo
(
couponRequest
.
getPreStartDate
())
>
0
||
item
.
getEndDate
().
compareTo
(
couponRequest
.
getPreEndDate
())
<
0
)){
item
.
setIsAvailable
(
AvailableEnum
.
UNAVAILABLE
.
getCode
());
item
.
setReason
(
"优惠卷未生效,优惠卷有效时间为"
+
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD_HH_MM_SS
,
item
.
getStartDate
())
+
"-"
+
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD_HH_MM_SS
,
item
.
getEndDate
()));
}
return
item
.
getIsAvailable
()==
0
;
}
private
Boolean
checkCouponPeriod
(
SConsumerCoupon
item
,
CouponRequest
couponRequest
){
if
(
Objects
.
nonNull
(
item
.
getCouponTimeStart
())&&
Objects
.
nonNull
(
item
.
getCouponTimeEnd
())
&&
!
StringUtils
.
equals
(
item
.
getCouponTimeStart
(),
"00:00"
)&&(!
StringUtils
.
equals
(
item
.
getCouponTimeEnd
(),
"24:00"
)||!
StringUtils
.
equals
(
item
.
getCouponTimeEnd
(),
"23:00"
))){
String
startStr
=
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD
,
couponRequest
.
getPreStartDate
());
//判断短是否跨日
if
(
DateUtils
.
parseDate
(
startStr
+
" "
+
item
.
getCouponTimeStart
()).
compareTo
(
DateUtils
.
parseDate
(
startStr
+
" "
+
item
.
getCouponTimeEnd
()))>
0
){
if
(
DateUtils
.
parseDate
(
startStr
+
" "
+
item
.
getCouponTimeStart
()).
compareTo
(
couponRequest
.
getPreStartDate
())>
0
||
DateUtils
.
addDays
(
DateUtils
.
parseDate
(
startStr
+
" "
+
item
.
getCouponTimeEnd
()),
1
).
compareTo
(
couponRequest
.
getPreEndDate
())<
0
)
{
item
.
setIsAvailable
(
AvailableEnum
.
UNAVAILABLE
.
getCode
());
item
.
setReason
(
"优惠卷可用时段为"
+
item
.
getCouponTimeStart
()
+
"-次日"
+
item
.
getCouponTimeEnd
());
}
}
else
{
if
(
DateUtils
.
parseDate
(
startStr
+
" "
+
item
.
getCouponTimeStart
()).
compareTo
(
couponRequest
.
getPreStartDate
())>
0
||
DateUtils
.
parseDate
(
startStr
+
" "
+
item
.
getCouponTimeEnd
()).
compareTo
(
couponRequest
.
getPreEndDate
())<
0
)
{
item
.
setIsAvailable
(
AvailableEnum
.
UNAVAILABLE
.
getCode
());
item
.
setReason
(
"优惠卷可用时段为"
+
item
.
getCouponTimeStart
()
+
"-"
+
item
.
getCouponTimeEnd
());
}
}
}
return
item
.
getIsAvailable
()==
0
;
}
private
Boolean
checkCouponType
(
SConsumerCoupon
item
,
CouponRequest
couponRequest
,
List
<
SStore
>
sStores
,
List
<
SRoom
>
sRooms
,
BigDecimal
timeLong
){
SStore
sStore
=
sStores
.
stream
().
filter
(
store
->
store
.
getId
().
equals
(
couponRequest
.
getStoreId
())).
findFirst
().
orElse
(
null
);
SRoom
byId
=
sRooms
.
stream
().
filter
(
room
->
room
.
getId
().
equals
(
couponRequest
.
getRoomId
())).
findFirst
().
orElse
(
null
);
BigDecimal
subtract
=
new
BigDecimal
(
item
.
getMinDuration
());
CouponTypeEnum
couponTypeEnum
=
CouponTypeEnum
.
getTypeCode
(
item
.
getCouponType
());
switch
(
couponTypeEnum
){
case
PACKAGE:
if
(
couponRequest
.
getOrderMode
().
equals
(
BuyTypeEnum
.
PACK
.
getCode
()))
{
//计算价格
extracted
(
item
,
timeLong
,
byId
,
subtract
,
sStore
);
}
else
{
}
else
{
item
.
setIsAvailable
(
AvailableEnum
.
UNAVAILABLE
.
getCode
());
item
.
setIsAvailable
(
AvailableEnum
.
UNAVAILABLE
.
getCode
());
item
.
setReason
(
"
优惠卷未生效,优惠卷有效时段为每天"
+
item
.
getCouponTimeStart
()
+
"-"
+
item
.
getCouponTimeEnd
()
);
item
.
setReason
(
"
仅支持套餐模式下单使用"
);
}
}
}
else
{
break
;
case
DURATION:
//判断门槛时长
if
(
timeLong
.
compareTo
(
subtract
)
>=
0
)
{
//判断门店类型
isStoreType
(
item
,
sStore
,
byId
);
}
else
{
item
.
setIsAvailable
(
AvailableEnum
.
UNAVAILABLE
.
getCode
());
item
.
setReason
(
"下单时长等于"
+
timeLong
+
"小时,不满足优惠券门槛时长"
);
}
break
;
default
:
extracted
(
item
,
timeLong
,
byId
,
subtract
,
sStore
);
break
;
}
return
item
.
getIsAvailable
()==
0
;
}
private
Boolean
checkStore
(
SConsumerCoupon
item
,
CouponRequest
couponRequest
,
List
<
SStore
>
sStores
){
if
(
StringUtils
.
isNotBlank
(
item
.
getStoreIds
()))
{
List
<
Long
>
storeIds
=
Arrays
.
asList
(
item
.
getStoreIds
().
split
(
","
)).
stream
().
map
(
Long:
:
parseLong
).
collect
(
Collectors
.
toList
());
if
(!
storeIds
.
contains
(
couponRequest
.
getStoreId
()))
{
List
<
String
>
storeNames
=
sStores
.
stream
().
filter
(
store
->
storeIds
.
contains
(
store
.
getId
())).
map
(
SStore:
:
getName
).
collect
(
Collectors
.
toList
());
item
.
setIsAvailable
(
AvailableEnum
.
UNAVAILABLE
.
getCode
());
item
.
setIsAvailable
(
AvailableEnum
.
UNAVAILABLE
.
getCode
());
item
.
setReason
(
"优惠卷
未生效,优惠卷有效时间为"
+
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD_HH_MM_SS
,
item
.
getStartDate
())
+
"-"
+
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD_HH_MM_SS
,
item
.
getEndDate
()
));
item
.
setReason
(
"优惠卷
当前门店不可用,适用门店:"
+
storeNames
.
toString
(
));
}
}
}
);
}
return
sConsumerCoupons
;
return
item
.
getIsAvailable
()==
0
;
}
}
@Override
@Override
...
@@ -228,19 +375,20 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
...
@@ -228,19 +375,20 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
newSConsumerCoupon
.
setCouponTimeStart
(
sCoupon
.
getValidStartTime
());
newSConsumerCoupon
.
setCouponTimeStart
(
sCoupon
.
getValidStartTime
());
newSConsumerCoupon
.
setCouponTimeEnd
(
sCoupon
.
getValidEndTime
());
newSConsumerCoupon
.
setCouponTimeEnd
(
sCoupon
.
getValidEndTime
());
newSConsumerCoupon
.
setCouponType
(
sCoupon
.
getCouponType
());
newSConsumerCoupon
.
setCouponType
(
sCoupon
.
getCouponType
());
newSConsumerCoupon
.
setMinPrice
(
new
BigDecimal
(
0.00
));
newSConsumerCoupon
.
setMinPrice
(
new
BigDecimal
(
0.00
));
newSConsumerCoupon
.
setSubPrice
(
sCoupon
.
getSubPrice
());
newSConsumerCoupon
.
setSubPrice
(
sCoupon
.
getSubPrice
());
newSConsumerCoupon
.
setWeeks
(
sCoupon
.
getWeeks
());
newSConsumerCoupon
.
setMinDuration
(
sCoupon
.
getMinDuration
());
newSConsumerCoupon
.
setMinDuration
(
sCoupon
.
getMinDuration
());
newSConsumerCoupon
.
setMaxDuration
(
sCoupon
.
getMaxDuration
());
newSConsumerCoupon
.
setMaxDuration
(
sCoupon
.
getMaxDuration
());
newSConsumerCoupon
.
setDuration
(
sCoupon
.
getDuration
());
newSConsumerCoupon
.
setDuration
(
sCoupon
.
getDuration
());
newSConsumerCoupon
.
setOrderType
(
sCoupon
.
getOrderType
());
newSConsumerCoupon
.
setPackageId
(
sCoupon
.
getPackageId
());
newSConsumerCoupon
.
setSourceType
(
SourceTypeEnum
.
GIVE
.
getCode
());
newSConsumerCoupon
.
setSourceType
(
SourceTypeEnum
.
GIVE
.
getCode
());
newSConsumerCoupon
.
setPlatformType
(
String
.
valueOf
(
sCoupon
.
getPlatformType
()));
newSConsumerCoupon
.
setPlatformType
(
String
.
valueOf
(
sCoupon
.
getPlatformType
()));
newSConsumerCoupon
.
setStartDate
(
sCoupon
.
getStartDate
());
newSConsumerCoupon
.
setStartDate
(
sCoupon
.
getStartDate
());
newSConsumerCoupon
.
setEndDate
(
sCoupon
.
getEndDate
());
newSConsumerCoupon
.
setEndDate
(
sCoupon
.
getEndDate
());
newSConsumerCoupon
.
setRemark
(
sCoupon
.
getRemark
());
newSConsumerCoupon
.
setRemark
(
sCoupon
.
getRemark
());
int
insert
=
sConsumerCoupon
Mapper
.
insert
(
newSConsumerCoupon
);
int
insert
=
base
Mapper
.
insert
(
newSConsumerCoupon
);
if
(
insert
>
0
)
{
if
(
insert
>
0
)
{
//优惠券数量减一
//优惠券数量减一
sCoupon
.
setNumber
(
sCoupon
.
getNumber
()
-
1
);
sCoupon
.
setNumber
(
sCoupon
.
getNumber
()
-
1
);
...
...
share-system/src/main/java/share/system/service/impl/SConsumptionRecordsServiceImpl.java
View file @
8cf074a9
...
@@ -6,6 +6,9 @@ import java.util.stream.Collectors;
...
@@ -6,6 +6,9 @@ import java.util.stream.Collectors;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
import
share.common.enums.ConsumeNameEnum
;
import
share.common.enums.PayTypeEnum
;
import
share.common.enums.SignEnum
;
import
share.common.utils.DateUtils
;
import
share.common.utils.DateUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -103,6 +106,19 @@ public class SConsumptionRecordsServiceImpl implements ISConsumptionRecordsServi
...
@@ -103,6 +106,19 @@ public class SConsumptionRecordsServiceImpl implements ISConsumptionRecordsServi
return
sConsumptionRecordsMapper
.
insertSConsumptionRecords
(
sConsumptionRecords
);
return
sConsumptionRecordsMapper
.
insertSConsumptionRecords
(
sConsumptionRecords
);
}
}
@Override
public
int
insertSConsumptionRecords
(
SOrder
sOrder
)
{
SConsumptionRecords
sConsumptionRecords
=
new
SConsumptionRecords
();
sConsumptionRecords
.
setConsumerId
(
sOrder
.
getConsumerId
());
sConsumptionRecords
.
setOrderId
(
sOrder
.
getId
());
sConsumptionRecords
.
setName
(
ConsumeNameEnum
.
CONSUME
.
getValue
());
sConsumptionRecords
.
setPrice
(
sOrder
.
getPayPrice
());
sConsumptionRecords
.
setPayType
(
PayTypeEnum
.
WECHAT
.
getName
());
sConsumptionRecords
.
setSign
(
SignEnum
.
BURDEN
.
getValue
());
sConsumptionRecords
.
setCreateTime
(
DateUtils
.
getNowDate
());
return
sConsumptionRecordsMapper
.
insertSConsumptionRecords
(
sConsumptionRecords
);
}
/**
/**
* 修改消费记录
* 修改消费记录
*
*
...
...
share-system/src/main/java/share/system/service/impl/SCouponServiceImpl.java
View file @
8cf074a9
package
share
.
system
.
service
.
impl
;
package
share
.
system
.
service
.
impl
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.util.List
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.dianping.openapi.sdk.api.tuangou.entity.TuangouDealQueryShopDealResponseEntity
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.ObjectUtils
;
import
share.common.enums.CouponTypeEnum
;
import
share.common.enums.RoomType
;
import
share.common.enums.RoomType
;
import
share.common.enums.StoreType
;
import
share.common.enums.StoreType
;
import
share.common.utils.DateUtils
;
import
share.common.utils.DateUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
share.system.domain.SStore
;
import
share.system.mapper.SCouponMapper
;
import
share.system.mapper.SCouponMapper
;
import
share.system.domain.SCoupon
;
import
share.system.domain.SCoupon
;
import
share.system.service.ISCouponService
;
import
share.system.service.ISCouponService
;
import
share.system.service.ISStoreService
;
import
share.system.service.QPService
;
/**
/**
* 优惠券Service业务层处理
* 优惠券Service业务层处理
*
*
* @author ruoyi
* @author ruoyi
* @date 2023-09-27
* @date 2023-09-27
*/
*/
@Service
@Service
public
class
SCouponServiceImpl
implements
ISCouponService
public
class
SCouponServiceImpl
implements
ISCouponService
{
{
@Autowired
@Autowired
private
SCouponMapper
sCouponMapper
;
private
SCouponMapper
sCouponMapper
;
@Autowired
private
ISStoreService
storeService
;
@Autowired
private
QPService
qpService
;
//默认时长
//默认时长
private
static
final
String
DEFAULT_DURATION
=
"0"
;
private
static
final
String
DEFAULT_DURATION
=
"0"
;
//默认折扣最大时长
//默认折扣最大时长
...
@@ -31,97 +45,108 @@ public class SCouponServiceImpl implements ISCouponService
...
@@ -31,97 +45,108 @@ public class SCouponServiceImpl implements ISCouponService
//默认优惠开始(有效)时段
//默认优惠开始(有效)时段
private
static
final
String
DEFAULT_START_TIME
=
"00:00"
;
private
static
final
String
DEFAULT_START_TIME
=
"00:00"
;
//默认优惠结束(有效)时段
//默认优惠结束(有效)时段
private
static
final
String
DEFAULT_END_TIME
=
"24:00"
;
private
static
final
String
DEFAULT_END_TIME
=
"23:00"
;
private
static
final
String
TWO
=
"2"
;
/**
/**
* 查询优惠券
* 查询优惠券
*
*
* @param id 优惠券主键
* @param id 优惠券主键
* @return 优惠券
* @return 优惠券
*/
*/
@Override
@Override
public
SCoupon
selectSCouponById
(
Long
id
)
public
SCoupon
selectSCouponById
(
Long
id
)
{
{
return
sCouponMapper
.
selectSCouponById
(
id
);
return
sCouponMapper
.
selectSCouponById
(
id
);
}
}
/**
/**
* 查询优惠券列表
* 查询优惠券列表
*
*
* @param sCoupon 优惠券
* @param sCoupon 优惠券
* @return 优惠券
* @return 优惠券
*/
*/
@Override
@Override
public
List
<
SCoupon
>
selectSCouponList
(
SCoupon
sCoupon
)
public
List
<
SCoupon
>
selectSCouponList
(
SCoupon
sCoupon
)
{
{
return
sCouponMapper
.
selectSCouponList
(
sCoupon
);
return
sCouponMapper
.
selectSCouponList
(
sCoupon
);
}
}
/**
/**
* 新增优惠券
* 新增优惠券
*
*
* @param sCoupon 优惠券
* @param sCoupon 优惠券
* @return 结果
* @return 结果
*/
*/
@Override
@Override
public
int
insertSCoupon
(
SCoupon
sCoupon
)
public
int
insertSCoupon
(
SCoupon
sCoupon
)
{
{
if
(
StringUtils
.
isBlank
(
sCoupon
.
getRoomType
()))
{
if
(
StringUtils
.
isBlank
(
sCoupon
.
getRoomType
()))
{
sCoupon
.
setRoomType
(
RoomType
.
getCodeList
());
sCoupon
.
setRoomType
(
RoomType
.
getCodeList
());
}
}
if
(
StringUtils
.
isBlank
(
sCoupon
.
getStoreType
()))
{
if
(
StringUtils
.
isBlank
(
sCoupon
.
getStoreType
()))
{
sCoupon
.
setStoreType
(
StoreType
.
getCodeList
());
sCoupon
.
setStoreType
(
StoreType
.
getCodeList
());
}
}
sCoupon
.
setValidStartTime
(
DEFAULT_START_TIME
);
if
(
StringUtils
.
isBlank
(
sCoupon
.
getValidStartTime
()))
{
sCoupon
.
setValidEndTime
(
DEFAULT_END_TIME
);
sCoupon
.
setValidStartTime
(
DEFAULT_START_TIME
);
}
if
(
StringUtils
.
isBlank
(
sCoupon
.
getValidEndTime
()))
{
sCoupon
.
setValidEndTime
(
DEFAULT_END_TIME
);
}
sCoupon
.
setMinDuration
(
DEFAULT_DURATION
);
sCoupon
.
setMinDuration
(
DEFAULT_DURATION
);
sCoupon
.
setMaxDuration
(
DEFAULT_MAX_DURATION
);
sCoupon
.
setMaxDuration
(
DEFAULT_MAX_DURATION
);
sCoupon
.
setMinPrice
(
new
BigDecimal
(
"0.00"
));
sCoupon
.
setMinPrice
(
new
BigDecimal
(
"0.00"
));
sCoupon
.
setCreateTime
(
DateUtils
.
getNowDate
());
sCoupon
.
setCreateTime
(
DateUtils
.
getNowDate
());
SCoupon
sCouponList
=
sCouponMapper
.
selectByDealgroupId
(
sCoupon
.
getDealgroupId
());
return
sCouponMapper
.
insertSCoupon
(
sCoupon
);
if
(
ObjectUtils
.
isEmpty
(
sCouponList
))
{
return
sCouponMapper
.
insertSCoupon
(
sCoupon
);
}
else
{
throw
new
RuntimeException
(
"该团购已存在"
);
}
}
}
/**
/**
* 修改优惠券
* 修改优惠券
*
*
* @param sCoupon 优惠券
* @param sCoupon 优惠券
* @return 结果
* @return 结果
*/
*/
@Override
@Override
public
int
updateSCoupon
(
SCoupon
sCoupon
)
public
int
updateSCoupon
(
SCoupon
sCoupon
)
{
{
sCoupon
.
setUpdateTime
(
DateUtils
.
getNowDate
());
sCoupon
.
setUpdateTime
(
DateUtils
.
getNowDate
());
return
sCouponMapper
.
updateSCoupon
(
sCoupon
);
SCoupon
sCouponList
=
sCouponMapper
.
selectByDealgroupId
(
sCoupon
.
getDealgroupId
());
if
(
ObjectUtils
.
isEmpty
(
sCouponList
)
||
sCouponList
.
getId
().
equals
(
sCoupon
.
getId
()))
{
return
sCouponMapper
.
updateSCoupon
(
sCoupon
);
}
else
{
throw
new
RuntimeException
(
"该团购已存在"
);
}
}
}
/**
/**
* 批量删除优惠券
* 批量删除优惠券
*
*
* @param ids 需要删除的优惠券主键
* @param ids 需要删除的优惠券主键
* @return 结果
* @return 结果
*/
*/
@Override
@Override
public
int
deleteSCouponByIds
(
Long
[]
ids
)
public
int
deleteSCouponByIds
(
Long
[]
ids
)
{
{
return
sCouponMapper
.
deleteSCouponByIds
(
ids
);
return
sCouponMapper
.
deleteSCouponByIds
(
ids
);
}
}
/**
/**
* 删除优惠券信息
* 删除优惠券信息
*
*
* @param id 优惠券主键
* @param id 优惠券主键
* @return 结果
* @return 结果
*/
*/
@Override
@Override
public
int
deleteSCouponById
(
Long
id
)
public
int
deleteSCouponById
(
Long
id
)
{
{
return
sCouponMapper
.
deleteSCouponById
(
id
);
return
sCouponMapper
.
deleteSCouponById
(
id
);
}
}
/**
/**
* 根据优惠券名称查询优惠券
* 根据优惠券名称查询优惠券
*
* @param dealTitle
* @param dealTitle
* @return
* @return
*/
*/
...
@@ -134,4 +159,65 @@ public class SCouponServiceImpl implements ISCouponService
...
@@ -134,4 +159,65 @@ public class SCouponServiceImpl implements ISCouponService
public
List
<
SCoupon
>
selectSCouponByIds
(
Long
[]
couponIds
)
{
public
List
<
SCoupon
>
selectSCouponByIds
(
Long
[]
couponIds
)
{
return
sCouponMapper
.
selectSCouponByIds
(
couponIds
);
return
sCouponMapper
.
selectSCouponByIds
(
couponIds
);
}
}
@Override
public
List
<
SCoupon
>
queryShopDeal
()
{
//查询所有门店的shopId
List
<
SStore
>
sStores
=
storeService
.
list
();
//获取所有的openShopUuid,去掉为空的
List
<
String
>
openShopUuids
=
sStores
.
stream
().
map
(
SStore:
:
getOpenShopUuid
).
filter
(
StringUtils:
:
isNotBlank
).
collect
(
Collectors
.
toList
());
Map
<
Long
,
SCoupon
>
sCouponList
=
new
LinkedHashMap
<>();
openShopUuids
.
stream
().
forEach
(
openShopUuid
->
{
List
<
TuangouDealQueryShopDealResponseEntity
>
queryshopdeal
=
qpService
.
queryshopdeal
(
openShopUuid
);
if
(!
CollectionUtils
.
isEmpty
(
queryshopdeal
))
{
queryshopdeal
.
stream
().
forEach
(
item
->
{
if
(
TWO
.
equals
(
item
.
getSale_status
()))
{
SCoupon
sCoupon1
=
sCouponList
.
get
(
item
.
getDealgroup_id
());
if
(
ObjectUtils
.
isEmpty
(
sCoupon1
))
{
SCoupon
sCoupon
=
new
SCoupon
();
//添加团购id
sCoupon
.
setDealgroupId
(
item
.
getDealgroup_id
());
//套餐名称
sCoupon
.
setName
(
item
.
getTitle
());
//套餐原价
sCoupon
.
setSubPrice
(
BigDecimal
.
valueOf
(
item
.
getMarketprice
()));
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
);
try
{
Date
receiptEndDate
=
sdf
.
parse
(
item
.
getReceipt_end_date
());
Date
receiptBeginDate
=
sdf
.
parse
(
item
.
getReceipt_begin_date
());
sCoupon
.
setStartDate
(
receiptBeginDate
);
sCoupon
.
setEndDate
(
receiptEndDate
);
}
catch
(
ParseException
e
)
{
throw
new
RuntimeException
(
e
);
}
sCoupon
.
setRoomType
(
RoomType
.
getCodeList
());
sCoupon
.
setStoreType
(
StoreType
.
getCodeList
());
sCoupon
.
setValidStartTime
(
DEFAULT_START_TIME
);
sCoupon
.
setValidEndTime
(
DEFAULT_END_TIME
);
sCoupon
.
setMinDuration
(
DEFAULT_DURATION
);
sCoupon
.
setMaxDuration
(
DEFAULT_MAX_DURATION
);
sCoupon
.
setMinPrice
(
new
BigDecimal
(
"0.00"
));
sCoupon
.
setCouponType
(
CouponTypeEnum
.
CASH
.
getCode
());
sCouponList
.
put
(
item
.
getDealgroup_id
(),
sCoupon
);
//从门店列表中获取门店id
sCoupon
.
setStoreIds
(
String
.
valueOf
(
sStores
.
stream
().
filter
(
store
->
store
.
getOpenShopUuid
().
equals
(
openShopUuid
)).
findFirst
().
get
().
getId
()));
}
else
{
sCoupon1
.
setStoreIds
(
sCoupon1
.
getStoreIds
()
+
","
+
sStores
.
stream
().
filter
(
store
->
store
.
getOpenShopUuid
().
equals
(
openShopUuid
)).
findFirst
().
get
().
getId
());
}
}
});
}
});
return
new
ArrayList
<>(
sCouponList
.
values
());
}
@Override
public
List
<
SCoupon
>
listDuration
(
SCoupon
sCoupon
)
{
return
sCouponMapper
.
listDuration
(
sCoupon
);
}
@Override
public
List
<
SCoupon
>
selectSCouponByDealgroupId
(
Long
dealgroupId
)
{
return
sCouponMapper
.
selectSCouponByDealgroupId
(
dealgroupId
);
}
}
}
share-system/src/main/java/share/system/service/impl/SOrderServiceImpl.java
View file @
8cf074a9
...
@@ -100,7 +100,6 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
...
@@ -100,7 +100,6 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
private
SmsService
smsService
;
private
SmsService
smsService
;
/**
/**
* 查询订单
* 查询订单
*
*
...
@@ -134,10 +133,10 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
...
@@ -134,10 +133,10 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
@Override
@Override
public
List
<
SOrderVo
>
selectSOrderVoList
(
SOrder
sOrder
)
{
public
List
<
SOrderVo
>
selectSOrderVoList
(
SOrder
sOrder
)
{
LambdaQueryWrapper
<
SOrder
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
LambdaQueryWrapper
<
SOrder
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
if
(
Objects
.
nonNull
(
sOrder
.
getPayStatus
()))
{
if
(
Objects
.
nonNull
(
sOrder
.
getPayStatus
()))
{
queryWrapper
.
eq
(
SOrder:
:
getPayStatus
,
sOrder
.
getPayStatus
());
queryWrapper
.
eq
(
SOrder:
:
getPayStatus
,
sOrder
.
getPayStatus
());
}
}
if
(
Objects
.
nonNull
(
sOrder
.
getConsumerId
()))
{
if
(
Objects
.
nonNull
(
sOrder
.
getConsumerId
()))
{
queryWrapper
.
eq
(
SOrder:
:
getConsumerId
,
sOrder
.
getConsumerId
());
queryWrapper
.
eq
(
SOrder:
:
getConsumerId
,
sOrder
.
getConsumerId
());
}
}
if
(
ObjectUtil
.
isNotEmpty
(
sOrder
.
getStatus
()))
{
if
(
ObjectUtil
.
isNotEmpty
(
sOrder
.
getStatus
()))
{
...
@@ -165,10 +164,10 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
...
@@ -165,10 +164,10 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
}
}
public
List
<
SOrderVo
>
selectPayedSOrderVoList
(
SOrder
sOrder
){
public
List
<
SOrderVo
>
selectPayedSOrderVoList
(
SOrder
sOrder
)
{
if
(
Objects
.
isNull
(
sOrder
.
getConsumerId
()))
{
if
(
Objects
.
isNull
(
sOrder
.
getConsumerId
()))
{
SConsumer
user
=
FrontTokenComponent
.
getWxSConsumerEntry
();
SConsumer
user
=
FrontTokenComponent
.
getWxSConsumerEntry
();
if
(
Objects
.
isNull
(
user
))
{
if
(
Objects
.
isNull
(
user
))
{
throw
new
BaseException
(
"登陆过期!"
);
throw
new
BaseException
(
"登陆过期!"
);
}
}
sOrder
.
setConsumerId
(
user
.
getId
());
sOrder
.
setConsumerId
(
user
.
getId
());
...
@@ -178,21 +177,22 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
...
@@ -178,21 +177,22 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
}
}
/**
/**
* 验证是否可以申请退款
* 验证是否可以申请退款
*
* @param orderVo 订单信息
* @param orderVo 订单信息
* @param coupon 优惠券信息
* @param coupon
优惠券信息
* @return
* @return
*/
*/
private
boolean
isRefund
(
SOrderVo
orderVo
,
SConsumerCoupon
coupon
)
{
@Override
public
boolean
isRefund
(
SOrderVo
orderVo
,
SConsumerCoupon
coupon
)
{
if
(
coupon
!=
null
&&
!
PlatformTypeEnum
.
SELF
.
getCode
().
equals
(
coupon
.
getPlatformType
()))
{
if
(
coupon
!=
null
&&
!
PlatformTypeEnum
.
SELF
.
getCode
().
equals
(
coupon
.
getPlatformType
()))
{
return
Boolean
.
FALSE
;
return
Boolean
.
FALSE
;
}
else
if
(
orderVo
!=
null
&&
OrderStatusEnum
.
UNUSED
.
getCode
().
equals
(
orderVo
.
getStatus
())
}
else
if
(
orderVo
!=
null
&&
OrderStatusEnum
.
UNUSED
.
getCode
().
equals
(
orderVo
.
getStatus
())
&&
OrderTypeEnum
.
RESERVER
.
getCode
().
equals
(
orderVo
.
getOrderType
())){
&&
OrderTypeEnum
.
RESERVER
.
getCode
().
equals
(
orderVo
.
getOrderType
()))
{
Date
startTime
=
orderVo
.
getPreStartDate
();
Date
startTime
=
orderVo
.
getPreStartDate
();
Date
nowTime
=
cn
.
hutool
.
core
.
date
.
DateUtil
.
date
();
Date
nowTime
=
cn
.
hutool
.
core
.
date
.
DateUtil
.
date
();
if
(
startTime
.
compareTo
(
nowTime
)
<=
0
)
{
if
(
startTime
.
compareTo
(
nowTime
)
<=
0
)
{
return
Boolean
.
FALSE
;
return
Boolean
.
FALSE
;
}
}
long
between
=
cn
.
hutool
.
core
.
date
.
DateUtil
.
between
(
nowTime
,
long
between
=
cn
.
hutool
.
core
.
date
.
DateUtil
.
between
(
nowTime
,
...
@@ -206,17 +206,19 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
...
@@ -206,17 +206,19 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
/**
/**
* 验证是否可以申请退款
* 验证是否可以申请退款
* @param order 订单信息
*
* @param order 订单信息
* @param coupon 优惠券信息
* @param coupon 优惠券信息
* @return
* @return
*/
*/
private
boolean
isRefund
(
SOrder
order
,
SConsumerCoupon
coupon
)
{
@Override
public
boolean
isRefund
(
SOrder
order
,
SConsumerCoupon
coupon
)
{
if
(
coupon
!=
null
&&
!
PlatformTypeEnum
.
SELF
.
getCode
().
equals
(
coupon
.
getPlatformType
()))
{
if
(
coupon
!=
null
&&
!
PlatformTypeEnum
.
SELF
.
getCode
().
equals
(
coupon
.
getPlatformType
()))
{
return
Boolean
.
FALSE
;
return
Boolean
.
FALSE
;
}
else
if
(
order
!=
null
&&
OrderStatusEnum
.
UNUSED
.
getCode
().
equals
(
order
.
getStatus
())){
}
else
if
(
order
!=
null
&&
OrderStatusEnum
.
UNUSED
.
getCode
().
equals
(
order
.
getStatus
()))
{
Date
startTime
=
order
.
getPreStartDate
();
Date
startTime
=
order
.
getPreStartDate
();
Date
nowTime
=
cn
.
hutool
.
core
.
date
.
DateUtil
.
date
();
Date
nowTime
=
cn
.
hutool
.
core
.
date
.
DateUtil
.
date
();
if
(
startTime
.
compareTo
(
nowTime
)
<=
0
)
{
if
(
startTime
.
compareTo
(
nowTime
)
<=
0
)
{
return
Boolean
.
FALSE
;
return
Boolean
.
FALSE
;
}
}
long
between
=
cn
.
hutool
.
core
.
date
.
DateUtil
.
between
(
nowTime
,
long
between
=
cn
.
hutool
.
core
.
date
.
DateUtil
.
between
(
nowTime
,
...
@@ -227,6 +229,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
...
@@ -227,6 +229,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
}
}
return
Boolean
.
FALSE
;
return
Boolean
.
FALSE
;
}
}
/**
/**
* 新增订单
* 新增订单
*
*
...
@@ -308,7 +311,22 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
...
@@ -308,7 +311,22 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
//校验订单预约时间
//校验订单预约时间
checkOrderDate
(
request
);
checkOrderDate
(
request
);
//校验订单套餐
//校验订单套餐
checkOrderPack
(
request
,
user
);
checkOrderPack
(
request
,
user
);
SConsumerCoupon
byId
=
null
;
if
(
Objects
.
nonNull
(
request
.
getCouponId
())
&&
request
.
getCouponId
()
!=
0
)
{
byId
=
consumerCouponService
.
getById
(
request
.
getCouponId
());
if
(
Objects
.
nonNull
(
byId
))
{
if
(
byId
.
getUseStatus
().
equals
(
UserStatusEnum
.
UNUSED
.
getCode
()))
{
if
(
StringUtils
.
isNotEmpty
(
byId
.
getCouponCode
()))
{
qpService
.
prepare
(
byId
.
getCouponCode
(),
sStore
.
getOpenShopUuid
(),
ConsumerCouponStatusEnum
.
ORDER
.
getCode
());
}
}
else
{
throw
new
BaseException
(
"优惠券已使用!"
);
}
}
else
{
throw
new
BaseException
(
"优惠券不存在!"
);
}
}
OrderPayResultResponse
response
=
new
OrderPayResultResponse
();
OrderPayResultResponse
response
=
new
OrderPayResultResponse
();
if
(
request
.
getPayFee
().
compareTo
(
BigDecimal
.
ZERO
)
<=
0
)
{
if
(
request
.
getPayFee
().
compareTo
(
BigDecimal
.
ZERO
)
<=
0
)
{
response
.
setPayType
(
PayTypeEnum
.
WECHAT
.
getValue
());
response
.
setPayType
(
PayTypeEnum
.
WECHAT
.
getValue
());
...
@@ -325,34 +343,24 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
...
@@ -325,34 +343,24 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
}
}
save
(
sOrder
);
save
(
sOrder
);
if
(
response
.
getStatus
().
equals
(
YesNoEnum
.
yes
.
getFlag
()))
{
if
(
response
.
getStatus
().
equals
(
YesNoEnum
.
yes
.
getFlag
()))
{
if
(
Objects
.
nonNull
(
request
.
getCouponId
())
&&
request
.
getCouponId
()
!=
0
)
{
if
(
Objects
.
nonNull
(
byId
))
{
SConsumerCoupon
byId
=
consumerCouponService
.
getById
(
request
.
getCouponId
());
if
(
StringUtils
.
isNotEmpty
(
byId
.
getCouponCode
()))
{
if
(
StringUtils
.
isNotEmpty
(
byId
.
getCouponCode
()))
{
if
(
byId
.
getUseStatus
().
equals
(
UserStatusEnum
.
UNUSED
.
getCode
()))
{
//验劵
//验劵
qpService
.
consume
(
byId
.
getCouponCode
(),
1
,
sStore
.
getOpenShopUuid
(),
ConsumerCouponStatusEnum
.
ORDER
.
getCode
());
qpService
.
consume
(
byId
.
getCouponCode
(),
1
,
sStore
.
getOpenShopUuid
(),
ConsumerCouponStatusEnum
.
ORDER
.
getCode
());
}
else
{
throw
new
BaseException
(
"优惠券已使用!"
);
}
}
}
SConsumerCoupon
consumerCoupon
=
new
SConsumerCoupon
();
SConsumerCoupon
consumerCoupon
=
new
SConsumerCoupon
();
consumerCoupon
.
setId
(
request
.
getCouponId
());
consumerCoupon
.
setId
(
request
.
getCouponId
());
consumerCoupon
.
setUseStatus
(
UserStatusEnum
.
USED
.
getCode
());
consumerCoupon
.
setUseStatus
(
UserStatusEnum
.
USED
.
getCode
());
consumerCouponService
.
updateById
(
consumerCoupon
);
consumerCouponService
.
updateById
(
consumerCoupon
);
}
}
SConsumptionRecords
sConsumptionRecords
=
new
SConsumptionRecords
();
sConsumptionRecordsService
.
insertSConsumptionRecords
(
sOrder
);
sConsumptionRecords
.
setConsumerId
(
sOrder
.
getConsumerId
());
sConsumptionRecords
.
setOrderId
(
sOrder
.
getId
());
sConsumptionRecords
.
setName
(
ConsumeNameEnum
.
CONSUME
.
getValue
());
sConsumptionRecords
.
setPrice
(
sOrder
.
getPayPrice
());
sConsumptionRecords
.
setPayType
(
PayTypeEnum
.
WECHAT
.
getName
());
sConsumptionRecords
.
setSign
(
SignEnum
.
BURDEN
.
getValue
());
sConsumptionRecordsService
.
insertSConsumptionRecords
(
sConsumptionRecords
);
Map
<
String
,
String
>
map
=
new
HashMap
<>();
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"orderNo"
,
sOrder
.
getOrderNo
());
map
.
put
(
"orderNo"
,
sOrder
.
getOrderNo
());
map
.
put
(
"expirationTime"
,
sOrder
.
getPreStartDate
().
toString
());
map
.
put
(
"expirationTime"
,
sOrder
.
getPreStartDate
().
toString
());
JSONObject
jsonObject
=
new
JSONObject
(
map
);
JSONObject
jsonObject
=
new
JSONObject
(
map
);
redisUtils
.
set
(
ReceiptRdeisEnum
.
ORDER_NO
.
getValue
()
+
sOrder
.
getOrderNo
(),
jsonObject
.
toString
());
if
(
sOrder
.
getOrderType
().
equals
(
OrderTypeEnum
.
RESERVER
.
getCode
()))
{
redisUtils
.
set
(
ReceiptRdeisEnum
.
ORDER_NO
.
getValue
()
+
sOrder
.
getOrderNo
(),
jsonObject
.
toString
());
}
}
}
if
(
sOrder
.
getOrderType
().
equals
(
OrderTypeEnum
.
RENEW
.
getCode
()))
{
if
(
sOrder
.
getOrderType
().
equals
(
OrderTypeEnum
.
RENEW
.
getCode
()))
{
sOrder
.
setStartDate
(
sOrder
.
getPreStartDate
());
sOrder
.
setStartDate
(
sOrder
.
getPreStartDate
());
...
@@ -366,7 +374,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
...
@@ -366,7 +374,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
deviceOpService
.
actionExecute
(
sOrder
.
getRoomId
(),
sOrder
.
getConsumerPhone
(),
VoiceEnum
.
RENEWAL_SUCCESS
.
getCode
(),
deviceOpService
.
actionExecute
(
sOrder
.
getRoomId
(),
sOrder
.
getConsumerPhone
(),
VoiceEnum
.
RENEWAL_SUCCESS
.
getCode
(),
cn
.
hutool
.
core
.
date
.
DateUtil
.
format
(
new
Date
(),
DatePattern
.
NORM_DATETIME_PATTERN
),
cn
.
hutool
.
core
.
date
.
DateUtil
.
format
(
new
Date
(),
DatePattern
.
NORM_DATETIME_PATTERN
),
cn
.
hutool
.
core
.
date
.
DateUtil
.
format
(
cn
.
hutool
.
core
.
date
.
DateUtil
.
offsetMinute
(
new
Date
(),
1
),
DatePattern
.
NORM_DATETIME_PATTERN
),
"1"
);
cn
.
hutool
.
core
.
date
.
DateUtil
.
format
(
cn
.
hutool
.
core
.
date
.
DateUtil
.
offsetMinute
(
new
Date
(),
1
),
DatePattern
.
NORM_DATETIME_PATTERN
),
"1"
);
SRoom
sRoom
=
roomService
.
getById
(
sOrder
.
getRoomId
());
//
SRoom sRoom = roomService.getById(sOrder.getRoomId());
// //通知保洁人员
// //通知保洁人员
// sConsumerService.selectListByStoreId(sOrder.getStoreId()).stream().forEach(item -> {
// sConsumerService.selectListByStoreId(sOrder.getStoreId()).stream().forEach(item -> {
// // 循环发送短信提示门店保洁打扫卫生
// // 循环发送短信提示门店保洁打扫卫生
...
@@ -379,27 +387,26 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
...
@@ -379,27 +387,26 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
map
.
put
(
"expirationTime"
,
sOrder
.
getEndDate
().
toString
());
map
.
put
(
"expirationTime"
,
sOrder
.
getEndDate
().
toString
());
JSONObject
jsonObject
=
new
JSONObject
(
map
);
JSONObject
jsonObject
=
new
JSONObject
(
map
);
redisUtils
.
set
(
ReceiptRdeisEnum
.
ORDER_NO_KEY
.
getValue
()
+
sOrder
.
getOrderNo
(),
jsonObject
.
toString
());
redisUtils
.
set
(
ReceiptRdeisEnum
.
ORDER_NO_KEY
.
getValue
()
+
sOrder
.
getOrderNo
(),
jsonObject
.
toString
());
redisUtils
.
delete
(
ReceiptRdeisEnum
.
ORDER_NO
.
getValue
()
+
sOrder
.
getOrderNo
());
}
}
return
response
;
return
response
;
}
}
private
void
checkOrderPack
(
CreateOrderRequest
request
,
SConsumer
user
)
{
private
void
checkOrderPack
(
CreateOrderRequest
request
,
SConsumer
user
)
{
if
(
Objects
.
nonNull
(
request
.
getPackId
())
&&
request
.
getPackId
()>
0
)
{
if
(
Objects
.
nonNull
(
request
.
getPackId
())
&&
request
.
getPackId
()
>
0
)
{
//判断是否首次订单套餐
//判断是否首次订单套餐
SPack
pack
=
packService
.
getById
(
request
.
getPackId
());
SPack
pack
=
packService
.
getById
(
request
.
getPackId
());
if
(
Objects
.
isNull
(
pack
)||
Objects
.
isNull
(
pack
.
getId
()))
{
if
(
Objects
.
isNull
(
pack
)
||
Objects
.
isNull
(
pack
.
getId
()))
{
throw
new
BaseException
(
"下单套餐不存在!"
);
throw
new
BaseException
(
"下单套餐不存在!"
);
}
}
if
(
YesNoEnum
.
yes
.
getIndex
().
compareTo
(
pack
.
getFirstOrderAvailable
())==
0
)
{
if
(
YesNoEnum
.
yes
.
getIndex
().
compareTo
(
pack
.
getFirstOrderAvailable
())
==
0
)
{
List
<
SOrder
>
orderList
=
payedUnrefundListByUserId
(
user
.
getId
());
List
<
SOrder
>
orderList
=
payedUnrefundListByUserId
(
user
.
getId
());
if
(
CollectionUtils
.
isNotEmpty
(
orderList
))
{
if
(
CollectionUtils
.
isNotEmpty
(
orderList
))
{
throw
new
BaseException
(
"当前套餐仅首次下单可用!"
);
throw
new
BaseException
(
"当前套餐仅首次下单可用!"
);
}
}
}
}
if
(
Objects
.
nonNull
(
pack
.
getPackaStartPeriod
())&&
Objects
.
nonNull
(
pack
.
getPackaEndPeriod
())
if
(
Objects
.
nonNull
(
pack
.
getPackaStartPeriod
())
&&
Objects
.
nonNull
(
pack
.
getPackaEndPeriod
())
&&(!
StringUtils
.
equals
(
pack
.
getPackaStartPeriod
(),
"0"
)||!
StringUtils
.
equals
(
pack
.
getPackaEndPeriod
(),
"23"
)))
{
&&
(!
StringUtils
.
equals
(
pack
.
getPackaStartPeriod
(),
"0"
)
||
!
StringUtils
.
equals
(
pack
.
getPackaEndPeriod
(),
"23"
)))
{
Integer
preStartHour
=
Integer
.
parseInt
(
DateUtils
.
parseDateToStr
(
"H"
,
request
.
getPreStartDate
()));
Integer
preStartHour
=
Integer
.
parseInt
(
DateUtils
.
parseDateToStr
(
"H"
,
request
.
getPreStartDate
()));
Integer
preEndHour
=
Integer
.
parseInt
(
DateUtils
.
parseDateToStr
(
"H"
,
request
.
getPreEndDate
()));
Integer
preEndHour
=
Integer
.
parseInt
(
DateUtils
.
parseDateToStr
(
"H"
,
request
.
getPreEndDate
()));
Integer
packaStartPeriod
=
Integer
.
parseInt
(
pack
.
getPackaStartPeriod
());
Integer
packaStartPeriod
=
Integer
.
parseInt
(
pack
.
getPackaStartPeriod
());
...
@@ -411,7 +418,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
...
@@ -411,7 +418,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
throw
new
BaseException
(
"预约时段非套餐可用时段!"
);
throw
new
BaseException
(
"预约时段非套餐可用时段!"
);
}
}
//1 开始时段>结束时段,代表可用时段跨日,则应该预约开始时间<可用开始时间,预约结束时间>可用结束时间
//1 开始时段>结束时段,代表可用时段跨日,则应该预约开始时间<可用开始时间,预约结束时间>可用结束时间
}
else
{
}
else
{
if
(
packaStartPeriod
.
compareTo
(
preStartHour
)
<
0
||
preEndHour
.
compareTo
(
packaEndPeriod
)
<
0
)
{
if
(
packaStartPeriod
.
compareTo
(
preStartHour
)
<
0
||
preEndHour
.
compareTo
(
packaEndPeriod
)
<
0
)
{
throw
new
BaseException
(
"预约时段非套餐可用时段!"
);
throw
new
BaseException
(
"预约时段非套餐可用时段!"
);
}
}
...
@@ -743,21 +750,14 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
...
@@ -743,21 +750,14 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
deviceOpService
.
actionExecute
(
sOrder
.
getRoomId
(),
sOrder
.
getConsumerPhone
(),
VoiceEnum
.
RENEWAL_SUCCESS
.
getCode
(),
deviceOpService
.
actionExecute
(
sOrder
.
getRoomId
(),
sOrder
.
getConsumerPhone
(),
VoiceEnum
.
RENEWAL_SUCCESS
.
getCode
(),
cn
.
hutool
.
core
.
date
.
DateUtil
.
format
(
new
Date
(),
DatePattern
.
NORM_DATETIME_PATTERN
),
cn
.
hutool
.
core
.
date
.
DateUtil
.
format
(
new
Date
(),
DatePattern
.
NORM_DATETIME_PATTERN
),
cn
.
hutool
.
core
.
date
.
DateUtil
.
format
(
cn
.
hutool
.
core
.
date
.
DateUtil
.
offsetMinute
(
new
Date
(),
1
),
DatePattern
.
NORM_DATETIME_PATTERN
),
"1"
);
cn
.
hutool
.
core
.
date
.
DateUtil
.
format
(
cn
.
hutool
.
core
.
date
.
DateUtil
.
offsetMinute
(
new
Date
(),
1
),
DatePattern
.
NORM_DATETIME_PATTERN
),
"1"
);
SRoom
sRoom
=
roomService
.
getById
(
sOrder
.
getRoomId
());
//
SRoom sRoom = roomService.getById(sOrder.getRoomId());
//通知保洁人员
//
//通知保洁人员
// sConsumerService.selectListByStoreId(sOrder.getStoreId()).stream().forEach(item -> {
// sConsumerService.selectListByStoreId(sOrder.getStoreId()).stream().forEach(item -> {
// // 循环发送短信提示门店保洁打扫卫生
// // 循环发送短信提示门店保洁打扫卫生
// smsService.sendSmsCleanRecordsStopRemind(item.getPhone(), sStore, sRoom);
// smsService.sendSmsCleanRecordsStopRemind(item.getPhone(), sStore, sRoom);
// });
// });
}
}
SConsumptionRecords
sConsumptionRecords
=
new
SConsumptionRecords
();
sConsumptionRecordsService
.
insertSConsumptionRecords
(
sOrder
);
sConsumptionRecords
.
setConsumerId
(
sOrder
.
getConsumerId
());
sConsumptionRecords
.
setOrderId
(
sOrder
.
getId
());
sConsumptionRecords
.
setName
(
ConsumeNameEnum
.
CONSUME
.
getValue
());
sConsumptionRecords
.
setPrice
(
sOrder
.
getPayPrice
());
sConsumptionRecords
.
setPayType
(
PayTypeEnum
.
WECHAT
.
getName
());
sConsumptionRecords
.
setSign
(
SignEnum
.
BURDEN
.
getValue
());
sConsumptionRecordsService
.
insertSConsumptionRecords
(
sConsumptionRecords
);
}
}
@Override
@Override
...
@@ -767,6 +767,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
...
@@ -767,6 +767,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
/**
/**
* 小程序申请退款
* 小程序申请退款
*
* @param request
* @param request
* @return
* @return
*/
*/
...
@@ -812,28 +813,29 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
...
@@ -812,28 +813,29 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
e
.
printStackTrace
();
e
.
printStackTrace
();
throw
new
BaseException
(
"微信申请退款失败!"
);
throw
new
BaseException
(
"微信申请退款失败!"
);
}
}
}
else
{
//修改订单退款状态,退款成功
sOrder
.
setStatus
(
OrderStatusEnum
.
CANCEL
.
getCode
());
sOrder
.
setRefundStatus
(
RefundStatusEnum
.
REFUNDED
.
getCode
());
sOrder
.
setRefundReasonTime
(
cn
.
hutool
.
core
.
date
.
DateUtil
.
date
());
sOrder
.
setRefundPrice
(
BigDecimal
.
ZERO
);
Boolean
execute
=
Boolean
.
FALSE
;
try
{
sOrder
.
setRefundReason
(
request
.
getRefundReason
());
updateById
(
sOrder
);
//微信退款
// if (sOrder.getPayType().equals(PayTypeEnum.WECHAT.getCode()) && request.getAmount().compareTo(BigDecimal.ZERO) == 0) {
// 退款task, 定时任务退优惠券
redisUtil
.
lPush
(
Constants
.
ORDER_TASK_REDIS_KEY_AFTER_REFUND_BY_USER
,
sOrder
.
getId
());
// }
execute
=
Boolean
.
TRUE
;
}
catch
(
Exception
e
)
{
logger
.
error
(
e
.
toString
());
}
if
(!
execute
)
{
throw
new
BaseException
(
"订单更新失败"
);
}
}
}
//修改订单退款状态,退款成功
// sOrder.setStatus(OrderStatusEnum.CANCEL.getCode());
// sOrder.setRefundStatus(RefundStatusEnum.REFUNDED.getCode());
// sOrder.setRefundReasonTime(cn.hutool.core.date.DateUtil.date());
// sOrder.setRefundPrice(request.getAmount());
// Boolean execute = Boolean.FALSE;
// try {
// sOrder.setRefundReason(request.getRefundReason());
// updateById(sOrder);
// //微信退款
// if (sOrder.getPayType().equals(PayTypeEnum.WECHAT.getCode()) && request.getAmount().compareTo(BigDecimal.ZERO) == 0) {
// // 退款task, 定时任务退优惠券
// redisUtil.lPush(Constants.ORDER_TASK_REDIS_KEY_AFTER_REFUND_BY_USER, sOrder.getId());
// }
// execute = Boolean.TRUE;
// } catch (Exception e) {
// logger.error(e.toString());
// }
// if (!execute) {
// throw new BaseException("订单更新失败");
// }
return
Boolean
.
TRUE
;
return
Boolean
.
TRUE
;
}
}
...
@@ -843,7 +845,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
...
@@ -843,7 +845,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
queryWrapper
.
eq
(
SOrder:
:
getPayStatus
,
YesNoEnum
.
yes
.
getIndex
());
queryWrapper
.
eq
(
SOrder:
:
getPayStatus
,
YesNoEnum
.
yes
.
getIndex
());
queryWrapper
.
eq
(
SOrder:
:
getConsumerId
,
userId
);
queryWrapper
.
eq
(
SOrder:
:
getConsumerId
,
userId
);
queryWrapper
.
notIn
(
SOrder:
:
getRefundStatus
,
RefundStatusEnum
.
getRefundedStatus
());
queryWrapper
.
notIn
(
SOrder:
:
getRefundStatus
,
RefundStatusEnum
.
getRefundedStatus
());
queryWrapper
.
in
(
SOrder:
:
getStatus
,
new
ArrayList
<
Integer
>(){{
queryWrapper
.
in
(
SOrder:
:
getStatus
,
new
ArrayList
<
Integer
>()
{{
add
(
OrderStatusEnum
.
UNUSED
.
getCode
());
add
(
OrderStatusEnum
.
UNUSED
.
getCode
());
add
(
OrderStatusEnum
.
INUSE
.
getCode
());
add
(
OrderStatusEnum
.
INUSE
.
getCode
());
add
(
OrderStatusEnum
.
USED
.
getCode
());
add
(
OrderStatusEnum
.
USED
.
getCode
());
...
@@ -885,7 +887,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
...
@@ -885,7 +887,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
vo
.
setRoomTypeName
(
RoomType
.
getNameByCode
(
room
.
getRoomType
()));
vo
.
setRoomTypeName
(
RoomType
.
getNameByCode
(
room
.
getRoomType
()));
}
}
});
});
if
(
Objects
.
nonNull
(
vo
.
getCouponId
()))
{
if
(
Objects
.
nonNull
(
vo
.
getCouponId
()))
{
userCouponList
.
stream
().
forEach
(
userCoupon
->
{
userCouponList
.
stream
().
forEach
(
userCoupon
->
{
if
(
userCoupon
.
getId
().
equals
(
vo
.
getCouponId
()))
{
if
(
userCoupon
.
getId
().
equals
(
vo
.
getCouponId
()))
{
// 判断是否可以退款
// 判断是否可以退款
...
@@ -894,7 +896,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
...
@@ -894,7 +896,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
}
}
});
});
}
else
{
}
else
{
// 判断是否可以退款
// 判断是否可以退款
vo
.
setIsRefund
(
isRefund
(
o
,
null
));
vo
.
setIsRefund
(
isRefund
(
o
,
null
));
}
}
...
@@ -942,14 +944,14 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
...
@@ -942,14 +944,14 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
).
collect
(
Collectors
.
toList
()).
isEmpty
())
{
).
collect
(
Collectors
.
toList
()).
isEmpty
())
{
throw
new
BaseException
(
"房间取电设备不存在!"
);
throw
new
BaseException
(
"房间取电设备不存在!"
);
}
}
if
(
ObjectUtil
.
isNotEmpty
(
sOrder
.
getArrivalTim
e
()))
{
if
(
sOrder
.
getStatus
().
equals
(
OrderStatusEnum
.
UNUSED
.
getCod
e
()))
{
if
(
RoomStatusEnum
.
HOLD
.
getValue
().
compareTo
(
sRoomVo
.
getStatus
())
==
0
if
(
RoomStatusEnum
.
HOLD
.
getValue
().
compareTo
(
sRoomVo
.
getStatus
())
==
0
||!
checkOrderOpenDoor
(
sOrder
))
{
||
!
checkOrderOpenDoor
(
sOrder
))
{
throw
new
BaseException
(
"房间当前时段已被占用不可开门!"
);
throw
new
BaseException
(
"房间当前时段已被占用不可开门!"
);
}
}
//判断预约时间是否到达,可提前一个小时开门
//判断预约时间是否到达,可提前一个小时开门
if
(
DateUtils
.
addHours
(
sOrder
.
getPreStartDate
(),
Constants
.
OPEN_DOOR_AHEAD_HOUR_MINUS
).
compareTo
(
new
Date
())
>
0
)
{
if
(
DateUtils
.
addHours
(
sOrder
.
getPreStartDate
(),
Constants
.
OPEN_DOOR_AHEAD_HOUR_MINUS
).
compareTo
(
new
Date
())
>
0
)
{
throw
new
BaseException
(
"预约时间未到达,可提前"
+
Constants
.
OPEN_DOOR_AHEAD_HOUR
+
"小时进场,请耐心等候!"
);
throw
new
BaseException
(
"预约时间未到达,可提前"
+
Constants
.
OPEN_DOOR_AHEAD_HOUR
+
"小时进场,请耐心等候!"
);
}
}
//更改订单状态,房间状态,开始时间,结束时间
//更改订单状态,房间状态,开始时间,结束时间
sOrder
.
setStatus
(
OrderStatusEnum
.
INUSE
.
getCode
());
sOrder
.
setStatus
(
OrderStatusEnum
.
INUSE
.
getCode
());
...
@@ -982,9 +984,17 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
...
@@ -982,9 +984,17 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
cn
.
hutool
.
core
.
date
.
DateUtil
.
format
(
new
Date
(),
DatePattern
.
NORM_DATETIME_PATTERN
),
cn
.
hutool
.
core
.
date
.
DateUtil
.
format
(
new
Date
(),
DatePattern
.
NORM_DATETIME_PATTERN
),
cn
.
hutool
.
core
.
date
.
DateUtil
.
format
(
cn
.
hutool
.
core
.
date
.
DateUtil
.
offsetMinute
(
new
Date
(),
1
),
cn
.
hutool
.
core
.
date
.
DateUtil
.
format
(
cn
.
hutool
.
core
.
date
.
DateUtil
.
offsetMinute
(
new
Date
(),
1
),
DatePattern
.
NORM_DATETIME_PATTERN
),
"1"
,
10L
);
DatePattern
.
NORM_DATETIME_PATTERN
),
"1"
,
10L
);
}
else
{
}
else
{
deviceOpService
.
openDoor
(
sRoomVo
.
getId
(),
sOrder
.
getConsumerPhone
());
deviceOpService
.
openDoor
(
sRoomVo
.
getId
(),
sOrder
.
getConsumerPhone
());
if
(
ObjectUtil
.
isEmpty
(
sOrder
.
getArrivalTime
()))
{
//语音
deviceOpService
.
asyncActionExecute
(
sOrder
.
getRoomId
(),
sOrder
.
getConsumerPhone
(),
VoiceEnum
.
OPEN
.
getCode
(),
cn
.
hutool
.
core
.
date
.
DateUtil
.
format
(
new
Date
(),
DatePattern
.
NORM_DATETIME_PATTERN
),
cn
.
hutool
.
core
.
date
.
DateUtil
.
format
(
cn
.
hutool
.
core
.
date
.
DateUtil
.
offsetMinute
(
new
Date
(),
1
),
DatePattern
.
NORM_DATETIME_PATTERN
),
"1"
,
10L
);
sOrder
.
setArrivalTime
(
new
Date
());
baseMapper
.
updateById
(
sOrder
);
}
}
}
return
"开锁成功"
;
return
"开锁成功"
;
}
}
...
@@ -1012,9 +1022,9 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
...
@@ -1012,9 +1022,9 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
}});
}});
//订单开始时间大于等于当前时间 并且 订单开始时间小于等于当前订单实际结束时间+30分钟保洁
//订单开始时间大于等于当前时间 并且 订单开始时间小于等于当前订单实际结束时间+30分钟保洁
BigDecimal
bigDecimal
=
DateUtils
.
differentHour
(
order
.
getPreStartDate
(),
order
.
getPreEndDate
());
BigDecimal
bigDecimal
=
DateUtils
.
differentHour
(
order
.
getPreStartDate
(),
order
.
getPreEndDate
());
Date
orderEndDate
=
DateUtils
.
addMinutes
(
DateUtils
.
addHours
(
new
Date
(),
bigDecimal
.
intValue
()),
Constants
.
ROOM_LOCK_DELAY_MINUTE
);
Date
orderEndDate
=
DateUtils
.
addMinutes
(
DateUtils
.
addHours
(
new
Date
(),
bigDecimal
.
intValue
()),
Constants
.
ROOM_LOCK_DELAY_MINUTE
);
queryWrapper
.
apply
(
"IFNULL(start_date,pre_start_date) >= '"
+
DateUtils
.
getTime
()
+
"' "
+
queryWrapper
.
apply
(
"IFNULL(start_date,pre_start_date) >= '"
+
DateUtils
.
getTime
()
+
"' "
+
" AND IFNULL(start_date,pre_start_date) <= '"
+
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD_HH_MM_SS
,
orderEndDate
)
+
"'"
);
" AND IFNULL(start_date,pre_start_date) <= '"
+
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD_HH_MM_SS
,
orderEndDate
)
+
"'"
);
return
count
(
queryWrapper
)
==
0
;
return
count
(
queryWrapper
)
==
0
;
}
}
...
@@ -1046,9 +1056,9 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
...
@@ -1046,9 +1056,9 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
priceResponse
.
setPayFee
(
payPrice
);
priceResponse
.
setPayFee
(
payPrice
);
}
else
{
}
else
{
// 判断优惠券是否可以使用
// 判断优惠券是否可以使用
if
(
Objects
.
nonNull
(
user
)&&
Objects
.
nonNull
(
request
.
getCouponId
()))
{
if
(
Objects
.
nonNull
(
user
)
&&
Objects
.
nonNull
(
request
.
getCouponId
()))
{
SConsumerCoupon
consumerCoupon
=
consumerCouponService
.
getById
(
request
.
getCouponId
());
SConsumerCoupon
consumerCoupon
=
consumerCouponService
.
getById
(
request
.
getCouponId
());
computedCouponPrice
(
priceResponse
,
user
,
consumerCoupon
);
computedCouponPrice
(
request
,
priceResponse
,
user
,
consumerCoupon
);
}
}
}
}
return
priceResponse
;
return
priceResponse
;
...
@@ -1065,7 +1075,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
...
@@ -1065,7 +1075,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
/**
/**
* 计算使用优惠券后的订单金额
* 计算使用优惠券后的订单金额
*/
*/
private
void
computedCouponPrice
(
ComputedOrderPriceResponse
priceResponse
,
SConsumer
user
,
SConsumerCoupon
consumerCoupon
)
{
private
void
computedCouponPrice
(
OrderComputedPriceRequest
request
,
ComputedOrderPriceResponse
priceResponse
,
SConsumer
user
,
SConsumerCoupon
consumerCoupon
)
{
if
(
ObjectUtil
.
isNull
(
consumerCoupon
)
||
!
consumerCoupon
.
getConsumerId
().
equals
(
user
.
getId
()))
{
if
(
ObjectUtil
.
isNull
(
consumerCoupon
)
||
!
consumerCoupon
.
getConsumerId
().
equals
(
user
.
getId
()))
{
throw
new
BaseException
(
"优惠券领取记录不存在!"
);
throw
new
BaseException
(
"优惠券领取记录不存在!"
);
}
}
...
@@ -1085,7 +1096,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
...
@@ -1085,7 +1096,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
case
DISCOUNT:
//TODO 折扣券
case
DISCOUNT:
//TODO 折扣券
break
;
break
;
case
PACKAGE:
//套餐券
case
PACKAGE:
//套餐券
case
CASH:
//现金券
case
CASH:
//现金券
(团购券)
//判断优惠券最小使用金额
//判断优惠券最小使用金额
if
(
consumerCoupon
.
getMinPrice
().
compareTo
(
priceResponse
.
getTotalFee
())
>
0
)
{
if
(
consumerCoupon
.
getMinPrice
().
compareTo
(
priceResponse
.
getTotalFee
())
>
0
)
{
throw
new
BaseException
(
"总金额小于优惠券最小使用金额"
);
throw
new
BaseException
(
"总金额小于优惠券最小使用金额"
);
...
@@ -1099,7 +1110,20 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
...
@@ -1099,7 +1110,20 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
priceResponse
.
setPayFee
(
subtract
);
priceResponse
.
setPayFee
(
subtract
);
}
}
break
;
break
;
case
DURATION:
//TODO 时长券
case
DURATION:
//时长券
BigDecimal
timeLong
=
DateUtils
.
differentHour
(
request
.
getPreStartDate
(),
request
.
getPreEndDate
());
if
(
new
BigDecimal
(
consumerCoupon
.
getMinDuration
()).
compareTo
(
timeLong
)
>
0
)
{
throw
new
BaseException
(
"总时长小于优惠券最小使用时长"
);
}
BigDecimal
duration
=
new
BigDecimal
(
consumerCoupon
.
getDuration
());
if
(
duration
.
compareTo
(
timeLong
)
>=
0
)
{
priceResponse
.
setPayFee
(
BigDecimal
.
ZERO
);
priceResponse
.
setCouponFee
(
priceResponse
.
getTotalFee
());
}
else
{
BigDecimal
unitPrice
=
priceResponse
.
getTotalFee
().
divide
(
timeLong
);
priceResponse
.
setPayFee
(
unitPrice
.
multiply
(
timeLong
.
subtract
(
duration
)));
priceResponse
.
setCouponFee
(
priceResponse
.
getTotalFee
().
subtract
(
priceResponse
.
getPayFee
()));
}
break
;
break
;
default
:
default
:
break
;
break
;
...
...
share-system/src/main/java/share/system/service/impl/SStoreServiceImpl.java
View file @
8cf074a9
...
@@ -405,6 +405,9 @@ public class SStoreServiceImpl extends ServiceImpl<SStoreMapper, SStore> impleme
...
@@ -405,6 +405,9 @@ public class SStoreServiceImpl extends ServiceImpl<SStoreMapper, SStore> impleme
}
}
//查询所有房间
//查询所有房间
List
<
SRoomVo
>
roomVoList
=
sRoomService
.
listByStoreIds
(
storeIds
);
List
<
SRoomVo
>
roomVoList
=
sRoomService
.
listByStoreIds
(
storeIds
);
List
<
Long
>
roomIdList
=
Optional
.
ofNullable
(
roomVoList
).
orElse
(
new
ArrayList
<>()).
stream
().
map
(
SRoomVo:
:
getId
).
collect
(
Collectors
.
toList
());
List
<
SCleanRecords
>
sCleanRecordsList
=
cleanRecordsService
.
unCleanedListByRoomIds
(
roomIdList
);
Map
<
Long
,
List
<
SCleanRecords
>>
recordsMap
=
Optional
.
ofNullable
(
sCleanRecordsList
).
orElse
(
new
ArrayList
<>()).
stream
().
collect
(
Collectors
.
groupingBy
(
SCleanRecords:
:
getRoomId
));
//查询所有设备
//查询所有设备
List
<
Device
>
deviceList
=
deviceService
.
list
();
List
<
Device
>
deviceList
=
deviceService
.
list
();
//遍历门店
//遍历门店
...
@@ -412,6 +415,11 @@ public class SStoreServiceImpl extends ServiceImpl<SStoreMapper, SStore> impleme
...
@@ -412,6 +415,11 @@ public class SStoreServiceImpl extends ServiceImpl<SStoreMapper, SStore> impleme
List
<
SRoomVo
>
roomVos
=
new
ArrayList
<>();
List
<
SRoomVo
>
roomVos
=
new
ArrayList
<>();
//遍历房间
//遍历房间
roomVoList
.
stream
().
forEach
(
room
->
{
roomVoList
.
stream
().
forEach
(
room
->
{
if
(
CollectionUtils
.
isNotEmpty
(
recordsMap
.
get
(
room
.
getId
())))
{
SCleanRecords
records
=
recordsMap
.
get
(
room
.
getId
()).
get
(
0
);
room
.
setRecordsStatus
(
records
.
getStatus
());
room
.
setRecordsId
(
records
.
getId
());
}
List
<
Device
>
devices
=
new
ArrayList
<>();
List
<
Device
>
devices
=
new
ArrayList
<>();
deviceList
.
stream
().
forEach
(
device
->
{
deviceList
.
stream
().
forEach
(
device
->
{
if
(
room
.
getId
().
compareTo
(
device
.
getRoomId
())
==
0
)
{
if
(
room
.
getId
().
compareTo
(
device
.
getRoomId
())
==
0
)
{
...
...
share-system/src/main/resources/mapper/system/CouponLogMapper.xml
View file @
8cf074a9
...
@@ -14,6 +14,7 @@
...
@@ -14,6 +14,7 @@
<result
property=
"couponType"
column=
"coupon_type"
/>
<result
property=
"couponType"
column=
"coupon_type"
/>
<result
property=
"couponValue"
column=
"coupon_value"
/>
<result
property=
"couponValue"
column=
"coupon_value"
/>
<result
property=
"status"
column=
"status"
/>
<result
property=
"status"
column=
"status"
/>
<result
property=
"number"
column=
"number"
/>
<result
property=
"message"
column=
"message"
/>
<result
property=
"message"
column=
"message"
/>
<result
property=
"createBy"
column=
"create_by"
/>
<result
property=
"createBy"
column=
"create_by"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"createTime"
column=
"create_time"
/>
...
@@ -31,6 +32,7 @@
...
@@ -31,6 +32,7 @@
coupon_name,
coupon_name,
coupon_type,
coupon_type,
coupon_value,
coupon_value,
number,
status,
status,
message,
message,
create_by,
create_by,
...
@@ -50,6 +52,7 @@
...
@@ -50,6 +52,7 @@
<if
test=
"couponId != null "
>
and coupon_id = #{couponId}
</if>
<if
test=
"couponId != null "
>
and coupon_id = #{couponId}
</if>
<if
test=
"couponName != null and couponName != ''"
>
and coupon_name like concat('%', #{couponName}, '%')
<if
test=
"couponName != null and couponName != ''"
>
and coupon_name like concat('%', #{couponName}, '%')
</if>
</if>
<if
test=
"number != null "
>
and number = #{number}
</if>
<if
test=
"couponType != null and couponType != ''"
>
and coupon_type = #{couponType}
</if>
<if
test=
"couponType != null and couponType != ''"
>
and coupon_type = #{couponType}
</if>
<if
test=
"couponValue != null "
>
and coupon_value = #{couponValue}
</if>
<if
test=
"couponValue != null "
>
and coupon_value = #{couponValue}
</if>
<if
test=
"status != null and status != ''"
>
and status = #{status}
</if>
<if
test=
"status != null and status != ''"
>
and status = #{status}
</if>
...
@@ -73,6 +76,7 @@
...
@@ -73,6 +76,7 @@
<if
test=
"couponType != null and couponType != ''"
>
coupon_type,
</if>
<if
test=
"couponType != null and couponType != ''"
>
coupon_type,
</if>
<if
test=
"couponValue != null"
>
coupon_value,
</if>
<if
test=
"couponValue != null"
>
coupon_value,
</if>
<if
test=
"status != null and status != ''"
>
status,
</if>
<if
test=
"status != null and status != ''"
>
status,
</if>
<if
test=
"number != null"
>
number,
</if>
<if
test=
"message != null and message != ''"
>
message,
</if>
<if
test=
"message != null and message != ''"
>
message,
</if>
<if
test=
"createBy != null"
>
create_by,
</if>
<if
test=
"createBy != null"
>
create_by,
</if>
<if
test=
"createTime != null"
>
create_time,
</if>
<if
test=
"createTime != null"
>
create_time,
</if>
...
@@ -89,6 +93,7 @@
...
@@ -89,6 +93,7 @@
<if
test=
"couponType != null and couponType != ''"
>
#{couponType},
</if>
<if
test=
"couponType != null and couponType != ''"
>
#{couponType},
</if>
<if
test=
"couponValue != null"
>
#{couponValue},
</if>
<if
test=
"couponValue != null"
>
#{couponValue},
</if>
<if
test=
"status != null and status != ''"
>
#{status},
</if>
<if
test=
"status != null and status != ''"
>
#{status},
</if>
<if
test=
"number != null"
>
#{number},
</if>
<if
test=
"message != null and message != ''"
>
#{message},
</if>
<if
test=
"message != null and message != ''"
>
#{message},
</if>
<if
test=
"createBy != null"
>
#{createBy},
</if>
<if
test=
"createBy != null"
>
#{createBy},
</if>
<if
test=
"createTime != null"
>
#{createTime},
</if>
<if
test=
"createTime != null"
>
#{createTime},
</if>
...
@@ -109,6 +114,7 @@
...
@@ -109,6 +114,7 @@
<if
test=
"couponType != null and couponType != ''"
>
coupon_type = #{couponType},
</if>
<if
test=
"couponType != null and couponType != ''"
>
coupon_type = #{couponType},
</if>
<if
test=
"couponValue != null"
>
coupon_value = #{couponValue},
</if>
<if
test=
"couponValue != null"
>
coupon_value = #{couponValue},
</if>
<if
test=
"status != null and status != ''"
>
status = #{status},
</if>
<if
test=
"status != null and status != ''"
>
status = #{status},
</if>
<if
test=
"number != null"
>
number = #{number},
</if>
<if
test=
"message != null and message != ''"
>
message = #{message},
</if>
<if
test=
"message != null and message != ''"
>
message = #{message},
</if>
<if
test=
"createBy != null"
>
create_by = #{createBy},
</if>
<if
test=
"createBy != null"
>
create_by = #{createBy},
</if>
<if
test=
"createTime != null"
>
create_time = #{createTime},
</if>
<if
test=
"createTime != null"
>
create_time = #{createTime},
</if>
...
...
share-system/src/main/resources/mapper/system/SConsumerCouponMapper.xml
View file @
8cf074a9
...
@@ -10,6 +10,8 @@
...
@@ -10,6 +10,8 @@
<result
property=
"couponId"
column=
"coupon_id"
/>
<result
property=
"couponId"
column=
"coupon_id"
/>
<result
property=
"storeId"
column=
"store_id"
/>
<result
property=
"storeId"
column=
"store_id"
/>
<result
property=
"dealId"
column=
"deal_id"
/>
<result
property=
"dealId"
column=
"deal_id"
/>
<result
property=
"dealgroupId"
column=
"dealgroup_id"
/>
<result
property=
"storeIds"
column=
"store_ids"
/>
<result
property=
"couponCode"
column=
"coupon_code"
/>
<result
property=
"couponCode"
column=
"coupon_code"
/>
<result
property=
"name"
column=
"name"
/>
<result
property=
"name"
column=
"name"
/>
<result
property=
"couponType"
column=
"coupon_type"
/>
<result
property=
"couponType"
column=
"coupon_type"
/>
...
@@ -31,6 +33,7 @@
...
@@ -31,6 +33,7 @@
<result
property=
"useDate"
column=
"use_date"
/>
<result
property=
"useDate"
column=
"use_date"
/>
<result
property=
"useStatus"
column=
"use_status"
/>
<result
property=
"useStatus"
column=
"use_status"
/>
<result
property=
"isDelete"
column=
"is_delete"
/>
<result
property=
"isDelete"
column=
"is_delete"
/>
<result
property=
"weeks"
column=
"weeks"
/>
<result
property=
"createBy"
column=
"create_by"
/>
<result
property=
"createBy"
column=
"create_by"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"updateBy"
column=
"update_by"
/>
<result
property=
"updateBy"
column=
"update_by"
/>
...
@@ -46,6 +49,8 @@
...
@@ -46,6 +49,8 @@
coupon_id,
coupon_id,
store_id,
store_id,
deal_id,
deal_id,
dealgroup_id,
store_ids,
coupon_code,
coupon_code,
name,
name,
coupon_type,
coupon_type,
...
@@ -63,6 +68,7 @@
...
@@ -63,6 +68,7 @@
use_date,
use_date,
use_status,
use_status,
is_delete,
is_delete,
weeks,
create_by,
create_by,
create_time,
create_time,
update_by,
update_by,
...
@@ -101,7 +107,8 @@
...
@@ -101,7 +107,8 @@
<if
test=
"startDate != null "
>
and start_date = #{startDate}
</if>
<if
test=
"startDate != null "
>
and start_date = #{startDate}
</if>
<if
test=
"endDate != null "
>
and end_date = #{endDate}
</if>
<if
test=
"endDate != null "
>
and end_date = #{endDate}
</if>
<if
test=
"useDate != null "
>
and use_date = #{useDate}
</if>
<if
test=
"useDate != null "
>
and use_date = #{useDate}
</if>
<if
test=
"useStatus != null and useStatus != ''"
>
and use_status = #{useStatus}
</if>
<if
test=
"useStatus != null and useStatus != '' or useStatus==0"
>
and use_status = #{useStatus}
</if>
<if
test=
"weeks != null and weeks != ''"
>
and weeks = #{weeks}
</if>
<if
test=
"isDelete != null "
>
and is_delete = #{isDelete}
</if>
<if
test=
"isDelete != null "
>
and is_delete = #{isDelete}
</if>
<if
test=
"deleteBy != null and deleteBy != ''"
>
and delete_by = #{deleteBy}
</if>
<if
test=
"deleteBy != null and deleteBy != ''"
>
and delete_by = #{deleteBy}
</if>
<if
test=
"deleteTime != null "
>
and delete_time = #{deleteTime}
</if>
<if
test=
"deleteTime != null "
>
and delete_time = #{deleteTime}
</if>
...
@@ -151,6 +158,7 @@
...
@@ -151,6 +158,7 @@
<if
test=
"useDate != null"
>
use_date,
</if>
<if
test=
"useDate != null"
>
use_date,
</if>
<if
test=
"useStatus != null"
>
use_status,
</if>
<if
test=
"useStatus != null"
>
use_status,
</if>
<if
test=
"isDelete != null"
>
is_delete,
</if>
<if
test=
"isDelete != null"
>
is_delete,
</if>
<if
test=
"weeks != null"
>
weeks,
</if>
<if
test=
"createBy != null"
>
create_by,
</if>
<if
test=
"createBy != null"
>
create_by,
</if>
<if
test=
"createTime != null"
>
create_time,
</if>
<if
test=
"createTime != null"
>
create_time,
</if>
<if
test=
"updateBy != null"
>
update_by,
</if>
<if
test=
"updateBy != null"
>
update_by,
</if>
...
@@ -162,11 +170,13 @@
...
@@ -162,11 +170,13 @@
<if
test=
"storeType != null"
>
store_type,
</if>
<if
test=
"storeType != null"
>
store_type,
</if>
<if
test=
"orderType != null"
>
order_type,
</if>
<if
test=
"orderType != null"
>
order_type,
</if>
<if
test=
"packageId != null"
>
package_id,
</if>
<if
test=
"packageId != null"
>
package_id,
</if>
<if
test=
"dealgroupId != null"
>
dealgroup_id,
</if>
<if
test=
"storeIds != null"
>
store_ids,
</if>
</trim>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"consumerId != null"
>
#{consumerId},
</if>
<if
test=
"consumerId != null"
>
#{consumerId},
</if>
<if
test=
"couponId != null"
>
#{couponId},
</if>
<if
test=
"couponId != null"
>
#{couponId},
</if>
<if
test=
"storeId != null"
>
#{storeId}
</if>
<if
test=
"storeId != null"
>
#{storeId}
,
</if>
<if
test=
"dealId != null"
>
#{dealId},
</if>
<if
test=
"dealId != null"
>
#{dealId},
</if>
<if
test=
"couponCode != null and couponCode != ''"
>
#{couponCode},
</if>
<if
test=
"couponCode != null and couponCode != ''"
>
#{couponCode},
</if>
<if
test=
"name != null and name != ''"
>
#{name},
</if>
<if
test=
"name != null and name != ''"
>
#{name},
</if>
...
@@ -185,6 +195,7 @@
...
@@ -185,6 +195,7 @@
<if
test=
"useDate != null"
>
#{useDate},
</if>
<if
test=
"useDate != null"
>
#{useDate},
</if>
<if
test=
"useStatus != null"
>
#{useStatus},
</if>
<if
test=
"useStatus != null"
>
#{useStatus},
</if>
<if
test=
"isDelete != null"
>
#{isDelete},
</if>
<if
test=
"isDelete != null"
>
#{isDelete},
</if>
<if
test=
"weeks != null"
>
#{weeks},
</if>
<if
test=
"createBy != null"
>
#{createBy},
</if>
<if
test=
"createBy != null"
>
#{createBy},
</if>
<if
test=
"createTime != null"
>
#{createTime},
</if>
<if
test=
"createTime != null"
>
#{createTime},
</if>
<if
test=
"updateBy != null"
>
#{updateBy},
</if>
<if
test=
"updateBy != null"
>
#{updateBy},
</if>
...
@@ -196,6 +207,8 @@
...
@@ -196,6 +207,8 @@
<if
test=
"storeType != null"
>
#{storeType},
</if>
<if
test=
"storeType != null"
>
#{storeType},
</if>
<if
test=
"orderType != null"
>
#{orderType},
</if>
<if
test=
"orderType != null"
>
#{orderType},
</if>
<if
test=
"packageId != null"
>
#{packageId},
</if>
<if
test=
"packageId != null"
>
#{packageId},
</if>
<if
test=
"dealgroupId != null"
>
#{dealgroupId},
</if>
<if
test=
"storeIds != null"
>
#{storeIds},
</if>
</trim>
</trim>
</insert>
</insert>
...
@@ -223,6 +236,7 @@
...
@@ -223,6 +236,7 @@
<if
test=
"useDate != null"
>
use_date = #{useDate},
</if>
<if
test=
"useDate != null"
>
use_date = #{useDate},
</if>
<if
test=
"useStatus != null"
>
use_status = #{useStatus},
</if>
<if
test=
"useStatus != null"
>
use_status = #{useStatus},
</if>
<if
test=
"isDelete != null"
>
is_delete = #{isDelete},
</if>
<if
test=
"isDelete != null"
>
is_delete = #{isDelete},
</if>
<if
test=
"weeks != null"
>
weeks = #{weeks},
</if>
<if
test=
"createBy != null"
>
create_by = #{createBy},
</if>
<if
test=
"createBy != null"
>
create_by = #{createBy},
</if>
<if
test=
"createTime != null"
>
create_time = #{createTime},
</if>
<if
test=
"createTime != null"
>
create_time = #{createTime},
</if>
<if
test=
"updateBy != null"
>
update_by = #{updateBy},
</if>
<if
test=
"updateBy != null"
>
update_by = #{updateBy},
</if>
...
@@ -234,6 +248,8 @@
...
@@ -234,6 +248,8 @@
<if
test=
"storeType != null"
>
store_type = #{storeType},
</if>
<if
test=
"storeType != null"
>
store_type = #{storeType},
</if>
<if
test=
"orderType != null"
>
order_type = #{orderType},
</if>
<if
test=
"orderType != null"
>
order_type = #{orderType},
</if>
<if
test=
"packageId != null"
>
package_id = #{packageId},
</if>
<if
test=
"packageId != null"
>
package_id = #{packageId},
</if>
<if
test=
"dealgroupId != null"
>
dealgroup_id = #{dealgroupId},
</if>
<if
test=
"storeIds != null"
>
store_ids = #{storeIds},
</if>
</trim>
</trim>
where id = #{id}
where id = #{id}
</update>
</update>
...
...
share-system/src/main/resources/mapper/system/SCouponMapper.xml
View file @
8cf074a9
...
@@ -16,12 +16,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -16,12 +16,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result
property=
"couponType"
column=
"coupon_type"
/>
<result
property=
"couponType"
column=
"coupon_type"
/>
<result
property=
"orderType"
column=
"order_type"
/>
<result
property=
"orderType"
column=
"order_type"
/>
<result
property=
"packageId"
column=
"package_id"
/>
<result
property=
"packageId"
column=
"package_id"
/>
<result
property=
"dealgroupId"
column=
"dealgroup_id"
/>
<result
property=
"storeIds"
column=
"store_ids"
/>
<result
property=
"duration"
column=
"duration"
/>
<result
property=
"duration"
column=
"duration"
/>
<result
property=
"minDuration"
column=
"min_duration"
/>
<result
property=
"minDuration"
column=
"min_duration"
/>
<result
property=
"maxDuration"
column=
"max_duration"
/>
<result
property=
"maxDuration"
column=
"max_duration"
/>
<result
property=
"minPrice"
column=
"min_price"
/>
<result
property=
"minPrice"
column=
"min_price"
/>
<result
property=
"subPrice"
column=
"sub_price"
/>
<result
property=
"subPrice"
column=
"sub_price"
/>
<result
property=
"isOverlay"
column=
"is_overlay"
/>
<result
property=
"isOverlay"
column=
"is_overlay"
/>
<result
property=
"weeks"
column=
"weeks"
/>
<result
property=
"platformType"
column=
"platform_type"
/>
<result
property=
"platformType"
column=
"platform_type"
/>
<result
property=
"number"
column=
"number"
/>
<result
property=
"number"
column=
"number"
/>
<result
property=
"createBy"
column=
"create_by"
/>
<result
property=
"createBy"
column=
"create_by"
/>
...
@@ -39,6 +42,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -39,6 +42,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
coupon_type,
coupon_type,
order_type,
order_type,
package_id,
package_id,
dealgroup_id,
weeks,
store_ids,
duration,min_duration,max_duration,
duration,min_duration,max_duration,
min_price,sub_price,is_overlay,
min_price,sub_price,is_overlay,
platform_type,number,create_by,
platform_type,number,create_by,
...
@@ -59,6 +65,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -59,6 +65,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"couponType != null"
>
and coupon_type = #{couponType}
</if>
<if
test=
"couponType != null"
>
and coupon_type = #{couponType}
</if>
<if
test=
"orderType != null"
>
and order_type = #{orderType}
</if>
<if
test=
"orderType != null"
>
and order_type = #{orderType}
</if>
<if
test=
"packageId != null"
>
and package_id = #{packageId}
</if>
<if
test=
"packageId != null"
>
and package_id = #{packageId}
</if>
<if
test=
"dealgroupId != null"
>
and dealgroup_id = #{dealgroupId}
</if>
<if
test=
"storeIds != null"
>
and store_ids = #{storeIds}
</if>
<if
test=
"duration != null and duration != ''"
>
and duration = #{duration}
</if>
<if
test=
"duration != null and duration != ''"
>
and duration = #{duration}
</if>
<if
test=
"minDuration != null and minDuration != ''"
>
and min_duration = #{minDuration}
</if>
<if
test=
"minDuration != null and minDuration != ''"
>
and min_duration = #{minDuration}
</if>
<if
test=
"maxDuration != null and maxDuration != ''"
>
and max_duration = #{maxDuration}
</if>
<if
test=
"maxDuration != null and maxDuration != ''"
>
and max_duration = #{maxDuration}
</if>
...
@@ -66,6 +74,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -66,6 +74,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"subPrice != null and subPrice != ''"
>
and sub_price = #{subPrice}
</if>
<if
test=
"subPrice != null and subPrice != ''"
>
and sub_price = #{subPrice}
</if>
<if
test=
"isOverlay != null"
>
and is_overlay = #{isOverlay}
</if>
<if
test=
"isOverlay != null"
>
and is_overlay = #{isOverlay}
</if>
<if
test=
"platformType != null"
>
and platform_type = #{platformType}
</if>
<if
test=
"platformType != null"
>
and platform_type = #{platformType}
</if>
<if
test=
"weeks != null"
>
and weeks = #{weeks}
</if>
<if
test=
"number != null"
>
and number = #{number}
</if>
<if
test=
"number != null"
>
and number = #{number}
</if>
<if
test=
"createBy != null"
>
and create_by = #{createBy}
</if>
<if
test=
"createBy != null"
>
and create_by = #{createBy}
</if>
<if
test=
"createTime != null"
>
and create_time = #{createTime}
</if>
<if
test=
"createTime != null"
>
and create_time = #{createTime}
</if>
...
@@ -89,6 +98,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -89,6 +98,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id}
#{id}
</foreach>
</foreach>
</select>
</select>
<select
id=
"listDuration"
resultMap=
"SCouponResult"
>
<include
refid=
"selectSCouponVo"
/>
where 1=1 and coupon_type = #{couponType}
<if
test=
"endDate != null"
>
and end_date >= NOW()
</if>
</select>
<select
id=
"selectSCouponByDealgroupId"
resultMap=
"SCouponResult"
>
<include
refid=
"selectSCouponVo"
/>
where dealgroup_id = #{dealgroupId}
</select>
<select
id=
"selectByDealgroupId"
resultMap=
"SCouponResult"
>
<include
refid=
"selectSCouponVo"
/>
where dealgroup_id = #{dealgroupId}
</select>
<insert
id=
"insertSCoupon"
parameterType=
"SCoupon"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
<insert
id=
"insertSCoupon"
parameterType=
"SCoupon"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into s_coupon
insert into s_coupon
...
@@ -107,6 +130,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -107,6 +130,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"minPrice != null"
>
min_price,
</if>
<if
test=
"minPrice != null"
>
min_price,
</if>
<if
test=
"subPrice != null"
>
sub_price,
</if>
<if
test=
"subPrice != null"
>
sub_price,
</if>
<if
test=
"isOverlay != null"
>
is_overlay,
</if>
<if
test=
"isOverlay != null"
>
is_overlay,
</if>
<if
test=
"weeks != null"
>
weeks,
</if>
<if
test=
"platformType != null"
>
platform_type,
</if>
<if
test=
"platformType != null"
>
platform_type,
</if>
<if
test=
"number != null"
>
number,
</if>
<if
test=
"number != null"
>
number,
</if>
<if
test=
"createBy != null"
>
create_by,
</if>
<if
test=
"createBy != null"
>
create_by,
</if>
...
@@ -114,6 +138,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -114,6 +138,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"remark != null"
>
remark,
</if>
<if
test=
"remark != null"
>
remark,
</if>
<if
test=
"orderType != null"
>
order_type,
</if>
<if
test=
"orderType != null"
>
order_type,
</if>
<if
test=
"packageId != null"
>
package_id,
</if>
<if
test=
"packageId != null"
>
package_id,
</if>
<if
test=
"dealgroupId != null"
>
dealgroup_id,
</if>
<if
test=
"storeIds != null"
>
store_ids,
</if>
</trim>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"name != null and name != ''"
>
#{name},
</if>
<if
test=
"name != null and name != ''"
>
#{name},
</if>
...
@@ -130,6 +156,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -130,6 +156,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"minPrice != null"
>
#{minPrice},
</if>
<if
test=
"minPrice != null"
>
#{minPrice},
</if>
<if
test=
"subPrice != null"
>
#{subPrice},
</if>
<if
test=
"subPrice != null"
>
#{subPrice},
</if>
<if
test=
"isOverlay != null"
>
#{isOverlay},
</if>
<if
test=
"isOverlay != null"
>
#{isOverlay},
</if>
<if
test=
"weeks != null"
>
#{weeks},
</if>
<if
test=
"platformType != null"
>
#{platformType},
</if>
<if
test=
"platformType != null"
>
#{platformType},
</if>
<if
test=
"number != null"
>
#{number},
</if>
<if
test=
"number != null"
>
#{number},
</if>
<if
test=
"createBy != null"
>
#{createBy},
</if>
<if
test=
"createBy != null"
>
#{createBy},
</if>
...
@@ -137,6 +164,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -137,6 +164,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"remark != null"
>
#{remark},
</if>
<if
test=
"remark != null"
>
#{remark},
</if>
<if
test=
"orderType != null"
>
#{orderType},
</if>
<if
test=
"orderType != null"
>
#{orderType},
</if>
<if
test=
"packageId != null"
>
#{packageId},
</if>
<if
test=
"packageId != null"
>
#{packageId},
</if>
<if
test=
"dealgroupId != null"
>
#{dealgroupId},
</if>
<if
test=
"storeIds != null"
>
#{storeIds},
</if>
</trim>
</trim>
</insert>
</insert>
...
@@ -146,16 +175,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -146,16 +175,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"name != null and name != ''"
>
name = #{name},
</if>
<if
test=
"name != null and name != ''"
>
name = #{name},
</if>
<if
test=
"startDate != null"
>
start_date = #{startDate},
</if>
<if
test=
"startDate != null"
>
start_date = #{startDate},
</if>
<if
test=
"endDate != null"
>
end_date = #{endDate},
</if>
<if
test=
"endDate != null"
>
end_date = #{endDate},
</if>
<if
test=
"validStartTime !=
null
"
>
valid_start_time = #{validStartTime},
</if>
<if
test=
"validStartTime !=
''
"
>
valid_start_time = #{validStartTime},
</if>
<if
test=
"validEndTime !=
null
"
>
valid_end_time = #{validEndTime},
</if>
<if
test=
"validEndTime !=
''
"
>
valid_end_time = #{validEndTime},
</if>
<if
test=
"storeType != null"
>
store_type = #{storeType},
</if>
<if
test=
"storeType != null"
>
store_type = #{storeType},
</if>
<if
test=
"roomType != null"
>
room_type = #{roomType},
</if>
<if
test=
"roomType != null"
>
room_type = #{roomType},
</if>
<if
test=
"couponType != null"
>
coupon_type = #{couponType},
</if>
<if
test=
"couponType != null"
>
coupon_type = #{couponType},
</if>
<if
test=
"orderType != null"
>
order_type = #{orderType},
</if>
<if
test=
"orderType != ''"
>
order_type = #{orderType},
</if>
<if
test=
"packageId != null"
>
package_id = #{packageId},
</if>
<if
test=
"packageId != ''"
>
package_id = #{packageId},
</if>
<if
test=
"storeIds != null"
>
store_ids = #{storeIds},
</if>
<if
test=
"dealgroupId != null"
>
dealgroup_id = #{dealgroupId},
</if>
<if
test=
"duration != null and duration != ''"
>
duration = #{duration},
</if>
<if
test=
"duration != null and duration != ''"
>
duration = #{duration},
</if>
<if
test=
"minDuration != null and minDuration != ''"
>
min_duration = #{minDuration},
</if>
<if
test=
"minDuration != null and minDuration != ''"
>
min_duration = #{minDuration},
</if>
<if
test=
"maxDuration != null and maxDuration != ''"
>
max_duration = #{maxDuration},
</if>
<if
test=
"maxDuration != null and maxDuration != ''"
>
max_duration = #{maxDuration},
</if>
<if
test=
"weeks != null"
>
weeks = #{weeks},
</if>
<if
test=
"minPrice != null and minPrice != ''"
>
min_price = #{minPrice},
</if>
<if
test=
"minPrice != null and minPrice != ''"
>
min_price = #{minPrice},
</if>
<if
test=
"subPrice != null and subPrice != ''"
>
sub_price = #{subPrice},
</if>
<if
test=
"subPrice != null and subPrice != ''"
>
sub_price = #{subPrice},
</if>
<if
test=
"isOverlay != null"
>
is_overlay = #{isOverlay},
</if>
<if
test=
"isOverlay != null"
>
is_overlay = #{isOverlay},
</if>
...
...
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