Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
P
precision-effect
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
耿迪迪
precision-effect
Commits
bb6dd7e7
Commit
bb6dd7e7
authored
Oct 30, 2023
by
王晓倩
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
账户自动划拨关闭时订单分批支付
parent
3525ae4d
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
321 additions
and
29 deletions
+321
-29
TTradeProject.java
...src/main/java/com/zehong/system/domain/TTradeProject.java
+10
-0
TTradeProjectServiceImpl.java
.../zehong/system/service/impl/TTradeProjectServiceImpl.java
+20
-2
SettlePayAmount.java
.../system/service/impl/tradeSettlement/SettlePayAmount.java
+125
-0
OperatorButton.vue
...-effect-web/src/views/trade/components/OperatorButton.vue
+39
-27
ToPay.vue
precision-effect-web/src/views/trade/components/ToPay.vue
+127
-0
No files found.
precision-effect-system/src/main/java/com/zehong/system/domain/TTradeProject.java
View file @
bb6dd7e7
...
...
@@ -163,6 +163,8 @@ public class TTradeProject extends BaseEntity
private
String
sortType
;
private
BigDecimal
payAmount
;
/** 评价时间 */
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@Excel
(
name
=
"评价时间"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd"
)
...
...
@@ -645,6 +647,14 @@ public class TTradeProject extends BaseEntity
this
.
approvalTime
=
approvalTime
;
}
public
BigDecimal
getPayAmount
()
{
return
payAmount
;
}
public
void
setPayAmount
(
BigDecimal
payAmount
)
{
this
.
payAmount
=
payAmount
;
}
@Override
public
String
toString
()
{
return
new
ToStringBuilder
(
this
,
ToStringStyle
.
MULTI_LINE_STYLE
)
...
...
precision-effect-system/src/main/java/com/zehong/system/service/impl/TTradeProjectServiceImpl.java
View file @
bb6dd7e7
...
...
@@ -14,6 +14,7 @@ import com.zehong.system.mapper.TTradeProjectMapper;
import
com.zehong.system.service.ITTradeProjectService
;
import
com.zehong.system.service.impl.tradeRoles.TradeRoles
;
import
com.zehong.system.service.impl.tradeRoles.roles.*
;
import
com.zehong.system.service.impl.tradeSettlement.SettlePayAmount
;
import
com.zehong.system.service.impl.tradeSettlement.SettlePendingPayment
;
import
com.zehong.system.service.impl.tradeSettlement.SettlementTrade
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -51,6 +52,9 @@ public class TTradeProjectServiceImpl implements ITTradeProjectService
@Resource
private
SettlePendingPayment
settlePendingPayment
;
@Resource
private
SettlePayAmount
settlePayAmount
;
/**
* 查询交易项目
*
...
...
@@ -256,14 +260,28 @@ public class TTradeProjectServiceImpl implements ITTradeProjectService
//交易结算
settlementTrade
.
settleAbleAmount
(
tradeInfo
);
}
else
{
//自动划拨关闭情况下成交价全部计入尾款,可执行“去支付”操作
tradeInfo
.
setTradeStatus
(
"5"
);
tradeInfo
.
setPendingPayment
(
tradeInfo
.
getDealPrice
());
}
return
;
}
//去支付
if
(
"5"
.
equals
(
tTradeProject
.
getTradeStatus
())){
settlementTrade
.
settleAbleAmount
(
tradeInfo
);
tradeInfo
.
setTradeStatus
(
"3"
);
BigDecimal
payAmount
=
tTradeProject
.
getPayAmount
();
BigDecimal
pendingPayment
=
tradeInfo
.
getPendingPayment
();
// 更新交易单尾款
if
(
payAmount
.
compareTo
(
pendingPayment
)
==
0
){
// 支付金额等于尾款
tradeInfo
.
setTradeStatus
(
"3"
);
tradeInfo
.
setPendingPayment
(
BigDecimal
.
ZERO
);
}
else
if
(
payAmount
.
compareTo
(
pendingPayment
)
==
-
1
){
// 支付金额小于尾款
tradeInfo
.
setPendingPayment
(
pendingPayment
.
subtract
(
payAmount
));
}
settlePayAmount
.
settlePayAmount
(
tTradeProject
,
tradeInfo
);
}
}
...
...
precision-effect-system/src/main/java/com/zehong/system/service/impl/tradeSettlement/SettlePayAmount.java
0 → 100644
View file @
bb6dd7e7
package
com
.
zehong
.
system
.
service
.
impl
.
tradeSettlement
;
import
com.zehong.common.core.exception.BusinessException
;
import
com.zehong.common.utils.SecurityUtils
;
import
com.zehong.system.domain.TAccount
;
import
com.zehong.system.domain.TCashOperate
;
import
com.zehong.system.domain.TTradeProject
;
import
com.zehong.system.mapper.TAccountMapper
;
import
com.zehong.system.mapper.TCashOperateMapper
;
import
com.zehong.system.mapper.TTradeProjectMapper
;
import
io.jsonwebtoken.lang.Collections
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.Resource
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
java.util.List
;
/**
* @author geng
* 交易结算
*/
@Component
public
class
SettlePayAmount
{
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
SettlePayAmount
.
class
);
private
TTradeProject
tradeProject
;
@Resource
private
TAccountMapper
tAccountMapper
;
@Resource
private
TTradeProjectMapper
tTradeProjectMapper
;
@Resource
private
TCashOperateMapper
cashOperateMapper
;
@Autowired
private
AutoSettlePendingPayment
autoSettlePendingPayment
;
/**
* 可用账户结算
*/
public
void
settlePayAmount
(
TTradeProject
tradeProject
,
TTradeProject
tradeInfo
){
//对象已更新尾款值
this
.
tradeProject
=
tradeInfo
;
this
.
tradeProject
.
setPayAmount
(
tradeProject
.
getPayAmount
());
//买方结算
settleBuyerAbleAmount
();
//卖方结算
settleSellerAbleAmount
();
}
/**
* 买方结算
*/
private
void
settleBuyerAbleAmount
()
{
TAccount
account
=
getAccountInfo
(
this
.
tradeProject
.
getTradeDeptId
());
BigDecimal
payAmount
=
this
.
tradeProject
.
getPayAmount
();
//判断买方可用额度是否足够支付本次金额
if
(
account
.
getAbleAmount
().
compareTo
(
payAmount
)
==
-
1
){
throw
new
BusinessException
(
"账户可用金额不足"
);
}
//更新可用额度
updateAccount
(
account
,
payAmount
.
negate
());
}
/**
* 卖方结算
*/
private
void
settleSellerAbleAmount
()
{
TAccount
account
=
getAccountInfo
(
this
.
tradeProject
.
getApplyDeptId
());
BigDecimal
payAmount
=
this
.
tradeProject
.
getPayAmount
();
//更新可用额度
updateAccount
(
account
,
payAmount
);
//卖方账户自动划拨如开启,自动结算本部门未付尾款
autoSettlePendingPayment
.
autoSettlePendingPayment
(
payAmount
,
account
,
this
.
tradeProject
.
getApplyDeptId
());
}
/**
* 获取账户信息
* @param deptId
* @return
*/
private
TAccount
getAccountInfo
(
Long
deptId
){
TAccount
tAccount
=
new
TAccount
();
tAccount
.
setDeptId
(
deptId
);
List
<
TAccount
>
accounts
=
tAccountMapper
.
selectTAccountList
(
tAccount
);
if
(
Collections
.
isEmpty
(
accounts
)){
log
.
error
(
"交易部门资金账户不能为空,部门id:"
+
tradeProject
.
getApplyDeptId
());
throw
new
BusinessException
(
"交易部门资金账户不能为空!"
);
}
return
accounts
.
get
(
0
);
}
/**
* 更新账户可用金额
* @param tAccount 账户信息
* @param amount 账户变动金额
*/
private
void
updateAccount
(
TAccount
tAccount
,
BigDecimal
amount
){
if
(
amount
.
compareTo
(
BigDecimal
.
ZERO
)
==
0
)
return
;
tAccount
.
setAbleAmount
(
tAccount
.
getAbleAmount
().
add
(
amount
));
tAccount
.
setUpdateTime
(
new
Date
());
tAccountMapper
.
updateTAccount
(
tAccount
);
//更新资金变动日志
TCashOperate
operate
=
new
TCashOperate
();
operate
.
setOperateDeptId
(
tAccount
.
getDeptId
());
operate
.
setOperateAmount
(
amount
.
compareTo
(
BigDecimal
.
ZERO
)
==
1
?
amount:
amount
.
abs
());
operate
.
setOperateTime
(
new
Date
());
operate
.
setRelationDoc
(
this
.
tradeProject
.
getTradeId
().
toString
());
//1.交易单 2.借支单 3.外部采购单 4.借贷单
operate
.
setDocumentType
(
"1"
);
operate
.
setOperateType
(
amount
.
compareTo
(
BigDecimal
.
ZERO
)
==
1
?
"1"
:
"2"
);
operate
.
setOperatePersonId
(
SecurityUtils
.
getLoginUser
().
getUser
().
getUserId
());
cashOperateMapper
.
insertTCashOperate
(
operate
);
}
}
precision-effect-web/src/views/trade/components/OperatorButton.vue
View file @
bb6dd7e7
...
...
@@ -4,7 +4,7 @@
<el-dialog
:title=
"getOperatorName()"
:visible
.
sync=
"open"
width=
"800px"
append-to-body
:close-on-click-modal=
"false"
destroy-on-close
>
<component
:is=
"currentTabComponent"
:tradeData=
"tradeData"
ref=
"currentCom"
v-if=
"open"
></component>
<div
slot=
"footer"
class=
"dialog-footer"
style=
"text-align: center"
v-if=
"operatorName != 'tradeDetail'"
>
<el-button
style=
"width: 150px;border-color: #1890ff;color: #1890ff;"
@
click=
"resetSuggestion"
>
重置意见
</el-button>
<el-button
style=
"width: 150px;border-color: #1890ff;color: #1890ff;"
@
click=
"resetSuggestion"
v-if=
"operatorName != 'toPay'"
>
重置意见
</el-button>
<el-button
type=
"primary"
style=
"width: 150px"
v-if=
"operatorName == 'evaluate'"
@
click=
"reject"
>
驳回
</el-button>
<el-button
type=
"primary"
style=
"width: 150px"
@
click=
"submitSuggestion"
>
提交
</el-button>
</div>
...
...
@@ -18,6 +18,7 @@
import
evaluate
from
"./Evaluate"
;
import
confirm
from
"./Confirm"
;
import
approval
from
"./Approval"
;
import
toPay
from
"./ToPay"
;
import
{
sendNotice
,
noticeIsReadByRelationId
}
from
"@/api/system/notice"
;
export
default
{
name
:
"operator-button"
,
...
...
@@ -25,7 +26,8 @@
evaluate
,
confirm
,
approval
,
tradeDetail
tradeDetail
,
toPay
},
props
:{
operatorName
:
{
...
...
@@ -65,10 +67,10 @@
}
},
openDialog
(){
if
(
this
.
operatorName
==
"toPay"
){
this
.
toPay
();
return
;
}
//
if(this.operatorName == "toPay"){
//
this.toPay();
//
return;
//
}
if
(
this
.
operatorName
==
"settlePendingPayment"
){
this
.
settlePendingPayment
();
return
;
...
...
@@ -76,27 +78,27 @@
this
.
getProjectInfo
();
},
//去支付
toPay
(){
this
.
$confirm
(
'是否确认去支付'
,
"警告"
,
{
confirmButtonText
:
"确定"
,
cancelButtonText
:
"取消"
,
type
:
"warning"
,
}
)
.
then
(()
=>
{
settlementTrade
({
tradeId
:
this
.
tradeInfo
.
tradeId
,
tradeStatus
:
"5"
}).
then
(
res
=>
{
if
(
res
.
code
==
200
){
this
.
$emit
(
"getList"
);
this
.
msgSuccess
(
"支付成功"
);
}
})
})
.
catch
(()
=>
{});
},
//
toPay(){
//
this.$confirm(
//
'是否确认去支付',
//
"警告",
//
{
//
confirmButtonText: "确定",
//
cancelButtonText: "取消",
//
type: "warning",
//
}
//
)
//
.then(() => {
//
settlementTrade({tradeId:this.tradeInfo.tradeId,tradeStatus:"5"}).then(res =>{
//
if(res.code == 200){
//
this.$emit("getList");
//
this.msgSuccess("支付成功");
//
}
//
})
//
})
//
.catch(() => {});
//
//
},
settlePendingPayment
(){
this
.
$confirm
(
'是否确认结算尾款'
,
...
...
@@ -152,6 +154,16 @@
})
return
;
}
if
(
this
.
operatorName
==
"toPay"
){
settlementTrade
(
this
.
$refs
.
currentCom
.
submitSuggestion
()).
then
(
res
=>
{
if
(
res
.
code
==
200
){
this
.
open
=
false
;
this
.
$emit
(
"getList"
);
this
.
$message
.
success
(
"支付成功!"
);
}
})
return
;
}
let
that
=
this
;
updateProject
(
this
.
$refs
.
currentCom
.
submitSuggestion
()).
then
(
res
=>
{
if
(
res
.
code
==
200
){
...
...
precision-effect-web/src/views/trade/components/ToPay.vue
0 → 100644
View file @
bb6dd7e7
<
template
>
<div
class=
"toPay"
>
<!-- 去支付 -->
<el-row
style=
"margin-left:95px"
>
<el-col
:span=
"12"
>
<el-row>
<el-col
:span=
"8"
>
交易细项名称:
</el-col>
<el-col
:span=
"16"
>
{{
tradeData
.
transactionDetailName
}}
</el-col>
</el-row>
</el-col>
<el-col
:span=
"11"
>
<el-row>
<el-col
:span=
"8"
>
交易申请时间:
</el-col>
<el-col
:span=
"16"
>
{{
tradeData
.
createTime
}}
</el-col>
</el-row>
</el-col>
</el-row>
<el-row
style=
"margin-left:95px;padding-top: 15px"
>
<el-col
:span=
"12"
>
<el-row>
<el-col
:span=
"8"
>
交易成交价:
</el-col>
<el-col
:span=
"16"
>
{{
tradeData
.
dealPrice
}}
</el-col>
</el-row>
</el-col>
<el-col
:span=
"11"
>
<el-row>
<el-col
:span=
"8"
>
未付金额:
</el-col>
<el-col
:span=
"16"
>
{{
tradeData
.
pendingPayment
}}
</el-col>
</el-row>
</el-col>
</el-row>
<el-divider></el-divider>
<!--
<div
style=
"margin: 11px 30px;color: #1890ff;"
>
交易支付
</div>
-->
<el-row
style=
"margin-left:95px; padding-top: 20px"
>
<el-col
:span=
"12"
>
<el-col
:span=
"6"
>
支付金额:
</el-col>
<el-col
:span=
"8"
>
<el-input
v-model=
"payAmount"
placeholder=
"请输入支付金额"
style=
"width: 200px"
clearable
/><br>
<el-button
type=
"text"
@
click=
"payAll"
>
全额支付
</el-button>
</el-col>
</el-col>
</el-row>
</div>
</
template
>
<
script
>
import
CommonInfo
from
"./CommonInfo"
;
import
{
treeselect
}
from
"@/api/system/dept"
;
import
{
selectTransactorByDeptId
}
from
"@/api/system/user"
;
import
Treeselect
from
"@riophae/vue-treeselect"
;
import
"@riophae/vue-treeselect/dist/vue-treeselect.css"
;
import
moment
from
"moment"
;
export
default
{
name
:
"toPay"
,
props
:{
tradeData
:
{
type
:
Object
}
},
components
:{
CommonInfo
,
Treeselect
},
data
(){
return
{
payAmount
:
null
,
}
},
created
()
{
},
watch
:{
"tradeDeptId"
:{
handler
(
newValue
,
oldValue
){
this
.
getTransactor
();
},
deep
:
true
,
},
},
methods
:{
payAll
(){
this
.
payAmount
=
this
.
tradeData
.
pendingPayment
;
},
checkParam
(){
if
(
this
.
payAmount
<=
0
||
this
.
payAmount
>
this
.
tradeData
.
pendingPayment
)
{
this
.
$message
.
error
(
"请输入正确的支付金额!"
);
return
true
;
}
},
submitSuggestion
(){
return
{
tradeId
:
this
.
tradeData
.
tradeId
,
tradeStatus
:
"5"
,
payAmount
:
this
.
payAmount
};
}
}
}
</
script
>
<
style
scoped
lang=
"scss"
>
.toPay
{
/*height: 460px;*/
overflow-y
:
auto
;
&
:
:-
webkit-scrollbar
{
/* 设置滚动条宽度 */
width
:
4px
;
/* 设置滚动条背景色 */
//background: black;
}
//滚动条轨道
&
:
:-
webkit-scrollbar-track
{
background-color
:transparent
;
-webkit-border-radius
:
2em
;
-moz-border-radius
:
2em
;
border-radius
:
2em
;
}
//滚动条滑块
&
:
:-
webkit-scrollbar-thumb
{
background-color
:
rgb
(
147
,
147
,
153
,
0
.5
);
-webkit-border-radius
:
2em
;
-moz-border-radius
:
2em
;
border-radius
:
2em
;
}
}
</
style
>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment