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
d258fc7e
Commit
d258fc7e
authored
Jun 28, 2020
by
liudong1993
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://gitlab.oytour.com/Kui2/mall.oytour.com
parents
c0d08e85
57301dd3
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
197 additions
and
81 deletions
+197
-81
MiniProgramModule.cs
Mall.Module.User/MiniProgramModule.cs
+1
-1
RB_Finance_RecordDetailRepository.cs
Mall.Repository/Finance/RB_Finance_RecordDetailRepository.cs
+34
-3
AppletUserController.cs
Mall.WebApi/Controllers/User/AppletUserController.cs
+55
-0
FinanceModule.cs
Mall.WindowsService/Module/FinanceModule.cs
+107
-77
No files found.
Mall.Module.User/MiniProgramModule.cs
View file @
d258fc7e
...
...
@@ -1779,7 +1779,7 @@ namespace Mall.Module.User
}
else
{
LogHelper
.
Write
(
string
.
Format
(
"
SendMemberLevelMsg
:wenXinResult:{0}"
,
wenXinResult
));
LogHelper
.
Write
(
string
.
Format
(
"
GetLiveInfo
:wenXinResult:{0}"
,
wenXinResult
));
}
}
return
false
;
...
...
Mall.Repository/Finance/RB_Finance_RecordDetailRepository.cs
View file @
d258fc7e
...
...
@@ -22,19 +22,50 @@ namespace Mall.Repository.Finance
string
where
=
$" where 1=1 "
;
if
(
dmodel
.
TenantId
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Finance_Record
.
TenantId
)}
=
{
dmodel
.
TenantId
}
"
;
where
+=
$@" and
{
nameof
(
RB_Finance_Record
Detail
.
TenantId
)}
=
{
dmodel
.
TenantId
}
"
;
}
if
(
dmodel
.
MallBaseId
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Finance_Record
.
MallBaseId
)}
=
{
dmodel
.
MallBaseId
}
"
;
where
+=
$@" and
{
nameof
(
RB_Finance_Record
Detail
.
MallBaseId
)}
=
{
dmodel
.
MallBaseId
}
"
;
}
if
(
dmodel
.
Type
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Finance_Record
.
Type
)}
=
{
dmodel
.
Type
}
"
;
where
+=
$@" and
{
nameof
(
RB_Finance_Record
Detail
.
Type
)}
=
{
dmodel
.
Type
}
"
;
}
string
sql
=
$@"SELECT * FROM
{
TableName
}
{
where
}
order by Id asc"
;
return
Get
<
RB_Finance_RecordDetail
>(
sql
).
ToList
();
}
/// <summary>
/// 获取列表
/// </summary>
/// <param name="dmodel"></param>
/// <returns></returns>
public
List
<
RB_Finance_RecordDetail
>
GetListByOrderIds
(
string
orderIds
,
RB_Finance_RecordDetail
dmodel
)
{
string
where
=
$" where 1=1 "
;
if
(
dmodel
.
TenantId
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Finance_RecordDetail
.
TenantId
)}
=
{
dmodel
.
TenantId
}
"
;
}
if
(
dmodel
.
MallBaseId
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Finance_RecordDetail
.
MallBaseId
)}
=
{
dmodel
.
MallBaseId
}
"
;
}
if
(
dmodel
.
Type
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Finance_RecordDetail
.
Type
)}
=
{
dmodel
.
Type
}
"
;
}
if
(!
string
.
IsNullOrWhiteSpace
(
orderIds
))
{
where
+=
$@" and
{
nameof
(
RB_Finance_RecordDetail
.
OrderId
)}
in (
{
orderIds
}
)"
;
}
string
sql
=
$@"SELECT * FROM
{
TableName
}
{
where
}
order by Id asc"
;
return
Get
<
RB_Finance_RecordDetail
>(
sql
).
ToList
();
}
}
}
Mall.WebApi/Controllers/User/AppletUserController.cs
View file @
d258fc7e
...
...
@@ -31,6 +31,8 @@ namespace Mall.WebApi.Controllers.User
private
readonly
UserModule
userModule
=
new
UserModule
();
private
readonly
Module
.
MarketingCenter
.
CouponModule
couponModule
=
new
Module
.
MarketingCenter
.
CouponModule
();
private
readonly
Module
.
MarketingCenter
.
RechargeModule
rechargeModule
=
new
Module
.
MarketingCenter
.
RechargeModule
();
private
readonly
MiniProgramModule
appletWeChatModule
=
new
MiniProgramModule
();
#
region
收货地址
/// <summary>
...
...
@@ -1115,5 +1117,58 @@ namespace Mall.WebApi.Controllers.User
return
ApiResult
.
Success
(
""
,
new
{
rechargeRules
,
rechargeSettings
});
}
#
endregion
#
region
直播房间信息
[
HttpPost
]
[
Obsolete
]
public
ApiResult
GetLiveHouseList
()
{
var
req
=
RequestParm
;
var
userInfo
=
AppletUserInfo
;
ResultPageModel
pagelist
=
JsonConvert
.
DeserializeObject
<
ResultPageModel
>(
RequestParm
.
msg
.
ToString
());
Model
.
Entity
.
AppletWeChat
.
RB_Live_House
demodel
=
JsonConvert
.
DeserializeObject
<
Model
.
Entity
.
AppletWeChat
.
RB_Live_House
>(
RequestParm
.
msg
.
ToString
());
demodel
.
TenantId
=
userInfo
.
TenantId
;
demodel
.
MallBaseId
=
userInfo
.
MallBaseId
;
var
list
=
appletWeChatModule
.
GetLiveHousePageList
(
pagelist
.
pageIndex
,
pagelist
.
pageSize
,
out
long
count
,
demodel
);
pagelist
.
count
=
Convert
.
ToInt32
(
count
);
pagelist
.
pageData
=
list
.
Select
(
x
=>
new
{
x
.
ID
,
x
.
roomid
,
x
.
name
,
x
.
anchor_img
,
x
.
anchor_name
,
x
.
cover_img
,
x
.
live_status
,
start_time
=
GetTime
(
x
.
start_time
),
end_time
=
GetTime
(
x
.
end_time
),
});
return
ApiResult
.
Success
(
""
,
pagelist
);
}
/// <summary>
/// 时间戳转为C#格式时间
/// </summary>
/// <param name="timeStamp">Unix时间戳格式</param>
/// <returns>C#格式时间</returns>
[
Obsolete
]
public
static
string
GetTime
(
string
timeStamp
)
{
try
{
DateTime
dtStart
=
TimeZone
.
CurrentTimeZone
.
ToLocalTime
(
new
DateTime
(
1970
,
1
,
1
));
long
lTime
=
long
.
Parse
(
timeStamp
+
"0000000"
);
TimeSpan
toNow
=
new
TimeSpan
(
lTime
);
return
dtStart
.
Add
(
toNow
).
ToString
(
"yyyy-MM-dd HH:mm:ss"
);
}
catch
(
Exception
)
{
return
""
;
}
}
#
endregion
}
}
\ No newline at end of file
Mall.WindowsService/Module/FinanceModule.cs
View file @
d258fc7e
...
...
@@ -122,8 +122,10 @@ namespace Mall.WindowsService.Module
{
StringBuilder
builder
=
new
StringBuilder
();
builder
.
AppendFormat
(
$@" SELECT a.*,b.OrderNo from rb_goods_orderdetail as a LEFT JOIN rb_goods_order as b on a.OrderId=b.OrderId
where b.TenantId=
{
item
.
TenantId
}
and b.MallBaseId=
{
item
.
MallBaseId
}
and DATE_FORMAT(b.CreateDate,'%y-%m-%d')>= DATE_FORMAT('
{
startDate
}
','%y-%m-%d')
and DATE_FORMAT(b.CreateDate,'%y-%m-%d')<DATE_FORMAT('
{
endDate
}
','%y-%m-%d') and b.OrderStatus in(2,3,4,5,6) "
);
where b.TenantId=
{
item
.
TenantId
}
and b.MallBaseId=
{
item
.
MallBaseId
}
and DATE_FORMAT(b.PaymentTime,'%y-%m-%d')>= DATE_FORMAT('
{
startDate
}
','%y-%m-%d')
and DATE_FORMAT(b.PaymentTime,'%y-%m-%d')<DATE_FORMAT('
{
endDate
}
','%y-%m-%d') AND (
b.OrderStatus IN (2, 3, 4, 5, 6) OR ( b.OrderStatus = 7 AND DATE_FORMAT(b.PaymentTime, '%y-%m-%d') >= DATE_FORMAT('
{
startDate
}
', '%y-%m-%d')
AND DATE_FORMAT(b.PaymentTime, '%y-%m-%d') < DATE_FORMAT('
{
endDate
}
', '%y-%m-%d')))"
);
Helper
.
LogHelper
.
Write
(
"sql语句:"
+
builder
.
ToString
());
var
goodsDetailList
=
goodsOrderDetailRepository
.
Get
<
RB_Goods_OrderDetail_Extend
>(
builder
.
ToString
()).
ToList
();
...
...
@@ -136,93 +138,121 @@ and DATE_FORMAT(b.CreateDate,'%y-%m-%d')<DATE_FORMAT('{endDate}','%y-%m-%d') an
record
.
Type
=
1
;
record
.
CreateDate
=
System
.
DateTime
.
Now
;
record
.
RecordDetailList
=
new
List
<
RB_Finance_RecordDetail
>();
foreach
(
var
orderGoodsItem
in
goodsDetailList
)
List
<
RB_Finance_RecordDetail
>
orderGoodsList
=
new
List
<
RB_Finance_RecordDetail
>();
if
(
goodsDetailList
!=
null
&&
goodsDetailList
.
Any
())
//获取当前需要生成入款单的订单是否已经生成财务单据
{
string
orderIds
=
string
.
Join
(
","
,
goodsDetailList
.
Select
(
x
=>
x
.
OrderId
));
orderGoodsList
=
financeRecordDetailRepository
.
GetListByOrderIds
(
orderIds
,
new
RB_Finance_RecordDetail
{
TenantId
=
item
.
TenantId
,
MallBaseId
=
item
.
MallBaseId
,
Type
=
1
});
}
else
{
Helper
.
LogHelper
.
Write
(
"暂无数据"
);
return
false
;
}
if
(
orderGoodsItem
.
Final_Price
>
0
)
{
var
newOrderGoods
=
new
RB_Goods_OrderDetail_Extend
();
newOrderGoods
=
orderGoodsItem
;
newOrderGoods
.
FinanceType
=
1
;
result
.
Add
(
newOrderGoods
);
}
if
(
orderGoodsItem
.
FreightMoney
.
HasValue
&&
orderGoodsItem
.
FreightMoney
.
Value
>
0
)
foreach
(
var
orderGoodsItem
in
goodsDetailList
)
{
bool
isAdd
=
true
;
if
(
orderGoodsList
!=
null
&&
orderGoodsList
.
Any
())
{
var
newOrderGoods
=
new
RB_Goods_OrderDetail_Extend
();
newOrderGoods
=
orderGoodsItem
;
newOrderGoods
.
FinanceType
=
2
;
result
.
Add
(
newOrderGoods
);
if
(
orderGoodsList
.
Where
(
x
=>
x
.
OrderDetailId
==
orderGoodsItem
.
Id
).
Count
()
>
0
)
//判断订单是否已经有入款单据生成
{
isAdd
=
false
;
}
}
if
(
isAdd
)
{
if
(
orderGoodsItem
.
Final_Price
>
0
)
{
var
newOrderGoods
=
new
RB_Goods_OrderDetail_Extend
();
newOrderGoods
=
orderGoodsItem
;
newOrderGoods
.
FinanceType
=
1
;
result
.
Add
(
newOrderGoods
);
}
if
(
orderGoodsItem
.
FreightMoney
.
HasValue
&&
orderGoodsItem
.
FreightMoney
.
Value
>
0
)
{
var
newOrderGoods
=
new
RB_Goods_OrderDetail_Extend
();
newOrderGoods
=
orderGoodsItem
;
newOrderGoods
.
FinanceType
=
2
;
result
.
Add
(
newOrderGoods
);
}
RB_Finance_RecordDetail
financeRecordDetail
=
new
RB_Finance_RecordDetail
{
ID
=
0
,
RecordId
=
0
,
Type
=
record
.
Type
,
TenantId
=
record
.
TenantId
,
MallBaseId
=
record
.
MallBaseId
,
FinanceId
=
0
,
CreateDate
=
record
.
CreateDate
,
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
,
Number
=
orderGoodsItem
.
Number
};
record
.
RecordDetailList
.
Add
(
financeRecordDetail
);
RB_Finance_RecordDetail
financeRecordDetail
=
new
RB_Finance_RecordDetail
{
ID
=
0
,
RecordId
=
0
,
Type
=
record
.
Type
,
TenantId
=
record
.
TenantId
,
MallBaseId
=
record
.
MallBaseId
,
FinanceId
=
0
,
CreateDate
=
record
.
CreateDate
,
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
,
Number
=
orderGoodsItem
.
Number
};
record
.
RecordDetailList
.
Add
(
financeRecordDetail
);
}
}
var
detailList
=
result
.
Select
(
x
=>
new
{
CostTypeId
=
x
.
FinanceType
==
1
?
item
.
IncomeCostTypeId
:
item
.
FreightCostTypeId
,
Number
=
x
.
FinanceType
==
1
?
x
.
Number
:
1
,
OriginalMoney
=
x
.
FinanceType
==
1
?
x
.
Unit_Price
:
x
.
FreightMoney
,
UnitPrice
=
x
.
FinanceType
==
1
?
(((
x
.
Final_Price
??
0
)
-
(
x
.
FreightMoney
??
0
))
/
(
x
.
Number
??
0
))
:
x
.
FreightMoney
,
Remark
=
x
.
GoodsName
+
x
.
OrderNo
});
var
financeObj
=
new
if
(
result
!=
null
&&
result
.
Any
())
{
CreateBy
=
Config
.
NetworkDirector
,
item
.
IsPublic
,
BType
=
item
.
AccountType
,
AccountId
=
item
.
AccountId
,
WBMoney
=
result
.
Sum
(
x
=>
x
.
Final_Price
??
0
),
RB_Branch_Id
=
Config
.
RB_Branch_Id
,
RemitterName
=
item
.
RemitterName
,
TradeDate
=
System
.
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd"
),
AccountNumber
=
System
.
DateTime
.
Now
.
ToString
(
"yyyyMMdd"
),
TemplateId
=
item
.
WorkFlowId
,
OrderSource
=
16
,
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
.
IncomeFinanceApi
,
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
;
int
recordId
=
financeRecordRepository
.
Insert
(
record
);
Helper
.
LogHelper
.
Write
(
"财务单据ID:"
+
frid
+
",记录id:"
+
recordId
+
"订单数量:"
+
record
.
RecordDetailList
.
Count
());
record
.
RecordDetailList
.
ForEach
(
x
=>
x
.
RecordId
=
recordId
);
record
.
RecordDetailList
.
ForEach
(
x
=>
x
.
FinanceId
=
frid
);
flag
=
financeRecordDetailRepository
.
InsertBatch
(
record
.
RecordDetailList
);
}
var
detailList
=
result
.
Select
(
x
=>
new
{
CostTypeId
=
x
.
FinanceType
==
1
?
item
.
IncomeCostTypeId
:
item
.
FreightCostTypeId
,
Number
=
x
.
FinanceType
==
1
?
x
.
Number
:
1
,
OriginalMoney
=
x
.
FinanceType
==
1
?
x
.
Unit_Price
:
x
.
FreightMoney
,
UnitPrice
=
x
.
FinanceType
==
1
?
(((
x
.
Final_Price
??
0
)
-
(
x
.
FreightMoney
??
0
))
/
(
x
.
Number
??
0
))
:
x
.
FreightMoney
,
Remark
=
x
.
GoodsName
+
x
.
OrderNo
});
var
financeObj
=
new
{
CreateBy
=
Config
.
NetworkDirector
,
item
.
IsPublic
,
BType
=
item
.
AccountType
,
AccountId
=
item
.
AccountId
,
WBMoney
=
result
.
Sum
(
x
=>
x
.
Final_Price
??
0
),
RB_Branch_Id
=
Config
.
RB_Branch_Id
,
RemitterName
=
item
.
RemitterName
,
TradeDate
=
System
.
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd"
),
AccountNumber
=
System
.
DateTime
.
Now
.
ToString
(
"yyyyMMdd"
),
TemplateId
=
item
.
WorkFlowId
,
OrderSource
=
16
,
Remark
=
System
.
DateTime
.
Now
.
ToString
(
"yyyy年MM月dd日"
)
+
"自动生成财务单据"
,
detailList
,
};
string
sign
=
EncryptionHelper
.
AesEncrypt
(
JsonHelper
.
Serialize
(
financeObj
),
Config
.
FinanceKey
);
var
resultInfo
=
new
{
msg
=
sign
,
};
Helper
.
LogHelper
.
Write
(
apiResult
);
string
apiResult
=
Mall
.
Common
.
Plugin
.
HttpHelper
.
HttpPost
(
Config
.
IncomeFinanceApi
,
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
;
int
recordId
=
financeRecordRepository
.
Insert
(
record
);
Helper
.
LogHelper
.
Write
(
"财务单据ID:"
+
frid
+
",记录id:"
+
recordId
+
"订单数量:"
+
record
.
RecordDetailList
.
Count
());
record
.
RecordDetailList
.
ForEach
(
x
=>
x
.
RecordId
=
recordId
);
record
.
RecordDetailList
.
ForEach
(
x
=>
x
.
FinanceId
=
frid
);
flag
=
financeRecordDetailRepository
.
InsertBatch
(
record
.
RecordDetailList
);
}
Helper
.
LogHelper
.
Write
(
apiResult
);
}
}
}
}
...
...
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