Commit ef8d182d authored by 吴春's avatar 吴春

提交代码,制单新增部门字段

parent 1907d9c5
......@@ -4551,6 +4551,7 @@ namespace Mall.Module.Product
{ nameof(RB_Goods.IsQuickBuy),model.IsQuickBuy==1?2:1}
};
}
else
{
return false;
......@@ -4595,7 +4596,7 @@ namespace Mall.Module.Product
/// <param name="tenantId"></param>
/// <param name="mallBaseId"></param>
/// <returns></returns>
public bool SetProductGoodsQuickUpdate(string goodsIds, int type, int sort, string goodsName, int freightId, int limitBuyGoodsNum, int limitBuyOrderNum, int integralPresent, int integralPresentType, decimal pointsDeduction, int pointsDeductionType, int isMultipleDeduction, int isQuickBuy, int isGoodsNegotiable, int tenantId, int mallBaseId)
public bool SetProductGoodsQuickUpdate(string goodsIds, int type, int sort, string goodsName, int freightId, int limitBuyGoodsNum, int limitBuyOrderNum, int integralPresent, int integralPresentType, decimal pointsDeduction, int pointsDeductionType, int isMultipleDeduction, int isQuickBuy, int isGoodsNegotiable,int SupplierId, int tenantId, int mallBaseId)
{
Dictionary<string, object> keyValues;
if (type == 1)
......@@ -4674,6 +4675,12 @@ namespace Mall.Module.Product
{ nameof(RB_Goods.IsGoodsNegotiable),isGoodsNegotiable}
};
}//面议
else if (type == 12)
{
keyValues = new Dictionary<string, object>() {
{ nameof(RB_Goods.SupplierId),SupplierId}
};
}//面议
else
{
return false;
......@@ -5623,5 +5630,6 @@ namespace Mall.Module.Product
#endregion
}
}
......@@ -1757,7 +1757,7 @@ namespace Mall.Module.User
string wenXinResult = string.Empty;
if (!string.IsNullOrWhiteSpace(token))
{
string Url = " http://api.weixin.qq.com/wxa/business/getliveinfo?access_token=" + token;
string Url = " https://api.weixin.qq.com/wxa/business/getliveinfo?access_token=" + token;
var postdata = new
{
start = 0,
......
......@@ -2105,9 +2105,11 @@ namespace Mall.Module.User
if (!string.IsNullOrEmpty(remodel.ReOrderNos) && !string.IsNullOrEmpty(remodel.ReOrderIds))
{
List<int> OrderIdList = JsonConvert.DeserializeObject<List<int>>(remodel.ReOrderIds);
if (OrderIdList.Any()) {
if (OrderIdList.Any())
{
var oclist = goods_OrderCommissionRepository.GetUserCommissionRemitedList(remodel.UserId ?? 0, string.Join(",", OrderIdList));
foreach (var qitem in oclist) {
foreach (var qitem in oclist)
{
Dictionary<string, object> keyValues2 = new Dictionary<string, object>() {
{ nameof(RB_Goods_OrderCommission_Extend.IsRemit),0}
};
......@@ -2560,6 +2562,20 @@ namespace Mall.Module.User
return member_ShippingAddressRepository.Update(keyValues, wheres);
}
#region 地址
/// <summary>
/// 根据地区名称获取地区列表
/// </summary>
/// <param name="where"></param>
/// <returns></returns>
public List<Model.Extend.BaseSetUp.RB_Destination_Extend> GetDestinationListByNames(string[] where)
{
return destinationRepository.GetListByNames(where);
}
#endregion
#endregion
#region 收藏商品
......@@ -3214,7 +3230,8 @@ namespace Mall.Module.User
#region 写入提现订单
if (demodel.TenantId == 1) {
if (demodel.TenantId == 1)
{
//所有未提现的 返佣
var clist = goods_OrderCommissionRepository.GetUserCommissionRemit(demodel.UserId ?? 0);
if (clist.Any())
......
......@@ -699,12 +699,11 @@ LEFT JOIN rb_member_user as c on b.UserId=c.Id
// payMemerNumWhere += $@" and {nameof(RB_Goods_Order.OrderSource)}={(int)dmodel.PlatformType}";
//}
if (dmodel.OrderStatus > 0)
{
if (dmodel.OrderStatus == 1)
if (dmodel.OrderStatus == 1 || dmodel.OrderStatus == 0)
{
where += $@" and a.{nameof(RB_Goods_Order.OrderStatus)} in (1,2,4,3,6)";
payMemerNumWhere += $@" and {nameof(RB_Goods_Order.OrderStatus)} in (1,2,4,3,6)";
where += $@" and a.{nameof(RB_Goods_Order.OrderStatus)} in (2,4,3,5,6)";
payMemerNumWhere += $@" and {nameof(RB_Goods_Order.OrderStatus)} in (2,4,5,3,6)";
}
else if (dmodel.OrderStatus == 2)
{
......@@ -722,18 +721,21 @@ LEFT JOIN rb_member_user as c on b.UserId=c.Id
}
else if (dmodel.OrderStatus == 5)//后面做因为现在还没有售后表
{
}
where += $@" and a.{nameof(RB_Goods_OrderAfterSale.ReOrderStatus)} =5";
}
if (!string.IsNullOrWhiteSpace(dmodel.StartDate))
{
where += $" AND DATE_FORMAT(a.{nameof(RB_Goods_Order.CreateDate)},'%Y-%m-%d' )>= DATE_FORMAT('{dmodel.StartDate}','%Y-%m-%d' )";
payMemerNumWhere += $" AND DATE_FORMAT({nameof(RB_Goods_Order.CreateDate)},'%Y-%m-%d' )>= DATE_FORMAT('{dmodel.StartDate}','%Y-%m-%d' )";
// payMemerNumWhere += $" AND DATE_FORMAT({nameof(RB_Goods_Order.CreateDate)},'%Y-%m-%d' )>= DATE_FORMAT('{dmodel.StartDate}','%Y-%m-%d' )";
payMemerNumWhere += $" AND DATE_FORMAT(a.{nameof(RB_Goods_OrderAfterSale.CreateDate)},'%Y-%m-%d' )>= DATE_FORMAT('{dmodel.StartDate}','%Y-%m-%d' )";
}
if (!string.IsNullOrWhiteSpace(dmodel.EndDate))
{
where += $" AND DATE_FORMAT(a.{nameof(RB_Goods_Order.CreateDate)},'%Y-%m-%d' )<= DATE_FORMAT('{dmodel.EndDate}','%Y-%m-%d' )";
payMemerNumWhere += $" AND DATE_FORMAT({nameof(RB_Goods_Order.CreateDate)},'%Y-%m-%d' )<= DATE_FORMAT('{dmodel.EndDate}','%Y-%m-%d' )";
payMemerNumWhere += $" AND DATE_FORMAT(a.{nameof(RB_Goods_OrderAfterSale.CreateDate)},'%Y-%m-%d' )<= DATE_FORMAT('{dmodel.EndDate}','%Y-%m-%d' )";
// payMemerNumWhere += $" AND DATE_FORMAT({nameof(RB_Goods_Order.CreateDate)},'%Y-%m-%d' )<= DATE_FORMAT('{dmodel.EndDate}','%Y-%m-%d' )";
}
// string sql = $@"SELECT t.CreateDate,SUM(t.GoodsNum)as GoodsNum ,COUNT(t.OrderId)as OrderNum ,SUM(t.Income)as PayMoney,
......@@ -751,15 +753,7 @@ LEFT JOIN (SELECT COUNT(DISTINCT UserId) as PayMemerNum, DATE_FORMAT(CreateDate,
as c on c.CreateDate=DATE_FORMAT(a.CreateDate,'%Y-%m-%d' ) {where} )
as t GROUP BY t.CreateDate desc";
}
else if (dmodel.OrderStatus == 4)
{
sql = $@"SELECT t.CreateDate,SUM(t.ReNumber)as GoodsNum ,COUNT(t.ReOrderId)as OrderNum ,SUM(t.Income)as PayMoney,MAX(t.PayMemerNum) as PayMemerNum
from (SELECT DATE_FORMAT(a.CreateDate,'%Y-%m-%d' )as CreateDate,a.ReNumber,a.Refund as Income,c.PayMemerNum,a.ReOrderId from RB_Goods_OrderAfterSale as a
LEFT JOIN (SELECT COUNT(DISTINCT UserId) as PayMemerNum, DATE_FORMAT(CreateDate,'%Y-%m-%d' ) as CreateDate from RB_Goods_OrderAfterSale where {payMemerNumWhere} GROUP BY DATE_FORMAT(CreateDate,'%Y-%m-%d' ))
as c on c.CreateDate=DATE_FORMAT(a.CreateDate,'%Y-%m-%d' ) {where} )
as t GROUP BY t.CreateDate desc";
}
else if (dmodel.OrderStatus == 4)
else
{
sql = $@"SELECT t.CreateDate,SUM(t.ReNumber)as GoodsNum ,COUNT(t.ReOrderId)as OrderNum ,SUM(t.Income)as PayMoney,MAX(t.PayMemerNum) as PayMemerNum
from (SELECT DATE_FORMAT(a.CreateDate,'%Y-%m-%d' )as CreateDate,a.ReNumber,a.Refund as Income,c.PayMemerNum,a.ReOrderId from RB_Goods_OrderAfterSale as a
......@@ -767,14 +761,22 @@ LEFT JOIN (SELECT COUNT(DISTINCT UserId) as PayMemerNum, DATE_FORMAT(CreateDate,
as c on c.CreateDate=DATE_FORMAT(a.CreateDate,'%Y-%m-%d' ) {where} )
as t GROUP BY t.CreateDate desc";
}
else if (dmodel.OrderStatus == 5)
{
sql = $@"SELECT t.CreateDate,SUM(t.ReNumber)as GoodsNum ,COUNT(t.ReOrderId)as OrderNum ,SUM(t.Income)as PayMoney,MAX(t.PayMemerNum) as PayMemerNum
from (SELECT DATE_FORMAT(a.CreateDate,'%Y-%m-%d' )as CreateDate,a.ReNumber,a.RefundActual as Income,c.PayMemerNum,a.ReOrderId from RB_Goods_OrderAfterSale as a
LEFT JOIN (SELECT COUNT(DISTINCT UserId) as PayMemerNum, DATE_FORMAT(CreateDate,'%Y-%m-%d' ) as CreateDate from RB_Goods_OrderAfterSale where {payMemerNumWhere} GROUP BY DATE_FORMAT(CreateDate,'%Y-%m-%d' ))
as c on c.CreateDate=DATE_FORMAT(a.CreateDate,'%Y-%m-%d' ) {where} )
as t GROUP BY t.CreateDate desc";
}
// else if (dmodel.OrderStatus == 4)
// {
// sql = $@"SELECT t.CreateDate,SUM(t.ReNumber)as GoodsNum ,COUNT(t.ReOrderId)as OrderNum ,SUM(t.Income)as PayMoney,MAX(t.PayMemerNum) as PayMemerNum
//from (SELECT DATE_FORMAT(a.CreateDate,'%Y-%m-%d' )as CreateDate,a.ReNumber,a.Refund as Income,c.PayMemerNum,a.ReOrderId from RB_Goods_OrderAfterSale as a
//LEFT JOIN (SELECT COUNT(DISTINCT UserId) as PayMemerNum, DATE_FORMAT(CreateDate,'%Y-%m-%d' ) as CreateDate from RB_Goods_OrderAfterSale where {payMemerNumWhere} GROUP BY DATE_FORMAT(CreateDate,'%Y-%m-%d' ))
//as c on c.CreateDate=DATE_FORMAT(a.CreateDate,'%Y-%m-%d' ) {where} )
//as t GROUP BY t.CreateDate desc";
// }
// else if (dmodel.OrderStatus == 5)
// {
// sql = $@"SELECT t.CreateDate,SUM(t.ReNumber)as GoodsNum ,COUNT(t.ReOrderId)as OrderNum ,SUM(t.Income)as PayMoney,MAX(t.PayMemerNum) as PayMemerNum
//from (SELECT DATE_FORMAT(a.CreateDate,'%Y-%m-%d' )as CreateDate,a.ReNumber,a.RefundActual as Income,c.PayMemerNum,a.ReOrderId from RB_Goods_OrderAfterSale as a
//LEFT JOIN (SELECT COUNT(DISTINCT UserId) as PayMemerNum, DATE_FORMAT(CreateDate,'%Y-%m-%d' ) as CreateDate from RB_Goods_OrderAfterSale where {payMemerNumWhere} GROUP BY DATE_FORMAT(CreateDate,'%Y-%m-%d' ))
//as c on c.CreateDate=DATE_FORMAT(a.CreateDate,'%Y-%m-%d' ) {where} )
//as t GROUP BY t.CreateDate desc";
// }
return GetPage<DataStatistics_Query>(pageIndex, pageSize, out count, sql).ToList();
}
......@@ -788,7 +790,7 @@ as t GROUP BY t.CreateDate desc";
/// <param name="dmodel"></param>
/// <returns></returns>
public List<DataStatistics_Query> GetSellExcel(DataStatistics_Query dmodel)
{
{
string where = $" where 1=1 ";
string payMemerNumWhere = "";
string orderTypeWhere = "";
......@@ -855,12 +857,12 @@ from (SELECT DATE_FORMAT(a.CreateDate,'%Y-%m-%d' )as CreateDate,b.GoodsNum,a.Use
LEFT JOIN (SELECT OrderId,SUM(Number)as GoodsNum from rb_goods_orderdetail where 1=1 {orderTypeWhere} GROUP BY OrderId)as b on a.OrderId=b.OrderId {where})
as t GROUP BY t.CreateDate desc";
return Get<DataStatistics_Query>(sql).ToList();
}
#endregion
}
#endregion
#region 损益核算表
public List<OrderStatistics_Query> GetOrderProfitLossList(int pageIndex, int pageSize, out long count, OrderStatistics_Query dmodel)
{
#region 损益核算表
public List<OrderStatistics_Query> GetOrderProfitLossList(int pageIndex, int pageSize, out long count, OrderStatistics_Query dmodel)
{
string where = "where 1=1 and a.OrderStatus in(2,3,4,5,6) ";
if (dmodel != null)
......@@ -905,12 +907,12 @@ LEFT JOIN (SELECT SUM(goc.Commission) as TwoCommission,goc.OrderDetailId,goc.Use
LEFT JOIN (SELECT SUM(Commission) as ALLCommission,OrderDetailId from rb_goods_ordercommission GROUP BY OrderId ) as e on b.Id=e.OrderDetailId {where}
GROUP BY b.GoodsId,b.SupplierId,b.OrderId ";
return GetPage<OrderStatistics_Query>(pageIndex, pageSize, out count, sql).ToList();
}
}
public List<OrderStatistics_Query> GetAllOrderProfitLossList( OrderStatistics_Query dmodel)
{
public List<OrderStatistics_Query> GetAllOrderProfitLossList(OrderStatistics_Query dmodel)
{
string where = "where 1=1 and a.OrderStatus in(2,3,4,5,6) ";
if (dmodel != null)
......@@ -967,37 +969,37 @@ GROUP BY b.GoodsId,b.SupplierId,b.OrderId ";
//LEFT JOIN (SELECT SUM(Commission) as TwoCommission,OrderId from rb_goods_ordercommission where Grade=2 and CommissionState=2 GROUP BY OrderId ) as d on a.OrderId=d.OrderId
//LEFT JOIN (SELECT SUM(Commission) as ALLCommission,OrderId from rb_goods_ordercommission GROUP BY OrderId ) as e on a.OrderId=e.OrderId {where}
//GROUP BY b.GoodsId,b.SupplierId,b.OrderId ";
return Get<OrderStatistics_Query>( sql).ToList();
}
return Get<OrderStatistics_Query>(sql).ToList();
}
/// <summary>
/// 获取用户 订单下的商品数量
/// </summary>
/// <param name="userId"></param>
/// <param name="limitGoodsIds"></param>
/// <returns></returns>
public List<RB_Goods_Order_Extend> GetUserOrderGoodsNum(int userId, string limitGoodsIds, int tenantId, int mallBaseId)
{
/// <summary>
/// 获取用户 订单下的商品数量
/// </summary>
/// <param name="userId"></param>
/// <param name="limitGoodsIds"></param>
/// <returns></returns>
public List<RB_Goods_Order_Extend> GetUserOrderGoodsNum(int userId, string limitGoodsIds, int tenantId, int mallBaseId)
{
string sql = $@"SELECT od.GoodsId,SUM(od.Number) as GoodsTotalNum FROM rb_goods_orderdetail od
INNER JOIN rb_goods_order o on od.OrderId=o.OrderId
WHERE od.TenantId={tenantId} and od.MallBaseId={mallBaseId} and o.`Status`=0 and o.OrderStatus in (1,2,3,4,5,6) and o.Recycled=2 AND o.UserId={userId} and od.GoodsId in ({limitGoodsIds})
GROUP BY od.GoodsId";
return Get<RB_Goods_Order_Extend>(sql).ToList();
}
}
/// <summary>
/// 获取用户 商品订单得数量
/// </summary>
/// <param name="userId"></param>
/// <param name="limitGoodsIds"></param>
/// <param name="tenantId"></param>
/// <param name="mallBaseId"></param>
/// <returns></returns>
public List<RB_Goods_Order_Extend> GetUserOrderNum(int userId, string limitGoodsIds, int tenantId, int mallBaseId)
{
/// <summary>
/// 获取用户 商品订单得数量
/// </summary>
/// <param name="userId"></param>
/// <param name="limitGoodsIds"></param>
/// <param name="tenantId"></param>
/// <param name="mallBaseId"></param>
/// <returns></returns>
public List<RB_Goods_Order_Extend> GetUserOrderNum(int userId, string limitGoodsIds, int tenantId, int mallBaseId)
{
string sql = $@"SELECT t.GoodsId,COUNT(0) as OrderNum FROM(
SELECT od.GoodsId,o.* FROM rb_goods_orderdetail od
INNER JOIN rb_goods_order o on od.OrderId=o.OrderId
......@@ -1006,36 +1008,36 @@ GROUP BY od.GoodsId,o.OrderId
)t GROUP BY t.GoodsId";
return Get<RB_Goods_Order_Extend>(sql).ToList();
}
#endregion
}
#endregion
#region
#region
/// <summary>
/// 获取超时取消的订单列表
/// </summary>
/// <param name="cancelTime"></param>
/// <param name="t"></param>
/// <param name="m"></param>
/// <returns></returns>
public List<RB_Goods_Order_Extend> GetCanCancelOrderList(int cancelTime, int t, int m)
{
/// <summary>
/// 获取超时取消的订单列表
/// </summary>
/// <param name="cancelTime"></param>
/// <param name="t"></param>
/// <param name="m"></param>
/// <returns></returns>
public List<RB_Goods_Order_Extend> GetCanCancelOrderList(int cancelTime, int t, int m)
{
string sql = $@"SELECT OrderId,UserId,OrderNo,OrderSource,CouponsIds FROM rb_goods_order where TenantId ={t} and MallBaseId ={m} and `Status`=0 and OrderStatus =1 and DATE_ADD(CreateDate,INTERVAL {cancelTime} MINUTE) < '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}'";
return Get<RB_Goods_Order_Extend>(sql).ToList();
}
}
/// <summary>
/// 获取可自动收货的订单列表
/// </summary>
/// <param name="day"></param>
/// <param name="t"></param>
/// <param name="m"></param>
/// <returns></returns>
public List<RB_Goods_Order_Extend> GetCanReceivingOrderList(int day, int t, int m)
{
/// <summary>
/// 获取可自动收货的订单列表
/// </summary>
/// <param name="day"></param>
/// <param name="t"></param>
/// <param name="m"></param>
/// <returns></returns>
public List<RB_Goods_Order_Extend> GetCanReceivingOrderList(int day, int t, int m)
{
string sql = $@"SELECT OrderId,UserId,OrderNo,OrderSource,CouponsIds FROM rb_goods_order where TenantId ={t} and MallBaseId ={m} and `Status`=0 and OrderStatus =3 and DATE_ADD(DeliveryTime,INTERVAL {day} DAY) < '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}'";
return Get<RB_Goods_Order_Extend>(sql).ToList();
}
}
#endregion
}
}
......@@ -65,7 +65,6 @@ namespace Mall.WebApi.Controllers.MallBase
}
public static List<RB_Destination_Extend> GetData(List<RB_Destination_Extend> nodeList)
{
List<RB_Destination_Extend> nodes = nodeList.Where(x => x.ParentID == 2).ToList();
......
......@@ -66,7 +66,8 @@ namespace Mall.WebApi.Controllers.MallBase
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetMaterialInfo() {
public ApiResult SetMaterialInfo()
{
var parms = RequestParm;
RB_Material_Info_Extend demodel = JsonConvert.DeserializeObject<RB_Material_Info_Extend>(parms.msg.ToString());
if (string.IsNullOrEmpty(demodel.Name))
......@@ -77,10 +78,12 @@ namespace Mall.WebApi.Controllers.MallBase
{
return ApiResult.ParamIsNull("请传递类型");
}
if ((demodel.GroupId ?? 0) < 0) {
if ((demodel.GroupId ?? 0) < 0)
{
return ApiResult.ParamIsNull("请输入分组");
}
if (string.IsNullOrEmpty(demodel.Path)) {
if (string.IsNullOrEmpty(demodel.Path))
{
return ApiResult.ParamIsNull("请传递文件路径");
}
......@@ -134,13 +137,16 @@ namespace Mall.WebApi.Controllers.MallBase
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetMaterialGroupInfo() {
public ApiResult SetMaterialGroupInfo()
{
var parms = RequestParm;
RB_Material_Group_Extend demodel = JsonConvert.DeserializeObject<RB_Material_Group_Extend>(parms.msg.ToString());
if (string.IsNullOrEmpty(demodel.Name)) {
if (string.IsNullOrEmpty(demodel.Name))
{
return ApiResult.ParamIsNull("请输入分组名称");
}
if (demodel.Type != 1 && demodel.Type != 2) {
if (demodel.Type != 1 && demodel.Type != 2)
{
return ApiResult.ParamIsNull("请传递类型");
}
......@@ -155,7 +161,8 @@ namespace Mall.WebApi.Controllers.MallBase
{
return ApiResult.Success();
}
else {
else
{
return ApiResult.Failed();
}
}
......@@ -165,11 +172,13 @@ namespace Mall.WebApi.Controllers.MallBase
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetMaterialGroupRecycled() {
public ApiResult SetMaterialGroupRecycled()
{
var requestParm = RequestParm;
var parms = JObject.Parse(requestParm.msg.ToString());
int GroupId = parms.GetInt("GroupId", 0);
if (GroupId < 0) {
if (GroupId < 0)
{
return ApiResult.ParamIsNull("请传递分组id");
}
......@@ -178,7 +187,8 @@ namespace Mall.WebApi.Controllers.MallBase
{
return ApiResult.Success();
}
else {
else
{
return ApiResult.Failed();
}
}
......@@ -393,7 +403,8 @@ namespace Mall.WebApi.Controllers.MallBase
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetProductCategoryTreeList() {
public ApiResult GetProductCategoryTreeList()
{
var parms = RequestParm;
RB_Product_Category_Extend demodel = JsonConvert.DeserializeObject<RB_Product_Category_Extend>(parms.msg.ToString());
......@@ -409,11 +420,13 @@ namespace Mall.WebApi.Controllers.MallBase
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetProductCategoryInfo() {
public ApiResult GetProductCategoryInfo()
{
var req = RequestParm;
JObject parms = JObject.Parse(req.msg.ToString());
int CategoryId = parms.GetInt("CategoryId", 0);
if (CategoryId <= 0) {
if (CategoryId <= 0)
{
return ApiResult.ParamIsNull();
}
......@@ -448,24 +461,30 @@ namespace Mall.WebApi.Controllers.MallBase
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetProductCategoryInfo() {
public ApiResult SetProductCategoryInfo()
{
var req = RequestParm;
RB_Product_Category_Extend demodel = JsonConvert.DeserializeObject<RB_Product_Category_Extend>(req.msg.ToString());
if ((demodel.Tier ?? 0) <= 0) {
if ((demodel.Tier ?? 0) <= 0)
{
return ApiResult.ParamIsNull("请选择层级");
}
if (string.IsNullOrEmpty(demodel.Name)) {
if (string.IsNullOrEmpty(demodel.Name))
{
return ApiResult.ParamIsNull("请输入分类名称");
}
if (!demodel.Sort.HasValue) {
if (!demodel.Sort.HasValue)
{
return ApiResult.ParamIsNull("请输入排序");
}
if (demodel.Tier == 1)
{
demodel.ParentId = 0;
}
else if (demodel.Tier > 1) {
if ((demodel.ParentId ?? 0) <= 0) {
else if (demodel.Tier > 1)
{
if ((demodel.ParentId ?? 0) <= 0)
{
return ApiResult.ParamIsNull("请选择上级");
}
}
......@@ -482,12 +501,13 @@ namespace Mall.WebApi.Controllers.MallBase
demodel.IsForeignShare ??= 2;
demodel.CreateDate = DateTime.Now;
demodel.UpdateDate = DateTime.Now;
bool flag= productModule.SetProductCategoryInfo(demodel);
bool flag = productModule.SetProductCategoryInfo(demodel);
if (flag)
{
return ApiResult.Success();
}
else {
else
{
return ApiResult.Failed();
}
......@@ -498,7 +518,8 @@ namespace Mall.WebApi.Controllers.MallBase
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult DelProductCategoryInfo() {
public ApiResult DelProductCategoryInfo()
{
var req = RequestParm;
JObject parms = JObject.Parse(req.msg.ToString());
int CategoryId = parms.GetInt("CategoryId", 0);
......@@ -523,30 +544,37 @@ namespace Mall.WebApi.Controllers.MallBase
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetProductCategoryTransfer() {
public ApiResult SetProductCategoryTransfer()
{
var req = RequestParm;
JObject parms = JObject.Parse(req.msg.ToString());
int CategoryId = parms.GetInt("CategoryId", 0);
int ParentId = parms.GetInt("ParentId", 0);
if (CategoryId <= 0) {
if (CategoryId <= 0)
{
return ApiResult.ParamIsNull("请选择需转移分类id");
}
if (ParentId < 0) {
if (ParentId < 0)
{
return ApiResult.ParamIsNull("请选择转入分类id");
}
if (CategoryId == ParentId) {
if (CategoryId == ParentId)
{
return ApiResult.ParamIsNull("不能转入同一分类下");
}
var list = productModule.GetProductCategoryForALLChlid(CategoryId, Convert.ToInt32(req.uid), req.MallBaseId);
if (list.Where(x => x.Id == ParentId).Any()) {
if (list.Where(x => x.Id == ParentId).Any())
{
return ApiResult.ParamIsNull("不能转入当前分类的子集分类");
}
var model = list.Where(x => x.Id == CategoryId).FirstOrDefault();
if (model == null) {
if (model == null)
{
return ApiResult.ParamIsNull("分类不存在,请核实后再试");
}
if (model.ParentId == ParentId) {
if (model.ParentId == ParentId)
{
return ApiResult.ParamIsNull("已在当前分类下,未转移");
}
......@@ -555,7 +583,8 @@ namespace Mall.WebApi.Controllers.MallBase
{
return ApiResult.Success();
}
else {
else
{
return ApiResult.Failed();
}
}
......@@ -565,10 +594,12 @@ namespace Mall.WebApi.Controllers.MallBase
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetProductCategorySort() {
public ApiResult SetProductCategorySort()
{
var req = RequestParm;
List<RB_Product_CategorySort> delist = JsonConvert.DeserializeObject<List<RB_Product_CategorySort>>(req.msg.ToString());
if (delist == null || !delist.Any()) {
if (delist == null || !delist.Any())
{
return ApiResult.ParamIsNull();
}
......@@ -588,7 +619,8 @@ namespace Mall.WebApi.Controllers.MallBase
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetProductCategoryStyleInfo() {
public ApiResult GetProductCategoryStyleInfo()
{
var parms = RequestParm;
var model = productModule.GetProductCategoryStyleInfo(parms.TenantId, parms.MallBaseId);
......@@ -608,7 +640,8 @@ namespace Mall.WebApi.Controllers.MallBase
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetProductCategoryStyleInfo() {
public ApiResult SetProductCategoryStyleInfo()
{
var req = RequestParm;
RB_Product_CategoryStyle_Extend demodel = JsonConvert.DeserializeObject<RB_Product_CategoryStyle_Extend>(req.msg.ToString());
......@@ -684,13 +717,16 @@ namespace Mall.WebApi.Controllers.MallBase
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetProductSpecificationInfo() {
public ApiResult SetProductSpecificationInfo()
{
var req = RequestParm;
RB_Product_Specification_Extend demodel = JsonConvert.DeserializeObject<RB_Product_Specification_Extend>(req.msg.ToString());
if (string.IsNullOrEmpty(demodel.Name)) {
if (string.IsNullOrEmpty(demodel.Name))
{
return ApiResult.ParamIsNull("请输入规格名");
}
if (demodel.SpecList == null || !demodel.SpecList.Any()) {
if (demodel.SpecList == null || !demodel.SpecList.Any())
{
return ApiResult.ParamIsNull("请输入规格值");
}
demodel.Content = JsonConvert.SerializeObject(demodel.SpecList);
......@@ -704,7 +740,8 @@ namespace Mall.WebApi.Controllers.MallBase
{
return ApiResult.Success();
}
else {
else
{
return ApiResult.Failed();
}
}
......@@ -714,11 +751,13 @@ namespace Mall.WebApi.Controllers.MallBase
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult DelProductSpecificationInfo() {
public ApiResult DelProductSpecificationInfo()
{
var req = RequestParm;
JObject parms = JObject.Parse(req.msg.ToString());
int SpecificationId = parms.GetInt("SpecificationId", 0);
if (SpecificationId <= 0) {
if (SpecificationId <= 0)
{
return ApiResult.ParamIsNull();
}
......@@ -727,7 +766,8 @@ namespace Mall.WebApi.Controllers.MallBase
{
return ApiResult.Success();
}
else {
else
{
return ApiResult.Failed();
}
}
......@@ -800,7 +840,7 @@ namespace Mall.WebApi.Controllers.MallBase
{
var req = RequestParm;
RB_Product_QuickBuy_Extend demodel = JsonConvert.DeserializeObject<RB_Product_QuickBuy_Extend>(req.msg.ToString());
if ((demodel.CategoryId??0)<=0)
if ((demodel.CategoryId ?? 0) <= 0)
{
return ApiResult.ParamIsNull("请选择分类");
}
......@@ -808,7 +848,8 @@ namespace Mall.WebApi.Controllers.MallBase
{
return ApiResult.ParamIsNull("请输入排序");
}
if (productModule.ValidateQuickBuyCategory(demodel.Id, demodel.CategoryId, req.TenantId, req.MallBaseId)) {
if (productModule.ValidateQuickBuyCategory(demodel.Id, demodel.CategoryId, req.TenantId, req.MallBaseId))
{
return ApiResult.Failed("该分类已存在,无法再次添加");
}
......@@ -864,7 +905,8 @@ namespace Mall.WebApi.Controllers.MallBase
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetProductRecommendSetInfo() {
public ApiResult GetProductRecommendSetInfo()
{
var req = RequestParm;
var model = productModule.GetProductRecommendSetInfo(req.TenantId, req.MallBaseId);
return ApiResult.Success("", new
......@@ -888,18 +930,23 @@ namespace Mall.WebApi.Controllers.MallBase
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetProductRecommendSetInfo() {
public ApiResult SetProductRecommendSetInfo()
{
var req = RequestParm;
RB_Product_Recommend_Extend demodel = JsonConvert.DeserializeObject<RB_Product_Recommend_Extend>(req.msg.ToString());
if (demodel.IsOrderRecommend == 1) {
if (demodel.OrderProductList == null || !demodel.OrderProductList.Any()) {
if (demodel.IsOrderRecommend == 1)
{
if (demodel.OrderProductList == null || !demodel.OrderProductList.Any())
{
return ApiResult.ParamIsNull("请选择自定义推荐商品");
}
demodel.OrderProductIds = string.Join(",", demodel.OrderProductList.Select(x => x.Id).Distinct());
}
if (demodel.IsCommentRecommend == 1) {
if (demodel.CommentProductList == null || !demodel.CommentProductList.Any()) {
if (demodel.IsCommentRecommend == 1)
{
if (demodel.CommentProductList == null || !demodel.CommentProductList.Any())
{
return ApiResult.ParamIsNull("请选择自定义推荐商品");
}
demodel.CommentProductIds = string.Join(",", demodel.CommentProductList.Select(x => x.Id).Distinct());
......@@ -916,7 +963,8 @@ namespace Mall.WebApi.Controllers.MallBase
{
return ApiResult.Success();
}
else {
else
{
return ApiResult.Failed();
}
}
......@@ -982,16 +1030,19 @@ namespace Mall.WebApi.Controllers.MallBase
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetProductServiceInfo() {
public ApiResult GetProductServiceInfo()
{
var req = RequestParm;
JObject parms = JObject.Parse(req.msg.ToString());
int ServiceId = parms.GetInt("ServiceId", 0);
if (ServiceId <= 0) {
if (ServiceId <= 0)
{
return ApiResult.ParamIsNull();
}
var model = productModule.GetProductServiceInfo(ServiceId);
return ApiResult.Success("",new {
return ApiResult.Success("", new
{
model.Id,
model.Name,
model.Sort,
......@@ -1070,7 +1121,8 @@ namespace Mall.WebApi.Controllers.MallBase
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetProductGoodsPageList() {
public ApiResult GetProductGoodsPageList()
{
var parms = RequestParm;
ResultPageModel pagelist = JsonConvert.DeserializeObject<ResultPageModel>(parms.msg.ToString());
RB_Goods_Extend demodel = JsonConvert.DeserializeObject<RB_Goods_Extend>(parms.msg.ToString());
......@@ -1196,7 +1248,8 @@ namespace Mall.WebApi.Controllers.MallBase
x.GoodsNumbers
}));
}
else {
else
{
List<object> objList = new List<object>();
List<object> SpecificationValueList = new List<object>();
SpecificationValueList.Add(new
......@@ -1232,7 +1285,8 @@ namespace Mall.WebApi.Controllers.MallBase
GGMX = JsonConvert.SerializeObject(SpecificationPriceList);//序列化
}
string AreaList = "";
if (item.IsAreaBuy == 1) {
if (item.IsAreaBuy == 1)
{
AreaList = JsonConvert.SerializeObject(item.AreaList.Select(x => new
{
x.Id,
......@@ -1306,7 +1360,8 @@ namespace Mall.WebApi.Controllers.MallBase
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetProductGoodsDialogList() {
public ApiResult GetProductGoodsDialogList()
{
var parms = RequestParm;
ResultPageModel pagelist = JsonConvert.DeserializeObject<ResultPageModel>(parms.msg.ToString());
RB_Goods_Extend demodel = JsonConvert.DeserializeObject<RB_Goods_Extend>(parms.msg.ToString());
......@@ -1332,11 +1387,13 @@ namespace Mall.WebApi.Controllers.MallBase
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetProductGoodsInfo() {
public ApiResult GetProductGoodsInfo()
{
var req = RequestParm;
JObject prams = JObject.Parse(req.msg.ToString());
int GoodsId = prams.GetInt("GoodsId", 0);
if (GoodsId <= 0) {
if (GoodsId <= 0)
{
return ApiResult.ParamIsNull();
}
......@@ -1392,17 +1449,20 @@ namespace Mall.WebApi.Controllers.MallBase
model.ProxyRises,
model.ProxyMoney,
model.IsProcurement,
CategoryList = model.CategoryList.Select(x=>new {
CategoryList = model.CategoryList.Select(x => new
{
x.Id,
x.CategoryId,
x.CategoryName
}),
SpecificationList= model.SpecificationList.Select(x=>new {
SpecificationList = model.SpecificationList.Select(x => new
{
x.Id,
x.EnabledImage,
x.Name,
x.Sort,
SpecificationValueList= x.SpecificationValueList.Select(y=>new {
SpecificationValueList = x.SpecificationValueList.Select(y => new
{
y.Id,
y.Image,
y.ImagePath,
......@@ -1410,7 +1470,8 @@ namespace Mall.WebApi.Controllers.MallBase
y.Sort
})
}),
SpecificationPriceList= model.SpecificationPriceList.Select(x=>new {
SpecificationPriceList = model.SpecificationPriceList.Select(x => new
{
x.Id,
x.GoodsNumbers,
x.GoodsWeight,
......@@ -1419,13 +1480,15 @@ namespace Mall.WebApi.Controllers.MallBase
x.SpecificationSort,
x.AttrList
}),
AreaList= model.AreaList.Select(x=>new {
AreaList = model.AreaList.Select(x => new
{
x.Id,
x.AreaId,
x.AreaName,
x.AreaType
}),
DistributionCommissionList= model.DistributionCommissionList.Select(x=>new {
DistributionCommissionList = model.DistributionCommissionList.Select(x => new
{
x.Id,
x.DistributorGrade,
x.OneCommission,
......@@ -1433,28 +1496,33 @@ namespace Mall.WebApi.Controllers.MallBase
x.ThreeCommission,
x.TwoCommission
}),
DistributionCommissionTreeList= model.DistributionCommissionTreeList.Select(x=>new {
DistributionCommissionTreeList = model.DistributionCommissionTreeList.Select(x => new
{
x.Id,
x.SpecificationSort,
x.AttrList,
GradeCommissionList= x.GradeCommissionList.Select(y=>new {
GradeCommissionList = x.GradeCommissionList.Select(y => new
{
y.DistributorGrade,
y.OneCommission,
y.ThreeCommission,
y.TwoCommission
})
}),
MemberPriceList = model.MemberPriceList.Select(x=>new {
MemberPriceList = model.MemberPriceList.Select(x => new
{
x.Id,
x.MemberGrade,
x.MemberPrice,
x.SpecificationSort
}),
MemberPriceTreeList= model.MemberPriceTreeList.Select(x=>new {
MemberPriceTreeList = model.MemberPriceTreeList.Select(x => new
{
x.Id,
x.SpecificationSort,
x.AttrList,
GradePriceList= x.GradePriceList.Select(y=>new {
GradePriceList = x.GradePriceList.Select(y => new
{
y.MemberGrade,
y.MemberPrice
})
......@@ -1469,26 +1537,32 @@ namespace Mall.WebApi.Controllers.MallBase
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetProductGoodsInfo() {
public ApiResult SetProductGoodsInfo()
{
var parms = RequestParm;
RB_Goods_Extend demodel = JsonConvert.DeserializeObject<RB_Goods_Extend>(parms.msg.ToString());
demodel.TenantId = parms.TenantId;
demodel.MallBaseId = parms.MallBaseId;
if (string.IsNullOrEmpty(demodel.Name)) {
if (string.IsNullOrEmpty(demodel.Name))
{
return ApiResult.ParamIsNull("请输入商品名称");
}
if (demodel.CarouselImageList == null || !demodel.CarouselImageList.Any()) {
if (demodel.CarouselImageList == null || !demodel.CarouselImageList.Any())
{
return ApiResult.ParamIsNull("请添加商品轮播图");
}
demodel.CarouselImage = JsonConvert.SerializeObject(demodel.CarouselImageList.Select(x => x.Path));
if ((demodel.SellingPrice ?? 0) <= 0){
if ((demodel.SellingPrice ?? 0) <= 0)
{
return ApiResult.ParamIsNull("请输入售价");
}
if ((demodel.OriginalPrice ?? 0) <= 0){
if ((demodel.OriginalPrice ?? 0) <= 0)
{
return ApiResult.ParamIsNull("请输入原价");
}
if (string.IsNullOrEmpty(demodel.Unit)){
if (string.IsNullOrEmpty(demodel.Unit))
{
return ApiResult.ParamIsNull("请输入单位");
}
demodel.IsCustomSpecification ??= 1;
......@@ -1498,35 +1572,44 @@ namespace Mall.WebApi.Controllers.MallBase
if (demodel.IsCustomSpecification == 1)
{
demodel.InventoryNum = 0;
if (demodel.SpecificationList == null || !demodel.SpecificationList.Any()) {
if (demodel.SpecificationList == null || !demodel.SpecificationList.Any())
{
return ApiResult.ParamIsNull("请传递规格列表");
}
if (demodel.SpecificationPriceList == null || !demodel.SpecificationPriceList.Any()) {
if (demodel.SpecificationPriceList == null || !demodel.SpecificationPriceList.Any())
{
return ApiResult.ParamIsNull("请传递规格价格库存列表");
}
if (demodel.SpecificationList.Count() != demodel.SpecificationList.Select(x => x.Sort).Distinct().Count()) {
if (demodel.SpecificationList.Count() != demodel.SpecificationList.Select(x => x.Sort).Distinct().Count())
{
return ApiResult.ParamIsNull("规格名排序有误");
}
int TotalNum = 1;
foreach (var item in demodel.SpecificationList) {
foreach (var item in demodel.SpecificationList)
{
if (item.SpecificationValueList == null || !item.SpecificationValueList.Any())
{
return ApiResult.ParamIsNull("请传递规格值列表");
}
if (item.SpecificationValueList.Count() != item.SpecificationValueList.Select(x => x.Sort).Distinct().Count()) {
if (item.SpecificationValueList.Count() != item.SpecificationValueList.Select(x => x.Sort).Distinct().Count())
{
return ApiResult.ParamIsNull("规格值排序有误");
}
TotalNum *= item.SpecificationValueList.Count();
if (item.EnabledImage == 1) {
foreach (var qitem in item.SpecificationValueList) {
if ((qitem.Image ?? "") == "") {
if (item.EnabledImage == 1)
{
foreach (var qitem in item.SpecificationValueList)
{
if ((qitem.Image ?? "") == "")
{
return ApiResult.ParamIsNull("请选择规格图片");
}
}
}
}
//验证总keys数量
if (demodel.SpecificationPriceList.Count() != TotalNum) {
if (demodel.SpecificationPriceList.Count() != TotalNum)
{
return ApiResult.ParamIsNull("规格价格数量有误");
}
//初始化所有keys
......@@ -1537,14 +1620,16 @@ namespace Mall.WebApi.Controllers.MallBase
}
int MGBJNum = 1;
//组装所有keys
foreach (var item in demodel.SpecificationList) {
foreach (var item in demodel.SpecificationList)
{
int LBBJNum = TotalNum / item.SpecificationValueList.Count() / MGBJNum;
int KeyIndex = 0;
for (var i = 1; i <= LBBJNum; i++)
{
foreach (var qitem in item.SpecificationValueList)
{
for (var j = 1; j <= MGBJNum; j++) {
for (var j = 1; j <= MGBJNum; j++)
{
KeyList[KeyIndex] = KeyList[KeyIndex] + ":" + qitem.Sort;
KeyIndex++;
}
......@@ -1552,16 +1637,20 @@ namespace Mall.WebApi.Controllers.MallBase
}
}
//验证所有keys
foreach (var item in KeyList) {
foreach (var item in KeyList)
{
string keys = item[1..];
var pricemodel = demodel.SpecificationPriceList.Where(x => x.SpecificationSort == keys).FirstOrDefault();
if (pricemodel == null) {
if (pricemodel == null)
{
return ApiResult.ParamIsNull("规格价格Key有误");
}
if ((pricemodel.SellingPrice ?? 0) <= 0) {
if ((pricemodel.SellingPrice ?? 0) <= 0)
{
return ApiResult.ParamIsNull("请输入规格列表价格");
}
if ((pricemodel.InventoryNum ?? 0) < 0) {
if ((pricemodel.InventoryNum ?? 0) < 0)
{
return ApiResult.ParamIsNull("规格列表库存不正确");
}
pricemodel.InventoryNum ??= 0;
......@@ -1573,7 +1662,8 @@ namespace Mall.WebApi.Controllers.MallBase
//主表价格 如果有自定义规格,直接取最小值
demodel.SellingPrice = demodel.SpecificationPriceList.Min(x => x.SellingPrice ?? 0);
//分销佣金
if (demodel.SeparateDistribution == 1) {
if (demodel.SeparateDistribution == 1)
{
if (DGradeList == null)
{
DGradeList = productModule.GetDistributorGradeList(new Model.Extend.User.RB_Distributor_Grade_Extend() { Enabled = 1, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId });
......@@ -1590,11 +1680,14 @@ namespace Mall.WebApi.Controllers.MallBase
}
//转换
List<RB_Goods_DistributionCommission_Extend> Rlist = new List<RB_Goods_DistributionCommission_Extend>();
foreach (var item in demodel.DistributionCommissionList) {
if (item.GradeCommissionList == null || !item.GradeCommissionList.Any()) {
foreach (var item in demodel.DistributionCommissionList)
{
if (item.GradeCommissionList == null || !item.GradeCommissionList.Any())
{
return ApiResult.ParamIsNull("请传递分销佣金列表");
}
foreach (var qitem in item.GradeCommissionList) {
foreach (var qitem in item.GradeCommissionList)
{
Rlist.Add(new RB_Goods_DistributionCommission_Extend()
{
DistributorGrade = qitem.DistributorGrade,
......@@ -1606,7 +1699,8 @@ namespace Mall.WebApi.Controllers.MallBase
});
}
}
if (Rlist.Any()) {
if (Rlist.Any())
{
demodel.DistributionCommissionList = Rlist;
}
if (demodel.SeparateDistributionType == 1)
......@@ -1640,7 +1734,7 @@ namespace Mall.WebApi.Controllers.MallBase
if (DGradeList.Count() * TotalNum != demodel.DistributionCommissionList.Count())
{
LogHelper.Write(DGradeList.Count().ToString() + "|||" + JsonConvert.SerializeObject(DGradeList));
LogHelper.Write("TotalNum:"+ TotalNum.ToString());
LogHelper.Write("TotalNum:" + TotalNum.ToString());
LogHelper.Write(JsonConvert.SerializeObject(demodel.DistributionCommissionList));
return ApiResult.ParamIsNull("分销佣金列表数量不正确");
}
......@@ -1672,7 +1766,8 @@ namespace Mall.WebApi.Controllers.MallBase
}
//会员价格
if (demodel.EnjoyMember == 1 && demodel.SeparateSetMember == 1) {
if (demodel.EnjoyMember == 1 && demodel.SeparateSetMember == 1)
{
// 获取所有会员等级
if (MGradeList == null)
{
......@@ -1761,7 +1856,8 @@ namespace Mall.WebApi.Controllers.MallBase
}
demodel.GoodsService = JsonConvert.SerializeObject(demodel.ServiceList.Select(x => x.Id));
}
else {
else
{
demodel.GoodsService = "[]";
}
demodel.FreightId ??= 0;
......@@ -1772,8 +1868,10 @@ namespace Mall.WebApi.Controllers.MallBase
demodel.FullMoneyPinkage ??= 0;
demodel.IsAreaBuy ??= 2;
if (demodel.IsAreaBuy == 1) {
if (demodel.AreaList == null || !demodel.AreaList.Any()) {
if (demodel.IsAreaBuy == 1)
{
if (demodel.AreaList == null || !demodel.AreaList.Any())
{
return ApiResult.ParamIsNull("请选择区域");
}
}
......@@ -1789,7 +1887,8 @@ namespace Mall.WebApi.Controllers.MallBase
#endregion
demodel.SeparateDistribution ??= 2;
demodel.SeparateDistributionType ??= 1;
if (demodel.SeparateDistribution == 1) {
if (demodel.SeparateDistribution == 1)
{
//获取所有分销商等级
if (DGradeList == null)
{
......@@ -1803,14 +1902,17 @@ namespace Mall.WebApi.Controllers.MallBase
}
if (demodel.SeparateDistributionType == 1)
{
if (demodel.DistributionCommissionList == null || !demodel.DistributionCommissionList.Any()) {
if (demodel.DistributionCommissionList == null || !demodel.DistributionCommissionList.Any())
{
return ApiResult.ParamIsNull("请传递分销佣金列表");
}
//普通设置 直接根据等级验证数量
if (DGradeList.Count() != demodel.DistributionCommissionList.Count()) {
if (DGradeList.Count() != demodel.DistributionCommissionList.Count())
{
return ApiResult.ParamIsNull("分销佣金列表数量不正确");
}
foreach (var item in DGradeList) {
foreach (var item in DGradeList)
{
var defaultModel = demodel.DistributionCommissionList.Where(x => x.DistributorGrade == item.Id).FirstOrDefault();
if (defaultModel == null)
{
......@@ -1822,8 +1924,10 @@ namespace Mall.WebApi.Controllers.MallBase
defaultModel.SpecificationSort = "";
}
}
else {
if (demodel.IsCustomSpecification != 1) {
else
{
if (demodel.IsCustomSpecification != 1)
{
return ApiResult.ParamIsNull("无法开启详细设置");
}
}
......@@ -1838,7 +1942,8 @@ namespace Mall.WebApi.Controllers.MallBase
{
MGradeList = productModule.GetMemberGradeList(new Model.Extend.User.RB_Member_Grade_Extend() { Enabled = 1, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId });
}
if (!MGradeList.Any()) {
if (!MGradeList.Any())
{
return ApiResult.ParamIsNull("单独设置会员价需先添加会员等级");
}
if (demodel.IsCustomSpecification == 2)
......@@ -1873,16 +1978,19 @@ namespace Mall.WebApi.Controllers.MallBase
demodel.ProxyRises ??= 0;
demodel.ProxyMoney ??= 0;
demodel.IsProcurement = 2;//新增时
if (demodel.IsProxy == 1 && demodel.CostPrice > 0) {
if (demodel.IsProxy == 1 && demodel.CostPrice > 0)
{
decimal ProxyMoney = 0;
if (demodel.ProxyType == 1)
{
ProxyMoney = Math.Round((demodel.CostPrice ?? 0) * (1 + (demodel.ProxyRises ?? 0)), 2, MidpointRounding.AwayFromZero);
}
else {
else
{
ProxyMoney = (demodel.CostPrice ?? 0) + (demodel.ProxyRises ?? 0);
}
if (ProxyMoney != (demodel.ProxyMoney ?? 0)) {
if (ProxyMoney != (demodel.ProxyMoney ?? 0))
{
return ApiResult.ParamIsNull("代理价格不正确");
}
}
......@@ -1892,7 +2000,8 @@ namespace Mall.WebApi.Controllers.MallBase
{
return ApiResult.Success();
}
else {
else
{
return ApiResult.Failed();
}
}
......@@ -1902,11 +2011,12 @@ namespace Mall.WebApi.Controllers.MallBase
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetProductGoodsQuickUpdate() {
public ApiResult SetProductGoodsQuickUpdate()
{
var req = RequestParm;
JObject parms = JObject.Parse(req.msg.ToString());
string GoodsIds = parms.GetStringValue("GoodsIds");
int Type = parms.GetInt("Type", 0);//1排序 2商品名称 3快速购买 4上架 5下架 6删除 7运费 8限购 9积分 10快速购买 11面议
int Type = parms.GetInt("Type", 0);//1排序 2商品名称 3快速购买 4上架 5下架 6删除 7运费 8限购 9积分 10快速购买 11面议,12 供应商
int Sort = parms.GetInt("Sort", 0);
string GoodsName = parms.GetStringValue("GoodsName");
int FreightId = parms.GetInt("FreightId", 0);//运费
......@@ -1919,19 +2029,28 @@ namespace Mall.WebApi.Controllers.MallBase
int IsMultipleDeduction = parms.GetInt("IsMultipleDeduction", 2);//是否多件抵扣
int IsQuickBuy = parms.GetInt("IsQuickBuy", 2);//快速购买
int IsGoodsNegotiable = parms.GetInt("IsGoodsNegotiable", 2);//商品面议
int SupplierId = parms.GetInt("SupplierId", 0);//供应商
if (string.IsNullOrEmpty(GoodsIds))
{
return ApiResult.ParamIsNull();
}
if (Type == 2) {
if (string.IsNullOrEmpty(GoodsName)) {
if (Type == 2)
{
if (string.IsNullOrEmpty(GoodsName))
{
return ApiResult.ParamIsNull("请传递商品名称");
}
}
else if (Type == 12)
{
if (SupplierId == 0 && req.TenantId==1 && req.MallBaseId == 1)
{
return ApiResult.ParamIsNull("请选择供应商");
}
}
bool flag = productModule.SetProductGoodsQuickUpdate(GoodsIds, Type, Sort, GoodsName, FreightId, LimitBuyGoodsNum, LimitBuyOrderNum, IntegralPresent
, IntegralPresentType, PointsDeduction, PointsDeductionType, IsMultipleDeduction, IsQuickBuy, IsGoodsNegotiable, req.TenantId, req.MallBaseId);
, IntegralPresentType, PointsDeduction, PointsDeductionType, IsMultipleDeduction, IsQuickBuy, IsGoodsNegotiable, SupplierId, req.TenantId, req.MallBaseId);
if (flag)
{
return ApiResult.Success();
......@@ -1947,11 +2066,13 @@ namespace Mall.WebApi.Controllers.MallBase
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult DelProcudtGoodsInfo() {
public ApiResult DelProcudtGoodsInfo()
{
var req = RequestParm;
JObject parms = JObject.Parse(req.msg.ToString());
int GoodsId = parms.GetInt("GoodsId", 0);
if (GoodsId <= 0) {
if (GoodsId <= 0)
{
return ApiResult.ParamIsNull();
}
......@@ -1960,7 +2081,8 @@ namespace Mall.WebApi.Controllers.MallBase
{
return ApiResult.Success();
}
else {
else
{
return ApiResult.Failed();
}
}
......@@ -2013,12 +2135,14 @@ namespace Mall.WebApi.Controllers.MallBase
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetProductGoodsProxy() {
public ApiResult SetProductGoodsProxy()
{
var req = RequestParm;
JObject parms = JObject.Parse(req.msg.ToString());
int GoodsId = parms.GetInt("GoodsId", 0);
string CategoryStr = parms.GetStringValue("CategoryStr");
if (GoodsId <= 0) {
if (GoodsId <= 0)
{
return ApiResult.ParamIsNull("请传递商品id");
}
if (string.IsNullOrEmpty(CategoryStr) || CategoryStr == "[]")
......@@ -2035,7 +2159,8 @@ namespace Mall.WebApi.Controllers.MallBase
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult CancelGoodsProxy() {
public ApiResult CancelGoodsProxy()
{
var req = RequestParm;
JObject parms = JObject.Parse(req.msg.ToString());
......@@ -2051,7 +2176,8 @@ namespace Mall.WebApi.Controllers.MallBase
{
return ApiResult.Success();
}
else {
else
{
return ApiResult.Failed();
}
}
......@@ -2061,7 +2187,8 @@ namespace Mall.WebApi.Controllers.MallBase
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetGoodsProxyStatus() {
public ApiResult SetGoodsProxyStatus()
{
var req = RequestParm;
JObject parms = JObject.Parse(req.msg.ToString());
int GoodsId = parms.GetInt("GoodsId", 0);
......@@ -2107,7 +2234,8 @@ namespace Mall.WebApi.Controllers.MallBase
{
return ApiResult.ParamIsNull("请选择商品状态");
}
if (string.IsNullOrEmpty(CategoryList)) {
if (string.IsNullOrEmpty(CategoryList))
{
return ApiResult.ParamIsNull("请选择商品分类");
}
List<int> CategoryIdList = new List<int>();
......
......@@ -243,6 +243,22 @@ namespace Mall.WebApi.Controllers.User
}
}
/// <summary>
/// 根据地区名称获取地区列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public virtual ApiResult GetDestinationListByNames()
{
var request = RequestParm;
var userInfo = AppletUserInfo;
JObject parm = JObject.Parse(request.msg.ToString());
var area = parm.GetStringValue("area");
var where = Common.Plugin.JsonHelper.DeserializeObject<string[]>(area);
var list = userModule.GetDestinationListByNames(where);
return ApiResult.Success(data: list.Select(qitem => new { qitem.ID, qitem.Name, qitem.CodeLevel }));
}
#endregion
#region 收藏商品
......
......@@ -334,6 +334,7 @@ namespace Mall.WebApi.Controllers.User
OtherType = 13,
Remark = System.DateTime.Now.ToString("yyyy年MM月dd日") + "生成财务单据",
detailList,
RB_Depart_Id= Config.ExpendDepartment
};
string sign = EncryptionHelper.AesEncrypt(JsonHelper.Serialize(financeObj), Config.FinanceKey);
var resultInfo = new
......
......@@ -21,8 +21,8 @@
"ViewFileSiteUrl": "https://viitto-1301420277.cos.ap-chengdu.myqcloud.com",
"ImKey": "b612b31e837c79c68f141aeb719d2b20",
"ImSecret": "66000451fb72",
"Mongo": "mongodb://192.168.2.214:27017",
//"Mongo": "mongodb://47.96.25.130:27017",
//"Mongo": "mongodb://192.168.2.214:27017",
"Mongo": "mongodb://47.96.25.130:27017",
"MongoDBName": "Mall",
"ProjectUrl": "D:/project/GitProject/mallapp",
"DeveloperKitsPort": "15720",
......@@ -35,24 +35,25 @@
"RB_Branch_Id": 49, //所属公司id
"IncomeDirector": 1756, //财务收入创建人
"IncomeBranchId": 49, //财务收入创建人公司
"IncomeDepartment": 331,
"ExpendDirector": 1756, //财务支出创建人
"ExpendBranchId": 49, //财务支出创建人公司
"ExpendDepartment": 331,
"RebornDMC": "reborn_dmc",
"IncomeFinanceApi": "http://192.168.2.16:8083/api/Mall/InsertFinanceBatchForMallIn",
"PaymentFinanceApi": "http://192.168.2.16:8083/api/Mall/InsertFinanceBatchForMallOut",
"FinanceKey": "FinanceMallInsertToERPViitto2020",
"SettlementRate": "0.60",
"RedisSetting": {
"RedisServer": "192.168.2.214",
"RedisPort": "6379",
"RedisPwd": "123456"
},
//"RedisSetting": {
// "RedisServer": "47.96.23.199",
// "RedisServer": "192.168.2.214",
// "RedisPort": "6379",
// "RedisPwd": "Viitto2018"
// "RedisPwd": "123456"
//},
"RedisSetting": {
"RedisServer": "47.96.23.199",
"RedisPort": "6379",
"RedisPwd": "Viitto2018"
},
"VirtualDirectory": "WebFile",
"FileService": "2",
"IsNormalServer": 2,
......
......@@ -266,7 +266,8 @@ and DATE_FORMAT(b.PaymentTime,'%y-%m-%d')<DATE_FORMAT('{endDate}','%y-%m-%d') A
OrderSource = 16,
Remark = System.DateTime.Now.ToString("yyyy年MM月dd日") + "自动生成财务单据",
detailList,
OriginalFee
OriginalFee,
RB_Depart_Id= Config.IncomeDepartment
};
string sign = EncryptionHelper.AesEncrypt(JsonHelper.Serialize(financeObj), Config.FinanceKey);
var resultInfo = new
......@@ -1171,7 +1172,8 @@ and DATE_FORMAT(b.PaymentTime,'%y-%m-%d')<DATE_FORMAT('{endDate}','%y-%m-%d') A
OtherType = 14,
ReFinanceId = 0,
Remark,
detailList
detailList,
RB_Depart_Id = Config.ExpendDepartment
};
string sign = EncryptionHelper.AesEncrypt(JsonHelper.Serialize(financeObj), Config.FinanceKey);
var resultInfo = new
......
......@@ -30,8 +30,10 @@
"sTenpayNotify": "http://mallapi.oytour.com/api/WeChatNotify/Notify", //微信回调地址
"IncomeDirector": 1756, //财务收入创建人
"IncomeBranchId": 49, //财务收入创建人公司
"IncomeDepartment": 331,
"ExpendDirector": 1756, //财务支出创建人
"ExpendBranchId": 49, //财务支出创建人公司
"ExpendDepartment": 331,
"NetworkDirector": 1756, //网络主管的id,用于新建供应商账户的时候的创建人
"RB_Branch_Id": 49, //所属公司id
"RebornDMC": "reborn_dmc",
......
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