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
f1892cf6
Commit
f1892cf6
authored
Sep 12, 2024
by
吕明尚
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'refs/heads/dev' into test
parents
9af0f9c3
f5558b68
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
846 additions
and
53 deletions
+846
-53
EquityFundLogController.java
.../share/web/controller/system/EquityFundLogController.java
+104
-0
SharingActivitiesController.java
...re/web/controller/system/SharingActivitiesController.java
+24
-16
DeviceTask.java
share-quartz/src/main/java/share/quartz/task/DeviceTask.java
+18
-2
RedisTask.java
share-quartz/src/main/java/share/quartz/task/RedisTask.java
+64
-4
EquityFundLog.java
...stem/src/main/java/share/system/domain/EquityFundLog.java
+99
-0
SharingActivities.java
.../src/main/java/share/system/domain/SharingActivities.java
+2
-3
EquityFundLogMapper.java
...rc/main/java/share/system/mapper/EquityFundLogMapper.java
+62
-0
DeviceService.java
...tem/src/main/java/share/system/service/DeviceService.java
+3
-2
EquityFundLogService.java
.../main/java/share/system/service/EquityFundLogService.java
+62
-0
SharingActivitiesService.java
...n/java/share/system/service/SharingActivitiesService.java
+3
-0
CallbackServiceImpl.java
...n/java/share/system/service/impl/CallbackServiceImpl.java
+104
-2
DeviceServiceImpl.java
...ain/java/share/system/service/impl/DeviceServiceImpl.java
+21
-12
EquityFundLogServiceImpl.java
...a/share/system/service/impl/EquityFundLogServiceImpl.java
+97
-0
SConsumerCenterServiceImpl.java
...share/system/service/impl/SConsumerCenterServiceImpl.java
+1
-1
SOrderServiceImpl.java
...ain/java/share/system/service/impl/SOrderServiceImpl.java
+15
-10
SharingActivitiesServiceImpl.java
...are/system/service/impl/SharingActivitiesServiceImpl.java
+38
-1
EquityFundLogMapper.xml
.../src/main/resources/mapper/system/EquityFundLogMapper.xml
+129
-0
No files found.
share-admin/src/main/java/share/web/controller/system/EquityFundLogController.java
0 → 100644
View file @
f1892cf6
package
share
.
web
.
controller
.
system
;
import
java.util.List
;
import
javax.servlet.http.HttpServletResponse
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PutMapping
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
share.common.annotation.Log
;
import
share.common.core.controller.BaseController
;
import
share.common.core.domain.AjaxResult
;
import
share.common.enums.BusinessType
;
import
share.system.domain.EquityFundLog
;
import
share.system.service.EquityFundLogService
;
import
share.common.utils.poi.ExcelUtil
;
import
share.common.core.page.TableDataInfo
;
/**
* 权益金记录Controller
*
* @author wuwenlong
* @date 2024-09-10
*/
@RestController
@RequestMapping
(
"/system/equityFundLog"
)
public
class
EquityFundLogController
extends
BaseController
{
@Autowired
private
EquityFundLogService
equityFundLogService
;
/**
* 查询权益金记录列表
*/
@PreAuthorize
(
"@ss.hasPermi('system:equityFundLog:list')"
)
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
EquityFundLog
equityFundLog
)
{
startPage
();
List
<
EquityFundLog
>
list
=
equityFundLogService
.
selectEquityFundLogList
(
equityFundLog
);
return
getDataTable
(
list
);
}
/**
* 导出权益金记录列表
*/
@PreAuthorize
(
"@ss.hasPermi('system:equityFundLog:export')"
)
@Log
(
title
=
"权益金记录"
,
businessType
=
BusinessType
.
EXPORT
)
@PostMapping
(
"/export"
)
public
void
export
(
HttpServletResponse
response
,
EquityFundLog
equityFundLog
)
{
List
<
EquityFundLog
>
list
=
equityFundLogService
.
selectEquityFundLogList
(
equityFundLog
);
ExcelUtil
<
EquityFundLog
>
util
=
new
ExcelUtil
<
EquityFundLog
>(
EquityFundLog
.
class
);
util
.
exportExcel
(
response
,
list
,
"权益金记录数据"
);
}
/**
* 获取权益金记录详细信息
*/
@PreAuthorize
(
"@ss.hasPermi('system:equityFundLog:query')"
)
@GetMapping
(
value
=
"/{id}"
)
public
AjaxResult
getInfo
(
@PathVariable
(
"id"
)
Long
id
)
{
return
success
(
equityFundLogService
.
selectEquityFundLogById
(
id
));
}
/**
* 新增权益金记录
*/
@PreAuthorize
(
"@ss.hasPermi('system:equityFundLog:add')"
)
@Log
(
title
=
"权益金记录"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
public
AjaxResult
add
(
@RequestBody
EquityFundLog
equityFundLog
)
{
return
toAjax
(
equityFundLogService
.
insertEquityFundLog
(
equityFundLog
));
}
/**
* 修改权益金记录
*/
@PreAuthorize
(
"@ss.hasPermi('system:equityFundLog:edit')"
)
@Log
(
title
=
"权益金记录"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
public
AjaxResult
edit
(
@RequestBody
EquityFundLog
equityFundLog
)
{
return
toAjax
(
equityFundLogService
.
updateEquityFundLog
(
equityFundLog
));
}
/**
* 删除权益金记录
*/
@PreAuthorize
(
"@ss.hasPermi('system:equityFundLog:remove')"
)
@Log
(
title
=
"权益金记录"
,
businessType
=
BusinessType
.
DELETE
)
@DeleteMapping
(
"/{ids}"
)
public
AjaxResult
remove
(
@PathVariable
Long
[]
ids
)
{
return
toAjax
(
equityFundLogService
.
deleteEquityFundLogByIds
(
ids
));
}
}
share-admin/src/main/java/share/web/controller/system/SharingActivitiesController.java
View file @
f1892cf6
...
...
@@ -2,6 +2,7 @@ package share.web.controller.system;
import
java.util.List
;
import
javax.servlet.http.HttpServletResponse
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
...
...
@@ -23,14 +24,13 @@ import share.common.core.page.TableDataInfo;
/**
* 分享活动绑定关系Controller
*
*
* @author wuwenlong
* @date 2024-09-02
*/
@RestController
@RequestMapping
(
"/system/activities"
)
public
class
SharingActivitiesController
extends
BaseController
{
public
class
SharingActivitiesController
extends
BaseController
{
@Autowired
private
SharingActivitiesService
sharingActivitiesService
;
...
...
@@ -39,8 +39,7 @@ public class SharingActivitiesController extends BaseController
*/
@PreAuthorize
(
"@ss.hasPermi('system:activities:list')"
)
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
SharingActivities
sharingActivities
)
{
public
TableDataInfo
list
(
SharingActivities
sharingActivities
)
{
startPage
();
List
<
SharingActivities
>
list
=
sharingActivitiesService
.
selectSharingActivitiesList
(
sharingActivities
);
return
getDataTable
(
list
);
...
...
@@ -52,8 +51,7 @@ public class SharingActivitiesController extends BaseController
@PreAuthorize
(
"@ss.hasPermi('system:activities:export')"
)
@Log
(
title
=
"分享活动绑定关系"
,
businessType
=
BusinessType
.
EXPORT
)
@PostMapping
(
"/export"
)
public
void
export
(
HttpServletResponse
response
,
SharingActivities
sharingActivities
)
{
public
void
export
(
HttpServletResponse
response
,
SharingActivities
sharingActivities
)
{
List
<
SharingActivities
>
list
=
sharingActivitiesService
.
selectSharingActivitiesList
(
sharingActivities
);
ExcelUtil
<
SharingActivities
>
util
=
new
ExcelUtil
<
SharingActivities
>(
SharingActivities
.
class
);
util
.
exportExcel
(
response
,
list
,
"分享活动绑定关系数据"
);
...
...
@@ -64,8 +62,7 @@ public class SharingActivitiesController extends BaseController
*/
@PreAuthorize
(
"@ss.hasPermi('system:activities:query')"
)
@GetMapping
(
value
=
"/{id}"
)
public
AjaxResult
getInfo
(
@PathVariable
(
"id"
)
Long
id
)
{
public
AjaxResult
getInfo
(
@PathVariable
(
"id"
)
Long
id
)
{
return
success
(
sharingActivitiesService
.
selectSharingActivitiesById
(
id
));
}
...
...
@@ -75,19 +72,31 @@ public class SharingActivitiesController extends BaseController
@PreAuthorize
(
"@ss.hasPermi('system:activities:add')"
)
@Log
(
title
=
"分享活动绑定关系"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
public
AjaxResult
add
(
@RequestBody
SharingActivities
sharingActivities
)
{
public
AjaxResult
add
(
@RequestBody
SharingActivities
sharingActivities
)
{
return
toAjax
(
sharingActivitiesService
.
insertSharingActivities
(
sharingActivities
));
}
/**
* 新增分享活动绑定关系
*/
// @PreAuthorize("@ss.hasPermi('system:activities:addSharingActivities')")
@Log
(
title
=
"分享活动绑定关系"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
(
"/addSharingActivities"
)
public
AjaxResult
addSharingActivities
(
@RequestBody
SharingActivities
sharingActivities
)
{
AjaxResult
ajaxResult
=
sharingActivitiesService
.
addSharingActivities
(
sharingActivities
);
return
ajaxResult
;
}
/**
* 修改分享活动绑定关系
*/
@PreAuthorize
(
"@ss.hasPermi('system:activities:edit')"
)
@Log
(
title
=
"分享活动绑定关系"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
public
AjaxResult
edit
(
@RequestBody
SharingActivities
sharingActivities
)
{
public
AjaxResult
edit
(
@RequestBody
SharingActivities
sharingActivities
)
{
return
toAjax
(
sharingActivitiesService
.
updateSharingActivities
(
sharingActivities
));
}
...
...
@@ -96,9 +105,8 @@ public class SharingActivitiesController extends BaseController
*/
@PreAuthorize
(
"@ss.hasPermi('system:activities:remove')"
)
@Log
(
title
=
"分享活动绑定关系"
,
businessType
=
BusinessType
.
DELETE
)
@DeleteMapping
(
"/{ids}"
)
public
AjaxResult
remove
(
@PathVariable
Long
[]
ids
)
{
@DeleteMapping
(
"/{ids}"
)
public
AjaxResult
remove
(
@PathVariable
Long
[]
ids
)
{
return
toAjax
(
sharingActivitiesService
.
deleteSharingActivitiesByIds
(
ids
));
}
}
share-quartz/src/main/java/share/quartz/task/DeviceTask.java
View file @
f1892cf6
...
...
@@ -7,9 +7,11 @@ import org.slf4j.LoggerFactory;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
share.system.domain.DeviceGateway
;
import
share.system.domain.SStore
;
import
share.system.service.DeviceGatewayService
;
import
share.system.service.DeviceService
;
import
share.system.service.DeviceStatusLogService
;
import
share.system.service.ISStoreService
;
import
java.util.List
;
...
...
@@ -29,6 +31,8 @@ public class DeviceTask {
private
DeviceGatewayService
deviceGatewayService
;
@Autowired
private
DeviceService
deviceService
;
@Autowired
private
ISStoreService
storeService
;
/**
* 设备异常状态短信提醒任务
...
...
@@ -64,8 +68,20 @@ public class DeviceTask {
if
(
validTime
==
null
)
{
validTime
=
15
;
}
// 更新所有门锁设备开锁密码
deviceService
.
updateDeviceDoorLockPassword
(
validTime
);
SStore
sStore
=
new
SStore
();
sStore
.
setStatus
(
"1"
);
List
<
SStore
>
storeList
=
storeService
.
selectSStoreList
(
sStore
);
for
(
SStore
store
:
storeList
)
{
// 更新所有门锁设备开锁密码
deviceService
.
updateDeviceDoorLockPassword
(
validTime
,
store
.
getId
());
// 延时执行操作
try
{
Thread
.
sleep
(
15000
);
}
catch
(
InterruptedException
e
)
{
// e.printStackTrace();
log
.
error
(
"定期修改门锁设备的开锁密码线程中断:{}"
,
e
.
getMessage
());
}
}
log
.
debug
(
"updateDeviceDoorLockPassword:每周一修改房间门锁密码结束"
);
}
...
...
share-quartz/src/main/java/share/quartz/task/RedisTask.java
View file @
f1892cf6
...
...
@@ -32,6 +32,7 @@ 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
;
...
...
@@ -110,6 +111,15 @@ public class RedisTask {
@Autowired
private
SharingActivitiesService
sharingActivitiesService
;
@Autowired
private
ISysConfigService
sysConfigService
;
@Autowired
private
SConsumerService
consumerService
;
@Autowired
private
EquityFundLogService
equityFundLogService
;
//15分钟的常量
final
long
FIFTEEN_MINUTES
=
60
*
15
;
...
...
@@ -339,6 +349,8 @@ public class RedisTask {
//查询是否有上级
LambdaQueryWrapper
<
SharingActivities
>
sharingActivitiesLambdaQueryWrapper
=
new
LambdaQueryWrapper
<>();
sharingActivitiesLambdaQueryWrapper
.
eq
(
SharingActivities
::
getNewUid
,
sOrder
.
getConsumerId
());
sharingActivitiesLambdaQueryWrapper
.
eq
(
SharingActivities
::
getActivityType
,
"0"
);
sharingActivitiesLambdaQueryWrapper
.
eq
(
SharingActivities
::
getIsDelete
,
YesNoEnum
.
no
.
getIndex
());
SharingActivities
sharingActivities
=
sharingActivitiesService
.
getOne
(
sharingActivitiesLambdaQueryWrapper
);
if
(
ObjectUtil
.
isNotEmpty
(
sharingActivities
)){
LambdaQueryWrapper
<
ConsumerWallet
>
consumerWalletLambdaQueryWrapper
=
new
LambdaQueryWrapper
<>();
...
...
@@ -354,21 +366,69 @@ public class RedisTask {
//新增钱包
ConsumerWallet
newConsumerWallet
=
new
ConsumerWallet
();
BigDecimal
defaultVlue
=
new
BigDecimal
(
0.0
);
newConsumerWallet
.
setCreateTime
(
DateUtils
.
getNowDate
());
newConsumerWallet
.
setConsumerId
(
sharingActivities
.
getUid
());
newConsumerWallet
.
setBalance
(
defaultVlue
);
newConsumerWallet
.
setRemainingIntegral
(
defaultVlue
);
newConsumerWallet
.
setRemainingDuration
(
defaultVlue
);
newConsumerWallet
.
setEquityFund
(
defaultVlue
);
newConsumerWallet
.
setAccumulateEquityFund
(
defaultVlue
);
consumerWalletService
.
save
(
newConsumerWallet
);
BigDecimal
anHour
=
new
BigDecimal
(
1.0
);
newConsumerWallet
.
setRemainingDuration
(
newConsumerWallet
.
getRemainingDuration
().
add
(
anHour
));
newConsumerWallet
.
setUpdateTime
(
DateUtils
.
getNowDate
());
consumerWalletService
.
update
ConsumerWallet
(
newConsumerWallet
);
consumerWalletService
.
insert
ConsumerWallet
(
newConsumerWallet
);
}
}
}
//查询是否有上级
LambdaQueryWrapper
<
SharingActivities
>
sharingActivitiesLambdaQueryWrapper
=
new
LambdaQueryWrapper
<>();
sharingActivitiesLambdaQueryWrapper
.
eq
(
SharingActivities
::
getNewUid
,
sOrder
.
getConsumerId
());
sharingActivitiesLambdaQueryWrapper
.
eq
(
SharingActivities
::
getActivityType
,
"1"
);
sharingActivitiesLambdaQueryWrapper
.
eq
(
SharingActivities
::
getIsDelete
,
YesNoEnum
.
no
.
getIndex
());
SharingActivities
sharingActivities
=
sharingActivitiesService
.
getOne
(
sharingActivitiesLambdaQueryWrapper
);
if
(
ObjectUtil
.
isNotEmpty
(
sharingActivities
)){
//查询会员用户类型
LambdaQueryWrapper
<
ConsumerMember
>
consumerMemberLambdaQueryWrapper
=
new
LambdaQueryWrapper
<>();
consumerMemberLambdaQueryWrapper
.
eq
(
ConsumerMember:
:
getConsumerId
,
sharingActivities
.
getUid
());
ConsumerMember
consumerMember
=
consumerMemberService
.
getOne
(
consumerMemberLambdaQueryWrapper
);
//判断是否为权益会员和会员是否有效
if
(
"2"
.
equals
(
consumerMember
.
getMemberType
())
&&
new
Date
().
getTime
()
<
consumerMember
.
getExpirationDate
().
getTime
()
){
Boolean
aBoolean
=
redisTemplate
.
hasKey
(
ReceiptRdeisEnum
.
EQUITY_MEMBERS_TIME
+
sharingActivities
.
getUid
().
toString
());
if
(
aBoolean
){
LambdaQueryWrapper
<
ConsumerWallet
>
consumerWalletLambdaQueryWrapper
=
new
LambdaQueryWrapper
<>();
consumerWalletLambdaQueryWrapper
.
eq
(
ConsumerWallet:
:
getConsumerId
,
sharingActivities
.
getUid
());
ConsumerWallet
consumerWallet
=
consumerWalletService
.
getOne
(
consumerWalletLambdaQueryWrapper
);
BigDecimal
payPrice
=
sOrder
.
getPayPrice
();
if
(
payPrice
.
signum
()
>
0
)
{
String
equityFund
=
sysConfigService
.
selectConfigByKey
(
"sys.equityFundLog.equityFund"
);
consumerWallet
.
setEquityFund
(
consumerWallet
.
getEquityFund
().
add
(
payPrice
.
multiply
(
new
BigDecimal
(
equityFund
).
setScale
(
2
,
RoundingMode
.
HALF_UP
))));
consumerWallet
.
setAccumulateEquityFund
(
consumerWallet
.
getAccumulateEquityFund
().
add
(
payPrice
.
multiply
(
new
BigDecimal
(
equityFund
).
setScale
(
2
,
RoundingMode
.
HALF_UP
))));
consumerWallet
.
setUpdateTime
(
DateUtils
.
getNowDate
());
consumerWalletService
.
updateConsumerWallet
(
consumerWallet
);
//添加权益金日志记录
//下级用户
SConsumer
newConsumer
=
consumerService
.
getById
(
sOrder
.
getConsumerId
());
//上级用户
SConsumer
consumer
=
consumerService
.
getById
(
sharingActivities
.
getUid
());
EquityFundLog
equityFundLog
=
new
EquityFundLog
();
equityFundLog
.
setEquityFund
(
payPrice
.
multiply
(
new
BigDecimal
(
equityFund
).
setScale
(
2
,
RoundingMode
.
HALF_UP
)));
equityFundLog
.
setEquityFundType
(
"1"
);
equityFundLog
.
setOutTradeNo
(
sOrder
.
getOutTradeNo
());
equityFundLog
.
setTerminalTrace
(
sOrder
.
getOutTradeNo
());
equityFundLog
.
setUid
(
sharingActivities
.
getUid
());
equityFundLog
.
setNewUid
(
sharingActivities
.
getNewUid
());
equityFundLog
.
setPhone
(
consumer
.
getPhone
());
equityFundLog
.
setAccount
(
consumer
.
getAccount
());
equityFundLog
.
setNickName
(
consumer
.
getNickName
());
equityFundLog
.
setNewPhone
(
newConsumer
.
getPhone
());
equityFundLog
.
setNewAccount
(
newConsumer
.
getAccount
());
equityFundLog
.
setNewNickName
(
newConsumer
.
getNickName
());
equityFundLogService
.
insertEquityFundLog
(
equityFundLog
);
}
}
}
}
if
(
extracted
(
o
,
sOrders
,
sOrder
))
return
;
//更改订单状态
sOrder
.
setStatus
(
OrderStatusEnum
.
USED
.
getCode
());
...
...
share-system/src/main/java/share/system/domain/EquityFundLog.java
0 → 100644
View file @
f1892cf6
package
share
.
system
.
domain
;
import
java.math.BigDecimal
;
import
com.baomidou.mybatisplus.annotation.*
;
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
lombok.Data
;
/**
* 权益金记录对象 s_equity_fund_log
*
* @author wuwenlong
* @date 2024-09-10
*/
@Data
@TableName
(
value
=
"s_equity_fund_log"
)
public
class
EquityFundLog
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1L
;
/** 主键 */
@TableId
(
type
=
IdType
.
AUTO
)
private
Long
id
;
/** 权益金类型(0-充值,1-权益订单) */
@Excel
(
name
=
"权益金类型(0-充值,1-权益订单)"
)
private
String
equityFundType
;
/** 权益金额 */
@Excel
(
name
=
"权益金额"
)
private
BigDecimal
equityFund
;
/** 上级id */
@Excel
(
name
=
"上级id"
)
private
Long
uid
;
/** 下级id */
@Excel
(
name
=
"下级id"
)
private
Long
newUid
;
/** 终端流水号 */
@Excel
(
name
=
"终端流水号"
)
private
String
terminalTrace
;
/** 订单号 */
@Excel
(
name
=
"订单号"
)
private
String
outTradeNo
;
/** 删除标记:1-删除,0-正常 */
//逻辑删除注解(0 未删除 1 已删除)
@TableLogic
@TableField
(
select
=
false
)
private
Long
isDelete
;
/** 上级手机号 */
@Excel
(
name
=
"上级手机号"
)
private
String
phone
;
/** 上级账号 */
@Excel
(
name
=
"上级账号"
)
private
String
account
;
/** 上级用户昵称 */
@Excel
(
name
=
"上级用户昵称"
)
private
String
nickName
;
/** 下级手机号 */
@Excel
(
name
=
"下级手机号"
)
private
String
newPhone
;
/** 下级账号 */
@Excel
(
name
=
"上级账号"
)
private
String
newAccount
;
/** 下级用户昵称 */
@Excel
(
name
=
"下级用户昵称"
)
private
String
newNickName
;
@Override
public
String
toString
()
{
return
new
ToStringBuilder
(
this
,
ToStringStyle
.
MULTI_LINE_STYLE
)
.
append
(
"id"
,
getId
())
.
append
(
"equityFundType"
,
getEquityFundType
())
.
append
(
"equityFund"
,
getEquityFund
())
.
append
(
"uid"
,
getUid
())
.
append
(
"newUid"
,
getNewUid
())
.
append
(
"terminalTrace"
,
getTerminalTrace
())
.
append
(
"outTradeNo"
,
getOutTradeNo
())
.
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/SharingActivities.java
View file @
f1892cf6
package
share
.
system
.
domain
;
import
com.baomidou.mybatisplus.annotation.
TableName
;
import
com.baomidou.mybatisplus.annotation.
*
;
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
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableLogic
;
import
lombok.Data
;
/**
* 分享活动绑定关系对象 s_sharing_activities
...
...
@@ -21,6 +19,7 @@ public class SharingActivities extends BaseEntity
private
static
final
long
serialVersionUID
=
1L
;
/** 主键 */
@TableId
(
type
=
IdType
.
AUTO
)
private
Long
id
;
/** 活动类型(0-新用户注册,1-权益金会员分享) */
...
...
share-system/src/main/java/share/system/mapper/EquityFundLogMapper.java
0 → 100644
View file @
f1892cf6
package
share
.
system
.
mapper
;
import
java.util.List
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
share.system.domain.EquityFundLog
;
/**
* 权益金记录Mapper接口
*
* @author wuwenlong
* @date 2024-09-10
*/
public
interface
EquityFundLogMapper
extends
BaseMapper
<
EquityFundLog
>
{
/**
* 查询权益金记录
*
* @param id 权益金记录主键
* @return 权益金记录
*/
public
EquityFundLog
selectEquityFundLogById
(
Long
id
);
/**
* 查询权益金记录列表
*
* @param equityFundLog 权益金记录
* @return 权益金记录集合
*/
public
List
<
EquityFundLog
>
selectEquityFundLogList
(
EquityFundLog
equityFundLog
);
/**
* 新增权益金记录
*
* @param equityFundLog 权益金记录
* @return 结果
*/
public
int
insertEquityFundLog
(
EquityFundLog
equityFundLog
);
/**
* 修改权益金记录
*
* @param equityFundLog 权益金记录
* @return 结果
*/
public
int
updateEquityFundLog
(
EquityFundLog
equityFundLog
);
/**
* 删除权益金记录
*
* @param id 权益金记录主键
* @return 结果
*/
public
int
deleteEquityFundLogById
(
Long
id
);
/**
* 批量删除权益金记录
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public
int
deleteEquityFundLogByIds
(
Long
[]
ids
);
}
share-system/src/main/java/share/system/service/DeviceService.java
View file @
f1892cf6
package
share
.
system
.
service
;
import
java.util.List
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
share.common.core.page.TableDataInfo
;
import
share.system.domain.Device
;
import
share.system.domain.DeviceDto
;
import
java.util.List
;
/**
* 设备信息Service接口
*
...
...
@@ -85,5 +86,5 @@ public interface DeviceService extends IService<Device>
TableDataInfo
devicePage
(
DeviceDto
device
);
boolean
updateDeviceDoorLockPassword
(
Integer
validTime
);
boolean
updateDeviceDoorLockPassword
(
Integer
validTime
,
Long
storeId
);
}
share-system/src/main/java/share/system/service/EquityFundLogService.java
0 → 100644
View file @
f1892cf6
package
share
.
system
.
service
;
import
java.util.List
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
share.system.domain.EquityFundLog
;
/**
* 权益金记录Service接口
*
* @author wuwenlong
* @date 2024-09-10
*/
public
interface
EquityFundLogService
extends
IService
<
EquityFundLog
>
{
/**
* 查询权益金记录
*
* @param id 权益金记录主键
* @return 权益金记录
*/
public
EquityFundLog
selectEquityFundLogById
(
Long
id
);
/**
* 查询权益金记录列表
*
* @param equityFundLog 权益金记录
* @return 权益金记录集合
*/
public
List
<
EquityFundLog
>
selectEquityFundLogList
(
EquityFundLog
equityFundLog
);
/**
* 新增权益金记录
*
* @param equityFundLog 权益金记录
* @return 结果
*/
public
int
insertEquityFundLog
(
EquityFundLog
equityFundLog
);
/**
* 修改权益金记录
*
* @param equityFundLog 权益金记录
* @return 结果
*/
public
int
updateEquityFundLog
(
EquityFundLog
equityFundLog
);
/**
* 批量删除权益金记录
*
* @param ids 需要删除的权益金记录主键集合
* @return 结果
*/
public
int
deleteEquityFundLogByIds
(
Long
[]
ids
);
/**
* 删除权益金记录信息
*
* @param id 权益金记录主键
* @return 结果
*/
public
int
deleteEquityFundLogById
(
Long
id
);
}
share-system/src/main/java/share/system/service/SharingActivitiesService.java
View file @
f1892cf6
...
...
@@ -2,6 +2,7 @@ package share.system.service;
import
java.util.List
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
share.common.core.domain.AjaxResult
;
import
share.system.domain.SharingActivities
;
/**
...
...
@@ -59,4 +60,6 @@ public interface SharingActivitiesService extends IService<SharingActivities>
* @return 结果
*/
public
int
deleteSharingActivitiesById
(
Long
id
);
AjaxResult
addSharingActivities
(
SharingActivities
sharingActivities
);
}
share-system/src/main/java/share/system/service/impl/CallbackServiceImpl.java
View file @
f1892cf6
...
...
@@ -7,10 +7,12 @@ import cn.hutool.crypto.SecureUtil;
import
cn.hutool.json.JSONUtil
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.dynamic.datasource.annotation.DSTransactional
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
org.bouncycastle.jce.provider.BouncyCastleProvider
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.stereotype.Service
;
import
share.common.config.SaobeiConfig
;
import
share.common.config.WeChatConfig
;
...
...
@@ -30,6 +32,8 @@ import javax.crypto.Cipher;
import
javax.crypto.spec.SecretKeySpec
;
import
javax.servlet.http.HttpServletRequest
;
import
java.io.UnsupportedEncodingException
;
import
java.math.BigDecimal
;
import
java.math.RoundingMode
;
import
java.nio.charset.StandardCharsets
;
import
java.security.Security
;
import
java.util.*
;
...
...
@@ -79,10 +83,30 @@ public class CallbackServiceImpl implements CallbackService {
@Autowired
private
MonthlyCardOrderService
monthlyCardOrderService
;
@Autowired
private
SharingActivitiesService
sharingActivitiesService
;
@Autowired
private
ISysConfigService
sysConfigService
;
@Autowired
private
EquityFundLogService
equityFundLogService
;
@Autowired
private
ConsumerWalletService
consumerWalletService
;
@Autowired
private
SConsumerService
consumerService
;
@Autowired
private
ConsumerMemberService
consumerMemberService
;
@Autowired
private
RedisTemplate
redisTemplate
;
/**
* 微信支付回调
*/
@DSTransactional
*/
@DSTransactional
@Override
public
String
weChat
(
String
xmlInfo
)
{
StringBuffer
sb
=
new
StringBuffer
();
...
...
@@ -445,6 +469,9 @@ public class CallbackServiceImpl implements CallbackService {
wechatInfo
.
setTradeState
(
"1"
);
wechatInfo
.
setTradeStateDesc
(
"支付成功"
);
wechatPayInfoService
.
updateById
(
wechatInfo
);
//新增权益金日志
addEquityFundLog
(
recharge
.
getConsumerId
(),
recharge
.
getRechargeAmount
(),
recharge
.
getOutTradeNo
(),
recharge
.
getTerminalTrace
(),
"0"
);
aFalse
=
Boolean
.
TRUE
;
}
catch
(
Exception
e
)
{
logger
.
error
(
"微信支付回调出错"
);
...
...
@@ -524,6 +551,9 @@ public class CallbackServiceImpl implements CallbackService {
equityPayInfo
.
setTradeState
(
"1"
);
equityPayInfo
.
setTradeStateDesc
(
"支付成功"
);
wechatPayInfoService
.
updateById
(
equityPayInfo
);
//新增权益金日志
addEquityFundLog
(
equityMembersOrder
.
getConsumerId
(),
equityMembersOrder
.
getPayPrice
(),
equityMembersOrder
.
getEquityOrderNo
(),
equityMembersOrder
.
getTerminalTrace
(),
"1"
);
aBoolean
=
Boolean
.
TRUE
;
}
catch
(
Exception
e
)
{
logger
.
error
(
"微信支付回调出错"
);
...
...
@@ -728,6 +758,76 @@ public class CallbackServiceImpl implements CallbackService {
}
/**
* 新增权益金日志
* @param consumerId 用户ID
* @param payPrice 消费金额
* @param equityOrderNo 订单编号
* @param terminalTrace 终端流水号
* @param type 权益类型
*/
private
void
addEquityFundLog
(
Long
consumerId
,
BigDecimal
payPrice
,
String
equityOrderNo
,
String
terminalTrace
,
String
type
)
{
//查询是否有上级
SharingActivities
sharingActivities
=
sharingActivitiesService
.
getOne
(
new
LambdaQueryWrapper
<
SharingActivities
>()
.
eq
(
SharingActivities:
:
getNewUid
,
consumerId
)
.
eq
(
SharingActivities:
:
getActivityType
,
"1"
)
.
eq
(
SharingActivities:
:
getIsDelete
,
YesNoEnum
.
no
.
getIndex
()));
if
(
ObjectUtil
.
isNotEmpty
(
sharingActivities
))
{
//查询会员用户类型
LambdaQueryWrapper
<
ConsumerMember
>
consumerMemberLambdaQueryWrapper
=
new
LambdaQueryWrapper
<>();
consumerMemberLambdaQueryWrapper
.
eq
(
ConsumerMember:
:
getConsumerId
,
sharingActivities
.
getUid
());
ConsumerMember
consumerMember
=
consumerMemberService
.
getOne
(
consumerMemberLambdaQueryWrapper
);
//判断是否为权益会员和会员是否有效
if
(
"2"
.
equals
(
consumerMember
.
getMemberType
())
&&
new
Date
().
getTime
()
<
consumerMember
.
getExpirationDate
().
getTime
()
){
Boolean
aBoolean
=
redisTemplate
.
hasKey
(
ReceiptRdeisEnum
.
EQUITY_MEMBERS_TIME
+
sharingActivities
.
getUid
().
toString
());
if
(
aBoolean
){
String
equityFund
=
sysConfigService
.
selectConfigByKey
(
"sys.equityFundLog.equityFund"
);
//查询上级用户是否有钱包
ConsumerWallet
consumerWallet
=
consumerWalletService
.
getOne
(
new
LambdaQueryWrapper
<
ConsumerWallet
>()
.
eq
(
ConsumerWallet:
:
getConsumerId
,
sharingActivities
.
getUid
()));
if
(
ObjectUtil
.
isNotEmpty
(
consumerWallet
))
{
consumerWallet
.
setEquityFund
(
consumerWallet
.
getEquityFund
().
add
(
payPrice
.
multiply
(
new
BigDecimal
(
equityFund
))));
consumerWallet
.
setAccumulateEquityFund
(
consumerWallet
.
getAccumulateEquityFund
().
add
(
payPrice
.
multiply
(
new
BigDecimal
(
equityFund
))));
consumerWallet
.
setUpdateTime
(
DateUtils
.
getNowDate
());
consumerWalletService
.
updateConsumerWallet
(
consumerWallet
);
}
else
{
//新增钱包
ConsumerWallet
newConsumerWallet
=
new
ConsumerWallet
();
BigDecimal
defaultVlue
=
new
BigDecimal
(
0.0
);
newConsumerWallet
.
setConsumerId
(
sharingActivities
.
getUid
());
newConsumerWallet
.
setBalance
(
defaultVlue
);
newConsumerWallet
.
setRemainingIntegral
(
defaultVlue
);
newConsumerWallet
.
setRemainingDuration
(
defaultVlue
);
newConsumerWallet
.
setEquityFund
(
consumerWallet
.
getEquityFund
().
add
(
payPrice
.
multiply
(
new
BigDecimal
(
equityFund
).
setScale
(
2
,
RoundingMode
.
HALF_UP
))));
newConsumerWallet
.
setAccumulateEquityFund
(
consumerWallet
.
getAccumulateEquityFund
()
.
add
(
payPrice
.
multiply
(
new
BigDecimal
(
equityFund
).
setScale
(
2
,
RoundingMode
.
HALF_UP
))));
consumerWalletService
.
insertConsumerWallet
(
newConsumerWallet
);
}
//添加权益金日志记录
//下级用户
SConsumer
newConsumer
=
consumerService
.
getById
(
consumerId
);
//上级用户
SConsumer
consumer
=
consumerService
.
getById
(
sharingActivities
.
getUid
());
EquityFundLog
equityFundLog
=
new
EquityFundLog
();
equityFundLog
.
setEquityFund
(
payPrice
.
multiply
(
new
BigDecimal
(
equityFund
).
setScale
(
2
,
RoundingMode
.
HALF_UP
)));
equityFundLog
.
setEquityFundType
(
type
);
equityFundLog
.
setOutTradeNo
(
equityOrderNo
);
equityFundLog
.
setTerminalTrace
(
terminalTrace
);
equityFundLog
.
setUid
(
sharingActivities
.
getUid
());
equityFundLog
.
setNewUid
(
sharingActivities
.
getNewUid
());
equityFundLog
.
setPhone
(
consumer
.
getPhone
());
equityFundLog
.
setAccount
(
consumer
.
getAccount
());
equityFundLog
.
setNickName
(
consumer
.
getNickName
());
equityFundLog
.
setNewPhone
(
newConsumer
.
getPhone
());
equityFundLog
.
setNewAccount
(
newConsumer
.
getAccount
());
equityFundLog
.
setNewNickName
(
newConsumer
.
getNickName
());
equityFundLogService
.
insertEquityFundLog
(
equityFundLog
);
}
}
}
}
/**
* 支付订单回调通知
* @return MyRecord
*/
...
...
@@ -865,4 +965,6 @@ public class CallbackServiceImpl implements CallbackService {
}
return
result
;
}
}
share-system/src/main/java/share/system/service/impl/DeviceServiceImpl.java
View file @
f1892cf6
package
share
.
system
.
service
.
impl
;
import
java.util.ArrayList
;
import
java.util.Comparator
;
import
java.util.Date
;
import
java.util.List
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.util.NumberUtil
;
import
cn.hutool.core.util.ObjectUtil
;
...
...
@@ -12,6 +7,10 @@ import cn.hutool.core.util.StrUtil;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
share.common.core.page.PageDomain
;
import
share.common.core.page.TableDataInfo
;
...
...
@@ -19,15 +18,10 @@ import share.common.core.page.TableSupport;
import
share.common.enums.DeviceOpSourceEnum
;
import
share.common.enums.DeviceType
;
import
share.common.enums.OpTypeEnum
;
import
share.common.utils.BaseUtil
;
import
share.common.utils.DateUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
share.common.utils.SecurityUtils
;
import
share.common.utils.bean.BeanUtils
;
import
share.system.domain.*
;
import
share.system.domain.vo.DeviceVo
;
import
share.system.domain.vo.SStoreVo
;
import
share.system.mapper.DeviceMapper
;
import
share.system.mapper.SRoomMapper
;
import
share.system.mapper.SStoreMapper
;
...
...
@@ -36,6 +30,11 @@ import share.system.service.DevicePasswordLogService;
import
share.system.service.DeviceService
;
import
share.system.service.ISRoomService
;
import
java.util.ArrayList
;
import
java.util.Comparator
;
import
java.util.Date
;
import
java.util.List
;
/**
* 设备信息Service业务层处理
*
...
...
@@ -44,6 +43,9 @@ import share.system.service.ISRoomService;
*/
@Service
public
class
DeviceServiceImpl
extends
ServiceImpl
<
DeviceMapper
,
Device
>
implements
DeviceService
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
DeviceServiceImpl
.
class
);
@Autowired
private
DeviceMapper
deviceMapper
;
@Autowired
...
...
@@ -198,11 +200,11 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
*/
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
boolean
updateDeviceDoorLockPassword
(
Integer
validTime
)
{
public
boolean
updateDeviceDoorLockPassword
(
Integer
validTime
,
Long
storeId
)
{
LambdaQueryWrapper
<
Device
>
queryWrapper
=
new
LambdaQueryWrapper
();
queryWrapper
.
eq
(
Device:
:
getDevType
,
DeviceType
.
DEVICE_CCEE
.
getCode
());
queryWrapper
.
isNotNull
(
Device:
:
getRoomId
);
queryWrapper
.
inSql
(
Device:
:
getRoomId
,
"select id from s_room where room_type not in ('4', '5')
"
);
queryWrapper
.
inSql
(
Device:
:
getRoomId
,
"select id from s_room where room_type not in ('4', '5')
and store_id = "
+
storeId
);
List
<
Device
>
list
=
deviceMapper
.
selectList
(
queryWrapper
);
if
(
list
.
size
()
>
0
)
{
// 默认15天
...
...
@@ -233,6 +235,13 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
deviceOpService
.
setDevicePassword
(
list
.
get
(
i
).
getRoomId
(),
StrUtil
.
toString
(
passwordList
[
i
]),
startTime
,
endTime
,
"13800000000"
,
OpTypeEnum
.
OP_DEVICE_PASSWORD
.
getCode
(),
DeviceOpSourceEnum
.
DEVICE_SOURCE_40
.
getCode
());
// 延时执行操作
try
{
Thread
.
sleep
(
8000
);
}
catch
(
InterruptedException
e
)
{
// e.printStackTrace();
logger
.
error
(
"定期修改门锁设备的开锁密码线程中断:{}"
,
e
.
getMessage
());
}
}
// 修改房间门锁密码
roomService
.
updateBatchById
(
roomList
);
...
...
share-system/src/main/java/share/system/service/impl/EquityFundLogServiceImpl.java
0 → 100644
View file @
f1892cf6
package
share
.
system
.
service
.
impl
;
import
java.util.List
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
share.common.utils.DateUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
share.system.mapper.EquityFundLogMapper
;
import
share.system.domain.EquityFundLog
;
import
share.system.service.EquityFundLogService
;
/**
* 权益金记录Service业务层处理
*
* @author wuwenlong
* @date 2024-09-10
*/
@Service
public
class
EquityFundLogServiceImpl
extends
ServiceImpl
<
EquityFundLogMapper
,
EquityFundLog
>
implements
EquityFundLogService
{
@Autowired
private
EquityFundLogMapper
equityFundLogMapper
;
/**
* 查询权益金记录
*
* @param id 权益金记录主键
* @return 权益金记录
*/
@Override
public
EquityFundLog
selectEquityFundLogById
(
Long
id
)
{
return
equityFundLogMapper
.
selectEquityFundLogById
(
id
);
}
/**
* 查询权益金记录列表
*
* @param equityFundLog 权益金记录
* @return 权益金记录
*/
@Override
public
List
<
EquityFundLog
>
selectEquityFundLogList
(
EquityFundLog
equityFundLog
)
{
return
equityFundLogMapper
.
selectEquityFundLogList
(
equityFundLog
);
}
/**
* 新增权益金记录
*
* @param equityFundLog 权益金记录
* @return 结果
*/
@Override
public
int
insertEquityFundLog
(
EquityFundLog
equityFundLog
)
{
equityFundLog
.
setCreateTime
(
DateUtils
.
getNowDate
());
return
equityFundLogMapper
.
insertEquityFundLog
(
equityFundLog
);
}
/**
* 修改权益金记录
*
* @param equityFundLog 权益金记录
* @return 结果
*/
@Override
public
int
updateEquityFundLog
(
EquityFundLog
equityFundLog
)
{
equityFundLog
.
setUpdateTime
(
DateUtils
.
getNowDate
());
return
equityFundLogMapper
.
updateEquityFundLog
(
equityFundLog
);
}
/**
* 批量删除权益金记录
*
* @param ids 需要删除的权益金记录主键
* @return 结果
*/
@Override
public
int
deleteEquityFundLogByIds
(
Long
[]
ids
)
{
return
equityFundLogMapper
.
deleteEquityFundLogByIds
(
ids
);
}
/**
* 删除权益金记录信息
*
* @param id 权益金记录主键
* @return 结果
*/
@Override
public
int
deleteEquityFundLogById
(
Long
id
)
{
return
equityFundLogMapper
.
deleteEquityFundLogById
(
id
);
}
}
share-system/src/main/java/share/system/service/impl/SConsumerCenterServiceImpl.java
View file @
f1892cf6
...
...
@@ -317,7 +317,7 @@ public class SConsumerCenterServiceImpl extends ServiceImpl<SConsumerMapper, SCo
sharingActivities
.
setUid
(
uid
);
sharingActivities
.
setNewUid
(
id
);
sharingActivities
.
setCreateTime
(
DateUtils
.
getNowDate
());
sharingActivitiesService
.
save
(
sharingActivities
);
sharingActivitiesService
.
insertSharingActivities
(
sharingActivities
);
}
}
sConsumerTokenService
.
bind
(
registerThirdSConsumerRequest
.
getOpenId
(),
finalSConsumer
.
getId
(),
response
.
getUnionId
());
...
...
share-system/src/main/java/share/system/service/impl/SOrderServiceImpl.java
View file @
f1892cf6
...
...
@@ -2599,8 +2599,9 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
Cron
cron
=
cronParser
.
parse
(
activity
.
getCronExpression
());
ExecutionTime
executionTime
=
ExecutionTime
.
forCron
(
cron
);
boolean
match
=
executionTime
.
isMatch
(
ZonedDateTime
.
ofInstant
(
request
.
getPreStartDate
().
toInstant
(),
ZoneId
.
systemDefault
()));
boolean
match1
=
executionTime
.
isMatch
(
ZonedDateTime
.
ofInstant
(
request
.
getPreEndDate
().
toInstant
(),
ZoneId
.
systemDefault
()));
if
(
match
&&
match1
&&
priceResponse
.
getDiscount
().
compareTo
(
activity
.
getDiscountRatio
())
==
0
)
{
// boolean match1 = executionTime.isMatch(ZonedDateTime.ofInstant(request.getPreEndDate().toInstant(), ZoneId.systemDefault()));
// if (match && match1 && priceResponse.getDiscount().compareTo(activity.getDiscountRatio()) == 0) {
if
(
match
&&
priceResponse
.
getDiscount
().
compareTo
(
activity
.
getDiscountRatio
())
==
0
)
{
if
(
consumerWallet
.
getBalance
().
compareTo
(
totalFee
)
>=
0
)
{
priceResponse
.
setBalance
(
totalFee
);
priceResponse
.
setRemainingBalance
(
consumerWallet
.
getBalance
().
subtract
(
totalFee
));
...
...
@@ -2688,8 +2689,9 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
Cron
cron
=
cronParser
.
parse
(
activity
.
getCronExpression
());
ExecutionTime
executionTime
=
ExecutionTime
.
forCron
(
cron
);
boolean
match
=
executionTime
.
isMatch
(
ZonedDateTime
.
ofInstant
(
request
.
getPreStartDate
().
toInstant
(),
ZoneId
.
systemDefault
()));
boolean
match1
=
executionTime
.
isMatch
(
ZonedDateTime
.
ofInstant
(
request
.
getPreEndDate
().
toInstant
(),
ZoneId
.
systemDefault
()));
if
(
match
&&
match1
&&
priceResponse
.
getDiscount
().
compareTo
(
activity
.
getDiscountRatio
())
==
0
)
{
// boolean match1 = executionTime.isMatch(ZonedDateTime.ofInstant(request.getPreEndDate().toInstant(), ZoneId.systemDefault()));
// if (match && match1 && priceResponse.getDiscount().compareTo(activity.getDiscountRatio()) == 0) {
if
(
match
&&
priceResponse
.
getDiscount
().
compareTo
(
activity
.
getDiscountRatio
())
==
0
)
{
if
(
consumerWallet
.
getBalance
().
compareTo
(
totalFee
)
>=
0
)
{
priceResponse
.
setTotalFeeNow
(
totalFee
);
priceResponse
.
setMemberDiscount
(
totalFee
);
...
...
@@ -2771,8 +2773,9 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
List
<
SOrder
>
orderList
=
list
(
queryWrapper
);
if
(
CollectionUtils
.
isEmpty
(
orderList
))
{
boolean
match
=
executionTime
.
isMatch
(
ZonedDateTime
.
ofInstant
(
request
.
getPreStartDate
().
toInstant
(),
ZoneId
.
systemDefault
()));
boolean
match1
=
executionTime
.
isMatch
(
ZonedDateTime
.
ofInstant
(
request
.
getPreEndDate
().
toInstant
(),
ZoneId
.
systemDefault
()));
if
(
match
&&
match1
)
{
// boolean match1 = executionTime.isMatch(ZonedDateTime.ofInstant(request.getPreEndDate().toInstant(), ZoneId.systemDefault()));
// if (match && match1) {
if
(
match
)
{
payPrice
=
payPrice
.
multiply
(
activity
.
getDiscountRatio
()).
divide
(
new
BigDecimal
(
100
),
2
,
RoundingMode
.
HALF_UP
);
}
else
{
...
...
@@ -2782,8 +2785,9 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
AtomicInteger
i
=
new
AtomicInteger
();
orderList
.
stream
().
forEach
(
item
->
{
boolean
match
=
executionTime
.
isMatch
(
ZonedDateTime
.
ofInstant
(
item
.
getPreStartDate
().
toInstant
(),
ZoneId
.
systemDefault
()));
boolean
match1
=
executionTime
.
isMatch
(
ZonedDateTime
.
ofInstant
(
item
.
getPreEndDate
().
toInstant
(),
ZoneId
.
systemDefault
()));
if
(
match
&&
match1
// boolean match1 = executionTime.isMatch(ZonedDateTime.ofInstant(item.getPreEndDate().toInstant(), ZoneId.systemDefault()));
// if (match && match1
if
(
match
&&
item
.
getDuration
().
compareTo
(
BigDecimal
.
ZERO
)
==
0
&&
(
item
.
getPayPrice
().
add
(
item
.
getBalance
())).
divide
(
item
.
getTotalPrice
(),
2
,
RoundingMode
.
HALF_UP
)
.
multiply
(
new
BigDecimal
(
100
)).
compareTo
(
activity
.
getDiscountRatio
())
==
0
...
...
@@ -2793,8 +2797,9 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
});
if
(
i
.
get
()
==
0
)
{
boolean
match
=
executionTime
.
isMatch
(
ZonedDateTime
.
ofInstant
(
request
.
getPreStartDate
().
toInstant
(),
ZoneId
.
systemDefault
()));
boolean
match1
=
executionTime
.
isMatch
(
ZonedDateTime
.
ofInstant
(
request
.
getPreEndDate
().
toInstant
(),
ZoneId
.
systemDefault
()));
if
(
match
&&
match1
)
{
// boolean match1 = executionTime.isMatch(ZonedDateTime.ofInstant(request.getPreEndDate().toInstant(), ZoneId.systemDefault()));
// if (match && match1) {
if
(
match
)
{
payPrice
=
payPrice
.
multiply
(
activity
.
getDiscountRatio
()).
divide
(
new
BigDecimal
(
100
),
2
,
RoundingMode
.
HALF_UP
);
}
else
{
payPrice
=
payPrice
.
multiply
(
memberConfig
.
getDiscountRatio
()).
divide
(
new
BigDecimal
(
100
),
2
,
RoundingMode
.
HALF_UP
);
...
...
share-system/src/main/java/share/system/service/impl/SharingActivitiesServiceImpl.java
View file @
f1892cf6
package
share
.
system
.
service
.
impl
;
import
java.util.List
;
import
java.util.Set
;
import
cn.hutool.core.util.ObjectUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
share.common.core.domain.AjaxResult
;
import
share.common.core.redis.RedisUtil
;
import
share.common.enums.ReceiptRdeisEnum
;
import
share.common.utils.DateUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -21,6 +29,9 @@ public class SharingActivitiesServiceImpl extends ServiceImpl<SharingActivitiesM
@Autowired
private
SharingActivitiesMapper
sharingActivitiesMapper
;
@Autowired
private
RedisTemplate
redisTemplate
;
/**
* 查询分享活动绑定关系
*
...
...
@@ -54,7 +65,8 @@ public class SharingActivitiesServiceImpl extends ServiceImpl<SharingActivitiesM
@Override
public
int
insertSharingActivities
(
SharingActivities
sharingActivities
)
{
sharingActivities
.
setCreateTime
(
DateUtils
.
getNowDate
());
return
sharingActivitiesMapper
.
insertSharingActivities
(
sharingActivities
);
}
...
...
@@ -94,4 +106,29 @@ public class SharingActivitiesServiceImpl extends ServiceImpl<SharingActivitiesM
{
return
sharingActivitiesMapper
.
deleteSharingActivitiesById
(
id
);
}
/**
* 新增分享活动绑定关系
* @param sharingActivities
* @return
*/
@Override
public
AjaxResult
addSharingActivities
(
SharingActivities
sharingActivities
)
{
sharingActivities
.
setCreateTime
(
DateUtils
.
getNowDate
());
Long
newUid
=
sharingActivities
.
getNewUid
();
SharingActivities
sharingActivities1
=
sharingActivitiesMapper
.
selectOne
(
new
LambdaQueryWrapper
<
SharingActivities
>().
eq
(
SharingActivities:
:
getNewUid
,
newUid
));
if
(
ObjectUtil
.
isNotEmpty
(
sharingActivities1
)){
return
AjaxResult
.
success
(
"此用户以绑定其他权益会员"
);
}
Boolean
B
=
redisTemplate
.
hasKey
(
ReceiptRdeisEnum
.
EQUITY_MEMBERS_TIME
+
sharingActivities
.
getUid
().
toString
());
if
(!
B
){
return
AjaxResult
.
success
(
"分享用户权益过期"
);
}
sharingActivitiesMapper
.
insertSharingActivities
(
sharingActivities
);
Boolean
aBoolean
=
redisTemplate
.
hasKey
(
ReceiptRdeisEnum
.
EQUITY_MEMBERS_TIME
+
sharingActivities
.
getUid
().
toString
());
if
(!
aBoolean
){
sharingActivitiesMapper
.
deleteSharingActivitiesById
(
sharingActivities
.
getId
());
}
return
AjaxResult
.
success
();
}
}
share-system/src/main/resources/mapper/system/EquityFundLogMapper.xml
0 → 100644
View file @
f1892cf6
<?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.EquityFundLogMapper"
>
<resultMap
type=
"EquityFundLog"
id=
"EquityFundLogResult"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"equityFundType"
column=
"equity_fund_type"
/>
<result
property=
"equityFund"
column=
"equity_fund"
/>
<result
property=
"uid"
column=
"uid"
/>
<result
property=
"newUid"
column=
"new_uid"
/>
<result
property=
"terminalTrace"
column=
"terminal_trace"
/>
<result
property=
"outTradeNo"
column=
"out_trade_no"
/>
<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"
/>
<result
property=
"account"
column=
"account"
/>
<result
property=
"nickName"
column=
"nick_name"
/>
<result
property=
"phone"
column=
"phone"
/>
<result
property=
"newAccount"
column=
"new_account"
/>
<result
property=
"newNickName"
column=
"new_nick_name"
/>
<result
property=
"newPhone"
column=
"new_phone"
/>
</resultMap>
<sql
id=
"selectEquityFundLogVo"
>
select id, equity_fund_type, equity_fund,
, new_uid, terminal_trace, out_trade_no, is_delete,
create_by, create_time, update_by, update_time, remark,
account,nick_name,phone,new_account,new_nick_name,new_phone
from s_equity_fund_log
</sql>
<select
id=
"selectEquityFundLogList"
parameterType=
"EquityFundLog"
resultMap=
"EquityFundLogResult"
>
<include
refid=
"selectEquityFundLogVo"
/>
<where>
<if
test=
"equityFundType != null and equityFundType != ''"
>
and equity_fund_type = #{equityFundType}
</if>
<if
test=
"equityFund != null "
>
and equity_fund = #{equityFund}
</if>
<if
test=
"uid != null "
>
and uid = #{uid}
</if>
<if
test=
"newUid != null "
>
and new_uid = #{newUid}
</if>
<if
test=
"terminalTrace != null and terminalTrace != ''"
>
and terminal_trace = #{terminalTrace}
</if>
<if
test=
"outTradeNo != null and outTradeNo != ''"
>
and out_trade_no = #{outTradeNo}
</if>
<if
test=
"isDelete != null "
>
and is_delete = #{isDelete}
</if>
</where>
</select>
<select
id=
"selectEquityFundLogById"
parameterType=
"Long"
resultMap=
"EquityFundLogResult"
>
<include
refid=
"selectEquityFundLogVo"
/>
where id = #{id}
</select>
<insert
id=
"insertEquityFundLog"
parameterType=
"EquityFundLog"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into s_equity_fund_log
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"equityFundType != null and equityFundType != ''"
>
equity_fund_type,
</if>
<if
test=
"equityFund != null"
>
equity_fund,
</if>
<if
test=
"uid != null"
>
uid,
</if>
<if
test=
"newUid != null"
>
new_uid,
</if>
<if
test=
"terminalTrace != null"
>
terminal_trace,
</if>
<if
test=
"outTradeNo != null"
>
out_trade_no,
</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>
<if
test=
"account != null"
>
account,
</if>
<if
test=
"nickName != null"
>
nickName,
</if>
<if
test=
"phone != null"
>
phone,
</if>
<if
test=
"newAccount != null"
>
new_account,
</if>
<if
test=
"newNickName != null"
>
new_nickName,
</if>
<if
test=
"newPhone != null"
>
new_phone,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"equityFundType != null and equityFundType != ''"
>
#{equityFundType},
</if>
<if
test=
"equityFund != null"
>
#{equityFund},
</if>
<if
test=
"uid != null"
>
#{uid},
</if>
<if
test=
"newUid != null"
>
#{newUid},
</if>
<if
test=
"terminalTrace != null"
>
#{terminalTrace},
</if>
<if
test=
"outTradeNo != null"
>
#{outTradeNo},
</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>
<if
test=
"account != null"
>
#{account},
</if>
<if
test=
"nickName != null"
>
#{nickName},
</if>
<if
test=
"phone != null"
>
#{phone},
</if>
<if
test=
"newAccount != null"
>
#{new_account},
</if>
<if
test=
"newNickName != null"
>
#{new_nickName},
</if>
<if
test=
"newPhone != null"
>
#{new_phone},
</if>
</trim>
</insert>
<update
id=
"updateEquityFundLog"
parameterType=
"EquityFundLog"
>
update s_equity_fund_log
<trim
prefix=
"SET"
suffixOverrides=
","
>
<if
test=
"equityFundType != null and equityFundType != ''"
>
equity_fund_type = #{equityFundType},
</if>
<if
test=
"equityFund != null"
>
equity_fund = #{equityFund},
</if>
<if
test=
"uid != null"
>
uid = #{uid},
</if>
<if
test=
"newUid != null"
>
new_uid = #{newUid},
</if>
<if
test=
"terminalTrace != null"
>
terminal_trace = #{terminalTrace},
</if>
<if
test=
"outTradeNo != null"
>
out_trade_no = #{outTradeNo},
</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=
"deleteEquityFundLogById"
parameterType=
"Long"
>
delete from s_equity_fund_log where id = #{id}
</delete>
<delete
id=
"deleteEquityFundLogByIds"
parameterType=
"String"
>
delete from s_equity_fund_log where id in
<foreach
item=
"id"
collection=
"array"
open=
"("
separator=
","
close=
")"
>
#{id}
</foreach>
</delete>
</mapper>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment