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
811b37e3
Commit
811b37e3
authored
Oct 09, 2024
by
吕明尚
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' into test
parents
cbd6cbd6
1c69cb22
Hide whitespace changes
Inline
Side-by-side
Showing
43 changed files
with
1678 additions
and
36 deletions
+1678
-36
GiftAmountLogController.java
.../share/web/controller/system/GiftAmountLogController.java
+92
-0
RechargeAmountLogController.java
...re/web/controller/system/RechargeAmountLogController.java
+92
-0
ReceiptRdeisEnum.java
...on/src/main/java/share/common/enums/ReceiptRdeisEnum.java
+3
-1
ConsumerSecondaryCardController.java
...eb/controller/system/ConsumerSecondaryCardController.java
+2
-2
RedisTask.java
share-quartz/src/main/java/share/quartz/task/RedisTask.java
+44
-2
ConsumerMonthlyCard.java
...rc/main/java/share/system/domain/ConsumerMonthlyCard.java
+7
-5
ConsumerWallet.java
...tem/src/main/java/share/system/domain/ConsumerWallet.java
+12
-0
GiftAmountLog.java
...stem/src/main/java/share/system/domain/GiftAmountLog.java
+81
-0
MonthlyCardConf.java
...em/src/main/java/share/system/domain/MonthlyCardConf.java
+1
-1
MonthlyCardLog.java
...tem/src/main/java/share/system/domain/MonthlyCardLog.java
+20
-2
RechargeAmountLog.java
.../src/main/java/share/system/domain/RechargeAmountLog.java
+87
-0
SOrder.java
share-system/src/main/java/share/system/domain/SOrder.java
+12
-0
SecondaryCardLog.java
...m/src/main/java/share/system/domain/SecondaryCardLog.java
+17
-0
ConsumerSecondaryCardVo.java
.../java/share/system/domain/vo/ConsumerSecondaryCardVo.java
+4
-0
GiftAmountLogVo.java
...src/main/java/share/system/domain/vo/GiftAmountLogVo.java
+13
-0
RechargeAmountLogVo.java
...main/java/share/system/domain/vo/RechargeAmountLogVo.java
+13
-0
SConsumerVo.java
...tem/src/main/java/share/system/domain/vo/SConsumerVo.java
+4
-2
ConsumerMonthlyCardMapper.java
...n/java/share/system/mapper/ConsumerMonthlyCardMapper.java
+1
-1
GiftAmountLogMapper.java
...rc/main/java/share/system/mapper/GiftAmountLogMapper.java
+63
-0
RechargeAmountLogMapper.java
...ain/java/share/system/mapper/RechargeAmountLogMapper.java
+63
-0
CreateOrderRequest.java
...rc/main/java/share/system/request/CreateOrderRequest.java
+8
-0
OrderComputedPriceRequest.java
.../java/share/system/request/OrderComputedPriceRequest.java
+8
-0
ComputedOrderPriceResponse.java
...ava/share/system/response/ComputedOrderPriceResponse.java
+7
-0
ConsumerMonthlyCardService.java
...java/share/system/service/ConsumerMonthlyCardService.java
+1
-1
ConsumerSecondaryCardService.java
...va/share/system/service/ConsumerSecondaryCardService.java
+2
-0
GiftAmountLogService.java
.../main/java/share/system/service/GiftAmountLogService.java
+63
-0
RechargeAmountLogService.java
...n/java/share/system/service/RechargeAmountLogService.java
+63
-0
ConsumerMonthlyCardServiceImpl.java
...e/system/service/impl/ConsumerMonthlyCardServiceImpl.java
+1
-1
ConsumerSecondaryCardServiceImpl.java
...system/service/impl/ConsumerSecondaryCardServiceImpl.java
+34
-0
ConsumerWalletServiceImpl.java
.../share/system/service/impl/ConsumerWalletServiceImpl.java
+50
-0
GiftAmountLogServiceImpl.java
...a/share/system/service/impl/GiftAmountLogServiceImpl.java
+92
-0
MonthlyCardOrderServiceImpl.java
...hare/system/service/impl/MonthlyCardOrderServiceImpl.java
+19
-0
RechargeAmountLogServiceImpl.java
...are/system/service/impl/RechargeAmountLogServiceImpl.java
+92
-0
RechargeServiceImpl.java
...n/java/share/system/service/impl/RechargeServiceImpl.java
+2
-0
SConsumerServiceImpl.java
.../java/share/system/service/impl/SConsumerServiceImpl.java
+15
-7
SOrderServiceImpl.java
...ain/java/share/system/service/impl/SOrderServiceImpl.java
+227
-11
SecondaryCardOrderServiceImpl.java
...re/system/service/impl/SecondaryCardOrderServiceImpl.java
+19
-0
ConsumerWalletMapper.xml
...src/main/resources/mapper/system/ConsumerWalletMapper.xml
+14
-0
GiftAmountLogMapper.xml
.../src/main/resources/mapper/system/GiftAmountLogMapper.xml
+131
-0
MonthlyCardLogMapper.xml
...src/main/resources/mapper/system/MonthlyCardLogMapper.xml
+13
-0
RechargeAmountLogMapper.xml
.../main/resources/mapper/system/RechargeAmountLogMapper.xml
+133
-0
SOrderMapper.xml
...-system/src/main/resources/mapper/system/SOrderMapper.xml
+40
-0
SecondaryCardLogMapper.xml
...c/main/resources/mapper/system/SecondaryCardLogMapper.xml
+13
-0
No files found.
share-admin/src/main/java/share/web/controller/system/GiftAmountLogController.java
0 → 100644
View file @
811b37e3
package
share
.
web
.
controller
.
system
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.*
;
import
share.common.annotation.Log
;
import
share.common.core.controller.BaseController
;
import
share.common.core.domain.AjaxResult
;
import
share.common.core.page.TableDataInfo
;
import
share.common.enums.BusinessType
;
import
share.common.utils.poi.ExcelUtil
;
import
share.system.domain.GiftAmountLog
;
import
share.system.domain.vo.GiftAmountLogVo
;
import
share.system.service.GiftAmountLogService
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.List
;
/**
* 赠送金额日志Controller
*
* @author wuwenlong
* @date 2024-10-08
*/
@RestController
@RequestMapping
(
"/system/giftAmountLog"
)
public
class
GiftAmountLogController
extends
BaseController
{
@Autowired
private
GiftAmountLogService
giftAmountLogService
;
/**
* 查询赠送金额日志列表
*/
@PreAuthorize
(
"@ss.hasPermi('system:giftAmountLog:list')"
)
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
GiftAmountLogVo
giftAmountLog
)
{
startPage
();
List
<
GiftAmountLogVo
>
list
=
giftAmountLogService
.
selectGiftAmountLogList
(
giftAmountLog
);
return
getDataTable
(
list
);
}
/**
* 导出赠送金额日志列表
*/
@PreAuthorize
(
"@ss.hasPermi('system:giftAmountLog:export')"
)
@Log
(
title
=
"赠送金额日志"
,
businessType
=
BusinessType
.
EXPORT
)
@PostMapping
(
"/export"
)
public
void
export
(
HttpServletResponse
response
,
GiftAmountLogVo
giftAmountLog
)
{
List
<
GiftAmountLogVo
>
list
=
giftAmountLogService
.
selectGiftAmountLogList
(
giftAmountLog
);
ExcelUtil
<
GiftAmountLogVo
>
util
=
new
ExcelUtil
<
GiftAmountLogVo
>(
GiftAmountLogVo
.
class
);
util
.
exportExcel
(
response
,
list
,
"赠送金额日志数据"
);
}
/**
* 获取赠送金额日志详细信息
*/
@PreAuthorize
(
"@ss.hasPermi('system:giftAmountLog:query')"
)
@GetMapping
(
value
=
"/{id}"
)
public
AjaxResult
getInfo
(
@PathVariable
(
"id"
)
Long
id
)
{
return
success
(
giftAmountLogService
.
selectGiftAmountLogById
(
id
));
}
/**
* 新增赠送金额日志
*/
@PreAuthorize
(
"@ss.hasPermi('system:giftAmountLog:add')"
)
@Log
(
title
=
"赠送金额日志"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
public
AjaxResult
add
(
@RequestBody
GiftAmountLog
giftAmountLog
)
{
return
toAjax
(
giftAmountLogService
.
insertGiftAmountLog
(
giftAmountLog
));
}
/**
* 修改赠送金额日志
*/
@PreAuthorize
(
"@ss.hasPermi('system:giftAmountLog:edit')"
)
@Log
(
title
=
"赠送金额日志"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
public
AjaxResult
edit
(
@RequestBody
GiftAmountLog
giftAmountLog
)
{
return
toAjax
(
giftAmountLogService
.
updateGiftAmountLog
(
giftAmountLog
));
}
/**
* 删除赠送金额日志
*/
@PreAuthorize
(
"@ss.hasPermi('system:giftAmountLog:remove')"
)
@Log
(
title
=
"赠送金额日志"
,
businessType
=
BusinessType
.
DELETE
)
@DeleteMapping
(
"/{ids}"
)
public
AjaxResult
remove
(
@PathVariable
Long
[]
ids
)
{
return
toAjax
(
giftAmountLogService
.
deleteGiftAmountLogByIds
(
ids
));
}
}
share-admin/src/main/java/share/web/controller/system/RechargeAmountLogController.java
0 → 100644
View file @
811b37e3
package
share
.
web
.
controller
.
system
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.*
;
import
share.common.annotation.Log
;
import
share.common.core.controller.BaseController
;
import
share.common.core.domain.AjaxResult
;
import
share.common.core.page.TableDataInfo
;
import
share.common.enums.BusinessType
;
import
share.common.utils.poi.ExcelUtil
;
import
share.system.domain.RechargeAmountLog
;
import
share.system.domain.vo.RechargeAmountLogVo
;
import
share.system.service.RechargeAmountLogService
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.List
;
/**
* 充值金额日志Controller
*
* @author wuwenlong
* @date 2024-10-08
*/
@RestController
@RequestMapping
(
"/system/rechargeAmountLog"
)
public
class
RechargeAmountLogController
extends
BaseController
{
@Autowired
private
RechargeAmountLogService
rechargeAmountLogService
;
/**
* 查询充值金额日志列表
*/
@PreAuthorize
(
"@ss.hasPermi('system:rechargeAmountLog:list')"
)
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
RechargeAmountLogVo
rechargeAmountLog
)
{
startPage
();
List
<
RechargeAmountLogVo
>
list
=
rechargeAmountLogService
.
selectRechargeAmountLogList
(
rechargeAmountLog
);
return
getDataTable
(
list
);
}
/**
* 导出充值金额日志列表
*/
@PreAuthorize
(
"@ss.hasPermi('system:rechargeAmountLog:export')"
)
@Log
(
title
=
"充值金额日志"
,
businessType
=
BusinessType
.
EXPORT
)
@PostMapping
(
"/export"
)
public
void
export
(
HttpServletResponse
response
,
RechargeAmountLogVo
rechargeAmountLog
)
{
List
<
RechargeAmountLogVo
>
list
=
rechargeAmountLogService
.
selectRechargeAmountLogList
(
rechargeAmountLog
);
ExcelUtil
<
RechargeAmountLogVo
>
util
=
new
ExcelUtil
<
RechargeAmountLogVo
>(
RechargeAmountLogVo
.
class
);
util
.
exportExcel
(
response
,
list
,
"充值金额日志数据"
);
}
/**
* 获取充值金额日志详细信息
*/
@PreAuthorize
(
"@ss.hasPermi('system:rechargeAmountLog:query')"
)
@GetMapping
(
value
=
"/{id}"
)
public
AjaxResult
getInfo
(
@PathVariable
(
"id"
)
Long
id
)
{
return
success
(
rechargeAmountLogService
.
selectRechargeAmountLogById
(
id
));
}
/**
* 新增充值金额日志
*/
@PreAuthorize
(
"@ss.hasPermi('system:rechargeAmountLog:add')"
)
@Log
(
title
=
"充值金额日志"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
public
AjaxResult
add
(
@RequestBody
RechargeAmountLog
rechargeAmountLog
)
{
return
toAjax
(
rechargeAmountLogService
.
insertRechargeAmountLog
(
rechargeAmountLog
));
}
/**
* 修改充值金额日志
*/
@PreAuthorize
(
"@ss.hasPermi('system:rechargeAmountLog:edit')"
)
@Log
(
title
=
"充值金额日志"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
public
AjaxResult
edit
(
@RequestBody
RechargeAmountLog
rechargeAmountLog
)
{
return
toAjax
(
rechargeAmountLogService
.
updateRechargeAmountLog
(
rechargeAmountLog
));
}
/**
* 删除充值金额日志
*/
@PreAuthorize
(
"@ss.hasPermi('system:rechargeAmountLog:remove')"
)
@Log
(
title
=
"充值金额日志"
,
businessType
=
BusinessType
.
DELETE
)
@DeleteMapping
(
"/{ids}"
)
public
AjaxResult
remove
(
@PathVariable
Long
[]
ids
)
{
return
toAjax
(
rechargeAmountLogService
.
deleteRechargeAmountLogByIds
(
ids
));
}
}
share-common/src/main/java/share/common/enums/ReceiptRdeisEnum.java
View file @
811b37e3
...
...
@@ -13,7 +13,9 @@ public enum ReceiptRdeisEnum {
//房间15分钟过期
ROOM_EXPIRE_TIME
(
9
,
"ROOM_EXPIRE_TIME."
),
ORDER_CANCEL_PAY
(
10
,
"ORDER_CANCEL_PAY."
),
EQUITY_MEMBERS_TIME
(
11
,
"EQUITY_MEMBERS_TIME."
)
EQUITY_MEMBERS_TIME
(
11
,
"EQUITY_MEMBERS_TIME."
),
MONTHLY_CARD
(
12
,
"MONTHLY_CARD."
),
SECONDARY_CARD
(
13
,
"SECONDARY_CARD."
)
;
...
...
share-front/src/main/java/share/web/controller/system/ConsumerSecondaryCardController.java
View file @
811b37e3
...
...
@@ -35,8 +35,8 @@ public class ConsumerSecondaryCardController extends BaseController {
}
@GetMapping
(
"/query"
)
public
AjaxResult
selectByConsumerId
()
{
return
success
(
consumerSecondaryCardService
.
selectBy
ConsumerId
(
));
public
AjaxResult
selectByConsumerId
(
Long
packId
)
{
return
success
(
consumerSecondaryCardService
.
selectBy
PaclId
(
packId
));
}
}
share-quartz/src/main/java/share/quartz/task/RedisTask.java
View file @
811b37e3
...
...
@@ -14,7 +14,6 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import
com.dianping.openapi.sdk.api.oauth.entity.CustomerRefreshTokenResponse
;
import
com.dianping.openapi.sdk.api.tuangou.entity.TuangouReceiptGetConsumedReponseEntity
;
import
com.xxl.job.core.handler.annotation.XxlJob
;
import
lombok.val
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -33,7 +32,6 @@ import share.system.domain.vo.MqttxVo;
import
share.system.service.*
;
import
java.math.BigDecimal
;
import
java.math.RoundingMode
;
import
java.util.*
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.TimeUnit
;
...
...
@@ -116,6 +114,12 @@ public class RedisTask {
@Autowired
private
EquityFundExcessService
equityFundExcessService
;
@Autowired
private
ConsumerMonthlyCardService
consumerMonthlyCardService
;
@Autowired
private
ConsumerSecondaryCardService
consumerSecondaryCardService
;
//15分钟的常量
final
long
FIFTEEN_MINUTES
=
60
*
15
;
...
...
@@ -780,4 +784,42 @@ public class RedisTask {
});
logger
.
debug
(
"AutoUpdateOpenid:自动更新用户unionid结束"
);
}
@XxlJob
(
"AutomaticallyMonthlyCard"
)
public
void
AutomaticallyMonthlyCard
()
{
logger
.
debug
(
"AutomaticallyMonthlyCard:自动结束月卡开始"
);
Set
<
String
>
keys
=
redisTemplate
.
keys
(
ReceiptRdeisEnum
.
MONTHLY_CARD
.
getValue
()
+
"*"
);
if
(
keys
.
size
()
==
0
)
return
;
keys
.
stream
().
forEach
(
key
->
{
String
value
=
redisUtil
.
get
(
String
.
valueOf
(
key
));
JSONObject
jsonObject
=
new
JSONObject
(
value
);
Date
expirationTime
=
jsonObject
.
getDate
(
"expirationTime"
);
Long
consumerMonthlyCardId
=
jsonObject
.
getLong
(
"consumerMonthlyCardId"
);
if
(
expirationTime
.
getTime
()
<
new
Date
().
getTime
())
{
consumerMonthlyCardService
.
removeById
(
consumerMonthlyCardId
);
redisUtil
.
delete
(
key
);
}
});
logger
.
debug
(
"AutomaticallyMonthlyCard:自动结束月卡结束"
);
}
@XxlJob
(
"AutomaticallySecondaryCard"
)
public
void
AutomaticallySecondaryCard
()
{
logger
.
debug
(
"AutomaticallySecondaryCard:自动结束次卡开始"
);
Set
<
String
>
keys
=
redisTemplate
.
keys
(
ReceiptRdeisEnum
.
SECONDARY_CARD
.
getValue
()
+
"*"
);
if
(
keys
.
size
()
==
0
)
return
;
keys
.
stream
().
forEach
(
key
->
{
String
value
=
redisUtil
.
get
(
String
.
valueOf
(
key
));
JSONObject
jsonObject
=
new
JSONObject
(
value
);
Date
expirationTime
=
jsonObject
.
getDate
(
"expirationTime"
);
Long
consumerSecondaryCardId
=
jsonObject
.
getLong
(
"consumerSecondaryCardId"
);
if
(
expirationTime
.
getTime
()
<
new
Date
().
getTime
())
{
consumerSecondaryCardService
.
removeById
(
consumerSecondaryCardId
);
redisUtil
.
delete
(
key
);
}
});
logger
.
debug
(
"AutomaticallySecondaryCard:自动结束次卡结束"
);
}
}
share-system/src/main/java/share/system/domain/ConsumerMonthlyCard.java
View file @
811b37e3
package
share
.
system
.
domain
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.annotation.*
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
lombok.Data
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
...
...
@@ -10,6 +8,7 @@ import org.apache.commons.lang3.builder.ToStringStyle;
import
share.common.annotation.Excel
;
import
share.common.core.domain.BaseEntity
;
import
java.math.BigDecimal
;
import
java.util.Date
;
/**
...
...
@@ -51,7 +50,7 @@ public class ConsumerMonthlyCard extends BaseEntity {
* 免费时长
*/
@Excel
(
name
=
"免费时长"
)
private
Long
freeDuration
;
private
BigDecimal
freeDuration
;
/**
* 月卡天数
...
...
@@ -69,7 +68,10 @@ public class ConsumerMonthlyCard extends BaseEntity {
/**
* 删除标记:1-删除,0-正常
*/
private
Long
isDelete
;
//逻辑删除注解(0 未删除 1 已删除)
@TableLogic
@TableField
(
select
=
false
)
private
Integer
isDelete
;
@Override
...
...
share-system/src/main/java/share/system/domain/ConsumerWallet.java
View file @
811b37e3
...
...
@@ -39,6 +39,18 @@ public class ConsumerWallet extends BaseEntity {
private
BigDecimal
balance
;
/**
* 充值金额
*/
@Excel
(
name
=
"充值金额"
)
private
BigDecimal
rechargeAmount
;
/**
* 赠送金额
*/
@Excel
(
name
=
"赠送金额"
)
private
BigDecimal
giftAmount
;
/**
* 时长
*/
@Excel
(
name
=
"时长"
)
...
...
share-system/src/main/java/share/system/domain/GiftAmountLog.java
0 → 100644
View file @
811b37e3
package
share
.
system
.
domain
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
lombok.Data
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
import
share.common.annotation.Excel
;
import
share.common.core.domain.BaseEntity
;
import
java.math.BigDecimal
;
import
java.util.Date
;
/**
* 赠送金额日志对象 s_gift_amount_log
*
* @author wuwenlong
* @date 2024-10-08
*/
@Data
public
class
GiftAmountLog
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* ID
*/
private
Long
id
;
/**
* 用户id
*/
private
Long
consumerId
;
/**
* 当前金额
*/
@Excel
(
name
=
"当前金额"
)
private
BigDecimal
currentAmount
;
/**
* 变动金额
*/
@Excel
(
name
=
"变动金额"
)
private
BigDecimal
variableAmount
;
/**
* 操作类型
*/
@Excel
(
name
=
"操作类型"
)
private
Integer
operationType
;
/**
* 操作时间
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
)
@Excel
(
name
=
"操作时间"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd"
)
private
Date
operationTime
;
/**
* 是否删除
*/
private
Long
isDelete
;
@Override
public
String
toString
()
{
return
new
ToStringBuilder
(
this
,
ToStringStyle
.
MULTI_LINE_STYLE
)
.
append
(
"id"
,
getId
())
.
append
(
"consumerId"
,
getConsumerId
())
.
append
(
"currentAmount"
,
getCurrentAmount
())
.
append
(
"variableAmount"
,
getVariableAmount
())
.
append
(
"operationType"
,
getOperationType
())
.
append
(
"operationTime"
,
getOperationTime
())
.
append
(
"isDelete"
,
getIsDelete
())
.
append
(
"createBy"
,
getCreateBy
())
.
append
(
"createTime"
,
getCreateTime
())
.
append
(
"updateBy"
,
getUpdateBy
())
.
append
(
"updateTime"
,
getUpdateTime
())
.
append
(
"remark"
,
getRemark
())
.
toString
();
}
}
share-system/src/main/java/share/system/domain/MonthlyCardConf.java
View file @
811b37e3
...
...
@@ -43,7 +43,7 @@ public class MonthlyCardConf extends BaseEntity {
* 免费时长
*/
@Excel
(
name
=
"免费时长"
)
private
Long
freeDuration
;
private
BigDecimal
freeDuration
;
/**
* 月卡天数
...
...
share-system/src/main/java/share/system/domain/MonthlyCardLog.java
View file @
811b37e3
...
...
@@ -3,12 +3,16 @@ package share.system.domain;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableLogic
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
lombok.Data
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
import
share.common.annotation.Excel
;
import
share.common.core.domain.BaseEntity
;
import
java.math.BigDecimal
;
import
java.util.Date
;
/**
* 月卡使用记录对象 s_monthly_card_log
*
...
...
@@ -47,13 +51,27 @@ public class MonthlyCardLog extends BaseEntity {
* 使用时长
*/
@Excel
(
name
=
"使用时长"
)
private
Long
useDuration
;
private
BigDecimal
useDuration
;
/**
* 剩余时长
*/
@Excel
(
name
=
"剩余时长"
)
private
Long
residueDuration
;
private
BigDecimal
residueDuration
;
/**
* 操作类型
*/
@Excel
(
name
=
"操作类型"
)
private
Integer
operationType
;
/**
* 操作时间
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@Excel
(
name
=
"操作时间"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd"
)
private
Date
operationTime
;
/**
* 删除标记:1-删除,0-正常
...
...
share-system/src/main/java/share/system/domain/RechargeAmountLog.java
0 → 100644
View file @
811b37e3
package
share
.
system
.
domain
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableLogic
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
lombok.Data
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
import
share.common.annotation.Excel
;
import
share.common.core.domain.BaseEntity
;
import
java.math.BigDecimal
;
import
java.util.Date
;
/**
* 充值金额日志对象 s_recharge_amount_log
*
* @author wuwenlong
* @date 2024-10-08
*/
@Data
public
class
RechargeAmountLog
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* ID
*/
private
Long
id
;
/**
* 用户id
*/
@Excel
(
name
=
"用户id"
)
private
Long
consumerId
;
/**
* 当前金额
*/
@Excel
(
name
=
"当前金额"
)
private
BigDecimal
currentAmount
;
/**
* 变动金额
*/
@Excel
(
name
=
"变动金额"
)
private
BigDecimal
variableAmount
;
/**
* 操作类型
*/
@Excel
(
name
=
"操作类型"
)
private
Integer
operationType
;
/**
* 操作时间
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
)
@Excel
(
name
=
"操作时间"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd"
)
private
Date
operationTime
;
/**
* 是否删除
*/
//逻辑删除注解(0 未删除 1 已删除)
@TableLogic
@TableField
(
select
=
false
)
private
Long
isDelete
;
@Override
public
String
toString
()
{
return
new
ToStringBuilder
(
this
,
ToStringStyle
.
MULTI_LINE_STYLE
)
.
append
(
"id"
,
getId
())
.
append
(
"consumerId"
,
getConsumerId
())
.
append
(
"currentAmount"
,
getCurrentAmount
())
.
append
(
"variableAmount"
,
getVariableAmount
())
.
append
(
"operationType"
,
getOperationType
())
.
append
(
"operationTime"
,
getOperationTime
())
.
append
(
"isDelete"
,
getIsDelete
())
.
append
(
"createBy"
,
getCreateBy
())
.
append
(
"createTime"
,
getCreateTime
())
.
append
(
"updateBy"
,
getUpdateBy
())
.
append
(
"updateTime"
,
getUpdateTime
())
.
append
(
"remark"
,
getRemark
())
.
toString
();
}
}
share-system/src/main/java/share/system/domain/SOrder.java
View file @
811b37e3
...
...
@@ -81,6 +81,12 @@ public class SOrder extends BaseEntity
@Excel
(
name
=
"优惠券金额"
)
private
BigDecimal
couponPrice
;
@Excel
(
name
=
"次卡ID"
)
private
Long
secondaryCardId
;
@Excel
(
name
=
"月卡ID"
)
private
Long
monthlyCardId
;
@Excel
(
name
=
"订单总价"
)
private
BigDecimal
totalPrice
;
...
...
@@ -99,6 +105,12 @@ public class SOrder extends BaseEntity
@Excel
(
name
=
"使用余额"
)
private
BigDecimal
balance
;
@Excel
(
name
=
"充值金额"
)
private
BigDecimal
rechargeAmount
;
@Excel
(
name
=
"赠送金额"
)
private
BigDecimal
giftAmount
;
@Excel
(
name
=
"优惠比例"
)
private
BigDecimal
discountRatio
;
...
...
share-system/src/main/java/share/system/domain/SecondaryCardLog.java
View file @
811b37e3
...
...
@@ -3,12 +3,15 @@ package share.system.domain;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableLogic
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
lombok.Data
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
import
share.common.annotation.Excel
;
import
share.common.core.domain.BaseEntity
;
import
java.util.Date
;
/**
* 次卡使用记录对象 s_secondary_card_log
*
...
...
@@ -62,6 +65,20 @@ public class SecondaryCardLog extends BaseEntity {
private
Long
residueCount
;
/**
* 操作类型
*/
@Excel
(
name
=
"操作类型"
)
private
Integer
operationType
;
/**
* 操作时间
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@Excel
(
name
=
"操作时间"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd"
)
private
Date
operationTime
;
/**
* 删除标记:1-删除,0-正常
*/
//逻辑删除注解(0 未删除 1 已删除)
...
...
share-system/src/main/java/share/system/domain/vo/ConsumerSecondaryCardVo.java
View file @
811b37e3
...
...
@@ -19,4 +19,8 @@ public class ConsumerSecondaryCardVo extends ConsumerSecondaryCard {
private
String
confName
;
//次卡金额
private
BigDecimal
confAmount
;
//是否适用当前套餐
private
Integer
isUse
;
//原因
private
String
reason
;
}
share-system/src/main/java/share/system/domain/vo/GiftAmountLogVo.java
0 → 100644
View file @
811b37e3
package
share
.
system
.
domain
.
vo
;
import
lombok.Data
;
import
share.system.domain.GiftAmountLog
;
@Data
public
class
GiftAmountLogVo
extends
GiftAmountLog
{
private
String
nickName
;
private
String
avatar
;
private
String
phone
;
}
share-system/src/main/java/share/system/domain/vo/RechargeAmountLogVo.java
0 → 100644
View file @
811b37e3
package
share
.
system
.
domain
.
vo
;
import
lombok.Data
;
import
share.system.domain.RechargeAmountLog
;
@Data
public
class
RechargeAmountLogVo
extends
RechargeAmountLog
{
private
String
nickName
;
private
String
avatar
;
private
String
phone
;
}
share-system/src/main/java/share/system/domain/vo/SConsumerVo.java
View file @
811b37e3
...
...
@@ -2,9 +2,10 @@ package share.system.domain.vo;
import
lombok.Data
;
import
share.system.domain.ConsumerMember
;
import
share.system.domain.ConsumerWallet
;
import
share.system.domain.SConsumer
;
import
java.util.List
;
/**
* @className: share.system.domain.vo.SConsumerVo
* @description: 会员
...
...
@@ -46,7 +47,8 @@ public class SConsumerVo extends SConsumer {
private
Long
newId
;
private
List
<
ConsumerMonthlyCardVo
>
monthlyCardList
;
private
List
<
ConsumerSecondaryCardVo
>
secondaryCardList
;
}
share-system/src/main/java/share/system/mapper/ConsumerMonthlyCardMapper.java
View file @
811b37e3
...
...
@@ -61,5 +61,5 @@ public interface ConsumerMonthlyCardMapper extends BaseMapper<ConsumerMonthlyCar
*/
public
int
deleteConsumerMonthlyCardByIds
(
Long
[]
ids
);
ConsumerMonthlyCardVo
selectByConsumerId
(
ConsumerMonthlyCardVo
consumerMemberVo
);
List
<
ConsumerMonthlyCardVo
>
selectByConsumerId
(
ConsumerMonthlyCardVo
consumerMemberVo
);
}
share-system/src/main/java/share/system/mapper/GiftAmountLogMapper.java
0 → 100644
View file @
811b37e3
package
share
.
system
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
share.system.domain.GiftAmountLog
;
import
share.system.domain.vo.GiftAmountLogVo
;
import
java.util.List
;
/**
* 赠送金额日志Mapper接口
*
* @author wuwenlong
* @date 2024-10-08
*/
public
interface
GiftAmountLogMapper
extends
BaseMapper
<
GiftAmountLog
>
{
/**
* 查询赠送金额日志
*
* @param id 赠送金额日志主键
* @return 赠送金额日志
*/
public
GiftAmountLog
selectGiftAmountLogById
(
Long
id
);
/**
* 查询赠送金额日志列表
*
* @param giftAmountLog 赠送金额日志
* @return 赠送金额日志集合
*/
public
List
<
GiftAmountLogVo
>
selectGiftAmountLogList
(
GiftAmountLogVo
giftAmountLog
);
/**
* 新增赠送金额日志
*
* @param giftAmountLog 赠送金额日志
* @return 结果
*/
public
int
insertGiftAmountLog
(
GiftAmountLog
giftAmountLog
);
/**
* 修改赠送金额日志
*
* @param giftAmountLog 赠送金额日志
* @return 结果
*/
public
int
updateGiftAmountLog
(
GiftAmountLog
giftAmountLog
);
/**
* 删除赠送金额日志
*
* @param id 赠送金额日志主键
* @return 结果
*/
public
int
deleteGiftAmountLogById
(
Long
id
);
/**
* 批量删除赠送金额日志
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public
int
deleteGiftAmountLogByIds
(
Long
[]
ids
);
}
share-system/src/main/java/share/system/mapper/RechargeAmountLogMapper.java
0 → 100644
View file @
811b37e3
package
share
.
system
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
share.system.domain.RechargeAmountLog
;
import
share.system.domain.vo.RechargeAmountLogVo
;
import
java.util.List
;
/**
* 充值金额日志Mapper接口
*
* @author wuwenlong
* @date 2024-10-08
*/
public
interface
RechargeAmountLogMapper
extends
BaseMapper
<
RechargeAmountLog
>
{
/**
* 查询充值金额日志
*
* @param id 充值金额日志主键
* @return 充值金额日志
*/
public
RechargeAmountLog
selectRechargeAmountLogById
(
Long
id
);
/**
* 查询充值金额日志列表
*
* @param rechargeAmountLog 充值金额日志
* @return 充值金额日志集合
*/
public
List
<
RechargeAmountLogVo
>
selectRechargeAmountLogList
(
RechargeAmountLogVo
rechargeAmountLog
);
/**
* 新增充值金额日志
*
* @param rechargeAmountLog 充值金额日志
* @return 结果
*/
public
int
insertRechargeAmountLog
(
RechargeAmountLog
rechargeAmountLog
);
/**
* 修改充值金额日志
*
* @param rechargeAmountLog 充值金额日志
* @return 结果
*/
public
int
updateRechargeAmountLog
(
RechargeAmountLog
rechargeAmountLog
);
/**
* 删除充值金额日志
*
* @param id 充值金额日志主键
* @return 结果
*/
public
int
deleteRechargeAmountLogById
(
Long
id
);
/**
* 批量删除充值金额日志
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public
int
deleteRechargeAmountLogByIds
(
Long
[]
ids
);
}
share-system/src/main/java/share/system/request/CreateOrderRequest.java
View file @
811b37e3
...
...
@@ -89,4 +89,12 @@ public class CreateOrderRequest {
@ApiModelProperty
(
value
=
"使用时长"
)
private
BigDecimal
duration
;
//次卡ID
@ApiModelProperty
(
value
=
"次卡ID"
)
private
Long
secondaryCardId
;
//月卡ID
@ApiModelProperty
(
value
=
"月卡ID"
)
private
Long
monthlyCardId
;
}
share-system/src/main/java/share/system/request/OrderComputedPriceRequest.java
View file @
811b37e3
...
...
@@ -54,4 +54,12 @@ public class OrderComputedPriceRequest {
@ApiModelProperty
(
value
=
"标签id"
)
private
Long
roomLabelId
;
//次卡ID
@ApiModelProperty
(
value
=
"次卡ID"
)
private
Long
secondaryCardId
;
//月卡ID
@ApiModelProperty
(
value
=
"月卡ID"
)
private
Long
monthlyCardId
;
}
share-system/src/main/java/share/system/response/ComputedOrderPriceResponse.java
View file @
811b37e3
...
...
@@ -68,5 +68,12 @@ public class ComputedOrderPriceResponse implements Serializable {
@ApiModelProperty
(
value
=
"剩余余额"
)
private
BigDecimal
remainingBalance
;
//次卡ID
@ApiModelProperty
(
value
=
"次卡ID"
)
private
Long
secondaryCardId
;
//月卡ID
@ApiModelProperty
(
value
=
"月卡ID"
)
private
Long
monthlyCardId
;
}
share-system/src/main/java/share/system/service/ConsumerMonthlyCardService.java
View file @
811b37e3
...
...
@@ -61,5 +61,5 @@ public interface ConsumerMonthlyCardService extends IService<ConsumerMonthlyCard
*/
public
int
deleteConsumerMonthlyCardById
(
Long
id
);
ConsumerMonthlyCardVo
selectByConsumerId
();
List
<
ConsumerMonthlyCardVo
>
selectByConsumerId
();
}
share-system/src/main/java/share/system/service/ConsumerSecondaryCardService.java
View file @
811b37e3
...
...
@@ -62,4 +62,6 @@ public interface ConsumerSecondaryCardService extends IService<ConsumerSecondary
public
int
deleteConsumerSecondaryCardById
(
Long
id
);
List
<
ConsumerSecondaryCardVo
>
selectByConsumerId
();
List
<
ConsumerSecondaryCardVo
>
selectByPaclId
(
Long
packId
);
}
share-system/src/main/java/share/system/service/GiftAmountLogService.java
0 → 100644
View file @
811b37e3
package
share
.
system
.
service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
share.system.domain.GiftAmountLog
;
import
share.system.domain.vo.GiftAmountLogVo
;
import
java.util.List
;
/**
* 赠送金额日志Service接口
*
* @author wuwenlong
* @date 2024-10-08
*/
public
interface
GiftAmountLogService
extends
IService
<
GiftAmountLog
>
{
/**
* 查询赠送金额日志
*
* @param id 赠送金额日志主键
* @return 赠送金额日志
*/
public
GiftAmountLog
selectGiftAmountLogById
(
Long
id
);
/**
* 查询赠送金额日志列表
*
* @param giftAmountLog 赠送金额日志
* @return 赠送金额日志集合
*/
public
List
<
GiftAmountLogVo
>
selectGiftAmountLogList
(
GiftAmountLogVo
giftAmountLog
);
/**
* 新增赠送金额日志
*
* @param giftAmountLog 赠送金额日志
* @return 结果
*/
public
int
insertGiftAmountLog
(
GiftAmountLog
giftAmountLog
);
/**
* 修改赠送金额日志
*
* @param giftAmountLog 赠送金额日志
* @return 结果
*/
public
int
updateGiftAmountLog
(
GiftAmountLog
giftAmountLog
);
/**
* 批量删除赠送金额日志
*
* @param ids 需要删除的赠送金额日志主键集合
* @return 结果
*/
public
int
deleteGiftAmountLogByIds
(
Long
[]
ids
);
/**
* 删除赠送金额日志信息
*
* @param id 赠送金额日志主键
* @return 结果
*/
public
int
deleteGiftAmountLogById
(
Long
id
);
}
share-system/src/main/java/share/system/service/RechargeAmountLogService.java
0 → 100644
View file @
811b37e3
package
share
.
system
.
service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
share.system.domain.RechargeAmountLog
;
import
share.system.domain.vo.RechargeAmountLogVo
;
import
java.util.List
;
/**
* 充值金额日志Service接口
*
* @author wuwenlong
* @date 2024-10-08
*/
public
interface
RechargeAmountLogService
extends
IService
<
RechargeAmountLog
>
{
/**
* 查询充值金额日志
*
* @param id 充值金额日志主键
* @return 充值金额日志
*/
public
RechargeAmountLog
selectRechargeAmountLogById
(
Long
id
);
/**
* 查询充值金额日志列表
*
* @param rechargeAmountLog 充值金额日志
* @return 充值金额日志集合
*/
public
List
<
RechargeAmountLogVo
>
selectRechargeAmountLogList
(
RechargeAmountLogVo
rechargeAmountLog
);
/**
* 新增充值金额日志
*
* @param rechargeAmountLog 充值金额日志
* @return 结果
*/
public
int
insertRechargeAmountLog
(
RechargeAmountLog
rechargeAmountLog
);
/**
* 修改充值金额日志
*
* @param rechargeAmountLog 充值金额日志
* @return 结果
*/
public
int
updateRechargeAmountLog
(
RechargeAmountLog
rechargeAmountLog
);
/**
* 批量删除充值金额日志
*
* @param ids 需要删除的充值金额日志主键集合
* @return 结果
*/
public
int
deleteRechargeAmountLogByIds
(
Long
[]
ids
);
/**
* 删除充值金额日志信息
*
* @param id 充值金额日志主键
* @return 结果
*/
public
int
deleteRechargeAmountLogById
(
Long
id
);
}
share-system/src/main/java/share/system/service/impl/ConsumerMonthlyCardServiceImpl.java
View file @
811b37e3
...
...
@@ -95,7 +95,7 @@ public class ConsumerMonthlyCardServiceImpl extends ServiceImpl<ConsumerMonthlyC
}
@Override
public
ConsumerMonthlyCardVo
selectByConsumerId
()
{
public
List
<
ConsumerMonthlyCardVo
>
selectByConsumerId
()
{
SConsumer
info
=
sConsumerService
.
getInfo
();
ConsumerMonthlyCardVo
vo
=
new
ConsumerMonthlyCardVo
();
vo
.
setConsumerId
(
info
.
getId
());
...
...
share-system/src/main/java/share/system/service/impl/ConsumerSecondaryCardServiceImpl.java
View file @
811b37e3
package
share
.
system
.
service
.
impl
;
import
cn.hutool.core.util.ObjectUtil
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
share.common.enums.YesNoEnum
;
import
share.common.exception.base.BaseException
;
import
share.common.utils.DateUtils
;
import
share.system.domain.ConsumerSecondaryCard
;
import
share.system.domain.SConsumer
;
import
share.system.domain.SPack
;
import
share.system.domain.vo.ConsumerSecondaryCardVo
;
import
share.system.mapper.ConsumerSecondaryCardMapper
;
import
share.system.service.ConsumerSecondaryCardService
;
import
share.system.service.IPackService
;
import
share.system.service.SConsumerService
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
/**
* 用户次卡Service业务层处理
...
...
@@ -25,6 +33,8 @@ public class ConsumerSecondaryCardServiceImpl extends ServiceImpl<ConsumerSecond
private
ConsumerSecondaryCardMapper
consumerSecondaryCardMapper
;
@Autowired
private
SConsumerService
sConsumerService
;
@Autowired
private
IPackService
packService
;
/**
* 查询用户次卡
...
...
@@ -97,8 +107,32 @@ public class ConsumerSecondaryCardServiceImpl extends ServiceImpl<ConsumerSecond
@Override
public
List
<
ConsumerSecondaryCardVo
>
selectByConsumerId
()
{
SConsumer
info
=
sConsumerService
.
getInfo
();
if
(
ObjectUtil
.
isNull
(
info
))
{
throw
new
BaseException
(
"您的登录已过期,请先登录"
);
}
ConsumerSecondaryCardVo
vo
=
new
ConsumerSecondaryCardVo
();
vo
.
setConsumerId
(
info
.
getId
());
return
consumerSecondaryCardMapper
.
selectByConsumerId
(
vo
);
}
@Override
public
List
<
ConsumerSecondaryCardVo
>
selectByPaclId
(
Long
packId
)
{
SConsumer
info
=
sConsumerService
.
getInfo
();
if
(
ObjectUtil
.
isNull
(
info
))
{
throw
new
BaseException
(
"您的登录已过期,请先登录"
);
}
Map
<
Long
,
SPack
>
packMap
=
packService
.
list
().
stream
().
collect
(
Collectors
.
toMap
(
SPack:
:
getId
,
Function
.
identity
()));
ConsumerSecondaryCardVo
vo
=
new
ConsumerSecondaryCardVo
();
vo
.
setConsumerId
(
info
.
getId
());
List
<
ConsumerSecondaryCardVo
>
consumerSecondaryCardVos
=
consumerSecondaryCardMapper
.
selectByConsumerId
(
vo
);
consumerSecondaryCardVos
.
stream
().
forEach
(
item
->
{
if
(
item
.
getPackId
().
equals
(
packId
))
{
item
.
setIsUse
(
YesNoEnum
.
yes
.
getIndex
());
}
else
{
item
.
setIsUse
(
YesNoEnum
.
no
.
getIndex
());
item
.
setReason
(
"当前次卡适用于"
+
packMap
.
get
(
item
.
getPackId
()).
getName
()
+
"套餐"
+
",不适用于"
+
packMap
.
get
(
packId
).
getName
()
+
"套餐"
);
}
});
return
consumerSecondaryCardVos
;
}
}
share-system/src/main/java/share/system/service/impl/ConsumerWalletServiceImpl.java
View file @
811b37e3
...
...
@@ -59,6 +59,10 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper,
private
ISConsumerCouponService
consumerCouponService
;
@Autowired
private
ISysConfigService
sysConfigService
;
@Autowired
private
RechargeAmountLogService
rechargeAmountLogService
;
@Autowired
private
GiftAmountLogService
giftAmountLogService
;
/**
* 查询会员钱包
...
...
@@ -153,6 +157,26 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper,
balanceLog
.
setCreateTime
(
new
Date
());
balanceLogService
.
save
(
balanceLog
);
}
if
(
consumerWallet
.
getRechargeAmount
().
compareTo
(
new
BigDecimal
(
0
))
>
0
)
{
RechargeAmountLog
rechargeAmountLog
=
new
RechargeAmountLog
();
rechargeAmountLog
.
setConsumerId
(
consumerWallet
.
getConsumerId
());
rechargeAmountLog
.
setCurrentAmount
(
new
BigDecimal
(
0
));
rechargeAmountLog
.
setVariableAmount
(
consumerWallet
.
getRechargeAmount
());
rechargeAmountLog
.
setOperationType
(
YesNoEnum
.
yes
.
getIndex
());
rechargeAmountLog
.
setOperationTime
(
new
Date
());
rechargeAmountLog
.
setCreateTime
(
new
Date
());
rechargeAmountLogService
.
save
(
rechargeAmountLog
);
}
if
(
consumerWallet
.
getGiftAmount
().
compareTo
(
new
BigDecimal
(
0
))
>
0
)
{
GiftAmountLog
giftAmountLog
=
new
GiftAmountLog
();
giftAmountLog
.
setConsumerId
(
consumerWallet
.
getConsumerId
());
giftAmountLog
.
setCurrentAmount
(
new
BigDecimal
(
0
));
giftAmountLog
.
setVariableAmount
(
consumerWallet
.
getGiftAmount
());
giftAmountLog
.
setOperationType
(
YesNoEnum
.
yes
.
getIndex
());
giftAmountLog
.
setOperationTime
(
new
Date
());
giftAmountLog
.
setCreateTime
(
new
Date
());
giftAmountLogService
.
save
(
giftAmountLog
);
}
if
(
consumerWallet
.
getRemainingDuration
().
compareTo
(
new
BigDecimal
(
0
))
>
0
)
{
DurationLog
durationLog
=
new
DurationLog
();
durationLog
.
setConsumerId
(
consumerWallet
.
getConsumerId
());
...
...
@@ -206,6 +230,8 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper,
public
boolean
editConsumerWallet
(
ConsumerWallet
consumerWallet
,
Recharge
recharge
,
ConsumerMember
one
)
{
BigDecimal
divide
=
new
BigDecimal
(
0
);
BigDecimal
oldBalance
=
consumerWallet
.
getBalance
();
BigDecimal
oldRechargeAmount
=
consumerWallet
.
getRechargeAmount
();
BigDecimal
oldGiftAmount
=
consumerWallet
.
getGiftAmount
();
BigDecimal
oldDuration
=
consumerWallet
.
getRemainingDuration
();
BigDecimal
oldIntegral
=
consumerWallet
.
getRemainingIntegral
();
String
rechargeMembershipExpirationTime
=
sysConfigService
.
selectConfigByKey
(
"rechargeMembershipExpirationTime"
);
...
...
@@ -222,8 +248,10 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper,
logger
.
debug
(
"修改会员用户"
);
consumerWallet
.
setBalance
(
consumerWallet
.
getBalance
().
add
(
recharge
.
getRechargeAmount
()));
consumerWallet
.
setRechargeAmount
(
consumerWallet
.
getRechargeAmount
().
add
(
recharge
.
getRechargeAmount
()));
if
(
rechargeConf
.
getGiveType
().
contains
(
GiveTypeEnum
.
AMOUNT
.
getIndex
()))
{
consumerWallet
.
setBalance
(
consumerWallet
.
getBalance
().
add
(
recharge
.
getGiveAmount
()));
consumerWallet
.
setGiftAmount
(
consumerWallet
.
getGiftAmount
().
add
(
recharge
.
getGiveAmount
()));
}
if
(
rechargeConf
.
getGiveType
().
contains
(
GiveTypeEnum
.
DURATION
.
getIndex
()))
{
BigDecimal
duration
=
consumerWallet
.
getRemainingDuration
().
add
(
rechargeConf
.
getGiveDuration
());
...
...
@@ -247,6 +275,28 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper,
balanceLogService
.
save
(
balanceLog
);
logger
.
debug
(
"新增余额日志"
);
}
if
(
consumerWallet
.
getRechargeAmount
().
compareTo
(
new
BigDecimal
(
0
))
>
0
)
{
RechargeAmountLog
rechargeAmountLog
=
new
RechargeAmountLog
();
rechargeAmountLog
.
setConsumerId
(
consumerWallet
.
getConsumerId
());
rechargeAmountLog
.
setCurrentAmount
(
oldRechargeAmount
);
rechargeAmountLog
.
setVariableAmount
(
consumerWallet
.
getRechargeAmount
().
subtract
(
oldRechargeAmount
));
rechargeAmountLog
.
setOperationType
(
YesNoEnum
.
yes
.
getIndex
());
rechargeAmountLog
.
setOperationTime
(
new
Date
());
rechargeAmountLog
.
setCreateTime
(
new
Date
());
rechargeAmountLogService
.
save
(
rechargeAmountLog
);
logger
.
debug
(
"新增充值金额日志"
);
}
if
(
consumerWallet
.
getGiftAmount
().
compareTo
(
new
BigDecimal
(
0
))
>
0
)
{
GiftAmountLog
giftAmountLog
=
new
GiftAmountLog
();
giftAmountLog
.
setConsumerId
(
consumerWallet
.
getConsumerId
());
giftAmountLog
.
setCurrentAmount
(
oldGiftAmount
);
giftAmountLog
.
setVariableAmount
(
consumerWallet
.
getGiftAmount
().
subtract
(
oldGiftAmount
));
giftAmountLog
.
setOperationType
(
YesNoEnum
.
yes
.
getIndex
());
giftAmountLog
.
setOperationTime
(
new
Date
());
giftAmountLog
.
setCreateTime
(
new
Date
());
giftAmountLogService
.
save
(
giftAmountLog
);
logger
.
debug
(
"新增赠送金额日志"
);
}
if
(
consumerWallet
.
getRemainingDuration
().
compareTo
(
new
BigDecimal
(
0
))
>
0
)
{
DurationLog
durationLog
=
new
DurationLog
();
durationLog
.
setConsumerId
(
consumerWallet
.
getConsumerId
());
...
...
share-system/src/main/java/share/system/service/impl/GiftAmountLogServiceImpl.java
0 → 100644
View file @
811b37e3
package
share
.
system
.
service
.
impl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
share.common.utils.DateUtils
;
import
share.system.domain.GiftAmountLog
;
import
share.system.domain.vo.GiftAmountLogVo
;
import
share.system.mapper.GiftAmountLogMapper
;
import
share.system.service.GiftAmountLogService
;
import
java.util.List
;
/**
* 赠送金额日志Service业务层处理
*
* @author wuwenlong
* @date 2024-10-08
*/
@Service
public
class
GiftAmountLogServiceImpl
extends
ServiceImpl
<
GiftAmountLogMapper
,
GiftAmountLog
>
implements
GiftAmountLogService
{
@Autowired
private
GiftAmountLogMapper
giftAmountLogMapper
;
/**
* 查询赠送金额日志
*
* @param id 赠送金额日志主键
* @return 赠送金额日志
*/
@Override
public
GiftAmountLog
selectGiftAmountLogById
(
Long
id
)
{
return
giftAmountLogMapper
.
selectGiftAmountLogById
(
id
);
}
/**
* 查询赠送金额日志列表
*
* @param giftAmountLog 赠送金额日志
* @return 赠送金额日志
*/
@Override
public
List
<
GiftAmountLogVo
>
selectGiftAmountLogList
(
GiftAmountLogVo
giftAmountLog
)
{
return
giftAmountLogMapper
.
selectGiftAmountLogList
(
giftAmountLog
);
}
/**
* 新增赠送金额日志
*
* @param giftAmountLog 赠送金额日志
* @return 结果
*/
@Override
public
int
insertGiftAmountLog
(
GiftAmountLog
giftAmountLog
)
{
giftAmountLog
.
setCreateTime
(
DateUtils
.
getNowDate
());
return
giftAmountLogMapper
.
insertGiftAmountLog
(
giftAmountLog
);
}
/**
* 修改赠送金额日志
*
* @param giftAmountLog 赠送金额日志
* @return 结果
*/
@Override
public
int
updateGiftAmountLog
(
GiftAmountLog
giftAmountLog
)
{
giftAmountLog
.
setUpdateTime
(
DateUtils
.
getNowDate
());
return
giftAmountLogMapper
.
updateGiftAmountLog
(
giftAmountLog
);
}
/**
* 批量删除赠送金额日志
*
* @param ids 需要删除的赠送金额日志主键
* @return 结果
*/
@Override
public
int
deleteGiftAmountLogByIds
(
Long
[]
ids
)
{
return
giftAmountLogMapper
.
deleteGiftAmountLogByIds
(
ids
);
}
/**
* 删除赠送金额日志信息
*
* @param id 赠送金额日志主键
* @return 结果
*/
@Override
public
int
deleteGiftAmountLogById
(
Long
id
)
{
return
giftAmountLogMapper
.
deleteGiftAmountLogById
(
id
);
}
}
share-system/src/main/java/share/system/service/impl/MonthlyCardOrderServiceImpl.java
View file @
811b37e3
package
share
.
system
.
service
.
impl
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.json.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
share.common.core.redis.RedisUtil
;
import
share.common.enums.ReceiptRdeisEnum
;
import
share.common.enums.YesNoEnum
;
import
share.common.exception.base.BaseException
;
import
share.common.utils.BaseUtil
;
...
...
@@ -24,7 +27,9 @@ import share.system.response.MonthlyyCardPayResultResponse;
import
share.system.service.*
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* 月卡订单Service业务层处理
...
...
@@ -44,6 +49,8 @@ public class MonthlyCardOrderServiceImpl extends ServiceImpl<MonthlyCardOrderMap
private
MonthlyCardConfService
monthlyCardConfService
;
@Autowired
private
ConsumerMonthlyCardService
consumerMonthlyCardService
;
@Autowired
private
RedisUtil
redisUtil
;
/**
* 查询月卡订单
...
...
@@ -170,6 +177,18 @@ public class MonthlyCardOrderServiceImpl extends ServiceImpl<MonthlyCardOrderMap
consumerMonthlyCard
.
setMonthlyCardDays
(
byId
.
getMonthlyCardDays
());
consumerMonthlyCard
.
setCreateTime
(
new
Date
());
consumerMonthlyCardService
.
save
(
consumerMonthlyCard
);
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"consumerMonthlyCardId"
,
String
.
valueOf
(
consumerMonthlyCard
.
getId
()));
map
.
put
(
"expirationTime"
,
consumerMonthlyCard
.
getExpirationDate
().
toString
());
JSONObject
jsonObject
=
new
JSONObject
(
map
);
new
Thread
(()
->
{
try
{
Thread
.
sleep
(
1000
);
redisUtil
.
set
(
ReceiptRdeisEnum
.
MONTHLY_CARD
.
getValue
()
+
consumerMonthlyCard
.
getId
(),
jsonObject
.
toString
());
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
}).
start
();
}
@Override
...
...
share-system/src/main/java/share/system/service/impl/RechargeAmountLogServiceImpl.java
0 → 100644
View file @
811b37e3
package
share
.
system
.
service
.
impl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
share.common.utils.DateUtils
;
import
share.system.domain.RechargeAmountLog
;
import
share.system.domain.vo.RechargeAmountLogVo
;
import
share.system.mapper.RechargeAmountLogMapper
;
import
share.system.service.RechargeAmountLogService
;
import
java.util.List
;
/**
* 充值金额日志Service业务层处理
*
* @author wuwenlong
* @date 2024-10-08
*/
@Service
public
class
RechargeAmountLogServiceImpl
extends
ServiceImpl
<
RechargeAmountLogMapper
,
RechargeAmountLog
>
implements
RechargeAmountLogService
{
@Autowired
private
RechargeAmountLogMapper
rechargeAmountLogMapper
;
/**
* 查询充值金额日志
*
* @param id 充值金额日志主键
* @return 充值金额日志
*/
@Override
public
RechargeAmountLog
selectRechargeAmountLogById
(
Long
id
)
{
return
rechargeAmountLogMapper
.
selectRechargeAmountLogById
(
id
);
}
/**
* 查询充值金额日志列表
*
* @param rechargeAmountLog 充值金额日志
* @return 充值金额日志
*/
@Override
public
List
<
RechargeAmountLogVo
>
selectRechargeAmountLogList
(
RechargeAmountLogVo
rechargeAmountLog
)
{
return
rechargeAmountLogMapper
.
selectRechargeAmountLogList
(
rechargeAmountLog
);
}
/**
* 新增充值金额日志
*
* @param rechargeAmountLog 充值金额日志
* @return 结果
*/
@Override
public
int
insertRechargeAmountLog
(
RechargeAmountLog
rechargeAmountLog
)
{
rechargeAmountLog
.
setCreateTime
(
DateUtils
.
getNowDate
());
return
rechargeAmountLogMapper
.
insertRechargeAmountLog
(
rechargeAmountLog
);
}
/**
* 修改充值金额日志
*
* @param rechargeAmountLog 充值金额日志
* @return 结果
*/
@Override
public
int
updateRechargeAmountLog
(
RechargeAmountLog
rechargeAmountLog
)
{
rechargeAmountLog
.
setUpdateTime
(
DateUtils
.
getNowDate
());
return
rechargeAmountLogMapper
.
updateRechargeAmountLog
(
rechargeAmountLog
);
}
/**
* 批量删除充值金额日志
*
* @param ids 需要删除的充值金额日志主键
* @return 结果
*/
@Override
public
int
deleteRechargeAmountLogByIds
(
Long
[]
ids
)
{
return
rechargeAmountLogMapper
.
deleteRechargeAmountLogByIds
(
ids
);
}
/**
* 删除充值金额日志信息
*
* @param id 充值金额日志主键
* @return 结果
*/
@Override
public
int
deleteRechargeAmountLogById
(
Long
id
)
{
return
rechargeAmountLogMapper
.
deleteRechargeAmountLogById
(
id
);
}
}
share-system/src/main/java/share/system/service/impl/RechargeServiceImpl.java
View file @
811b37e3
...
...
@@ -223,9 +223,11 @@ public class RechargeServiceImpl extends ServiceImpl<RechargeMapper, Recharge> i
ConsumerWallet
consumerWallet
=
new
ConsumerWallet
();
consumerWallet
.
setConsumerId
(
recharge
.
getConsumerId
());
consumerWallet
.
setBalance
(
recharge
.
getRechargeAmount
());
consumerWallet
.
setRechargeAmount
(
recharge
.
getRechargeAmount
());
if
(
rechargeConf
.
getGiveType
().
contains
(
GiveTypeEnum
.
AMOUNT
.
getIndex
()))
{
BigDecimal
balance
=
recharge
.
getRechargeAmount
().
add
(
rechargeConf
.
getGiveAmount
());
consumerWallet
.
setBalance
(
balance
);
consumerWallet
.
setGiftAmount
(
rechargeConf
.
getGiveAmount
());
}
if
(
rechargeConf
.
getGiveType
().
contains
(
GiveTypeEnum
.
DURATION
.
getIndex
()))
{
consumerWallet
.
setRemainingDuration
(
rechargeConf
.
getGiveDuration
());
...
...
share-system/src/main/java/share/system/service/impl/SConsumerServiceImpl.java
View file @
811b37e3
...
...
@@ -25,7 +25,6 @@ import share.common.utils.DateUtils;
import
share.common.utils.StringUtils
;
import
share.system.domain.*
;
import
share.system.domain.vo.*
;
import
share.system.mapper.ConsumerMemberMapper
;
import
share.system.mapper.SConsumerMapper
;
import
share.system.mapper.SStoreConsumerMapper
;
import
share.system.request.RegisterThirdSConsumerRequest
;
...
...
@@ -63,6 +62,10 @@ public class SConsumerServiceImpl extends ServiceImpl<SConsumerMapper, SConsumer
private
MemberConfigService
memberConfigService
;
@Autowired
private
MemberProgressLogService
memberProgressLogService
;
@Autowired
private
ConsumerSecondaryCardService
consumerSecondaryCardService
;
@Autowired
private
ConsumerMonthlyCardService
consumerMonthlyCardService
;
@Autowired
...
...
@@ -214,6 +217,8 @@ public class SConsumerServiceImpl extends ServiceImpl<SConsumerMapper, SConsumer
BeanUtils
.
copyProperties
(
currentUser
,
vo
);
ConsumerMember
consumerMember
=
consumerMemberService
.
getOne
(
new
LambdaQueryWrapper
<
ConsumerMember
>().
eq
(
ConsumerMember:
:
getConsumerId
,
currentUser
.
getId
()));
ConsumerWallet
consumerWallet
=
consumerWalletService
.
getOne
(
new
LambdaQueryWrapper
<
ConsumerWallet
>().
eq
(
ConsumerWallet:
:
getConsumerId
,
currentUser
.
getId
()));
List
<
ConsumerSecondaryCardVo
>
consumerSecondaryCardVos
=
consumerSecondaryCardService
.
selectByConsumerId
();
List
<
ConsumerMonthlyCardVo
>
consumerMonthlyCardVo
=
consumerMonthlyCardService
.
selectByConsumerId
();
if
(
ObjectUtil
.
isNotEmpty
(
consumerMember
))
{
vo
.
setConsumerMember
(
consumerMember
);
MemberConfig
memberConfig
=
memberConfigService
.
getOne
(
new
LambdaQueryWrapper
<
MemberConfig
>().
eq
(
MemberConfig:
:
getMembershipLevel
,
consumerMember
.
getMembershipLevel
()));
...
...
@@ -277,9 +282,12 @@ public class SConsumerServiceImpl extends ServiceImpl<SConsumerMapper, SConsumer
}
else
{
vo
.
setIsManage
(
true
);
}
if
(!
CollectionUtils
.
isEmpty
(
consumerSecondaryCardVos
))
{
vo
.
setSecondaryCardList
(
consumerSecondaryCardVos
);
}
if
(!
CollectionUtils
.
isEmpty
(
consumerMonthlyCardVo
))
{
vo
.
setMonthlyCardList
(
consumerMonthlyCardVo
);
}
return
vo
;
}
...
...
@@ -350,10 +358,10 @@ public class SConsumerServiceImpl extends ServiceImpl<SConsumerMapper, SConsumer
@Override
public
TableDataInfo
selectConsumernotById
(
SConsumerVo
sConsumer
)
{
List
<
ConsumerMember
>
consumerMembers
=
consumerMemberService
List
<
ConsumerMember
>
consumerMembers
=
consumerMemberService
.
list
(
new
LambdaQueryWrapper
<
ConsumerMember
>()
.
eq
(
ConsumerMember:
:
getIsRights
,
YesNoEnum
.
yes
.
getIndex
())
.
ne
(
ConsumerMember:
:
getConsumerId
,
sConsumer
.
getNewId
()));
.
eq
(
ConsumerMember:
:
getIsRights
,
YesNoEnum
.
yes
.
getIndex
())
.
ne
(
ConsumerMember:
:
getConsumerId
,
sConsumer
.
getNewId
()));
List
<
Long
>
collect
=
consumerMembers
.
stream
().
map
(
ConsumerMember:
:
getConsumerId
).
collect
(
Collectors
.
toList
());
LambdaQueryWrapper
<
SConsumer
>
uSConsumer
=
new
LambdaQueryWrapper
<
SConsumer
>();
if
(
StringUtils
.
isNotEmpty
(
sConsumer
.
getPhone
())){
...
...
share-system/src/main/java/share/system/service/impl/SOrderServiceImpl.java
View file @
811b37e3
...
...
@@ -172,6 +172,14 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
@Autowired
private
RechargeService
rechargeService
;
@Autowired
private
ConsumerMonthlyCardService
consumerMonthlyCardService
;
@Autowired
private
MonthlyCardLogService
monthlyCardLogService
;
@Autowired
private
ConsumerSecondaryCardService
consumerSecondaryCardService
;
@Autowired
private
SecondaryCardLogService
secondaryCardLogService
;
@Autowired
private
SharingActivitiesService
sharingActivitiesService
;
...
...
@@ -436,6 +444,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
SOrder
sOrder
=
getInfoException
(
request
.
getOrderNo
());
ConsumerWallet
consumerWallet
=
consumerWalletService
.
getOne
(
new
LambdaQueryWrapper
<
ConsumerWallet
>().
eq
(
ConsumerWallet:
:
getConsumerId
,
sOrder
.
getConsumerId
()));
ConsumerMember
consumerMember
=
consumerMemberService
.
getOne
(
new
LambdaQueryWrapper
<
ConsumerMember
>().
eq
(
ConsumerMember:
:
getConsumerId
,
sOrder
.
getConsumerId
()));
ConsumerMonthlyCard
consumerMonthlyCard
=
consumerMonthlyCardService
.
getById
(
sOrder
.
getMonthlyCardId
());
ConsumerSecondaryCard
consumerSecondaryCard
=
consumerSecondaryCardService
.
getById
(
sOrder
.
getSecondaryCardId
());
SOrder
oldSOrder
=
new
SOrder
();
BeanUtils
.
copyProperties
(
sOrder
,
oldSOrder
);
if
(
ObjectUtils
.
isEmpty
(
sOrder
))
{
...
...
@@ -511,7 +521,11 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
//退款
if
(
sOrder
.
getPayType
().
equals
(
PayTypeEnum
.
WECHAT
.
getCode
()))
{
try
{
refundExtracted
(
consumerWallet
,
sOrder
,
consumerMember
);
if
(!
ObjectUtils
.
isEmpty
(
sOrder
.
getMonthlyCardId
())
||
!
ObjectUtils
.
isEmpty
(
sOrder
.
getSecondaryCardId
()))
{
refundExtracted
(
consumerMonthlyCard
,
sOrder
,
consumerSecondaryCard
);
}
else
{
refundExtracted
(
consumerWallet
,
sOrder
,
consumerMember
);
}
orderRefundService
.
refundOp
(
request
,
sOrder
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
...
...
@@ -519,7 +533,11 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
}
}
}
else
{
refundExtracted
(
consumerWallet
,
sOrder
,
consumerMember
);
if
(!
ObjectUtils
.
isEmpty
(
sOrder
.
getMonthlyCardId
())
||
!
ObjectUtils
.
isEmpty
(
sOrder
.
getSecondaryCardId
()))
{
refundExtracted
(
consumerMonthlyCard
,
sOrder
,
consumerSecondaryCard
);
}
else
{
refundExtracted
(
consumerWallet
,
sOrder
,
consumerMember
);
}
sOrder
.
setStatus
(
OrderStatusEnum
.
CANCEL
.
getCode
());
sOrder
.
setRefundStatus
(
RefundStatusEnum
.
REFUNDED
.
getCode
());
sOrder
.
setRefundReasonTime
(
cn
.
hutool
.
core
.
date
.
DateUtil
.
date
());
...
...
@@ -903,6 +921,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
}
ConsumerWallet
consumerWallet
=
consumerWalletService
.
getOne
(
new
LambdaQueryWrapper
<
ConsumerWallet
>().
eq
(
ConsumerWallet:
:
getConsumerId
,
user
.
getId
()));
ConsumerMember
consumerMember
=
consumerMemberService
.
getOne
(
new
LambdaQueryWrapper
<
ConsumerMember
>().
eq
(
ConsumerMember:
:
getConsumerId
,
user
.
getId
()));
ConsumerMonthlyCard
consumerMonthlyCard
=
consumerMonthlyCardService
.
getById
(
request
.
getMonthlyCardId
());
ConsumerSecondaryCard
consumerSecondaryCard
=
consumerSecondaryCardService
.
getById
(
request
.
getSecondaryCardId
());
List
<
SStore
>
stores
=
storeService
.
list
();
SRoom
room
=
roomService
.
getById
(
request
.
getRoomId
());
SStore
sStore
=
storeService
.
getById
(
request
.
getStoreId
());
...
...
@@ -959,7 +979,12 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
response
.
setOrderNo
(
sOrder
.
getOrderNo
());
sOrder
.
setPayStatus
(
YesNoEnum
.
yes
.
getIndex
());
sOrder
.
setPayTime
(
DateUtils
.
getNowDate
());
creatExtracted
(
consumerWallet
,
sOrder
,
consumerMember
);
if
(
ObjectUtils
.
isEmpty
(
request
.
getMonthlyCardId
())
&&
ObjectUtils
.
isEmpty
(
request
.
getSecondaryCardId
()))
{
creatExtracted
(
consumerWallet
,
sOrder
,
consumerMember
);
}
else
{
creatExtracted
(
consumerMonthlyCard
,
sOrder
,
consumerSecondaryCard
);
}
}
else
{
// response = orderPayService.payment(sOrder);
// 扫呗聚合支付
...
...
@@ -1110,14 +1135,38 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
}
if
(
ObjectUtil
.
isNotEmpty
(
sOrder
.
getBalance
())
&&
sOrder
.
getBalance
().
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
BalanceLog
balanceLog
=
new
BalanceLog
();
RechargeAmountLog
rechargeAmountLog
=
new
RechargeAmountLog
();
GiftAmountLog
giftAmountLog
=
new
GiftAmountLog
();
balanceLog
.
setConsumerId
(
sOrder
.
getConsumerId
());
balanceLog
.
setVariableAmount
(
sOrder
.
getBalance
());
rechargeAmountLog
.
setConsumerId
(
sOrder
.
getConsumerId
());
giftAmountLog
.
setConsumerId
(
sOrder
.
getConsumerId
());
balanceLog
.
setCurrentBalance
(
consumerWallet
.
getBalance
());
rechargeAmountLog
.
setCurrentAmount
(
consumerWallet
.
getRechargeAmount
());
giftAmountLog
.
setCurrentAmount
(
consumerWallet
.
getGiftAmount
());
balanceLog
.
setVariableAmount
(
sOrder
.
getBalance
());
balanceLog
.
setOperationType
(
YesNoEnum
.
no
.
getIndex
());
rechargeAmountLog
.
setOperationType
(
YesNoEnum
.
no
.
getIndex
());
giftAmountLog
.
setOperationType
(
YesNoEnum
.
no
.
getIndex
());
balanceLog
.
setOperationTime
(
new
Date
());
rechargeAmountLog
.
setOperationTime
(
new
Date
());
giftAmountLog
.
setOperationTime
(
new
Date
());
balanceLog
.
setCreateTime
(
new
Date
());
balanceLogService
.
save
(
balanceLog
);
rechargeAmountLog
.
setCreateTime
(
new
Date
());
giftAmountLog
.
setCreateTime
(
new
Date
());
//计算充值金额和余额的比例
BigDecimal
divide
=
consumerWallet
.
getRechargeAmount
().
divide
(
consumerWallet
.
getBalance
(),
2
,
RoundingMode
.
HALF_UP
);
//余额乘充值金额比例
BigDecimal
oldRechargeAmount
=
consumerWallet
.
getBalance
().
multiply
(
divide
);
BigDecimal
oldGiftAmount
=
consumerWallet
.
getBalance
().
subtract
(
oldRechargeAmount
);
rechargeAmountLog
.
setVariableAmount
(
oldRechargeAmount
);
giftAmountLog
.
setVariableAmount
(
oldGiftAmount
);
consumerWallet
.
setBalance
(
consumerWallet
.
getBalance
().
subtract
(
sOrder
.
getBalance
()));
consumerWallet
.
setRechargeAmount
(
consumerWallet
.
getRechargeAmount
().
subtract
(
oldRechargeAmount
));
consumerWallet
.
setGiftAmount
(
consumerWallet
.
getGiftAmount
().
subtract
(
oldGiftAmount
));
sOrder
.
setRechargeAmount
(
oldRechargeAmount
);
sOrder
.
setGiftAmount
(
oldGiftAmount
);
balanceLogService
.
save
(
balanceLog
);
consumerWalletService
.
updateById
(
consumerWallet
);
}
}
...
...
@@ -1245,6 +1294,42 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
}
}
private
void
creatExtracted
(
ConsumerMonthlyCard
consumerMonthlyCard
,
SOrder
sOrder
,
ConsumerSecondaryCard
consumerSecondaryCard
)
{
if
(!
ObjectUtils
.
isEmpty
(
sOrder
.
getMonthlyCardId
())
&&
!
ObjectUtils
.
isEmpty
(
sOrder
.
getDuration
()))
{
if
(
consumerMonthlyCard
.
getFreeDuration
().
compareTo
(
sOrder
.
getDuration
())
>=
0
)
{
consumerMonthlyCard
.
setFreeDuration
(
consumerMonthlyCard
.
getFreeDuration
().
subtract
(
sOrder
.
getDuration
()));
MonthlyCardLog
monthlyCardLog
=
new
MonthlyCardLog
();
monthlyCardLog
.
setConsumerMonthlyCardId
(
sOrder
.
getMonthlyCardId
());
monthlyCardLog
.
setConsumerId
(
consumerMonthlyCard
.
getConsumerId
());
monthlyCardLog
.
setPhone
(
sOrder
.
getConsumerPhone
());
monthlyCardLog
.
setUseDuration
(
sOrder
.
getDuration
());
monthlyCardLog
.
setResidueDuration
(
consumerMonthlyCard
.
getFreeDuration
());
monthlyCardLog
.
setOperationType
(
YesNoEnum
.
no
.
getIndex
());
monthlyCardLog
.
setOperationTime
(
new
Date
());
monthlyCardLog
.
setCreateTime
(
new
Date
());
consumerMonthlyCardService
.
updateById
(
consumerMonthlyCard
);
monthlyCardLogService
.
save
(
monthlyCardLog
);
}
}
if
(!
ObjectUtils
.
isEmpty
(
sOrder
.
getSecondaryCardId
())
&&
!
ObjectUtils
.
isEmpty
(
sOrder
.
getPackId
()))
{
if
(
sOrder
.
getPackId
().
equals
(
consumerSecondaryCard
.
getPackId
()))
{
consumerSecondaryCard
.
setNumber
(
consumerSecondaryCard
.
getNumber
()
-
1
);
SecondaryCardLog
secondaryCardLog
=
new
SecondaryCardLog
();
secondaryCardLog
.
setConsumerSecondaryCardId
(
sOrder
.
getSecondaryCardId
());
secondaryCardLog
.
setConsumerId
(
consumerSecondaryCard
.
getConsumerId
());
secondaryCardLog
.
setPhone
(
sOrder
.
getConsumerPhone
());
secondaryCardLog
.
setPackId
(
sOrder
.
getPackId
());
secondaryCardLog
.
setUsageCount
(
1L
);
secondaryCardLog
.
setResidueCount
(
Long
.
valueOf
(
consumerSecondaryCard
.
getNumber
()));
secondaryCardLog
.
setOperationType
(
YesNoEnum
.
no
.
getIndex
());
secondaryCardLog
.
setOperationTime
(
new
Date
());
secondaryCardLog
.
setCreateTime
(
new
Date
());
consumerSecondaryCardService
.
updateById
(
consumerSecondaryCard
);
secondaryCardLogService
.
save
(
secondaryCardLog
);
}
}
}
private
void
refundExtracted
(
ConsumerWallet
consumerWallet
,
SOrder
sOrder
,
ConsumerMember
consumerMember
)
{
if
(
ObjectUtil
.
isNotEmpty
(
consumerWallet
))
{
if
(
ObjectUtil
.
isNotEmpty
(
sOrder
.
getDuration
())
&&
sOrder
.
getDuration
().
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
...
...
@@ -1262,14 +1347,30 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
}
if
(
ObjectUtil
.
isNotEmpty
(
sOrder
.
getBalance
())
&&
sOrder
.
getBalance
().
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
BalanceLog
balanceLog
=
new
BalanceLog
();
RechargeAmountLog
rechargeAmountLog
=
new
RechargeAmountLog
();
GiftAmountLog
giftAmountLog
=
new
GiftAmountLog
();
balanceLog
.
setConsumerId
(
sOrder
.
getConsumerId
());
balanceLog
.
setVariableAmount
(
sOrder
.
getBalance
());
rechargeAmountLog
.
setConsumerId
(
sOrder
.
getConsumerId
());
giftAmountLog
.
setConsumerId
(
sOrder
.
getConsumerId
());
balanceLog
.
setCurrentBalance
(
consumerWallet
.
getBalance
());
rechargeAmountLog
.
setCurrentAmount
(
consumerWallet
.
getRechargeAmount
());
giftAmountLog
.
setCurrentAmount
(
consumerWallet
.
getGiftAmount
());
balanceLog
.
setVariableAmount
(
sOrder
.
getBalance
());
rechargeAmountLog
.
setVariableAmount
(
sOrder
.
getRechargeAmount
());
giftAmountLog
.
setVariableAmount
(
sOrder
.
getGiftAmount
());
balanceLog
.
setOperationType
(
YesNoEnum
.
yes
.
getIndex
());
rechargeAmountLog
.
setOperationType
(
YesNoEnum
.
yes
.
getIndex
());
giftAmountLog
.
setOperationType
(
YesNoEnum
.
yes
.
getIndex
());
balanceLog
.
setOperationTime
(
new
Date
());
rechargeAmountLog
.
setOperationTime
(
new
Date
());
giftAmountLog
.
setOperationTime
(
new
Date
());
balanceLog
.
setCreateTime
(
new
Date
());
balanceLogService
.
save
(
balanceLog
);
rechargeAmountLog
.
setCreateTime
(
new
Date
());
giftAmountLog
.
setCreateTime
(
new
Date
());
consumerWallet
.
setBalance
(
consumerWallet
.
getBalance
().
add
(
sOrder
.
getBalance
()));
consumerWallet
.
setRechargeAmount
(
consumerWallet
.
getRechargeAmount
().
add
(
sOrder
.
getRechargeAmount
()));
consumerWallet
.
setGiftAmount
(
consumerWallet
.
getGiftAmount
().
add
(
sOrder
.
getGiftAmount
()));
balanceLogService
.
save
(
balanceLog
);
consumerWalletService
.
updateById
(
consumerWallet
);
}
}
...
...
@@ -1438,6 +1539,40 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
// }
}
private
void
refundExtracted
(
ConsumerMonthlyCard
consumerMonthlyCard
,
SOrder
sOrder
,
ConsumerSecondaryCard
consumerSecondaryCard
)
{
if
(!
ObjectUtils
.
isEmpty
(
sOrder
.
getMonthlyCardId
())
&&
!
ObjectUtils
.
isEmpty
(
sOrder
.
getDuration
()))
{
consumerMonthlyCard
.
setFreeDuration
(
consumerMonthlyCard
.
getFreeDuration
().
add
(
sOrder
.
getDuration
()));
MonthlyCardLog
monthlyCardLog
=
new
MonthlyCardLog
();
monthlyCardLog
.
setConsumerMonthlyCardId
(
sOrder
.
getMonthlyCardId
());
monthlyCardLog
.
setConsumerId
(
consumerMonthlyCard
.
getConsumerId
());
monthlyCardLog
.
setPhone
(
sOrder
.
getConsumerPhone
());
monthlyCardLog
.
setUseDuration
(
sOrder
.
getDuration
());
monthlyCardLog
.
setResidueDuration
(
consumerMonthlyCard
.
getFreeDuration
());
monthlyCardLog
.
setOperationType
(
YesNoEnum
.
yes
.
getIndex
());
monthlyCardLog
.
setOperationTime
(
new
Date
());
monthlyCardLog
.
setCreateTime
(
new
Date
());
consumerMonthlyCardService
.
updateById
(
consumerMonthlyCard
);
monthlyCardLogService
.
save
(
monthlyCardLog
);
}
if
(!
ObjectUtils
.
isEmpty
(
sOrder
.
getSecondaryCardId
())
&&
!
ObjectUtils
.
isEmpty
(
sOrder
.
getPackId
()))
{
if
(
sOrder
.
getPackId
().
equals
(
consumerSecondaryCard
.
getPackId
()))
{
consumerSecondaryCard
.
setNumber
(
consumerSecondaryCard
.
getNumber
()
+
1
);
SecondaryCardLog
secondaryCardLog
=
new
SecondaryCardLog
();
secondaryCardLog
.
setConsumerSecondaryCardId
(
sOrder
.
getSecondaryCardId
());
secondaryCardLog
.
setConsumerId
(
consumerSecondaryCard
.
getConsumerId
());
secondaryCardLog
.
setPhone
(
sOrder
.
getConsumerPhone
());
secondaryCardLog
.
setPackId
(
sOrder
.
getPackId
());
secondaryCardLog
.
setUsageCount
(
1L
);
secondaryCardLog
.
setResidueCount
(
Long
.
valueOf
(
consumerSecondaryCard
.
getNumber
()));
secondaryCardLog
.
setOperationType
(
YesNoEnum
.
yes
.
getIndex
());
secondaryCardLog
.
setOperationTime
(
new
Date
());
secondaryCardLog
.
setCreateTime
(
new
Date
());
consumerSecondaryCardService
.
updateById
(
consumerSecondaryCard
);
secondaryCardLogService
.
save
(
secondaryCardLog
);
}
}
}
private
String
lockOrder
(
CreateOrderRequest
request
)
throws
BaseException
{
try
{
//自旋10次,每次等待1秒
...
...
@@ -1927,6 +2062,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
ConsumerWallet
consumerWallet
=
consumerWalletService
.
getOne
(
new
LambdaQueryWrapper
<
ConsumerWallet
>().
eq
(
ConsumerWallet:
:
getConsumerId
,
sOrder
.
getConsumerId
()));
ConsumerMember
consumerMember
=
consumerMemberService
.
getOne
(
new
LambdaQueryWrapper
<
ConsumerMember
>().
eq
(
ConsumerMember:
:
getConsumerId
,
sOrder
.
getConsumerId
()));
ConsumerMonthlyCard
consumerMonthlyCard
=
consumerMonthlyCardService
.
getById
(
sOrder
.
getMonthlyCardId
());
ConsumerSecondaryCard
consumerSecondaryCard
=
consumerSecondaryCardService
.
getById
(
sOrder
.
getSecondaryCardId
());
logger
.
debug
(
"订单查询预约时间是否干涉"
);
LambdaQueryWrapper
<
SOrder
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
ne
(
SOrder:
:
getOrderNo
,
sOrder
.
getOrderNo
());
...
...
@@ -1986,7 +2123,11 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
deviceOpService
.
openOrCloseDevice
(
sOrder
.
getRoomId
(),
sOrder
.
getConsumerPhone
(),
OpTypeEnum
.
CUT_ELECTRIC
.
getCode
(),
true
,
5
,
DeviceOpSourceEnum
.
DEVICE_SOURCE_20
.
getCode
());
}
refundExtracted
(
consumerWallet
,
sOrder
,
consumerMember
);
if
(!
ObjectUtils
.
isEmpty
(
sOrder
.
getMonthlyCardId
())
||
!
ObjectUtils
.
isEmpty
(
sOrder
.
getSecondaryCardId
()))
{
refundExtracted
(
consumerMonthlyCard
,
sOrder
,
consumerSecondaryCard
);
}
else
{
refundExtracted
(
consumerWallet
,
sOrder
,
consumerMember
);
}
}
}
else
{
...
...
@@ -2017,7 +2158,11 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
if
(
sOrder
.
getIsDelete
().
equals
(
YesNoEnum
.
yes
.
getIndex
())
&&
sOrder
.
getPayStatus
().
equals
(
YesNoEnum
.
yes
.
getIndex
()))
{
sOrder
.
setIsDelete
(
YesNoEnum
.
no
.
getIndex
());
}
creatExtracted
(
consumerWallet
,
sOrder
,
consumerMember
);
if
(!
ObjectUtils
.
isEmpty
(
sOrder
.
getMonthlyCardId
())
||
!
ObjectUtils
.
isEmpty
(
sOrder
.
getSecondaryCardId
()))
{
creatExtracted
(
consumerMonthlyCard
,
sOrder
,
consumerSecondaryCard
);
}
else
{
creatExtracted
(
consumerWallet
,
sOrder
,
consumerMember
);
}
baseMapper
.
updateSOrder
(
sOrder
);
unLockOrder
(
sOrder
.
getRoomId
());
if
(
sOrder
.
getOrderType
().
equals
(
OrderTypeEnum
.
RENEW
.
getCode
()))
{
...
...
@@ -2125,6 +2270,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
SOrder
sOrder
=
getInfoException
(
request
.
getOrderNo
());
ConsumerWallet
consumerWallet
=
consumerWalletService
.
getOne
(
new
LambdaQueryWrapper
<
ConsumerWallet
>().
eq
(
ConsumerWallet:
:
getConsumerId
,
sOrder
.
getConsumerId
()));
ConsumerMember
consumerMember
=
consumerMemberService
.
getOne
(
new
LambdaQueryWrapper
<
ConsumerMember
>().
eq
(
ConsumerMember:
:
getConsumerId
,
sOrder
.
getConsumerId
()));
ConsumerMonthlyCard
consumerMonthlyCard
=
consumerMonthlyCardService
.
getById
(
sOrder
.
getMonthlyCardId
());
ConsumerSecondaryCard
consumerSecondaryCard
=
consumerSecondaryCardService
.
getById
(
sOrder
.
getSecondaryCardId
());
if
(!
YesNoEnum
.
yes
.
getIndex
().
equals
(
sOrder
.
getPayStatus
()))
{
throw
new
BaseException
(
"未支付无法退款"
);
}
...
...
@@ -2170,7 +2317,11 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
deviceOpService
.
openOrCloseDevice
(
sOrder
.
getRoomId
(),
sOrder
.
getConsumerPhone
(),
OpTypeEnum
.
CUT_ELECTRIC
.
getCode
(),
true
,
5
,
DeviceOpSourceEnum
.
DEVICE_SOURCE_20
.
getCode
());
}
refundExtracted
(
consumerWallet
,
sOrder
,
consumerMember
);
if
(!
ObjectUtils
.
isEmpty
(
sOrder
.
getMonthlyCardId
())
||
!
ObjectUtils
.
isEmpty
(
sOrder
.
getSecondaryCardId
()))
{
refundExtracted
(
consumerMonthlyCard
,
sOrder
,
consumerSecondaryCard
);
}
else
{
refundExtracted
(
consumerWallet
,
sOrder
,
consumerMember
);
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
...
...
@@ -2197,7 +2348,11 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
try
{
sOrder
.
setRefundReason
(
request
.
getRefundReason
());
updateById
(
sOrder
);
refundExtracted
(
consumerWallet
,
sOrder
,
consumerMember
);
if
(!
ObjectUtils
.
isEmpty
(
sOrder
.
getMonthlyCardId
())
||
!
ObjectUtils
.
isEmpty
(
sOrder
.
getSecondaryCardId
()))
{
refundExtracted
(
consumerMonthlyCard
,
sOrder
,
consumerSecondaryCard
);
}
else
{
refundExtracted
(
consumerWallet
,
sOrder
,
consumerMember
);
}
//微信退款
// if (sOrder.getPayType().equals(PayTypeEnum.WECHAT.getCode()) && request.getAmount().compareTo(BigDecimal.ZERO) == 0) {
// 退款task, 定时任务退优惠券
...
...
@@ -2480,10 +2635,16 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
Activity
activity
=
null
;
ConsumerMember
consumerMember
=
null
;
ConsumerWallet
consumerWallet
=
null
;
ConsumerMonthlyCard
consumerMonthlyCard
=
null
;
List
<
ConsumerSecondaryCard
>
consumerSecondaryCardList
=
null
;
LambdaQueryWrapper
<
Activity
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
if
(
ObjectUtil
.
isNotEmpty
(
user
))
{
consumerWallet
=
consumerWalletService
.
getOne
(
new
LambdaQueryWrapper
<
ConsumerWallet
>().
eq
(
ConsumerWallet:
:
getConsumerId
,
user
.
getId
()));
consumerMember
=
consumerMemberService
.
getOne
(
new
LambdaQueryWrapper
<
ConsumerMember
>().
eq
(
ConsumerMember:
:
getConsumerId
,
user
.
getId
()));
consumerMonthlyCard
=
consumerMonthlyCardService
.
getOne
(
new
LambdaQueryWrapper
<
ConsumerMonthlyCard
>().
eq
(
ConsumerMonthlyCard:
:
getConsumerId
,
user
.
getId
()));
consumerSecondaryCardList
=
consumerSecondaryCardService
.
list
(
new
LambdaQueryWrapper
<
ConsumerSecondaryCard
>().
eq
(
ConsumerSecondaryCard:
:
getConsumerId
,
user
.
getId
())
.
ne
(
ConsumerSecondaryCard:
:
getNumber
,
YesNoEnum
.
no
.
getIndex
())
);
if
(
ObjectUtil
.
isNotEmpty
(
consumerMember
))
{
queryWrapper
.
eq
(
Activity:
:
getIsOpen
,
YesNoEnum
.
yes
.
getIndex
());
// if (consumerMember.getIsRights().equals(YesNoEnum.yes.getIndex())) {
...
...
@@ -2532,6 +2693,9 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
priceResponse
.
setDiscountRatio
(
priceResponse
.
getDiscount
());
totalFee
=
getBigDecimal
(
consumerWallet
,
activity
,
timeLong
,
priceResponse
,
totalFee
,
room
,
request
,
consumerMember
);
}
if
(
ObjectUtil
.
isNotEmpty
(
consumerMonthlyCard
))
{
totalFee
=
getBigDecimal
(
consumerMonthlyCard
,
timeLong
,
priceResponse
,
totalPrice
,
room
);
}
}
else
{
SPack
byId
=
packService
.
getById
(
roomLabel
.
getPackId
());
if
(!
ObjectUtils
.
isEmpty
(
byId
)
&&
byId
.
getIsOpen
().
equals
(
YesNoEnum
.
yes
.
getIndex
()))
{
...
...
@@ -2549,6 +2713,12 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
priceResponse
.
setDiscountRatio
(
priceResponse
.
getDiscount
());
totalFee
=
getBigDecimal
(
consumerWallet
,
activity
,
timeLong
,
priceResponse
,
totalFee
,
byId
,
request
);
}
if
(
CollectionUtils
.
isNotEmpty
(
consumerSecondaryCardList
))
{
totalFee
=
getBigDecimal
(
consumerSecondaryCardList
,
priceResponse
,
byId
,
payPrice
);
}
// if(ObjectUtil.isNotEmpty(consumerMonthlyCard)){
// totalFee = getBigDecimal(consumerMonthlyCard,timeLong,priceResponse,totalFee,room);
// }
// totalFee = getBigDecimal(consumerWallet, timeLong, priceResponse, totalFee, byId);
}
else
{
...
...
@@ -2566,6 +2736,9 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
priceResponse
.
setDiscountRatio
(
priceResponse
.
getDiscount
());
totalFee
=
getBigDecimal
(
consumerWallet
,
activity
,
timeLong
,
priceResponse
,
totalFee
,
room
,
request
,
consumerMember
);
}
if
(
ObjectUtil
.
isNotEmpty
(
consumerMonthlyCard
))
{
totalFee
=
getBigDecimal
(
consumerMonthlyCard
,
timeLong
,
priceResponse
,
totalPrice
,
room
);
}
// totalFee = getBigDecimal(consumerWallet, timeLong, priceResponse, totalFee, room);
}
...
...
@@ -2586,6 +2759,9 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
priceResponse
.
setDiscountRatio
(
priceResponse
.
getDiscount
());
totalFee
=
getBigDecimal
(
consumerWallet
,
activity
,
timeLong
,
priceResponse
,
totalFee
,
byId
,
request
);
}
if
(
CollectionUtils
.
isNotEmpty
(
consumerSecondaryCardList
))
{
totalFee
=
getBigDecimal
(
consumerSecondaryCardList
,
priceResponse
,
byId
,
payPrice
);
}
}
priceResponse
.
setTotalFee
(
payPrice
);
...
...
@@ -2914,6 +3090,46 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
return
payPrice
;
}
private
BigDecimal
getBigDecimal
(
ConsumerMonthlyCard
consumerMonthlyCard
,
BigDecimal
timeLong
,
ComputedOrderPriceResponse
priceResponse
,
BigDecimal
totalFee
,
SRoom
room
)
{
if
(
consumerMonthlyCard
.
getFreeDuration
().
compareTo
(
timeLong
)
>=
0
)
{
priceResponse
.
setDuration
(
timeLong
);
priceResponse
.
setRemainingDuration
(
consumerMonthlyCard
.
getFreeDuration
().
subtract
(
timeLong
));
priceResponse
.
setDiscount
(
BigDecimal
.
ZERO
);
totalFee
=
new
BigDecimal
(
0
);
priceResponse
.
setMemberDiscount
(
new
BigDecimal
(
0.00
));
priceResponse
.
setTotalFeeNow
(
priceResponse
.
getTotalFee
());
priceResponse
.
setPayFee
(
BigDecimal
.
ZERO
);
priceResponse
.
setMonthlyCardId
(
consumerMonthlyCard
.
getId
());
}
else
if
(
consumerMonthlyCard
.
getFreeDuration
().
compareTo
(
timeLong
)
<
0
)
{
priceResponse
.
setDuration
(
consumerMonthlyCard
.
getFreeDuration
());
priceResponse
.
setRemainingDuration
(
new
BigDecimal
(
0
));
BigDecimal
remainingBalance
=
consumerMonthlyCard
.
getFreeDuration
().
multiply
(
room
.
getPrice
());
remainingBalance
=
totalFee
.
subtract
(
remainingBalance
);
priceResponse
.
setTotalFeeNow
(
remainingBalance
);
priceResponse
.
setMemberDiscount
(
totalFee
.
subtract
(
remainingBalance
));
totalFee
=
remainingBalance
;
priceResponse
.
setPayFee
(
remainingBalance
);
priceResponse
.
setMonthlyCardId
(
consumerMonthlyCard
.
getId
());
}
return
totalFee
;
}
private
BigDecimal
getBigDecimal
(
List
<
ConsumerSecondaryCard
>
consumerSecondaryCardList
,
ComputedOrderPriceResponse
priceResponse
,
SPack
byId
,
BigDecimal
payPrice
)
{
//获取集合中次数最少的次卡,次数不低于0
ConsumerSecondaryCard
consumerSecondaryCard
=
consumerSecondaryCardList
.
stream
().
min
(
Comparator
.
comparing
(
ConsumerSecondaryCard:
:
getNumber
)).
get
();
if
(
consumerSecondaryCard
.
getPackId
().
equals
(
byId
.
getId
()))
{
priceResponse
.
setDiscount
(
BigDecimal
.
ZERO
);
priceResponse
.
setMemberDiscount
(
BigDecimal
.
ZERO
);
priceResponse
.
setTotalFeeNow
(
payPrice
);
priceResponse
.
setPayFee
(
BigDecimal
.
ZERO
);
priceResponse
.
setSecondaryCardId
(
consumerSecondaryCard
.
getId
());
payPrice
=
BigDecimal
.
ZERO
;
}
return
payPrice
;
}
private
BigDecimal
computeTotalPrice
(
Long
packId
,
BigDecimal
totalPrice
)
{
SPack
pack
=
packService
.
getById
(
packId
);
if
(
Objects
.
isNull
(
pack
))
{
...
...
share-system/src/main/java/share/system/service/impl/SecondaryCardOrderServiceImpl.java
View file @
811b37e3
package
share
.
system
.
service
.
impl
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.json.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
share.common.core.redis.RedisUtil
;
import
share.common.enums.ReceiptRdeisEnum
;
import
share.common.enums.YesNoEnum
;
import
share.common.exception.base.BaseException
;
import
share.common.utils.BaseUtil
;
...
...
@@ -23,7 +26,9 @@ import share.system.response.SecondaryCardOrderPayResultResponse;
import
share.system.service.*
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* 次卡购买记录Service业务层处理
...
...
@@ -43,6 +48,8 @@ public class SecondaryCardOrderServiceImpl extends ServiceImpl<SecondaryCardOrde
private
SecondaryCardConfService
secondaryCardConfService
;
@Autowired
private
ConsumerSecondaryCardService
consumerSecondaryCardService
;
@Autowired
private
RedisUtil
redisUtil
;
/**
* 查询次卡购买记录
...
...
@@ -160,6 +167,18 @@ public class SecondaryCardOrderServiceImpl extends ServiceImpl<SecondaryCardOrde
consumerSecondaryCard
.
setNumber
(
secondaryCardConf
.
getNumber
());
consumerSecondaryCard
.
setCreateTime
(
new
Date
());
consumerSecondaryCardService
.
save
(
consumerSecondaryCard
);
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"consumerSecondaryCardId"
,
String
.
valueOf
(
consumerSecondaryCard
.
getId
()));
map
.
put
(
"expirationTime"
,
consumerSecondaryCard
.
getExpirationDate
().
toString
());
JSONObject
jsonObject
=
new
JSONObject
(
map
);
new
Thread
(()
->
{
try
{
Thread
.
sleep
(
1000
);
redisUtil
.
set
(
ReceiptRdeisEnum
.
SECONDARY_CARD
.
getValue
()
+
consumerSecondaryCard
.
getId
(),
jsonObject
.
toString
());
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
}).
start
();
}
@Override
...
...
share-system/src/main/resources/mapper/system/ConsumerWalletMapper.xml
View file @
811b37e3
...
...
@@ -11,6 +11,8 @@
<result
property=
"avatar"
column=
"avatar"
/>
<result
property=
"phone"
column=
"phone"
/>
<result
property=
"balance"
column=
"balance"
/>
<result
property=
"rechargeAmount"
column=
"recharge_amount"
/>
<result
property=
"giftAmount"
column=
"gift_amount"
/>
<result
property=
"remainingDuration"
column=
"remaining_duration"
/>
<result
property=
"remainingIntegral"
column=
"remaining_integral"
/>
<result
property=
"isDelete"
column=
"is_delete"
/>
...
...
@@ -27,6 +29,8 @@
select id,
consumer_id,
balance,
recharge_amount,
gift_amount,
remaining_duration,
remaining_integral,
is_delete,
...
...
@@ -47,6 +51,8 @@
c.phone,
c.avatar,
w.balance,
w.recharge_amount,
w.gift_amount,
w.remaining_duration,
w.remaining_integral,
w.is_delete,
...
...
@@ -80,6 +86,8 @@
c.phone,
c.avatar,
w.balance,
w.recharge_amount,
w.gift_amount,
w.remaining_duration,
w.remaining_integral,
w.is_delete,
...
...
@@ -109,6 +117,8 @@
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"consumerId != null"
>
consumer_id,
</if>
<if
test=
"balance != null"
>
balance,
</if>
<if
test=
"rechargeAmount != null"
>
recharge_amount,
</if>
<if
test=
"giftAmount != null"
>
gift_amount,
</if>
<if
test=
"remainingDuration != null"
>
remaining_duration,
</if>
<if
test=
"remainingIntegral != null"
>
remaining_integral,
</if>
<if
test=
"isDelete != null"
>
is_delete,
</if>
...
...
@@ -123,6 +133,8 @@
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"consumerId != null"
>
#{consumerId},
</if>
<if
test=
"balance != null"
>
#{balance},
</if>
<if
test=
"rechargeAmount != null"
>
#{rechargeAmount},
</if>
<if
test=
"giftAmount != null"
>
#{giftAmount},
</if>
<if
test=
"remainingDuration != null"
>
#{remainingDuration},
</if>
<if
test=
"remainingIntegral != null"
>
#{remainingIntegral},
</if>
<if
test=
"isDelete != null"
>
#{isDelete},
</if>
...
...
@@ -141,6 +153,8 @@
<trim
prefix=
"SET"
suffixOverrides=
","
>
<if
test=
"consumerId != null"
>
consumer_id = #{consumerId},
</if>
<if
test=
"balance != null"
>
balance = #{balance},
</if>
<if
test=
"rechargeAmount != null"
>
recharge_amount = #{rechargeAmount},
</if>
<if
test=
"giftAmount != null"
>
gift_amount = #{giftAmount},
</if>
<if
test=
"remainingDuration != null"
>
remaining_duration = #{remainingDuration},
</if>
<if
test=
"remainingIntegral != null"
>
remaining_integral = #{remainingIntegral},
</if>
<if
test=
"isDelete != null"
>
is_delete = #{isDelete},
</if>
...
...
share-system/src/main/resources/mapper/system/GiftAmountLogMapper.xml
0 → 100644
View file @
811b37e3
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"share.system.mapper.GiftAmountLogMapper"
>
<resultMap
type=
"GiftAmountLogVo"
id=
"GiftAmountLogResult"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"consumerId"
column=
"consumer_id"
/>
<result
property=
"nickName"
column=
"nick_name"
/>
<result
property=
"phone"
column=
"phone"
/>
<result
property=
"avatar"
column=
"avatar"
/>
<result
property=
"currentAmount"
column=
"current_amount"
/>
<result
property=
"variableAmount"
column=
"variable_amount"
/>
<result
property=
"operationType"
column=
"operation_type"
/>
<result
property=
"operationTime"
column=
"operation_time"
/>
<result
property=
"isDelete"
column=
"is_delete"
/>
<result
property=
"createBy"
column=
"create_by"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"updateBy"
column=
"update_by"
/>
<result
property=
"updateTime"
column=
"update_time"
/>
<result
property=
"remark"
column=
"remark"
/>
</resultMap>
<sql
id=
"selectGiftAmountLogVo"
>
select id,
consumer_id,
current_amount,
variable_amount,
operation_type,
operation_time,
is_delete,
create_by,
create_time,
update_by,
update_time,
remark
from s_gift_amount_log
</sql>
<select
id=
"selectGiftAmountLogList"
parameterType=
"GiftAmountLogVo"
resultMap=
"GiftAmountLogResult"
>
select b.id,
b.consumer_id,
c.nick_name,
c.phone,
c.avatar,
b.variable_amount,
b.current_amount,
b.operation_type,
b.operation_time,
b. is_delete,
b. create_by,
b. create_time,
b. update_by,
b.update_time,
b. remark
from s_gift_amount_log b join s_consumer c on b.consumer_id = c.id
<where>
<if
test=
"nickName != null and nickName != ''"
>
and c.nick_name like concat('%', #{nickName},'%')
</if>
<if
test=
"phone != null and phone != ''"
>
and c.phone like concat('%', #{phone},'%')
</if>
</where>
ORDER BY b.operation_time DESC
</select>
<select
id=
"selectGiftAmountLogById"
parameterType=
"Long"
resultMap=
"GiftAmountLogResult"
>
<include
refid=
"selectGiftAmountLogVo"
/>
where id = #{id}
</select>
<insert
id=
"insertGiftAmountLog"
parameterType=
"GiftAmountLog"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into s_gift_amount_log
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"consumerId != null"
>
consumer_id,
</if>
<if
test=
"currentAmount != null"
>
current_amount,
</if>
<if
test=
"variableAmount != null"
>
variable_amount,
</if>
<if
test=
"operationType != null"
>
operation_type,
</if>
<if
test=
"operationTime != null"
>
operation_time,
</if>
<if
test=
"isDelete != null"
>
is_delete,
</if>
<if
test=
"createBy != null"
>
create_by,
</if>
<if
test=
"createTime != null"
>
create_time,
</if>
<if
test=
"updateBy != null"
>
update_by,
</if>
<if
test=
"updateTime != null"
>
update_time,
</if>
<if
test=
"remark != null"
>
remark,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"consumerId != null"
>
#{consumerId},
</if>
<if
test=
"currentAmount != null"
>
#{currentAmount},
</if>
<if
test=
"variableAmount != null"
>
#{variableAmount},
</if>
<if
test=
"operationType != null"
>
#{operationType},
</if>
<if
test=
"operationTime != null"
>
#{operationTime},
</if>
<if
test=
"isDelete != null"
>
#{isDelete},
</if>
<if
test=
"createBy != null"
>
#{createBy},
</if>
<if
test=
"createTime != null"
>
#{createTime},
</if>
<if
test=
"updateBy != null"
>
#{updateBy},
</if>
<if
test=
"updateTime != null"
>
#{updateTime},
</if>
<if
test=
"remark != null"
>
#{remark},
</if>
</trim>
</insert>
<update
id=
"updateGiftAmountLog"
parameterType=
"GiftAmountLog"
>
update s_gift_amount_log
<trim
prefix=
"SET"
suffixOverrides=
","
>
<if
test=
"consumerId != null"
>
consumer_id = #{consumerId},
</if>
<if
test=
"currentAmount != null"
>
current_amount = #{currentAmount},
</if>
<if
test=
"variableAmount != null"
>
variable_amount = #{variableAmount},
</if>
<if
test=
"operationType != null"
>
operation_type = #{operationType},
</if>
<if
test=
"operationTime != null"
>
operation_time = #{operationTime},
</if>
<if
test=
"isDelete != null"
>
is_delete = #{isDelete},
</if>
<if
test=
"createBy != null"
>
create_by = #{createBy},
</if>
<if
test=
"createTime != null"
>
create_time = #{createTime},
</if>
<if
test=
"updateBy != null"
>
update_by = #{updateBy},
</if>
<if
test=
"updateTime != null"
>
update_time = #{updateTime},
</if>
<if
test=
"remark != null"
>
remark = #{remark},
</if>
</trim>
where id = #{id}
</update>
<delete
id=
"deleteGiftAmountLogById"
parameterType=
"Long"
>
delete
from s_gift_amount_log
where id = #{id}
</delete>
<delete
id=
"deleteGiftAmountLogByIds"
parameterType=
"String"
>
delete from s_gift_amount_log where id in
<foreach
item=
"id"
collection=
"array"
open=
"("
separator=
","
close=
")"
>
#{id}
</foreach>
</delete>
</mapper>
\ No newline at end of file
share-system/src/main/resources/mapper/system/MonthlyCardLogMapper.xml
View file @
811b37e3
...
...
@@ -15,6 +15,8 @@
<result
property=
"phone"
column=
"phone"
/>
<result
property=
"useDuration"
column=
"use_duration"
/>
<result
property=
"residueDuration"
column=
"residue_duration"
/>
<result
property=
"operationType"
column=
"operation_type"
/>
<result
property=
"operationTime"
column=
"operation_time"
/>
<result
property=
"isDelete"
column=
"is_delete"
/>
<result
property=
"createBy"
column=
"create_by"
/>
<result
property=
"createTime"
column=
"create_time"
/>
...
...
@@ -30,6 +32,8 @@
phone,
use_duration,
residue_duration,
operation_type,
operation_time,
is_delete,
create_by,
create_time,
...
...
@@ -50,6 +54,8 @@
l.phone,
l.use_duration,
l.residue_duration,
l.operation_type,
l.operation_time,
l.is_delete,
l.create_by,
l.create_time,
...
...
@@ -65,6 +71,7 @@
<if
test=
"phone != null and phone != ''"
>
and l.phone = #{phone}
</if>
<if
test=
"useDuration != null "
>
and l.use_duration = #{useDuration}
</if>
<if
test=
"residueDuration != null "
>
and l.residue_duration = #{residueDuration}
</if>
order by l.create_time
</select>
<select
id=
"selectMonthlyCardLogById"
parameterType=
"Long"
resultMap=
"MonthlyCardLogResult"
>
...
...
@@ -86,6 +93,8 @@
<if
test=
"updateBy != null"
>
update_by,
</if>
<if
test=
"updateTime != null"
>
update_time,
</if>
<if
test=
"remark != null"
>
remark,
</if>
<if
test=
"operationType != null"
>
operation_type,
</if>
<if
test=
"operationTime != null"
>
operation_time,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"consumerMonthlyCardId != null"
>
#{consumerMonthlyCardId},
</if>
...
...
@@ -99,6 +108,8 @@
<if
test=
"updateBy != null"
>
#{updateBy},
</if>
<if
test=
"updateTime != null"
>
#{updateTime},
</if>
<if
test=
"remark != null"
>
#{remark},
</if>
<if
test=
"operationType != null"
>
#{operationType},
</if>
<if
test=
"operationTime != null"
>
#{operationTime},
</if>
</trim>
</insert>
...
...
@@ -116,6 +127,8 @@
<if
test=
"updateBy != null"
>
update_by = #{updateBy},
</if>
<if
test=
"updateTime != null"
>
update_time = #{updateTime},
</if>
<if
test=
"remark != null"
>
remark = #{remark},
</if>
<if
test=
"operationType != null"
>
operation_type = #{operationType},
</if>
<if
test=
"operationTime != null"
>
operation_time = #{operationTime},
</if>
</trim>
where id = #{id}
</update>
...
...
share-system/src/main/resources/mapper/system/RechargeAmountLogMapper.xml
0 → 100644
View file @
811b37e3
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"share.system.mapper.RechargeAmountLogMapper"
>
<resultMap
type=
"RechargeAmountLogVo"
id=
"RechargeAmountLogResult"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"consumerId"
column=
"consumer_id"
/>
<result
property=
"nickName"
column=
"nick_name"
/>
<result
property=
"phone"
column=
"phone"
/>
<result
property=
"avatar"
column=
"avatar"
/>
<result
property=
"currentAmount"
column=
"current_amount"
/>
<result
property=
"variableAmount"
column=
"variable_amount"
/>
<result
property=
"operationType"
column=
"operation_type"
/>
<result
property=
"operationTime"
column=
"operation_time"
/>
<result
property=
"isDelete"
column=
"is_delete"
/>
<result
property=
"createBy"
column=
"create_by"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"updateBy"
column=
"update_by"
/>
<result
property=
"updateTime"
column=
"update_time"
/>
<result
property=
"remark"
column=
"remark"
/>
</resultMap>
<sql
id=
"selectRechargeAmountLogVo"
>
select id,
consumer_id,
current_amount,
variable_amount,
operation_type,
operation_time,
is_delete,
create_by,
create_time,
update_by,
update_time,
remark
from s_recharge_amount_log
</sql>
<select
id=
"selectRechargeAmountLogList"
parameterType=
"RechargeAmountLogVo"
resultMap=
"RechargeAmountLogResult"
>
select b.id,
b.consumer_id,
c.nick_name,
c.phone,
c.avatar,
b.variable_amount,
b.current_amount,
b.operation_type,
b.operation_time,
b. is_delete,
b. create_by,
b. create_time,
b. update_by,
b.update_time,
b. remark
from s_recharge_amount_log b join s_consumer c on b.consumer_id = c.id
<where>
<if
test=
"nickName != null and nickName != ''"
>
and c.nick_name like concat('%', #{nickName},'%')
</if>
<if
test=
"phone != null and phone != ''"
>
and c.phone like concat('%', #{phone},'%')
</if>
<if
test=
"currentAmount != null "
>
and b.current_amount = #{currentAmount}
</if>
<if
test=
"variableAmount != null "
>
and b.variable_amount = #{variableAmount}
</if>
</where>
ORDER BY b.operation_time DESC
</select>
<select
id=
"selectRechargeAmountLogById"
parameterType=
"Long"
resultMap=
"RechargeAmountLogResult"
>
<include
refid=
"selectRechargeAmountLogVo"
/>
where id = #{id}
</select>
<insert
id=
"insertRechargeAmountLog"
parameterType=
"RechargeAmountLog"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into s_recharge_amount_log
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"consumerId != null"
>
consumer_id,
</if>
<if
test=
"currentAmount != null"
>
current_amount,
</if>
<if
test=
"variableAmount != null"
>
variable_amount,
</if>
<if
test=
"operationType != null"
>
operation_type,
</if>
<if
test=
"operationTime != null"
>
operation_time,
</if>
<if
test=
"isDelete != null"
>
is_delete,
</if>
<if
test=
"createBy != null"
>
create_by,
</if>
<if
test=
"createTime != null"
>
create_time,
</if>
<if
test=
"updateBy != null"
>
update_by,
</if>
<if
test=
"updateTime != null"
>
update_time,
</if>
<if
test=
"remark != null"
>
remark,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"consumerId != null"
>
#{consumerId},
</if>
<if
test=
"currentAmount != null"
>
#{currentAmount},
</if>
<if
test=
"variableAmount != null"
>
#{variableAmount},
</if>
<if
test=
"operationType != null"
>
#{operationType},
</if>
<if
test=
"operationTime != null"
>
#{operationTime},
</if>
<if
test=
"isDelete != null"
>
#{isDelete},
</if>
<if
test=
"createBy != null"
>
#{createBy},
</if>
<if
test=
"createTime != null"
>
#{createTime},
</if>
<if
test=
"updateBy != null"
>
#{updateBy},
</if>
<if
test=
"updateTime != null"
>
#{updateTime},
</if>
<if
test=
"remark != null"
>
#{remark},
</if>
</trim>
</insert>
<update
id=
"updateRechargeAmountLog"
parameterType=
"RechargeAmountLog"
>
update s_recharge_amount_log
<trim
prefix=
"SET"
suffixOverrides=
","
>
<if
test=
"consumerId != null"
>
consumer_id = #{consumerId},
</if>
<if
test=
"currentAmount != null"
>
current_amount = #{currentAmount},
</if>
<if
test=
"variableAmount != null"
>
variable_amount = #{variableAmount},
</if>
<if
test=
"operationType != null"
>
operation_type = #{operationType},
</if>
<if
test=
"operationTime != null"
>
operation_time = #{operationTime},
</if>
<if
test=
"isDelete != null"
>
is_delete = #{isDelete},
</if>
<if
test=
"createBy != null"
>
create_by = #{createBy},
</if>
<if
test=
"createTime != null"
>
create_time = #{createTime},
</if>
<if
test=
"updateBy != null"
>
update_by = #{updateBy},
</if>
<if
test=
"updateTime != null"
>
update_time = #{updateTime},
</if>
<if
test=
"remark != null"
>
remark = #{remark},
</if>
</trim>
where id = #{id}
</update>
<delete
id=
"deleteRechargeAmountLogById"
parameterType=
"Long"
>
delete
from s_recharge_amount_log
where id = #{id}
</delete>
<delete
id=
"deleteRechargeAmountLogByIds"
parameterType=
"String"
>
delete from s_recharge_amount_log where id in
<foreach
item=
"id"
collection=
"array"
open=
"("
separator=
","
close=
")"
>
#{id}
</foreach>
</delete>
</mapper>
\ No newline at end of file
share-system/src/main/resources/mapper/system/SOrderMapper.xml
View file @
811b37e3
...
...
@@ -21,9 +21,13 @@
<result
property=
"packPrice"
column=
"pack_price"
/>
<result
property=
"couponId"
column=
"coupon_id"
/>
<result
property=
"couponPrice"
column=
"coupon_price"
/>
<result
property=
"secondaryCardId"
column=
"secondary_card_id"
/>
<result
property=
"monthlyCardId"
column=
"monthly_card_id"
/>
<result
property=
"totalPrice"
column=
"total_price"
/>
<result
property=
"duration"
column=
"duration"
/>
<result
property=
"balance"
column=
"balance"
/>
<result
property=
"rechargeAmount"
column=
"recharge_amount"
/>
<result
property=
"giftAmount"
column=
"gift_amount"
/>
<result
property=
"discountRatio"
column=
"discount_ratio"
/>
<result
property=
"payPrice"
column=
"pay_price"
/>
<result
property=
"payTime"
column=
"pay_time"
/>
...
...
@@ -63,10 +67,14 @@
pack_price,
coupon_id,
coupon_price,
secondary_card_id,
monthly_card_id,
total_price,
pay_price,
duration,
balance,
recharge_amount,
gift_amount,
discount_ratio,
pay_time,
time_long,
...
...
@@ -106,10 +114,14 @@
pack_price,
coupon_id,
coupon_price,
secondary_card_id,
monthly_card_id,
total_price,
pay_price,
duration,
balance,
recharge_amount,
gift_amount,
discount_ratio,
pay_time,
time_long,
...
...
@@ -149,10 +161,14 @@
<if
test=
"packPrice != null and packPrice != ''"
>
and pack_price = #{packPrice}
</if>
<if
test=
"couponId != null and couponId != ''"
>
and coupon_id = #{couponId}
</if>
<if
test=
"couponPrice != null and couponPrice != ''"
>
and coupon_price = #{couponPrice}
</if>
<if
test=
"secondaryCardId != null and secondaryCardId != ''"
>
and secondary_card_id = #{secondaryCardId}
</if>
<if
test=
"monthlyCardId != null and monthlyCardId != ''"
>
and monthly_card_id = #{monthlyCardId}
</if>
<if
test=
"totalPrice != null and totalPrice != ''"
>
and total_price = #{totalPrice}
</if>
<if
test=
"payPrice != null and payPrice != ''"
>
and pay_price = #{payPrice}
</if>
<if
test=
"duration != null and duration != ''"
>
and duration = #{duration}
</if>
<if
test=
"balance != null and balance != ''"
>
and balance = #{balance}
</if>
<if
test=
"rechargeAmount != null and rechargeAmount != ''"
>
and recharge_amount = #{rechargeAmount}
</if>
<if
test=
"giftAmount != null and giftAmount !=''"
>
and gift_amount = #{giftAmount}
</if>
<if
test=
"discountRatio != null and discountRatio != ''"
>
and discount_ratio = #{discountRatio}
</if>
<if
test=
"startPayTime != null"
>
and DATE_FORMAT(pay_time, '%Y-%m-%d')
>
= DATE_FORMAT(#{startPayTime}, '%Y-%m-%d')
...
...
@@ -225,11 +241,15 @@
s.consumer_phone,
s.duration,
s.balance,
s.recharge_amount,
s.gift_amount,
s.discount_ratio,
s.pack_id,
s.pack_price,
s.coupon_id,
s.coupon_price,
s.secondary_card_id,
s.monthly_card_id,
s.total_price,
s.pay_price,
s.discount_ratio,
...
...
@@ -273,11 +293,15 @@
s.consumer_phone,
s.duration,
s.balance,
s.recharge_amount,
s.gift_amount,
s.discount_ratio,
s.pack_id,
s.pack_price,
s.coupon_id,
s.coupon_price,
s.secondary_card_id,
s.monthly_card_id,
s.total_price,
s.pay_price,
s.discount_ratio,
...
...
@@ -339,6 +363,8 @@
<if
test=
"packPrice != null and packPrice != ''"
>
and pack_price = #{packPrice}
</if>
<if
test=
"couponId != null and couponId != ''"
>
and coupon_id = #{couponId}
</if>
<if
test=
"couponPrice != null and couponPrice != ''"
>
and coupon_price = #{couponPrice}
</if>
<if
test=
"secondaryCardId != null and secondaryCardId != ''"
>
and secondary_card_id = #{secondaryCardId}
</if>
<if
test=
"monthlyCardId != null and monthlyCardId != ''"
>
and monthly_card_id = #{monthlyCardId}
</if>
<if
test=
"totalPrice != null and totalPrice != ''"
>
and total_price = #{totalPrice}
</if>
<if
test=
"payPrice != null and payPrice != ''"
>
and pay_price = #{payPrice}
</if>
<if
test=
"duration != null and duration != ''"
>
and duration = #{duration}
</if>
...
...
@@ -401,6 +427,8 @@
<if
test=
"packPrice != null and packPrice != ''"
>
and pack_price = #{packPrice}
</if>
<if
test=
"couponId != null and couponId != ''"
>
and coupon_id = #{couponId}
</if>
<if
test=
"couponPrice != null and couponPrice != ''"
>
and coupon_price = #{couponPrice}
</if>
<if
test=
"secondaryCardId != null and secondaryCardId != ''"
>
and secondary_card_id = #{secondaryCardId}
</if>
<if
test=
"monthlyCardId != null and monthlyCardId != ''"
>
and monthly_card_id = #{monthlyCardId}
</if>
<if
test=
"totalPrice != null and totalPrice != ''"
>
and total_price = #{totalPrice}
</if>
<if
test=
"payPrice != null and payPrice != ''"
>
and pay_price = #{payPrice}
</if>
<if
test=
"duration != null and duration != ''"
>
and duration = #{duration}
</if>
...
...
@@ -480,6 +508,10 @@
<if
test=
"discountRatio != null and discountRatio != ''"
>
discount_ratio,
</if>
<if
test=
"duration != null and duration != ''"
>
duration,
</if>
<if
test=
"balance != null and balance != '' "
>
balance,
</if>
<if
test=
"rechargeAmount != null and rechargeAmount != ''"
>
recharge_amount,
</if>
<if
test=
"giftAmount != null and giftAmount != ''"
>
gift_amount,
</if>
<if
test=
"secondaryCardId != null and secondaryCardId != ''"
>
secondary_card_id,
</if>
<if
test=
"monthlyCardId != null and monthlyCardId != ''"
>
monthly_card_id,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"orderNo != null"
>
#{orderNo},
</if>
...
...
@@ -517,6 +549,10 @@
<if
test=
"discountRatio != null"
>
#{discountRatio},
</if>
<if
test=
"duration != null"
>
#{duration},
</if>
<if
test=
"balance != null"
>
#{balance},
</if>
<if
test=
"rechargeAmount != null"
>
#{rechargeAmount},
</if>
<if
test=
"giftAmount != null"
>
#{giftAmount},
</if>
<if
test=
"secondaryCardId != null"
>
#{secondary_card_id},
</if>
<if
test=
"monthlyCardId != null"
>
#{monthly_card_id},
</if>
</trim>
</insert>
...
...
@@ -559,6 +595,10 @@
<if
test=
"discountRatio != null"
>
discount_ratio = #{discountRatio},
</if>
<if
test=
"duration != null"
>
duration = #{duration},
</if>
<if
test=
"balance != null"
>
balance = #{balance},
</if>
<if
test=
"rechargeAmount != null"
>
recharge_amount = #{rechargeAmount},
</if>
<if
test=
"giftAmount != null"
>
gift_amount = #{giftAmount},
</if>
<if
test=
"monthlyCardId != null"
>
monthly_card_id = #{monthlyCardId},
</if>
<if
test=
"secondaryCardId != null"
>
secondary_card_id = #{secondaryCardId},
</if>
</trim>
where id = #{id}
</update>
...
...
share-system/src/main/resources/mapper/system/SecondaryCardLogMapper.xml
View file @
811b37e3
...
...
@@ -18,6 +18,8 @@
<result
property=
"packPrice"
column=
"pack_price"
/>
<result
property=
"usageCount"
column=
"usage_count"
/>
<result
property=
"residueCount"
column=
"residue_count"
/>
<result
property=
"operationType"
column=
"operation_type"
/>
<result
property=
"operationTime"
column=
"operation_time"
/>
<result
property=
"isDelete"
column=
"is_delete"
/>
<result
property=
"createBy"
column=
"create_by"
/>
<result
property=
"createTime"
column=
"create_time"
/>
...
...
@@ -34,6 +36,8 @@
pack_id,
usage_count,
residue_count,
operation_type,
operation_time,
is_delete,
create_by,
create_time,
...
...
@@ -57,6 +61,8 @@
p.price as 'pack_price',
l.usage_count,
l.residue_count,
l.operation_type,
l.operation_time,
l.is_delete,
l.create_by,
l.create_time,
...
...
@@ -74,6 +80,7 @@
<if
test=
"packId != null "
>
and l.pack_id = #{packId}
</if>
<if
test=
"usageCount != null "
>
and l.usage_count = #{usageCount}
</if>
<if
test=
"residueCount != null "
>
and l.residue_count = #{residueCount}
</if>
order by l.create_time
</select>
<select
id=
"selectSecondaryCardLogById"
parameterType=
"Long"
resultMap=
"SecondaryCardLogResult"
>
...
...
@@ -96,6 +103,8 @@
<if
test=
"updateBy != null"
>
update_by,
</if>
<if
test=
"updateTime != null"
>
update_time,
</if>
<if
test=
"remark != null"
>
remark,
</if>
<if
test=
"operationType != null"
>
operation_type,
</if>
<if
test=
"operationTime != null"
>
operation_time,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"consumerSecondaryCardId != null"
>
#{consumerSecondaryCardId},
</if>
...
...
@@ -110,6 +119,8 @@
<if
test=
"updateBy != null"
>
#{updateBy},
</if>
<if
test=
"updateTime != null"
>
#{updateTime},
</if>
<if
test=
"remark != null"
>
#{remark},
</if>
<if
test=
"operationType != null"
>
#{operationType},
</if>
<if
test=
"operationTime != null"
>
#{operationTime},
</if>
</trim>
</insert>
...
...
@@ -128,6 +139,8 @@
<if
test=
"updateBy != null"
>
update_by = #{updateBy},
</if>
<if
test=
"updateTime != null"
>
update_time = #{updateTime},
</if>
<if
test=
"remark != null"
>
remark = #{remark},
</if>
<if
test=
"operationType != null"
>
operation_type = #{operationType},
</if>
<if
test=
"operationTime != null"
>
operation_time = #{operationTime},
</if>
</trim>
where id = #{id}
</update>
...
...
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