Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
clx-performance
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
姜武杰
clx-performance
Commits
a103b8ca
提交
a103b8ca
authored
6月 18, 2024
作者:
胡宁宁
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
增加司机保证金冻结支付接口
上级
7e776aea
隐藏空白字符变更
内嵌
并排
正在显示
19 个修改的文件
包含
910 行增加
和
20 行删除
+910
-20
PayOperationStatusEnum.java
...clx/performance/enums/payment/PayOperationStatusEnum.java
+52
-0
PaymentActionEnum.java
.../com/clx/performance/enums/payment/PaymentActionEnum.java
+33
-0
PaymentStatusEnum.java
.../com/clx/performance/enums/payment/PaymentStatusEnum.java
+49
-0
CallServiceDTO.java
.../com/clx/performance/param/pc/payment/CallServiceDTO.java
+28
-0
FreezeBatchDTO.java
.../com/clx/performance/param/pc/payment/FreezeBatchDTO.java
+25
-0
PayBatchDTO.java
...ava/com/clx/performance/param/pc/payment/PayBatchDTO.java
+29
-0
PayPlatformFeeParam.java
...clx/performance/param/pc/payment/PayPlatformFeeParam.java
+28
-0
MslPaymentConfig.java
...ain/java/com/clx/performance/config/MslPaymentConfig.java
+2
-0
PayNotifyController.java
...x/performance/controller/payment/PayNotifyController.java
+121
-0
TempController.java
...a/com/clx/performance/controller/temp/TempController.java
+14
-0
OrderPaymentDaoImpl.java
...clx/performance/dao/impl/payment/OrderPaymentDaoImpl.java
+41
-0
OrderPaymentDao.java
...java/com/clx/performance/dao/payment/OrderPaymentDao.java
+23
-0
HttpEnum.java
...web/src/main/java/com/clx/performance/enums/HttpEnum.java
+8
-1
PayRemarkEnum.java
...rc/main/java/com/clx/performance/enums/PayRemarkEnum.java
+1
-0
OrderPaymentMapper.java
...om/clx/performance/mapper/payment/OrderPaymentMapper.java
+12
-0
OrderPayment.java
.../java/com/clx/performance/model/payment/OrderPayment.java
+75
-0
PaymentService.java
...main/java/com/clx/performance/service/PaymentService.java
+13
-0
PaymentServiceImpl.java
.../com/clx/performance/service/impl/PaymentServiceImpl.java
+336
-7
TempServiceImpl.java
...ava/com/clx/performance/service/impl/TempServiceImpl.java
+20
-12
没有找到文件。
performance-api/src/main/java/com/clx/performance/enums/payment/PayOperationStatusEnum.java
0 → 100644
浏览文件 @
a103b8ca
package
com
.
clx
.
performance
.
enums
.
payment
;
import
java.util.Map
;
import
java.util.concurrent.ConcurrentHashMap
;
/**
* @author huningning
* Date 2024-06-18
* Time 14:01
*/
public
enum
PayOperationStatusEnum
{
FREEZE
(
1
,
"冻结"
),
ADJUSTMENT
(
2
,
"调整"
),
UNFREEZE
(
3
,
"解冻"
),
PART_UNFREEZE
(
4
,
"部分解冻"
),
PART_PAY
(
5
,
"部分支付"
),
PAY
(
6
,
"支付"
),
COMPLETE
(
7
,
"完成"
)
;
private
static
Map
<
Integer
,
String
>
map
=
new
ConcurrentHashMap
<>();
static
{
for
(
PayOperationStatusEnum
payOperationStatusEnum
:
PayOperationStatusEnum
.
values
()){
map
.
put
(
payOperationStatusEnum
.
getValue
(),
payOperationStatusEnum
.
getDisplayValue
());
}
}
private
int
value
;
private
String
displayValue
;
public
void
setValue
(
int
value
)
{
this
.
value
=
value
;
}
public
String
getDisplayValue
()
{
return
displayValue
;
}
public
void
setDisplayValue
(
String
displayValue
)
{
this
.
displayValue
=
displayValue
;
}
private
PayOperationStatusEnum
(
int
value
,
String
displayValue
){
this
.
value
=
value
;
this
.
displayValue
=
displayValue
;
}
public
int
getValue
(){
return
value
;
}
public
static
String
toString
(
int
value
){
return
map
.
get
(
value
);
}
}
performance-api/src/main/java/com/clx/performance/enums/payment/PaymentActionEnum.java
0 → 100644
浏览文件 @
a103b8ca
package
com
.
clx
.
performance
.
enums
.
payment
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
import
java.util.Arrays
;
import
java.util.Optional
;
public
enum
PaymentActionEnum
{
;
/** 操作类型 1撤销 2完成 3修改*/
@Getter
@AllArgsConstructor
public
enum
Type
{
CANCEL
(
1
,
"撤销"
),
COMPLETE
(
2
,
"完成"
),
ADJUST
(
3
,
"修改"
),
;
private
final
Integer
code
;
private
final
String
msg
;
public
static
Optional
<
Type
>
getByCode
(
int
code
)
{
return
Arrays
.
stream
(
values
()).
filter
(
e
->
e
.
code
==
code
).
findFirst
();
}
public
static
String
getMsgByCode
(
int
code
)
{
return
getByCode
(
code
).
map
(
Type:
:
getMsg
).
orElse
(
null
);
}
}
}
performance-api/src/main/java/com/clx/performance/enums/payment/PaymentStatusEnum.java
0 → 100644
浏览文件 @
a103b8ca
package
com
.
clx
.
performance
.
enums
.
payment
;
import
java.util.Map
;
import
java.util.concurrent.ConcurrentHashMap
;
/**
* @author huningning
* Date 2024-06-18
* Time 14:01
* 支付状态
*/
public
enum
PaymentStatusEnum
{
CREATE
(
0
,
"发起"
),
SUCCESS
(
1
,
"成功"
),
FAIL
(
2
,
"失败"
)
;
private
static
Map
<
Integer
,
String
>
map
=
new
ConcurrentHashMap
<>();
static
{
for
(
PaymentStatusEnum
paymentStatusEnum
:
PaymentStatusEnum
.
values
()){
map
.
put
(
paymentStatusEnum
.
getValue
(),
paymentStatusEnum
.
getDisplayValue
());
}
}
private
int
value
;
private
String
displayValue
;
public
void
setValue
(
int
value
)
{
this
.
value
=
value
;
}
public
String
getDisplayValue
()
{
return
displayValue
;
}
public
void
setDisplayValue
(
String
displayValue
)
{
this
.
displayValue
=
displayValue
;
}
private
PaymentStatusEnum
(
int
value
,
String
displayValue
){
this
.
value
=
value
;
this
.
displayValue
=
displayValue
;
}
public
int
getValue
(){
return
value
;
}
public
static
String
toString
(
int
value
){
return
map
.
get
(
value
);
}
}
performance-api/src/main/java/com/clx/performance/param/pc/payment/CallServiceDTO.java
0 → 100644
浏览文件 @
a103b8ca
package
com
.
clx
.
performance
.
param
.
pc
.
payment
;
import
lombok.Getter
;
import
lombok.NoArgsConstructor
;
import
lombok.Setter
;
import
lombok.ToString
;
/**
*
* @author xujianke
* @date 2017年4月22日
* @description
*/
@Getter
@Setter
@ToString
@NoArgsConstructor
public
class
CallServiceDTO
{
/** 业务系统编码 参考<SystemCodeEnum> */
Integer
system
;
/** 支付结果通知回调地址 */
String
notifyUrl
;
/** 操作唯一标识 UUID */
String
uuid
;
/** 关联单号 */
String
orderNo
;
}
performance-api/src/main/java/com/clx/performance/param/pc/payment/FreezeBatchDTO.java
0 → 100644
浏览文件 @
a103b8ca
package
com
.
clx
.
performance
.
param
.
pc
.
payment
;
import
lombok.Getter
;
import
lombok.NoArgsConstructor
;
import
lombok.Setter
;
import
lombok.ToString
;
import
java.util.List
;
/**
*
* @author xujianke
* @date 2017年5月31日
* @description 批量处理冻结
*/
@Getter
@Setter
@ToString
@NoArgsConstructor
public
class
FreezeBatchDTO
extends
CallServiceDTO
{
/** 处理冻结 */
private
List
<
FreezeUnitDTO
>
FreezeUnitList
;
/** 增加支付单元的处理,为了在解冻的时候额外增加赔偿 add by cuiwanzhe 20200430 */
private
PayBatchDTO
payBatchDTO
;
}
performance-api/src/main/java/com/clx/performance/param/pc/payment/PayBatchDTO.java
0 → 100644
浏览文件 @
a103b8ca
package
com
.
clx
.
performance
.
param
.
pc
.
payment
;
import
lombok.Getter
;
import
lombok.NoArgsConstructor
;
import
lombok.Setter
;
import
lombok.ToString
;
import
java.util.List
;
/**
*
* @author xujianke
* @date 2017年4月18日
* @description 同一个订单的批量支付操作类 不能跨订单支付
*/
@Getter
@Setter
@ToString
@NoArgsConstructor
public
class
PayBatchDTO
extends
CallServiceDTO
{
/**支付操作*/
private
List
<
PayUnitDTO
>
payUnitList
;
/**主钱包*/
private
Integer
walletCode
;
/**子钱包*/
private
Integer
walletSubCode
;
/**主钱包的交易密码*/
private
String
pwd
;
}
performance-api/src/main/java/com/clx/performance/param/pc/payment/PayPlatformFeeParam.java
0 → 100644
浏览文件 @
a103b8ca
package
com
.
clx
.
performance
.
param
.
pc
.
payment
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.*
;
import
lombok.experimental.Accessors
;
import
javax.validation.constraints.NotBlank
;
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@Builder
@Accessors
(
chain
=
true
)
public
class
PayPlatformFeeParam
{
@NotBlank
(
message
=
"支付人不能为空"
)
@ApiModelProperty
(
value
=
"支付来源"
,
example
=
"2234"
,
dataType
=
"int"
)
Integer
from
;
@NotBlank
(
message
=
"支付密码不能为空"
)
@ApiModelProperty
(
value
=
"支付方密码"
,
example
=
"2356"
,
dataType
=
"String"
)
String
pwd
;
@NotBlank
(
message
=
"金额不能为空"
)
@ApiModelProperty
(
value
=
"金额"
,
example
=
"2356"
,
dataType
=
"int"
)
Integer
figure
;
@NotBlank
(
message
=
"交易单号不能为空"
)
@ApiModelProperty
(
value
=
"交易单号"
,
example
=
"2356"
,
dataType
=
"String"
)
String
tradeNo
;
}
performance-web/src/main/java/com/clx/performance/config/MslPaymentConfig.java
浏览文件 @
a103b8ca
...
@@ -17,4 +17,6 @@ public class MslPaymentConfig {
...
@@ -17,4 +17,6 @@ public class MslPaymentConfig {
private
String
notifyhost
;
private
String
notifyhost
;
@Value
(
"${msl.payment.transport.walletCode}"
)
@Value
(
"${msl.payment.transport.walletCode}"
)
private
Integer
transportWalletCode
;
private
Integer
transportWalletCode
;
@Value
(
"${msl.payment.system.walletCode}"
)
private
Integer
systemWalletCode
;
}
}
performance-web/src/main/java/com/clx/performance/controller/payment/PayNotifyController.java
浏览文件 @
a103b8ca
package
com
.
clx
.
performance
.
controller
.
payment
;
package
com
.
clx
.
performance
.
controller
.
payment
;
import
com.clx.performance.enums.PayUnitTypeEnum
;
import
com.clx.performance.enums.payment.PayOperationStatusEnum
;
import
com.clx.performance.enums.payment.PaymentStatusEnum
;
import
com.clx.performance.model.payment.OrderPayment
;
import
com.clx.performance.param.pay.NotifyString
;
import
com.clx.performance.param.pay.NotifyString
;
import
com.clx.performance.service.PaymentService
;
import
com.clx.performance.service.breakcontract.BreakContractMqHandlerService
;
import
com.clx.performance.service.breakcontract.BreakContractMqHandlerService
;
import
com.clx.performance.service.settle.SettlementMqHandlerService
;
import
com.clx.performance.service.settle.SettlementMqHandlerService
;
import
com.msl.common.result.Result
;
import
com.msl.common.result.Result
;
...
@@ -27,6 +32,12 @@ public class PayNotifyController {
...
@@ -27,6 +32,12 @@ public class PayNotifyController {
@Autowired
@Autowired
private
BreakContractMqHandlerService
breakContractMqHandlerService
;
private
BreakContractMqHandlerService
breakContractMqHandlerService
;
@Autowired
private
PaymentService
paymentService
;
@ApiOperation
(
value
=
"用户支付完成回调接口"
,
notes
=
" <br>By:胡宁宁"
)
@ApiOperation
(
value
=
"用户支付完成回调接口"
,
notes
=
" <br>By:胡宁宁"
)
@RequestMapping
(
value
=
"/userPayNotify"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/userPayNotify"
,
method
=
RequestMethod
.
POST
)
public
Result
<
Object
>
userPayNotify
(
@RequestBody
NotifyString
notify
)
{
public
Result
<
Object
>
userPayNotify
(
@RequestBody
NotifyString
notify
)
{
...
@@ -70,4 +81,114 @@ public class PayNotifyController {
...
@@ -70,4 +81,114 @@ public class PayNotifyController {
Result
<
Object
>
ret
=
new
Result
<>();
Result
<
Object
>
ret
=
new
Result
<>();
return
ret
;
return
ret
;
}
}
@ApiOperation
(
value
=
"司机冻结保证金回调接口"
,
notes
=
" <br>By:胡宁宁"
)
@RequestMapping
(
value
=
"/userPayDriverFreezeNotify"
,
method
=
RequestMethod
.
POST
)
public
Result
<
Object
>
userPayDriverFreezeNotify
(
@RequestBody
NotifyString
notify
)
{
log
.
info
(
"司机冻结保证金回调接口 传参 {}"
,
notify
);
if
(
Objects
.
isNull
(
notify
)
||
Objects
.
isNull
(
notify
.
getCode
())
||
Objects
.
isNull
(
notify
.
getAction
()))
{
return
new
Result
<>();
}
String
paymentItem
=
PayUnitTypeEnum
.
FREEZE_PLATFORM_FEE
.
getCode
()+
""
;
int
operation
=
PayOperationStatusEnum
.
FREEZE
.
getValue
();
if
(
notify
.
getCode
()
!=
0
)
{
paymentService
.
updateOrderPaymentFail
(
notify
.
getOrderNo
(),
notify
.
getMsg
(),
operation
,
paymentItem
);
// 支付失败处理
log
.
info
(
"支付失败处理 唯一id {}"
,
notify
.
getOrderNo
());
}
else
{
paymentService
.
updateOrderPaymentSuccess
(
notify
.
getOrderNo
(),
operation
,
paymentItem
);
// 支付支付成功处理
log
.
info
(
" 支付支付成功处理 唯一id {}"
,
notify
.
getOrderNo
());
}
Result
<
Object
>
ret
=
new
Result
<>();
return
ret
;
}
@ApiOperation
(
value
=
"司机调整保证金回调接口"
,
notes
=
" <br>By:胡宁宁"
)
@RequestMapping
(
value
=
"/userPayAdjustDriverFreezeNotify"
,
method
=
RequestMethod
.
POST
)
public
Result
<
Object
>
userPayAdjustDriverFreezeNotify
(
@RequestBody
NotifyString
notify
)
{
log
.
info
(
"司机冻结保证金回调接口 传参 {}"
,
notify
);
if
(
Objects
.
isNull
(
notify
)
||
Objects
.
isNull
(
notify
.
getCode
())
||
Objects
.
isNull
(
notify
.
getAction
()))
{
return
new
Result
<>();
}
String
paymentItem
=
PayUnitTypeEnum
.
FREEZE_PLATFORM_FEE
.
getCode
()+
""
;
int
operation
=
PayOperationStatusEnum
.
ADJUSTMENT
.
getValue
();
if
(
notify
.
getCode
()
!=
0
)
{
paymentService
.
updateOrderPaymentFail
(
notify
.
getOrderNo
(),
notify
.
getMsg
(),
operation
,
paymentItem
);
// 支付失败处理
log
.
info
(
"支付失败处理 唯一id {}"
,
notify
.
getOrderNo
());
}
else
{
paymentService
.
updateOrderPaymentSuccess
(
notify
.
getOrderNo
(),
operation
,
paymentItem
);
// 支付支付成功处理
log
.
info
(
" 支付支付成功处理 唯一id {}"
,
notify
.
getOrderNo
());
}
Result
<
Object
>
ret
=
new
Result
<>();
return
ret
;
}
@ApiOperation
(
value
=
"司机取消运单退还保证金回调接口"
,
notes
=
" <br>By:胡宁宁"
)
@RequestMapping
(
value
=
"/userPayCancelDriverFreezeNotify"
,
method
=
RequestMethod
.
POST
)
public
Result
<
Object
>
userPayCancelDriverFreezeNotify
(
@RequestBody
NotifyString
notify
)
{
log
.
info
(
"司机冻结保证金回调接口 传参 {}"
,
notify
);
if
(
Objects
.
isNull
(
notify
)
||
Objects
.
isNull
(
notify
.
getCode
())
||
Objects
.
isNull
(
notify
.
getAction
()))
{
return
new
Result
<>();
}
String
paymentItem
=
PayUnitTypeEnum
.
FREEZE_PLATFORM_FEE
.
getCode
()+
""
;
int
operation
=
PayOperationStatusEnum
.
UNFREEZE
.
getValue
();
if
(
notify
.
getCode
()
!=
0
)
{
paymentService
.
updateOrderPaymentFail
(
notify
.
getOrderNo
(),
notify
.
getMsg
(),
operation
,
paymentItem
);
// 支付失败处理
log
.
info
(
"支付失败处理 唯一id {}"
,
notify
.
getOrderNo
());
}
else
{
paymentService
.
updateOrderPaymentSuccess
(
notify
.
getOrderNo
(),
operation
,
paymentItem
);
// 支付支付成功处理
log
.
info
(
" 支付支付成功处理 唯一id {}"
,
notify
.
getOrderNo
());
}
Result
<
Object
>
ret
=
new
Result
<>();
return
ret
;
}
@ApiOperation
(
value
=
"运单完成 保证金回调接口"
,
notes
=
" <br>By:胡宁宁"
)
@RequestMapping
(
value
=
"/userPayCompleteDriverFreezeNotify"
,
method
=
RequestMethod
.
POST
)
public
Result
<
Object
>
userPayCompleteDriverFreezeNotify
(
@RequestBody
NotifyString
notify
)
{
log
.
info
(
"司机冻结保证金回调接口 传参 {}"
,
notify
);
if
(
Objects
.
isNull
(
notify
)
||
Objects
.
isNull
(
notify
.
getCode
())
||
Objects
.
isNull
(
notify
.
getAction
()))
{
return
new
Result
<>();
}
String
paymentItem
=
PayUnitTypeEnum
.
FREEZE_PLATFORM_FEE
.
getCode
()+
""
;
int
operation
=
PayOperationStatusEnum
.
UNFREEZE
.
getValue
();
if
(
notify
.
getCode
()
!=
0
)
{
paymentService
.
updateOrderPaymentFail
(
notify
.
getOrderNo
(),
notify
.
getMsg
(),
operation
,
paymentItem
);
// 支付失败处理
log
.
info
(
"支付失败处理 唯一id {}"
,
notify
.
getOrderNo
());
}
else
{
paymentService
.
updateOrderPaymentSuccess
(
notify
.
getOrderNo
(),
operation
,
paymentItem
);
// 支付支付成功处理
log
.
info
(
" 支付支付成功处理 唯一id {}"
,
notify
.
getOrderNo
());
}
Result
<
Object
>
ret
=
new
Result
<>();
return
ret
;
}
}
}
performance-web/src/main/java/com/clx/performance/controller/temp/TempController.java
浏览文件 @
a103b8ca
...
@@ -13,8 +13,11 @@ import lombok.extern.slf4j.Slf4j;
...
@@ -13,8 +13,11 @@ import lombok.extern.slf4j.Slf4j;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.validation.constraints.NotBlank
;
/**
/**
* @Author: aiqingguo
* @Author: aiqingguo
...
@@ -51,6 +54,17 @@ public class TempController {
...
@@ -51,6 +54,17 @@ public class TempController {
return
Result
.
ok
();
return
Result
.
ok
();
}
}
@ApiOperation
(
value
=
"测试支付划账 (临时接口)"
,
notes
=
"<br>By:胡宁宁"
)
@RequestMapping
(
value
=
"/paymentTest"
,
method
=
RequestMethod
.
GET
)
public
Result
<
Void
>
paymentTest
(
@RequestParam
(
"fromUser"
)
@NotBlank
(
message
=
"扣款方"
)
String
fromUser
,
@RequestParam
(
"toUser"
)
@NotBlank
(
message
=
"收款方"
)
String
toUser
,
@RequestParam
(
"figure"
)
@NotBlank
(
message
=
"金额"
)
String
figure
)
{
tempService
.
paymentTest
(
fromUser
,
toUser
,
figure
);
return
Result
.
ok
();
}
// @ApiOperation(value = "更新网运标识", notes = "<br>By:艾庆国")
// @ApiOperation(value = "更新网运标识", notes = "<br>By:艾庆国")
// @RequestMapping(value = "/updateInvoiceType", method = RequestMethod.POST)
// @RequestMapping(value = "/updateInvoiceType", method = RequestMethod.POST)
// public Result<Void> updateInvoiceType(String childNo, Integer invoiceType) {
// public Result<Void> updateInvoiceType(String childNo, Integer invoiceType) {
...
...
performance-web/src/main/java/com/clx/performance/dao/impl/payment/OrderPaymentDaoImpl.java
0 → 100644
浏览文件 @
a103b8ca
package
com
.
clx
.
performance
.
dao
.
impl
.
payment
;
import
com.clx.performance.dao.payment.OrderPaymentDao
;
import
com.clx.performance.mapper.payment.OrderPaymentMapper
;
import
com.clx.performance.model.IntegralStatistics
;
import
com.clx.performance.model.payment.OrderPayment
;
import
com.msl.common.base.Optional
;
import
com.msl.common.dao.impl.BaseDaoImpl
;
import
org.springframework.stereotype.Repository
;
/**
* @author huningning
* Date 2024-06-18
* Time 14:01
*/
@Repository
public
class
OrderPaymentDaoImpl
extends
BaseDaoImpl
<
OrderPaymentMapper
,
OrderPayment
,
Integer
>
implements
OrderPaymentDao
{
@Override
public
Optional
<
OrderPayment
>
selectByOrderNoAndItemId
(
String
orderNo
,
String
paymentItem
)
{
return
Optional
.
of
(
orderNo
)
.
map
(
item
->
lQrWrapper
()
.
eq
(
OrderPayment:
:
getOrderNo
,
item
)
.
eq
(
OrderPayment:
:
getPaymentItem
,
paymentItem
)
)
.
map
(
super
::
getOne
);
}
@Override
public
Optional
<
OrderPayment
>
selectByRelationNo
(
String
relationNo
,
Integer
operation
,
String
paymentItem
)
{
return
Optional
.
of
(
relationNo
)
.
map
(
item
->
lQrWrapper
()
.
eq
(
OrderPayment:
:
getRelationNo
,
item
)
.
eq
(
OrderPayment:
:
getOperation
,
operation
)
.
eq
(
OrderPayment:
:
getPaymentItem
,
paymentItem
)
)
.
map
(
super
::
getOne
);
}
}
performance-web/src/main/java/com/clx/performance/dao/payment/OrderPaymentDao.java
0 → 100644
浏览文件 @
a103b8ca
package
com
.
clx
.
performance
.
dao
.
payment
;
import
com.clx.performance.mapper.payment.OrderPaymentMapper
;
import
com.clx.performance.model.payment.OrderPayment
;
import
com.msl.common.base.Optional
;
import
com.msl.common.dao.BaseDao
;
import
org.apache.ibatis.annotations.Param
;
/**
* @author huningning
* Date 2024-06-18
* Time 14:01
*/
public
interface
OrderPaymentDao
extends
BaseDao
<
OrderPaymentMapper
,
OrderPayment
,
Integer
>
{
Optional
<
OrderPayment
>
selectByOrderNoAndItemId
(
@Param
(
"orderNo"
)
String
orderNo
,
@Param
(
"paymentItem"
)
String
paymentItem
);
Optional
<
OrderPayment
>
selectByRelationNo
(
@Param
(
"relationNo"
)
String
relationNo
,
@Param
(
"operation"
)
Integer
operation
,
@Param
(
"paymentItem"
)
String
paymentItem
);
}
performance-web/src/main/java/com/clx/performance/enums/HttpEnum.java
浏览文件 @
a103b8ca
...
@@ -7,7 +7,14 @@ import lombok.Getter;
...
@@ -7,7 +7,14 @@ import lombok.Getter;
@AllArgsConstructor
@AllArgsConstructor
public
enum
HttpEnum
{
public
enum
HttpEnum
{
PERFORMANCE_PAY_CLX_PAYMENT
(
10000
,
"履约服务向老马上来发起钱包转账"
,
"/payment-service/performance/payUserWalletTransfer"
),
PERFORMANCE_PAY_CLX_PAYMENT
(
10000
,
"履约服务向老马上来发起钱包转账"
,
"/payment-service/performance/payUserWalletTransfer"
),
PERFORMANCE_PAY_CLX_DRIVER_FREEZE
(
10000
,
"履约服务向老马上来发起司机押金冻结"
,
"/payment-service/performance/freezeUserMQ"
),
PERFORMANCE_PAY_CLX_ADJUST_DRIVER_FREEZE
(
10000
,
"履约服务向老马上来发起司机押金冻结调整"
,
"/payment-service/performance/completeFreezeBatchMQ"
),
;
;
private
final
int
code
;
private
final
int
code
;
...
...
performance-web/src/main/java/com/clx/performance/enums/PayRemarkEnum.java
浏览文件 @
a103b8ca
...
@@ -26,6 +26,7 @@ public enum PayRemarkEnum {
...
@@ -26,6 +26,7 @@ public enum PayRemarkEnum {
//v78 解冻保险
//v78 解冻保险
OWNER_PAY_DRIVER_INSURANCE
(
15
,
"货主取消订单赔偿金"
),
OWNER_PAY_DRIVER_INSURANCE
(
15
,
"货主取消订单赔偿金"
),
DRIVER_PAY_OWNER_DRIVER_INSURANCE
(
16
,
"司机取消订单赔偿金"
),
DRIVER_PAY_OWNER_DRIVER_INSURANCE
(
16
,
"司机取消订单赔偿金"
),
UPDATE_DRIVER_FREEZE
(
17
,
"修正司机押金"
),
;
;
...
...
performance-web/src/main/java/com/clx/performance/mapper/payment/OrderPaymentMapper.java
0 → 100644
浏览文件 @
a103b8ca
package
com
.
clx
.
performance
.
mapper
.
payment
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.clx.performance.model.payment.OrderPayment
;
/**
* @author huningning
* Date 2024-06-18
* Time 14:01
*/
public
interface
OrderPaymentMapper
extends
BaseMapper
<
OrderPayment
>
{
}
performance-web/src/main/java/com/clx/performance/model/payment/OrderPayment.java
0 → 100644
浏览文件 @
a103b8ca
package
com
.
clx
.
performance
.
model
.
payment
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.msl.common.config.KeyColumn
;
import
com.msl.common.model.HasKey
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Getter
;
import
lombok.Setter
;
import
lombok.experimental.Accessors
;
import
java.time.LocalDateTime
;
/**
* @author huningning
* Date 2024-06-18
* Time 14:01
*/
@Getter
@Setter
@Accessors
(
chain
=
true
)
@TableName
(
"order_payment"
)
public
class
OrderPayment
implements
HasKey
<
Integer
>
{
@TableId
(
value
=
"id"
,
type
=
IdType
.
AUTO
)
private
Integer
id
;
@TableField
(
"order_no"
)
@ApiModelProperty
(
"主订单号"
)
private
String
orderNo
;
@TableField
(
"relation_no"
)
@ApiModelProperty
(
"业务关联单号"
)
private
String
relationNo
;
@TableField
(
"payment_item"
)
@ApiModelProperty
(
"交易名目"
)
private
String
paymentItem
;
@TableField
(
"serial_no"
)
@ApiModelProperty
(
"流水号"
)
private
String
serialNo
;
@TableField
(
"amount"
)
@ApiModelProperty
(
"金额"
)
private
Integer
amount
;
@TableField
(
"operation"
)
@ApiModelProperty
(
"1:冻结 2:调整 3:解冻 4:部分解冻 5:部分支付 6:支付"
)
private
Integer
operation
;
@TableField
(
"status"
)
@ApiModelProperty
(
"0: 发起,1: 成功,2:失败"
)
private
Integer
status
;
@TableField
(
"reason"
)
@ApiModelProperty
(
""
)
private
String
reason
;
@TableField
(
"create_time"
)
@ApiModelProperty
(
""
)
private
LocalDateTime
createTime
;
@TableField
(
"modified_time"
)
@ApiModelProperty
(
""
)
private
LocalDateTime
modifiedTime
;
@Override
@KeyColumn
(
"id"
)
public
Integer
gainKey
()
{
return
this
.
id
;
}
}
performance-web/src/main/java/com/clx/performance/service/PaymentService.java
浏览文件 @
a103b8ca
...
@@ -2,6 +2,7 @@ package com.clx.performance.service;
...
@@ -2,6 +2,7 @@ package com.clx.performance.service;
import
com.clx.performance.param.pc.payment.PayParam
;
import
com.clx.performance.param.pc.payment.PayParam
;
import
com.clx.performance.param.pc.payment.PayPlatformFeeParam
;
import
com.msl.common.result.Result
;
import
com.msl.common.result.Result
;
public
interface
PaymentService
{
public
interface
PaymentService
{
...
@@ -9,4 +10,16 @@ public interface PaymentService {
...
@@ -9,4 +10,16 @@ public interface PaymentService {
Result
paymentWallet
(
PayParam
noCheckPwd
);
Result
paymentWallet
(
PayParam
noCheckPwd
);
Result
paymentBreakContractWallet
(
PayParam
noCheckPwd
);
Result
paymentBreakContractWallet
(
PayParam
noCheckPwd
);
Result
paymentPlatformFee
(
PayPlatformFeeParam
param
);
Result
paymentChangePlatformFee
(
PayPlatformFeeParam
param
);
Result
paymentCompletePlatformFee
(
PayPlatformFeeParam
param
);
Result
paymentCancelPlatformFee
(
PayPlatformFeeParam
param
);
void
updateOrderPaymentFail
(
String
orderNo
,
String
msg
,
Integer
operation
,
String
paymentItem
);
void
updateOrderPaymentSuccess
(
String
orderNo
,
Integer
operation
,
String
paymentItem
);
}
}
performance-web/src/main/java/com/clx/performance/service/impl/PaymentServiceImpl.java
浏览文件 @
a103b8ca
...
@@ -5,32 +5,40 @@ import com.alibaba.fastjson.TypeReference;
...
@@ -5,32 +5,40 @@ import com.alibaba.fastjson.TypeReference;
import
com.clx.performance.config.MslPaymentConfig
;
import
com.clx.performance.config.MslPaymentConfig
;
import
com.clx.performance.constant.ActionConstants
;
import
com.clx.performance.constant.ActionConstants
;
import
com.clx.performance.dao.ThirdPartRequestLogDao
;
import
com.clx.performance.dao.ThirdPartRequestLogDao
;
import
com.clx.performance.dao.payment.OrderPaymentDao
;
import
com.clx.performance.encryption.oldmsl.PayEncryptTools
;
import
com.clx.performance.encryption.oldmsl.PayEncryptTools
;
import
com.clx.performance.encryption.oldmsl.PrivateKeyConfig
;
import
com.clx.performance.encryption.oldmsl.PrivateKeyConfig
;
import
com.clx.performance.encryption.oldmsl.SystemCodeEnum
;
import
com.clx.performance.encryption.oldmsl.SystemCodeEnum
;
import
com.clx.performance.enums.PayUnitTypeEnum
;
import
com.clx.performance.enums.*
;
import
com.clx.performance.enums.PerformanceResultEnum
;
import
com.clx.performance.enums.payment.PayOperationStatusEnum
;
import
com.clx.performance.enums.ThirdRequestTypeEnum
;
import
com.clx.performance.enums.payment.PaymentActionEnum
;
import
com.clx.performance.enums.payment.PaymentStatusEnum
;
import
com.clx.performance.model.ThirdPartRequestLog
;
import
com.clx.performance.model.ThirdPartRequestLog
;
import
com.clx.performance.param.pc.payment.PayParam
;
import
com.clx.performance.model.payment.OrderPayment
;
import
com.clx.performance.param.pc.payment.PayUnitDTO
;
import
com.clx.performance.param.pc.payment.*
;
import
com.clx.performance.param.pc.payment.PayUserDTO
;
import
com.clx.performance.service.PaymentService
;
import
com.clx.performance.service.PaymentService
;
import
com.clx.performance.service.ThirdPartRequestLogService
;
import
com.clx.performance.service.ThirdPartRequestLogService
;
import
com.google.gson.Gson
;
import
com.google.gson.Gson
;
import
com.msl.common.base.Optional
;
import
com.msl.common.dto.HttpDTO
;
import
com.msl.common.dto.HttpDTO
;
import
com.msl.common.exception.ServiceSystemException
;
import
com.msl.common.exception.ServiceSystemException
;
import
com.msl.common.result.Result
;
import
com.msl.common.result.Result
;
import
com.msl.common.utils.EncryptUtil
;
import
com.msl.common.utils.EncryptUtil
;
import
com.msl.common.utils.HttpUtil
;
import
com.msl.common.utils.HttpUtil
;
import
com.msl.common.utils.LocalDateTimeUtils
;
import
lombok.AllArgsConstructor
;
import
lombok.AllArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.interceptor.TransactionAspectSupport
;
import
java.math.BigDecimal
;
import
java.security.GeneralSecurityException
;
import
java.security.GeneralSecurityException
;
import
java.time.LocalDateTime
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.UUID
;
import
java.util.UUID
;
import
static
com
.
clx
.
performance
.
enums
.
HttpEnum
.
PERFORMANCE_PAY_CLX_PAYMENT
;
import
static
com
.
clx
.
performance
.
enums
.
HttpEnum
.
PERFORMANCE_PAY_CLX_PAYMENT
;
...
@@ -48,6 +56,18 @@ public class PaymentServiceImpl implements PaymentService {
...
@@ -48,6 +56,18 @@ public class PaymentServiceImpl implements PaymentService {
/** 违约回调地址 **/
/** 违约回调地址 **/
public
static
final
String
NOTIFY_BROKER_URL
=
"/clx-performance/payment/notify/userPayBrokerContractNotify"
;
public
static
final
String
NOTIFY_BROKER_URL
=
"/clx-performance/payment/notify/userPayBrokerContractNotify"
;
/** 司机平台押金冻结回调地址 **/
public
static
final
String
NOTIFY_PLATFORM_FEE_URL
=
"/clx-performance/payment/notify/userPayDriverFreezeNotify"
;
/** 司机平台押金冻结调整回调地址 **/
public
static
final
String
NOTIFY_ADJUST_PLATFORM_FEE_URL
=
"/clx-performance/payment/notify/userPayAdjustDriverFreezeNotify"
;
/** 司机平台押金冻结取消回调地址 **/
public
static
final
String
NOTIFY_CANCEL_PLATFORM_FEE_URL
=
"/clx-performance/payment/notify/userPayCancelDriverFreezeNotify"
;
/** 司机平台押金冻结完成回调地址 **/
public
static
final
String
NOTIFY_COMPLETE_PLATFORM_FEE_URL
=
"/clx-performance/payment/notify/userPayCompleteDriverFreezeNotify"
;
@Autowired
@Autowired
private
final
MslPaymentConfig
mslPaymentConfig
;
private
final
MslPaymentConfig
mslPaymentConfig
;
...
@@ -57,6 +77,12 @@ public class PaymentServiceImpl implements PaymentService {
...
@@ -57,6 +77,12 @@ public class PaymentServiceImpl implements PaymentService {
@Autowired
@Autowired
ThirdPartRequestLogService
thirdPartRequestLogService
;
ThirdPartRequestLogService
thirdPartRequestLogService
;
@Autowired
OrderPaymentDao
orderPaymentDao
;
@Autowired
UniqueOrderNumService
uniqueOrderNumService
;
/**
/**
* 钱包直接划账给钱包
* 钱包直接划账给钱包
*
*
...
@@ -102,7 +128,6 @@ public class PaymentServiceImpl implements PaymentService {
...
@@ -102,7 +128,6 @@ public class PaymentServiceImpl implements PaymentService {
/**
/**
* 钱包直接划账给钱包(违约)
* 钱包直接划账给钱包(违约)
*
* @param payDTO
* @param payDTO
* @return
* @return
*/
*/
...
@@ -141,6 +166,188 @@ public class PaymentServiceImpl implements PaymentService {
...
@@ -141,6 +166,188 @@ public class PaymentServiceImpl implements PaymentService {
return
notify
;
return
notify
;
}
}
/**
* 创建支付流水记录
* @param orderPayment
*/
public
void
saveOrderPayment
(
OrderPayment
orderPayment
){
orderPaymentDao
.
saveEntity
(
orderPayment
);
}
/**
* 冻结司机平台押金
* @param
* @return
*/
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
Result
paymentPlatformFee
(
PayPlatformFeeParam
payDTO
)
{
/** 创建记录 默认冻结 **/
OrderPayment
orderPayment
=
new
OrderPayment
()
.
setAmount
(
payDTO
.
getFigure
())
.
setOrderNo
(
payDTO
.
getTradeNo
())
.
setRelationNo
(
payOrderNoGenerate
())
.
setPaymentItem
(
PayUnitTypeEnum
.
FREEZE_PLATFORM_FEE
.
getCode
()
+
""
)
.
setStatus
(
PaymentStatusEnum
.
CREATE
.
getValue
())
.
setOperation
(
PayOperationStatusEnum
.
FREEZE
.
getValue
());
saveOrderPayment
(
orderPayment
);
/** 构建司机冻结单元 **/
PayUserDTO
payUserDTO
=
buildDriverFreezeBatchDTO
(
payDTO
,
orderPayment
);
log
.
info
(
"发起司机押金冻结支付请求日志 {}"
,
payUserDTO
);
Result
<
Object
>
notify
=
(
Result
<
Object
>)
postRequest
(
mslPaymentConfig
.
getHost
()
+
HttpEnum
.
PERFORMANCE_PAY_CLX_DRIVER_FREEZE
.
getUrl
(),
JSON
.
toJSONString
(
payUserDTO
));
log
.
info
(
"支付司机押金冻结支付请求 返回日志 {}"
,
notify
);
if
(
notify
==
null
)
{
throw
new
ServiceSystemException
(
PerformanceResultEnum
.
HTTP_ERROR
);
}
if
(
notify
.
getCode
()
!=
0
)
{
throw
new
ServiceSystemException
(
PerformanceResultEnum
.
HTTP_ERROR
,
notify
.
getMsg
());
}
return
notify
;
}
/**
* 调整司机平台押金
* @param
* @return
*/
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
Result
paymentChangePlatformFee
(
PayPlatformFeeParam
param
)
{
//查询冻结记录
OrderPayment
orderPaymentOptional
=
orderPaymentDao
.
selectByOrderNoAndItemId
(
param
.
getTradeNo
(),
PayUnitTypeEnum
.
FREEZE_PLATFORM_FEE
.
getCode
()
+
""
).
orNull
();
if
(
null
==
orderPaymentOptional
){
throw
new
ServiceSystemException
(
PerformanceResultEnum
.
DATA_NOT_FIND
,
"数据不存在"
)
;
}
/** 创建记录 新的调整记录 **/
OrderPayment
orderPayment
=
new
OrderPayment
()
.
setAmount
(
param
.
getFigure
())
.
setOrderNo
(
param
.
getTradeNo
())
.
setRelationNo
(
payOrderNoGenerate
())
.
setPaymentItem
(
PayUnitTypeEnum
.
FREEZE_PLATFORM_FEE
.
getCode
()
+
""
)
.
setStatus
(
PaymentStatusEnum
.
CREATE
.
getValue
())
.
setOperation
(
PayOperationStatusEnum
.
ADJUSTMENT
.
getValue
());
saveOrderPayment
(
orderPayment
);
/** 调整冻结记录 **/
FreezeBatchDTO
freezeBatchDTO
=
buildChangeFreezeBatchDTO
(
orderPaymentOptional
,
orderPayment
.
getRelationNo
()
,
param
.
getFigure
());
log
.
info
(
"发起支付请求日志 {}"
,
freezeBatchDTO
);
Result
<
Object
>
notify
=
(
Result
<
Object
>)
postRequest
(
mslPaymentConfig
.
getHost
()
+
HttpEnum
.
PERFORMANCE_PAY_CLX_ADJUST_DRIVER_FREEZE
.
getUrl
(),
JSON
.
toJSONString
(
freezeBatchDTO
));
log
.
info
(
"支付返回日志 {}"
,
notify
);
if
(
notify
==
null
)
{
throw
new
ServiceSystemException
(
PerformanceResultEnum
.
HTTP_ERROR
);
}
if
(
notify
.
getCode
()
!=
0
)
{
throw
new
ServiceSystemException
(
PerformanceResultEnum
.
HTTP_ERROR
,
notify
.
getMsg
());
}
return
notify
;
}
@Override
public
Result
paymentCompletePlatformFee
(
PayPlatformFeeParam
param
)
{
//查询冻结记录
OrderPayment
orderPaymentOptional
=
orderPaymentDao
.
selectByOrderNoAndItemId
(
param
.
getTradeNo
(),
PayUnitTypeEnum
.
FREEZE_PLATFORM_FEE
.
getCode
()
+
""
).
orNull
();
if
(
null
==
orderPaymentOptional
){
throw
new
ServiceSystemException
(
PerformanceResultEnum
.
DATA_NOT_FIND
,
"数据不存在"
)
;
}
/** 创建记录 新的调整记录 **/
OrderPayment
orderPayment
=
new
OrderPayment
()
.
setAmount
(
param
.
getFigure
())
.
setOrderNo
(
param
.
getTradeNo
())
.
setRelationNo
(
payOrderNoGenerate
())
.
setPaymentItem
(
PayUnitTypeEnum
.
FREEZE_PLATFORM_FEE
.
getCode
()
+
""
)
.
setStatus
(
PaymentStatusEnum
.
CREATE
.
getValue
())
.
setOperation
(
PayOperationStatusEnum
.
UNFREEZE
.
getValue
());
saveOrderPayment
(
orderPayment
);
/** 调整冻结记录 **/
FreezeBatchDTO
freezeBatchDTO
=
buildCompleteFreezeBatchDTO
(
orderPaymentOptional
,
orderPayment
.
getRelationNo
());
log
.
info
(
"发起支付请求日志 {}"
,
freezeBatchDTO
);
Result
<
Object
>
notify
=
(
Result
<
Object
>)
postRequest
(
mslPaymentConfig
.
getHost
()
+
HttpEnum
.
PERFORMANCE_PAY_CLX_ADJUST_DRIVER_FREEZE
.
getUrl
(),
JSON
.
toJSONString
(
freezeBatchDTO
));
log
.
info
(
"支付返回日志 {}"
,
notify
);
if
(
notify
==
null
)
{
throw
new
ServiceSystemException
(
PerformanceResultEnum
.
HTTP_ERROR
);
}
if
(
notify
.
getCode
()
!=
0
)
{
throw
new
ServiceSystemException
(
PerformanceResultEnum
.
HTTP_ERROR
,
notify
.
getMsg
());
}
return
notify
;
}
@Override
public
Result
paymentCancelPlatformFee
(
PayPlatformFeeParam
param
)
{
//查询冻结记录
OrderPayment
orderPaymentOptional
=
orderPaymentDao
.
selectByOrderNoAndItemId
(
param
.
getTradeNo
(),
PayUnitTypeEnum
.
FREEZE_PLATFORM_FEE
.
getCode
()
+
""
).
orNull
();
if
(
null
==
orderPaymentOptional
){
throw
new
ServiceSystemException
(
PerformanceResultEnum
.
DATA_NOT_FIND
,
"数据不存在"
)
;
}
/** 创建记录 新的调整记录 **/
OrderPayment
orderPayment
=
new
OrderPayment
()
.
setAmount
(
param
.
getFigure
())
.
setOrderNo
(
param
.
getTradeNo
())
.
setRelationNo
(
payOrderNoGenerate
())
.
setPaymentItem
(
PayUnitTypeEnum
.
FREEZE_PLATFORM_FEE
.
getCode
()
+
""
)
.
setStatus
(
PaymentStatusEnum
.
CREATE
.
getValue
())
.
setOperation
(
PayOperationStatusEnum
.
UNFREEZE
.
getValue
());
saveOrderPayment
(
orderPayment
);
/** 调整冻结记录 **/
FreezeBatchDTO
freezeBatchDTO
=
buildCanCelFreezeBatchDTO
(
orderPaymentOptional
,
orderPayment
.
getRelationNo
());
log
.
info
(
"发起支付请求日志 {}"
,
freezeBatchDTO
);
Result
<
Object
>
notify
=
(
Result
<
Object
>)
postRequest
(
mslPaymentConfig
.
getHost
()
+
HttpEnum
.
PERFORMANCE_PAY_CLX_ADJUST_DRIVER_FREEZE
.
getUrl
(),
JSON
.
toJSONString
(
freezeBatchDTO
));
log
.
info
(
"支付返回日志 {}"
,
notify
);
if
(
notify
==
null
)
{
throw
new
ServiceSystemException
(
PerformanceResultEnum
.
HTTP_ERROR
);
}
if
(
notify
.
getCode
()
!=
0
)
{
throw
new
ServiceSystemException
(
PerformanceResultEnum
.
HTTP_ERROR
,
notify
.
getMsg
());
}
return
notify
;
}
@Override
public
void
updateOrderPaymentFail
(
String
orderNo
,
String
msg
,
Integer
operation
,
String
paymentItem
)
{
//查询冻结记录
OrderPayment
orderPaymentOptional
=
orderPaymentDao
.
selectByRelationNo
(
orderNo
,
operation
,
paymentItem
).
orNull
();
if
(
null
==
orderPaymentOptional
){
log
.
error
(
"数据不存在 {}, {}"
,
orderNo
,
msg
);
}
orderPaymentOptional
.
setStatus
(
PaymentStatusEnum
.
FAIL
.
getValue
());
orderPaymentOptional
.
setReason
(
msg
);
orderPaymentDao
.
updateEntityByKey
(
orderPaymentOptional
);
}
@Override
public
void
updateOrderPaymentSuccess
(
String
orderNo
,
Integer
operation
,
String
paymentItem
)
{
//查询冻结记录
OrderPayment
orderPaymentOptional
=
orderPaymentDao
.
selectByRelationNo
(
orderNo
,
operation
,
paymentItem
).
orNull
();
if
(
null
==
orderPaymentOptional
){
log
.
error
(
"数据不存在 {}, {}"
,
orderNo
);
}
orderPaymentOptional
.
setStatus
(
PaymentStatusEnum
.
SUCCESS
.
getValue
());
orderPaymentDao
.
updateEntityByKey
(
orderPaymentOptional
);
}
/**
/**
* post请求
* post请求
...
@@ -187,7 +394,129 @@ public class PaymentServiceImpl implements PaymentService {
...
@@ -187,7 +394,129 @@ public class PaymentServiceImpl implements PaymentService {
}
}
/**
* 创建支付流水号
*/
private
String
payOrderNoGenerate
()
{
return
"5"
+
uniqueOrderNumService
.
getUniqueOrderNum
(
LocalDateTimeUtils
.
convertLocalDateTimeToString
(
LocalDateTime
.
now
(),
LocalDateTimeUtils
.
DATE_DAY
));
}
/**
* 构建司机冻结押金支付单元
* @param payDTO
* @param orderPayment
* @return
*/
public
PayUserDTO
buildDriverFreezeBatchDTO
(
PayPlatformFeeParam
payDTO
,
OrderPayment
orderPayment
){
/** 构建支付单元 **/
PayUnitDTO
payUnitDTO
=
PayUnitDTO
.
builder
()
.
id
(
orderPayment
.
getRelationNo
())
.
from
(
payDTO
.
getFrom
())
.
to
(
mslPaymentConfig
.
getSystemWalletCode
())
.
figure
(
payDTO
.
getFigure
())
.
type
(
PayUnitTypeEnum
.
FREEZE_PLATFORM_FEE
.
getCode
())
.
timestamp
(
System
.
currentTimeMillis
()
/
1000
)
.
remark
(
PayRemarkEnum
.
toString
(
PayRemarkEnum
.
DRIVER_CREDIT
.
getValue
())).
build
();
/** 生成签名**/
PayEncryptTools
.
sign
(
payUnitDTO
,
PrivateKeyConfig
.
privateKeyByte
);
/** 构建支付支付 ***/
PayUserDTO
payUserDTO
=
PayUserDTO
.
builder
()
.
pwd
(
payDTO
.
getPwd
())
.
system
(
SystemCodeEnum
.
PERFORMANCE_SERVICE
.
getCode
())
.
userCode
(
payDTO
.
getFrom
())
.
orderNo
(
orderPayment
.
getRelationNo
())
.
uuid
(
UUID
.
randomUUID
().
toString
().
replaceAll
(
"-"
,
""
))
.
notifyUrl
(
mslPaymentConfig
.
getNotifyhost
()
+
NOTIFY_PLATFORM_FEE_URL
)
.
payUnitDTO
(
payUnitDTO
).
build
();
return
payUserDTO
;
}
/**
* 构建 司机平台服务费冻结实体
*/
public
FreezeBatchDTO
buildChangeFreezeBatchDTO
(
OrderPayment
orderPaymentOptional
,
String
orderNo
,
Integer
figure
){
FreezeBatchDTO
freezeBatchDTO
=
new
FreezeBatchDTO
();
List
<
FreezeUnitDTO
>
FreezeUnitList
=
new
ArrayList
<
FreezeUnitDTO
>();
FreezeUnitDTO
freightPayUnitDTO
=
new
FreezeUnitDTO
();
/** 操作类型 1撤销 2完成 3修改*/
freightPayUnitDTO
.
setAction
(
PaymentActionEnum
.
Type
.
ADJUST
.
getCode
());
/** 赔偿金额(单位分)0全部返回 */
freightPayUnitDTO
.
setFigure
(
Long
.
valueOf
(
figure
));
/** 冻结序列号 (流水号)*/
freightPayUnitDTO
.
setFreezeNo
(
orderPaymentOptional
.
getSerialNo
());
freightPayUnitDTO
.
setRemark
(
PayRemarkEnum
.
toString
(
PayRemarkEnum
.
UPDATE_DRIVER_FREEZE
.
getValue
()));
freightPayUnitDTO
.
setTimestamp
(
System
.
currentTimeMillis
()
/
1000
);
PayEncryptTools
.
sign
(
freightPayUnitDTO
,
PrivateKeyConfig
.
privateKeyByte
);
FreezeUnitList
.
add
(
freightPayUnitDTO
);
freezeBatchDTO
.
setFreezeUnitList
(
FreezeUnitList
);
freezeBatchDTO
.
setOrderNo
(
orderNo
);
freezeBatchDTO
.
setSystem
(
SystemCodeEnum
.
PERFORMANCE_SERVICE
.
getCode
());
//回调地址
freezeBatchDTO
.
setNotifyUrl
(
mslPaymentConfig
.
getNotifyhost
()
+
NOTIFY_ADJUST_PLATFORM_FEE_URL
);
freezeBatchDTO
.
setUuid
(
UUID
.
randomUUID
().
toString
().
replaceAll
(
"-"
,
""
));
log
.
info
(
"平衡司机冻结保证金支付调去参数=="
+
freezeBatchDTO
.
toString
());
return
freezeBatchDTO
;
}
/**
* 构建 司机平台服务费取消实体
*/
public
FreezeBatchDTO
buildCanCelFreezeBatchDTO
(
OrderPayment
orderPaymentOptional
,
String
orderNo
){
FreezeBatchDTO
freezeBatchDTO
=
new
FreezeBatchDTO
();
List
<
FreezeUnitDTO
>
FreezeUnitList
=
new
ArrayList
<
FreezeUnitDTO
>();
FreezeUnitDTO
payUnitDTO
=
new
FreezeUnitDTO
();
/** 操作类型 1撤销 2完成 3修改*/
payUnitDTO
.
setAction
(
PaymentActionEnum
.
Type
.
CANCEL
.
getCode
());
/** 赔偿金额(单位分)0全部返回 */
payUnitDTO
.
setFigure
(
0L
);
/** 冻结序列号 (流水号)*/
payUnitDTO
.
setFreezeNo
(
orderPaymentOptional
.
getSerialNo
());
payUnitDTO
.
setFee
(
0L
);
payUnitDTO
.
setRemark
(
PayRemarkEnum
.
toString
(
PayRemarkEnum
.
DRIVER_UNFREEZE
.
getValue
()));
payUnitDTO
.
setTimestamp
(
System
.
currentTimeMillis
()
/
1000
);
PayEncryptTools
.
sign
(
payUnitDTO
,
PrivateKeyConfig
.
privateKeyByte
);
FreezeUnitList
.
add
(
payUnitDTO
);
freezeBatchDTO
.
setFreezeUnitList
(
FreezeUnitList
);
freezeBatchDTO
.
setOrderNo
(
orderNo
);
freezeBatchDTO
.
setSystem
(
SystemCodeEnum
.
PERFORMANCE_SERVICE
.
getCode
());
//回调地址
freezeBatchDTO
.
setNotifyUrl
(
mslPaymentConfig
.
getNotifyhost
()
+
NOTIFY_CANCEL_PLATFORM_FEE_URL
);
freezeBatchDTO
.
setUuid
(
UUID
.
randomUUID
().
toString
().
replaceAll
(
"-"
,
""
));
log
.
info
(
"运单取消 退还司机保证金 =="
+
freezeBatchDTO
.
toString
());
return
freezeBatchDTO
;
}
/**
* 构建 司机平台服务费完成实体
*/
public
FreezeBatchDTO
buildCompleteFreezeBatchDTO
(
OrderPayment
orderPaymentOptional
,
String
String
){
FreezeBatchDTO
freezeBatchDTO
=
new
FreezeBatchDTO
();
List
<
FreezeUnitDTO
>
FreezeUnitList
=
new
ArrayList
<
FreezeUnitDTO
>();
FreezeUnitDTO
payUnitDTO
=
new
FreezeUnitDTO
();
/** 操作类型 1撤销 2完成 3修改*/
payUnitDTO
.
setAction
(
PaymentActionEnum
.
Type
.
COMPLETE
.
getCode
());
/** 赔偿金额(单位分)0全部返回 */
payUnitDTO
.
setFigure
(
0L
);
/** 冻结序列号 (流水号)*/
payUnitDTO
.
setFreezeNo
(
orderPaymentOptional
.
getSerialNo
());
payUnitDTO
.
setFee
(
0L
);
payUnitDTO
.
setRemark
(
PayRemarkEnum
.
toString
(
PayRemarkEnum
.
DRIVER_UNFREEZE
.
getValue
()));
payUnitDTO
.
setTimestamp
(
System
.
currentTimeMillis
()
/
1000
);
PayEncryptTools
.
sign
(
payUnitDTO
,
PrivateKeyConfig
.
privateKeyByte
);
FreezeUnitList
.
add
(
payUnitDTO
);
freezeBatchDTO
.
setFreezeUnitList
(
FreezeUnitList
);
freezeBatchDTO
.
setOrderNo
(
orderPaymentOptional
.
getRelationNo
());
freezeBatchDTO
.
setSystem
(
SystemCodeEnum
.
PERFORMANCE_SERVICE
.
getCode
());
//回调地址
freezeBatchDTO
.
setNotifyUrl
(
mslPaymentConfig
.
getNotifyhost
()
+
NOTIFY_COMPLETE_PLATFORM_FEE_URL
);
freezeBatchDTO
.
setUuid
(
UUID
.
randomUUID
().
toString
().
replaceAll
(
"-"
,
""
));
log
.
info
(
"运单 完成 支付 司机保证金 =="
+
freezeBatchDTO
.
toString
());
return
freezeBatchDTO
;
}
}
}
performance-web/src/main/java/com/clx/performance/service/impl/TempServiceImpl.java
浏览文件 @
a103b8ca
...
@@ -5,10 +5,12 @@ import com.clx.performance.enums.BreakContractSettlementDriverEnum;
...
@@ -5,10 +5,12 @@ import com.clx.performance.enums.BreakContractSettlementDriverEnum;
import
com.clx.performance.enums.PayRemarkEnum
;
import
com.clx.performance.enums.PayRemarkEnum
;
import
com.clx.performance.enums.PerformanceResultEnum
;
import
com.clx.performance.enums.PerformanceResultEnum
;
import
com.clx.performance.param.pc.payment.PayParam
;
import
com.clx.performance.param.pc.payment.PayParam
;
import
com.clx.performance.param.pc.payment.PayPlatformFeeParam
;
import
com.clx.performance.service.PaymentService
;
import
com.clx.performance.service.PaymentService
;
import
com.clx.performance.model.breakcontract.BreakContractSettlementDriver
;
import
com.clx.performance.model.breakcontract.BreakContractSettlementDriver
;
import
com.clx.performance.service.TempService
;
import
com.clx.performance.service.TempService
;
import
com.clx.performance.service.settle.SettlementService
;
import
com.clx.performance.service.settle.SettlementService
;
import
com.msl.common.result.Result
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -41,18 +43,24 @@ public class TempServiceImpl implements TempService {
...
@@ -41,18 +43,24 @@ public class TempServiceImpl implements TempService {
@Override
@Override
public
void
paymentTest
(
String
fromUser
,
String
toUser
,
String
figure
)
{
public
void
paymentTest
(
String
fromUser
,
String
toUser
,
String
figure
)
{
PayParam
noCheckPwd
=
PayParam
.
builder
().
from
(
// PayParam noCheckPwd = PayParam.builder().from(
Integer
.
valueOf
(
fromUser
))
// Integer.valueOf(fromUser))
.
to
(
Integer
.
valueOf
(
toUser
))
// .to(Integer.valueOf(toUser))
.
figure
(
Integer
.
valueOf
(
figure
))
// .figure(Integer.valueOf(figure))
.
tradeNo
(
UUID
.
randomUUID
().
toString
().
replaceAll
(
"-"
,
""
))
// .tradeNo(UUID.randomUUID().toString().replaceAll("-", ""))
.
tradeId
(
"12345"
)
// .tradeId("12345")
.
pwd
(
"noCheckPwd"
)
// .pwd("noCheckPwd")
.
remark
(
PayRemarkEnum
.
toString
(
PayRemarkEnum
.
FREIGHT_TO_OWNER
.
getValue
()))
// .remark(PayRemarkEnum.toString(PayRemarkEnum.FREIGHT_TO_OWNER.getValue()))
.
build
();
// .build();
//
//
paymentService
.
paymentWallet
(
noCheckPwd
);
// paymentService.paymentWallet(noCheckPwd);
PayPlatformFeeParam
payPlatformFeeParam
=
new
PayPlatformFeeParam
();
payPlatformFeeParam
.
setFigure
(
Integer
.
valueOf
(
figure
));
payPlatformFeeParam
.
setFrom
(
Integer
.
valueOf
(
fromUser
));
payPlatformFeeParam
.
setPwd
(
toUser
);
payPlatformFeeParam
.
setTradeNo
(
UUID
.
randomUUID
().
toString
().
replaceAll
(
"-"
,
""
));
}
}
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论