Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mall.oytour.com
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
黄奎
mall.oytour.com
Commits
2793a9df
Commit
2793a9df
authored
Jun 10, 2020
by
吴春
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交代码
parent
c38f9893
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
161 additions
and
18 deletions
+161
-18
RB_Goods_OrderDetail_Extend.cs
Mall.Model/Extend/Product/RB_Goods_OrderDetail_Extend.cs
+3
-0
FinanceModule.cs
Mall.Module.Product/FinanceModule.cs
+65
-2
RB_Member_BalanceRepository.cs
Mall.Repository/User/RB_Member_BalanceRepository.cs
+4
-1
AppletUserController.cs
Mall.WebApi/Controllers/User/AppletUserController.cs
+29
-1
SupplierController.cs
Mall.WebApi/Controllers/User/SupplierController.cs
+60
-14
No files found.
Mall.Model/Extend/Product/RB_Goods_OrderDetail_Extend.cs
View file @
2793a9df
...
...
@@ -126,6 +126,9 @@ namespace Mall.Model.Extend.Product
/// 订单商品ids
/// </summary>
public
List
<
int
>
IdList
{
get
;
set
;
}
public
int
IsPublic
{
get
;
set
;
}
#
endregion
}
...
...
Mall.Module.Product/FinanceModule.cs
View file @
2793a9df
...
...
@@ -6,9 +6,11 @@ using System.Text.RegularExpressions;
using
Mall.Common
;
using
Mall.Common.API
;
using
Mall.Common.Plugin
;
using
Mall.Model.Entity.Product
;
using
Mall.Model.Extend.Finance
;
using
Mall.Repository
;
using
Mall.Repository.Finance
;
using
Mall.Repository.Product
;
using
Newtonsoft.Json
;
namespace
Mall.Module.Finance
...
...
@@ -43,8 +45,18 @@ namespace Mall.Module.Finance
/// </summary>
private
readonly
RB_CurrencyRepository
currencyRepository
=
new
RB_CurrencyRepository
();
/// <summary>
/// 财务生成记录
/// </summary>
private
static
RB_Finance_RecordRepository
financeRecordRepository
=
new
RB_Finance_RecordRepository
();
/// <summary>
/// 财务生成记录详情
/// </summary>
private
static
RB_Finance_RecordDetailRepository
financeRecordDetailRepository
=
new
RB_Finance_RecordDetailRepository
();
/// <summary>
/// 订单明细
/// </summary>
private
readonly
RB_Goods_OrderDetailRepository
goods_OrderDetailRepository
=
new
RB_Goods_OrderDetailRepository
();
/// <summary>
/// 获取列表
/// </summary>
...
...
@@ -221,5 +233,56 @@ namespace Mall.Module.Finance
}
#
region
财务记录
public
bool
SetFinanceRecord
(
RB_Finance_Record_Extend
model
)
{
bool
flag
=
false
;
var
trans
=
financeRecordRepository
.
DbTransaction
;
try
{
int
recordId
=
0
;
if
(
model
.
ID
==
0
)
{
recordId
=
financeRecordRepository
.
Insert
(
model
,
trans
);
flag
=
recordId
>
0
;
if
(
model
.
RecordDetailList
!=
null
&&
model
.
RecordDetailList
.
Any
())
{
model
.
RecordDetailList
.
ForEach
(
x
=>
x
.
RecordId
=
recordId
);
model
.
RecordDetailList
.
ForEach
(
x
=>
x
.
FinanceId
=
model
.
FinanceId
);
financeRecordDetailRepository
.
InsertBatch
(
model
.
RecordDetailList
,
trans
);
}
if
(
flag
)
//更新订单商品的财务单据
{
foreach
(
var
item
in
model
.
RecordDetailList
)
{
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Goods_OrderDetail
.
CostFinanceId
),
model
.
FinanceId
}
};
List
<
WhereHelper
>
whereHelpers
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
()
{
FiledName
=
nameof
(
RB_Finance_Configurine_Extend
.
Id
),
FiledValue
=
item
.
OrderDetailId
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
goods_OrderDetailRepository
.
Update
(
keyValues
,
whereHelpers
,
trans
);
}
}
}
financeRecordRepository
.
DBSession
.
Commit
();
}
catch
(
Exception
ex
)
{
LogHelper
.
Write
(
ex
,
"SetFinanceRecord"
);
financeRecordRepository
.
DBSession
.
Rollback
(
"SetFinanceRecord"
);
return
false
;
}
return
flag
;
}
#
endregion
}
}
Mall.Repository/User/RB_Member_BalanceRepository.cs
View file @
2793a9df
...
...
@@ -48,7 +48,10 @@ namespace Mall.Repository.User
{
where
+=
$@" and
{
nameof
(
RB_Member_Balance
.
UserId
)}
=
{
dmodel
.
UserId
}
"
;
}
if
(
dmodel
.
CreateDate
.
HasValue
)
{
where
+=
$@" and date_format(
{
nameof
(
RB_Member_Balance
.
CreateDate
)}
, '%Y-%m' ) =date_format( '
{
dmodel
.
CreateDate
.
Value
}
', '%Y-%m' ) "
;
}
string
sql
=
$@"select * from RB_Member_Balance where
{
where
}
order by Id desc"
;
return
GetPage
<
RB_Member_Balance_Extend
>(
pageIndex
,
pageSize
,
out
rowCount
,
sql
).
ToList
();
}
...
...
Mall.WebApi/Controllers/User/AppletUserController.cs
View file @
2793a9df
...
...
@@ -30,7 +30,6 @@ namespace Mall.WebApi.Controllers.User
private
readonly
UserModule
userModule
=
new
UserModule
();
private
readonly
Module
.
MarketingCenter
.
CouponModule
couponModule
=
new
Module
.
MarketingCenter
.
CouponModule
();
#
region
收货地址
/// <summary>
...
...
@@ -902,5 +901,34 @@ namespace Mall.WebApi.Controllers.User
return
ApiResult
.
Success
(
""
,
pagelist
);
}
#
endregion
#
region
余额明细
/// <summary>
/// 个人中心- 积分明细
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetMemberBalancePageList
()
{
var
req
=
RequestParm
;
var
userInfo
=
AppletUserInfo
;
ResultPageModel
pagelist
=
JsonConvert
.
DeserializeObject
<
ResultPageModel
>(
req
.
msg
.
ToString
());
RB_Member_Balance_Extend
demodel
=
JsonConvert
.
DeserializeObject
<
RB_Member_Balance_Extend
>(
req
.
msg
.
ToString
());
demodel
.
UserId
=
userInfo
.
UserId
;
demodel
.
TenantId
=
userInfo
.
TenantId
;
demodel
.
MallBaseId
=
userInfo
.
MallBaseId
;
var
list
=
userModule
.
GetMemberBalancePageList
(
pagelist
.
pageIndex
,
pagelist
.
pageSize
,
out
long
count
,
demodel
);
pagelist
.
count
=
Convert
.
ToInt32
(
count
);
pagelist
.
pageData
=
list
.
Select
(
x
=>
new
{
x
.
Remarks
,
x
.
Description
,
CreateDate
=
x
.
CreateDate
.
HasValue
?
x
.
CreateDate
.
Value
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)
:
""
,
x
.
Balance
,
x
.
Type
});
return
ApiResult
.
Success
(
""
,
pagelist
);
}
#
endregion
}
}
\ No newline at end of file
Mall.WebApi/Controllers/User/SupplierController.cs
View file @
2793a9df
...
...
@@ -247,13 +247,9 @@ namespace Mall.WebApi.Controllers.User
RB_Goods_OrderDetail_Extend
demodel
=
JsonConvert
.
DeserializeObject
<
RB_Goods_OrderDetail_Extend
>(
RequestParm
.
msg
.
ToString
());
demodel
.
TenantId
=
UserInfo
.
TenantId
;
demodel
.
MallBaseId
=
parms
.
MallBaseId
;
demodel
.
IsFinance
=
2
;
var
list
=
orderModule
.
GetSupplierOrderList
(
demodel
);
var
result
=
new
List
<
RB_Goods_OrderDetail_Extend
>();
RB_Finance_Record_Extend
record
=
new
RB_Finance_Record_Extend
();
record
.
MallBaseId
=
demodel
.
MallBaseId
;
record
.
TenantId
=
demodel
.
TenantId
;
...
...
@@ -264,10 +260,21 @@ namespace Mall.WebApi.Controllers.User
if
(
list
!=
null
&&
list
.
Any
())
{
//先查询规则
var
financeConfigurineModel
=
financeModule
.
GetFinanceConfigurineList
(
new
Model
.
Extend
.
Finance
.
RB_Finance_Configurine_Extend
{
Type
=
1
,
MallBaseId
=
demodel
.
MallBaseId
,
TenantId
=
demodel
.
TenantId
}).
FirstOrDefault
();
var
financeConfigurineModel
=
financeModule
.
GetFinanceConfigurineList
(
new
Model
.
Extend
.
Finance
.
RB_Finance_Configurine_Extend
{
Type
=
2
,
MallBaseId
=
demodel
.
MallBaseId
,
TenantId
=
demodel
.
TenantId
}).
FirstOrDefault
();
//查询供应商的财务信息
var
supplierModel
=
supplierModule
.
GetList
(
new
RB_Supplier_Extend
{
MallBaseId
=
demodel
.
MallBaseId
,
TenantId
=
demodel
.
TenantId
,
ID
=
demodel
.
SupplierId
}).
FirstOrDefault
();
if
(
supplierModel
==
null
)
{
return
ApiResult
.
Failed
(
"供应商信息不存在"
);
}
if
(
supplierModel
.
ClientBankAccount
==
null
)
{
return
ApiResult
.
Failed
(
"供应商账户信息不存在"
);
}
foreach
(
var
orderGoodsItem
in
list
)
{
if
(
orderGoodsItem
.
Final_Price
>
0
)
if
(
orderGoodsItem
.
CostMoney
>
0
)
{
var
newOrderGoods
=
new
RB_Goods_OrderDetail_Extend
();
newOrderGoods
=
orderGoodsItem
;
...
...
@@ -275,7 +282,7 @@ namespace Mall.WebApi.Controllers.User
result
.
Add
(
newOrderGoods
);
}
if
(
orderGoodsItem
.
Freight
Money
.
HasValue
&&
orderGoodsItem
.
Freigh
tMoney
.
Value
>
0
)
if
(
orderGoodsItem
.
Freight
CostMoney
.
HasValue
&&
orderGoodsItem
.
FreightCos
tMoney
.
Value
>
0
)
{
var
newOrderGoods
=
new
RB_Goods_OrderDetail_Extend
();
newOrderGoods
=
orderGoodsItem
;
...
...
@@ -295,22 +302,61 @@ namespace Mall.WebApi.Controllers.User
Name
=
orderGoodsItem
.
GoodsName
,
OrderId
=
orderGoodsItem
.
OrderId
??
0
,
OrderDetailId
=
orderGoodsItem
.
Id
,
GoodsPrice
=
((
orderGoodsItem
.
Final_Price
??
0
)
-
(
orderGoodsItem
.
FreightMoney
??
0
)),
FreightMoney
=
orderGoodsItem
.
FreightMoney
,
Unit_Price
=
orderGoodsItem
.
Unit_Price
,
GoodsPrice
=
((
orderGoodsItem
.
CostMoney
??
0
)
*
(
orderGoodsItem
.
Number
??
0
)),
FreightMoney
=
orderGoodsItem
.
Freight
Cost
Money
,
Unit_Price
=
orderGoodsItem
.
CostMoney
,
Number
=
orderGoodsItem
.
Number
};
record
.
RecordDetailList
.
Add
(
financeRecordDetail
);
}
var
detailList
=
result
.
Select
(
x
=>
new
{
CostTypeId
=
x
.
FinanceType
==
1
?
financeConfigurineModel
.
CBCostTypeId
:
financeConfigurineModel
.
Freight
CostTypeId
,
CostTypeId
=
x
.
FinanceType
==
1
?
financeConfigurineModel
.
CBCostTypeId
:
financeConfigurineModel
.
Expenses
CostTypeId
,
Number
=
x
.
FinanceType
==
1
?
x
.
Number
:
1
,
OriginalMoney
=
x
.
FinanceType
==
1
?
x
.
Unit_Price
:
x
.
Freigh
tMoney
,
UnitPrice
=
x
.
FinanceType
==
1
?
((
(
x
.
Final_Price
??
0
)
-
(
x
.
FreightMoney
??
0
))
/
(
x
.
Number
??
0
))
:
x
.
Freigh
tMoney
,
OriginalMoney
=
x
.
FinanceType
==
1
?
x
.
CostMoney
:
x
.
FreightCos
tMoney
,
UnitPrice
=
x
.
FinanceType
==
1
?
((
x
.
CostMoney
??
0
))
:
x
.
FreightCos
tMoney
,
Remark
=
x
.
GoodsName
+
x
.
OrderNo
});
var
financeObj
=
new
{
CreateBy
=
Config
.
NetworkDirector
,
IsPublic
=
demodel
.
IsPublic
,
// supplierModel.ClientBankAccount.AccountType, //financeConfigurineModel.AccountType,
ClientType
=
supplierModel
.
ClientBankAccount
.
Type
,
ClientID
=
supplierModel
.
BankAccountId
,
CurrencyId
=
financeConfigurineModel
.
CurrencyId
,
WBMoney
=
result
.
Sum
(
x
=>
((
x
.
CostMoney
??
0
)
*
(
x
.
Number
??
0
))
+
(
x
.
FreightCostMoney
??
0
)),
RB_Branch_Id
=
Config
.
RB_Branch_Id
,
PayDate
=
System
.
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd"
),
TemplateId
=
financeConfigurineModel
.
WorkFlowId
,
OrderSource
=
16
,
OtherType
=
13
,
Remark
=
System
.
DateTime
.
Now
.
ToString
(
"yyyy年MM月dd日"
)
+
"生成财务单据"
,
detailList
,
};
string
sign
=
EncryptionHelper
.
AesEncrypt
(
JsonHelper
.
Serialize
(
financeObj
),
Config
.
FinanceKey
);
var
resultInfo
=
new
{
msg
=
sign
,
};
string
apiResult
=
Mall
.
Common
.
Plugin
.
HttpHelper
.
HttpPost
(
Config
.
PaymentFinanceApi
,
JsonHelper
.
Serialize
(
resultInfo
),
""
);
JObject
parmsJob
=
JObject
.
Parse
(
apiResult
);
string
resultCode
=
parmsJob
.
GetStringValue
(
"resultCode"
);
int
frid
=
parmsJob
.
GetInt
(
"data"
,
0
);
if
(
resultCode
==
"1"
&&
frid
>
0
)
//新增记录
{
record
.
FinanceId
=
frid
;
bool
addResult
=
financeModule
.
SetFinanceRecord
(
record
);
if
(
addResult
)
{
return
ApiResult
.
Success
(
"财务单据生成成功"
);
}
else
{
return
ApiResult
.
Failed
(
"财务单据生成失败"
);
}
}
}
return
ApiResult
.
Success
(
""
);
...
...
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