Commit b2c2de32 authored by 吴春's avatar 吴春

提交

parent 6b8088f3
...@@ -21,6 +21,11 @@ namespace Mall.Common.Enum.MallBase ...@@ -21,6 +21,11 @@ namespace Mall.Common.Enum.MallBase
/// 起送规则 /// 起送规则
/// </summary> /// </summary>
[EnumField("起送规则")] [EnumField("起送规则")]
OpenMinPrice = 3 OpenMinPrice = 3,
/// <summary>
/// 区域购买
/// </summary>
[EnumField("区域购买")]
AreaBuy =4
} }
} }
using Mall.Common.AOP;
using System;
using System.Collections.Generic;
using System.Text;
namespace Mall.Model.Entity.BaseSetUp
{
/// <summary>
/// 电子面单实体表
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_ElectronicSheet
{
public int ID { get; set; }
/// <summary>
/// 商户id
/// </summary>
public int TenantId { get; set; }
/// <summary>
/// 小程序id
/// </summary>
public int MallBaseId { get; set; }
public int Status { get; set; }
public DateTime CreateDate { get; set; }
public DateTime UpdateDate { get; set; }
/// <summary>
/// 发件人姓名
/// </summary>
public string Name { get; set; }
/// <summary>
/// 发件人电话
/// </summary>
public string Mobile { get; set; }
/// <summary>
/// 地址
/// </summary>
public string Address { get; set; }
/// <summary>
/// 0-否1-是
/// </summary>
public int IsDefault { get; set; }
/// <summary>
/// 省
/// </summary>
public int ProvinceId { get; set; }
/// <summary>
/// 市
/// </summary>
public int CityId { get; set; }
/// <summary>
/// 区
/// </summary>
public int DistrictId { get; set; }
/// <summary>
/// 发件人手机
/// </summary>
public string Phone { get; set; }
/// <summary>
/// 发件人邮箱
/// </summary>
public string Email { get; set; }
/// <summary>
/// 发件人公司
/// </summary>
public string Company { get; set; }
/// <summary>
/// 网点名称
/// </summary>
public string WebDot { get; set; }
/// <summary>
/// 网点编码
/// </summary>
public string WebCode { get; set; }
/// <summary>
/// 月结编码
/// </summary>
public string MonthlyCode { get; set; }
/// <summary>
/// 电子面单密码
/// </summary>
public string Password { get; set; }
/// <summary>
/// 电子面单账号
/// </summary>
public string Account { get; set; }
/// <summary>
/// 是否打印商品,0-否,10是
/// </summary>
public int IsPrintGoods { get; set; }
/// <summary>
/// 是否订阅手短信,0-否,10是
/// </summary>
public int IsSubscribeSMS { get; set; }
/// <summary>
/// 快递公司Id
/// </summary>
public int ExpressId { get; set; }
}
}
using Mall.Common.AOP;
using System;
using System.Collections.Generic;
using System.Text;
namespace Mall.Model.Entity.BaseSetUp
{
/// <summary>
/// 退货地址
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Logistics_Delivery
{
public int ID { get; set; }
/// <summary>
/// 商户id
/// </summary>
public int TenantId { get; set; }
/// <summary>
/// 小程序id
/// </summary>
public int MallBaseId { get; set; }
public int Status { get; set; }
/// <summary>
/// 0-否1-是
/// </summary>
public int IsDefault { get; set; }
public DateTime CreateDate { get; set; }
public DateTime UpdateDate { get; set; }
/// <summary>
/// 收货人姓名
/// </summary>
public string Name { get; set; }
/// <summary>
/// 联系方式
/// </summary>
public string Mobile { get; set; }
/// <summary>
/// 地址
/// </summary>
public string Address { get; set; }
/// <summary>
/// 备注
/// </summary>
public string Remarks { get; set; }
/// <summary>
/// 省
/// </summary>
public int ProvinceId { get; set; }
/// <summary>
/// 市
/// </summary>
public int CityId { get; set; }
/// <summary>
/// 区
/// </summary>
public int DistrictId { get; set; }
}
}
using Mall.Common.AOP;
using System;
using System.Collections.Generic;
using System.Text;
namespace Mall.Model.Entity.BaseSetUp
{
/// <summary>
/// 快递公司
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Logistics_Express
{
public int ID { get; set; }
/// <summary>
/// 商户id
/// </summary>
public int TenantId { get; set; }
/// <summary>
/// 小程序id
/// </summary>
public int MallBaseId { get; set; }
public int Status { get; set; }
/// <summary>
/// 快递公司名称
/// </summary>
public string Name { get; set; }
/// <summary>
/// 快递公司缩写
/// </summary>
public string ExpressCode { get; set; }
}
}
using Mall.Common.AOP;
using Mall.Model.Entity.BaseSetUp;
using System;
using System.Collections.Generic;
using System.Text;
namespace Mall.Model.Extend.BaseSetUp
{
/// <summary>
/// 电子面单扩展实体表
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_ElectronicSheet_Extend : RB_ElectronicSheet
{
/// <summary>
/// 省
/// </summary>
public string ProvinceName { get; set; }
/// <summary>
/// 市
/// </summary>
public string CityName { get; set; }
/// <summary>
/// 区
/// </summary>
public string DistrictName { get; set; }
/// <summary>
/// 快递公司
/// </summary>
public string ExpressName { get; set; }
}
}
using Mall.Common.AOP;
using Mall.Model.Entity.BaseSetUp;
using System;
using System.Collections.Generic;
using System.Text;
namespace Mall.Model.Extend.BaseSetUp
{
/// <summary>
/// 退货地址扩展表
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Logistics_Delivery_Extend : RB_Logistics_Delivery
{
/// <summary>
/// 省
/// </summary>
public string ProvinceName { get; set; }
/// <summary>
/// 市
/// </summary>
public string CityName { get; set; }
/// <summary>
/// 区
/// </summary>
public string DistrictName { get; set; }
}
}
...@@ -20,8 +20,9 @@ namespace Mall.Module.BaseSetUp ...@@ -20,8 +20,9 @@ namespace Mall.Module.BaseSetUp
private RB_Logistics_RulesPriceRepository logisticsRulesPriceRepository = new RB_Logistics_RulesPriceRepository(); private RB_Logistics_RulesPriceRepository logisticsRulesPriceRepository = new RB_Logistics_RulesPriceRepository();
private RB_Logistics_RulesRegionRepository logisticsRulesRegionRepository = new RB_Logistics_RulesRegionRepository(); private RB_Logistics_RulesRegionRepository logisticsRulesRegionRepository = new RB_Logistics_RulesRegionRepository();
private RB_Logistics_RulesRepository logisticsRulesRepository = new RB_Logistics_RulesRepository(); private RB_Logistics_RulesRepository logisticsRulesRepository = new RB_Logistics_RulesRepository();
private RB_Logistics_DeliveryRepository deliveryRepository = new RB_Logistics_DeliveryRepository();
private RB_Logistics_ExpressRepository expressRepository = new RB_Logistics_ExpressRepository();
private RB_ElectronicSheetRepository electronicSheetRepository = new RB_ElectronicSheetRepository();
#region 基础设置 #region 基础设置
/// <summary> /// <summary>
/// 获取小程序列表 /// 获取小程序列表
...@@ -195,7 +196,7 @@ namespace Mall.Module.BaseSetUp ...@@ -195,7 +196,7 @@ namespace Mall.Module.BaseSetUp
{ {
new WhereHelper (){ FiledName=nameof(RB_Logistics_Rules.MallBaseId),FiledValue=query.MallBaseId,OperatorEnum=OperatorEnum.Equal} new WhereHelper (){ FiledName=nameof(RB_Logistics_Rules.MallBaseId),FiledValue=query.MallBaseId,OperatorEnum=OperatorEnum.Equal}
}; };
logisticsRulesPriceRepository.Update(fileds, whereHelpers, trans); logisticsRulesRepository.Update(fileds, whereHelpers, trans);
IDictionary<string, object> filedsDefault = new Dictionary<string, object>() IDictionary<string, object> filedsDefault = new Dictionary<string, object>()
{ {
...@@ -205,7 +206,7 @@ namespace Mall.Module.BaseSetUp ...@@ -205,7 +206,7 @@ namespace Mall.Module.BaseSetUp
{ {
new WhereHelper (){ FiledName=nameof(RB_Logistics_Rules.ID),FiledValue=query.ID,OperatorEnum=OperatorEnum.Equal} new WhereHelper (){ FiledName=nameof(RB_Logistics_Rules.ID),FiledValue=query.ID,OperatorEnum=OperatorEnum.Equal}
}; };
logisticsRulesPriceRepository.Update(filedsDefault, whereHelpersDefault, trans); logisticsRulesRepository.Update(filedsDefault, whereHelpersDefault, trans);
logisticsRulesRepository.DBSession.Commit(); logisticsRulesRepository.DBSession.Commit();
} }
catch (Exception ex) catch (Exception ex)
...@@ -240,12 +241,15 @@ namespace Mall.Module.BaseSetUp ...@@ -240,12 +241,15 @@ namespace Mall.Module.BaseSetUp
item.RulesId = rulesId; item.RulesId = rulesId;
item.TenantId = model.TenantId; item.TenantId = model.TenantId;
item.MallBaseId = model.MallBaseId; item.MallBaseId = model.MallBaseId;
item.CreateDate = model.CreateDate;
item.UpdateDate = model.UpdateDate;
int priceId = logisticsRulesPriceRepository.Insert(item, trans); int priceId = logisticsRulesPriceRepository.Insert(item, trans);
item.List.ForEach(x => x.RulesPriceId = priceId); item.List.ForEach(x => x.RulesPriceId = priceId);
item.List.ForEach(x => x.TenantId = model.TenantId); item.List.ForEach(x => x.TenantId = model.TenantId);
item.List.ForEach(x => x.RulesType = Common.Enum.MallBase.RulesTypeEnum.Rule); item.List.ForEach(x => x.RulesType = Common.Enum.MallBase.RulesTypeEnum.Rule);
item.List.ForEach(x => x.MallBaseId = model.MallBaseId); item.List.ForEach(x => x.MallBaseId = model.MallBaseId);
item.List.ForEach(x => x.CreateDate = System.DateTime.Now); item.List.ForEach(x => x.CreateDate = System.DateTime.Now);
item.List.ForEach(x => x.UpdateDate = System.DateTime.Now);
flag = logisticsRulesRegionRepository.InsertBatch(item.List, trans); flag = logisticsRulesRegionRepository.InsertBatch(item.List, trans);
} }
} }
...@@ -275,7 +279,7 @@ namespace Mall.Module.BaseSetUp ...@@ -275,7 +279,7 @@ namespace Mall.Module.BaseSetUp
IDictionary<string, object> fileds = new Dictionary<string, object>() IDictionary<string, object> fileds = new Dictionary<string, object>()
{ {
{ nameof(RB_Logistics_RulesPrice.Status),1}, { nameof(RB_Logistics_RulesPrice.Status),1},
{ nameof(RB_Logistics_RulesPrice.UpdateDate),model.UpdateDate},
}; };
IList<WhereHelper> whereHelpers = new List<WhereHelper>() IList<WhereHelper> whereHelpers = new List<WhereHelper>()
{ {
...@@ -307,8 +311,11 @@ namespace Mall.Module.BaseSetUp ...@@ -307,8 +311,11 @@ namespace Mall.Module.BaseSetUp
item.TenantId = model.TenantId; item.TenantId = model.TenantId;
item.MallBaseId = model.MallBaseId; item.MallBaseId = model.MallBaseId;
int priceId = 0; int priceId = 0;
item.UpdateDate = model.UpdateDate;
if (item.ID == 0) if (item.ID == 0)
{ {
item.CreateDate = System.DateTime.Now;
priceId = logisticsRulesPriceRepository.Insert(item, trans); priceId = logisticsRulesPriceRepository.Insert(item, trans);
} }
else else
...@@ -329,26 +336,10 @@ namespace Mall.Module.BaseSetUp ...@@ -329,26 +336,10 @@ namespace Mall.Module.BaseSetUp
}; };
flag = logisticsRulesRegionRepository.Update(filedsRegion, whereHelpersRegion, trans); flag = logisticsRulesRegionRepository.Update(filedsRegion, whereHelpersRegion, trans);
} }
//比较之前有的现在没有的价格
//List<string> notRegionList = new List<string>();
//notRegionList = listLogisticsRulesRegion.Where(x => x.RulesPriceId == item.ID).Select(x => x.ID.ToString()).Except(item.List.Select(x => x.ID.ToString())).ToList();
//var deleteRegionList = listLogisticsRulesRegion.Where(x => x.RulesPriceId == item.ID).Where(x => notRegionList.Contains(x.ID.ToString()));
//foreach (var itemRegion in deleteRegionList)
//{
// IDictionary<string, object> filedsRegion = new Dictionary<string, object>()//删除价格下面对应的地区
// {
// { nameof(RB_LogisticsRulesRegion.Status),1},
// };
// IList<WhereHelper> whereHelpersRegion = new List<WhereHelper>()
// {
// new WhereHelper (){ FiledName=nameof(RB_LogisticsRulesRegion.ID),FiledValue=itemRegion.ID,OperatorEnum=OperatorEnum.Equal}
// };
// logisticsRulesRegionRepository.Update(filedsRegion, whereHelpersRegion, trans);
//}
} }
item.List.ForEach(x => x.RulesPriceId = priceId); item.List.ForEach(x => x.RulesPriceId = priceId);
item.List.ForEach(x => x.CreateDate = System.DateTime.Now); item.List.ForEach(x => x.CreateDate = System.DateTime.Now);
item.List.ForEach(x => x.UpdateDate = System.DateTime.Now);
item.List.ForEach(x => x.ID = 0); item.List.ForEach(x => x.ID = 0);
item.List.ForEach(x => x.TenantId = model.TenantId); item.List.ForEach(x => x.TenantId = model.TenantId);
item.List.ForEach(x => x.RulesType = model.RulesType); item.List.ForEach(x => x.RulesType = model.RulesType);
...@@ -493,7 +484,7 @@ namespace Mall.Module.BaseSetUp ...@@ -493,7 +484,7 @@ namespace Mall.Module.BaseSetUp
public RB_Logistics_Rules_Extend GetPinkageModel(RB_Logistics_Rules_Extend query) public RB_Logistics_Rules_Extend GetPinkageModel(RB_Logistics_Rules_Extend query)
{ {
RB_Logistics_Rules_Extend model = logisticsRulesRepository.GetLogisticsRulesList(query).FirstOrDefault(); RB_Logistics_Rules_Extend model = logisticsRulesRepository.GetLogisticsRulesList(query).FirstOrDefault();
List<RB_Logistics_RulesRegion_Extend> listLogisticsRulesRegion = logisticsRulesRegionRepository.GetListRepository(new RB_Logistics_RulesRegion_Extend { TenantId = query.TenantId, RulesType = Common.Enum.MallBase.RulesTypeEnum.Pinkage, MallBaseId = query.MallBaseId, RulesPriceId = model.ID }); List<RB_Logistics_RulesRegion_Extend> listLogisticsRulesRegion = logisticsRulesRegionRepository.GetListRepository(new RB_Logistics_RulesRegion_Extend { TenantId = query.TenantId, RulesType = query.RulesType, MallBaseId = query.MallBaseId, RulesPriceId = model.ID });
model.List = new List<RB_Logistics_RulesRegion_Extend>(); model.List = new List<RB_Logistics_RulesRegion_Extend>();
model.List = listLogisticsRulesRegion; model.List = listLogisticsRulesRegion;
return model; return model;
...@@ -520,7 +511,7 @@ namespace Mall.Module.BaseSetUp ...@@ -520,7 +511,7 @@ namespace Mall.Module.BaseSetUp
rulesId = model.ID; rulesId = model.ID;
flag = logisticsRulesRepository.Update(model, trans); flag = logisticsRulesRepository.Update(model, trans);
List<RB_Logistics_RulesRegion_Extend> listLogisticsRulesRegion = logisticsRulesRegionRepository.GetListRepository(new RB_Logistics_RulesRegion_Extend { TenantId = model.TenantId, RulesType = Common.Enum.MallBase.RulesTypeEnum.Pinkage, MallBaseId = model.MallBaseId, RulesPriceId = model.ID }); List<RB_Logistics_RulesRegion_Extend> listLogisticsRulesRegion = logisticsRulesRegionRepository.GetListRepository(new RB_Logistics_RulesRegion_Extend { TenantId = model.TenantId, RulesType = model.RulesType, MallBaseId = model.MallBaseId, RulesPriceId = model.ID });
//删除之前的区域 //删除之前的区域
foreach (var itemRegion in listLogisticsRulesRegion.Where(x => x.RulesPriceId == model.ID)) foreach (var itemRegion in listLogisticsRulesRegion.Where(x => x.RulesPriceId == model.ID))
...@@ -537,13 +528,17 @@ namespace Mall.Module.BaseSetUp ...@@ -537,13 +528,17 @@ namespace Mall.Module.BaseSetUp
flag = logisticsRulesRegionRepository.Update(filedsRegion, whereHelpersRegion, trans); flag = logisticsRulesRegionRepository.Update(filedsRegion, whereHelpersRegion, trans);
} }
} }
model.List.ForEach(x => x.TenantId = rulesId); if (model.List != null && model.List.Any())
model.List.ForEach(x => x.CreateDate = System.DateTime.Now); {
model.List.ForEach(x => x.ID = 0); model.List.ForEach(x => x.TenantId = rulesId);
model.List.ForEach(x => x.RulesPriceId = model.TenantId); model.List.ForEach(x => x.CreateDate = System.DateTime.Now);
model.List.ForEach(x => x.RulesType = Common.Enum.MallBase.RulesTypeEnum.Pinkage); model.List.ForEach(x => x.ID = 0);
model.List.ForEach(x => x.MallBaseId = model.MallBaseId); model.List.ForEach(x => x.RulesPriceId = model.TenantId);
flag = logisticsRulesRegionRepository.InsertBatch(model.List, trans); model.List.ForEach(x => x.RulesType = model.RulesType);
model.List.ForEach(x => x.MallBaseId = model.MallBaseId);
flag = logisticsRulesRegionRepository.InsertBatch(model.List, trans);
}
logisticsRulesRepository.DBSession.Commit(); logisticsRulesRepository.DBSession.Commit();
} }
catch (Exception ex) catch (Exception ex)
...@@ -632,5 +627,255 @@ namespace Mall.Module.BaseSetUp ...@@ -632,5 +627,255 @@ namespace Mall.Module.BaseSetUp
} }
#endregion #endregion
#region 退货地址
/// <summary>
/// 退货地址列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_Logistics_Delivery_Extend> GetDeliveryPageList(int pageIndex, int pageSize, out long rowCount, RB_Logistics_Delivery_Extend query)
{
return deliveryRepository.GetPageListRepository(pageIndex, pageSize, out rowCount, query);
}
/// <summary>
/// 退货地址列表
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_Logistics_Delivery_Extend> GetLogisticsDeliveryList(RB_Logistics_Delivery_Extend query)
{
return deliveryRepository.GetLogisticsDeliveryList(query);
}
/// <summary>
/// 删除收货地址
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public bool DelDelivery(RB_Logistics_Delivery_Extend model)
{
Dictionary<string, object> cols = new Dictionary<string, object>()
{
{ nameof(RB_Logistics_Delivery.Status),1},
{ nameof(RB_Logistics_Delivery.UpdateDate),DateTime.Now},
};
List<WhereHelper> wheres1 = new List<WhereHelper>() {
new WhereHelper(){
FiledName=nameof(RB_Logistics_Delivery.ID),
FiledValue=model.ID,
OperatorEnum=OperatorEnum.Equal
},
new WhereHelper(){
FiledName=nameof(RB_Logistics_Delivery.TenantId),
FiledValue=Convert.ToInt32(model.TenantId),
OperatorEnum=OperatorEnum.Equal
},
new WhereHelper(){
FiledName=nameof(RB_Logistics_Delivery.MallBaseId),
FiledValue=Convert.ToInt32(model.MallBaseId),
OperatorEnum=OperatorEnum.Equal
}
};
return deliveryRepository.Update(cols, wheres1);
}
public bool SetDefaultLogisticsDelivery(RB_Logistics_Delivery_Extend query)
{
bool flag = false;
var trans = deliveryRepository.DbTransaction;
try
{
IDictionary<string, object> fileds = new Dictionary<string, object>()
{
{ nameof(RB_Logistics_Rules.IsDefault),0},
};
IList<WhereHelper> whereHelpers = new List<WhereHelper>()
{
new WhereHelper (){ FiledName=nameof(RB_Logistics_Delivery.MallBaseId),FiledValue=query.MallBaseId,OperatorEnum=OperatorEnum.Equal},
new WhereHelper (){ FiledName=nameof(RB_Logistics_Delivery.TenantId),FiledValue=query.TenantId,OperatorEnum=OperatorEnum.Equal}
};
deliveryRepository.Update(fileds, whereHelpers, trans);
IDictionary<string, object> filedsDefault = new Dictionary<string, object>()
{
{ nameof(RB_Logistics_Rules.IsDefault),1},
};
IList<WhereHelper> whereHelpersDefault = new List<WhereHelper>()
{
new WhereHelper (){ FiledName=nameof(RB_Logistics_Delivery.ID),FiledValue=query.ID,OperatorEnum=OperatorEnum.Equal}
};
deliveryRepository.Update(filedsDefault, whereHelpersDefault, trans);
deliveryRepository.DBSession.Commit();
}
catch (Exception ex)
{
LogHelper.Write(ex, "SetDefaultLogisticsDelivery");
deliveryRepository.DBSession.Rollback("SetDefaultLogisticsDelivery");
return false;
}
return flag;
}
/// <summary>
/// 新增/修改收货地址
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public bool AddOrUpdateDelivery(RB_Logistics_Delivery_Extend model)
{
if (model.ID == 0)
{
return deliveryRepository.Insert(model) > 0;
}
else
{
return deliveryRepository.Update(model);
}
}
#endregion
#region 快递公司
/// <summary>
/// 快递公司列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_Logistics_Express> GetLogisticsExpressList(RB_Logistics_Express query)
{
return expressRepository.GetLogisticsExpressList(query);
}
#endregion
#region 电子面单
/// <summary>
///电子面单列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_ElectronicSheet_Extend> GetElectronicSheetPage(int pageIndex, int pageSize, out long rowCount, RB_ElectronicSheet_Extend query)
{
return electronicSheetRepository.GetElectronicSheetPage(pageIndex, pageSize, out rowCount, query);
}
/// <summary>
/// 电子面单列表
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_ElectronicSheet_Extend> GetElectronicSheetList(RB_ElectronicSheet_Extend query)
{
return electronicSheetRepository.GetElectronicSheetList(query);
}
/// <summary>
/// 删除电子面单
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public bool DelElectronicSheet(RB_ElectronicSheet_Extend model)
{
Dictionary<string, object> cols = new Dictionary<string, object>()
{
{ nameof(RB_ElectronicSheet.Status),1},
{ nameof(RB_ElectronicSheet.UpdateDate),DateTime.Now},
};
List<WhereHelper> wheres1 = new List<WhereHelper>() {
new WhereHelper(){
FiledName=nameof(RB_ElectronicSheet.ID),
FiledValue=model.ID,
OperatorEnum=OperatorEnum.Equal
},
new WhereHelper(){
FiledName=nameof(RB_ElectronicSheet.TenantId),
FiledValue=Convert.ToInt32(model.TenantId),
OperatorEnum=OperatorEnum.Equal
},
new WhereHelper(){
FiledName=nameof(RB_ElectronicSheet.MallBaseId),
FiledValue=Convert.ToInt32(model.MallBaseId),
OperatorEnum=OperatorEnum.Equal
}
};
return electronicSheetRepository.Update(cols, wheres1);
}
/// <summary>
/// 设置默认电子面单
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public bool SetDefaultElectronicSheet(RB_ElectronicSheet_Extend query)
{
bool flag = false;
var trans = electronicSheetRepository.DbTransaction;
try
{
IDictionary<string, object> fileds = new Dictionary<string, object>()
{
{ nameof(RB_Logistics_Rules.IsDefault),0},
};
IList<WhereHelper> whereHelpers = new List<WhereHelper>()
{
new WhereHelper (){ FiledName=nameof(RB_ElectronicSheet.MallBaseId),FiledValue=query.MallBaseId,OperatorEnum=OperatorEnum.Equal},
new WhereHelper (){ FiledName=nameof(RB_ElectronicSheet.TenantId),FiledValue=query.TenantId,OperatorEnum=OperatorEnum.Equal},
};
electronicSheetRepository.Update(fileds, whereHelpers, trans);
IDictionary<string, object> filedsDefault = new Dictionary<string, object>()
{
{ nameof(RB_Logistics_Rules.IsDefault),1},
};
IList<WhereHelper> whereHelpersDefault = new List<WhereHelper>()
{
new WhereHelper (){ FiledName=nameof(RB_ElectronicSheet.ID),FiledValue=query.ID,OperatorEnum=OperatorEnum.Equal}
};
electronicSheetRepository.Update(filedsDefault, whereHelpersDefault, trans);
electronicSheetRepository.DBSession.Commit();
}
catch (Exception ex)
{
LogHelper.Write(ex, "SetDefaultLogisticsDelivery");
electronicSheetRepository.DBSession.Rollback("SetDefaultLogisticsDelivery");
return false;
}
return flag;
}
/// <summary>
/// 新增/修改电子面单
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public bool AddOrUpdateElectronicSheet(RB_ElectronicSheet_Extend model)
{
if (model.ID == 0)
{
return electronicSheetRepository.Insert(model) > 0;
}
else
{
return electronicSheetRepository.Update(model);
}
}
#endregion
} }
} }
using Mall.Model.Entity.BaseSetUp;
using Mall.Model.Extend.BaseSetUp;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Mall.Repository.BaseSetUp
{
/// <summary>
/// 电子面单仓储层
/// </summary>
public class RB_ElectronicSheetRepository : RepositoryBase<RB_ElectronicSheet>
{
/// <summary>
/// 表名称
/// </summary>
public string TableName { get { return nameof(RB_ElectronicSheet); } }
// <summary>
/// 表名称
/// </summary>
public string DestinationTableName { get { return nameof(RB_Destination); } }
/// <summary>
///电子面单列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_ElectronicSheet_Extend> GetElectronicSheetPage(int pageIndex, int pageSize, out long rowCount, RB_ElectronicSheet_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.Append(@$" SELECT a.*,b.`Name` as ProvinceName,c.`Name` as CityName,d.`Name` as DistrictName FROM {TableName} as a
LEFT JOIN {DestinationTableName} as b on a.ProvinceId = b.ID
LEFT JOIN {DestinationTableName} as c on a.CityId = c.ID
LEFT JOIN {DestinationTableName} as d on a.DistrictId = d.ID WHERE a.{nameof(RB_ElectronicSheet_Extend.Status)}=0");
if (query != null)
{
// where += $@" and {nameof(RB_Customer_InfoCreate.CustomerId)}={dmodel.CustomerId}";
if (query.TenantId > 0)
{
builder.Append($" AND a.{nameof(RB_ElectronicSheet_Extend.TenantId)}={query.TenantId}");
}
if (query.TenantId > 0)
{
builder.Append($" AND a.{nameof(RB_ElectronicSheet_Extend.MallBaseId)}={query.MallBaseId}");
}
if (!string.IsNullOrWhiteSpace(query.Name))
{
builder.Append(@$" AND (a.{nameof(RB_ElectronicSheet_Extend.Name)} like '%{query.Name}%' or a.{nameof(RB_ElectronicSheet_Extend.Mobile)} like '%{query.Name}%')
or a.{nameof(RB_ElectronicSheet_Extend.WebCode)} like '%{query.Name}%') or a.{nameof(RB_ElectronicSheet_Extend.WebDot)} like '%{query.Name}%')
or a.{nameof(RB_ElectronicSheet_Extend.Company)} like '%{query.Name}%')
");
}
}
return GetPage<RB_ElectronicSheet_Extend>(pageIndex, pageSize, out rowCount, builder.ToString()).ToList();
}
/// <summary>
/// 电子面单列表
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_ElectronicSheet_Extend> GetElectronicSheetList(RB_ElectronicSheet_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.Append(@$" SELECT a.*,b.`Name` as ProvinceName,c.`Name` as CityName,d.`Name` as DistrictName FROM {TableName} as a
LEFT JOIN { DestinationTableName} as b on a.ProvinceId = b.ID
LEFT JOIN { DestinationTableName} as c on a.CityId = c.ID
LEFT JOIN { DestinationTableName} as d on a.DistrictId = d.ID WHERE a.{ nameof(RB_ElectronicSheet_Extend.Status)}= 0 ");
if (query != null)
{
if (query.ID > 0)
{
builder.Append($" AND a.{nameof(RB_ElectronicSheet_Extend.ID)}={query.ID}");
}
if (query.TenantId > 0)
{
builder.Append($" AND a.{nameof(RB_ElectronicSheet_Extend.TenantId)}={query.TenantId}");
}
if (query.TenantId > 0)
{
builder.Append($" AND a.{nameof(RB_ElectronicSheet_Extend.MallBaseId)}={query.MallBaseId}");
}
if (!string.IsNullOrWhiteSpace(query.Name))
{
builder.Append($" AND a.{nameof(RB_ElectronicSheet_Extend.Name)} like '%{query.Name}%'");
}
if (!string.IsNullOrWhiteSpace(query.Mobile))
{
builder.Append($" AND a.{nameof(RB_ElectronicSheet_Extend.Mobile)} like '%{query.Mobile}%'");
}
}
return Get<RB_ElectronicSheet_Extend>(builder.ToString()).ToList();
}
}
}
using Mall.Model.Entity.BaseSetUp;
using Mall.Model.Extend.BaseSetUp;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Mall.Repository.BaseSetUp
{
/// <summary>
/// 退货地址仓储层
/// </summary>
public class RB_Logistics_DeliveryRepository : RepositoryBase<RB_Logistics_Delivery>
{
/// <summary>
/// 表名称
/// </summary>
public string TableName { get { return nameof(RB_Logistics_Delivery); } }
// <summary>
/// 表名称
/// </summary>
public string DestinationTableName { get { return nameof(RB_Destination); } }
/// <summary>
/// 退货地址列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_Logistics_Delivery_Extend> GetPageListRepository(int pageIndex, int pageSize, out long rowCount, RB_Logistics_Delivery_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.Append(@$" SELECT a.*,b.`Name` as ProvinceName,c.`Name` as CityName,d.`Name` as DistrictName FROM {TableName} as a
LEFT JOIN {DestinationTableName} as b on a.ProvinceId = b.ID
LEFT JOIN {DestinationTableName} as c on a.CityId = c.ID
LEFT JOIN {DestinationTableName} as d on a.DistrictId = d.ID WHERE a.{nameof(RB_Logistics_Delivery_Extend.Status)}=0");
if (query != null)
{
// where += $@" and {nameof(RB_Customer_InfoCreate.CustomerId)}={dmodel.CustomerId}";
if (query.TenantId > 0)
{
builder.Append($" AND a.{nameof(RB_Logistics_Delivery_Extend.TenantId)}={query.TenantId}");
}
if (query.TenantId > 0)
{
builder.Append($" AND a.{nameof(RB_Logistics_Delivery_Extend.MallBaseId)}={query.MallBaseId}");
}
if (!string.IsNullOrWhiteSpace(query.Name))
{
builder.Append($" AND (a.{nameof(RB_Logistics_Delivery_Extend.Name)} like '%{query.Name}%' or a.{nameof(RB_Logistics_Delivery_Extend.Mobile)} like '%{query.Mobile}%') ");
}
}
return GetPage<RB_Logistics_Delivery_Extend>(pageIndex, pageSize, out rowCount, builder.ToString()).ToList();
}
/// <summary>
/// 退货地址列表
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_Logistics_Delivery_Extend> GetLogisticsDeliveryList(RB_Logistics_Delivery_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.Append(@$" SELECT a.*,b.`Name` as ProvinceName,c.`Name` as CityName,d.`Name` as DistrictName FROM {TableName} as a
LEFT JOIN { DestinationTableName} as b on a.ProvinceId = b.ID
LEFT JOIN { DestinationTableName} as c on a.CityId = c.ID
LEFT JOIN { DestinationTableName} as d on a.DistrictId = d.ID WHERE a.{ nameof(RB_Logistics_Delivery_Extend.Status)}= 0 ");
if (query != null)
{
if (query.ID > 0)
{
builder.Append($" AND a.{nameof(RB_Logistics_Delivery_Extend.ID)}={query.ID}");
}
if (query.TenantId > 0)
{
builder.Append($" AND a.{nameof(RB_Logistics_Delivery_Extend.TenantId)}={query.TenantId}");
}
if (query.TenantId > 0)
{
builder.Append($" AND a.{nameof(RB_Logistics_Delivery_Extend.MallBaseId)}={query.MallBaseId}");
}
if (!string.IsNullOrWhiteSpace(query.Name))
{
builder.Append($" AND a.{nameof(RB_Logistics_Delivery_Extend.Name)} like '%{query.Name}%'");
}
if (!string.IsNullOrWhiteSpace(query.Mobile))
{
builder.Append($" AND a.{nameof(RB_Logistics_Delivery_Extend.Mobile)} like '%{query.Mobile}%'");
}
}
return Get<RB_Logistics_Delivery_Extend>(builder.ToString()).ToList();
}
}
}
using Mall.Model.Entity.BaseSetUp;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Mall.Repository.BaseSetUp
{
public class RB_Logistics_ExpressRepository:RepositoryBase<RB_Logistics_Express>
{
/// <summary>
/// 表名称
/// </summary>
public string TableName { get { return nameof(RB_Logistics_Express); } }
/// <summary>
/// 快递公司列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_Logistics_Express> GetLogisticsExpressList(RB_Logistics_Express query)
{
StringBuilder builder = new StringBuilder();
builder.Append($" SELECT * FROM {TableName} WHERE {nameof(RB_Logistics_Express.Status)}=0 ");
if (query != null)
{
if (query.ID > 0)
{
builder.Append($" AND {nameof(RB_Logistics_Express.ID)}={query.ID}");
}
if (query.TenantId > 0)
{
builder.Append($" AND {nameof(RB_Logistics_Express.TenantId)}={query.TenantId}");
}
if (query.TenantId > 0)
{
builder.Append($" AND {nameof(RB_Logistics_Express.MallBaseId)}={query.MallBaseId}");
}
if (!string.IsNullOrWhiteSpace(query.Name))
{
builder.Append($" AND {nameof(RB_Logistics_Express.Name)} like '%{query.Name}%'");
}
}
return Get<RB_Logistics_Express>(builder.ToString()).ToList();
}
}
}
...@@ -42,7 +42,7 @@ namespace Mall.Repository.BaseSetUp ...@@ -42,7 +42,7 @@ namespace Mall.Repository.BaseSetUp
} }
if (query.RulesType > 0) if (query.RulesType > 0)
{ {
builder.Append($" AND a.{nameof(RB_Logistics_Rules_Extend.RulesType)}={(int)query.RulesType}"); builder.Append($" AND {nameof(RB_Logistics_Rules_Extend.RulesType)}={(int)query.RulesType}");
} }
} }
return GetPage<RB_Logistics_Rules_Extend>(pageIndex, pageSize, out rowCount, builder.ToString()).ToList(); return GetPage<RB_Logistics_Rules_Extend>(pageIndex, pageSize, out rowCount, builder.ToString()).ToList();
...@@ -81,7 +81,7 @@ namespace Mall.Repository.BaseSetUp ...@@ -81,7 +81,7 @@ namespace Mall.Repository.BaseSetUp
} }
if (query.RulesType > 0) if (query.RulesType > 0)
{ {
builder.Append($" AND a.{nameof(RB_Logistics_Rules_Extend.RulesType)}={(int)query.RulesType}"); builder.Append($" AND {nameof(RB_Logistics_Rules_Extend.RulesType)}={(int)query.RulesType}");
} }
} }
return Get<RB_Logistics_Rules_Extend>(builder.ToString()).ToList(); return Get<RB_Logistics_Rules_Extend>(builder.ToString()).ToList();
......
...@@ -59,11 +59,11 @@ namespace Mall.Repository.BaseSetUp ...@@ -59,11 +59,11 @@ namespace Mall.Repository.BaseSetUp
{ {
if (query.TenantId > 0) if (query.TenantId > 0)
{ {
builder.Append($" AND {nameof(RB_MallBase_Extend.TenantId)}={query.TenantId}"); builder.Append($" AND a.{nameof(RB_MallBase_Extend.TenantId)}={query.TenantId}");
} }
if (query.MallBaseId > 0) if (query.MallBaseId > 0)
{ {
builder.Append($" AND {nameof(RB_MallBase_Extend.MallBaseId)}={query.MallBaseId}"); builder.Append($" AND a.{nameof(RB_MallBase_Extend.MallBaseId)}={query.MallBaseId}");
} }
} }
return Get<RB_MallBase_Extend>( builder.ToString()).ToList(); return Get<RB_MallBase_Extend>( builder.ToString()).ToList();
......
...@@ -28,6 +28,7 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -28,6 +28,7 @@ namespace Mall.WebApi.Controllers.MallBase
#region 基础设置 #region 基础设置
public ApiResult AddOrUpdateMallBase() public ApiResult AddOrUpdateMallBase()
{ {
var parms = RequestParm;
var query = JsonConvert.DeserializeObject<RB_MallBase_Extend>(RequestParm.msg.ToString()); var query = JsonConvert.DeserializeObject<RB_MallBase_Extend>(RequestParm.msg.ToString());
if (query == null) if (query == null)
...@@ -83,10 +84,15 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -83,10 +84,15 @@ namespace Mall.WebApi.Controllers.MallBase
public ApiResult GetMallBaseInfo() public ApiResult GetMallBaseInfo()
{ {
var parms = RequestParm;
var query = new RB_MallBase_Extend(); var query = new RB_MallBase_Extend();
query.TenantId = UserInfo.TenantId; query.TenantId = UserInfo.TenantId;
query.MallBaseId = UserInfo.MallBaseId; query.MallBaseId = parms.MallBaseId;
var model = mallBaseModule.GetListRepository(query).FirstOrDefault(); var model = mallBaseModule.GetListRepository(query).FirstOrDefault();
if (model == null)
{
model = new RB_MallBase_Extend();
}
return ApiResult.Success("获取成功", model); return ApiResult.Success("获取成功", model);
} }
...@@ -102,6 +108,7 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -102,6 +108,7 @@ namespace Mall.WebApi.Controllers.MallBase
/// <returns></returns> /// <returns></returns>
public ApiResult GetLogistics() public ApiResult GetLogistics()
{ {
var parms = RequestParm;
var query = JsonConvert.DeserializeObject<RB_Logistics>(RequestParm.msg.ToString()); var query = JsonConvert.DeserializeObject<RB_Logistics>(RequestParm.msg.ToString());
query.TenantId = UserInfo.TenantId; query.TenantId = UserInfo.TenantId;
var oldLogisticsModel = mallBaseModule.GetLogisticsList(query).FirstOrDefault(); var oldLogisticsModel = mallBaseModule.GetLogisticsList(query).FirstOrDefault();
...@@ -119,6 +126,7 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -119,6 +126,7 @@ namespace Mall.WebApi.Controllers.MallBase
/// <returns></returns> /// <returns></returns>
public ApiResult AddOrUpdateLogistics() public ApiResult AddOrUpdateLogistics()
{ {
var parms = RequestParm;
var query = JsonConvert.DeserializeObject<RB_Logistics>(RequestParm.msg.ToString()); var query = JsonConvert.DeserializeObject<RB_Logistics>(RequestParm.msg.ToString());
if (query == null) if (query == null)
...@@ -150,10 +158,11 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -150,10 +158,11 @@ namespace Mall.WebApi.Controllers.MallBase
[HttpPost] [HttpPost]
public ApiResult GetLogisticsRulesPage() public ApiResult GetLogisticsRulesPage()
{ {
var parms = RequestParm;
ResultPageModel pagelist = JsonConvert.DeserializeObject<ResultPageModel>(RequestParm.msg.ToString()); ResultPageModel pagelist = JsonConvert.DeserializeObject<ResultPageModel>(RequestParm.msg.ToString());
RB_Logistics_Rules_Extend demodel = JsonConvert.DeserializeObject<RB_Logistics_Rules_Extend>(RequestParm.msg.ToString()); RB_Logistics_Rules_Extend demodel = JsonConvert.DeserializeObject<RB_Logistics_Rules_Extend>(RequestParm.msg.ToString());
demodel.TenantId = UserInfo.TenantId; demodel.TenantId = UserInfo.TenantId;
demodel.MallBaseId = UserInfo.MallBaseId; demodel.MallBaseId = parms.MallBaseId;
demodel.RulesType = Common.Enum.MallBase.RulesTypeEnum.Rule; demodel.RulesType = Common.Enum.MallBase.RulesTypeEnum.Rule;
var list = mallBaseModule.GetLogisticsRulesList(pagelist.pageIndex, pagelist.pageSize, out long count, demodel); var list = mallBaseModule.GetLogisticsRulesList(pagelist.pageIndex, pagelist.pageSize, out long count, demodel);
pagelist.count = Convert.ToInt32(count); pagelist.count = Convert.ToInt32(count);
...@@ -173,9 +182,10 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -173,9 +182,10 @@ namespace Mall.WebApi.Controllers.MallBase
/// <returns></returns> /// <returns></returns>
public ApiResult GetLogisticsRules() public ApiResult GetLogisticsRules()
{ {
var parms = RequestParm;
var query = JsonConvert.DeserializeObject<RB_Logistics_Rules_Extend>(RequestParm.msg.ToString()); var query = JsonConvert.DeserializeObject<RB_Logistics_Rules_Extend>(RequestParm.msg.ToString());
query.TenantId = UserInfo.TenantId; query.TenantId = UserInfo.TenantId;
query.MallBaseId = UserInfo.MallBaseId; query.MallBaseId = parms.MallBaseId;
query.RulesType = Common.Enum.MallBase.RulesTypeEnum.Rule; query.RulesType = Common.Enum.MallBase.RulesTypeEnum.Rule;
var oldLogisticsModel = mallBaseModule.GetLogisticsRulesModel(query); var oldLogisticsModel = mallBaseModule.GetLogisticsRulesModel(query);
if (oldLogisticsModel == null) if (oldLogisticsModel == null)
...@@ -193,9 +203,10 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -193,9 +203,10 @@ namespace Mall.WebApi.Controllers.MallBase
/// <returns></returns> /// <returns></returns>
public ApiResult SetLogisticsRulesDefault() public ApiResult SetLogisticsRulesDefault()
{ {
var parms = RequestParm;
var query = JsonConvert.DeserializeObject<RB_Logistics_Rules_Extend>(RequestParm.msg.ToString()); var query = JsonConvert.DeserializeObject<RB_Logistics_Rules_Extend>(RequestParm.msg.ToString());
query.TenantId = UserInfo.TenantId; query.TenantId = UserInfo.TenantId;
query.MallBaseId = UserInfo.MallBaseId; query.MallBaseId = parms.MallBaseId;
query.RulesType = Common.Enum.MallBase.RulesTypeEnum.Rule; query.RulesType = Common.Enum.MallBase.RulesTypeEnum.Rule;
bool result = mallBaseModule.SetDefaultLogisticsRules(query); bool result = mallBaseModule.SetDefaultLogisticsRules(query);
...@@ -217,9 +228,10 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -217,9 +228,10 @@ namespace Mall.WebApi.Controllers.MallBase
/// <returns></returns> /// <returns></returns>
public ApiResult AddOrUpdateLogisticsRules() public ApiResult AddOrUpdateLogisticsRules()
{ {
var parms = RequestParm;
var query = JsonConvert.DeserializeObject<RB_Logistics_Rules_Extend>(RequestParm.msg.ToString()); var query = JsonConvert.DeserializeObject<RB_Logistics_Rules_Extend>(RequestParm.msg.ToString());
query.TenantId = UserInfo.TenantId; query.TenantId = UserInfo.TenantId;
query.MallBaseId = UserInfo.MallBaseId; query.MallBaseId = parms.MallBaseId;
query.RulesType = Common.Enum.MallBase.RulesTypeEnum.Rule; query.RulesType = Common.Enum.MallBase.RulesTypeEnum.Rule;
if (query == null) if (query == null)
{ {
...@@ -263,14 +275,14 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -263,14 +275,14 @@ namespace Mall.WebApi.Controllers.MallBase
public ApiResult DelRules() public ApiResult DelRules()
{ {
var parms = RequestParm;
JObject parms = JObject.Parse(RequestParm.msg.ToString()); JObject parmsJob = JObject.Parse(RequestParm.msg.ToString());
int Id = parms.GetInt("Id", 0); int Id = parmsJob.GetInt("Id", 0);
if (Id <= 0) if (Id <= 0)
{ {
return ApiResult.Failed("请传递参数"); return ApiResult.Failed("请传递参数");
} }
bool flag = mallBaseModule.DelRulesInfo(Id, UserInfo.TenantId, UserInfo.MallBaseId); bool flag = mallBaseModule.DelRulesInfo(Id, UserInfo.TenantId, parms.MallBaseId);
if (flag) if (flag)
{ {
return ApiResult.Success(); return ApiResult.Success();
...@@ -293,10 +305,11 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -293,10 +305,11 @@ namespace Mall.WebApi.Controllers.MallBase
[HttpPost] [HttpPost]
public ApiResult GetLogisticsPinkagePage() public ApiResult GetLogisticsPinkagePage()
{ {
var parms = RequestParm;
ResultPageModel pagelist = JsonConvert.DeserializeObject<ResultPageModel>(RequestParm.msg.ToString()); ResultPageModel pagelist = JsonConvert.DeserializeObject<ResultPageModel>(RequestParm.msg.ToString());
RB_Logistics_Rules_Extend demodel = JsonConvert.DeserializeObject<RB_Logistics_Rules_Extend>(RequestParm.msg.ToString()); RB_Logistics_Rules_Extend demodel = JsonConvert.DeserializeObject<RB_Logistics_Rules_Extend>(RequestParm.msg.ToString());
demodel.TenantId = UserInfo.TenantId; demodel.TenantId = UserInfo.TenantId;
demodel.MallBaseId = UserInfo.MallBaseId; demodel.MallBaseId = parms.MallBaseId;
demodel.RulesType = Common.Enum.MallBase.RulesTypeEnum.Pinkage; demodel.RulesType = Common.Enum.MallBase.RulesTypeEnum.Pinkage;
var list = mallBaseModule.GetLogisticsPinkageList(pagelist.pageIndex, pagelist.pageSize, out long count, demodel); var list = mallBaseModule.GetLogisticsPinkageList(pagelist.pageIndex, pagelist.pageSize, out long count, demodel);
pagelist.count = Convert.ToInt32(count); pagelist.count = Convert.ToInt32(count);
...@@ -314,14 +327,14 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -314,14 +327,14 @@ namespace Mall.WebApi.Controllers.MallBase
public ApiResult DelPinkage() public ApiResult DelPinkage()
{ {
var parms = RequestParm;
JObject parms = JObject.Parse(RequestParm.msg.ToString()); JObject parmsJob = JObject.Parse(RequestParm.msg.ToString());
int Id = parms.GetInt("Id", 0); int Id = parmsJob.GetInt("Id", 0);
if (Id <= 0) if (Id <= 0)
{ {
return ApiResult.Failed("请传递参数"); return ApiResult.Failed("请传递参数");
} }
bool flag = mallBaseModule.DelPinkageInfo(Id, UserInfo.TenantId, UserInfo.MallBaseId); bool flag = mallBaseModule.DelPinkageInfo(Id, UserInfo.TenantId, parms.MallBaseId);
if (flag) if (flag)
{ {
return ApiResult.Success(); return ApiResult.Success();
...@@ -338,9 +351,10 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -338,9 +351,10 @@ namespace Mall.WebApi.Controllers.MallBase
/// <returns></returns> /// <returns></returns>
public ApiResult GetLogisticsPinkage() public ApiResult GetLogisticsPinkage()
{ {
var parms = RequestParm;
var query = JsonConvert.DeserializeObject<RB_Logistics_Rules_Extend>(RequestParm.msg.ToString()); var query = JsonConvert.DeserializeObject<RB_Logistics_Rules_Extend>(RequestParm.msg.ToString());
query.TenantId = UserInfo.TenantId; query.TenantId = UserInfo.TenantId;
query.MallBaseId = UserInfo.MallBaseId; query.MallBaseId = parms.MallBaseId;
query.RulesType = Common.Enum.MallBase.RulesTypeEnum.Pinkage; query.RulesType = Common.Enum.MallBase.RulesTypeEnum.Pinkage;
var oldLogisticsModel = mallBaseModule.GetPinkageModel(query); var oldLogisticsModel = mallBaseModule.GetPinkageModel(query);
if (oldLogisticsModel == null) if (oldLogisticsModel == null)
...@@ -357,9 +371,10 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -357,9 +371,10 @@ namespace Mall.WebApi.Controllers.MallBase
/// <returns></returns> /// <returns></returns>
public ApiResult AddOrUpdateLogisticsPinkage() public ApiResult AddOrUpdateLogisticsPinkage()
{ {
var parms = RequestParm;
var query = JsonConvert.DeserializeObject<RB_Logistics_Rules_Extend>(RequestParm.msg.ToString()); var query = JsonConvert.DeserializeObject<RB_Logistics_Rules_Extend>(RequestParm.msg.ToString());
query.TenantId = UserInfo.TenantId; query.TenantId = UserInfo.TenantId;
query.MallBaseId = UserInfo.MallBaseId; query.MallBaseId = parms.MallBaseId;
query.RulesType = Common.Enum.MallBase.RulesTypeEnum.Pinkage; query.RulesType = Common.Enum.MallBase.RulesTypeEnum.Pinkage;
if (query == null) if (query == null)
{ {
...@@ -402,9 +417,10 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -402,9 +417,10 @@ namespace Mall.WebApi.Controllers.MallBase
#region 起送规则 #region 起送规则
public ApiResult GetMinPriceInfo() public ApiResult GetMinPriceInfo()
{ {
var parms = RequestParm;
var query = new RB_Logistics_Rules_Extend(); var query = new RB_Logistics_Rules_Extend();
query.TenantId = UserInfo.TenantId; query.TenantId = UserInfo.TenantId;
query.MallBaseId = UserInfo.MallBaseId; query.MallBaseId = parms.MallBaseId;
query.RulesType = Common.Enum.MallBase.RulesTypeEnum.OpenMinPrice; query.RulesType = Common.Enum.MallBase.RulesTypeEnum.OpenMinPrice;
var model = mallBaseModule.GetLogisticsRulesModel(query); var model = mallBaseModule.GetLogisticsRulesModel(query);
return ApiResult.Success("获取成功", model); return ApiResult.Success("获取成功", model);
...@@ -417,9 +433,10 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -417,9 +433,10 @@ namespace Mall.WebApi.Controllers.MallBase
/// <returns></returns> /// <returns></returns>
public ApiResult AddOrUpdateMinPrice() public ApiResult AddOrUpdateMinPrice()
{ {
var parms = RequestParm;
var query = JsonConvert.DeserializeObject<RB_Logistics_Rules_Extend>(RequestParm.msg.ToString()); var query = JsonConvert.DeserializeObject<RB_Logistics_Rules_Extend>(RequestParm.msg.ToString());
query.TenantId = UserInfo.TenantId; query.TenantId = UserInfo.TenantId;
query.MallBaseId = UserInfo.MallBaseId; query.MallBaseId = parms.MallBaseId;
query.RulesType = Common.Enum.MallBase.RulesTypeEnum.OpenMinPrice; query.RulesType = Common.Enum.MallBase.RulesTypeEnum.OpenMinPrice;
if (query == null) if (query == null)
{ {
...@@ -472,5 +489,401 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -472,5 +489,401 @@ namespace Mall.WebApi.Controllers.MallBase
#endregion #endregion
#region 退货地址
/// <summary>
/// 退货地址列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetLogisticsDeliveryPage()
{
var parms = RequestParm;
ResultPageModel pagelist = JsonConvert.DeserializeObject<ResultPageModel>(RequestParm.msg.ToString());
RB_Logistics_Delivery_Extend demodel = JsonConvert.DeserializeObject<RB_Logistics_Delivery_Extend>(RequestParm.msg.ToString());
demodel.TenantId = UserInfo.TenantId;
demodel.MallBaseId = parms.MallBaseId;
var list = mallBaseModule.GetDeliveryPageList(pagelist.pageIndex, pagelist.pageSize, out long count, demodel);
pagelist.count = Convert.ToInt32(count);
pagelist.pageData = list.Select(x => new
{
x.ID,
x.Name,
x.Mobile,
x.Remarks,
Address = x.ProvinceName + x.CityName + x.DistrictName + x.Address,
x.CityName,
x.IsDefault
});
return ApiResult.Success("", pagelist);
}
/// <summary>
/// 获取退货地址详情
/// </summary>
/// <returns></returns>
public ApiResult GetLogisticsDelivery()
{
var parms = RequestParm;
var query = JsonConvert.DeserializeObject<RB_Logistics_Delivery_Extend>(RequestParm.msg.ToString());
query.TenantId = UserInfo.TenantId;
query.MallBaseId = parms.MallBaseId;
var oldLogisticsModel = mallBaseModule.GetLogisticsDeliveryList(query).FirstOrDefault();
if (oldLogisticsModel == null)
{
oldLogisticsModel = new RB_Logistics_Delivery_Extend();
}
return ApiResult.Success("", oldLogisticsModel);
}
/// <summary>
/// 设置默认退货地址
/// </summary>
/// <returns></returns>
public ApiResult SetLogisticsDeliveryDefault()
{
var parms = RequestParm;
var query = JsonConvert.DeserializeObject<RB_Logistics_Delivery_Extend>(RequestParm.msg.ToString());
query.TenantId = UserInfo.TenantId;
query.MallBaseId = parms.MallBaseId;
bool result = mallBaseModule.SetDefaultLogisticsDelivery(query);
if (result)
{
return ApiResult.Success("默认收货地址设置成功");
}
else
{
return ApiResult.Failed("默认收货地址设置失败");
}
}
/// <summary>
/// 保存退货地址信息
/// </summary>
/// <returns></returns>
public ApiResult AddOrUpdateLogisticsDelivery()
{
var parms = RequestParm;
var query = JsonConvert.DeserializeObject<RB_Logistics_Delivery_Extend>(RequestParm.msg.ToString());
query.TenantId = UserInfo.TenantId;
query.MallBaseId = parms.MallBaseId;
if (query == null)
{
return ApiResult.Failed("请传入物流规则信息");
}
else
{
if (string.IsNullOrWhiteSpace(query.Name))
{
return ApiResult.Failed("请输入收件人姓名");
}
if (string.IsNullOrWhiteSpace(query.Mobile))
{
return ApiResult.Failed("请输入联系方式");
}
if (query.ProvinceId == 0)
{
return ApiResult.Failed("请选择省");
}
if (query.CityId == 0)
{
return ApiResult.Failed("请选择市");
}
if (query.DistrictId == 0)
{
return ApiResult.Failed("请选择区");
}
if (string.IsNullOrWhiteSpace(query.Address))
{
return ApiResult.Failed("请输入详细地址");
}
if (query.ID == 0)
{
query.CreateDate = System.DateTime.Now;
}
query.UpdateDate = System.DateTime.Now;
bool result = mallBaseModule.AddOrUpdateDelivery(query);
if (result)
{
return ApiResult.Success("退货地址保存成功");
}
else
{
return ApiResult.Failed("退货地址保存失败");
}
}
}
/// <summary>
/// 删除退货地址
/// </summary>
/// <returns></returns>
public ApiResult DelDelivery()
{
var parms = RequestParm;
var query = JsonConvert.DeserializeObject<RB_Logistics_Delivery_Extend>(RequestParm.msg.ToString());
if (query.ID <= 0)
{
return ApiResult.Failed("请传递参数");
}
query.TenantId = UserInfo.TenantId;
query.MallBaseId = parms.MallBaseId;
bool flag = mallBaseModule.DelDelivery(query);
if (flag)
{
return ApiResult.Success();
}
else
{
return ApiResult.Failed();
}
}
#endregion
#region 区域购买
public ApiResult GetAreaBuyInfo()
{
var parms = RequestParm;
var query = new RB_Logistics_Rules_Extend();
query.TenantId = UserInfo.TenantId;
query.MallBaseId = parms.MallBaseId;
query.RulesType = Common.Enum.MallBase.RulesTypeEnum.OpenMinPrice;
var model = mallBaseModule.GetPinkageModel(query);
return ApiResult.Success("获取成功", model);
}
/// <summary>
/// 保存区域购买
/// </summary>
/// <returns></returns>
public ApiResult AddOrUpdateAreaBuy()
{
var parms = RequestParm;
var query = JsonConvert.DeserializeObject<RB_Logistics_Rules_Extend>(RequestParm.msg.ToString());
query.TenantId = UserInfo.TenantId;
query.MallBaseId = parms.MallBaseId;
query.RulesType = Common.Enum.MallBase.RulesTypeEnum.AreaBuy;
if (query == null)
{
return ApiResult.Failed("请传入区域规则信息");
}
else
{
if (query.IsOpenAllRegionPrice == 0)
{
if (query.List == null || !query.List.Any())
{
return ApiResult.Failed("请选择地区");
}
}
if (query.ID == 0)
{
query.CreateDate = System.DateTime.Now;
}
query.UpdateDate = System.DateTime.Now;
bool result = mallBaseModule.AddOrUpdatePinkage(query);
if (result)
{
return ApiResult.Success("区域购买信息保存成功");
}
else
{
return ApiResult.Failed("区域购买信息保存失败");
}
}
}
#endregion
#region 获取快递公司信息
public ApiResult GetExpressInfo()
{
var parms = RequestParm;
var query = new RB_Logistics_Express();
query.TenantId = UserInfo.TenantId;
query.MallBaseId = parms.MallBaseId;
var list = mallBaseModule.GetLogisticsExpressList(query);
var result = list.Select(x => new
{
x.ID,
x.Name,
x.ExpressCode
});
return ApiResult.Success("获取成功", result);
}
#endregion
#region 电子面单
/// <summary>
/// 获取电子面单分页
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetElectronicSheetPage()
{
var parms = RequestParm;
ResultPageModel pagelist = JsonConvert.DeserializeObject<ResultPageModel>(RequestParm.msg.ToString());
RB_ElectronicSheet_Extend demodel = JsonConvert.DeserializeObject<RB_ElectronicSheet_Extend>(RequestParm.msg.ToString());
demodel.TenantId = UserInfo.TenantId;
demodel.MallBaseId = parms.MallBaseId;
var list = mallBaseModule.GetElectronicSheetPage(pagelist.pageIndex, pagelist.pageSize, out long count, demodel);
pagelist.count = Convert.ToInt32(count);
pagelist.pageData = list.Select(x => new
{
x.ID,
x.Name,
x.Mobile,
Address = x.ProvinceName + x.CityName + x.DistrictName + x.Address,
x.IsDefault,
x.ExpressName,
x.WebDot,
x.WebCode
});
return ApiResult.Success("", pagelist);
}
/// <summary>
/// 获取电子面单详情
/// </summary>
/// <returns></returns>
public ApiResult GetElectronicSheet()
{
var parms = RequestParm;
var query = JsonConvert.DeserializeObject<RB_ElectronicSheet_Extend>(RequestParm.msg.ToString());
query.TenantId = UserInfo.TenantId;
query.MallBaseId = parms.MallBaseId;
var oldLogisticsModel = mallBaseModule.GetElectronicSheetList(query).FirstOrDefault();
if (oldLogisticsModel == null)
{
oldLogisticsModel = new RB_ElectronicSheet_Extend();
}
return ApiResult.Success("", oldLogisticsModel);
}
/// <summary>
/// 设置默认电子面单
/// </summary>
/// <returns></returns>
public ApiResult SetLogisticsElectronicSheet()
{
var parms = RequestParm;
var query = JsonConvert.DeserializeObject<RB_ElectronicSheet_Extend>(RequestParm.msg.ToString());
query.TenantId = UserInfo.TenantId;
query.MallBaseId = parms.MallBaseId;
bool result = mallBaseModule.SetDefaultElectronicSheet(query);
if (result)
{
return ApiResult.Success("默认电子面单设置成功");
}
else
{
return ApiResult.Failed("默认电子面单设置失败");
}
}
/// <summary>
/// 保存电子面单
/// </summary>
/// <returns></returns>
public ApiResult AddOrUpdateElectronicSheet()
{
var parms = RequestParm;
var query = JsonConvert.DeserializeObject<RB_ElectronicSheet_Extend>(RequestParm.msg.ToString());
query.TenantId = UserInfo.TenantId;
query.MallBaseId = parms.MallBaseId;
if (query == null)
{
return ApiResult.Failed("请传入电子面单信息");
}
else
{
if (string.IsNullOrWhiteSpace(query.Name))
{
return ApiResult.Failed("请输入发件人名称");
}
if (string.IsNullOrWhiteSpace(query.Mobile))
{
return ApiResult.Failed("请输入发件人电话");
}
if (query.ExpressId == 0)
{
return ApiResult.Failed("请选择快递公司");
}
if (query.ProvinceId == 0)
{
return ApiResult.Failed("请选择省");
}
if (query.CityId == 0)
{
return ApiResult.Failed("请选择市");
}
if (query.DistrictId == 0)
{
return ApiResult.Failed("请选择区");
}
if (string.IsNullOrWhiteSpace(query.Address))
{
return ApiResult.Failed("请输入发件人详细地址");
}
if (query.ID == 0)
{
query.CreateDate = System.DateTime.Now;
}
query.UpdateDate = System.DateTime.Now;
bool result = mallBaseModule.AddOrUpdateElectronicSheet(query);
if (result)
{
return ApiResult.Success("电子面单保存成功");
}
else
{
return ApiResult.Failed("电子面单保存失败");
}
}
}
/// <summary>
/// 删除退货地址
/// </summary>
/// <returns></returns>
public ApiResult DelElectronicSheet()
{
var parms = RequestParm;
var query = JsonConvert.DeserializeObject<RB_ElectronicSheet_Extend>(RequestParm.msg.ToString());
if (query.ID <= 0)
{
return ApiResult.Failed("请传递参数");
}
query.TenantId = UserInfo.TenantId;
query.MallBaseId = parms.MallBaseId;
bool flag = mallBaseModule.DelElectronicSheet(query);
if (flag)
{
return ApiResult.Success();
}
else
{
return ApiResult.Failed();
}
}
#endregion
} }
} }
\ No newline at end of file
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