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
2e8a0b14
Commit
2e8a0b14
authored
Aug 25, 2025
by
黄奎
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://gitlab.oytour.com/Kui2/mall.oytour.com
parents
85bccea0
040285a6
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
813 additions
and
103 deletions
+813
-103
RB_Customer_Integral.cs
Mall.Model/Entity/Customer/RB_Customer_Integral.cs
+82
-0
RB_Member_User.cs
Mall.Model/Entity/User/RB_Member_User.cs
+10
-0
RB_Customer_Integral_Extend.cs
Mall.Model/Extend/Customer/RB_Customer_Integral_Extend.cs
+33
-0
RB_Distributor_Info_Extend.cs
Mall.Model/Extend/User/RB_Distributor_Info_Extend.cs
+10
-0
RB_Member_User_Extend.cs
Mall.Model/Extend/User/RB_Member_User_Extend.cs
+5
-0
OrderModule.cs
Mall.Module.Product/OrderModule.cs
+131
-38
OrderModule_Part.cs
Mall.Module.Product/OrderModule_Part.cs
+96
-38
MemberUserModule.cs
Mall.Module.User/MemberUserModule.cs
+119
-0
UserModule.cs
Mall.Module.User/UserModule.cs
+63
-5
RB_Customer_IntegralRepository.cs
Mall.Repository/Customer/RB_Customer_IntegralRepository.cs
+163
-0
RB_Distributor_InfoRepository.cs
Mall.Repository/User/RB_Distributor_InfoRepository.cs
+1
-1
RB_Member_UserRepository.cs
Mall.Repository/User/RB_Member_UserRepository.cs
+4
-0
AppletOrderController.cs
Mall.WebApi/Controllers/Product/AppletOrderController.cs
+1
-1
AppletLoginController.cs
Mall.WebApi/Controllers/User/AppletLoginController.cs
+1
-0
MemberUserController.cs
Mall.WebApi/Controllers/User/MemberUserController.cs
+21
-0
appsettings.json
Mall.WebApi/appsettings.json
+3
-1
FinanceModule.cs
Mall.WindowsService/Module/FinanceModule.cs
+70
-19
No files found.
Mall.Model/Entity/Customer/RB_Customer_Integral.cs
0 → 100644
View file @
2e8a0b14
using
VT.FW.DB
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
Mall.Model.Entity.Customer
{
/// <summary>
/// 客户积分明细
/// </summary>
[
Serializable
]
[
DB
(
ConnectionName
=
"CustomerConnection"
)]
public
class
RB_Customer_Integral
{
/// <summary>
/// Id
/// </summary>
public
int
Id
{
get
;
set
;
}
/// <summary>
/// 客户Id
/// </summary>
public
int
CustomerId
{
get
;
set
;
}
/// <summary>
/// 客户类型 1同行 2直客
/// </summary>
public
int
CustomerType
{
get
;
set
;
}
/// <summary>
/// 订单ID
/// </summary>
public
int
OrderId
{
get
;
set
;
}
/// <summary>
/// 来源类型 1团队订单 2电商订单
/// </summary>
public
int
OrderType
{
get
;
set
;
}
/// <summary>
/// 变更金额(正负数 表示 增加 减少)
/// </summary>
public
decimal
IntegralNum
{
get
;
set
;
}
/// <summary>
/// 描述
/// </summary>
public
string
Description
{
get
;
set
;
}
/// <summary>
/// 集团ID
/// </summary>
public
int
GroupId
{
get
;
set
;
}
/// <summary>
/// 订单积分生成时间
/// </summary>
public
DateTime
CreateTime
{
get
;
set
;
}
/// <summary>
/// 归属团
/// </summary>
public
int
TCID
{
get
;
set
;
}
/// <summary>
/// 是否抵用 1是
/// </summary>
public
int
IsDeduction
{
get
;
set
;
}
/// <summary>
/// 同业员工ID
/// </summary>
public
int
CustomerChildrenId
{
get
;
set
;
}
/// <summary>
/// 总返佣金额
/// </summary>
public
decimal
MallCommission
{
get
;
set
;
}
}
}
Mall.Model/Entity/User/RB_Member_User.cs
View file @
2e8a0b14
...
...
@@ -269,5 +269,15 @@ namespace Mall.Model.Entity.User
/// UnionId唯一Id
/// </summary>
public
string
Unoinid
{
get
;
set
;
}
/// <summary>
/// 绑定同业ID
/// </summary>
public
int
CustomerId
{
get
;
set
;
}
/// <summary>
/// 绑定同业员工ID
/// </summary>
public
int
CustomerChildrenId
{
get
;
set
;
}
}
}
Mall.Model/Extend/Customer/RB_Customer_Integral_Extend.cs
0 → 100644
View file @
2e8a0b14
using
VT.FW.DB
;
using
System
;
namespace
Mall.Model.Extend.Customer
{
/// <summary>
/// 客户积分扩展表
/// </summary>
[
Serializable
]
[
DB
(
ConnectionName
=
"CustomerConnection"
)]
public
class
RB_Customer_Integral_Extend
:
Entity
.
Customer
.
RB_Customer_Integral
{
/// <summary>
/// 积分状态 0自己的可用 1同行下通用 2不可用
/// </summary>
public
int
IntegralUse
{
get
;
set
;
}
/// <summary>
/// 类型 1收 2支
/// </summary>
public
int
Type
{
get
;
set
;
}
/// <summary>
/// 门店名称
/// </summary>
public
string
CustomerName
{
get
;
set
;
}
/// <summary>
/// 联系人
/// </summary>
public
string
ContactName
{
get
;
set
;
}
}
}
Mall.Model/Extend/User/RB_Distributor_Info_Extend.cs
View file @
2e8a0b14
...
...
@@ -110,5 +110,15 @@ namespace Mall.Model.Extend.User
/// 是否直接下级[1-是]
/// </summary>
public
int
IsDirect
{
get
;
set
;
}
/// <summary>
/// 同业联系人
/// </summary>
public
int
CustomerChildrenId
{
get
;
set
;
}
/// <summary>
/// 联系人名称
/// </summary>
public
string
CustomerChildrenName
{
get
;
set
;
}
}
}
Mall.Model/Extend/User/RB_Member_User_Extend.cs
View file @
2e8a0b14
...
...
@@ -225,6 +225,11 @@ namespace Mall.Model.Extend.User
/// 用户可查看分组
/// </summary>
public
List
<
GroupItem
>
LookGroupList
{
get
;
set
;
}
/// <summary>
/// 绑定同业OpenId
/// </summary>
public
string
CustomerOpenId
{
get
;
set
;
}
}
/// <summary>
...
...
Mall.Module.Product/OrderModule.cs
View file @
2e8a0b14
...
...
@@ -14,6 +14,7 @@ using Mall.Model.Extend.Reserve;
using
Mall.Model.Extend.User
;
using
Mall.Module.User
;
using
Mall.Repository.BaseSetUp
;
using
Mall.Repository.Customer
;
using
Mall.Repository.Finance
;
using
Mall.Repository.GuideCar
;
using
Mall.Repository.MarketingCenter
;
...
...
@@ -122,6 +123,10 @@ namespace Mall.Module.Product
/// </summary>
private
readonly
RB_Member_UserRepository
member_UserRepository
=
new
RB_Member_UserRepository
();
/// <summary>
/// ERP 同业积分
/// </summary>
private
readonly
RB_Customer_IntegralRepository
customer_IntegralRepository
=
new
RB_Customer_IntegralRepository
();
/// <summary>
/// 用户余额
/// </summary>
private
readonly
RB_Member_BalanceRepository
member_BalanceRepository
=
new
RB_Member_BalanceRepository
();
...
...
@@ -1052,8 +1057,10 @@ namespace Mall.Module.Product
item
.
FreeShippingRemarks
,
EduData
,
GoodsRelevanceList
=
tempList
,
item
.
IntegralMoney
});
}
decimal
IntegralMoney
=
model
.
DetailList
?.
Sum
(
x
=>
x
.
IntegralMoney
??
0
)
??
0
;
return
ApiResult
.
Success
(
""
,
new
{
template_message_list
,
...
...
@@ -1069,7 +1076,7 @@ namespace Mall.Module.Product
PaymentWayName
=
model
.
PaymentWay
.
GetEnumName
(),
model
.
DeliveryMethod
,
DeliveryMethodName
=
model
.
DeliveryMethod
.
GetEnumName
(),
model
.
PreferPrice
,
PreferPrice
=
(
model
.
PreferPrice
??
0
)
+
IntegralMoney
,
model
.
Income
,
PayIncome
=
model
.
PayIncome
??
0
,
model
.
ResultPayMoney
,
...
...
@@ -1090,7 +1097,8 @@ namespace Mall.Module.Product
model
.
IsCanApplyForAfterSale
,
model
.
PresentFXGrade
,
model
.
BuyerMessage
,
model
.
OrderEduType
model
.
OrderEduType
,
IntegralMoney
});
}
...
...
@@ -1856,6 +1864,16 @@ namespace Mall.Module.Product
{
demodel
.
SmallShopsId
=
umodel
.
SmallShopId
;
}
if
(
umodel
.
CustomerChildrenId
>
0
)
{
//绑定erp同业积分
var
cmodel
=
customer_IntegralRepository
.
GetCustomerInfo
(
umodel
.
CustomerChildrenId
);
if
(
cmodel
!=
null
&&
cmodel
.
IntegralUse
!=
2
)
{
decimal
intergralNum
=
customer_IntegralRepository
.
GetCustomerIntegralSurplus
(
umodel
.
CustomerId
,
cmodel
.
IntegralUse
==
0
?
umodel
.
CustomerChildrenId
:
0
);
umodel
.
Integral
=
Convert
.
ToInt32
(
intergralNum
);
}
}
//积分
Model
.
Entity
.
MarketingCenter
.
RB_Integral_Settings
integralModel
=
new
Model
.
Entity
.
MarketingCenter
.
RB_Integral_Settings
();
if
(
umodel
.
Integral
>
0
)
...
...
@@ -3443,6 +3461,16 @@ namespace Mall.Module.Product
{
return
ApiResult
.
Failed
(
"用户不存在"
);
}
if
(
umodel
.
CustomerChildrenId
>
0
)
{
//绑定erp同业积分
var
cmodel
=
customer_IntegralRepository
.
GetCustomerInfo
(
umodel
.
CustomerChildrenId
);
if
(
cmodel
!=
null
&&
cmodel
.
IntegralUse
!=
2
)
{
decimal
intergralNum
=
customer_IntegralRepository
.
GetCustomerIntegralSurplus
(
umodel
.
CustomerId
,
cmodel
.
IntegralUse
==
0
?
umodel
.
CustomerChildrenId
:
0
);
umodel
.
Integral
=
Convert
.
ToInt32
(
intergralNum
);
}
}
if
(
demodel
.
SmallShopsId
==
0
)
{
demodel
.
SmallShopsId
=
umodel
.
SmallShopId
;
...
...
@@ -4691,7 +4719,11 @@ namespace Mall.Module.Product
demodel
.
OrderStatus
=
OrderStatusEnum
.
WaitSendGoods
;
demodel
.
PaymentTime
=
DateTime
.
Now
;
}
if
(
demodel
.
Income
==
0
&&
demodel
.
Use_Integral
==
1
&&
TotalIntegralMoney
>
0
&&
umodel
.
CustomerChildrenId
>
0
)
{
//使用 积分抵扣全额,无需再次付款
demodel
.
OrderStatus
=
OrderStatusEnum
.
WaitSendGoods
;
demodel
.
PaymentTime
=
DateTime
.
Now
;
}
int
OrderId
=
goods_OrderRepository
.
Insert
(
demodel
,
trans
);
if
(
OrderId
>
0
)
...
...
@@ -4738,6 +4770,33 @@ namespace Mall.Module.Product
keyValues
.
Add
(
nameof
(
RB_Member_User_Extend
.
CouponsNum
),
umodel
.
CouponsNum
);
}
if
(
demodel
.
Use_Integral
==
1
&&
TotalIntegralNumber
>
0
)
{
if
(
umodel
.
CustomerChildrenId
>
0
)
{
//进入erp同业积分更新
try
{
customer_IntegralRepository
.
Insert
(
new
Model
.
Entity
.
Customer
.
RB_Customer_Integral
()
{
Id
=
0
,
CustomerId
=
umodel
.
CustomerId
,
CustomerChildrenId
=
umodel
.
CustomerChildrenId
,
GroupId
=
2
,
OrderId
=
OrderId
,
TCID
=
0
,
OrderType
=
2
,
IsDeduction
=
1
,
IntegralNum
=
0
-
TotalIntegralNumber
,
CreateTime
=
DateTime
.
Now
,
CustomerType
=
1
,
Description
=
"赞羊订单使用积分抵扣"
+
TotalIntegralMoney
+
"元,订单号:"
+
demodel
.
OrderNo
,
MallCommission
=
demodel
.
DetailList
.
Sum
(
x
=>
x
.
CommissionPrice
)
});
//更新同行积分数
customer_IntegralRepository
.
UpdateCustomerIntegral
(
umodel
.
CustomerId
,
TotalIntegralNumber
);
}
catch
{}
}
else
{
keyValues
.
Add
(
nameof
(
RB_Member_User_Extend
.
Integral
),
(
umodel
.
Integral
??
0
));
member_IntegralRepository
.
Insert
(
new
Model
.
Entity
.
User
.
RB_Member_Integral
()
...
...
@@ -4756,6 +4815,7 @@ namespace Mall.Module.Product
OrderId
=
OrderId
},
trans
);
}
}
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Member_User_Extend
.
Id
),
...
...
@@ -4864,7 +4924,11 @@ namespace Mall.Module.Product
{
demodel
.
CouponDestription
=
"使用"
+
(
IsCommissionCoupons
?
"通用"
:
"店铺"
)
+
"优惠券抵扣"
;
}
//2025-05-30 ld erp同业绑定人员 使用积分抵扣 不返佣, 佣金由积分承担公司抵扣
if
(!(
umodel
.
CustomerChildrenId
>
0
&&
demodel
.
Use_Integral
==
1
&&
TotalIntegralNumber
>
0
))
{
Task
.
Run
(()
=>
InsertOrderCommission
(
demodel
,
umodel
,
GoodsIds
,
OrderId
));
}
#
endregion
//记录日志
goods_LogRepository
.
Insert
(
new
RB_Goods_Log
()
...
...
@@ -8701,6 +8765,34 @@ namespace Mall.Module.Product
var
umodel
=
member_UserRepository
.
GetEntity
(
omodel
.
UserId
);
//积分抵扣回滚
if
(
TotalIntegralNumber
>
0
)
{
if
(
umodel
.
CustomerChildrenId
>
0
)
{
//进入erp同业积分更新
try
{
customer_IntegralRepository
.
Insert
(
new
Model
.
Entity
.
Customer
.
RB_Customer_Integral
()
{
Id
=
0
,
CustomerId
=
umodel
.
CustomerId
,
CustomerChildrenId
=
umodel
.
CustomerChildrenId
,
GroupId
=
2
,
OrderId
=
omodel
.
OrderId
,
TCID
=
0
,
OrderType
=
2
,
IsDeduction
=
1
,
IntegralNum
=
TotalIntegralNumber
,
CreateTime
=
DateTime
.
Now
,
CustomerType
=
1
,
Description
=
"赞羊订单取消返回积分抵扣,订单号:"
+
omodel
.
OrderNo
,
MallCommission
=
0
-
detailList
.
Sum
(
x
=>
x
.
FXCommission
)
});
//更新同行积分数
customer_IntegralRepository
.
UpdateCustomerIntegral
(
umodel
.
CustomerId
,
0
-
TotalIntegralNumber
);
}
catch
{
}
}
else
{
Dictionary
<
string
,
object
>
keyValues1
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Member_User_Extend
.
Integral
),
umodel
.
Integral
+
TotalIntegralNumber
}
...
...
@@ -8732,6 +8824,7 @@ namespace Mall.Module.Product
},
trans
);
}
}
}
//优惠券回滚
if
(!
string
.
IsNullOrEmpty
(
omodel
.
CouponsIds
))
{
...
...
Mall.Module.Product/OrderModule_Part.cs
View file @
2e8a0b14
...
...
@@ -4393,6 +4393,34 @@ namespace Mall.Module.Product
var
umodel
=
member_UserRepository
.
GetEntity
(
omodel
.
UserId
);
//积分抵扣回滚
if
(
TotalIntegralNumber
>
0
)
{
if
(
umodel
.
CustomerChildrenId
>
0
)
{
//进入erp同业积分更新
try
{
customer_IntegralRepository
.
Insert
(
new
Model
.
Entity
.
Customer
.
RB_Customer_Integral
()
{
Id
=
0
,
CustomerId
=
umodel
.
CustomerId
,
CustomerChildrenId
=
umodel
.
CustomerChildrenId
,
GroupId
=
2
,
OrderId
=
omodel
.
OrderId
,
TCID
=
0
,
OrderType
=
2
,
IsDeduction
=
1
,
IntegralNum
=
TotalIntegralNumber
,
CreateTime
=
DateTime
.
Now
,
CustomerType
=
1
,
Description
=
"赞羊订单取消返回积分抵扣,订单号:"
+
omodel
.
OrderNo
,
MallCommission
=
0
-
detailList
.
Sum
(
x
=>
x
.
FXCommission
)
});
//更新同行积分数
customer_IntegralRepository
.
UpdateCustomerIntegral
(
umodel
.
CustomerId
,
0
-
TotalIntegralNumber
);
}
catch
{
}
}
else
{
Dictionary
<
string
,
object
>
keyValues1
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Member_User_Extend
.
Integral
),
umodel
.
Integral
+
TotalIntegralNumber
}
...
...
@@ -4424,6 +4452,7 @@ namespace Mall.Module.Product
},
trans
);
}
}
}
//优惠券回滚
if
(!
string
.
IsNullOrEmpty
(
omodel
.
CouponsIds
))
{
...
...
@@ -4788,6 +4817,34 @@ namespace Mall.Module.Product
var
umodel
=
member_UserRepository
.
GetEntity
(
omodel
.
UserId
);
//积分抵扣回滚
if
(
TotalIntegralNumber
>
0
)
{
if
(
umodel
.
CustomerChildrenId
>
0
)
{
//进入erp同业积分更新
try
{
customer_IntegralRepository
.
Insert
(
new
Model
.
Entity
.
Customer
.
RB_Customer_Integral
()
{
Id
=
0
,
CustomerId
=
umodel
.
CustomerId
,
CustomerChildrenId
=
umodel
.
CustomerChildrenId
,
GroupId
=
2
,
OrderId
=
omodel
.
OrderId
,
TCID
=
0
,
OrderType
=
2
,
IsDeduction
=
1
,
IntegralNum
=
TotalIntegralNumber
,
CreateTime
=
DateTime
.
Now
,
CustomerType
=
1
,
Description
=
"赞羊订单取消返回积分抵扣,订单号:"
+
omodel
.
OrderNo
,
MallCommission
=
0
-
detailList
.
Sum
(
x
=>
x
.
FXCommission
)
});
//更新同行积分数
customer_IntegralRepository
.
UpdateCustomerIntegral
(
umodel
.
CustomerId
,
0
-
TotalIntegralNumber
);
}
catch
{
}
}
else
{
Dictionary
<
string
,
object
>
keyValues1
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Member_User_Extend
.
Integral
),
umodel
.
Integral
+
TotalIntegralNumber
}
...
...
@@ -4819,6 +4876,7 @@ namespace Mall.Module.Product
},
trans
);
}
}
}
//优惠券回滚
if
(!
string
.
IsNullOrEmpty
(
omodel
.
CouponsIds
))
{
...
...
Mall.Module.User/MemberUserModule.cs
View file @
2e8a0b14
using
Mall.Common.Plugin
;
using
Mall.Model.Extend.Product
;
using
Mall.Model.Extend.User
;
using
Mall.Repository.Customer
;
using
Mall.Repository.Product
;
using
Mall.Repository.User
;
using
System
;
...
...
@@ -31,6 +32,22 @@ namespace Mall.Module.User
/// 售后订单
/// </summary>
private
readonly
RB_Goods_OrderAfterSaleRepository
goods_OrderAfterSaleRepository
=
new
RB_Goods_OrderAfterSaleRepository
();
/// <summary>
/// 同业客户积分
/// </summary>
private
readonly
RB_Customer_IntegralRepository
customer_IntegralRepository
=
new
RB_Customer_IntegralRepository
();
/// <summary>
/// 会员积分
/// </summary>
private
readonly
RB_Member_IntegralRepository
member_IntegralRepository
=
new
RB_Member_IntegralRepository
();
/// <summary>
/// 分销商
/// </summary>
private
readonly
RB_Distributor_InfoRepository
distributor_InfoRepository
=
new
RB_Distributor_InfoRepository
();
/// <summary>
/// 分销商日志
/// </summary>
private
readonly
RB_Distributor_LogRepository
distributor_LogRepository
=
new
RB_Distributor_LogRepository
();
/// <summary>
...
...
@@ -60,6 +77,108 @@ namespace Mall.Module.User
return
member_UserRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_Member_User_Extend
.
Id
),
extModel
.
Id
));
}
/// <summary>
/// 绑定同业
/// </summary>
/// <param name="extModel"></param>
/// <returns></returns>
public
bool
SetMemberBindCustomer
(
RB_Member_User_Extend
extModel
)
{
var
userModel
=
member_UserRepository
.
GetEntity
(
extModel
.
Id
);
if
(
userModel
==
null
||
userModel
.
CustomerId
>
0
)
{
return
true
;
}
//根据OpenID 反查询 CustomerId
var
CustomerModel
=
customer_IntegralRepository
.
GetCustomerToOpenId
(
extModel
.
CustomerOpenId
);
if
(!
string
.
IsNullOrEmpty
(
extModel
.
CustomerOpenId
)
&&
extModel
.
CustomerOpenId
.
Length
>
3
&&
extModel
.
CustomerOpenId
.
Substring
(
0
,
3
)
==
"lxy"
)
{
//根据 ID查询
try
{
int
ChildId
=
Convert
.
ToInt32
(
extModel
.
CustomerOpenId
.
Replace
(
"lxy"
,
""
));
CustomerModel
=
customer_IntegralRepository
.
GetCustomerToChildId
(
ChildId
);
}
catch
(
Exception
e
)
{
LogHelper
.
Write
(
e
,
"抓取旅小友ID失败"
);
}
}
if
(
CustomerModel
==
null
)
{
return
false
;
}
var
hlist
=
member_UserRepository
.
GetList
(
new
RB_Member_User_Extend
()
{
MallBaseId
=
userModel
.
MallBaseId
,
CustomerChildrenId
=
CustomerModel
.
CustomerChildrenId
});
if
(
hlist
.
Any
())
{
return
true
;
}
Dictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Member_User_Extend
.
CustomerId
),
CustomerModel
.
CustomerId
},
{
nameof
(
RB_Member_User_Extend
.
CustomerChildrenId
),
CustomerModel
.
CustomerChildrenId
},
};
bool
flag
=
member_UserRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_Member_User_Extend
.
Id
),
extModel
.
Id
));
if
(
flag
)
{
var
distModel
=
distributor_InfoRepository
.
GetList
(
new
RB_Distributor_Info_Extend
()
{
UserId
=
userModel
.
Id
}).
FirstOrDefault
();
if
(
distModel
!=
null
)
{
if
(
distModel
.
FXGradeId
<=
2
)
{
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Distributor_Info_Extend
.
FXGradeId
),
3
},
{
nameof
(
RB_Distributor_Info_Extend
.
UpdateDate
),
DateTime
.
Now
}
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Distributor_Info_Extend
.
Id
),
FiledValue
=
distModel
.
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
bool
flag2
=
distributor_InfoRepository
.
Update
(
keyValues
,
wheres
);
if
(
flag2
)
{
//记录日志
distributor_LogRepository
.
Insert
(
new
Model
.
Entity
.
User
.
RB_Distributor_Log
()
{
Content
=
"同行绑定赞羊,初始化分销商等级为:旅享家"
,
CreateDate
=
DateTime
.
Now
,
EmpId
=
0
,
Id
=
0
,
MallBaseId
=
1
,
TenantId
=
1
,
Type
=
1
,
UserId
=
userModel
.
Id
});
}
}
}
}
//因为存在 一个同行 下有多个 联系人的情况,
//if (flag) {
// //开始初始化 积分数据
// var list = customer_IntegralRepository.GetList(new Model.Extend.Customer.RB_Customer_Integral_Extend() { OrderType = 1, CustomerId = CustomerId });
// if (list.Any())
// {
// foreach (var item in list)
// {
// member_IntegralRepository.Insert(new Model.Entity.User.RB_Member_Integral()
// {
// Id = 0,
// Image = 0,
// Type = item.IntegralNum > 0 ? Common.Enum.MarketingCenter.RecordTypeEnum.Income : Common.Enum.MarketingCenter.RecordTypeEnum.Expend,
// Integral = Math.Abs(Convert.ToInt32(item.IntegralNum)),
// CreateDate = item.CreateTime,
// MallBaseId = extModel.MallBaseId,
// TenantId = extModel.TenantId,
// OrderId = item.OrderId,
// PlatformType = Common.Enum.User.UserSourceEnum.ERP,
// UserId = extModel.Id,
// Description = item.Description,
// Remarks = ""
// });
// }
// Dictionary<string, object> fileds2 = new Dictionary<string, object>()
// {
// { nameof(RB_Member_User_Extend.Integral),list.Sum(x=>x.IntegralNum)},
// };
// member_UserRepository.Update(fileds, new WhereHelper(nameof(RB_Member_User_Extend.Id), extModel.Id));
// }
//}
return
flag
;
}
#
region
小程序管理端
-
消息提醒
/// <summary>
...
...
Mall.Module.User/UserModule.cs
View file @
2e8a0b14
...
...
@@ -6,7 +6,6 @@ using Mall.Common;
using
Mall.Common.Plugin
;
using
Mall.Model.Entity.User
;
using
Mall.Model.Extend.User
;
using
Mall.Repository
;
using
Mall.Repository.User
;
using
Mall.Repository.Product
;
using
Mall.Model.Extend.Product
;
...
...
@@ -17,12 +16,11 @@ using Mall.Repository.BaseSetUp;
using
Mall.Common.Enum.User
;
using
Mall.Common.API
;
using
Newtonsoft.Json.Linq
;
using
System.Threading
;
using
Mall.Repository.Finance
;
using
NPOI.SS.Formula.Functions
;
using
VT.FW.DB
;
using
Mall.Repository.Miai
;
using
System.IO
;
using
Mall.Repository.Customer
;
namespace
Mall.Module.User
{
...
...
@@ -40,7 +38,10 @@ namespace Mall.Module.User
/// 用户管理
/// </summary>
private
readonly
RB_Member_UserRepository2
member_UserRepository2
=
new
RB_Member_UserRepository2
();
/// <summary>
/// ERP 同业积分
/// </summary>
private
readonly
RB_Customer_IntegralRepository
customer_IntegralRepository
=
new
RB_Customer_IntegralRepository
();
/// <summary>
/// 会员等级
/// </summary>
...
...
@@ -238,6 +239,13 @@ namespace Mall.Module.User
var
gradeIds
=
string
.
Join
(
","
,
list
.
Where
(
x
=>
x
.
MemberGrade
>
0
).
Select
(
x
=>
x
.
MemberGrade
??
0
));
gradeList
=
member_GradeRepository
.
GetList
(
new
RB_Member_Grade_Extend
()
{
GradeIds
=
gradeIds
,
TenantId
=
dmodel
.
TenantId
,
MallBaseId
=
dmodel
.
MallBaseId
});
}
#
region
查询绑定
同业联系人
List
<
Model
.
Extend
.
Customer
.
RB_Customer_Integral_Extend
>
CustomerList
=
new
List
<
Model
.
Extend
.
Customer
.
RB_Customer_Integral_Extend
>();
if
(
list
.
Any
(
x
=>
x
.
CustomerChildrenId
>
0
))
{
CustomerList
=
customer_IntegralRepository
.
GetCustomerInfoList
(
string
.
Join
(
","
,
list
.
Where
(
x
=>
x
.
CustomerChildrenId
>
0
).
Select
(
x
=>
x
.
CustomerChildrenId
)));
}
#
endregion
foreach
(
var
item
in
list
)
{
if
(
item
.
MemberGrade
>
0
)
...
...
@@ -248,6 +256,12 @@ namespace Mall.Module.User
{
item
.
MemberGradeName
=
"普通会员"
;
}
if
(
item
.
CustomerChildrenId
>
0
)
{
string
CustomerChildrenName
=
CustomerList
.
Where
(
x
=>
x
.
CustomerChildrenId
==
item
.
CustomerChildrenId
)?.
Select
(
x
=>
x
.
CustomerName
+
"/"
+
x
.
ContactName
)?.
FirstOrDefault
()
??
""
;
item
.
Name
+=
"【"
+
CustomerChildrenName
+
"】"
;
}
}
}
return
list
;
...
...
@@ -938,9 +952,29 @@ namespace Mall.Module.User
/// <param name="demodel"></param>
/// <returns></returns>
public
List
<
RB_Member_Integral_Extend
>
GetMemberIntegralPageList
(
int
pageIndex
,
int
pageSize
,
out
long
count
,
RB_Member_Integral_Extend
demodel
)
{
var
umodel
=
member_UserRepository
.
GetEntity
(
demodel
.
UserId
);
if
(
demodel
.
MallBaseId
==
1
&&
umodel
!=
null
&&
umodel
.
CustomerChildrenId
>
0
)
{
count
=
0
;
var
imodel
=
customer_IntegralRepository
.
GetCustomerInfo
(
umodel
.
CustomerChildrenId
);
if
(
imodel
==
null
||
imodel
.
IntegralUse
==
2
)
{
return
new
List
<
RB_Member_Integral_Extend
>();
}
//查询erp同业积分
var
list
=
customer_IntegralRepository
.
GetPageList
(
pageIndex
,
pageSize
,
out
count
,
new
Model
.
Extend
.
Customer
.
RB_Customer_Integral_Extend
()
{
CustomerId
=
imodel
.
CustomerId
,
CustomerChildrenId
=
imodel
.
IntegralUse
==
0
?
imodel
.
CustomerChildrenId
:
0
,
Type
=
(
int
)
demodel
.
Type
});
return
list
.
Select
(
x
=>
new
RB_Member_Integral_Extend
()
{
Remarks
=
""
,
Description
=
x
.
Description
,
CreateDate
=
x
.
CreateTime
,
Integral
=
Convert
.
ToInt32
(
Math
.
Abs
(
x
.
IntegralNum
)),
Type
=
x
.
IntegralNum
>
0
?
Common
.
Enum
.
MarketingCenter
.
RecordTypeEnum
.
Income
:
Common
.
Enum
.
MarketingCenter
.
RecordTypeEnum
.
Expend
}).
ToList
();
}
else
{
return
member_IntegralRepository
.
GetPageList
(
pageIndex
,
pageSize
,
out
count
,
demodel
);
}
}
/// <summary>
/// 保存积分
...
...
@@ -1504,6 +1538,13 @@ namespace Mall.Module.User
List
<
RB_Member_User_Extend
>
UserNum2List
=
member_UserRepository
.
GetDistributorReferralsNum
(
uids
,
tier
:
2
,
tenantId
:
demodel
.
TenantId
,
mallBaseId
:
demodel
.
MallBaseId
);
//直接查询三级
List
<
RB_Member_User_Extend
>
UserNum3List
=
member_UserRepository
.
GetDistributorReferralsNum
(
uids
,
tier
:
3
,
tenantId
:
demodel
.
TenantId
,
mallBaseId
:
demodel
.
MallBaseId
);
//直接查询三级
#
region
查询绑定
同业联系人
List
<
Model
.
Extend
.
Customer
.
RB_Customer_Integral_Extend
>
CustomerList
=
new
List
<
Model
.
Extend
.
Customer
.
RB_Customer_Integral_Extend
>();
if
(
list
.
Any
(
x
=>
x
.
CustomerChildrenId
>
0
))
{
CustomerList
=
customer_IntegralRepository
.
GetCustomerInfoList
(
string
.
Join
(
","
,
list
.
Where
(
x
=>
x
.
CustomerChildrenId
>
0
).
Select
(
x
=>
x
.
CustomerChildrenId
)));
}
#
endregion
foreach
(
var
item
in
list
)
{
if
(
item
.
GradeId
==
0
)
...
...
@@ -1556,6 +1597,11 @@ namespace Mall.Module.User
{
item
.
ThreeNum
=
UserNum3List
.
Where
(
x
=>
x
.
SuperiorId
==
item
.
UserId
).
FirstOrDefault
()?.
ReferralsNum
??
0
;
}
if
(
item
.
CustomerChildrenId
>
0
)
{
item
.
CustomerChildrenName
=
CustomerList
.
Where
(
x
=>
x
.
CustomerChildrenId
==
item
.
CustomerChildrenId
)?.
Select
(
x
=>
x
.
CustomerName
+
"/"
+
x
.
ContactName
)?.
FirstOrDefault
()
??
""
;
item
.
NickName
+=
"【"
+
item
.
CustomerChildrenName
+
"】"
;
}
}
}
...
...
@@ -4853,6 +4899,18 @@ namespace Mall.Module.User
}
#
endregion
#
region
同业积分处理
if
(
umodel
.
CustomerId
>
0
&&
umodel
.
CustomerChildrenId
>
0
)
{
//查询ERP 其账号是否可以积分兑换
var
cmodel
=
customer_IntegralRepository
.
GetCustomerInfo
(
umodel
.
CustomerChildrenId
);
if
(
cmodel
!=
null
&&
cmodel
.
IntegralUse
!=
2
)
{
decimal
erpIntergral
=
customer_IntegralRepository
.
GetCustomerIntegralSurplus
(
umodel
.
CustomerId
,
cmodel
.
IntegralUse
==
0
?
umodel
.
CustomerChildrenId
:
0
);
umodel
.
Integral
=
Convert
.
ToInt32
(
erpIntergral
);
}
}
#
endregion
objData
=
new
{
//孵化公司
...
...
Mall.Repository/Customer/RB_Customer_IntegralRepository.cs
0 → 100644
View file @
2e8a0b14
using
Mall.Model.Entity.Customer
;
using
Mall.Model.Extend.Customer
;
using
Mall.Model.Extend.User
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
Mall.Repository.Customer
{
/// <summary>
/// 客人积分明细仓储类
/// </summary>
public
class
RB_Customer_IntegralRepository
:
BaseRepository
<
RB_Customer_Integral
>
{
/// <summary>
/// 获取列表
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public
List
<
RB_Customer_Integral_Extend
>
GetList
(
RB_Customer_Integral_Extend
demodel
)
{
string
where
=
" 1=1 "
;
if
(
demodel
.
GroupId
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Customer_Integral_Extend
.
GroupId
)}
=
{
demodel
.
GroupId
}
"
;
}
if
(
demodel
.
OrderId
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Customer_Integral_Extend
.
OrderId
)}
=
{
demodel
.
OrderId
}
"
;
}
if
(
demodel
.
OrderType
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Customer_Integral_Extend
.
OrderType
)}
=
{
demodel
.
OrderType
}
"
;
}
if
(
demodel
.
CustomerId
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Customer_Integral_Extend
.
CustomerId
)}
=
{
demodel
.
CustomerId
}
"
;
}
if
(
demodel
.
CustomerType
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Customer_Integral_Extend
.
CustomerType
)}
=
{
demodel
.
CustomerType
}
"
;
}
if
(
demodel
.
TCID
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Customer_Integral_Extend
.
TCID
)}
=
{
demodel
.
TCID
}
"
;
}
string
sql
=
$@"select * from RB_Customer_Integral where
{
where
}
order by Id desc"
;
return
Get
<
RB_Customer_Integral_Extend
>(
sql
).
ToList
();
}
/// <summary>
/// 获取分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="demodel"></param>
/// <returns></returns>
public
List
<
RB_Customer_Integral_Extend
>
GetPageList
(
int
pageIndex
,
int
pageSize
,
out
long
count
,
RB_Customer_Integral_Extend
demodel
)
{
string
where
=
" 1=1 "
;
if
(
demodel
.
GroupId
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Customer_Integral_Extend
.
GroupId
)}
=
{
demodel
.
GroupId
}
"
;
}
if
(
demodel
.
OrderId
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Customer_Integral_Extend
.
OrderId
)}
=
{
demodel
.
OrderId
}
"
;
}
if
(
demodel
.
OrderType
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Customer_Integral_Extend
.
OrderType
)}
=
{
demodel
.
OrderType
}
"
;
}
if
(
demodel
.
CustomerId
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Customer_Integral_Extend
.
CustomerId
)}
=
{
demodel
.
CustomerId
}
"
;
}
if
(
demodel
.
CustomerChildrenId
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Customer_Integral_Extend
.
CustomerChildrenId
)}
=
{
demodel
.
CustomerChildrenId
}
"
;
}
if
(
demodel
.
Type
==
1
)
{
where
+=
$@" and
{
nameof
(
RB_Customer_Integral_Extend
.
IntegralNum
)}
>0"
;
}
else
if
(
demodel
.
Type
==
2
)
{
where
+=
$@" and
{
nameof
(
RB_Customer_Integral_Extend
.
IntegralNum
)}
<=0"
;
}
string
sql
=
$@"select * from RB_Customer_Integral where
{
where
}
order by Id desc"
;
return
GetPage
<
RB_Customer_Integral_Extend
>(
pageIndex
,
pageSize
,
out
count
,
sql
).
ToList
();
}
/// <summary>
/// 获取积分余额
/// </summary>
/// <param name="customerId"></param>
/// <param name="customerChildrenId"></param>
/// <returns></returns>
public
decimal
GetCustomerIntegralSurplus
(
int
customerId
,
int
customerChildrenId
)
{
string
sql
=
$@"SELECT SUM(IntegralNum) FROM rb_customer_integral i WHERE CustomerId =
{
customerId
}
{(
customerChildrenId
>
0
?
"and CustomerChildrenId="
+
customerChildrenId
:
""
)}
"
;
var
obj
=
ExecuteScalar
(
sql
);
return
obj
==
null
?
0
:
Convert
.
ToDecimal
(
obj
);
}
/// <summary>
/// 获取同业客户ID 通过 OpenId
/// </summary>
/// <param name="OpenId"></param>
/// <returns></returns>
public
RB_Customer_Integral_Extend
GetCustomerToOpenId
(
string
OpenId
)
{
string
sql
=
$@" SELECT InfoID CustomerId,ID as CustomerChildrenId FROM rb_customer_infochildren WHERE OpenId ='
{
OpenId
}
'"
;
return
Get
<
RB_Customer_Integral_Extend
>(
sql
).
FirstOrDefault
();
}
/// <summary>
/// 获取同业客户ID 通过联系人ID
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public
RB_Customer_Integral_Extend
GetCustomerToChildId
(
int
Id
)
{
string
sql
=
$@" SELECT InfoID CustomerId,ID as CustomerChildrenId FROM rb_customer_infochildren WHERE ID =
{
Id
}
"
;
return
Get
<
RB_Customer_Integral_Extend
>(
sql
).
FirstOrDefault
();
}
/// <summary>
/// 获取同行员工信息
/// </summary>
/// <param name="CustomerChildrenId"></param>
/// <returns></returns>
public
RB_Customer_Integral_Extend
GetCustomerInfo
(
int
CustomerChildrenId
)
{
string
sql
=
$@" select InfoID as CustomerId,ID as CustomerChildrenId,IntegralUse from rb_customer_infochildren where ID =
{
CustomerChildrenId
}
"
;
return
Get
<
RB_Customer_Integral_Extend
>(
sql
).
FirstOrDefault
();
}
/// <summary>
/// 更新erp同业积分余额
/// </summary>
/// <param name="customerId"></param>
/// <param name="totalIntegralNumber"></param>
public
void
UpdateCustomerIntegral
(
int
customerId
,
int
totalIntegralNumber
)
{
string
sql
=
$@"update rb_customer_info set Integral=Integral-
{
totalIntegralNumber
}
where CustomerId=
{
customerId
}
"
;
Execute
(
sql
);
}
/// <summary>
/// 获取联系人信息
/// </summary>
/// <param name="customerChildrenIds"></param>
/// <returns></returns>
public
List
<
RB_Customer_Integral_Extend
>
GetCustomerInfoList
(
string
customerChildrenIds
)
{
string
sql
=
$@"SELECT c.ID as CustomerChildrenId,i.CustomerId,c.ContactName,i.CustomerName FROM rb_customer_infochildren c
left join rb_customer_info i on c.InfoID =i.CustomerId
WHERE c.ID in(
{
customerChildrenIds
}
)"
;
return
Get
<
RB_Customer_Integral_Extend
>(
sql
).
ToList
();
}
}
}
Mall.Repository/User/RB_Distributor_InfoRepository.cs
View file @
2e8a0b14
...
...
@@ -65,7 +65,7 @@ namespace Mall.Repository.User
where
+=
$@" and u.
{
nameof
(
RB_Member_User
.
SuperiorId
)}
=
{
dmodel
.
SuperiorId
}
"
;
}
string
sql
=
$@"select di.*,u.Name as NickName,u.SuperiorId,u.Photo,u.Source from RB_Distributor_Info di
string
sql
=
$@"select di.*,u.Name as NickName,u.SuperiorId,u.Photo,u.Source
,u.CustomerChildrenId
from RB_Distributor_Info di
inner join rb_member_user u on di.UserId=u.Id
where
{
where
}
order by di.CreateDate desc"
;
return
GetPage
<
RB_Distributor_Info_Extend
>(
pageIndex
,
pageSize
,
out
rowCount
,
sql
).
ToList
();
...
...
Mall.Repository/User/RB_Member_UserRepository.cs
View file @
2e8a0b14
...
...
@@ -146,6 +146,10 @@ select * from RB_Member_User where {where} order by {orderBy}
{
where
+=
$@" and
{
nameof
(
RB_Member_User
.
SuperiorId
)}
=
{
dmodel
.
SuperiorId
}
"
;
}
if
(
dmodel
.
CustomerChildrenId
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Member_User
.
CustomerChildrenId
)}
=
{
dmodel
.
CustomerChildrenId
}
"
;
}
if
(!
string
.
IsNullOrEmpty
(
dmodel
.
UserIds
))
{
where
+=
$@" and
{
nameof
(
RB_Member_User
.
Id
)}
in(
{
dmodel
.
UserIds
}
)"
;
...
...
Mall.WebApi/Controllers/Product/AppletOrderController.cs
View file @
2e8a0b14
...
...
@@ -555,7 +555,7 @@ namespace Mall.WebApi.Controllers.MallBase
//进阶小课堂价格可以为0 hk 2022-11-01修改
if
(
demodel
.
TenantId
!=
27
)
{
if
(((
demodel
.
Income
??
0
)
+
((
demodel
.
DepositMoney
)))
<=
0
)
if
(((
demodel
.
Income
??
0
)
+
demodel
.
DepositMoney
)
<=
0
&&
(
demodel
.
Use_Integral
??
0
)
!=
1
)
{
return
ApiResult
.
ParamIsNull
(
"订单金额不正确"
);
}
...
...
Mall.WebApi/Controllers/User/AppletLoginController.cs
View file @
2e8a0b14
...
...
@@ -93,6 +93,7 @@ namespace Mall.WebApi.Controllers.User
EduSchoolId
=
parms
.
GetInt
(
"EduSchoolId"
,
0
),
IsShow
=
1
,
LookTimes
=
5
,
CustomerId
=
parms
.
GetInt
(
"CustomerId"
)
};
int
EduId
=
parms
.
GetInt
(
"EduId"
);
//用于教育绑定用户 2022-03-15
if
(
requestParm
.
TenantId
<=
0
)
...
...
Mall.WebApi/Controllers/User/MemberUserController.cs
View file @
2e8a0b14
...
...
@@ -69,6 +69,27 @@ namespace Mall.WebApi.Controllers.User
}
}
/// <summary>
/// 绑定同业
/// </summary>
/// <returns></returns>
[
RateValve
(
Policy
=
Policy
.
Ip
,
Limit
=
20
,
Duration
=
60
)]
[
HttpPost
]
public
ApiResult
SetMemberBindCustomer
()
{
JObject
jobj
=
JObject
.
Parse
(
RequestParm
.
msg
.
ToString
());
var
extModel
=
new
RB_Member_User_Extend
()
{
Id
=
jobj
.
GetInt
(
"Id"
),
CustomerOpenId
=
jobj
.
GetStringValue
(
"CustomerOpenId"
)
};
if
(
string
.
IsNullOrEmpty
(
extModel
.
CustomerOpenId
))
{
return
ApiResult
.
Success
();
}
extModel
.
TenantId
=
RequestParm
.
TenantId
;
extModel
.
MallBaseId
=
RequestParm
.
MallBaseId
;
if
(
extModel
.
MallBaseId
!=
1
)
{
return
ApiResult
.
Success
();
}
bool
flag
=
MemberUserModule
.
SetMemberBindCustomer
(
extModel
);
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
();
}
/// <summary>
/// 更改用户的手机号码 add by:W 2020-10-28
/// </summary>
...
...
Mall.WebApi/appsettings.json
View file @
2e8a0b14
...
...
@@ -11,7 +11,9 @@
"EduConnection"
:
"server=192.168.5.214;user id=reborn;password=Reborn@2018;database=reborn_edu;CharSet=utf8mb4; Convert Zero Datetime=true; "
,
"EduConnectionPName"
:
"MySql.Data.MySqlClient"
,
"ThinkConnection"
:
"server=192.168.5.214;user id=reborn;password=Reborn@2018;database=reborn_think;CharSet=utf8mb4; Convert Zero Datetime=true; "
,
"ThinkConnectionPName"
:
"MySql.Data.MySqlClient"
"ThinkConnectionPName"
:
"MySql.Data.MySqlClient"
,
"CustomerConnection"
:
"server=192.168.5.214;user id=reborn;password=Reborn@2018;database=reborn_sell;CharSet=utf8mb4; Convert Zero Datetime=true; "
,
"CustomerConnectionPName"
:
"MySql.Data.MySqlClient"
},
"Logging"
:
{
"LogLevel"
:
{
...
...
Mall.WindowsService/Module/FinanceModule.cs
View file @
2e8a0b14
...
...
@@ -15,6 +15,7 @@ using Mall.Model.Extend.User;
using
Mall.Module.User
;
using
Mall.Repository
;
using
Mall.Repository.BaseSetUp
;
using
Mall.Repository.Customer
;
using
Mall.Repository.Education
;
using
Mall.Repository.Finance
;
using
Mall.Repository.Product
;
...
...
@@ -77,6 +78,10 @@ namespace Mall.WindowsService.Module
/// </summary>
private
static
RB_Member_UserRepository
member_UserRepository
=
new
RB_Member_UserRepository
();
/// <summary>
/// erp同业积分
/// </summary>
private
static
RB_Customer_IntegralRepository
customer_IntegralRepository
=
new
RB_Customer_IntegralRepository
();
/// <summary>
/// 用户积分
/// </summary>
private
static
RB_Member_IntegralRepository
member_IntegralRepository
=
new
RB_Member_IntegralRepository
();
...
...
@@ -385,6 +390,16 @@ and DATE_FORMAT(b.PaymentTime,'%y-%m-%d')<DATE_FORMAT('{endDate}','%y-%m-%d') A
OriginalFee
+=
Math
.
Round
(
totalPrice
,
2
,
MidpointRounding
.
AwayFromZero
);
}
//会存在 积分全额抵扣情况
if
(((
result
.
Sum
(
x
=>
x
.
FinanceType
==
1
?
(
x
.
Final_Price
??
0
)
:
(
x
.
FreightMoney
??
0
)))
-
OriginalFee
)
==
0
)
{
record
.
FinanceId
=
0
;
record
.
IsFinanceAll
=
0
;
financeRecordRepository
.
Insert
(
record
);
Helper
.
LogHelper
.
Write
(
"暂无数据"
);
return
false
;
}
var
detailList
=
result
.
Select
(
x
=>
new
{
CostTypeId
=
x
.
FinanceType
==
1
?
item
.
IncomeCostTypeId
:
(
x
.
FinanceType
==
2
?
item
.
FreightCostTypeId
:
item
.
InsuranceTypeId
),
...
...
@@ -433,6 +448,13 @@ and DATE_FORMAT(b.PaymentTime,'%y-%m-%d')<DATE_FORMAT('{endDate}','%y-%m-%d') A
Helper
.
LogHelper
.
Write
(
apiResult
);
}
else
{
record
.
FinanceId
=
0
;
record
.
IsFinanceAll
=
0
;
financeRecordRepository
.
Insert
(
record
);
Helper
.
LogHelper
.
Write
(
"暂无数据"
);
return
false
;
}
}
...
...
@@ -882,6 +904,34 @@ and DATE_FORMAT(a.PayTime,'%y-%m-%d')<DATE_FORMAT('{endDate}','%y-%m-%d') AND a
var
umodel
=
member_UserRepository
.
GetEntity
(
qitem
.
UserId
);
//积分抵扣回滚
if
(
TotalIntegralNumber
>
0
)
{
if
(
umodel
.
CustomerChildrenId
>
0
)
{
//进入erp同业积分更新
try
{
customer_IntegralRepository
.
Insert
(
new
Model
.
Entity
.
Customer
.
RB_Customer_Integral
()
{
Id
=
0
,
CustomerId
=
umodel
.
CustomerId
,
CustomerChildrenId
=
umodel
.
CustomerChildrenId
,
GroupId
=
2
,
OrderId
=
qitem
.
OrderId
,
TCID
=
0
,
OrderType
=
2
,
IsDeduction
=
1
,
IntegralNum
=
TotalIntegralNumber
,
CreateTime
=
DateTime
.
Now
,
CustomerType
=
1
,
Description
=
"赞羊订单取消返回积分抵扣,订单号:"
+
qitem
.
OrderNo
,
MallCommission
=
0
-
detailList
.
Sum
(
x
=>
x
.
FXCommission
)
});
//更新同行积分数
customer_IntegralRepository
.
UpdateCustomerIntegral
(
umodel
.
CustomerId
,
0
-
TotalIntegralNumber
);
}
catch
{
}
}
else
{
Dictionary
<
string
,
object
>
keyValues1
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Member_User_Extend
.
Integral
),
umodel
.
Integral
+
TotalIntegralNumber
}
...
...
@@ -913,6 +963,7 @@ and DATE_FORMAT(a.PayTime,'%y-%m-%d')<DATE_FORMAT('{endDate}','%y-%m-%d') AND a
});
}
}
}
//优惠券回滚
if
(!
string
.
IsNullOrEmpty
(
qitem
.
CouponsIds
))
{
...
...
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