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
2c14ff84
Commit
2c14ff84
authored
Jan 18, 2021
by
liudong1993
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1、商城活动定时器
parent
af7f1f37
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
246 additions
and
40 deletions
+246
-40
ActivityModule.cs
Mall.Module.Product/ActivityModule.cs
+40
-40
RB_Goods_OrderRepository.cs
Mall.Repository/Product/RB_Goods_OrderRepository.cs
+41
-0
FinanceModule.cs
Mall.WindowsService/Module/FinanceModule.cs
+165
-0
No files found.
Mall.Module.Product/ActivityModule.cs
View file @
2c14ff84
...
...
@@ -178,13 +178,13 @@ namespace Mall.Module.Product
//查询中奖活动
var
myPrizeList
=
goods_Activity_GetRepository
.
GetList
(
new
RB_Goods_Activity_Get_Extend
()
{
TenantId
=
demodel
.
TenantId
,
MallBaseId
=
demodel
.
MallBaseId
,
ActivityIds
=
string
.
Join
(
","
,
list
.
Select
(
x
=>
x
.
Id
)),
UserId
=
UserId
});
int
AfterTime
=
0
;
if
(
demodel
.
QActivityState
==
1
)
{
var
mallModel
=
mallBaseRepository
.
GetEntity
(
demodel
.
MallBaseId
);
if
(
mallModel
!=
null
&&
mallModel
.
AfterTime
>
0
)
{
AfterTime
=
mallModel
.
AfterTime
;
}
//if (demodel.QActivityState == 1) {
var
mallModel
=
mallBaseRepository
.
GetEntity
(
demodel
.
MallBaseId
);
if
(
mallModel
!=
null
&&
mallModel
.
AfterTime
>
0
)
{
AfterTime
=
mallModel
.
AfterTime
;
}
//}
foreach
(
var
item
in
list
)
{
if
(
item
.
RangeType
==
1
)
...
...
@@ -213,55 +213,55 @@ namespace Mall.Module.Product
else
{
item
.
IsFinish
=
2
;
if
(
demodel
.
QActivityState
==
1
)
//if (demodel.QActivityState == 1)
//{
//查询分类/商品下
var
clist
=
goods_OrderRepository
.
GetGoodsNumForCategoryOrGoods_V2
(
item
,
UserId
,
AfterTime
);
//查询所有活动日期内的已付款订单
if
(
item
.
Tier
==
1
||
item
.
Tier
==
2
||
item
.
Tier
==
3
)
{
//查询分类/商品下
var
clist
=
goods_OrderRepository
.
GetGoodsNumForCategoryOrGoods
(
item
,
UserId
,
AfterTime
);
if
(
item
.
Tier
==
1
||
item
.
Tier
==
2
||
item
.
Tier
==
3
)
//如果属于有限定层级 需要先遍历 查询出对应的层级人员
foreach
(
var
qitem
in
clist
)
{
//如果属于有限定层级 需要先遍历 查询出对应的层级人员
foreach
(
var
qitem
in
clist
)
{
List
<
int
>
UserIdList
=
JsonConvert
.
DeserializeObject
<
List
<
int
>>(
"["
+
qitem
.
UserTree
+
"]"
);
qitem
.
OneUserId
=
UserIdList
[
0
];
if
(
UserIdList
.
Count
()
>
1
)
{
qitem
.
TwoUserId
=
UserIdList
[
1
];
}
if
(
UserIdList
.
Count
()
>
2
)
{
qitem
.
TwoUserId
=
UserIdList
[
2
];
}
}
if
(
item
.
Tier
==
1
)
{
clist
=
clist
.
Where
(
x
=>
x
.
OneUserId
==
UserId
).
ToList
();
}
else
if
(
item
.
Tier
==
2
)
List
<
int
>
UserIdList
=
JsonConvert
.
DeserializeObject
<
List
<
int
>>(
"["
+
qitem
.
UserTree
+
"]"
);
qitem
.
OneUserId
=
UserIdList
[
0
];
if
(
UserIdList
.
Count
()
>
1
)
{
clist
=
clist
.
Where
(
x
=>
x
.
OneUserId
==
UserId
||
x
.
TwoUserId
==
UserId
).
ToList
()
;
qitem
.
TwoUserId
=
UserIdList
[
1
]
;
}
else
if
(
UserIdList
.
Count
()
>
2
)
{
clist
=
clist
.
Where
(
x
=>
x
.
OneUserId
==
UserId
||
x
.
TwoUserId
==
UserId
||
x
.
ThreeUserId
==
UserId
).
ToList
()
;
qitem
.
TwoUserId
=
UserIdList
[
2
]
;
}
}
if
(
item
.
T
ype
==
1
)
if
(
item
.
T
ier
==
1
)
{
//订单数量
item
.
OrderTNum
=
clist
.
Select
(
x
=>
x
.
OrderId
).
Distinct
().
Count
();
clist
=
clist
.
Where
(
x
=>
x
.
OneUserId
==
UserId
).
ToList
();
}
else
if
(
item
.
T
ype
==
2
)
else
if
(
item
.
T
ier
==
2
)
{
//订单金额
item
.
Final_Price
=
clist
.
Sum
(
x
=>
x
.
Final_Price
);
clist
=
clist
.
Where
(
x
=>
x
.
OneUserId
==
UserId
||
x
.
TwoUserId
==
UserId
).
ToList
();
}
else
{
//商品数量
item
.
Number
=
clist
.
Sum
(
x
=>
x
.
Number
);
clist
=
clist
.
Where
(
x
=>
x
.
OneUserId
==
UserId
||
x
.
TwoUserId
==
UserId
||
x
.
ThreeUserId
==
UserId
).
ToList
();
}
}
if
(
item
.
Type
==
1
)
{
//订单数量
item
.
OrderTNum
=
clist
.
Select
(
x
=>
x
.
OrderId
).
Distinct
().
Count
();
}
else
if
(
item
.
Type
==
2
)
{
//订单金额
item
.
Final_Price
=
clist
.
Sum
(
x
=>
x
.
Final_Price
);
}
else
{
//商品数量
item
.
Number
=
clist
.
Sum
(
x
=>
x
.
Number
);
}
//}
}
}
}
...
...
Mall.Repository/Product/RB_Goods_OrderRepository.cs
View file @
2c14ff84
...
...
@@ -2304,6 +2304,47 @@ GROUP BY od.Id ";
}
}
/// <summary>
/// 获取分销商品数量 用户小程序端查询 只查询正常订单
/// </summary>
/// <param name="dmodel"></param>
/// <param name="UserId"></param>
/// <param name="AfterTime"></param>
/// <returns></returns>
public
List
<
RB_Goods_Activity_Extend
>
GetGoodsNumForCategoryOrGoods_V2
(
RB_Goods_Activity_Extend
dmodel
,
int
UserId
,
int
AfterTime
)
{
string
where
=
@
$"AND o.`Status` =0 AND o.Recycled=2 AND o.OrderStatus in(2,3,4,5,6) and oa.ReOrderId is null
AND
o
.
CreateDate
>=
'
{
dmodel
.
StartTime
.
ToString
(
"yyyy-MM-dd"
)}
'
AND
o
.
CreateDate
<=
'
{
dmodel
.
EndTime
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)}
'
AND
IFNULL
(
o
.{(
dmodel
.
ActiveObject
==
1
?
"DistributorTree"
:
"UserTree"
)},
''
)
<>
''
";
if
(
UserId
>
0
)
{
where
+=
$" AND FIND_IN_SET(
{
UserId
}
,o.
{(
dmodel
.
ActiveObject
==
1
?
"DistributorTree"
:
"UserTree"
)}
)"
;
}
if
(
dmodel
.
RangeType
==
1
)
{
string
sql
=
$@"
SELECT od.Id,od.Number,od.Final_Price,o.OrderId,o.
{(
dmodel
.
ActiveObject
==
1
?
"DistributorTree"
:
"UserTree"
)}
as UserTree FROM rb_goods_orderdetail od
LEFT JOIN rb_goods_order o ON o.OrderId = od.OrderId
LEFT JOIN rb_goods_category gc ON od.GoodsId = gc.GoodsId
left join rb_goods_orderaftersale oa on od.Id= oa.OrderDetialId and oa.Type=1 and oa.Status=0 and oa.ReOrderStatus in (1,2,3,4,5)
WHERE gc.CategoryId in (
{
dmodel
.
RangeIds
}
)
{
where
}
GROUP BY od.Id "
;
return
Get
<
RB_Goods_Activity_Extend
>(
sql
).
ToList
();
}
else
{
string
sql
=
$@"
SELECT od.Id,od.Number,od.Final_Price,o.OrderId,o.
{(
dmodel
.
ActiveObject
==
1
?
"DistributorTree"
:
"UserTree"
)}
as UserTree FROM rb_goods_orderdetail od
LEFT JOIN rb_goods_order o ON o.OrderId = od.OrderId
left join rb_goods_orderaftersale oa on od.Id= oa.OrderDetialId and oa.Type=1 and oa.Status=0 and oa.ReOrderStatus in (1,2,3,4,5)
WHERE od.GoodsId in(
{
dmodel
.
RangeIds
}
)
{
where
}
GROUP BY od.Id "
;
return
Get
<
RB_Goods_Activity_Extend
>(
sql
).
ToList
();
}
}
#
endregion
}
}
Mall.WindowsService/Module/FinanceModule.cs
View file @
2c14ff84
This diff is collapsed.
Click to expand it.
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