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
1dce6553
Commit
1dce6553
authored
Sep 08, 2023
by
耿迪迪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
尾款结算修改
parent
80a13707
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
149 additions
and
91 deletions
+149
-91
logback.xml
precision-effect-admin/src/main/resources/logback.xml
+1
-1
SettlementDebit.java
.../system/service/impl/debitSettlement/SettlementDebit.java
+16
-37
AutoSettlePendingPayment.java
...ervice/impl/tradeSettlement/AutoSettlePendingPayment.java
+117
-0
SettlePendingPayment.java
...em/service/impl/tradeSettlement/SettlePendingPayment.java
+6
-39
SettlementTrade.java
.../system/service/impl/tradeSettlement/SettlementTrade.java
+7
-13
index.vue
precision-effect-web/src/views/account/index.vue
+2
-1
No files found.
precision-effect-admin/src/main/resources/logback.xml
View file @
1dce6553
...
...
@@ -3,7 +3,7 @@
<!-- 日志存放路径 -->
<property
name=
"root"
value=
"${log.path:-./logs}"
/>
<!-- 日志输出格式 -->
<property
name=
"log.pattern"
value=
"%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"
/>
<property
name=
"log.pattern"
value=
"%d{
yyyy-MM-dd
HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"
/>
<!-- 控制台输出 -->
<appender
name=
"console"
class=
"ch.qos.logback.core.ConsoleAppender"
>
...
...
precision-effect-system/src/main/java/com/zehong/system/service/impl/debitSettlement/SettlementDebit.java
View file @
1dce6553
package
com
.
zehong
.
system
.
service
.
impl
.
debitSettlement
;
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.TDebitCredit
;
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
com.zehong.system.
service.impl.tradeSettlement.AutoSettlePendingPayment
;
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
;
...
...
@@ -24,6 +27,8 @@ import java.util.List;
@Component
public
class
SettlementDebit
{
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
SettlementDebit
.
class
);
@Resource
private
TAccountMapper
tAccountMapper
;
...
...
@@ -32,8 +37,8 @@ public class SettlementDebit {
private
TDebitCredit
tDebitCredit
;
@
Resource
private
TTradeProjectMapper
tTradeProjectMapper
;
@
Autowired
private
AutoSettlePendingPayment
autoSettlePendingPayment
;
/**
* 借贷结算
...
...
@@ -91,18 +96,7 @@ public class SettlementDebit {
TAccount
account
=
getAccountInfo
(
deptId
);
//更新可用额度
updateAccount
(
account
,
amount
,
operatorType
);
//结算本部尾款
if
(
"0"
.
equals
(
account
.
getTransferSwitch
())){
List
<
TTradeProject
>
pendingPaymentInfo
=
tTradeProjectMapper
.
getTradePendingPaymentInfo
(
deptId
);
for
(
TTradeProject
project
:
pendingPaymentInfo
){
if
(
amount
.
compareTo
(
BigDecimal
.
ZERO
)
==
0
){
return
;
}
BigDecimal
changeAmount
=
updatePendingPayment
(
amount
,
project
);
//重新计算进账金额
amount
=
amount
.
subtract
(
changeAmount
);
}
}
autoSettlePendingPayment
.
autoSettlePendingPayment
(
amount
,
account
,
deptId
);
}
...
...
@@ -115,6 +109,7 @@ public class SettlementDebit {
private
void
updateAccount
(
TAccount
tAccount
,
BigDecimal
amount
,
String
operatorType
){
if
(
amount
.
compareTo
(
BigDecimal
.
ZERO
)
==
0
)
return
;
tAccount
.
setAbleAmount
(
tAccount
.
getAbleAmount
().
add
(
amount
));
tAccount
.
setUpdateTime
(
new
Date
());
tAccountMapper
.
updateTAccount
(
tAccount
);
//更新资金变动日志
TCashOperate
operate
=
OperatorParam
(
tAccount
.
getDeptId
(),
amount
,
this
.
tDebitCredit
.
getDebitId
().
toString
());
...
...
@@ -133,28 +128,11 @@ public class SettlementDebit {
TAccount
tAccount
=
new
TAccount
();
tAccount
.
setDeptId
(
deptId
);
List
<
TAccount
>
accounts
=
tAccountMapper
.
selectTAccountList
(
tAccount
);
assert
!
Collections
.
isEmpty
(
accounts
)
:
"部门资金账户不能为空,部门id:"
+
deptId
;
return
accounts
.
get
(
0
);
if
(
Collections
.
isEmpty
(
accounts
)){
log
.
error
(
"交易部门资金账户不能为空,部门id:"
+
deptId
);
throw
new
BusinessException
(
"交易部门资金账户不能为空!"
);
}
/**
* 更新尾款信息
* @param incomeAmount 进账金额
* @param project 交易项目
*/
private
BigDecimal
updatePendingPayment
(
BigDecimal
incomeAmount
,
TTradeProject
project
){
//资金变动金额
BigDecimal
amount
=
incomeAmount
.
compareTo
(
project
.
getPendingPayment
())
==
1
?
project
.
getPendingPayment
()
:
incomeAmount
;
//尾款
BigDecimal
pendingPayment
=
incomeAmount
.
compareTo
(
project
.
getPendingPayment
())
==
-
1
?
project
.
getPendingPayment
().
subtract
(
incomeAmount
)
:
new
BigDecimal
(
"0"
);
project
.
setPendingPayment
(
pendingPayment
);
tTradeProjectMapper
.
updateTTradeProject
(
project
);
//更新资金变动日志
TCashOperate
operate
=
OperatorParam
(
project
.
getTradeDeptId
(),
amount
,
project
.
getTradeId
().
toString
());
operate
.
setOperateType
(
"3"
);
operate
.
setDocumentType
(
"4"
);
//1.交易单 2.借支单 3.外部采购单 4.借贷单
cashOperateMapper
.
insertTCashOperate
(
operate
);
return
amount
;
return
accounts
.
get
(
0
);
}
...
...
@@ -171,6 +149,7 @@ public class SettlementDebit {
operate
.
setOperateAmount
(
amount
.
compareTo
(
BigDecimal
.
ZERO
)
==
1
?
amount:
amount
.
abs
());
operate
.
setOperateTime
(
new
Date
());
operate
.
setRelationDoc
(
receiptNum
);
operate
.
setOperatePersonId
(
SecurityUtils
.
getLoginUser
().
getUser
().
getUserId
());
return
operate
;
}
...
...
precision-effect-system/src/main/java/com/zehong/system/service/impl/tradeSettlement/AutoSettlePendingPayment.java
0 → 100644
View file @
1dce6553
package
com
.
zehong
.
system
.
service
.
impl
.
tradeSettlement
;
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
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
AutoSettlePendingPayment
{
@Resource
private
TTradeProjectMapper
tTradeProjectMapper
;
@Resource
private
TAccountMapper
tAccountMapper
;
@Resource
private
TCashOperateMapper
tCashOperateMapper
;
/**
* 自动结算本部尾款
* @param incomeAmount 进账金额
* @param account 账户信息
* @param deptId 部门id
*/
public
void
autoSettlePendingPayment
(
BigDecimal
incomeAmount
,
TAccount
account
,
Long
deptId
){
//判断进账金额及本部自动划拨开关是否开启
if
(
incomeAmount
.
compareTo
(
BigDecimal
.
ZERO
)
==
1
&&
"0"
.
equals
(
account
.
getTransferSwitch
())){
//结算本部尾款
List
<
TTradeProject
>
pendingPaymentInfo
=
tTradeProjectMapper
.
getTradePendingPaymentInfo
(
deptId
);
for
(
TTradeProject
project
:
pendingPaymentInfo
){
if
(
incomeAmount
.
compareTo
(
BigDecimal
.
ZERO
)
==
0
){
return
;
}
//本部账户结算
BigDecimal
amount
=
settleSelfAccountInfo
(
incomeAmount
,
project
,
account
);
//卖方部门账户结算
settleSaleAccountInfo
(
amount
,
project
);
//重新计算进账金额
incomeAmount
=
incomeAmount
.
subtract
(
amount
);
}
}
}
/**
* 本部门账户信息变动
* @param incomeAmount 进账金额
* @param project 交易项目
* @param account 账户信息
* @return
*/
private
BigDecimal
settleSelfAccountInfo
(
BigDecimal
incomeAmount
,
TTradeProject
project
,
TAccount
account
)
{
//更新项目尾款信息
BigDecimal
amount
=
incomeAmount
.
compareTo
(
project
.
getPendingPayment
())
==
1
?
project
.
getPendingPayment
()
:
incomeAmount
;
//尾款
BigDecimal
pendingPayment
=
incomeAmount
.
compareTo
(
project
.
getPendingPayment
())
==
-
1
?
project
.
getPendingPayment
().
subtract
(
incomeAmount
)
:
new
BigDecimal
(
"0"
);
project
.
setPendingPayment
(
pendingPayment
);
tTradeProjectMapper
.
updateTTradeProject
(
project
);
//更新账户信息
account
.
setAbleAmount
(
account
.
getAbleAmount
().
subtract
(
amount
));
account
.
setUpdateTime
(
new
Date
());
tAccountMapper
.
updateTAccount
(
account
);
//添加操作记录
TCashOperate
operate
=
new
TCashOperate
();
operate
.
setOperateDeptId
(
project
.
getTradeDeptId
());
operate
.
setOperateAmount
(
amount
.
compareTo
(
BigDecimal
.
ZERO
)
==
1
?
amount:
amount
.
abs
());
operate
.
setOperateTime
(
new
Date
());
operate
.
setRelationDoc
(
project
.
getTradeId
().
toString
());
operate
.
setOperateType
(
"3"
);
//1.交易单 2.借支单 3.外部采购单 4.借贷单
operate
.
setDocumentType
(
"1"
);
operate
.
setOperatePersonId
(
SecurityUtils
.
getLoginUser
().
getUser
().
getUserId
());
tCashOperateMapper
.
insertTCashOperate
(
operate
);
return
amount
;
}
/**
* 卖方部门结算
* @param amount 进账金额
* @param project 交易项目信息
*/
private
void
settleSaleAccountInfo
(
BigDecimal
amount
,
TTradeProject
project
){
//更新账户信息
TAccount
tAccount
=
new
TAccount
();
tAccount
.
setDeptId
(
project
.
getApplyDeptId
());
List
<
TAccount
>
accounts
=
tAccountMapper
.
selectTAccountList
(
tAccount
);
TAccount
accountInfo
=
accounts
.
get
(
0
);
accountInfo
.
setAbleAmount
(
accountInfo
.
getAbleAmount
().
add
(
amount
));
accountInfo
.
setUpdateTime
(
new
Date
());
tAccountMapper
.
updateTAccount
(
accountInfo
);
//添加操作记录
TCashOperate
operate
=
new
TCashOperate
();
operate
.
setOperateDeptId
(
project
.
getApplyDeptId
());
operate
.
setOperateAmount
(
amount
.
compareTo
(
BigDecimal
.
ZERO
)
==
1
?
amount:
amount
.
abs
());
operate
.
setOperateTime
(
new
Date
());
operate
.
setRelationDoc
(
project
.
getTradeId
().
toString
());
operate
.
setOperateType
(
"10"
);
//1.交易单 2.借支单 3.外部采购单 4.借贷单
operate
.
setDocumentType
(
"1"
);
operate
.
setOperatePersonId
(
SecurityUtils
.
getLoginUser
().
getUser
().
getUserId
());
tCashOperateMapper
.
insertTCashOperate
(
operate
);
}
}
precision-effect-system/src/main/java/com/zehong/system/service/impl/tradeSettlement/SettlePendingPayment.java
View file @
1dce6553
...
...
@@ -11,6 +11,7 @@ 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
;
...
...
@@ -38,6 +39,9 @@ public class SettlePendingPayment {
@Resource
private
TCashOperateMapper
cashOperateMapper
;
@Autowired
private
AutoSettlePendingPayment
autoSettlePendingPayment
;
/**
* 可用账户结算
*/
...
...
@@ -77,21 +81,9 @@ public class SettlePendingPayment {
*/
private
void
settleSellerAbleAmount
(
BigDecimal
incomeAmount
)
{
TAccount
account
=
getAccountInfo
(
this
.
tradeProject
.
getApplyDeptId
());
//判断是否有进账
if
(
incomeAmount
.
compareTo
(
BigDecimal
.
ZERO
)
==
1
&&
"0"
.
equals
(
account
.
getTransferSwitch
())){
//结算本部尾款
List
<
TTradeProject
>
pendingPaymentInfo
=
tTradeProjectMapper
.
getTradePendingPaymentInfo
(
this
.
tradeProject
.
getApplyDeptId
());
for
(
TTradeProject
project
:
pendingPaymentInfo
){
if
(
incomeAmount
.
compareTo
(
BigDecimal
.
ZERO
)
==
0
){
return
;
}
BigDecimal
amount
=
updatePendingPayment
(
incomeAmount
,
project
);
//重新计算进账金额
incomeAmount
=
incomeAmount
.
subtract
(
amount
);
}
}
//更新可用额度
updateAccount
(
account
,
incomeAmount
);
autoSettlePendingPayment
.
autoSettlePendingPayment
(
incomeAmount
,
account
,
this
.
tradeProject
.
getApplyDeptId
());
}
/**
...
...
@@ -119,6 +111,7 @@ public class SettlePendingPayment {
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
();
...
...
@@ -129,34 +122,8 @@ public class SettlePendingPayment {
//1.交易单 2.借支单 3.外部采购单 4.借贷单
operate
.
setDocumentType
(
"1"
);
operate
.
setOperateType
(
amount
.
compareTo
(
BigDecimal
.
ZERO
)
==
1
?
"1"
:
"2"
);
//TODO 操作人
operate
.
setOperatePersonId
(
SecurityUtils
.
getLoginUser
().
getUser
().
getUserId
());
cashOperateMapper
.
insertTCashOperate
(
operate
);
}
/**
* 更新尾款信息
* @param incomeAmount 进账金额
* @param project 交易项目
*/
private
BigDecimal
updatePendingPayment
(
BigDecimal
incomeAmount
,
TTradeProject
project
){
//资金变动金额
BigDecimal
amount
=
incomeAmount
.
compareTo
(
project
.
getPendingPayment
())
==
1
?
project
.
getPendingPayment
()
:
incomeAmount
;
//尾款
BigDecimal
pendingPayment
=
incomeAmount
.
compareTo
(
project
.
getPendingPayment
())
==
-
1
?
project
.
getPendingPayment
().
subtract
(
incomeAmount
)
:
new
BigDecimal
(
"0"
);
project
.
setPendingPayment
(
pendingPayment
);
tTradeProjectMapper
.
updateTTradeProject
(
project
);
//更新资金变动日志
TCashOperate
operate
=
new
TCashOperate
();
operate
.
setOperateDeptId
(
project
.
getTradeDeptId
());
operate
.
setOperateAmount
(
amount
.
compareTo
(
BigDecimal
.
ZERO
)
==
1
?
amount:
amount
.
abs
());
operate
.
setOperateTime
(
new
Date
());
operate
.
setRelationDoc
(
project
.
getTradeId
().
toString
());
operate
.
setOperateType
(
"3"
);
operate
.
setDocumentType
(
"1"
);
//1.交易单 2.借支单 3.外部采购单 4.借贷单
cashOperateMapper
.
insertTCashOperate
(
operate
);
return
amount
;
}
}
precision-effect-system/src/main/java/com/zehong/system/service/impl/tradeSettlement/SettlementTrade.java
View file @
1dce6553
...
...
@@ -11,6 +11,7 @@ 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
;
...
...
@@ -37,6 +38,9 @@ public class SettlementTrade {
@Resource
private
TCashOperateMapper
cashOperateMapper
;
@Autowired
private
AutoSettlePendingPayment
autoSettlePendingPayment
;
/**
* 可用账户结算
*/
...
...
@@ -89,19 +93,7 @@ public class SettlementTrade {
BigDecimal
incomeAmount
=
this
.
tradeProject
.
getDealPrice
().
subtract
(
this
.
tradeProject
.
getPendingPayment
());
//更新可用额度
updateAccount
(
account
,
incomeAmount
);
//判断是否有进账
if
(
incomeAmount
.
compareTo
(
BigDecimal
.
ZERO
)
==
1
&&
"0"
.
equals
(
account
.
getTransferSwitch
())){
//结算本部尾款
List
<
TTradeProject
>
pendingPaymentInfo
=
tTradeProjectMapper
.
getTradePendingPaymentInfo
(
this
.
tradeProject
.
getApplyDeptId
());
for
(
TTradeProject
project
:
pendingPaymentInfo
){
if
(
incomeAmount
.
compareTo
(
BigDecimal
.
ZERO
)
==
0
){
return
;
}
BigDecimal
amount
=
updatePendingPayment
(
incomeAmount
,
project
);
//重新计算进账金额
incomeAmount
=
incomeAmount
.
subtract
(
amount
);
}
}
autoSettlePendingPayment
.
autoSettlePendingPayment
(
incomeAmount
,
account
,
this
.
tradeProject
.
getApplyDeptId
());
}
/**
...
...
@@ -129,6 +121,7 @@ public class SettlementTrade {
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
=
OperatorParam
(
tAccount
.
getDeptId
(),
amount
,
this
.
tradeProject
.
getTradeId
().
toString
());
...
...
@@ -174,6 +167,7 @@ public class SettlementTrade {
operate
.
setOperateAmount
(
amount
.
compareTo
(
BigDecimal
.
ZERO
)
==
1
?
amount:
amount
.
abs
());
operate
.
setOperateTime
(
new
Date
());
operate
.
setRelationDoc
(
receiptNum
);
operate
.
setOperatePersonId
(
SecurityUtils
.
getLoginUser
().
getUser
().
getUserId
());
return
operate
;
}
...
...
precision-effect-web/src/views/account/index.vue
View file @
1dce6553
...
...
@@ -269,11 +269,12 @@
<span
v-if=
"scope.row.operateType == '2'"
>
交易支出
</span>
<span
v-if=
"scope.row.operateType == '3'"
>
交易尾款扣除项目
</span>
<span
v-if=
"scope.row.operateType == '4'"
>
采购(报销)支出
</span>
<span
v-if=
"scope.row.operateType == '9'"
>
借支支出
</span>
<span
v-if=
"scope.row.operateType == '5'"
>
出借-支出
</span>
<span
v-if=
"scope.row.operateType == '6'"
>
借款-收入
</span>
<span
v-if=
"scope.row.operateType == '7'"
>
还款-支出
</span>
<span
v-if=
"scope.row.operateType == '8'"
>
还款进账-收入
</span>
<span
v-if=
"scope.row.operateType == '9'"
>
借支支出
</span>
<span
v-if=
"scope.row.operateType == '10'"
>
交易尾款收入项目
</span>
</
template
>
</el-table-column>
<el-table-column
label=
"金额"
align=
"center"
prop=
"operateAmount"
/>
...
...
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