Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
huatu_API
Project
Project
Details
Activity
Releases
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
liudong1993
huatu_API
Commits
14d652ca
Commit
14d652ca
authored
Sep 22, 2025
by
liudong1993
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
cddb18f8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
212 additions
and
6 deletions
+212
-6
FinanceWorkFlowModule_p3.cs
REBORN.Module.FinanceModule/FinanceWorkFlowModule_p3.cs
+191
-0
FinancialService2.cs
REBORN.Services.FinanceService/FinancialService2.cs
+21
-6
No files found.
REBORN.Module.FinanceModule/FinanceWorkFlowModule_p3.cs
View file @
14d652ca
...
@@ -9210,5 +9210,196 @@ namespace REBORN.Module.FinanceModule
...
@@ -9210,5 +9210,196 @@ namespace REBORN.Module.FinanceModule
return
true
;
return
true
;
}
}
/// <summary>
/// 更新手续费
/// </summary>
/// <param name="frid"></param>
/// <param name="userInfo"></param>
/// <returns></returns>
public
string
UpdateTransactionFee
(
int
frid
,
decimal
TFee
,
UserInfo
userInfo
)
{
var
fffmodel
=
RB_FinanceRepository
.
GetEntity
(
frid
);
if
(
fffmodel
==
null
)
{
return
"单据不存在"
;
}
if
(
fffmodel
.
Type
!=
WFTempLateClassEnum
.
OUT
)
{
return
"非付款单无法修改"
;
}
var
tradeWays2
=
RB_TradeWayRepository
.
GetList
(
new
RB_TradeWay_Extend
()
{
FinanceId
=
frid
});
if
(!
tradeWays2
.
Any
())
{
return
"出纳未审核银行账户,无法修改手续费"
;
}
if
(
tradeWays2
.
Count
()
>
1
)
{
return
"暂不支持多账户付款修改手续费,请联系管理员"
;
}
decimal
OldFee
=
tradeWays2
.
FirstOrDefault
().
PayFee
;
if
(
TFee
==
OldFee
)
{
return
""
;
}
//查询是否 合并审核
string
frids
=
frid
.
ToString
();
int
MainId
=
financeRelationRepository
.
GetList
(
new
RB_FinanceRelation
()
{
FinanceId
=
frid
}).
FirstOrDefault
()?.
NewFinanceId
??
0
;
if
(
MainId
>
0
)
{
var
frList
=
financeRelationRepository
.
GetList
(
new
RB_FinanceRelation
()
{
NewFinanceId
=
MainId
});
if
(
frList
.
Any
())
{
//走单个修改
frids
=
string
.
Join
(
","
,
frList
.
Select
(
x
=>
x
.
FinanceId
));
}
}
//查询一下 转账手续费科目
var
ctModel
=
costtypeRepository
.
GetList
(
new
RB_Costtype_Extend
()
{
RB_Group_Id
=
userInfo
.
RB_Group_id
,
MarkType
=
10
}).
FirstOrDefault
();
if
(
ctModel
==
null
)
{
return
"手续费科目不存在"
;
}
//再次查询一下
var
flist
=
RB_FinanceRepository
.
GetListSingle
(
new
RB_Finance_Extend
()
{
RB_Group_Id
=
userInfo
.
RB_Group_id
,
FrIDs
=
frids
});
var
dList
=
RB_FinanceDetailRepository
.
GetList
(
new
RB_FinanceDetail_Extend
()
{
GroupId
=
userInfo
.
RB_Group_id
,
FrIds
=
frids
});
var
tradeWays
=
RB_TradeWayRepository
.
GetList
(
new
RB_TradeWay_Extend
()
{
FrIdStr
=
frids
});
var
delDList
=
dList
.
Where
(
x
=>
x
.
CostTypeId
==
ctModel
.
ID
).
ToList
();
//需要删除的
dList
=
dList
.
Where
(
x
=>
x
.
CostTypeId
!=
ctModel
.
ID
).
ToList
();
//直接排除
List
<
int
>
CurrencyList
=
tradeWays
.
Select
(
x
=>
x
.
CurrencyId
??
0
).
Distinct
().
ToList
();
List
<
string
>
content
=
new
List
<
string
>();
foreach
(
var
currencyId
in
CurrencyList
)
{
//根据银行币种来
decimal
TotalFee
=
TFee
;
content
.
Add
(
TotalFee
+
(
currencyRepository
.
GetEntity
(
currencyId
)?.
Name
??
""
));
//对每一单 开始平分 根据本位币金额 来平分
decimal
TotalMoney
=
flist
.
Sum
(
x
=>
x
.
Money
??
0
);
decimal
TotalYBMoney
=
flist
.
Sum
(
x
=>
x
.
WBMoney
??
0
);
bool
isYB
=
true
;
if
(
flist
.
Select
(
x
=>
x
.
CurrencyId
).
Distinct
().
Count
()
>
1
)
{
isYB
=
false
;
}
foreach
(
var
item
in
flist
)
{
var
dmodel
=
dList
.
Where
(
x
=>
x
.
FinanceId
==
item
.
FrID
).
FirstOrDefault
();
decimal
fee
=
Math
.
Round
((
item
.
Money
??
0
)
/
TotalMoney
*
TotalFee
,
2
,
MidpointRounding
.
AwayFromZero
);
//同一币种
if
(
isYB
)
{
fee
=
Math
.
Round
((
item
.
WBMoney
??
0
)
/
TotalYBMoney
*
TotalFee
,
2
,
MidpointRounding
.
AwayFromZero
);
}
decimal
rate
=
tradeWays
.
Where
(
x
=>
x
.
CurrencyId
==
currencyId
).
FirstOrDefault
().
Rate
??
0
;
if
(
dmodel
.
CurrencyId
==
currencyId
)
{
rate
=
dmodel
.
Rate
??
0
;
}
//如果币种一致 使用单据汇率
dList
.
Add
(
new
RB_FinanceDetail_Extend
()
{
ID
=
0
,
CostTypeId
=
ctModel
.
ID
,
CurrencyId
=
currencyId
,
FinanceId
=
item
.
FrID
,
UnitPrice
=
fee
,
Number
=
1
,
Status
=
DateStateEnum
.
Normal
,
OriginalMoney
=
fee
,
Rate
=
rate
,
Money
=
Math
.
Round
(
fee
*
rate
,
2
,
MidpointRounding
.
AwayFromZero
),
Remark
=
""
});
}
//合计差额
if
(
dList
.
Where
(
x
=>
x
.
ID
==
0
).
Sum
(
x
=>
x
.
OriginalMoney
??
0
)
!=
TotalFee
)
{
//差额补到第一个里
var
dmodel
=
dList
.
Where
(
x
=>
x
.
ID
==
0
).
FirstOrDefault
();
dmodel
.
OriginalMoney
+=
TotalFee
-
dList
.
Where
(
x
=>
x
.
ID
==
0
).
Sum
(
x
=>
x
.
OriginalMoney
??
0
);
dmodel
.
UnitPrice
=
dmodel
.
OriginalMoney
;
dmodel
.
Money
=
Math
.
Round
((
dmodel
.
OriginalMoney
??
0
)
*
(
dmodel
.
Rate
??
0
),
2
,
MidpointRounding
.
AwayFromZero
);
}
}
foreach
(
var
item
in
flist
)
{
var
dclist
=
dList
.
Where
(
x
=>
x
.
FinanceId
==
item
.
FrID
).
ToList
();
//更新主表
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Finance_Extend
.
WBMoney
),
dclist
.
Sum
(
x
=>
x
.
OriginalMoney
??
0
)},
{
nameof
(
RB_Finance_Extend
.
Money
),
dclist
.
Sum
(
x
=>
x
.
Money
??
0
)},
};
if
((
item
.
PayMoney
??
0
)
!=
0
)
{
keyValues
.
Add
(
nameof
(
RB_Finance_Extend
.
PayMoney
),
dclist
.
Sum
(
x
=>
x
.
Money
??
0
));
}
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Finance_Extend
.
FrID
),
FiledValue
=
item
.
FrID
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
bool
flag
=
RB_FinanceRepository
.
Update
(
keyValues
,
wheres
);
if
(
flag
)
{
//开始新增 明细
foreach
(
var
qitem
in
dclist
.
Where
(
x
=>
x
.
ID
==
0
))
{
RB_FinanceDetailRepository
.
Insert
(
qitem
);
}
foreach
(
var
qitem
in
delDList
)
{
RB_FinanceDetailRepository
.
Delete
(
qitem
);
}
foreach
(
var
qitem
in
tradeWays
)
{
qitem
.
OriginalMoney
=
qitem
.
OriginalMoney
-
qitem
.
PayFee
+
TFee
;
qitem
.
Money
=
Math
.
Round
((
qitem
.
OriginalMoney
??
0
)
*
(
qitem
.
Rate
??
0
),
2
,
MidpointRounding
.
AwayFromZero
);
qitem
.
PayFee
=
TFee
;
Dictionary
<
string
,
object
>
keyValues1
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_TradeWay_Extend
.
OriginalMoney
),
qitem
.
OriginalMoney
},
{
nameof
(
RB_TradeWay_Extend
.
Money
),
qitem
.
Money
},
{
nameof
(
RB_TradeWay_Extend
.
PayFee
),
qitem
.
PayFee
},
};
RB_TradeWayRepository
.
Update
(
keyValues1
,
new
WhereHelper
()
{
FiledName
=
nameof
(
RB_TradeWay_Extend
.
ID
),
FiledValue
=
qitem
.
ID
,
OperatorEnum
=
OperatorEnum
.
Equal
});
}
//插入日志
RB_Finance_Infochange_Log
logModel2
=
new
RB_Finance_Infochange_Log
{
LogId
=
0
,
RB_Branch_id
=
userInfo
.
RB_Branch_id
,
RB_Group_id
=
userInfo
.
RB_Group_id
,
UpdateBy
=
userInfo
.
EmployeeId
,
UpdateDate
=
DateTime
.
Now
,
ResourceId
=
item
.
FrID
,
StartValue
=
$"转账手续费由【
{
OldFee
}
】修改为【
{
TFee
}
】"
,
Type
=
TemplateEnum
.
Process
,
EndValue
=
""
,
Description
=
""
,
};
RB_Finance_InfoChange_LogRepository
.
Insert
(
logModel2
);
#
region
订单操作
UpdateOrder
(
item
.
FrID
,
item
.
SourceID
??
0
,
item
.
OrderID
??
0
,
dclist
.
Sum
(
x
=>
x
.
Money
??
0
),
0
,
item
.
Type
??
0
,
item
.
OrderSource
??
0
,
item
.
Callback
,
userInfo
);
#
endregion
}
}
if
(
MainId
>
0
)
{
//更新主单 合并关联但
var
fModel
=
RB_FinanceRepository
.
GetEntity
(
MainId
);
var
MtradeWays
=
RB_TradeWayRepository
.
GetList
(
new
RB_TradeWay_Extend
()
{
FinanceId
=
MainId
});
//更新主表
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Finance_Extend
.
WBMoney
),
dList
.
Sum
(
x
=>
x
.
OriginalMoney
??
0
)},
{
nameof
(
RB_Finance_Extend
.
Money
),
dList
.
Sum
(
x
=>
x
.
Money
??
0
)},
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Finance_Extend
.
FrID
),
FiledValue
=
MainId
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
RB_FinanceRepository
.
Update
(
keyValues
,
wheres
);
foreach
(
var
qitem
in
MtradeWays
)
{
qitem
.
OriginalMoney
=
qitem
.
OriginalMoney
-
OldFee
+
TFee
;
qitem
.
Money
=
Math
.
Round
((
qitem
.
OriginalMoney
??
0
)
*
(
qitem
.
Rate
??
0
),
2
,
MidpointRounding
.
AwayFromZero
);
qitem
.
PayFee
=
TFee
;
Dictionary
<
string
,
object
>
keyValues1
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_TradeWay_Extend
.
OriginalMoney
),
qitem
.
OriginalMoney
},
{
nameof
(
RB_TradeWay_Extend
.
Money
),
qitem
.
Money
},
{
nameof
(
RB_TradeWay_Extend
.
PayFee
),
qitem
.
PayFee
},
};
RB_TradeWayRepository
.
Update
(
keyValues1
,
new
WhereHelper
()
{
FiledName
=
nameof
(
RB_TradeWay_Extend
.
ID
),
FiledValue
=
qitem
.
ID
,
OperatorEnum
=
OperatorEnum
.
Equal
});
}
}
return
""
;
}
}
}
}
}
REBORN.Services.FinanceService/FinancialService2.cs
View file @
14d652ca
...
@@ -1649,20 +1649,35 @@ namespace REBORN.Services.FinanceService
...
@@ -1649,20 +1649,35 @@ namespace REBORN.Services.FinanceService
JObject
parms
=
JObject
.
Parse
(
request
.
msg
.
ToString
());
JObject
parms
=
JObject
.
Parse
(
request
.
msg
.
ToString
());
int
FrId
=
parms
.
GetInt
(
"FrId"
,
0
);
int
FrId
=
parms
.
GetInt
(
"FrId"
,
0
);
decimal
Fee
=
parms
.
GetDecimal
(
"Fee"
);
decimal
Fee
=
parms
.
GetDecimal
(
"Fee"
);
if
(
FrId
<=
0
)
if
(
FrId
<=
0
)
{
{
return
ApiResult
.
ParamIsNull
(
"请传递单据ID"
);
return
ApiResult
.
ParamIsNull
(
"请传递单据ID"
);
}
}
//查询一下 是否付款单
string
msg
=
financialModule2
.
UpdateFinanceFee
(
FrId
,
Fee
,
userInfo
);
var
fmodel
=
module
.
GetFinanceModel
(
FrId
);
if
(
msg
==
""
)
if
(
fmodel
.
Type
==
Common
.
Enum
.
User
.
WFTempLateClassEnum
.
OUT
)
{
{
return
ApiResult
.
Success
();
string
msg
=
WorkFlowModule
.
UpdateTransactionFee
(
FrId
,
Fee
,
userInfo
);
if
(
msg
==
""
)
{
return
ApiResult
.
Success
();
}
else
{
return
ApiResult
.
Failed
(
msg
);
}
}
}
else
else
{
{
return
ApiResult
.
Failed
(
msg
);
string
msg
=
financialModule2
.
UpdateFinanceFee
(
FrId
,
Fee
,
userInfo
);
if
(
msg
==
""
)
{
return
ApiResult
.
Success
();
}
else
{
return
ApiResult
.
Failed
(
msg
);
}
}
}
}
}
...
...
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