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
28f4937d
Commit
28f4937d
authored
Jul 01, 2020
by
吴春
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交代码
parent
5f380dca
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
109 additions
and
103 deletions
+109
-103
Mall.WindowsService.csproj
Mall.WindowsService/Mall.WindowsService.csproj
+1
-0
FinanceModule.cs
Mall.WindowsService/Module/FinanceModule.cs
+108
-103
No files found.
Mall.WindowsService/Mall.WindowsService.csproj
View file @
28f4937d
...
...
@@ -23,6 +23,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Mall.CacheManager\Mall.CacheManager.csproj" />
<ProjectReference Include="..\Mall.Common\Mall.Common.csproj" />
<ProjectReference Include="..\Mall.DataAccess\Mall.DataAccess.csproj" />
<ProjectReference Include="..\Mall.Model\Mall.Model.csproj" />
...
...
Mall.WindowsService/Module/FinanceModule.cs
View file @
28f4937d
using
DapperExtensions.Lambda
;
using
Mall.CacheManager.AppletWeChat
;
using
Mall.Common
;
using
Mall.Common.Enum.Goods
;
using
Mall.Common.Enum.User
;
...
...
@@ -322,11 +323,14 @@ and DATE_FORMAT(b.PaymentTime,'%y-%m-%d')<DATE_FORMAT('{endDate}','%y-%m-%d') A
{
try
{
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
};
keyValues
.
Add
(
nameof
(
RB_Goods_Order_Extend
.
OrderStatus
),
OrderStatusEnum
.
Cancel
);
keyValues
.
Add
(
nameof
(
RB_Goods_Order_Extend
.
CancelTime
),
DateTime
.
Now
);
string
cacheOrderId
=
OrderPayReidsCache
.
Get
(
qitem
.
OrderId
.
ToString
());
if
(
string
.
IsNullOrWhiteSpace
(
cacheOrderId
))
{
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
};
keyValues
.
Add
(
nameof
(
RB_Goods_Order_Extend
.
OrderStatus
),
OrderStatusEnum
.
Cancel
);
keyValues
.
Add
(
nameof
(
RB_Goods_Order_Extend
.
CancelTime
),
DateTime
.
Now
);
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Goods_Order_Extend
.
OrderId
),
FiledValue
=
qitem
.
OrderId
,
...
...
@@ -348,155 +352,156 @@ and DATE_FORMAT(b.PaymentTime,'%y-%m-%d')<DATE_FORMAT('{endDate}','%y-%m-%d') A
OperatorEnum
=
OperatorEnum
.
Equal
}
};
bool
flag
=
goods_OrderRepository
.
Update
(
keyValues
,
wheres
);
if
(
flag
)
{
//回滚商品库存
if
(
true
)
bool
flag
=
goods_OrderRepository
.
Update
(
keyValues
,
wheres
);
if
(
flag
)
{
int
tenantId
=
item
.
TenantId
;
int
mallBaseId
=
item
.
MallBaseId
;
int
TotalIntegralNumber
=
0
;
var
detailList
=
goodsOrderDetailRepository
.
GetOrderDetailList
(
new
RB_Goods_OrderDetail_Extend
()
{
OrderId
=
qitem
.
OrderId
,
TenantId
=
tenantId
,
MallBaseId
=
mallBaseId
});
if
(
detailList
.
Any
())
//回滚商品库存
if
(
true
)
{
string
goodsIds
=
string
.
Join
(
","
,
detailList
.
Select
(
x
=>
x
.
GoodsId
??
0
).
Distinct
())
;
var
goodsList
=
goodsRepository
.
GetList
(
new
RB_Goods_Extend
()
{
GoodsIds
=
goodsIds
,
TenantId
=
tenantId
,
MallBaseId
=
mallBaseId
})
;
var
speciPList
=
goods_SpecificationPriceRepository
.
GetList
(
new
RB_Goods_SpecificationPrice_Extend
()
{
GoodsIds
=
goodsIds
,
TenantId
=
tenantId
,
MallBaseId
=
mallBaseId
})
;
foreach
(
var
ditem
in
detailList
)
int
tenantId
=
item
.
TenantId
;
int
mallBaseId
=
item
.
MallBaseId
;
int
TotalIntegralNumber
=
0
;
var
detailList
=
goodsOrderDetailRepository
.
GetOrderDetailList
(
new
RB_Goods_OrderDetail_Extend
()
{
OrderId
=
qitem
.
OrderId
,
TenantId
=
tenantId
,
MallBaseId
=
mallBaseId
});
if
(
detailList
.
Any
()
)
{
var
gmodel
=
goodsList
.
Where
(
x
=>
x
.
Id
==
ditem
.
GoodsId
).
FirstOrDefault
();
if
(
gmodel
==
null
)
{
continue
;
}
if
(
string
.
IsNullOrEmpty
(
ditem
.
SpecificationSort
))
string
goodsIds
=
string
.
Join
(
","
,
detailList
.
Select
(
x
=>
x
.
GoodsId
??
0
).
Distinct
());
var
goodsList
=
goodsRepository
.
GetList
(
new
RB_Goods_Extend
()
{
GoodsIds
=
goodsIds
,
TenantId
=
tenantId
,
MallBaseId
=
mallBaseId
});
var
speciPList
=
goods_SpecificationPriceRepository
.
GetList
(
new
RB_Goods_SpecificationPrice_Extend
()
{
GoodsIds
=
goodsIds
,
TenantId
=
tenantId
,
MallBaseId
=
mallBaseId
});
foreach
(
var
ditem
in
detailList
)
{
if
(
gmodel
.
IsCustomSpecification
==
1
)
var
gmodel
=
goodsList
.
Where
(
x
=>
x
.
Id
==
ditem
.
GoodsId
).
FirstOrDefault
();
if
(
gmodel
==
null
)
{
continue
;
}
}
else
{
if
(
gmodel
.
IsCustomSpecification
!=
1
)
if
(
string
.
IsNullOrEmpty
(
ditem
.
SpecificationSort
))
{
continue
;
if
(
gmodel
.
IsCustomSpecification
==
1
)
{
continue
;
}
}
var
speciPModel
=
speciPList
.
Where
(
x
=>
x
.
GoodsId
==
ditem
.
GoodsId
&&
x
.
SpecificationSort
==
ditem
.
SpecificationSort
).
FirstOrDefault
();
if
(
speciPModel
==
null
)
else
{
continue
;
}
//更新商品规格表库存 + 商品表总库存
Dictionary
<
string
,
object
>
keyValues2
=
new
Dictionary
<
string
,
object
>()
{
if
(
gmodel
.
IsCustomSpecification
!=
1
)
{
continue
;
}
var
speciPModel
=
speciPList
.
Where
(
x
=>
x
.
GoodsId
==
ditem
.
GoodsId
&&
x
.
SpecificationSort
==
ditem
.
SpecificationSort
).
FirstOrDefault
();
if
(
speciPModel
==
null
)
{
continue
;
}
//更新商品规格表库存 + 商品表总库存
Dictionary
<
string
,
object
>
keyValues2
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Goods_SpecificationPrice_Extend
.
InventoryNum
),
(
speciPModel
.
InventoryNum
??
0
)+(
ditem
.
Number
??
0
)}
};
List
<
WhereHelper
>
wheres2
=
new
List
<
WhereHelper
>()
{
List
<
WhereHelper
>
wheres2
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Goods_SpecificationPrice_Extend
.
Id
),
FiledValue
=
speciPModel
.
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
goods_SpecificationPriceRepository
.
Update
(
keyValues2
,
wheres2
);
}
//更新商品表库存
Dictionary
<
string
,
object
>
keyValues1
=
new
Dictionary
<
string
,
object
>()
{
goods_SpecificationPriceRepository
.
Update
(
keyValues2
,
wheres2
);
}
//更新商品表库存
Dictionary
<
string
,
object
>
keyValues1
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Goods_Extend
.
InventoryNum
),
(
gmodel
.
InventoryNum
??
0
)+(
ditem
.
Number
??
0
)}
};
List
<
WhereHelper
>
wheres1
=
new
List
<
WhereHelper
>()
{
List
<
WhereHelper
>
wheres1
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Goods_Extend
.
Id
),
FiledValue
=
gmodel
.
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
goodsRepository
.
Update
(
keyValues1
,
wheres1
);
goods_LogRepository
.
Insert
(
new
Mall
.
Model
.
Entity
.
Product
.
RB_Goods_Log
()
{
Id
=
0
,
Type
=
2
,
SourceId
=
ditem
.
GoodsId
,
Content
=
$"取消订单
{
qitem
.
OrderId
}
,还原商品库存:"
+
ditem
.
Number
,
CreateDate
=
DateTime
.
Now
,
MallBaseId
=
mallBaseId
,
TenantId
=
tenantId
});
if
(
ditem
.
IntegralNumber
>
0
)
{
TotalIntegralNumber
+=
(
ditem
.
IntegralNumber
??
0
);
goodsRepository
.
Update
(
keyValues1
,
wheres1
);
goods_LogRepository
.
Insert
(
new
Mall
.
Model
.
Entity
.
Product
.
RB_Goods_Log
()
{
Id
=
0
,
Type
=
2
,
SourceId
=
ditem
.
GoodsId
,
Content
=
$"取消订单
{
qitem
.
OrderId
}
,还原商品库存:"
+
ditem
.
Number
,
CreateDate
=
DateTime
.
Now
,
MallBaseId
=
mallBaseId
,
TenantId
=
tenantId
});
if
(
ditem
.
IntegralNumber
>
0
)
{
TotalIntegralNumber
+=
(
ditem
.
IntegralNumber
??
0
);
}
}
}
}
var
umodel
=
member_UserRepository
.
GetEntity
(
qitem
.
UserId
);
//积分抵扣回滚
if
(
TotalIntegralNumber
>
0
)
{
Dictionary
<
string
,
object
>
keyValues1
=
new
Dictionary
<
string
,
object
>()
{
var
umodel
=
member_UserRepository
.
GetEntity
(
qitem
.
UserId
);
//积分抵扣回滚
if
(
TotalIntegralNumber
>
0
)
{
Dictionary
<
string
,
object
>
keyValues1
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Member_User_Extend
.
Integral
),
umodel
.
Integral
+
TotalIntegralNumber
}
};
List
<
WhereHelper
>
wheres1
=
new
List
<
WhereHelper
>()
{
List
<
WhereHelper
>
wheres1
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Member_User_Extend
.
Id
),
FiledValue
=
umodel
.
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
bool
flag2
=
member_UserRepository
.
Update
(
keyValues1
,
wheres1
);
if
(
flag2
)
{
member_IntegralRepository
.
Insert
(
new
Mall
.
Model
.
Entity
.
User
.
RB_Member_Integral
()
bool
flag2
=
member_UserRepository
.
Update
(
keyValues1
,
wheres1
);
if
(
flag2
)
{
Id
=
0
,
CreateDate
=
DateTime
.
Now
,
Description
=
"订单取消返回积分抵扣,订单号:"
+
qitem
.
OrderNo
,
Image
=
0
,
Integral
=
TotalIntegralNumber
,
MallBaseId
=
item
.
MallBaseId
,
PlatformType
=
qitem
.
OrderSource
,
Remarks
=
""
,
TenantId
=
item
.
TenantId
,
Type
=
Common
.
Enum
.
MarketingCenter
.
RecordTypeEnum
.
Income
,
UserId
=
qitem
.
UserId
,
OrderId
=
qitem
.
OrderId
});
member_IntegralRepository
.
Insert
(
new
Mall
.
Model
.
Entity
.
User
.
RB_Member_Integral
()
{
Id
=
0
,
CreateDate
=
DateTime
.
Now
,
Description
=
"订单取消返回积分抵扣,订单号:"
+
qitem
.
OrderNo
,
Image
=
0
,
Integral
=
TotalIntegralNumber
,
MallBaseId
=
item
.
MallBaseId
,
PlatformType
=
qitem
.
OrderSource
,
Remarks
=
""
,
TenantId
=
item
.
TenantId
,
Type
=
Common
.
Enum
.
MarketingCenter
.
RecordTypeEnum
.
Income
,
UserId
=
qitem
.
UserId
,
OrderId
=
qitem
.
OrderId
});
}
}
}
//优惠券回滚
if
(!
string
.
IsNullOrEmpty
(
qitem
.
CouponsIds
))
{
var
cList
=
member_CouponRepository
.
GetList
(
new
RB_Member_DiscountCoupon_Extend
()
{
UseState
=
1
,
Ids
=
qitem
.
CouponsIds
,
UserId
=
qitem
.
UserId
,
TenantId
=
item
.
TenantId
,
MallBaseId
=
item
.
MallBaseId
});
foreach
(
var
citem
in
cList
)
//优惠券回滚
if
(!
string
.
IsNullOrEmpty
(
qitem
.
CouponsIds
))
{
Dictionary
<
string
,
object
>
keyValues1
=
new
Dictionary
<
string
,
object
>()
{
var
cList
=
member_CouponRepository
.
GetList
(
new
RB_Member_DiscountCoupon_Extend
()
{
UseState
=
1
,
Ids
=
qitem
.
CouponsIds
,
UserId
=
qitem
.
UserId
,
TenantId
=
item
.
TenantId
,
MallBaseId
=
item
.
MallBaseId
});
foreach
(
var
citem
in
cList
)
{
Dictionary
<
string
,
object
>
keyValues1
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Member_DiscountCoupon_Extend
.
UseState
),
0
}
};
List
<
WhereHelper
>
wheres1
=
new
List
<
WhereHelper
>()
{
List
<
WhereHelper
>
wheres1
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Member_DiscountCoupon_Extend
.
Id
),
FiledValue
=
citem
.
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
member_CouponRepository
.
Update
(
keyValues1
,
wheres1
);
member_CouponRepository
.
Update
(
keyValues1
,
wheres1
);
}
}
}
//余额支付回滚
//余额支付回滚
}
goods_LogRepository
.
Insert
(
new
Mall
.
Model
.
Entity
.
Product
.
RB_Goods_Log
()
{
Id
=
0
,
Type
=
1
,
SourceId
=
qitem
.
OrderId
,
Content
=
"订单超时,自动取消订单"
,
CreateDate
=
DateTime
.
Now
,
MallBaseId
=
item
.
MallBaseId
,
TenantId
=
item
.
TenantId
});
}
goods_LogRepository
.
Insert
(
new
Mall
.
Model
.
Entity
.
Product
.
RB_Goods_Log
()
{
Id
=
0
,
Type
=
1
,
SourceId
=
qitem
.
OrderId
,
Content
=
"订单超时,自动取消订单"
,
CreateDate
=
DateTime
.
Now
,
MallBaseId
=
item
.
MallBaseId
,
TenantId
=
item
.
TenantId
});
}
}
catch
(
Exception
ex
)
...
...
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