Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
cms
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
iuav
cms
Commits
9327e999
提交
9327e999
authored
8月 22, 2023
作者:
xiaowang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
用户钱包的扣除
上级
8b2197a6
隐藏空白字符变更
内嵌
并排
正在显示
13 个修改的文件
包含
1273 行增加
和
105 行删除
+1273
-105
FlyerWalletFlowVO.java
.../com/mmc/iuav/user/model/vo/wallet/FlyerWalletFlowVO.java
+49
-0
PublisherWalletFlowVO.java
.../mmc/iuav/user/model/vo/wallet/PublisherWalletFlowVO.java
+72
-0
TopUpCashVO.java
...n/java/com/mmc/iuav/user/model/vo/wallet/TopUpCashVO.java
+24
-0
WalletFlowVO.java
.../java/com/mmc/iuav/user/model/vo/wallet/WalletFlowVO.java
+24
-0
PayWalletController.java
.../mmc/iuav/user/controller/wallet/PayWalletController.java
+18
-4
PayWalletDao.java
.../main/java/com/mmc/iuav/user/dao/wallet/PayWalletDao.java
+5
-0
PayLogDO.java
...c/main/java/com/mmc/iuav/user/entity/wallet/PayLogDO.java
+11
-101
PayWalletDO.java
...ain/java/com/mmc/iuav/user/entity/wallet/PayWalletDO.java
+3
-0
PayMethodEnums.java
...src/main/java/com/mmc/iuav/user/enums/PayMethodEnums.java
+37
-0
PayWalletService.java
...va/com/mmc/iuav/user/service/wallet/PayWalletService.java
+3
-0
PayWalletServiceImpl.java
...c/iuav/user/service/wallet/impl/PayWalletServiceImpl.java
+379
-0
TDateUtil.java
...-user/src/main/java/com/mmc/iuav/user/util/TDateUtil.java
+612
-0
PayWalletDao.xml
...ce-user/src/main/resources/mapper/wallet/PayWalletDao.xml
+36
-0
没有找到文件。
cms-common/cms-common-model/src/main/java/com/mmc/iuav/user/model/vo/wallet/FlyerWalletFlowVO.java
0 → 100644
浏览文件 @
9327e999
package
com
.
mmc
.
iuav
.
user
.
model
.
vo
.
wallet
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.math.BigDecimal
;
import
java.util.Date
;
/**
* @author 23214
* 飞手方钱包记录
*/
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
public
class
FlyerWalletFlowVO
{
@ApiModelProperty
(
value
=
"用户ID"
)
private
Integer
userAccountId
;
@ApiModelProperty
(
value
=
"支付方式 100(订单发布) 200(无人接单取消订单)300(有人接单取消订单)400(飞手抢单)500(客服判定飞手无责取消订单)600(飞手有责取消订单)700(正常结算)800(修改订单金额状态)900(飞手未确认修改金额状态)1000(飞手确认修改金额状态)"
)
private
Integer
modeOfPayment
;
@ApiModelProperty
(
value
=
"云享金(需要正负)"
)
private
BigDecimal
cashAmount
;
@ApiModelProperty
(
value
=
"佣金(需要正负)"
)
private
BigDecimal
salaryAmount
;
@ApiModelProperty
(
value
=
"支付时间"
)
private
Date
timeOfPayment
;
@ApiModelProperty
(
value
=
"操作者用户id"
)
private
Integer
operateUserAccountId
;
@ApiModelProperty
(
value
=
"云享金违约金(需要正负)"
)
private
BigDecimal
yxjCashPledge
;
@ApiModelProperty
(
value
=
"佣金违约金(需要正负)"
)
private
BigDecimal
salaryCashPledge
;
@ApiModelProperty
(
value
=
"订单的百分比违约金(这笔钱是给发布方的)"
)
private
BigDecimal
percentagePenaltyOfOrder
;
}
\ No newline at end of file
cms-common/cms-common-model/src/main/java/com/mmc/iuav/user/model/vo/wallet/PublisherWalletFlowVO.java
0 → 100644
浏览文件 @
9327e999
package
com
.
mmc
.
iuav
.
user
.
model
.
vo
.
wallet
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.math.BigDecimal
;
import
java.util.Date
;
/**
* @author 23214
* 发布方钱包记录
*/
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
public
class
PublisherWalletFlowVO
{
@ApiModelProperty
(
value
=
"用户ID"
)
private
Integer
userAccountId
;
@ApiModelProperty
(
value
=
"支付方式 100(订单发布) 200(无人接单取消订单)300(有人接单取消订单)400(飞手抢单)500(客服判定飞手无责取消订单)"
+
"600(飞手有责取消订单)700(正常结算)800(修改订单金额状态)900(飞手未确认修改金额状态)1000(飞手确认修改金额状态)"
)
private
Integer
modeOfPayment
;
@ApiModelProperty
(
value
=
"云享金(需要正负)注:结算时修改金额如果大于原订单,需要支付的云享金,也传这个字段"
)
private
BigDecimal
cashAmount
;
@ApiModelProperty
(
value
=
"佣金(需要正负)注:结算时修改金额如果大于原订单,需要支付的佣金,也传这个字段"
)
private
BigDecimal
salaryAmount
;
@ApiModelProperty
(
value
=
"支付时间"
)
private
Date
timeOfPayment
;
@ApiModelProperty
(
value
=
"操作者用户id"
)
private
Integer
operateUserAccountId
;
@ApiModelProperty
(
value
=
"云享金违约金(需要正负)"
)
private
BigDecimal
yxjCashPledge
;
@ApiModelProperty
(
value
=
"佣金违约金(需要正负)"
)
private
BigDecimal
salaryCashPledge
;
@ApiModelProperty
(
value
=
"订单的百分比违约金(这笔钱是给飞手的) (需要正负)"
)
private
BigDecimal
percentagePenaltyOfOrder
;
@ApiModelProperty
(
value
=
"加急单云享金金额 (需要正负)"
)
private
BigDecimal
urgentYxjAmount
;
@ApiModelProperty
(
value
=
"加急单佣金金额 (需要正负)"
)
private
BigDecimal
urgentSalaryAmount
;
@ApiModelProperty
(
value
=
"置顶单云享金金额 (需要正负)"
)
private
BigDecimal
topYxjAmount
;
@ApiModelProperty
(
value
=
"置顶单佣金金额 (需要正负)"
)
private
BigDecimal
topSalaryAmount
;
@ApiModelProperty
(
value
=
"飞手应得订单金额 (正数)"
)
private
BigDecimal
flyerSalaryAmount
;
@ApiModelProperty
(
value
=
"修改后金额(注:①飞手未确认时,后面支付的需要退的佣金那部分钱 ②飞手确认时,修改后的金额小于原佣金,需要退多余的佣金那部分钱 ③如果全部是微信支付的则不用传值)"
)
private
BigDecimal
refundSalaryAmount
;
@ApiModelProperty
(
value
=
"修改后金额(注:①飞手未确认时,后面支付的需要退的云享金那部分钱 ②飞手确认时,修改后的金额小于原佣金,需要退多余的云享金那部分钱 ③如果全部是微信支付的则不用传值)"
)
private
BigDecimal
refundCashAmount
;
}
\ No newline at end of file
cms-common/cms-common-model/src/main/java/com/mmc/iuav/user/model/vo/wallet/TopUpCashVO.java
0 → 100644
浏览文件 @
9327e999
package
com
.
mmc
.
iuav
.
user
.
model
.
vo
.
wallet
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
/**
* @Author LW
* @date 2023/8/19 16:24
* 概要:
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public
class
TopUpCashVO
{
private
Integer
userAccountId
;
private
String
orderNo
;
private
Integer
amount
;
private
String
tradeState
;
}
cms-common/cms-common-model/src/main/java/com/mmc/iuav/user/model/vo/wallet/WalletFlowVO.java
0 → 100644
浏览文件 @
9327e999
package
com
.
mmc
.
iuav
.
user
.
model
.
vo
.
wallet
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.io.Serializable
;
/**
* @Author LW
* @date 2023/8/21 17:59
* 概要:
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public
class
WalletFlowVO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
8848411142632397203L
;
private
PublisherWalletFlowVO
publisherWalletFlowVO
;
private
FlyerWalletFlowVO
flyerWalletFlowVO
;
}
csm-service/cms-service-user/src/main/java/com/mmc/iuav/user/controller/wallet/PayWalletController.java
浏览文件 @
9327e999
...
...
@@ -3,12 +3,10 @@ package com.mmc.iuav.user.controller.wallet;
import
com.mmc.iuav.response.ResultBody
;
import
com.mmc.iuav.user.controller.BaseController
;
import
com.mmc.iuav.user.model.dto.wallet.PayWalletDTO
;
import
com.mmc.iuav.user.model.vo.wallet.WalletFlowVO
;
import
com.mmc.iuav.user.service.wallet.PayWalletService
;
import
io.swagger.annotations.*
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.*
;
import
springfox.documentation.annotations.ApiIgnore
;
import
javax.annotation.Resource
;
...
...
@@ -50,4 +48,20 @@ public class PayWalletController extends BaseController {
return
payWalletService
.
initPayWallet
(
userAccountId
);
}
@ApiOperation
(
value
=
"feign-云享金充值接口"
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
ResultBody
.
class
)})
@ApiIgnore
@GetMapping
(
"feignTopUpCash"
)
public
ResultBody
feignTopUpCash
(
@RequestParam
Integer
userAccountId
)
{
// return payWalletService.feignTopUpCash(userAccountId);
return
null
;
}
@ApiOperation
(
value
=
"feign-钱包流水记录"
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
ResultBody
.
class
)})
@PostMapping
(
"feignWalletFlow"
)
public
ResultBody
feignWalletFlow
(
@RequestBody
WalletFlowVO
walletFlowVO
)
{
return
payWalletService
.
feignWalletFlow
(
walletFlowVO
);
}
}
csm-service/cms-service-user/src/main/java/com/mmc/iuav/user/dao/wallet/PayWalletDao.java
浏览文件 @
9327e999
package
com
.
mmc
.
iuav
.
user
.
dao
.
wallet
;
import
com.mmc.iuav.user.entity.wallet.PayLogDO
;
import
com.mmc.iuav.user.entity.wallet.PayWalletDO
;
import
org.apache.ibatis.annotations.Mapper
;
...
...
@@ -13,4 +14,8 @@ public interface PayWalletDao {
PayWalletDO
getPayWalletByUser
(
Integer
userAccountId
);
void
insertPayWalletInfo
(
PayWalletDO
wallet
);
void
insertPayLogDO
(
PayLogDO
payWalletDO
);
int
updatePayWallet
(
PayWalletDO
updatePayWallet
);
}
csm-service/cms-service-user/src/main/java/com/mmc/iuav/user/entity/wallet/PayLogDO.java
浏览文件 @
9327e999
package
com
.
mmc
.
iuav
.
user
.
entity
.
wallet
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
import
java.util.Date
;
/**
...
...
@@ -9,6 +14,9 @@ import java.util.Date;
* @author makejava
* @since 2023-08-18 16:18:01
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public
class
PayLogDO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
752682324297846133L
;
...
...
@@ -26,17 +34,17 @@ public class PayLogDO implements Serializable {
*/
private
String
payNo
;
/**
* 0手动变更(大于0充值or小于0扣除)
100订单扣除 150订单冻结 200订单完成 250
提现扣除
* 0手动变更(大于0充值or小于0扣除)
50订单取消 100订单扣除 150订单冻结 200订单完成 250充值 300
提现扣除
*/
private
Integer
payMethod
;
/**
* 云享金变动金额(正数充值,负数扣除)
*/
private
Double
cashAmtPaid
;
private
BigDecimal
cashAmtPaid
;
/**
* 佣金变动金额(正数入账,负数扣除)
*/
private
Double
salaryAmtPaid
;
private
BigDecimal
salaryAmtPaid
;
/**
* 支付时间
*/
...
...
@@ -53,103 +61,5 @@ public class PayLogDO implements Serializable {
private
Date
createTime
;
private
Date
updateTime
;
public
Integer
getId
()
{
return
id
;
}
public
void
setId
(
Integer
id
)
{
this
.
id
=
id
;
}
public
Integer
getUserAccountId
()
{
return
userAccountId
;
}
public
void
setUserAccountId
(
Integer
userAccountId
)
{
this
.
userAccountId
=
userAccountId
;
}
public
Integer
getOrderNo
()
{
return
orderNo
;
}
public
void
setOrderNo
(
Integer
orderNo
)
{
this
.
orderNo
=
orderNo
;
}
public
String
getPayNo
()
{
return
payNo
;
}
public
void
setPayNo
(
String
payNo
)
{
this
.
payNo
=
payNo
;
}
public
Integer
getPayMethod
()
{
return
payMethod
;
}
public
void
setPayMethod
(
Integer
payMethod
)
{
this
.
payMethod
=
payMethod
;
}
public
Double
getCashAmtPaid
()
{
return
cashAmtPaid
;
}
public
void
setCashAmtPaid
(
Double
cashAmtPaid
)
{
this
.
cashAmtPaid
=
cashAmtPaid
;
}
public
Double
getSalaryAmtPaid
()
{
return
salaryAmtPaid
;
}
public
void
setSalaryAmtPaid
(
Double
salaryAmtPaid
)
{
this
.
salaryAmtPaid
=
salaryAmtPaid
;
}
public
Date
getPayTime
()
{
return
payTime
;
}
public
void
setPayTime
(
Date
payTime
)
{
this
.
payTime
=
payTime
;
}
public
String
getRemark
()
{
return
remark
;
}
public
void
setRemark
(
String
remark
)
{
this
.
remark
=
remark
;
}
public
Integer
getOperateUser
()
{
return
operateUser
;
}
public
void
setOperateUser
(
Integer
operateUser
)
{
this
.
operateUser
=
operateUser
;
}
public
Date
getCreateTime
()
{
return
createTime
;
}
public
void
setCreateTime
(
Date
createTime
)
{
this
.
createTime
=
createTime
;
}
public
Date
getUpdateTime
()
{
return
updateTime
;
}
public
void
setUpdateTime
(
Date
updateTime
)
{
this
.
updateTime
=
updateTime
;
}
}
csm-service/cms-service-user/src/main/java/com/mmc/iuav/user/entity/wallet/PayWalletDO.java
浏览文件 @
9327e999
...
...
@@ -53,6 +53,8 @@ public class PayWalletDO implements Serializable {
*/
private
BigDecimal
salaryFreeze
;
private
BigDecimal
wxCashFreeze
;
/**
* 提现总额
*/
...
...
@@ -78,6 +80,7 @@ public class PayWalletDO implements Serializable {
this
.
salaryPaid
=
BigDecimal
.
ZERO
;
this
.
salaryFreeze
=
BigDecimal
.
ZERO
;
this
.
salaryWdl
=
BigDecimal
.
ZERO
;
this
.
wxCashFreeze
=
BigDecimal
.
ZERO
;
}
}
csm-service/cms-service-user/src/main/java/com/mmc/iuav/user/enums/PayMethodEnums.java
0 → 100644
浏览文件 @
9327e999
package
com
.
mmc
.
iuav
.
user
.
enums
;
/**
* @Author LW
* @date 2023/8/19 18:53
* 概要:
*/
public
enum
PayMethodEnums
{
PUBLISH_ORDER
(
100
,
"订单发布"
),
CANCEL_ORDER_TAKING
(
200
,
"未接单时取消订单"
),
RECEIVED_ORDER_CANCEL
(
300
,
"已接单取消订单"
),
FLYING_ORDER_TAKING
(
400
,
"飞手抢单"
),
CUSTOMER_SERVICE_CANCEL_ORDER
(
500
,
"客服判定飞手无责取消订单"
),
FLYER_CANCEL_ORDER
(
600
,
"飞手有责取消订单"
),
NORMAL_SETTLEMENT
(
700
,
"正常结算"
),
MODIFY_THE_ORDER
(
800
,
"修改订单金额状态(大于)"
),
FLYING_HAND_NOT_CONFIRMED_GT
(
900
,
"飞手未确认修改金额大于原订单状态"
),
FLYING_HAND_CONFIRM_GT
(
1000
,
"飞手确认修改金额大于原订单状态"
),
FLYING_HAND_CONFIRM_LT
(
1000
,
"飞手确认修改金额小于原订单状态"
);
PayMethodEnums
(
Integer
code
,
String
method
)
{
this
.
code
=
code
;
this
.
method
=
method
;
}
private
Integer
code
;
private
String
method
;
public
Integer
getCode
()
{
return
this
.
code
;
}
public
String
getMethod
()
{
return
this
.
method
;
}
}
csm-service/cms-service-user/src/main/java/com/mmc/iuav/user/service/wallet/PayWalletService.java
浏览文件 @
9327e999
package
com
.
mmc
.
iuav
.
user
.
service
.
wallet
;
import
com.mmc.iuav.response.ResultBody
;
import
com.mmc.iuav.user.model.vo.wallet.WalletFlowVO
;
/**
* @Author LW
...
...
@@ -11,4 +12,6 @@ public interface PayWalletService {
ResultBody
getPayWalletInfo
(
Integer
userAccountId
);
ResultBody
initPayWallet
(
Integer
userAccountId
);
ResultBody
feignWalletFlow
(
WalletFlowVO
walletFlowVO
);
}
csm-service/cms-service-user/src/main/java/com/mmc/iuav/user/service/wallet/impl/PayWalletServiceImpl.java
浏览文件 @
9327e999
package
com
.
mmc
.
iuav
.
user
.
service
.
wallet
.
impl
;
import
com.mmc.iuav.general.CodeUtil
;
import
com.mmc.iuav.response.ResultBody
;
import
com.mmc.iuav.user.dao.wallet.PayWalletDao
;
import
com.mmc.iuav.user.entity.wallet.PayLogDO
;
import
com.mmc.iuav.user.entity.wallet.PayWalletDO
;
import
com.mmc.iuav.user.enums.PayMethodEnums
;
import
com.mmc.iuav.user.model.dto.wallet.PayWalletDTO
;
import
com.mmc.iuav.user.model.vo.wallet.FlyerWalletFlowVO
;
import
com.mmc.iuav.user.model.vo.wallet.PublisherWalletFlowVO
;
import
com.mmc.iuav.user.model.vo.wallet.WalletFlowVO
;
import
com.mmc.iuav.user.service.wallet.PayWalletService
;
import
com.mmc.iuav.user.util.TDateUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
import
java.math.BigDecimal
;
import
java.util.Date
;
/**
* @Author LW
...
...
@@ -15,6 +26,7 @@ import javax.annotation.Resource;
* 概要:
*/
@Service
@Slf4j
public
class
PayWalletServiceImpl
implements
PayWalletService
{
@Resource
PayWalletDao
payWalletDao
;
...
...
@@ -38,4 +50,371 @@ public class PayWalletServiceImpl implements PayWalletService {
payWalletDao
.
insertPayWalletInfo
(
wallet
);
return
ResultBody
.
success
();
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ResultBody
feignWalletFlow
(
WalletFlowVO
walletFlowVO
)
{
// 获取发布者的信息
PublisherWalletFlowVO
publisherWalletFlowVO
=
walletFlowVO
.
getPublisherWalletFlowVO
();
// 获取接单者的信息
FlyerWalletFlowVO
flyerWalletFlowVO
=
walletFlowVO
.
getFlyerWalletFlowVO
();
// 发布者的钱包信息
PayWalletDO
publishWallet
=
new
PayWalletDO
();
// 接单者的钱包信息
PayWalletDO
flyerWallet
=
new
PayWalletDO
();
// 获取用户钱包信息
if
(
publisherWalletFlowVO
!=
null
)
{
publishWallet
=
payWalletDao
.
getPayWalletByUser
(
publisherWalletFlowVO
.
getUserAccountId
());
}
if
(
flyerWalletFlowVO
!=
null
)
{
flyerWallet
=
payWalletDao
.
getPayWalletByUser
(
flyerWalletFlowVO
.
getUserAccountId
());
}
// 判断状态进行资金的扣减等于100时 发布订单
if
(
publisherWalletFlowVO
!=
null
&&
publisherWalletFlowVO
.
getModeOfPayment
().
equals
(
PayMethodEnums
.
PUBLISH_ORDER
.
getCode
()))
{
PayWalletDO
publishUpdatePayWallet
=
new
PayWalletDO
();
publishUpdatePayWallet
.
setUserAccountId
(
publisherWalletFlowVO
.
getUserAccountId
());
publishUpdatePayWallet
.
setPid
(
publishWallet
.
getPid
());
publishUpdatePayWallet
.
setCashAmt
(
publishWallet
.
getCashAmt
().
add
(
publisherWalletFlowVO
.
getCashAmount
())
.
add
(
publisherWalletFlowVO
.
getTopYxjAmount
()).
add
(
publisherWalletFlowVO
.
getUrgentYxjAmount
()));
publishUpdatePayWallet
.
setCashFreeze
(
publishWallet
.
getCashFreeze
().
subtract
(
publisherWalletFlowVO
.
getCashAmount
())
.
subtract
(
publisherWalletFlowVO
.
getTopYxjAmount
()).
subtract
(
publisherWalletFlowVO
.
getUrgentYxjAmount
()));
publishUpdatePayWallet
.
setSalaryAmt
(
publishWallet
.
getSalaryAmt
().
add
(
publisherWalletFlowVO
.
getSalaryAmount
())
.
add
(
publisherWalletFlowVO
.
getTopSalaryAmount
()).
add
(
publisherWalletFlowVO
.
getUrgentSalaryAmount
()));
publishUpdatePayWallet
.
setSalaryFreeze
(
publishWallet
.
getSalaryFreeze
().
subtract
(
publisherWalletFlowVO
.
getSalaryAmount
())
.
subtract
(
publisherWalletFlowVO
.
getTopSalaryAmount
()).
subtract
(
publisherWalletFlowVO
.
getUrgentSalaryAmount
()));
int
i
=
payWalletDao
.
updatePayWallet
(
publishUpdatePayWallet
);
if
(
i
>
0
)
{
PayLogDO
payLogDO
=
buildPayLogDO
(
publisherWalletFlowVO
,
null
);
payLogDO
.
setCashAmtPaid
(
publisherWalletFlowVO
.
getCashAmount
().
add
(
publisherWalletFlowVO
.
getTopYxjAmount
()).
add
(
publisherWalletFlowVO
.
getUrgentYxjAmount
()));
payLogDO
.
setSalaryAmtPaid
(
publisherWalletFlowVO
.
getSalaryAmount
().
add
(
publisherWalletFlowVO
.
getTopSalaryAmount
()).
add
(
publisherWalletFlowVO
.
getUrgentSalaryAmount
()));
// 插入流水记录表
payWalletDao
.
insertPayLogDO
(
payLogDO
);
return
ResultBody
.
success
();
}
else
{
log
.
error
(
"发布订单时,用户钱包更新失败,用户id是:{},传入参数是:{}"
,
publisherWalletFlowVO
.
getUserAccountId
(),
publisherWalletFlowVO
);
return
ResultBody
.
error
(
"钱包操作错误"
);
}
}
else
if
(
publisherWalletFlowVO
!=
null
&&
publisherWalletFlowVO
.
getModeOfPayment
().
equals
(
PayMethodEnums
.
CANCEL_ORDER_TAKING
.
getCode
()))
{
// 等于200时 发布方取消订单,无飞手接单
PayWalletDO
publishUpdatePayWallet
=
new
PayWalletDO
();
publishUpdatePayWallet
.
setUserAccountId
(
publisherWalletFlowVO
.
getUserAccountId
());
publishUpdatePayWallet
.
setPid
(
publishWallet
.
getPid
());
publishUpdatePayWallet
.
setCashAmt
(
publishWallet
.
getCashAmt
().
add
(
publisherWalletFlowVO
.
getCashAmount
()));
publishUpdatePayWallet
.
setCashFreeze
(
publishWallet
.
getCashFreeze
().
add
(
publisherWalletFlowVO
.
getTopYxjAmount
()).
add
(
publisherWalletFlowVO
.
getUrgentYxjAmount
()).
subtract
(
publisherWalletFlowVO
.
getCashAmount
()));
publishUpdatePayWallet
.
setSalaryAmt
(
publishWallet
.
getSalaryAmt
().
add
(
publisherWalletFlowVO
.
getSalaryAmount
()));
publishUpdatePayWallet
.
setSalaryFreeze
(
publishWallet
.
getSalaryFreeze
().
add
(
publisherWalletFlowVO
.
getTopSalaryAmount
()).
add
(
publisherWalletFlowVO
.
getUrgentSalaryAmount
()).
subtract
(
publisherWalletFlowVO
.
getSalaryAmount
()));
int
i
=
payWalletDao
.
updatePayWallet
(
publishUpdatePayWallet
);
if
(
i
>
0
)
{
PayLogDO
payLogDO
=
buildPayLogDO
(
publisherWalletFlowVO
,
null
);
// 插入流水记录表
payWalletDao
.
insertPayLogDO
(
payLogDO
);
return
ResultBody
.
success
();
}
else
{
log
.
error
(
"发布方取消订单,无飞手接单时,用户id是:{},传入参数是:{}"
,
publisherWalletFlowVO
.
getUserAccountId
(),
publisherWalletFlowVO
);
return
ResultBody
.
error
(
"钱包操作错误"
);
}
}
else
if
(
publisherWalletFlowVO
!=
null
&&
publisherWalletFlowVO
.
getModeOfPayment
().
equals
(
PayMethodEnums
.
RECEIVED_ORDER_CANCEL
.
getCode
()))
{
// 等于300时 发布方取消订单,有飞手接单
if
(
publisherWalletFlowVO
.
getYxjCashPledge
()
==
null
)
{
publisherWalletFlowVO
.
setYxjCashPledge
(
BigDecimal
.
ZERO
);
}
if
(
publisherWalletFlowVO
.
getSalaryCashPledge
()
==
null
)
{
publisherWalletFlowVO
.
setSalaryCashPledge
(
BigDecimal
.
ZERO
);
}
PayWalletDO
publishUpdatePayWallet
=
new
PayWalletDO
();
publishUpdatePayWallet
.
setUserAccountId
(
publisherWalletFlowVO
.
getUserAccountId
());
publishUpdatePayWallet
.
setPid
(
publishWallet
.
getPid
());
publishUpdatePayWallet
.
setCashAmt
(
publishWallet
.
getCashAmt
().
add
(
publisherWalletFlowVO
.
getCashAmount
()));
publishUpdatePayWallet
.
setCashFreeze
(
publishWallet
.
getCashFreeze
().
subtract
(
publisherWalletFlowVO
.
getCashAmount
()).
add
(
publisherWalletFlowVO
.
getYxjCashPledge
()));
publishUpdatePayWallet
.
setSalaryAmt
(
publishWallet
.
getSalaryAmt
().
add
(
publisherWalletFlowVO
.
getSalaryAmount
()));
publishUpdatePayWallet
.
setSalaryFreeze
(
publishWallet
.
getSalaryFreeze
().
subtract
(
publisherWalletFlowVO
.
getSalaryAmount
()).
add
(
publisherWalletFlowVO
.
getSalaryCashPledge
()));
// 更新发布者钱包数据
int
publishUpdateCount
=
payWalletDao
.
updatePayWallet
(
publishUpdatePayWallet
);
if
(
publishUpdateCount
<=
0
)
{
log
.
error
(
"发布方取消订单,有飞手接单时,发单方用户钱包更新失败,更新参数是:{},发单方用户id是:{},传入参数是:{}"
,
publishUpdatePayWallet
,
publisherWalletFlowVO
.
getUserAccountId
(),
publisherWalletFlowVO
);
return
ResultBody
.
error
(
"钱包操作错误"
);
}
PayLogDO
publishPayLogDO
=
buildPayLogDO
(
publisherWalletFlowVO
,
null
);
// 插入发布者流水记录表
payWalletDao
.
insertPayLogDO
(
publishPayLogDO
);
// 飞手钱包更新信息
PayWalletDO
flyerUpdatePayWallet
=
new
PayWalletDO
();
// 断言此处必定不为空
assert
flyerWalletFlowVO
!=
null
;
flyerUpdatePayWallet
.
setUserAccountId
(
flyerWalletFlowVO
.
getUserAccountId
());
flyerUpdatePayWallet
.
setPid
(
flyerWallet
.
getPid
());
flyerUpdatePayWallet
.
setSalaryAmt
(
flyerWallet
.
getSalaryAmt
().
add
(
publisherWalletFlowVO
.
getPercentagePenaltyOfOrder
()));
int
flyerUpdateCount
=
payWalletDao
.
updatePayWallet
(
flyerUpdatePayWallet
);
if
(
flyerUpdateCount
>
0
)
{
PayLogDO
flyerPayLogDO
=
buildPayLogDO
(
publisherWalletFlowVO
,
flyerWalletFlowVO
);
flyerPayLogDO
.
setCashAmtPaid
(
publisherWalletFlowVO
.
getPercentagePenaltyOfOrder
());
flyerPayLogDO
.
setOperateUser
(
publisherWalletFlowVO
.
getOperateUserAccountId
());
// 插入流水记录表
payWalletDao
.
insertPayLogDO
(
flyerPayLogDO
);
return
ResultBody
.
success
();
}
else
{
log
.
error
(
"发布方取消订单,有飞手接单时,飞手用户钱包更新失败,飞手用户id是:{},接单方传入参数是:{},发单方违约金是:{}"
,
flyerWalletFlowVO
.
getUserAccountId
(),
flyerWalletFlowVO
,
publisherWalletFlowVO
.
getPercentagePenaltyOfOrder
());
}
}
else
if
(
flyerWalletFlowVO
!=
null
&&
flyerWalletFlowVO
.
getModeOfPayment
().
equals
(
PayMethodEnums
.
FLYING_ORDER_TAKING
.
getCode
()))
{
// 状态为400时 表示飞手接单
// 飞手钱包更新信息
int
flyerUpdateCount
=
buildFlyerWallet
(
flyerWalletFlowVO
,
flyerWallet
);
if
(
flyerUpdateCount
>
0
)
{
PayLogDO
flyerPayLogDO
=
buildPayLogDO
(
null
,
flyerWalletFlowVO
);
// 插入流水记录表
payWalletDao
.
insertPayLogDO
(
flyerPayLogDO
);
return
ResultBody
.
success
();
}
else
{
log
.
error
(
"飞手抢单时,飞手用户钱包更新失败,飞手用户id是:{},传入参数是:{}"
,
flyerWalletFlowVO
.
getUserAccountId
(),
flyerWalletFlowVO
);
}
}
else
if
(
flyerWalletFlowVO
!=
null
&&
flyerWalletFlowVO
.
getModeOfPayment
().
equals
(
PayMethodEnums
.
CUSTOMER_SERVICE_CANCEL_ORDER
.
getCode
()))
{
// 状态为500时 客服判定飞手无责取消订单
// 飞手钱包更新信息
int
flyerUpdateCount
=
buildFlyerWallet
(
flyerWalletFlowVO
,
flyerWallet
);
if
(
flyerUpdateCount
>
0
)
{
PayLogDO
flyerPayLogDO
=
buildPayLogDO
(
null
,
flyerWalletFlowVO
);
// 插入流水记录表
payWalletDao
.
insertPayLogDO
(
flyerPayLogDO
);
return
ResultBody
.
success
();
}
else
{
log
.
error
(
"客服判定飞手无责取消订单时,飞手用户钱包更新失败,飞手用户id是:{},传入参数是:{}"
,
flyerWalletFlowVO
.
getUserAccountId
(),
flyerWalletFlowVO
);
}
}
else
if
(
flyerWalletFlowVO
!=
null
&&
flyerWalletFlowVO
.
getModeOfPayment
().
equals
(
PayMethodEnums
.
FLYER_CANCEL_ORDER
.
getCode
()))
{
// 状态为600时 飞手有责取消订单
// 飞手钱包更新信息
PayWalletDO
flyerUpdatePayWallet
=
new
PayWalletDO
();
flyerUpdatePayWallet
.
setUserAccountId
(
flyerWalletFlowVO
.
getUserAccountId
());
flyerUpdatePayWallet
.
setPid
(
flyerWallet
.
getPid
());
flyerUpdatePayWallet
.
setCashFreeze
(
flyerWallet
.
getCashFreeze
().
add
(
flyerWalletFlowVO
.
getYxjCashPledge
()));
flyerUpdatePayWallet
.
setSalaryFreeze
(
flyerWallet
.
getSalaryFreeze
().
add
(
flyerWalletFlowVO
.
getSalaryCashPledge
()));
int
flyerUpdateCount
=
payWalletDao
.
updatePayWallet
(
flyerUpdatePayWallet
);
if
(
flyerUpdateCount
<=
0
)
{
log
.
error
(
"飞手有责取消订单,飞手用户钱包更新失败,飞手用户id是:{},接单方传入参数是:{}"
,
flyerWalletFlowVO
.
getUserAccountId
(),
flyerWalletFlowVO
);
return
ResultBody
.
error
(
"钱包操作错误"
);
}
PayLogDO
flyerPayLogDO
=
buildPayLogDO
(
null
,
flyerWalletFlowVO
);
flyerPayLogDO
.
setCashAmtPaid
(
flyerWalletFlowVO
.
getYxjCashPledge
());
flyerPayLogDO
.
setSalaryAmtPaid
(
flyerWalletFlowVO
.
getSalaryAmount
());
// 插入接单者流水记录表
payWalletDao
.
insertPayLogDO
(
flyerPayLogDO
);
// 飞手钱包更新信息
PayWalletDO
publishUpdatePayWallet
=
new
PayWalletDO
();
// 断言此处必定不为空
assert
publisherWalletFlowVO
!=
null
;
publishUpdatePayWallet
.
setUserAccountId
(
flyerWalletFlowVO
.
getUserAccountId
());
publishUpdatePayWallet
.
setPid
(
flyerWallet
.
getPid
());
publishUpdatePayWallet
.
setSalaryAmt
(
publishWallet
.
getSalaryAmt
().
add
(
flyerWalletFlowVO
.
getPercentagePenaltyOfOrder
()));
int
publishUpdateCount
=
payWalletDao
.
updatePayWallet
(
flyerUpdatePayWallet
);
if
(
publishUpdateCount
>
0
)
{
PayLogDO
publishPayLogDO
=
buildPayLogDO
(
publisherWalletFlowVO
,
flyerWalletFlowVO
);
publishPayLogDO
.
setCashAmtPaid
(
flyerWalletFlowVO
.
getPercentagePenaltyOfOrder
());
publishPayLogDO
.
setOperateUser
(
flyerWalletFlowVO
.
getOperateUserAccountId
());
// 插入流水记录表
payWalletDao
.
insertPayLogDO
(
flyerPayLogDO
);
return
ResultBody
.
success
();
}
else
{
log
.
error
(
"飞手有责取消订单,发布者用户钱包更新失败,发布者用户id是:{},发布方传入参数是:{},接单方方违约金是:{}"
,
publisherWalletFlowVO
.
getUserAccountId
(),
publisherWalletFlowVO
,
flyerWalletFlowVO
.
getPercentagePenaltyOfOrder
());
}
}
else
if
(
publisherWalletFlowVO
!=
null
&&
publisherWalletFlowVO
.
getModeOfPayment
().
equals
(
PayMethodEnums
.
NORMAL_SETTLEMENT
.
getCode
()))
{
// 状态为700时 正常订单结算
// 解冻发布方订单的钱包金额
PayWalletDO
publishPayWalletDO
=
new
PayWalletDO
();
publishPayWalletDO
.
setUserAccountId
(
publisherWalletFlowVO
.
getUserAccountId
());
publishPayWalletDO
.
setPid
(
publishWallet
.
getPid
());
publishPayWalletDO
.
setCashFreeze
(
publishWallet
.
getCashFreeze
().
subtract
(
publisherWalletFlowVO
.
getCashAmount
())
.
add
(
publisherWalletFlowVO
.
getUrgentYxjAmount
()).
add
(
publisherWalletFlowVO
.
getTopYxjAmount
()));
publishPayWalletDO
.
setSalaryFreeze
(
publishWallet
.
getSalaryFreeze
().
subtract
(
publisherWalletFlowVO
.
getSalaryAmount
())
.
add
(
publisherWalletFlowVO
.
getTopSalaryAmount
()).
add
(
publisherWalletFlowVO
.
getUrgentSalaryAmount
()));
int
publishUpdateCount
=
payWalletDao
.
updatePayWallet
(
publishPayWalletDO
);
if
(
publishUpdateCount
<=
0
)
{
log
.
error
(
"正常结算时,发布者用户钱包更新失败,发布者id是:{},发布者传参是:{}"
,
publisherWalletFlowVO
.
getUserAccountId
(),
publisherWalletFlowVO
);
}
// 增加接单方钱包金额
assert
flyerWalletFlowVO
!=
null
;
int
flyerUpdateCount
=
addFlyerSalary
(
publisherWalletFlowVO
,
flyerWalletFlowVO
,
flyerWallet
);
if
(
flyerUpdateCount
>
0
)
{
// 记录流水记录
PayLogDO
flyerPayLogDO
=
buildPayLogDO
(
null
,
flyerWalletFlowVO
);
flyerPayLogDO
.
setSalaryAmtPaid
(
publisherWalletFlowVO
.
getFlyerSalaryAmount
());
flyerPayLogDO
.
setOperateUser
(
publisherWalletFlowVO
.
getUserAccountId
());
// 插入接单者流水记录表
payWalletDao
.
insertPayLogDO
(
flyerPayLogDO
);
return
ResultBody
.
success
();
}
else
{
log
.
error
(
"正常结算时,接单方用户钱包更新失败,接单者id是:{},发布者传参是:{}"
,
flyerWalletFlowVO
.
getUserAccountId
(),
publisherWalletFlowVO
);
}
}
else
if
(
publisherWalletFlowVO
!=
null
&&
publisherWalletFlowVO
.
getModeOfPayment
().
equals
(
PayMethodEnums
.
MODIFY_THE_ORDER
.
getCode
()))
{
// 状态为800时 发布方修改金额大于原来订单佣金
// 发布方还需补金额
if
(
releaseOrCancelOrderWallet
(
publisherWalletFlowVO
,
publishWallet
))
{
PayLogDO
payLogDO
=
buildPayLogDO
(
publisherWalletFlowVO
,
null
);
// 插入流水记录表
payWalletDao
.
insertPayLogDO
(
payLogDO
);
return
ResultBody
.
success
();
}
else
{
log
.
error
(
"发布方修改金额大于原来订单佣金时,用户钱包更新失败,用户id是:{},传入参数是:{}"
,
publisherWalletFlowVO
.
getUserAccountId
(),
publisherWalletFlowVO
);
return
ResultBody
.
error
(
"钱包操作错误"
);
}
}
else
if
(
publisherWalletFlowVO
!=
null
&&
publisherWalletFlowVO
.
getModeOfPayment
().
equals
(
PayMethodEnums
.
FLYING_HAND_NOT_CONFIRMED_GT
.
getCode
()))
{
// 状态为900时 飞手未确认修改金额大于原订单状态时订单结算
// 退回发布方后面补的金额
PayWalletDO
publishUpdatePayWallet
=
new
PayWalletDO
();
publishUpdatePayWallet
.
setUserAccountId
(
publisherWalletFlowVO
.
getUserAccountId
());
publishUpdatePayWallet
.
setPid
(
publishWallet
.
getPid
());
publishUpdatePayWallet
.
setSalaryAmt
(
publishWallet
.
getSalaryAmt
().
add
(
publisherWalletFlowVO
.
getRefundSalaryAmount
()));
publishUpdatePayWallet
.
setSalaryFreeze
(
publishWallet
.
getSalaryFreeze
().
subtract
(
publisherWalletFlowVO
.
getRefundSalaryAmount
()));
publishUpdatePayWallet
.
setCashAmt
(
publishWallet
.
getCashAmt
().
add
(
publisherWalletFlowVO
.
getRefundCashAmount
()));
publishUpdatePayWallet
.
setCashFreeze
(
publishWallet
.
getCashFreeze
().
subtract
(
publisherWalletFlowVO
.
getRefundCashAmount
()));
int
publishUpdateCount
=
payWalletDao
.
updatePayWallet
(
publishUpdatePayWallet
);
if
(
publishUpdateCount
<=
0
)
{
log
.
error
(
"飞手未确认修改金额大于原订单状态时,发布者用户钱包更新失败,发布者id是:{},发布者参数是:{}"
,
publisherWalletFlowVO
.
getUserAccountId
(),
publisherWalletFlowVO
);
}
// 记录发单方退回多余金额记录
refund
(
publisherWalletFlowVO
);
// 增加接单方钱包金额
assert
flyerWalletFlowVO
!=
null
;
int
flyerUpdateCount
=
addFlyerSalary
(
publisherWalletFlowVO
,
flyerWalletFlowVO
,
flyerWallet
);
if
(
flyerUpdateCount
>
0
)
{
// 记录流水记录
PayLogDO
flyerPayLogDO
=
buildPayLogDO
(
null
,
flyerWalletFlowVO
);
flyerPayLogDO
.
setSalaryAmtPaid
(
publisherWalletFlowVO
.
getFlyerSalaryAmount
());
flyerPayLogDO
.
setOperateUser
(
publisherWalletFlowVO
.
getUserAccountId
());
// 插入接单者流水记录表
payWalletDao
.
insertPayLogDO
(
flyerPayLogDO
);
return
ResultBody
.
success
();
}
else
{
log
.
error
(
"飞手未确认修改金额大于原订单状态时,接单方用户钱包更新失败,接单者id是:{},发布者传参是:{}"
,
flyerWalletFlowVO
.
getUserAccountId
(),
publisherWalletFlowVO
);
}
}
else
if
(
publisherWalletFlowVO
!=
null
&&
publisherWalletFlowVO
.
getModeOfPayment
().
equals
(
PayMethodEnums
.
FLYING_HAND_CONFIRM_LT
.
getCode
()))
{
// 状态为1000时 飞手确认修改金额小于原订单状态
// 退回发布方多余原订单金额,解冻钱包金额
PayWalletDO
publishUpdatePayWallet
=
new
PayWalletDO
();
publishUpdatePayWallet
.
setUserAccountId
(
publisherWalletFlowVO
.
getUserAccountId
());
publishUpdatePayWallet
.
setPid
(
publishWallet
.
getPid
());
publishUpdatePayWallet
.
setCashAmt
(
publishWallet
.
getCashAmt
().
add
(
publisherWalletFlowVO
.
getRefundCashAmount
()));
publishUpdatePayWallet
.
setCashFreeze
(
publishWallet
.
getCashFreeze
().
subtract
(
publisherWalletFlowVO
.
getRefundCashAmount
())
.
subtract
(
publisherWalletFlowVO
.
getCashAmount
()).
add
(
publisherWalletFlowVO
.
getUrgentYxjAmount
()).
add
(
publisherWalletFlowVO
.
getTopYxjAmount
()));
publishUpdatePayWallet
.
setSalaryAmt
(
publishWallet
.
getSalaryAmt
().
add
(
publisherWalletFlowVO
.
getRefundSalaryAmount
()));
publishUpdatePayWallet
.
setSalaryFreeze
(
publishWallet
.
getSalaryFreeze
().
subtract
(
publisherWalletFlowVO
.
getRefundSalaryAmount
())
.
subtract
(
publisherWalletFlowVO
.
getSalaryAmount
()).
add
(
publisherWalletFlowVO
.
getUrgentSalaryAmount
()).
add
(
publisherWalletFlowVO
.
getTopYxjAmount
()));
int
publishUpdateCount
=
payWalletDao
.
updatePayWallet
(
publishUpdatePayWallet
);
if
(
publishUpdateCount
<=
0
)
{
log
.
error
(
"飞手确认修改金额小于原订单状态,发布者用户钱包更新失败,发布者id是:{},发布者参数是:{}"
,
publisherWalletFlowVO
.
getUserAccountId
(),
publisherWalletFlowVO
);
}
// 记录多余退款记录
refund
(
publisherWalletFlowVO
);
// 增加接单方钱包金额
assert
flyerWalletFlowVO
!=
null
;
int
flyerUpdateCount
=
addFlyerSalary
(
publisherWalletFlowVO
,
flyerWalletFlowVO
,
flyerWallet
);
if
(
flyerUpdateCount
>
0
)
{
// 记录流水记录
PayLogDO
flyerPayLogDO
=
buildPayLogDO
(
null
,
flyerWalletFlowVO
);
flyerPayLogDO
.
setSalaryAmtPaid
(
publisherWalletFlowVO
.
getFlyerSalaryAmount
());
flyerPayLogDO
.
setOperateUser
(
publisherWalletFlowVO
.
getUserAccountId
());
// 插入接单者流水记录表
payWalletDao
.
insertPayLogDO
(
flyerPayLogDO
);
return
ResultBody
.
success
();
}
else
{
log
.
error
(
"飞手确认修改金额小于原订单状态,接单方用户钱包更新失败,接单者id是:{},发布者传参是:{}"
,
flyerWalletFlowVO
.
getUserAccountId
(),
publisherWalletFlowVO
);
}
}
return
ResultBody
.
error
(
"钱包操作错误"
);
}
private
int
buildFlyerWallet
(
FlyerWalletFlowVO
flyerWalletFlowVO
,
PayWalletDO
flyerWallet
)
{
PayWalletDO
flyerUpdatePayWallet
=
new
PayWalletDO
();
flyerUpdatePayWallet
.
setUserAccountId
(
flyerWalletFlowVO
.
getUserAccountId
());
flyerUpdatePayWallet
.
setPid
(
flyerWallet
.
getPid
());
flyerUpdatePayWallet
.
setCashAmt
(
flyerWallet
.
getCashAmt
().
add
(
flyerWalletFlowVO
.
getCashAmount
()));
flyerUpdatePayWallet
.
setCashFreeze
(
flyerWallet
.
getCashFreeze
().
subtract
(
flyerWalletFlowVO
.
getCashAmount
()));
flyerUpdatePayWallet
.
setSalaryAmt
(
flyerWallet
.
getSalaryAmt
().
add
(
flyerWalletFlowVO
.
getSalaryAmount
()));
flyerUpdatePayWallet
.
setSalaryFreeze
(
flyerWallet
.
getSalaryFreeze
().
subtract
(
flyerWalletFlowVO
.
getSalaryAmount
()));
int
flyerUpdateCount
=
payWalletDao
.
updatePayWallet
(
flyerUpdatePayWallet
);
return
flyerUpdateCount
;
}
private
void
refund
(
PublisherWalletFlowVO
publisherWalletFlowVO
)
{
if
(
publisherWalletFlowVO
.
getRefundCashAmount
().
compareTo
(
BigDecimal
.
ZERO
)
!=
0
||
publisherWalletFlowVO
.
getRefundSalaryAmount
().
compareTo
(
BigDecimal
.
ZERO
)
!=
0
)
{
PayLogDO
publishPayLogDO
=
buildPayLogDO
(
publisherWalletFlowVO
,
null
);
publishPayLogDO
.
setCashAmtPaid
(
publisherWalletFlowVO
.
getRefundCashAmount
());
publishPayLogDO
.
setSalaryAmtPaid
(
publisherWalletFlowVO
.
getRefundSalaryAmount
());
payWalletDao
.
insertPayLogDO
(
publishPayLogDO
);
}
}
private
int
addFlyerSalary
(
PublisherWalletFlowVO
publisherWalletFlowVO
,
FlyerWalletFlowVO
flyerWalletFlowVO
,
PayWalletDO
flyerWallet
)
{
assert
flyerWalletFlowVO
!=
null
;
PayWalletDO
flyerPayWalletDO
=
new
PayWalletDO
();
flyerPayWalletDO
.
setUserAccountId
(
flyerWalletFlowVO
.
getUserAccountId
());
flyerPayWalletDO
.
setPid
(
flyerWallet
.
getPid
());
flyerPayWalletDO
.
setSalaryAmt
(
flyerWallet
.
getSalaryAmt
().
add
(
publisherWalletFlowVO
.
getFlyerSalaryAmount
()));
int
flyerUpdateCount
=
payWalletDao
.
updatePayWallet
(
flyerPayWalletDO
);
return
flyerUpdateCount
;
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
boolean
releaseOrCancelOrderWallet
(
PublisherWalletFlowVO
publisherWalletFlowVO
,
PayWalletDO
wallet
)
{
PayWalletDO
publishUpdatePayWallet
=
new
PayWalletDO
();
if
(
publisherWalletFlowVO
.
getCashAmount
()
==
null
)
{
publisherWalletFlowVO
.
setCashAmount
(
BigDecimal
.
ZERO
);
}
if
(
publisherWalletFlowVO
.
getSalaryAmount
()
==
null
)
{
publisherWalletFlowVO
.
setSalaryAmount
(
BigDecimal
.
ZERO
);
}
publishUpdatePayWallet
.
setUserAccountId
(
publisherWalletFlowVO
.
getUserAccountId
());
publishUpdatePayWallet
.
setPid
(
wallet
.
getPid
());
publishUpdatePayWallet
.
setCashAmt
(
wallet
.
getCashAmt
().
add
(
publisherWalletFlowVO
.
getCashAmount
()));
publishUpdatePayWallet
.
setCashFreeze
(
wallet
.
getCashFreeze
().
subtract
(
publisherWalletFlowVO
.
getCashAmount
()));
publishUpdatePayWallet
.
setSalaryAmt
(
wallet
.
getSalaryAmt
().
add
(
publisherWalletFlowVO
.
getSalaryAmount
()));
publishUpdatePayWallet
.
setSalaryFreeze
(
wallet
.
getSalaryFreeze
().
subtract
(
publisherWalletFlowVO
.
getSalaryAmount
()));
int
i
=
payWalletDao
.
updatePayWallet
(
publishUpdatePayWallet
);
if
(
i
>
0
)
{
return
true
;
}
return
false
;
}
public
PayLogDO
buildPayLogDO
(
PublisherWalletFlowVO
publisherWalletFlowVO
,
FlyerWalletFlowVO
flyerWalletFlowVO
)
{
// 记录资金流水记录
PayLogDO
payLogWalletDO
=
new
PayLogDO
();
// 获取用户钱包信息
if
(
publisherWalletFlowVO
!=
null
)
{
if
(
publisherWalletFlowVO
.
getCashAmount
()
==
null
)
{
publisherWalletFlowVO
.
setCashAmount
(
BigDecimal
.
ZERO
);
}
if
(
publisherWalletFlowVO
.
getSalaryAmount
()
==
null
)
{
publisherWalletFlowVO
.
setSalaryAmount
(
BigDecimal
.
ZERO
);
}
// 生成支付流水号(规则"T" + 时间戳 + 用户id + 随机数4位)
String
publishPayNo
=
"T"
+
TDateUtil
.
getDateStr
(
new
Date
(),
TDateUtil
.
TYPE
)
+
publisherWalletFlowVO
.
getUserAccountId
()
+
CodeUtil
.
getRandomNum
(
4
);
payLogWalletDO
.
setPayMethod
(
publisherWalletFlowVO
.
getModeOfPayment
());
payLogWalletDO
.
setPayNo
(
publishPayNo
);
payLogWalletDO
.
setUserAccountId
(
publisherWalletFlowVO
.
getUserAccountId
());
payLogWalletDO
.
setCashAmtPaid
(
publisherWalletFlowVO
.
getCashAmount
());
payLogWalletDO
.
setSalaryAmtPaid
(
publisherWalletFlowVO
.
getSalaryAmount
());
payLogWalletDO
.
setPayTime
(
publisherWalletFlowVO
.
getTimeOfPayment
());
payLogWalletDO
.
setOperateUser
(
publisherWalletFlowVO
.
getOperateUserAccountId
());
return
payLogWalletDO
;
}
if
(
flyerWalletFlowVO
!=
null
)
{
if
(
flyerWalletFlowVO
.
getCashAmount
()
==
null
)
{
flyerWalletFlowVO
.
setCashAmount
(
BigDecimal
.
ZERO
);
}
if
(
flyerWalletFlowVO
.
getSalaryAmount
()
==
null
)
{
flyerWalletFlowVO
.
setSalaryAmount
(
BigDecimal
.
ZERO
);
}
// 生成支付流水号(规则"T" + 时间戳 + 用户id + 随机数4位)
String
flyerPayNo
=
"T"
+
TDateUtil
.
getDateStr
(
new
Date
(),
TDateUtil
.
TYPE
)
+
flyerWalletFlowVO
.
getUserAccountId
()
+
CodeUtil
.
getRandomNum
(
4
);
payLogWalletDO
.
setPayMethod
(
flyerWalletFlowVO
.
getModeOfPayment
());
payLogWalletDO
.
setPayNo
(
flyerPayNo
);
payLogWalletDO
.
setUserAccountId
(
flyerWalletFlowVO
.
getUserAccountId
());
payLogWalletDO
.
setCashAmtPaid
(
flyerWalletFlowVO
.
getCashAmount
());
payLogWalletDO
.
setSalaryAmtPaid
(
flyerWalletFlowVO
.
getSalaryAmount
());
payLogWalletDO
.
setPayTime
(
flyerWalletFlowVO
.
getTimeOfPayment
());
payLogWalletDO
.
setOperateUser
(
flyerWalletFlowVO
.
getOperateUserAccountId
());
return
payLogWalletDO
;
}
return
null
;
}
}
csm-service/cms-service-user/src/main/java/com/mmc/iuav/user/util/TDateUtil.java
0 → 100644
浏览文件 @
9327e999
package
com
.
mmc
.
iuav
.
user
.
util
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
/**
* @author 作者 geDuo
* @version 创建时间:2021年7月17日 下午5:28:19
* @explain 日期时间工具类
*/
public
class
TDateUtil
{
public
static
final
String
ONE_WEEK
=
"oneweek"
;
public
static
final
String
ONE_MONTH
=
"onemonth"
;
public
static
final
String
THREE_MONTH
=
"threemonth"
;
public
static
final
String
SIX_MONTH
=
"sixmonth"
;
public
static
final
String
ONE_YEAR
=
"oneyear"
;
public
static
final
String
TYPE
=
"yyyyMMddHHmmss"
;
public
static
String
getCurrentDate
()
{
SimpleDateFormat
df
=
new
SimpleDateFormat
(
"yyyy/MM/dd HH:mm"
);
// 设置日期格式
String
date
=
df
.
format
(
new
Date
());
// new Date()为获取当前系统时间
return
date
;
}
public
static
String
getCurrentDateByType
(
String
format
)
{
SimpleDateFormat
df
=
new
SimpleDateFormat
(
format
);
// 设置日期格式
String
date
=
df
.
format
(
new
Date
());
// new Date()为获取当前系统时间
return
date
;
}
public
static
String
getCurrentDateMidd
()
{
SimpleDateFormat
df
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
// 设置日期格式
String
date
=
df
.
format
(
new
Date
());
// new Date()为获取当前系统时间
return
date
;
}
public
static
Date
getDate
(
String
str
,
String
format
)
{
Date
date
=
null
;
try
{
SimpleDateFormat
df
=
new
SimpleDateFormat
(
format
);
// 设置日期格式
// String dates=df.format(new Date());// new Date()为获取当前系统时间
date
=
df
.
parse
(
str
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
date
;
}
/**
* date类型转字符串
*/
public
static
String
getDateStr
(
Date
date
,
String
type
)
{
SimpleDateFormat
format
=
new
SimpleDateFormat
(
type
);
String
s
=
format
.
format
(
date
);
return
s
;
}
/**
* 根据日期获得随机数
*/
public
static
Integer
getDateRandom
(
Date
date
,
String
format
,
int
count
)
{
String
code
=
""
;
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
code
=
code
+
(
int
)
(
Math
.
random
()
*
9
);
}
code
=
TDateUtil
.
getDateStr
(
date
,
format
)
+
code
;
return
Integer
.
parseInt
(
code
);
}
/**
* 10位数的秒转日期字符
*
* @param mss
* @return
*/
public
static
Date
dateFromSecond
(
long
sceondTime
)
{
return
new
Date
(
sceondTime
*
1000
);
}
/**
* 10位数的秒转日期字符
*
* @param mss
* @return
*/
public
static
String
dateFromSecondStr
(
long
sceondTime
)
{
return
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
).
format
(
new
Date
(
sceondTime
*
1000
));
}
/**
* 秒转时分秒
*
* @param secondTime
* @return
*/
public
static
String
hmsFromSecond
(
Integer
secondTime
)
{
Integer
hour
=
secondTime
/
60
/
60
;
Integer
minutes
=
secondTime
/
60
%
60
;
Integer
remainingSeconds
=
secondTime
%
60
;
return
(
hour
+
"h"
+
minutes
+
"min"
+
remainingSeconds
+
"s"
);
}
public
static
String
hmsFromSecondFormat
(
long
secondTime
)
{
long
day
=
secondTime
/
60
/
60
/
24
;
long
hour
=
secondTime
/
60
/
60
%
24
;
long
minutes
=
secondTime
/
60
%
60
;
long
remainingSeconds
=
secondTime
%
60
;
if
(
day
>
0
)
{
return
(
day
+
"天"
+
hour
+
"小时"
+
minutes
+
"分"
+
remainingSeconds
+
"秒"
);
}
return
(
hour
+
"小时"
+
minutes
+
"分"
+
remainingSeconds
+
"秒"
);
}
/**
* 两个日期的相差秒数
*
* @param maxDate
* @param minDate
* @return
*/
public
static
long
calLastedTime
(
Date
maxDate
,
Date
minDate
)
{
long
a
=
maxDate
.
getTime
();
long
b
=
minDate
.
getTime
();
long
c
=
(
a
-
b
)
/
1000
;
return
c
;
}
/**
* 获取某个月的月底最后一天的时间
*/
public
static
Date
getMonthLatestDay
(
Date
date
)
{
SimpleDateFormat
format
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
// 获取当前月最后一天
Calendar
ca
=
Calendar
.
getInstance
();
ca
.
setTime
(
date
);
ca
.
set
(
Calendar
.
DAY_OF_MONTH
,
ca
.
getActualMaximum
(
Calendar
.
DAY_OF_MONTH
));
String
last
=
format
.
format
(
ca
.
getTime
());
Date
dates
=
getDate
(
last
,
"yyyy-MM-dd"
);
return
dates
;
}
/**
* 某个时间 加N天
*/
public
static
Date
nextNumDay
(
Date
d
,
int
num
)
{
SimpleDateFormat
format
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
Date
date
=
null
;
try
{
Date
now
=
d
;
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
setTime
(
now
);
calendar
.
add
(
Calendar
.
DAY_OF_MONTH
,
num
);
String
last
=
format
.
format
(
calendar
.
getTime
());
date
=
getDate
(
last
,
"yyyy-MM-dd"
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
date
;
}
/**
* 某天个时间加 N 小时
*
* @param now
* @param num
* @return
*/
public
static
Date
addHourTime
(
Date
now
,
int
num
)
{
SimpleDateFormat
format
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
Date
date
=
null
;
try
{
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
setTime
(
now
);
calendar
.
add
(
Calendar
.
HOUR
,
num
);
String
last
=
format
.
format
(
calendar
.
getTime
());
date
=
getDate
(
last
,
"yyyy-MM-dd HH:mm:ss"
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
date
;
}
/**
* 某个时间加n个月加n天(负数为减)
*/
@SuppressWarnings
(
"static-access"
)
public
static
Date
getMonthNDayN
(
Date
date
,
int
month
,
int
day
)
{
SimpleDateFormat
format
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
Date
news
=
null
;
try
{
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
setTime
(
date
);
calendar
.
add
(
Calendar
.
MONTH
,
month
);
calendar
.
add
(
calendar
.
DATE
,
day
);
String
last
=
format
.
format
(
calendar
.
getTime
());
news
=
getDate
(
last
,
"yyyy-MM-dd"
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
news
;
}
/**
* 时间戳-计算小时
*/
public
static
long
getDistanceTime
(
long
time1
,
long
time2
)
{
long
diff
=
0
;
long
day
=
0
;
long
hour
=
0
;
if
(
time1
<
time2
)
{
diff
=
time2
-
time1
;
}
else
{
diff
=
time1
-
time2
;
}
day
=
diff
/
(
24
*
60
*
60
*
1000
);
hour
=
(
diff
/
(
60
*
60
*
1000
)
-
day
*
24
);
return
hour
;
}
/**
* 两个时间之间相差距离多少天
*
* @param one 时间参数 1:
* @param two 时间参数 2:
* @return 相差天数
*/
public
static
int
distanceDays
(
Date
one
,
Date
two
)
{
int
days
=
0
;
long
time1
=
one
.
getTime
();
long
time2
=
two
.
getTime
();
long
diff
;
if
(
time1
<
time2
)
{
diff
=
time2
-
time1
;
}
else
{
diff
=
time1
-
time2
;
}
days
=
new
Long
(
diff
/
(
1000
*
60
*
60
*
24
)).
intValue
();
return
days
;
}
public
static
Date
nextNumDateTime
(
Date
d
,
int
num
)
{
SimpleDateFormat
format
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
Date
date
=
null
;
try
{
Date
now
=
d
;
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
setTime
(
now
);
calendar
.
add
(
Calendar
.
DAY_OF_MONTH
,
num
);
String
last
=
format
.
format
(
calendar
.
getTime
());
date
=
getDate
(
last
,
"yyyy-MM-dd HH:mm:ss"
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
date
;
}
public
static
String
createYearWeek
(
String
startStr
,
String
endStr
)
{
if
(
startStr
==
null
||
""
.
equals
(
startStr
)
||
endStr
==
null
||
""
.
equals
(
endStr
))
{
return
"起止日期不能为空"
;
}
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
Date
start
=
null
;
Date
end
=
null
;
Date
startDate
;
Date
endDate
;
int
dayOfWeek
;
boolean
goOn
=
true
;
int
no
=
0
;
try
{
start
=
sdf
.
parse
(
startStr
);
end
=
sdf
.
parse
(
endStr
);
}
catch
(
ParseException
e
)
{
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"yyyyMMdd"
);
try
{
start
=
simpleDateFormat
.
parse
(
startStr
);
end
=
simpleDateFormat
.
parse
(
endStr
);
}
catch
(
ParseException
pe
)
{
pe
.
printStackTrace
();
}
}
if
(
start
.
compareTo
(
end
)
>
-
1
)
{
return
"结束日期必须大于开始日期"
;
}
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
setTime
(
start
);
dayOfWeek
=
calendar
.
get
(
Calendar
.
DAY_OF_WEEK
);
List
<
Map
<
String
,
String
>>
weekList
=
new
ArrayList
<>();
if
(
dayOfWeek
>
1
&&
dayOfWeek
<
7
)
{
do
{
startDate
=
start
;
calendar
.
add
(
Calendar
.
DATE
,
(
8
-
dayOfWeek
));
endDate
=
calendar
.
getTime
();
no
+=
1
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"startOfWeek"
,
sdf
.
format
(
startDate
));
map
.
put
(
"weekNo"
,
no
+
""
);
if
(
endDate
.
compareTo
(
end
)
<
0
)
{
map
.
put
(
"endOfWeek"
,
sdf
.
format
(
endDate
));
weekList
.
add
(
map
);
calendar
.
add
(
Calendar
.
DATE
,
1
);
start
=
calendar
.
getTime
();
dayOfWeek
=
2
;
}
else
{
map
.
put
(
"endOfWeek"
,
sdf
.
format
(
end
));
weekList
.
add
(
map
);
goOn
=
false
;
}
}
while
(
goOn
);
}
else
{
no
+=
1
;
startDate
=
start
;
if
(
dayOfWeek
==
1
)
{
endDate
=
start
;
}
else
{
calendar
.
add
(
Calendar
.
DATE
,
1
);
endDate
=
calendar
.
getTime
();
}
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"startOfWeek"
,
sdf
.
format
(
startDate
));
map
.
put
(
"endOfWeek"
,
sdf
.
format
(
endDate
));
map
.
put
(
"weekNo"
,
no
+
""
);
weekList
.
add
(
map
);
calendar
.
add
(
Calendar
.
DATE
,
1
);
start
=
calendar
.
getTime
();
do
{
startDate
=
start
;
calendar
.
add
(
Calendar
.
DATE
,
6
);
endDate
=
calendar
.
getTime
();
no
+=
1
;
map
=
new
HashMap
<>();
map
.
put
(
"startOfWeek"
,
sdf
.
format
(
startDate
));
map
.
put
(
"weekNo"
,
no
+
""
);
if
(
endDate
.
compareTo
(
end
)
<
0
)
{
map
.
put
(
"endOfWeek"
,
sdf
.
format
(
endDate
));
weekList
.
add
(
map
);
calendar
.
add
(
Calendar
.
DATE
,
1
);
start
=
calendar
.
getTime
();
}
else
{
map
.
put
(
"endOfWeek"
,
sdf
.
format
(
end
));
weekList
.
add
(
map
);
goOn
=
false
;
}
}
while
(
goOn
);
}
return
weekList
.
toString
();
}
/**
* 获取起止日期
*
* @param sdf 需要显示的日期格式
* @param date 需要参照的日期
* @param n 最近n周
* @param option 0 开始日期;1 结束日期
* @param k 0 包含本周 1 不包含本周
* @return
*/
public
static
String
getFromToDate
(
SimpleDateFormat
sdf
,
Date
date
,
int
n
,
int
option
,
int
k
)
{
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
setTime
(
date
);
int
dayOfWeek
=
calendar
.
get
(
Calendar
.
DAY_OF_WEEK
)
-
1
;
int
offset
=
0
==
option
?
1
-
dayOfWeek
:
7
-
dayOfWeek
;
int
amount
=
0
==
option
?
offset
-
(
n
-
1
+
k
)
*
7
:
offset
-
k
*
7
;
calendar
.
add
(
Calendar
.
DATE
,
amount
);
return
sdf
.
format
(
calendar
.
getTime
());
}
/**
* 根据当前日期获得最近n周的日期区间(包含本周)
*
* @param n
* @param sdf
* @return
*/
public
static
String
getNWeekTimeInterval
(
int
n
,
String
format
)
{
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
format
);
// 设置日期格式
String
beginDate
=
getFromToDate
(
sdf
,
new
Date
(),
n
,
0
,
0
);
String
endDate
=
getFromToDate
(
sdf
,
new
Date
(),
n
,
1
,
0
);
return
beginDate
+
","
+
endDate
;
}
/**
* 根据当前日期获得最近n周的日期区间(不包含本周)
*
* @param n
* @param sdf
* @return
*/
public
static
String
getNWeekTimeIntervalTwo
(
int
n
,
String
format
)
{
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
format
);
// 设置日期格式
String
beginDate
=
getFromToDate
(
sdf
,
new
Date
(),
n
,
0
,
1
);
String
endDate
=
getFromToDate
(
sdf
,
new
Date
(),
n
,
1
,
1
);
return
beginDate
+
","
+
endDate
;
}
/**
* 根据当前日期获得本周的日期区间(本周周一和周日日期)
*
* @param sdf
* @return
*/
public
static
String
getThisWeekTimeInterval
(
String
format
)
{
return
getNWeekTimeInterval
(
1
,
format
);
}
/**
* 根据当前日期获得上周的日期区间(上周周一和周日日期)
*
* @param sdf
* @return
*/
public
static
String
getLastWeekTimeInterval
(
String
format
)
{
return
getNWeekTimeIntervalTwo
(
1
,
format
);
}
/**
* 获取某个日期最近一个的星期日
*
* @return
*/
public
static
Date
getLatestWeekend
(
Date
date
)
{
Calendar
cal
=
Calendar
.
getInstance
();
cal
.
setTime
(
date
);
int
w
=
cal
.
get
(
Calendar
.
DAY_OF_WEEK
)
-
1
;
Date
endDate
=
TDateUtil
.
nextNumDay
(
date
,
w
*
-
1
);
return
endDate
;
}
/**
* 获取N周的星期一的日期(正加负减)
*
* @param date
* @return
*/
public
static
Date
getMinMonday
(
Date
date
,
int
weekNum
)
{
Calendar
cal
=
Calendar
.
getInstance
();
cal
.
setTime
(
date
);
int
w
=
cal
.
get
(
Calendar
.
DAY_OF_WEEK
)
-
1
;
Date
endDate
=
TDateUtil
.
nextNumDay
(
date
,
w
*
-
1
);
Date
startDate
=
TDateUtil
.
nextNumDay
(
endDate
,
(
weekNum
*
7
)
+
1
);
return
startDate
;
}
/**
* 获取某个月加几个月后一号的日期
*/
@SuppressWarnings
(
"static-access"
)
public
static
Date
getAddMonThDay
(
Date
date
,
int
i
)
{
SimpleDateFormat
format
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
setTime
(
date
);
calendar
.
add
(
calendar
.
MONTH
,
i
);
calendar
.
set
(
Calendar
.
DAY_OF_MONTH
,
1
);
String
last
=
format
.
format
(
calendar
.
getTime
());
date
=
getDate
(
last
,
"yyyy-MM-dd"
);
return
date
;
}
/**
* 某个月最后一天
*/
public
static
Date
getAnyMonthLastDay
(
Date
date
)
{
SimpleDateFormat
format
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
// 获取当前月最后一天
Calendar
ca
=
Calendar
.
getInstance
();
ca
.
setTime
(
date
);
ca
.
set
(
Calendar
.
DAY_OF_MONTH
,
ca
.
getActualMaximum
(
Calendar
.
DAY_OF_MONTH
));
String
last
=
format
.
format
(
ca
.
getTime
());
date
=
getDate
(
last
,
"yyyy-MM-dd"
);
return
date
;
}
public
static
Date
getDate
(
Date
date
,
String
type
)
{
SimpleDateFormat
format
=
new
SimpleDateFormat
(
type
);
String
s
=
format
.
format
(
date
);
return
getDate
(
s
,
type
);
}
/**
* 获取去年今天的日期
*/
public
static
Date
getLastYearTodayDate
()
{
Calendar
instance
=
Calendar
.
getInstance
();
instance
.
add
(
Calendar
.
YEAR
,
-
1
);
SimpleDateFormat
format
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
String
s
=
format
.
format
(
instance
.
getTime
());
return
getDate
(
s
,
"yyyy-MM-dd"
);
}
/**
* 获取昨天的日期
*
* @param type
* @return
*/
public
static
String
getYesterdayDateByType
(
String
type
)
{
Calendar
instance
=
Calendar
.
getInstance
();
instance
.
add
(
Calendar
.
DAY_OF_MONTH
,
-
1
);
Date
time
=
instance
.
getTime
();
SimpleDateFormat
format
=
new
SimpleDateFormat
(
type
);
return
format
.
format
(
time
);
}
/**
* 判断两个时间是不是在同一个月
*/
public
static
boolean
isSameMonth
(
Date
date1
,
Date
date2
)
{
Calendar
c
=
Calendar
.
getInstance
();
c
.
setTime
(
date1
);
int
month1
=
c
.
get
(
Calendar
.
MONTH
);
c
.
setTime
(
date2
);
int
month2
=
c
.
get
(
Calendar
.
MONTH
);
if
(
month1
==
month2
)
{
return
true
;
}
return
false
;
}
/**
* 间隔天数
*
* @param startTime
* @param endTime
* @return
*/
public
static
int
isolateDayNum
(
String
startTime
,
String
endTime
)
{
Date
startDate
=
getDate
(
startTime
,
"yyyy-MM-dd"
);
Date
endDate
=
getDate
(
endTime
,
"yyyy-MM-dd"
);
long
differentMillis
=
endDate
.
getTime
()
-
startDate
.
getTime
();
long
dayNum
=
differentMillis
/
(
1000
*
60
*
60
*
24
);
return
(
int
)
dayNum
;
}
/**
* 获取某月最后一天的时间
*
* @param yearMonth
* @return
*/
public
static
String
getLastDateTimeOfMonth
(
String
yearMonth
)
{
SimpleDateFormat
format0
=
new
SimpleDateFormat
(
"yyyy-MM"
);
SimpleDateFormat
format1
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
Calendar
instance
=
Calendar
.
getInstance
();
try
{
Date
parse
=
format0
.
parse
(
yearMonth
);
instance
.
setTime
(
parse
);
instance
.
set
(
Calendar
.
DAY_OF_MONTH
,
instance
.
getActualMaximum
(
Calendar
.
DAY_OF_MONTH
));
instance
.
set
(
Calendar
.
HOUR_OF_DAY
,
23
);
instance
.
set
(
Calendar
.
MINUTE
,
59
);
instance
.
set
(
Calendar
.
SECOND
,
59
);
String
format
=
format1
.
format
(
instance
.
getTime
());
return
format
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
null
;
}
public
static
Date
getStrToDate
(
String
str
)
{
SimpleDateFormat
dateFormat
=
new
SimpleDateFormat
(
"yyyy年MM月dd日"
);
Date
date
=
null
;
try
{
if
(
str
==
null
)
{
date
=
null
;
}
else
{
date
=
dateFormat
.
parse
(
str
);
}
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
}
return
date
;
}
public
static
int
getStageByDate
(
Date
date
)
{
Calendar
instance
=
Calendar
.
getInstance
();
instance
.
setTime
(
date
);
//当前时间
SimpleDateFormat
dateFormat
=
new
SimpleDateFormat
(
"HH:mm:ss"
);
String
format
=
dateFormat
.
format
(
date
);
try
{
Date
currentTime
=
dateFormat
.
parse
(
format
);
Date
parse1
=
dateFormat
.
parse
(
"05:00:00"
);
Date
parse2
=
dateFormat
.
parse
(
"11:00:00"
);
Date
parse3
=
dateFormat
.
parse
(
"17:00:00"
);
Date
parse4
=
dateFormat
.
parse
(
"00:00:00"
);
//A:05:00-11:00 | B:11:00-17:00 | C:00:00-05:00,17:00-00:00
if
(
currentTime
.
after
(
parse4
)
&&
currentTime
.
before
(
parse1
))
{
return
3
;
}
else
if
(
currentTime
.
after
(
parse1
)
&&
currentTime
.
before
(
parse2
))
{
return
1
;
}
else
if
(
currentTime
.
after
(
parse2
)
&&
currentTime
.
before
(
parse3
))
{
return
2
;
}
else
if
(
currentTime
.
after
(
parse3
)
&&
currentTime
.
after
(
parse4
))
{
return
4
;
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
0
;
}
public
static
String
getCurrentYear
()
{
Calendar
date
=
Calendar
.
getInstance
();
String
year
=
String
.
valueOf
(
date
.
get
(
Calendar
.
YEAR
));
return
year
;
}
}
csm-service/cms-service-user/src/main/resources/mapper/wallet/PayWalletDao.xml
浏览文件 @
9327e999
...
...
@@ -10,6 +10,42 @@
values (#{userAccountId}, #{cashAmt}, #{cashPaid}, #{cashFreeze}, #{salaryAmt}, #{salaryPaid}, #{salaryFreeze},
#{salaryWdl})
</insert>
<insert
id=
"insertPayLogDO"
>
insert into pay_log (user_account_id,
pay_no,
pay_method,
cash_amt_paid,
salary_amt_paid,
pay_time,
remark,
operate_user)
values (#{userAccountId}, #{payNo}, #{payMethod}, #{cashAmtPaid}, #{salaryAmtPaid}, #{payTime}, #{remark},
#{operateUser})
</insert>
<update
id=
"updatePayWallet"
>
update pay_wallet
<set>
<if
test=
"pid != null"
>
pid = #{pid} + 1,
</if>
<if
test=
"cashAmt != null"
>
cash_amt = #{cashAmt},
</if>
<if
test=
"cashFreeze != null"
>
cash_freeze = #{cashFreeze},
</if>
<if
test=
"salaryAmt != null"
>
salary_amt = #{salaryAmt},
</if>
<if
test=
"salaryFreeze != null"
>
salary_freeze = #{salaryFreeze},
</if>
<if
test=
"salaryWdl != null"
>
salary_wdl =#{salaryWdl}
</if>
</set>
where user_account_id = #{userAccountId} and pid = #{pid}
</update>
<select
id=
"getPayWalletByUser"
resultType=
"com.mmc.iuav.user.entity.wallet.PayWalletDO"
>
select id,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论