Commit 1b006293 authored by liudong1993's avatar liudong1993

Merge branch 'master' of http://gitlab.oytour.com/Kui2/mall.oytour.com

# Conflicts:
#	Mall.Module.Product/OrderModule.cs
parents ba7a0ef6 8eec5677
......@@ -127,20 +127,20 @@ namespace Mall.Common
/// </summary>
public int EmpId { get; set; }
//public string erptoken { get; set; }
///// <summary>
///// erp用户id
///// </summary>
//public int ERPEmpId { get; set; }
///// <summary>
///// erp公司id
///// </summary>
//public int ERPBranchId { get; set; }
///// <summary>
///// erp集团id
///// </summary>
//public int ERPGroupId { get; set; }
public string erptoken { get; set; }
/// <summary>
/// erp用户id
/// </summary>
public int ERPEmpId { get; set; }
/// <summary>
/// erp公司id
/// </summary>
public int ERPBranchId { get; set; }
/// <summary>
/// erp集团id
/// </summary>
public int ERPGroupId { get; set; }
}
}
......@@ -134,14 +134,7 @@ namespace Mall.Model.Entity.Property
set;
}
/// <summary>
/// 供应商id
/// </summary>
public int SupplierId
{
get;
set;
}
/// <summary>
/// 成本价
......
using Mall.Common.AOP;
using Mall.Common.Enum.User;
using System;
using System.Collections.Generic;
using System.Text;
namespace Mall.Model.Entity.User
{
/// <summary>
/// 粉象返佣等级表实体
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Distributor_FXCommission
{
/// <summary>
/// Id
/// </summary>
public int ID
{
get;
set;
}
/// <summary>
/// 等级ID
/// </summary>
public int FXGradeId
{
get;
set;
}
/// <summary>
/// 返佣等级ID
/// </summary>
public int CommissionGradeId
{
get;
set;
}
/// <summary>
/// 等级类型,-直接,2-间接
/// </summary>
public int GradeType
{
get;
set;
}
/// <summary>
/// 返佣金额
/// </summary>
public decimal? CommissionPrice
{
get;
set;
}
/// <summary>
/// 删除状态
/// </summary>
public int? Status
{
get;
set;
}
/// <summary>
/// 商户号
/// </summary>
public int TenantId
{
get;
set;
}
/// <summary>
/// 小程序id
/// </summary>
public int MallBaseId
{
get;
set;
}
/// <summary>
/// CreateDate
/// </summary>
public DateTime? CreateDate
{
get;
set;
}
/// <summary>
/// UpdateDate
/// </summary>
public DateTime? UpdateDate
{
get;
set;
}
}
}
using Mall.Common.AOP;
using Mall.Model.Entity.User;
using System;
using System.Collections.Generic;
using System.Text;
namespace Mall.Model.Extend.User
{
/// <summary>
/// 粉象返佣等级扩展表
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Distributor_FXCommission_Extend : RB_Distributor_FXCommission
{
/// <summary>
/// GradeName
/// </summary>
public string GradeName
{
get;
set;
}
}
}
......@@ -17,5 +17,11 @@ namespace Mall.Model.Extend.User
/// ids
/// </summary>
public string GradeIds { get; set; }
/// <summary>
/// 返佣佣金
/// </summary>
public List<RB_Distributor_FXCommission_Extend> FXCommissionList { get; set; }
}
}
......@@ -2291,8 +2291,10 @@ namespace Mall.Module.Product
var categoryList = clist.Where(x => x.GoodsId == item.GoodsId).ToList();
item.InventoryNum = gmodel.InventoryNum ?? 0;
item.CostMoney = gmodel.CostPrice ?? 0;
item.CommissionPrice = gmodel.Commission;// 粉象 返佣金额
item.CostMoney = gmodel.CostPrice ?? 0;//(gmodel.IsCustomSpecification==2)?(gmodel.CostPrice ?? 0):(speciPList.Where(x => x.GoodsId == item.GoodsId && x.SpecificationSort == item.SpecificationSort).FirstOrDefault().CostMoney);
item.ProductCode = gmodel.GoodsNumbers;
item.CategoryIdList = categoryList.Select(x => x.CategoryId ?? 0).ToList();
int GoodsWeight = gmodel.GoodsWeight ?? 0;//商品重量
......@@ -8395,9 +8397,9 @@ namespace Mall.Module.Product
/// <param name="count"></param>
/// <param name="dmodel"></param>
/// <returns></returns>
public List<RB_Goods_OrderDetail_Extend> GetNoOutOrderGoodsList(RB_Goods_OrderDetail_Extend dmodel)
public List<RB_Goods_OrderDetail_Extend> GetNoOutOrderGoodsList(int pageIndex, int pageSize, out long count, RB_Goods_OrderDetail_Extend dmodel)
{
return goods_OrderDetailRepository.GetNoOutOrderGoodsList(dmodel);
return goods_OrderDetailRepository.GetNoOutOrderGoodsList(pageIndex, pageSize, out count, dmodel);
}
#endregion
}
......
......@@ -3825,7 +3825,7 @@ namespace Mall.Module.Product
foreach (var item in splist)
{
var pupmodel = demodel.SpecificationPriceList.Where(x => x.SpecificationSort == item.SpecificationSort).FirstOrDefault();
if (item.SellingPrice != pupmodel.SellingPrice || item.InventoryNum != pupmodel.InventoryNum || item.GoodsNumbers != pupmodel.GoodsNumbers || item.GoodsWeight != pupmodel.GoodsWeight)
if (item.Commission != pupmodel.Commission || item.CostMoney != pupmodel.CostMoney || item.SellingPrice != pupmodel.SellingPrice || item.InventoryNum != pupmodel.InventoryNum || item.GoodsNumbers != pupmodel.GoodsNumbers || item.GoodsWeight != pupmodel.GoodsWeight)
{
Dictionary<string, object> keyValues1 = new Dictionary<string, object>() {
{ nameof(RB_Goods_SpecificationPrice.SellingPrice),pupmodel.SellingPrice},
......@@ -3882,7 +3882,7 @@ namespace Mall.Module.Product
foreach (var item in splist)
{
var pupmodel = demodel.SpecificationPriceList.Where(x => x.SpecificationSort == item.SpecificationSort).FirstOrDefault();
if (item.SellingPrice != pupmodel.SellingPrice || item.InventoryNum != pupmodel.InventoryNum || item.GoodsNumbers != pupmodel.GoodsNumbers || item.GoodsWeight != pupmodel.GoodsWeight)
if (item.Commission != pupmodel.Commission || item.CostMoney != pupmodel.CostMoney || item.SellingPrice != pupmodel.SellingPrice || item.InventoryNum != pupmodel.InventoryNum || item.GoodsNumbers != pupmodel.GoodsNumbers || item.GoodsWeight != pupmodel.GoodsWeight)
{
Dictionary<string, object> keyValues1 = new Dictionary<string, object>() {
{ nameof(RB_Goods_SpecificationPrice.SellingPrice),pupmodel.SellingPrice},
......
......@@ -58,9 +58,36 @@ namespace Mall.Module.User
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Role_Extend> GetRoleListExtModule(RB_Role_Extend query)
public string GetRoleListExtModule(RB_Role_Extend query)
{
return roleRepository.GetRoleListExtRepository(query);
string menuIds = "";
List<string> menuIdList = new List<string>();
var list= roleRepository.GetRoleListExtRepository(query);
if (list != null && list.Count > 0)
{
foreach (var item in list)
{
if (!string.IsNullOrWhiteSpace(item.RoleAuth))
{
var tempArray= item.RoleAuth.Split(',');
if (tempArray != null && tempArray.Length > 0)
{
foreach (var subItem in tempArray)
{
if (!string.IsNullOrWhiteSpace(subItem))
{
menuIdList.Add(subItem);
}
}
}
}
}
}
if (menuIdList != null && menuIdList.Count > 0)
{
menuIds = string.Join(",", menuIdList);
}
return menuIds;
}
/// <summary>
......
......@@ -142,6 +142,10 @@ namespace Mall.Module.User
private RB_Distributor_FXGradeRepository distributor_FXGradeRepository = new RB_Distributor_FXGradeRepository();
/// <summary>
/// 粉象返佣金额
/// </summary>
private RB_Distributor_FXCommissionRepository distributor_FXCommissionRepository = new RB_Distributor_FXCommissionRepository();
......@@ -2260,7 +2264,7 @@ namespace Mall.Module.User
}
return flag;
}
}
/// <summary>
/// 设置打款备注
......@@ -4620,7 +4624,8 @@ namespace Mall.Module.User
if (list.Any())
{
var pModel = list.Where(x => x.IsGuest == 1).FirstOrDefault();
if (pModel == null) {
if (pModel == null)
{
return ApiResult.Failed("未查询到普通会员等级");
}
List<string> TitleList = new List<string>();
......@@ -4628,17 +4633,21 @@ namespace Mall.Module.User
TitleList.Add("级别标准");
TitleList.Add(pModel.GradeName);
TitleList.Add("间接普会");
foreach (var item in list) {
if (item.Id != pModel.Id) {
foreach (var item in list)
{
if (item.Id != pModel.Id)
{
TitleList.Add(item.GradeName);
}
}
List<object> ContenList = new List<object>();
foreach (var item in list) {
foreach (var item in list)
{
List<string> itemList = new List<string>();
itemList.Add(item.GradeName);
itemList.Add((item.CommissionRatio ?? 0).ToString() + "%");
foreach (var qitem in list) {
foreach (var qitem in list)
{
if (qitem.Id == pModel.Id)
{
itemList.Add(GetFXGradeRatioCommon(list, item.Id, qitem.Id, 1).ToString() + "%");
......@@ -4652,12 +4661,14 @@ namespace Mall.Module.User
ContenList.Add(itemList);
}
return ApiResult.Success("",new {
return ApiResult.Success("", new
{
TitleList,
ContenList
});
}
else {
else
{
return ApiResult.Failed("没有数据");
}
}
......@@ -4682,10 +4693,12 @@ namespace Mall.Module.User
{
return 0;
}
if (model1.Grade > model2.Grade && Type == 1) {
if (model1.Grade > model2.Grade && Type == 1)
{
return (model1.CommissionRatio ?? 0) - (model2.CommissionRatio ?? 0);
}
if (id2 == pModel.Id && Type == 2) {
if (id2 == pModel.Id && Type == 2)
{
if (id1 == id2) { return 0; }
return (model1.CommissionRatio ?? 0) - ((pModel.CommissionRatio ?? 0) + (pModel.SiblingRatio ?? 0));
}
......@@ -4981,6 +4994,57 @@ namespace Mall.Module.User
return flag;
}
#endregion
#region 粉象返佣金额设置
/// <summary>
/// 返佣列表
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_Distributor_FXCommission_Extend> GetFXCommissionList(RB_Distributor_FXCommission_Extend query)
{
return distributor_FXCommissionRepository.GetFXCommissionList(query);
}
/// <summary>
/// 新增/修改返佣设置
/// </summary>
/// <param name="list"></param>
/// <returns></returns>
public bool AddOrUpdateFxCommission(List<RB_Distributor_FXCommission_Extend> list)
{
var trans = distributor_FXCommissionRepository.DbTransaction;
try
{
foreach (var item in list)
{
if (item.ID == 0)
{
item.CreateDate = System.DateTime.Now;
item.UpdateDate = System.DateTime.Now;
distributor_FXCommissionRepository.Insert(item, trans);
}
else if (item.ID > 0)
{
item.UpdateDate = System.DateTime.Now;
distributor_FXCommissionRepository.Update(item, trans);
}
}
distributor_FXCommissionRepository.DBSession.Commit();
return true;
}
catch (Exception ex)
{
distributor_FXCommissionRepository.DBSession.Rollback("AddOrUpdateFxCommission");
LogHelper.Write(ex, "AddOrUpdateFxCommission");
return false;
}
}
#endregion
}
}
......@@ -365,7 +365,7 @@ where {where} order by o.CreateDate desc";
/// <param name="count"></param>
/// <param name="dmodel"></param>
/// <returns></returns>
public List<RB_Goods_OrderDetail_Extend> GetNoOutOrderGoodsList(RB_Goods_OrderDetail_Extend dmodel)
public List<RB_Goods_OrderDetail_Extend> GetNoOutOrderGoodsList(int pageIndex, int pageSize, out long count, RB_Goods_OrderDetail_Extend dmodel)
{
string where = $" 1=1 and o.{nameof(RB_Goods_Order.Status)}=0 and o.OrderStatus=2";
string childreWhere = "";
......@@ -437,7 +437,7 @@ where {where} order by o.CreateDate desc";
string sql = $@"SELECT od.*,o.OrderNo FROM rb_goods_orderdetail od
INNER JOIN rb_goods_order o on o.OrderId=od.OrderId
where {where} order by o.CreateDate desc";
return Get<RB_Goods_OrderDetail_Extend>(sql).ToList();
return GetPage<RB_Goods_OrderDetail_Extend>(pageIndex, pageSize, out count, sql).ToList();
}
}
}
......@@ -53,10 +53,7 @@ namespace Mall.Repository.Property
{
builder.Append($" AND a.{nameof(RB_WarehouseOut_Goods_Extend.GoodsName)} like '%{query.GoodsName}%'");
}
if (query.SupplierId > 0)
{
builder.Append($" AND a.{nameof(RB_WarehouseOut_Goods_Extend.SupplierId)}={query.SupplierId}");
}
if (!string.IsNullOrWhiteSpace(query.OrderGoodsIds))
{
builder.Append($" AND a.{nameof(RB_WarehouseOut_Goods_Extend.OrderGoodsId)} in ({query.OrderGoodsIds})");
......@@ -98,10 +95,7 @@ namespace Mall.Repository.Property
{
builder.Append($" AND a.{nameof(RB_WarehouseOut_Goods_Extend.GoodsName)} like '%{query.GoodsName}%'");
}
if (query.SupplierId > 0)
{
builder.Append($" AND a.{nameof(RB_WarehouseOut_Goods_Extend.SupplierId)}={query.SupplierId}");
}
}
return Get<RB_WarehouseOut_Goods_Extend>(builder.ToString()).ToList();
}
......@@ -142,11 +136,7 @@ namespace Mall.Repository.Property
{
builder.Append($" AND a.{nameof(RB_WarehouseOut_Goods_Extend.GoodsName)} like '%{query.GoodsName}%'");
}
if (query.SupplierId > 0)
{
builder.Append($" AND a.{nameof(RB_WarehouseOut_Goods_Extend.SupplierId)}={query.SupplierId}");
}
if (!string.IsNullOrWhiteSpace(query.OrderGoodsIds))
{
builder.Append($" AND a.{nameof(RB_WarehouseOut_Goods_Extend.OrderGoodsId)} in ({query.OrderGoodsIds})");
......
using Mall.Model.Entity.User;
using Mall.Model.Extend.User;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Mall.Repository.User
{
public class RB_Distributor_FXCommissionRepository : RepositoryBase<RB_Distributor_FXCommission>
{
/// <summary>
/// 表名称
/// </summary>
public string TableName { get { return nameof(RB_Distributor_FXCommission); } }
/// <summary>
/// 返佣分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_Distributor_FXCommission_Extend> GetFXCommissionPageList(int pageIndex, int pageSize, out long rowCount, RB_Distributor_FXCommission_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.Append($" SELECT * FROM {TableName} WHERE {nameof(RB_Distributor_FXCommission_Extend.Status)}=0");
if (query != null)
{
if (query.TenantId > 0)
{
builder.Append($" AND {nameof(RB_Distributor_FXCommission_Extend.TenantId)}={query.TenantId}");
}
if (query.TenantId > 0)
{
builder.Append($" AND {nameof(RB_Distributor_FXCommission_Extend.MallBaseId)}={query.MallBaseId}");
}
if (query.FXGradeId > 0)
{
builder.Append($" AND {nameof(RB_Distributor_FXCommission_Extend.FXGradeId)}={query.FXGradeId}");
}
}
return GetPage<RB_Distributor_FXCommission_Extend>(pageIndex, pageSize, out rowCount, builder.ToString()).ToList();
}
/// <summary>
/// 返佣列表
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_Distributor_FXCommission_Extend> GetFXCommissionList(RB_Distributor_FXCommission_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.Append($" SELECT * FROM {TableName} WHERE {nameof(RB_Distributor_FXCommission_Extend.Status)}=0 ");
if (query != null)
{
if (query.ID > 0)
{
builder.Append($" AND {nameof(RB_Distributor_FXCommission_Extend.ID)}={query.ID}");
}
if (query.TenantId > 0)
{
builder.Append($" AND {nameof(RB_Distributor_FXCommission_Extend.TenantId)}={query.TenantId}");
}
if (query.TenantId > 0)
{
builder.Append($" AND {nameof(RB_Distributor_FXCommission_Extend.MallBaseId)}={query.MallBaseId}");
}
if (query.FXGradeId > 0)
{
builder.Append($" AND {nameof(RB_Distributor_FXCommission_Extend.FXGradeId)}={query.FXGradeId}");
}
}
return Get<RB_Distributor_FXCommission_Extend>(builder.ToString()).ToList();
}
}
}
......@@ -79,13 +79,19 @@ namespace Mall.Repository.User
/// <returns></returns>
public List<RB_Role_Extend> GetRoleListExtRepository(RB_Role_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT group_concat(RoleAuth) AS RoleAuth
string empRoleSql = string.Format(@" SELECT RoleAuth FROM rb_employee WHERE empId={0} ", query.EmpId);
var roleObj = base.ExecuteScalar(empRoleSql);
if (roleObj != null && !string.IsNullOrWhiteSpace(roleObj.ToString()))
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT *
FROM rb_role
WHERE `Status`=0 AND RoleId IN (SELECT group_concat(RoleAuth) AS RoleAuth FROM rb_employee WHERE empId={0} )
",query.EmpId);
return Get<RB_Role_Extend>(builder.ToString()).ToList();
WHERE `Status`=0 AND RoleId IN ({0})
", roleObj.ToString());
return Get<RB_Role_Extend>(builder.ToString()).ToList();
}
return new List<RB_Role_Extend>();
}
}
}
\ No newline at end of file
......@@ -131,7 +131,6 @@ namespace Mall.WebApi.Controllers.Property
{
item.TenantId = orderGoodsDetailModel.TenantId;
item.MallBaseId = orderGoodsDetailModel.MallBaseId;
item.SupplierId = orderGoodsDetailModel.SupplierId;
item.SpecificationSort = orderGoodsDetailModel.SpecificationSort;
item.OrderId = orderGoodsDetailModel.OrderId.Value;
item.OrderNo = orderGoodsDetailModel.OrderNo;
......@@ -188,8 +187,10 @@ namespace Mall.WebApi.Controllers.Property
RB_Goods_OrderDetail_Extend demodel = JsonConvert.DeserializeObject<RB_Goods_OrderDetail_Extend>(parms.msg.ToString());
demodel.TenantId = parms.TenantId;
demodel.MallBaseId = parms.MallBaseId;
var list = orderModule.GetNoOutOrderGoodsList(demodel);
return ApiResult.Success("", list);
var list = orderModule.GetNoOutOrderGoodsList(pagelist.pageIndex, pagelist.pageSize, out long count, demodel);
pagelist.count = Convert.ToInt32(count);
pagelist.pageData = list;
return ApiResult.Success("", pagelist);
}
......
......@@ -280,22 +280,42 @@ namespace Mall.WebApi.Controllers.User
{
if (demodel.IsSelectAll == 0 || demodel.IsSelectAll == 1)
{
if (orderGoodsItem.CostMoney > 0)
if (orderGoodsItem.CostMoney > 0 && orderGoodsItem.CostFinanceId <= 0)
{
var newOrderGoods = new RB_Goods_OrderDetail_Extend();
newOrderGoods = orderGoodsItem;
newOrderGoods.FinanceType = 1;
//var newOrderGoods = new RB_Goods_OrderDetail_Extend();
//newOrderGoods = orderGoodsItem;
//newOrderGoods.FinanceType = 1;
var newOrderGoods = new RB_Goods_OrderDetail_Extend
{
FinanceType = 1,
Final_Price = orderGoodsItem.Final_Price,
Number = 1,
FreightMoney = orderGoodsItem.FreightMoney,
GoodsName = orderGoodsItem.GoodsName,
OrderNo = orderGoodsItem.OrderNo,
Id = orderGoodsItem.Id
};
result.Add(newOrderGoods);
}
}
else if (demodel.IsSelectAll == 0 || demodel.IsSelectAll == 2)
{
if (orderGoodsItem.FreightCostMoney.HasValue && orderGoodsItem.FreightCostMoney.Value > 0)
if (orderGoodsItem.FreightCostMoney.HasValue && orderGoodsItem.FreightCostMoney.Value > 0 && orderGoodsItem.FreightFinanceId <= 0)
{
var newOrderGoods = new RB_Goods_OrderDetail_Extend();
newOrderGoods = orderGoodsItem;
newOrderGoods.FinanceType = 2;
//var newOrderGoods = new RB_Goods_OrderDetail_Extend();
//newOrderGoods = orderGoodsItem;
//newOrderGoods.FinanceType = 2;
var newOrderGoods = new RB_Goods_OrderDetail_Extend
{
FinanceType = 2,
Final_Price = orderGoodsItem.Final_Price,
Number = 1,
FreightMoney = orderGoodsItem.FreightMoney,
GoodsName = orderGoodsItem.GoodsName,
OrderNo = orderGoodsItem.OrderNo,
Id = orderGoodsItem.Id
};
result.Add(newOrderGoods);
}
}
......
......@@ -2703,10 +2703,12 @@ namespace Mall.WebApi.Controllers.User
{
return ApiResult.ParamIsNull("请选择等级");
}
if ((demodel.CommissionRatio ?? 0) <= 0) {
if ((demodel.CommissionRatio ?? 0) <= 0)
{
return ApiResult.ParamIsNull("请传递返佣比例");
}
if ((demodel.SiblingRatio ?? 0) <= 0) {
if ((demodel.SiblingRatio ?? 0) <= 0)
{
return ApiResult.ParamIsNull("请传递同级返佣比例");
}
//验证等级是否重复
......@@ -2770,7 +2772,8 @@ namespace Mall.WebApi.Controllers.User
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetFXDistributorGradeView() {
public ApiResult GetFXDistributorGradeView()
{
var req = RequestParm;
return userModule.GetFXDistributorGradeView(req.TenantId, req.MallBaseId);
}
......@@ -2799,6 +2802,168 @@ namespace Mall.WebApi.Controllers.User
return ApiResult.Success("", base64Img);
}
#endregion
#region 粉象返佣金额设置
/// <summary>
/// 获取粉象分销返佣信息列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetFXFxCommissionList()
{
var parms = RequestParm;
RB_Distributor_FXGrade_Extend demodel = JsonConvert.DeserializeObject<RB_Distributor_FXGrade_Extend>(parms.msg.ToString());
demodel.TenantId = Convert.ToInt32(parms.uid);
demodel.MallBaseId = parms.MallBaseId;
var list = userModule.GetFXDistributorGradeList(demodel).Where(x => x.IsGuest > 1);
//获取返佣价格设置
var listCommission = userModule.GetFXCommissionList(new RB_Distributor_FXCommission_Extend { TenantId = Convert.ToInt32(parms.uid), MallBaseId = parms.MallBaseId });
List<RB_Distributor_FXGrade_Extend> titleList = new List<RB_Distributor_FXGrade_Extend>();
foreach (var item in list)
{
item.FXCommissionList = new List<RB_Distributor_FXCommission_Extend>();
var nowList = listCommission.Where(x => x.FXGradeId == item.Id);
RB_Distributor_FXGrade_Extend titleModel = new RB_Distributor_FXGrade_Extend
{
GradeName = item.IsGuest == 3 ? "直接" + item.GradeName : item.GradeName,
};
titleList.Add(titleModel);
if (item.IsGuest == 3)
{
titleModel = new RB_Distributor_FXGrade_Extend
{
GradeName = "间接" + item.GradeName,
};
titleList.Add(titleModel);
}
foreach (var commissionItem in list)
{
if (nowList.Any(x => x.CommissionGradeId == commissionItem.Id && x.FXGradeId == item.Id))
{
var nowCommissionList = nowList.Where(x => x.CommissionGradeId == commissionItem.Id && x.FXGradeId == item.Id);
nowCommissionList.ToList().ForEach(x => x.GradeName = (commissionItem.IsGuest == 3 ? "直接" + commissionItem.GradeName : commissionItem.GradeName));
item.FXCommissionList.AddRange(nowCommissionList);
if (commissionItem.IsGuest == 3 && nowCommissionList.Count() < 2)
{
if (nowCommissionList.FirstOrDefault().GradeType == 1)
{
RB_Distributor_FXCommission_Extend model = new RB_Distributor_FXCommission_Extend
{
ID = 0,
FXGradeId = item.Id,
CommissionGradeId = commissionItem.Id,
GradeType = 2,
CommissionPrice = 0,
Status = 0,
GradeName = "间接" + commissionItem.GradeName,
MallBaseId = item.MallBaseId,
TenantId = item.TenantId,
};
item.FXCommissionList.Add(model);
}
else
{
RB_Distributor_FXCommission_Extend model = new RB_Distributor_FXCommission_Extend
{
ID = 0,
FXGradeId = item.Id,
CommissionGradeId = commissionItem.Id,
GradeType = 1,
CommissionPrice = 0,
Status = 0,
GradeName = "间接" + commissionItem.GradeName,
MallBaseId = item.MallBaseId,
TenantId = item.TenantId,
};
item.FXCommissionList.Add(model);
}
}
}
else
{
RB_Distributor_FXCommission_Extend model = new RB_Distributor_FXCommission_Extend
{
ID = 0,
FXGradeId = item.Id,
CommissionGradeId = commissionItem.Id,
GradeType = 1,
CommissionPrice = 0,
Status = 0,
GradeName = commissionItem.IsGuest == 3 ? "直接" + commissionItem.GradeName : commissionItem.GradeName,
MallBaseId = item.MallBaseId,
TenantId = item.TenantId,
};
item.FXCommissionList.Add(model);
if (commissionItem.IsGuest == 3)
{
model = new RB_Distributor_FXCommission_Extend
{
ID = 0,
FXGradeId = item.Id,
CommissionGradeId = commissionItem.Id,
GradeType = 2,
CommissionPrice = 0,
Status = 0,
GradeName = "间接" + commissionItem.GradeName,
MallBaseId = item.MallBaseId,
TenantId = item.TenantId,
};
item.FXCommissionList.Add(model);
}
}
}
}
var result = new
{
resultList = list.Select(x => new
{
x.Id,
x.GradeName,
x.FXCommissionList,
x.Grade,
}),
titleList = titleList.Select(x => new { x.GradeName })
};
return ApiResult.Success("", result);
}
/// <summary>
/// 新增修改等级
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetFXFxCommissionInfo()
{
var req = RequestParm;
RB_Distributor_FXGrade_Extend demodel = JsonConvert.DeserializeObject<RB_Distributor_FXGrade_Extend>(req.msg.ToString());
if (demodel.FXCommissionList.Any(x => x.CommissionPrice < 0))
{
return ApiResult.Failed("返佣价格不能小于0");
}
bool flag = userModule.AddOrUpdateFxCommission(demodel.FXCommissionList);
if (flag)
{
return ApiResult.Success();
}
else
{
return ApiResult.Failed();
}
}
#endregion
}
}
\ No newline at end of file
......@@ -193,17 +193,36 @@ and DATE_FORMAT(b.PaymentTime,'%y-%m-%d')<DATE_FORMAT('{endDate}','%y-%m-%d') A
{
if (orderGoodsItem.Final_Price > 0)
{
var newOrderGoods = new RB_Goods_OrderDetail_Extend();
newOrderGoods = orderGoodsItem;
newOrderGoods.FinanceType = 1;
var newOrderGoods = new RB_Goods_OrderDetail_Extend
{
FinanceType = 1,
Final_Price = orderGoodsItem.Final_Price,
Number = 1,
FreightMoney = orderGoodsItem.FreightMoney,
GoodsName = orderGoodsItem.GoodsName,
OrderNo = orderGoodsItem.OrderNo,
Id = orderGoodsItem.Id
};
//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;
//var newOrderGoods = new RB_Goods_OrderDetail_Extend();
//newOrderGoods = orderGoodsItem;
//newOrderGoods.FinanceType = 2;
var newOrderGoods = new RB_Goods_OrderDetail_Extend
{
FinanceType = 2,
Final_Price = orderGoodsItem.Final_Price,
Number = 1,
FreightMoney = orderGoodsItem.FreightMoney,
GoodsName = orderGoodsItem.GoodsName,
OrderNo = orderGoodsItem.OrderNo,
Id = orderGoodsItem.Id
};
result.Add(newOrderGoods);
}
RB_Finance_RecordDetail financeRecordDetail = new RB_Finance_RecordDetail
......@@ -267,7 +286,7 @@ and DATE_FORMAT(b.PaymentTime,'%y-%m-%d')<DATE_FORMAT('{endDate}','%y-%m-%d') A
Remark = System.DateTime.Now.ToString("yyyy年MM月dd日") + "自动生成财务单据",
detailList,
OriginalFee,
RB_Depart_Id= Config.IncomeDepartment
RB_Depart_Id = Config.IncomeDepartment
};
string sign = EncryptionHelper.AesEncrypt(JsonHelper.Serialize(financeObj), Config.FinanceKey);
var resultInfo = new
......@@ -973,7 +992,8 @@ and DATE_FORMAT(b.PaymentTime,'%y-%m-%d')<DATE_FORMAT('{endDate}','%y-%m-%d') A
/// 批量制退款单
/// </summary>
/// <returns></returns>
public static bool AutoCreateFinanceRefund() {
public static bool AutoCreateFinanceRefund()
{
try
{
//先查询规则
......@@ -1019,7 +1039,8 @@ and DATE_FORMAT(b.PaymentTime,'%y-%m-%d')<DATE_FORMAT('{endDate}','%y-%m-%d') A
{
OrderRefundFinanceModule(olist, afterlist);
}
else {
else
{
//没有 创建一条记录 财务单据为0的记录
RB_Finance_Record_Extend record = new RB_Finance_Record_Extend();
record.MallBaseId = item.MallBaseId;
......@@ -1050,7 +1071,7 @@ and DATE_FORMAT(b.PaymentTime,'%y-%m-%d')<DATE_FORMAT('{endDate}','%y-%m-%d') A
/// </summary>
/// <param name="omodel"></param>
/// <returns></returns>
public static bool OrderRefundFinanceModule(List<RB_Goods_Order_Extend> oList,List<RB_Goods_OrderAfterSale_Extend> afterList)
public static bool OrderRefundFinanceModule(List<RB_Goods_Order_Extend> oList, List<RB_Goods_OrderAfterSale_Extend> afterList)
{
var flag = false;
try
......@@ -1111,7 +1132,8 @@ and DATE_FORMAT(b.PaymentTime,'%y-%m-%d')<DATE_FORMAT('{endDate}','%y-%m-%d') A
record.RecordDetailList.Add(financeRecordDetail);
}
//售后退款
foreach (var dmodel in afterList) {
foreach (var dmodel in afterList)
{
decimal Money = dmodel.Refund ?? 0;
TotalMoney += Money;
//查询用户
......@@ -1194,7 +1216,8 @@ and DATE_FORMAT(b.PaymentTime,'%y-%m-%d')<DATE_FORMAT('{endDate}','%y-%m-%d') A
record.RecordDetailList.ForEach(x => x.FinanceId = frid);
flag = financeRecordDetailRepository.InsertBatch(record.RecordDetailList);
foreach (var omodel in oList) {
foreach (var omodel in oList)
{
Dictionary<string, object> keyValues = new Dictionary<string, object>() {
{ nameof(RB_Goods_Order_Extend.Remark), omodel.Remark +" 自动生成财务退款单据:"+ frid}
};
......@@ -1217,7 +1240,8 @@ and DATE_FORMAT(b.PaymentTime,'%y-%m-%d')<DATE_FORMAT('{endDate}','%y-%m-%d') A
};
goods_OrderRepository.Update(keyValues, wheres);
}
foreach (var dmodel in afterList) {
foreach (var dmodel in afterList)
{
Dictionary<string, object> keyValues = new Dictionary<string, object>() {
{ nameof(RB_Goods_OrderAfterSale.ReRemark), dmodel.ReRemark +" 自动生成财务退款单据:"+ frid},
{ nameof(RB_Goods_OrderAfterSale.FinanceId), frid},
......@@ -1252,7 +1276,7 @@ and DATE_FORMAT(b.PaymentTime,'%y-%m-%d')<DATE_FORMAT('{endDate}','%y-%m-%d') A
});
}
}
Helper.LogHelper.Write(apiResult);
Helper.LogHelper.Write(apiResult);
}
}
catch (Exception ex)
......
......@@ -12,9 +12,9 @@ namespace Mall.WindowsService
partial class WindowsService : ServiceBase
{
System.Timers.Timer timer1; //计时器
private System.Timers.Timer timer2; //订单取消计时器
private System.Timers.Timer timer3; //订单自动收货计时器
private System.Timers.Timer timer4; //七天自动取消下线计时器
//private System.Timers.Timer timer2; //订单取消计时器
//private System.Timers.Timer timer3; //订单自动收货计时器
//private System.Timers.Timer timer4; //七天自动取消下线计时器
public WindowsService()
{
......@@ -27,44 +27,44 @@ namespace Mall.WindowsService
Helper.LogHelper.Write("主服务开始运行......");
TimersHelper helper = new TimersHelper();
timer1 = new System.Timers.Timer();
timer1.Interval = 1000 * (60 * 60); //60分钟
timer1.Interval = 1000 * (60 * 0.5); //60分钟
timer1.Elapsed += new System.Timers.ElapsedEventHandler(helper.RevenueFinance);
timer1.Enabled = true;
#region 订单取消定时器
//#region 订单取消定时器
timer2 = new System.Timers.Timer
{
Interval = 1000 * (60 * 10) //10分钟处理一次
};
timer2.Elapsed += new System.Timers.ElapsedEventHandler(helper.AutoCancelOrder);
timer2.Enabled = true;
//timer2 = new System.Timers.Timer
//{
// Interval = 1000 * (60 * 10) //10分钟处理一次
//};
//timer2.Elapsed += new System.Timers.ElapsedEventHandler(helper.AutoCancelOrder);
//timer2.Enabled = true;
#endregion
//#endregion
#region 订单自动完成定时器
//#region 订单自动完成定时器
timer3 = new System.Timers.Timer();
timer3 = new System.Timers.Timer
{
Interval = 1000 * (60 * 60) //60分钟调用一次
};
timer3.Elapsed += new System.Timers.ElapsedEventHandler(helper.AutoReceivingOrder);
timer3.Enabled = true;
//timer3 = new System.Timers.Timer();
//timer3 = new System.Timers.Timer
//{
// Interval = 1000 * (60 * 60) //60分钟调用一次
//};
//timer3.Elapsed += new System.Timers.ElapsedEventHandler(helper.AutoReceivingOrder);
//timer3.Enabled = true;
#endregion
//#endregion
#region 七天自动取消下线
//#region 七天自动取消下线
timer4 = new System.Timers.Timer();
timer4 = new System.Timers.Timer
{
Interval = 1000 * (60 * 60) //60分钟调用一次
};
timer4.Elapsed += new System.Timers.ElapsedEventHandler(helper.AutoReleaseTheOffline);
timer4.Enabled = true;
//timer4 = new System.Timers.Timer();
//timer4 = new System.Timers.Timer
//{
// Interval = 1000 * (60 * 60) //60分钟调用一次
//};
//timer4.Elapsed += new System.Timers.ElapsedEventHandler(helper.AutoReleaseTheOffline);
//timer4.Enabled = true;
#endregion
//#endregion
}
protected override void OnStop()
......@@ -72,9 +72,9 @@ namespace Mall.WindowsService
// TODO: 在此处添加代码以执行停止服务所需的关闭操作。
Helper.LogHelper.Write("主服务停止运行......");
this.timer1.Enabled = false;
this.timer2.Enabled = false;
this.timer3.Enabled = false;
this.timer4.Enabled = false;
//this.timer2.Enabled = false;
//this.timer3.Enabled = false;
//this.timer4.Enabled = false;
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment