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
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
39 changed files
with
943 additions
and
122 deletions
+943
-122
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
+0
-0
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
+0
-0
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
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
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
javax.servlet.http.HttpServletResponse
;
...
...
@@ -7,6 +8,7 @@ import javax.servlet.http.HttpServletResponse;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PutMapping
;
...
...
@@ -21,10 +23,12 @@ import share.common.core.domain.AjaxResult;
import
share.common.enums.BusinessType
;
import
share.common.enums.RoomType
;
import
share.common.enums.StoreType
;
import
share.system.domain.SConsumer
;
import
share.system.domain.SConsumerCoupon
;
import
share.system.service.ISConsumerCouponService
;
import
share.common.utils.poi.ExcelUtil
;
import
share.common.core.page.TableDataInfo
;
import
share.system.service.SConsumerService
;
/**
* 优惠券领取记录Controller
...
...
@@ -39,6 +43,9 @@ public class SConsumerCouponController extends BaseController
@Autowired
private
ISConsumerCouponService
sConsumerCouponService
;
@Autowired
private
SConsumerService
sConsumerService
;
/**
* 查询优惠券领取记录列表
*/
...
...
@@ -46,9 +53,26 @@ public class SConsumerCouponController extends BaseController
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
SConsumerCoupon
sConsumerCoupon
)
{
List
<
SConsumer
>
list
=
sConsumerService
.
list
();
startPage
();
List
<
SConsumerCoupon
>
list
=
sConsumerCouponService
.
selectSConsumerCouponList
(
sConsumerCoupon
);
return
getDataTable
(
list
);
if
(
share
.
common
.
utils
.
StringUtils
.
isNotBlank
(
sConsumerCoupon
.
getPhone
()))
{
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
;
import
java.util.Date
;
import
java.util.List
;
import
javax.servlet.http.HttpServletResponse
;
...
...
@@ -59,7 +60,7 @@ public class SCouponController extends BaseController
public
TableDataInfo
listDuration
(
SCoupon
sCoupon
)
{
startPage
();
sCoupon
.
setCouponType
(
CouponTypeEnum
.
DURATION
.
getCode
());
List
<
SCoupon
>
list
=
sCouponService
.
selectSCouponList
(
sCoupon
);
List
<
SCoupon
>
list
=
sCouponService
.
listDuration
(
sCoupon
);
return
getDataTable
(
list
);
}
...
...
@@ -132,4 +133,14 @@ public class SCouponController extends BaseController
{
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
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接口地址
// 订单取消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 {
WECHAT
(
"2"
,
"微信回调"
),
SERVICE
(
"3"
,
"SERVICE回调"
),
ORDER
(
"4"
,
"订单下单"
),
//任务
TASK
(
"5"
,
"任务"
),
;
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
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
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 {
@Autowired
private
ISStoreService
sStoreService
;
private
static
final
Integer
TRY_NUMBER
=
3
;
/**
* 切点函数,用于标识需要记录操作日志的方法。
* 切点表达式为: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
()
{
}
...
...
@@ -53,7 +55,7 @@ public class QPServiceImplAspect {
public
void
beforMethod
(
JoinPoint
point
)
{
}
@Pointcut
(
"execution(* share.system.service.impl.QPServiceImpl.
*
(..))"
)
@Pointcut
(
"execution(* share.system.service.impl.QPServiceImpl.
consume
(..))"
)
public
void
operExceptionLogPoinCut
()
{
}
...
...
@@ -87,7 +89,6 @@ public class QPServiceImplAspect {
JSONObject
jsonObject
=
JSON
.
parseObject
(
params
);
//获得出参
String
outParams
=
JSON
.
toJSONString
(
result
);
// if(methodName.equals("consume")){
saveLog
(
couponLog
,
jsonObject
);
couponLog
.
setStatus
(
YesNoEnum
.
yes
.
getDisplay_3
());
couponLog
.
setMessage
(
outParams
);
...
...
@@ -112,6 +113,7 @@ public class QPServiceImplAspect {
*/
@AfterThrowing
(
pointcut
=
"operExceptionLogPoinCut()"
,
throwing
=
"e"
)
public
void
saveExceptionLog
(
JoinPoint
joinPoint
,
Throwable
e
)
{
CouponLog
couponLog
=
new
CouponLog
();
try
{
// 从切面织入点处通过反射机制获取织入点处的方法
MethodSignature
signature
=
(
MethodSignature
)
joinPoint
.
getSignature
();
...
...
@@ -119,18 +121,21 @@ public class QPServiceImplAspect {
Method
method
=
signature
.
getMethod
();
//获得方法名
String
methodName
=
method
.
getName
();
CouponLog
couponLog
=
new
CouponLog
();
// 将入参转换成json // 请求参数
String
[]
paramNames
=
((
MethodSignature
)
joinPoint
.
getSignature
()).
getParameterNames
();
String
params
=
argsArrayToString
(
paramNames
,
joinPoint
.
getArgs
());
//转JSON
JSONObject
jsonObject
=
JSON
.
parseObject
(
params
);
// if(methodName.equals("consume")) {
saveLog
(
couponLog
,
jsonObject
);
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
.
setMessage
(
e
.
getMessage
());
}
catch
(
Exception
e2
)
{
e2
.
printStackTrace
();
}
finally
{
CompletableFuture
.
supplyAsync
(()
->
{
int
i
=
couponLogService
.
insertCouponLog
(
couponLog
);
if
(
i
>
0
)
{
...
...
@@ -139,9 +144,6 @@ public class QPServiceImplAspect {
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 {
/**
* 开门、关门、取电、断电
*/
@Log
(
title
=
"设备信息"
,
businessType
=
BusinessType
.
UPDATE
)
@PostMapping
(
value
=
"/openOrClose"
)
public
AjaxResult
openOrClose
(
@RequestBody
DeviceParamVo
deviceParam
)
{
SConsumer
user
=
consumerService
.
getInfo
();
// 获取mqtt的topic、payload
MqttxVo
mqttxVo
=
mqttxService
.
openOrCloseDevice
(
deviceParam
.
getDevId
(),
SecurityUtils
.
getUsername
(),
deviceParam
.
getOpType
());
user
.
getAccount
(),
deviceParam
.
getOpType
());
// 发送mqtt消息
mqttGatewayComponent
.
sendToMqtt
(
mqttxVo
.
getTopic
(),
0
,
mqttxVo
.
getPayload
());
SConsumer
user
=
consumerService
.
getInfo
();
// 写日志记录
int
result
=
deviceLogService
.
addDeviceLog
(
mqttxVo
,
user
.
getAccount
());
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 {
// @PreAuthorize("@ss.hasPermi('system:coupon:list')")
@GetMapping
(
"/list"
)
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
();
List
<
SConsumerCoupon
>
list
=
sConsumerCouponService
.
selectSConsumerCouponList
(
sConsumerCoupon
);
List
<
SConsumerCoupon
>
list
=
sConsumerCouponService
.
listByUseStatus
(
Integer
.
valueOf
(
useStatus
)
);
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
@PostMapping
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
));
}
...
...
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 {
// 退优惠券
if
(
ObjectUtil
.
isNotNull
(
sOrder
.
getCouponId
()))
{
SConsumerCoupon
couponUser
=
consumerCouponService
.
getById
(
sOrder
.
getCouponId
());
couponUser
.
setUseStatus
(
CouponStatusEnum
.
NORMAL
.
getValue
());
consumerCouponService
.
updateById
(
couponUser
);
if
(
Objects
.
nonNull
(
couponUser
))
{
couponUser
.
setUseStatus
(
CouponStatusEnum
.
NORMAL
.
getValue
());
consumerCouponService
.
updateById
(
couponUser
);
}
}
return
true
;
});
...
...
@@ -240,6 +242,12 @@ public class OrderTask {
JSONObject
jsonObject
=
new
JSONObject
(
value
);
Date
expirationTime
=
jsonObject
.
getDate
(
"expirationTime"
);
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分
long
expire
=
(
expirationTime
.
getTime
()
-
new
Date
().
getTime
())
/
1000
;
// if (expire < TEN_MINUTES && expire > NINE_MINUTES) {
...
...
@@ -248,14 +256,14 @@ public class OrderTask {
// }
//判断时间是否在15分钟到14分钟
if
(
expire
<
FIFTEEN_MINUTES
&&
expire
>
FOURTEEN_MINUTES
)
{
SOrder
byOrderNo
=
orderService
.
getByOrderNo
(
String
.
valueOf
(
orderNo
));
SStore
sStore
=
storeService
.
getById
(
byOrderNo
.
getStore
Id
());
SRoom
sRoom
=
roomService
.
getById
(
byOrderNo
.
getRoomId
()
);
smsService
.
sendSmsOrderStartRemind
(
byOrderNo
.
getConsumerPhone
(),
sStore
,
sRoom
);
// SStore sStore = storeService.getById(byOrderNo.getStoreId(
));
// SRoom sRoom = roomService.getById(byOrderNo.getRoom
Id());
// smsService.sendSmsOrderStartRemind(byOrderNo.getConsumerPhone(), sStore, sRoom
);
logger
.
info
(
"订单号为:"
+
jsonObject
.
getStr
(
"orderNo"
)
+
"的订单开始预定时间到15分钟"
);
return
;
}
if
(
expirationTime
.
getTime
()
<
new
Date
().
getTime
())
{
sOrders
.
add
(
orderService
.
getByOrderNo
(
String
.
valueOf
(
orderNo
))
);
sOrders
.
add
(
byOrderNo
);
}
});
if
(
CollectionUtils
.
isEmpty
(
sOrders
))
{
...
...
share-quartz/src/main/java/share/quartz/task/RedisTask.java
View file @
8cf074a9
...
...
@@ -209,6 +209,7 @@ public class RedisTask {
SOrder
sOrder
=
sOrders
.
stream
().
filter
(
item
->
item
.
getOrderNo
().
equals
(
jsonObject
.
getStr
(
"orderNo"
))).
findFirst
().
orElse
(
null
);
if
(
ObjectUtils
.
isEmpty
(
sOrder
))
{
redisUtil
.
delete
(
o
);
logger
.
info
(
"订单号为:"
+
jsonObject
.
getStr
(
"orderNo"
)
+
"的订单不存在"
);
throw
new
BaseException
(
"订单不存在!"
);
}
long
expire
=
(
expirationTime
.
getTime
()
-
new
Date
().
getTime
())
/
1000
;
...
...
@@ -218,18 +219,18 @@ public class RedisTask {
deviceOpService
.
actionExecute
(
sOrder
.
getRoomId
(),
sOrder
.
getConsumerPhone
(),
VoiceEnum
.
RENEWAL_REMINDER1
.
getCode
(),
DateUtil
.
format
(
new
Date
(),
DatePattern
.
NORM_DATETIME_PATTERN
),
DateUtil
.
format
(
DateUtil
.
offsetMinute
(
new
Date
(),
1
),
DatePattern
.
NORM_DATETIME_PATTERN
),
"1"
);
logger
.
info
(
"订单号为:"
+
sOrder
.
getOrderNo
()
+
"的订单距离结束时间还有15分钟"
);
//从门店集合中判断门店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相同的房间对象
SRoom
sRoom
=
sRoomList
.
stream
().
filter
(
item
->
item
.
getId
().
equals
(
sOrder
.
getRoomId
())).
findFirst
().
orElse
(
null
);
// smsService.sendSmsCleanRecordsRemind15(byOrderNo.getConsumerPhone(), sStore, sRoom);
// SRoom sRoom = sRoomList.stream().filter(item -> item.getId().equals(sOrder.getRoomId())).findFirst().orElse(null);
//通知用户
smsService
.
sendSmsOrderEndRemind
(
sOrder
.
getConsumerPhone
(),
sStore
,
sRoom
);
//通知保洁人员
sConsumerService
.
selectListByStoreId
(
sOrder
.
getStoreId
()).
stream
().
forEach
(
item
->
{
// 循环发送短信提示门店保洁打扫卫生
smsService
.
sendSmsCleanRecordsRemind15
(
item
.
getPhone
(),
sStore
,
sRoom
);
});
//
smsService.sendSmsOrderEndRemind(sOrder.getConsumerPhone(), sStore, sRoom);
//
//通知保洁人员
//
sConsumerService.selectListByStoreId(sOrder.getStoreId()).stream().forEach(item -> {
//
// 循环发送短信提示门店保洁打扫卫生
//
smsService.sendSmsCleanRecordsRemind15(item.getPhone(), sStore, sRoom);
//
});
return
;
}
//判断时间是否在5分钟到4分钟
...
...
@@ -238,6 +239,7 @@ public class RedisTask {
deviceOpService
.
actionExecute
(
sOrder
.
getRoomId
(),
sOrder
.
getConsumerPhone
(),
VoiceEnum
.
RENEWAL_REMINDER2
.
getCode
(),
DateUtil
.
format
(
new
Date
(),
DatePattern
.
NORM_DATETIME_PATTERN
),
DateUtil
.
format
(
DateUtil
.
offsetMinute
(
new
Date
(),
1
),
DatePattern
.
NORM_DATETIME_PATTERN
),
"1"
);
logger
.
info
(
"订单号为:"
+
sOrder
.
getOrderNo
()
+
"的订单距离结束时间还有5分钟"
);
}
//判断是否过期
if
(
expirationTime
.
getTime
()
<
new
Date
().
getTime
())
{
...
...
@@ -268,7 +270,7 @@ public class RedisTask {
DateUtil
.
format
(
DateUtil
.
offsetMinute
(
new
Date
(),
1
),
DatePattern
.
NORM_DATETIME_PATTERN
),
"1"
);
//延时3分钟断电
deviceOpService
.
openOrCloseDevice
(
sOrder
.
getRoomId
(),
sOrder
.
getConsumerPhone
(),
OpTypeEnum
.
CUT_ELECTRIC
.
getCode
(),
true
,
THREE_MINUTES
);
logger
.
info
(
"订单号为:"
+
sOrder
.
getOrderNo
()
+
"的订单已结束,更改订单状态为已使用"
);
}
});
...
...
@@ -289,6 +291,7 @@ public class RedisTask {
//更改订单状态
sOrder
.
setStatus
(
OrderStatusEnum
.
USED
.
getCode
());
isOrderService
.
updateById
(
sOrder
);
logger
.
info
(
"订单号为:"
+
sOrder
.
getOrderNo
()
+
"的订单已有续单,更改订单状态为已使用"
);
return
true
;
}
return
false
;
...
...
share-system/src/main/java/share/system/domain/CouponLog.java
View file @
8cf074a9
...
...
@@ -52,6 +52,12 @@ public class CouponLog extends BaseEntity {
private
Long
couponId
;
/**
* 数量
*/
@Excel
(
name
=
"数量"
)
private
Integer
number
;
/**
* 优惠券名称
*/
@Excel
(
name
=
"优惠券名称"
)
...
...
@@ -81,25 +87,20 @@ public class CouponLog extends BaseEntity {
@Excel
(
name
=
"消息"
)
private
String
message
;
@Override
public
String
toString
()
{
return
new
ToStringBuilder
(
this
,
ToStringStyle
.
MULTI_LINE_STYLE
)
.
append
(
"id"
,
getId
())
.
append
(
"code"
,
getCode
())
.
append
(
"consumerId"
,
getConsumerId
())
.
append
(
"storeId"
,
getStoreId
())
.
append
(
"couponId"
,
getCouponId
())
.
append
(
"couponName"
,
getCouponName
())
.
append
(
"couponType"
,
getCouponType
())
.
append
(
"couponValue"
,
getCouponValue
())
.
append
(
"status"
,
getStatus
())
.
append
(
"message"
,
getMessage
())
.
append
(
"createBy"
,
getCreateBy
())
.
append
(
"createTime"
,
getCreateTime
())
.
append
(
"updateBy"
,
getUpdateBy
())
.
append
(
"updateTime"
,
getUpdateTime
())
.
append
(
"remark"
,
getRemark
())
.
toString
();
return
"CouponLog{"
+
"id="
+
id
+
", code='"
+
code
+
'\''
+
", consumerId="
+
consumerId
+
", storeId="
+
storeId
+
", couponId="
+
couponId
+
", number="
+
number
+
", couponName='"
+
couponName
+
'\''
+
", couponType='"
+
couponType
+
'\''
+
", couponValue="
+
couponValue
+
", status='"
+
status
+
'\''
+
", message='"
+
message
+
'\''
+
'}'
;
}
}
share-system/src/main/java/share/system/domain/SConsumerCoupon.java
View file @
8cf074a9
...
...
@@ -48,6 +48,18 @@ public class SConsumerCoupon extends BaseEntity
@Excel
(
name
=
"套餐ID"
)
private
Long
dealId
;
/**
* 团购ID
*/
@Excel
(
name
=
"团购ID"
)
private
Long
dealgroupId
;
/**
* 适用门店id
*/
@Excel
(
name
=
"适用门店id"
)
private
String
storeIds
;
/** 优惠券编码 */
@Excel
(
name
=
"优惠券编码"
)
private
String
couponCode
;
...
...
@@ -143,6 +155,12 @@ public class SConsumerCoupon extends BaseEntity
@TableField
(
select
=
false
)
private
Integer
isDelete
;
/**
* 适用星期列表(1:周一,2:周二,3:周三,4:周四,5:周五,6:周六,7:周日)
*/
@Excel
(
name
=
"适用星期列表"
)
private
String
weeks
;
/** 更新者 */
@Excel
(
name
=
"更新者"
)
private
String
deleteBy
;
...
...
@@ -164,4 +182,16 @@ public class SConsumerCoupon extends BaseEntity
*/
@TableField
(
select
=
false
)
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
@Excel
(
name
=
"绑定套餐ID"
)
private
Long
packageId
;
/**
* 团购ID
*/
@Excel
(
name
=
"团购ID"
)
private
Long
dealgroupId
;
/**
* 适用门店id
*/
@Excel
(
name
=
"适用门店id"
)
private
String
storeIds
;
/** 是否可叠加使用(0:不可叠加,1:可叠加) */
@Excel
(
name
=
"是否可叠加使用(0:不可叠加,1:可叠加)"
)
private
Integer
isOverlay
;
/**
* 适用星期列表(1:周一,2:周二,3:周三,4:周四,5:周五,6:周六,7:周日)
*/
@Excel
(
name
=
"适用星期列表"
)
private
String
weeks
;
/**
* 第三方平台类型(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
List
<
SCoupon
>
selectSCouponByName
(
String
dealTitle
);
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;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
share.common.annotation.Excel
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotEmpty
;
...
...
@@ -29,6 +30,13 @@ public class CouponRequest {
@NotNull
(
message
=
"下单模式不能为空"
)
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>
* @return 优惠券领取记录集合
*/
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;
import
java.util.List
;
import
share.system.domain.SConsumptionRecords
;
import
share.system.domain.SOrder
;
import
share.system.domain.vo.SConsumptionRecordsVo
;
/**
...
...
@@ -37,6 +38,13 @@ public interface ISConsumptionRecordsService
public
int
insertSConsumptionRecords
(
SConsumptionRecords
sConsumptionRecords
);
/**
* 新增消费记录
*
* @param sOrder 消费记录
* @return 结果
*/
public
int
insertSConsumptionRecords
(
SOrder
sOrder
);
/**
* 修改消费记录
*
* @param sConsumptionRecords 消费记录
...
...
share-system/src/main/java/share/system/service/ISCouponService.java
View file @
8cf074a9
...
...
@@ -67,4 +67,10 @@ public interface ISCouponService
List
<
SCoupon
>
selectSCouponByName
(
String
dealTitle
);
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;
import
java.util.List
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
share.system.domain.SConsumerCoupon
;
import
share.system.domain.SOrder
;
import
share.system.domain.vo.OrderVo
;
import
share.system.domain.vo.SOrderVo
;
import
share.system.request.CreateOrderRequest
;
import
share.system.request.OrderComputedPriceRequest
;
...
...
@@ -171,4 +173,11 @@ public interface ISOrderService extends IService<SOrder>
* @return
*/
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 {
//默认门槛金额
private
static
final
BigDecimal
DEFAULT_MIN_PRICE
=
BigDecimal
.
valueOf
(
0.00
);
private
static
final
String
ACCOUNT
=
"13888888888"
;
private
static
final
String
NAME
=
"管理人员"
;
/**
* 用户验卷接口
*/
@Override
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
();
//查询领取记录表
...
...
@@ -99,6 +103,12 @@ public class QPServiceImpl implements QPService {
LambdaQueryWrapper
<
SStore
>
sStoreLambdaQueryWrapper
=
new
LambdaQueryWrapper
<>();
sStoreLambdaQueryWrapper
.
eq
(
SStore:
:
getOpenShopUuid
,
openShopUuid
);
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
(
couponTwo
.
getConsumerId
().
equals
(
user
.
getId
()))
{
...
...
@@ -114,8 +124,8 @@ public class QPServiceImpl implements QPService {
TuangouReceiptPrepareResponseEntityVo
response
=
new
TuangouReceiptPrepareResponseEntityVo
();
SConsumerCoupon
sConsumerCoupon
=
new
SConsumerCoupon
();
sConsumerCoupon
.
setConsumerId
(
user
.
getId
());
sConsumerCoupon
.
setStoreId
(
sStore
.
getId
());
sConsumerCoupon
.
setDealId
(
prepare
.
getDeal_id
());
sConsumerCoupon
.
setStoreId
(
sStore
.
getId
());
sConsumerCoupon
.
setCouponCode
(
code
);
sConsumerCoupon
.
setName
(
prepare
.
getDeal_title
());
sConsumerCoupon
.
setSourceType
(
SourceTypeEnum
.
CHECK
.
getCode
());
...
...
@@ -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
;
if
(!
CollectionUtils
.
isEmpty
(
sCoupons
))
{
sCoupon
=
isCouponService
.
selectSCouponByName
(
prepare
.
getDeal_title
())
.
get
(
0
);
sCoupon
=
sCoupons
.
get
(
0
);
}
if
(
ObjectUtils
.
isEmpty
(
sCoupon
))
{
sConsumerCoupon
.
setCouponType
(
CouponTypeEnum
.
CASH
.
getCode
());
...
...
@@ -169,7 +179,10 @@ public class QPServiceImpl implements QPService {
sConsumerCoupon
.
setCouponTimeStart
(
sCoupon
.
getValidStartTime
());
sConsumerCoupon
.
setCouponTimeEnd
(
sCoupon
.
getValidEndTime
());
sConsumerCoupon
.
setOrderType
(
sCoupon
.
getOrderType
());
sConsumerCoupon
.
setDealgroupId
(
sCoupon
.
getDealgroupId
());
sConsumerCoupon
.
setStoreIds
(
sCoupon
.
getStoreIds
());
sConsumerCoupon
.
setPackageId
(
sCoupon
.
getPackageId
());
sConsumerCoupon
.
setWeeks
(
sCoupon
.
getWeeks
());
sConsumerCoupon
.
setRemark
(
sCoupon
.
getRemark
());
}
isConsumerCouponService
.
insertSConsumerCoupon
(
sConsumerCoupon
);
...
...
@@ -253,12 +266,19 @@ public class QPServiceImpl implements QPService {
String
session
=
(
String
)
sessionKey
.
get
(
"access_token"
);
SConsumer
user
=
FrontTokenComponent
.
getWxSConsumerEntry
();
String
requestid
=
UUID
.
randomUUID
().
toString
();
TuangouReceiptConsumeRequest
request
=
new
TuangouReceiptConsumeRequest
(
APP_KEY
,
APP_SECRET
,
session
,
requestid
,
code
,
count
,
""
,
user
.
getAccount
(),
user
.
getNickName
(),
openShopUuid
);
TuangouReceiptConsumeRequest
request
=
null
;
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
();
TuangouReceiptConsume
tuangouReceiptConsume
=
new
TuangouReceiptConsume
(
request
);
TuangouReceiptConsumeResponse
invoke
=
openAPIClient
.
invoke
(
tuangouReceiptConsume
);
if
(
invoke
.
getCode
()
!=
200
)
{
redisUtil
.
delete
(
ReceiptRdeisEnum
.
PREPARE
.
getValue
()
+
code
);
logger
.
error
(
"验卷失败:{}"
,
invoke
.
getMsg
());
throw
new
RuntimeException
(
invoke
.
getMsg
());
}
...
...
@@ -339,8 +359,9 @@ public class QPServiceImpl implements QPService {
TuangouDealQueryShopDeal
tuangouDealQueryShopDeal
=
new
TuangouDealQueryShopDeal
(
request
);
TuangouDealQueryShopDealResponse
response
=
openAPIClient
.
invoke
(
tuangouDealQueryShopDeal
);
if
(
response
.
getCode
()
!=
200
)
{
throw
new
RuntimeException
(
response
.
getMsg
());
logger
.
error
(
"门店团购信息:{}"
,
response
.
getMsg
());
}
logger
.
error
(
"门店团购信息:{}"
,
response
.
getData
());
return
response
.
getData
();
}
...
...
@@ -386,10 +407,13 @@ public class QPServiceImpl implements QPService {
JSONObject
sessionKey
=
new
JSONObject
(
o
);
String
session
=
(
String
)
sessionKey
.
get
(
"access_token"
);
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
);
CustomerKeyShopScopeQuery
shopScopeQuery
=
new
CustomerKeyShopScopeQuery
(
request
);
CustomerKeyShopScopeResponse
response
=
openAPIClient
.
invoke
(
shopScopeQuery
);
if
(
response
.
getCode
()
!=
200
)
{
logger
.
error
(
"适用店铺查询接口:{}"
,
response
.
getMsg
());
throw
new
RuntimeException
(
response
.
getMsg
());
}
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 {
//设置时间段房间可预约状态(可预约:大于营业开始时间,小于营业结束时间,大于当前时间,当前时间没有订单)
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
());
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
(
timeHourDate
.
compareTo
(
DateUtils
.
parseDate
(
day
+
" "
+
store
.
getOpenStartTime
()))
==
-
1
)
{
vo
.
setStatus
(
RoomStatusEnum
.
HOLD
.
getValue
());
vo
.
setStartHoldTime
(
timeHourDate
);
changeStartHoldTime
(
vo
,
timeHourDate
);
//判断是否是同一个小时,如果是同一个小时,占用结束时间为营业开始时间
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
{
//占用结束时间为当前时段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"
))
{
vo
.
setStatus
(
RoomStatusEnum
.
HOLD
.
getValue
());
//占用结束时间为当前时段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
)
{
vo
.
setStartHoldTime
(
DateUtils
.
parseDate
(
day
+
" "
+
store
.
getOpenEndTime
()));
changeStartHoldTime
(
vo
,
DateUtils
.
parseDate
(
day
+
" "
+
store
.
getOpenEndTime
()));
}
else
{
//占用开始时间为当前时段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
){
vo
.
setStatus
(
RoomStatusEnum
.
HOLD
.
getValue
());
vo
.
setStartHoldTime
(
timeHourDate
);
changeStartHoldTime
(
vo
,
timeHourDate
);
//判断是否是同一个小时,如果是同一个小时,占用结束时间为当前时间
if
(
timeHourDate
.
compareTo
(
DateUtils
.
parseDate
(
day
+
" "
+
finalNowTime
.
split
(
":"
)[
0
]))
==
0
){
vo
.
setEndHoldTime
(
DateUtils
.
parseDate
(
day
+
" "
+
finalNowTime
));
changeEndHoldTime
(
vo
,
DateUtils
.
parseDate
(
day
+
" "
+
finalNowTime
));
}
else
{
//占用结束时间为当前时段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
){
...
...
@@ -149,18 +170,18 @@ public class RoomStatusServiceImpl implements RoomStatusService {
//判断订单开始时间是否是同一个小时,如果是同一个小时,占用开始时间为订单开始时间
if
(
StringUtils
.
equals
(
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD_HH
,
timeHourDate
)
,
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD_HH
,
orderStartDate
))){
vo
.
setStartHoldTime
(
orderStartDate
);
changeStartHoldTime
(
vo
,
orderStartDate
);
}
else
{
//占用开始时间为当前时段0分0秒
vo
.
setStartHoldTime
(
timeHourDate
);
changeStartHoldTime
(
vo
,
timeHourDate
);
}
//判断订单结束时间是否是同一个小时,如果是同一个小时,占用结束时间为订单结束时间
if
(
StringUtils
.
equals
(
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD_HH
,
timeHourDate
)
,
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD_HH
,
orderEndDate
))){
vo
.
setEndHoldTime
(
orderEndDate
);
changeEndHoldTime
(
vo
,
orderEndDate
);
}
else
{
//占用结束时间为当前时段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
public
boolean
finishCleanRecords
()
{
Date
now
=
DateUtil
.
date
();
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
));
List
<
SCleanRecords
>
list
=
baseMapper
.
selectList
(
queryWrapper
);
if
(
list
.
size
()
==
0
)
{
...
...
share-system/src/main/java/share/system/service/impl/SConsumerCouponServiceImpl.java
View file @
8cf074a9
This diff is collapsed.
Click to expand it.
share-system/src/main/java/share/system/service/impl/SConsumptionRecordsServiceImpl.java
View file @
8cf074a9
...
...
@@ -6,6 +6,9 @@ import java.util.stream.Collectors;
import
org.apache.commons.collections4.CollectionUtils
;
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
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -103,6 +106,19 @@ public class SConsumptionRecordsServiceImpl implements ISConsumptionRecordsServi
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
;
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.springframework.util.CollectionUtils
;
import
org.springframework.util.ObjectUtils
;
import
share.common.enums.CouponTypeEnum
;
import
share.common.enums.RoomType
;
import
share.common.enums.StoreType
;
import
share.common.utils.DateUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
share.system.domain.SStore
;
import
share.system.mapper.SCouponMapper
;
import
share.system.domain.SCoupon
;
import
share.system.service.ISCouponService
;
import
share.system.service.ISStoreService
;
import
share.system.service.QPService
;
/**
* 优惠券Service业务层处理
*
*
* @author ruoyi
* @date 2023-09-27
*/
@Service
public
class
SCouponServiceImpl
implements
ISCouponService
{
public
class
SCouponServiceImpl
implements
ISCouponService
{
@Autowired
private
SCouponMapper
sCouponMapper
;
@Autowired
private
ISStoreService
storeService
;
@Autowired
private
QPService
qpService
;
//默认时长
private
static
final
String
DEFAULT_DURATION
=
"0"
;
//默认折扣最大时长
...
...
@@ -31,97 +45,108 @@ public class SCouponServiceImpl implements ISCouponService
//默认优惠开始(有效)时段
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 优惠券主键
* @return 优惠券
*/
@Override
public
SCoupon
selectSCouponById
(
Long
id
)
{
public
SCoupon
selectSCouponById
(
Long
id
)
{
return
sCouponMapper
.
selectSCouponById
(
id
);
}
/**
* 查询优惠券列表
*
*
* @param sCoupon 优惠券
* @return 优惠券
*/
@Override
public
List
<
SCoupon
>
selectSCouponList
(
SCoupon
sCoupon
)
{
public
List
<
SCoupon
>
selectSCouponList
(
SCoupon
sCoupon
)
{
return
sCouponMapper
.
selectSCouponList
(
sCoupon
);
}
/**
* 新增优惠券
*
*
* @param sCoupon 优惠券
* @return 结果
*/
@Override
public
int
insertSCoupon
(
SCoupon
sCoupon
)
{
public
int
insertSCoupon
(
SCoupon
sCoupon
)
{
if
(
StringUtils
.
isBlank
(
sCoupon
.
getRoomType
()))
{
sCoupon
.
setRoomType
(
RoomType
.
getCodeList
());
}
if
(
StringUtils
.
isBlank
(
sCoupon
.
getStoreType
()))
{
sCoupon
.
setStoreType
(
StoreType
.
getCodeList
());
}
sCoupon
.
setValidStartTime
(
DEFAULT_START_TIME
);
sCoupon
.
setValidEndTime
(
DEFAULT_END_TIME
);
if
(
StringUtils
.
isBlank
(
sCoupon
.
getValidStartTime
()))
{
sCoupon
.
setValidStartTime
(
DEFAULT_START_TIME
);
}
if
(
StringUtils
.
isBlank
(
sCoupon
.
getValidEndTime
()))
{
sCoupon
.
setValidEndTime
(
DEFAULT_END_TIME
);
}
sCoupon
.
setMinDuration
(
DEFAULT_DURATION
);
sCoupon
.
setMaxDuration
(
DEFAULT_MAX_DURATION
);
sCoupon
.
setMinPrice
(
new
BigDecimal
(
"0.00"
));
sCoupon
.
setCreateTime
(
DateUtils
.
getNowDate
());
return
sCouponMapper
.
insertSCoupon
(
sCoupon
);
SCoupon
sCouponList
=
sCouponMapper
.
selectByDealgroupId
(
sCoupon
.
getDealgroupId
());
if
(
ObjectUtils
.
isEmpty
(
sCouponList
))
{
return
sCouponMapper
.
insertSCoupon
(
sCoupon
);
}
else
{
throw
new
RuntimeException
(
"该团购已存在"
);
}
}
/**
* 修改优惠券
*
*
* @param sCoupon 优惠券
* @return 结果
*/
@Override
public
int
updateSCoupon
(
SCoupon
sCoupon
)
{
public
int
updateSCoupon
(
SCoupon
sCoupon
)
{
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 需要删除的优惠券主键
* @return 结果
*/
@Override
public
int
deleteSCouponByIds
(
Long
[]
ids
)
{
public
int
deleteSCouponByIds
(
Long
[]
ids
)
{
return
sCouponMapper
.
deleteSCouponByIds
(
ids
);
}
/**
* 删除优惠券信息
*
*
* @param id 优惠券主键
* @return 结果
*/
@Override
public
int
deleteSCouponById
(
Long
id
)
{
public
int
deleteSCouponById
(
Long
id
)
{
return
sCouponMapper
.
deleteSCouponById
(
id
);
}
/**
* 根据优惠券名称查询优惠券
*
* @param dealTitle
* @return
*/
...
...
@@ -134,4 +159,65 @@ public class SCouponServiceImpl implements ISCouponService
public
List
<
SCoupon
>
selectSCouponByIds
(
Long
[]
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
This diff is collapsed.
Click to expand it.
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
}
//查询所有房间
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
();
//遍历门店
...
...
@@ -412,6 +415,11 @@ public class SStoreServiceImpl extends ServiceImpl<SStoreMapper, SStore> impleme
List
<
SRoomVo
>
roomVos
=
new
ArrayList
<>();
//遍历房间
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
<>();
deviceList
.
stream
().
forEach
(
device
->
{
if
(
room
.
getId
().
compareTo
(
device
.
getRoomId
())
==
0
)
{
...
...
share-system/src/main/resources/mapper/system/CouponLogMapper.xml
View file @
8cf074a9
...
...
@@ -14,6 +14,7 @@
<result
property=
"couponType"
column=
"coupon_type"
/>
<result
property=
"couponValue"
column=
"coupon_value"
/>
<result
property=
"status"
column=
"status"
/>
<result
property=
"number"
column=
"number"
/>
<result
property=
"message"
column=
"message"
/>
<result
property=
"createBy"
column=
"create_by"
/>
<result
property=
"createTime"
column=
"create_time"
/>
...
...
@@ -31,6 +32,7 @@
coupon_name,
coupon_type,
coupon_value,
number,
status,
message,
create_by,
...
...
@@ -50,6 +52,7 @@
<if
test=
"couponId != null "
>
and coupon_id = #{couponId}
</if>
<if
test=
"couponName != null and couponName != ''"
>
and coupon_name like concat('%', #{couponName}, '%')
</if>
<if
test=
"number != null "
>
and number = #{number}
</if>
<if
test=
"couponType != null and couponType != ''"
>
and coupon_type = #{couponType}
</if>
<if
test=
"couponValue != null "
>
and coupon_value = #{couponValue}
</if>
<if
test=
"status != null and status != ''"
>
and status = #{status}
</if>
...
...
@@ -73,6 +76,7 @@
<if
test=
"couponType != null and couponType != ''"
>
coupon_type,
</if>
<if
test=
"couponValue != null"
>
coupon_value,
</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=
"createBy != null"
>
create_by,
</if>
<if
test=
"createTime != null"
>
create_time,
</if>
...
...
@@ -89,6 +93,7 @@
<if
test=
"couponType != null and couponType != ''"
>
#{couponType},
</if>
<if
test=
"couponValue != null"
>
#{couponValue},
</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=
"createBy != null"
>
#{createBy},
</if>
<if
test=
"createTime != null"
>
#{createTime},
</if>
...
...
@@ -109,6 +114,7 @@
<if
test=
"couponType != null and couponType != ''"
>
coupon_type = #{couponType},
</if>
<if
test=
"couponValue != null"
>
coupon_value = #{couponValue},
</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=
"createBy != null"
>
create_by = #{createBy},
</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 @@
<result
property=
"couponId"
column=
"coupon_id"
/>
<result
property=
"storeId"
column=
"store_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=
"name"
column=
"name"
/>
<result
property=
"couponType"
column=
"coupon_type"
/>
...
...
@@ -31,6 +33,7 @@
<result
property=
"useDate"
column=
"use_date"
/>
<result
property=
"useStatus"
column=
"use_status"
/>
<result
property=
"isDelete"
column=
"is_delete"
/>
<result
property=
"weeks"
column=
"weeks"
/>
<result
property=
"createBy"
column=
"create_by"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"updateBy"
column=
"update_by"
/>
...
...
@@ -46,6 +49,8 @@
coupon_id,
store_id,
deal_id,
dealgroup_id,
store_ids,
coupon_code,
name,
coupon_type,
...
...
@@ -63,6 +68,7 @@
use_date,
use_status,
is_delete,
weeks,
create_by,
create_time,
update_by,
...
...
@@ -101,7 +107,8 @@
<if
test=
"startDate != null "
>
and start_date = #{startDate}
</if>
<if
test=
"endDate != null "
>
and end_date = #{endDate}
</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=
"deleteBy != null and deleteBy != ''"
>
and delete_by = #{deleteBy}
</if>
<if
test=
"deleteTime != null "
>
and delete_time = #{deleteTime}
</if>
...
...
@@ -151,6 +158,7 @@
<if
test=
"useDate != null"
>
use_date,
</if>
<if
test=
"useStatus != null"
>
use_status,
</if>
<if
test=
"isDelete != null"
>
is_delete,
</if>
<if
test=
"weeks != null"
>
weeks,
</if>
<if
test=
"createBy != null"
>
create_by,
</if>
<if
test=
"createTime != null"
>
create_time,
</if>
<if
test=
"updateBy != null"
>
update_by,
</if>
...
...
@@ -162,11 +170,13 @@
<if
test=
"storeType != null"
>
store_type,
</if>
<if
test=
"orderType != null"
>
order_type,
</if>
<if
test=
"packageId != null"
>
package_id,
</if>
<if
test=
"dealgroupId != null"
>
dealgroup_id,
</if>
<if
test=
"storeIds != null"
>
store_ids,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"consumerId != null"
>
#{consumerId},
</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=
"couponCode != null and couponCode != ''"
>
#{couponCode},
</if>
<if
test=
"name != null and name != ''"
>
#{name},
</if>
...
...
@@ -185,6 +195,7 @@
<if
test=
"useDate != null"
>
#{useDate},
</if>
<if
test=
"useStatus != null"
>
#{useStatus},
</if>
<if
test=
"isDelete != null"
>
#{isDelete},
</if>
<if
test=
"weeks != null"
>
#{weeks},
</if>
<if
test=
"createBy != null"
>
#{createBy},
</if>
<if
test=
"createTime != null"
>
#{createTime},
</if>
<if
test=
"updateBy != null"
>
#{updateBy},
</if>
...
...
@@ -196,6 +207,8 @@
<if
test=
"storeType != null"
>
#{storeType},
</if>
<if
test=
"orderType != null"
>
#{orderType},
</if>
<if
test=
"packageId != null"
>
#{packageId},
</if>
<if
test=
"dealgroupId != null"
>
#{dealgroupId},
</if>
<if
test=
"storeIds != null"
>
#{storeIds},
</if>
</trim>
</insert>
...
...
@@ -223,6 +236,7 @@
<if
test=
"useDate != null"
>
use_date = #{useDate},
</if>
<if
test=
"useStatus != null"
>
use_status = #{useStatus},
</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=
"createTime != null"
>
create_time = #{createTime},
</if>
<if
test=
"updateBy != null"
>
update_by = #{updateBy},
</if>
...
...
@@ -234,6 +248,8 @@
<if
test=
"storeType != null"
>
store_type = #{storeType},
</if>
<if
test=
"orderType != null"
>
order_type = #{orderType},
</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>
where id = #{id}
</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"
<result
property=
"couponType"
column=
"coupon_type"
/>
<result
property=
"orderType"
column=
"order_type"
/>
<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=
"minDuration"
column=
"min_duration"
/>
<result
property=
"maxDuration"
column=
"max_duration"
/>
<result
property=
"minPrice"
column=
"min_price"
/>
<result
property=
"subPrice"
column=
"sub_price"
/>
<result
property=
"isOverlay"
column=
"is_overlay"
/>
<result
property=
"weeks"
column=
"weeks"
/>
<result
property=
"platformType"
column=
"platform_type"
/>
<result
property=
"number"
column=
"number"
/>
<result
property=
"createBy"
column=
"create_by"
/>
...
...
@@ -39,6 +42,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
coupon_type,
order_type,
package_id,
dealgroup_id,
weeks,
store_ids,
duration,min_duration,max_duration,
min_price,sub_price,is_overlay,
platform_type,number,create_by,
...
...
@@ -59,6 +65,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"couponType != null"
>
and coupon_type = #{couponType}
</if>
<if
test=
"orderType != null"
>
and order_type = #{orderType}
</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=
"minDuration != null and minDuration != ''"
>
and min_duration = #{minDuration}
</if>
<if
test=
"maxDuration != null and maxDuration != ''"
>
and max_duration = #{maxDuration}
</if>
...
...
@@ -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=
"isOverlay != null"
>
and is_overlay = #{isOverlay}
</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=
"createBy != null"
>
and create_by = #{createBy}
</if>
<if
test=
"createTime != null"
>
and create_time = #{createTime}
</if>
...
...
@@ -89,6 +98,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id}
</foreach>
</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 into s_coupon
...
...
@@ -107,6 +130,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"minPrice != null"
>
min_price,
</if>
<if
test=
"subPrice != null"
>
sub_price,
</if>
<if
test=
"isOverlay != null"
>
is_overlay,
</if>
<if
test=
"weeks != null"
>
weeks,
</if>
<if
test=
"platformType != null"
>
platform_type,
</if>
<if
test=
"number != null"
>
number,
</if>
<if
test=
"createBy != null"
>
create_by,
</if>
...
...
@@ -114,6 +138,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"remark != null"
>
remark,
</if>
<if
test=
"orderType != null"
>
order_type,
</if>
<if
test=
"packageId != null"
>
package_id,
</if>
<if
test=
"dealgroupId != null"
>
dealgroup_id,
</if>
<if
test=
"storeIds != null"
>
store_ids,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"name != null and name != ''"
>
#{name},
</if>
...
...
@@ -130,6 +156,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"minPrice != null"
>
#{minPrice},
</if>
<if
test=
"subPrice != null"
>
#{subPrice},
</if>
<if
test=
"isOverlay != null"
>
#{isOverlay},
</if>
<if
test=
"weeks != null"
>
#{weeks},
</if>
<if
test=
"platformType != null"
>
#{platformType},
</if>
<if
test=
"number != null"
>
#{number},
</if>
<if
test=
"createBy != null"
>
#{createBy},
</if>
...
...
@@ -137,6 +164,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"remark != null"
>
#{remark},
</if>
<if
test=
"orderType != null"
>
#{orderType},
</if>
<if
test=
"packageId != null"
>
#{packageId},
</if>
<if
test=
"dealgroupId != null"
>
#{dealgroupId},
</if>
<if
test=
"storeIds != null"
>
#{storeIds},
</if>
</trim>
</insert>
...
...
@@ -146,16 +175,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"name != null and name != ''"
>
name = #{name},
</if>
<if
test=
"startDate != null"
>
start_date = #{startDate},
</if>
<if
test=
"endDate != null"
>
end_date = #{endDate},
</if>
<if
test=
"validStartTime !=
null
"
>
valid_start_time = #{validStartTime},
</if>
<if
test=
"validEndTime !=
null
"
>
valid_end_time = #{validEndTime},
</if>
<if
test=
"validStartTime !=
''
"
>
valid_start_time = #{validStartTime},
</if>
<if
test=
"validEndTime !=
''
"
>
valid_end_time = #{validEndTime},
</if>
<if
test=
"storeType != null"
>
store_type = #{storeType},
</if>
<if
test=
"roomType != null"
>
room_type = #{roomType},
</if>
<if
test=
"couponType != null"
>
coupon_type = #{couponType},
</if>
<if
test=
"orderType != null"
>
order_type = #{orderType},
</if>
<if
test=
"packageId != null"
>
package_id = #{packageId},
</if>
<if
test=
"orderType != ''"
>
order_type = #{orderType},
</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=
"minDuration != null and minDuration != ''"
>
min_duration = #{minDuration},
</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=
"subPrice != null and subPrice != ''"
>
sub_price = #{subPrice},
</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