Commit fa163018 authored by liudong1993's avatar liudong1993

解决冲突

parents 3d323cae 0bbf13bb
......@@ -165,6 +165,8 @@ namespace Mall.CacheManager.User
/// <param name="UserId">用户Id</param>
/// <returns></returns>
public static AppletUserInfo GetAppletUserLoginInfo(object UserId)
{
if (UserId != null)
{
string cacheKey = UserModuleCacheKeyConfig.Applet_Login_Info + UserId.ToString();
AppletUserInfo userInfo = null;
......@@ -206,5 +208,7 @@ namespace Mall.CacheManager.User
}
return userInfo;
}
return null;
}
}
}
......@@ -65,6 +65,11 @@ namespace Mall.Model.Query
/// </summary>
public decimal PayMoney { get; set; }
/// <summary>
/// 复购人数
/// </summary>
public int RepurchaseNum { get; set; }
/// <summary>
/// 支付人数
......
......@@ -3610,7 +3610,7 @@ namespace Mall.Module.Product
if (pUserId > 0)
{
var pumodel = member_UserRepository.GetEntity(pUserId);
demodel.CompanyProfitRate = pumodel.CompanyProfitRate;
demodel.CompanyProfitRate = (pumodel?.CompanyProfitRate??0);
demodel.CompanyId = pUserId;
}
#endregion
......@@ -3755,6 +3755,28 @@ namespace Mall.Module.Product
}
}
/// ERP修改商品订单状态
/// </summary>
/// <param name="extModel"></param>
/// <param name="tradeModel"></param>
/// <returns></returns>
public bool UpdateERPGoodsOrderInfoModule(RB_Goods_Order_Extend extModel, RB_Goods_Online_Trade_Extend tradeModel)
{
bool flag = false;
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Goods_Order_Extend.MerchantsNo),extModel.MerchantsNo },
{nameof(RB_Goods_Order_Extend.OrderStatus),extModel.OrderStatus },
{nameof(RB_Goods_Order_Extend.PaymentTime),extModel.PaymentTime },
};
flag = goods_OrderRepository.Update(fileds, new WhereHelper(nameof(RB_Goods_Order_Extend.OrderId), extModel.OrderId));
if (flag)
{
flag = goods_Online_TradeRepository.Insert(tradeModel) > 0;
}
return flag;
}
/// <summary>
/// 司导下单
/// </summary>
......
......@@ -170,6 +170,25 @@ namespace Mall.Module.User
return employeeRepository.GetEmployeeListRepository(query);
}
/// <summary>
/// 判断账号是否存在
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public bool CheckExistsEmployeeModule(RB_Employee_Extend query)
{
List<WhereHelper> list = new List<WhereHelper>()
{
new WhereHelper(nameof(RB_Employee_Extend.EmpAccount),query.EmpAccount.Trim()),
};
if (query.EmpId > 0)
{
list.Add(new WhereHelper(nameof(RB_Employee_Extend.EmpId), query.EmpId, operatorEnum: OperatorEnum.NotEqual));
}
bool flag= employeeRepository.Exists(list);
return flag;
}
/// <summary>
/// 新增修改员工
/// </summary>
......
......@@ -407,8 +407,9 @@ namespace Mall.Module.User
{ nameof(RB_Member_User.ContactWay),demodel.ContactWay},
{ nameof(RB_Member_User.Remark),demodel.Remark},
{ nameof(RB_Member_User.AliasName),demodel.AliasName},
{ nameof(RB_Member_Grade.UpdateDate),demodel.UpdateDate},
{ nameof(RB_Member_User.UpdateDate),demodel.UpdateDate},
{ nameof(RB_Member_User.PostId),demodel.PostId},
{ nameof(RB_Member_User.Blacklist),demodel.Blacklist},
};
List<WhereHelper> wheres = new List<WhereHelper>() {
new WhereHelper(){
......@@ -4017,12 +4018,25 @@ namespace Mall.Module.User
/// 获取粉象我的团队标题列表
/// </summary>
/// <param name="userInfo"></param>
/// <param name="IsDirect">默认查询直属下线</param>
/// <returns></returns>
public object GerUserMyTeamTitelListForFX(AppletUserInfo userInfo)
public object GerUserMyTeamTitelListForFX(AppletUserInfo userInfo,int IsDirect=1)
{
string UserIds = member_UserRepository.GetMemberChildIdStr(userInfo.UserId);
var query = new RB_Distributor_Info_Extend()
{
UserIds = UserIds,
TenantId = userInfo.TenantId,
MallBaseId = userInfo.MallBaseId,
IsDirect = IsDirect
};
//查询直属下线
if (IsDirect == 1)
{
query.SuperiorId = userInfo.UserId;
}
//获取下级所有等级
var disList = distributor_InfoRepository.GetFXGreadeListForMyTeam(new RB_Distributor_Info_Extend() { UserIds = UserIds, TenantId = userInfo.TenantId, MallBaseId = userInfo.MallBaseId });
var disList = distributor_InfoRepository.GetFXGreadeListForMyTeam(query);
var fxList = new List<RB_Distributor_FXGrade_Extend>();
if (disList.Where(x => x.FXGradeId > 0).Any())
{
......
......@@ -95,23 +95,28 @@ namespace Mall.Repository.Product
}
if (!string.IsNullOrEmpty(dmodel.GoodsName))
{
where += $@" and od.{nameof(RB_Goods_OrderDetail.GoodsName)} like '%{dmodel.GoodsName}%'";
where += $@" and od.{nameof(RB_Goods_OrderDetail.GoodsName)} like @GoodsName ";
parameters.Add("GoodsName", "%" + dmodel.GoodsName.Trim() + "%");
}
if (!string.IsNullOrEmpty(dmodel.Consignee))
{
where += $@" and o.{nameof(RB_Goods_Order.Consignee)} like '%{dmodel.Consignee}%'";
where += $@" and o.{nameof(RB_Goods_Order.Consignee)} like @Consignee ";
parameters.Add("Consignee", "%" + dmodel.Consignee.Trim() + "%");
}
if (!string.IsNullOrEmpty(dmodel.Mobile))
{
where += $@" and o.{nameof(RB_Goods_Order.Mobile)} like '%{dmodel.Mobile}%'";
where += $@" and o.{nameof(RB_Goods_Order.Mobile)} like @Mobile ";
parameters.Add("Mobile", "%" + dmodel.Mobile.Trim() + "%");
}
if (!string.IsNullOrEmpty(dmodel.ProductCode))
{
where += $@" and od.{nameof(RB_Goods_OrderDetail.ProductCode)} like '%{dmodel.ProductCode}%'";
where += $@" and od.{nameof(RB_Goods_OrderDetail.ProductCode)} like @ProductCode ";
parameters.Add("ProductCode", "%" + dmodel.ProductCode.Trim() + "%");
}
if (!string.IsNullOrEmpty(dmodel.AnchorName))
{
where += $@" and o.{nameof(RB_Goods_Order.AnchorName)} like '%{dmodel.AnchorName}%'";
where += $@" and o.{nameof(RB_Goods_Order.AnchorName)} like @AnchorName ";
parameters.Add("AnchorName", "%" + dmodel.AnchorName.Trim() + "%");
}
if (dmodel.Recycled > 0)
{
......@@ -917,13 +922,6 @@ LEFT JOIN rb_member_user as c on b.UserId=c.Id
{
orderTypeWhere += $@" and {nameof(RB_Goods_OrderDetail.OrderType)}={dmodel.OrderType}";
}
//if (dmodel.OrderType > 0)
//{
// where += $@" and a.{nameof(RB_Goods_Order.or)}={(int)dmodel.OrderType}";
// payMemerNumWhere += $@" and {nameof(RB_Goods_Order.OrderSource)}={(int)dmodel.PlatformType}";
//}
if (dmodel.OrderStatus == 1 || dmodel.OrderStatus == 0)
{
where += $@" and a.{nameof(RB_Goods_Order.OrderStatus)} in (2,4,3,5,6)";
......@@ -952,29 +950,25 @@ LEFT JOIN rb_member_user as c on b.UserId=c.Id
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_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_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,
//(SELECT COUNT(distinct UserId) from rb_goods_order where DATE_FORMAT(CreateDate,'%Y-%m-%d' )=t.CreateDate {payMemerNumWhere} ) as PayMemerNum
//from (SELECT DATE_FORMAT(a.CreateDate,'%Y-%m-%d' )as CreateDate,b.GoodsNum,a.UserId,a.Income,a.OrderId from rb_goods_order as a
// 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";
if (dmodel.OrderStatus == 0 || dmodel.OrderStatus == 1 || dmodel.OrderStatus == 2 || dmodel.OrderStatus == 3)
{
sql = $@"SELECT t.CreateDate,SUM(t.GoodsNum)as GoodsNum ,COUNT(t.OrderId)as OrderNum ,SUM(t.Income)as PayMoney,MAX(t.PayMemerNum) as PayMemerNum
from (SELECT DATE_FORMAT(a.CreateDate,'%Y-%m-%d' )as CreateDate,b.GoodsNum,a.UserId,a.Income,a.OrderId,c.PayMemerNum from rb_goods_order as a
sql = $@"SELECT t.CreateDate,SUM(t.GoodsNum)as GoodsNum ,COUNT(t.OrderId)as OrderNum ,SUM(t.Income)as PayMoney,MAX(t.PayMemerNum) as PayMemerNum,MAX(t.RepurchaseNum) as RepurchaseNum
from (SELECT DATE_FORMAT(a.CreateDate,'%Y-%m-%d' )as CreateDate,b.GoodsNum,a.UserId,a.Income,a.OrderId,c.PayMemerNum,d.RepurchaseNum from rb_goods_order as a
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
LEFT JOIN (SELECT COUNT(DISTINCT UserId) as PayMemerNum, DATE_FORMAT(CreateDate,'%Y-%m-%d' ) as CreateDate from rb_goods_order where 1=1 {payMemerNumWhere} GROUP BY DATE_FORMAT(CreateDate,'%Y-%m-%d' ))
as c on c.CreateDate=DATE_FORMAT(a.CreateDate,'%Y-%m-%d' ) {where} )
as c on c.CreateDate=DATE_FORMAT(a.CreateDate,'%Y-%m-%d' )
LEFT JOIN (SELECT temp.CreateDate,COUNT(UserId) as RepurchaseNum from (SELECT UserId,COUNT(DISTINCT UserId) as RepurchaseNum, DATE_FORMAT(CreateDate,'%Y-%m-%d' ) as CreateDate from rb_goods_order where 1=1
{payMemerNumWhere} GROUP BY UserId,DATE_FORMAT(CreateDate,'%Y-%m-%d' ) having count(UserId) > 1) as temp GROUP BY temp.CreateDate
)
as d on d.CreateDate=DATE_FORMAT(a.CreateDate,'%Y-%m-%d' )
{where} )
as t GROUP BY t.CreateDate desc";
}
else
......@@ -990,22 +984,6 @@ from
)
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();
}
......
......@@ -177,10 +177,22 @@ where {where} order by di.CreateDate desc";
{
where += $@" and di.{nameof(RB_Distributor_Info.AuditStatus)}={(int)dmodel.AuditStatus}";
}
if (dmodel.IsDirect == 1)
{
if (dmodel.SuperiorId > 0)
{
//查找直属下级
where += $@" and u.{nameof(RB_Member_User.SuperiorId)}={dmodel.SuperiorId}";
}
}
else
{
if (!string.IsNullOrEmpty(dmodel.UserIds))
{
where += $@" and di.{nameof(RB_Distributor_Info.UserId)} in({dmodel.UserIds})";
}
}
if (dmodel.GradeId >= 0)
{
where += $@" and di.{nameof(RB_Distributor_Info.GradeId)}={dmodel.GradeId}";
......@@ -190,7 +202,10 @@ where {where} order by di.CreateDate desc";
where += $@" and di.{nameof(RB_Distributor_Info.Name)} like '%{dmodel.Name}%'";
}
string sql = $@"select di.FXGradeId,count(0) as OneNum from RB_Distributor_Info di where {where} group by di.FXGradeId";
string sql = $@"
select di.FXGradeId,count(0) as OneNum
from RB_Distributor_Info di LEFT JOIN rb_member_user AS u ON di.UserId=u.Id
where {where} group by di.FXGradeId";
return Get<RB_Distributor_Info_Extend>(sql).ToList();
}
......
......@@ -56,20 +56,19 @@ namespace Mall.Repository.User
/// <returns></returns>
public RB_Tenant_Extend GetTenantByMallRepository(RB_Tenant_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.Append(@"
StringBuilder builder1 = new StringBuilder();
builder1.AppendFormat(@"
SELECT A.TenantId,A.Account AS Account,A.Name,A.MobilePhone,A.WeChatNum,A.IsEffective,A.AccountValidate,A.CreateMiniPrograme
,A.AccountStatus,A.`Password` AS Password,0 AS EmpId,0 AS MallBaseId
FROM RB_Tenant AS A
WHERE 1=1 AND A.Account='{0}'
UNION ALL
SELECT A.TenantId,B.EmpAccount AS Account,A.Name,A.MobilePhone,A.WeChatNum,A.IsEffective,A.AccountValidate,A.CreateMiniPrograme
,A.AccountStatus,B.EmpPwd AS Password,B.EmpId
FROM RB_Tenant AS A LEFT JOIN rb_employee AS B ON A.TenantId=B.TenantId
WHERE 1=1 ");
if (query != null)
{
if (query.Account != null && !string.IsNullOrEmpty(query.Account.Trim()))
{
builder.AppendFormat(" AND B.EmpAccount='{0}' ", query.Account.Trim());
}
}
return Get<RB_Tenant_Extend>(builder.ToString()).FirstOrDefault();
,A.AccountStatus,B.EmpPwd AS Password,B.EmpId,B.MallBaseId
FROM RB_Tenant AS A INNER JOIN rb_employee AS B ON A.TenantId=B.TenantId
WHERE 1=1 AND B.EmpAccount='{0}'
", query.Account.Trim());
return Get<RB_Tenant_Extend>(builder1.ToString()).FirstOrDefault();
}
/// <summary>
......
......@@ -8,6 +8,7 @@ using Mall.Common.Plugin;
using Mall.Model.Extend.BaseSetUp;
using Mall.Module.BaseSetUp;
using Mall.WebApi.Filter;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json.Linq;
......@@ -31,17 +32,18 @@ namespace Mall.WebApi.Controllers.MallBase
/// </summary>
/// <param name="ParentID">父节点编号</param>
/// <returns></returns>
[AllowAnonymous]
public ApiResult GetChildList()
{
JObject parm = JObject.Parse(RequestParm.msg.ToString());
int ID = parm.GetInt("Id");
if (ID > 0)
{
var CommonList = Mall.Common.Data.AreaDataHelper.GetAreaList();
if (CommonList != null && CommonList.Count > 0)
{
return ApiResult.Success("", CommonList.Where(qitem => qitem.P == ID).Select(qitem => new { ID = qitem.I, Name = qitem.N }));
}
//var CommonList = Mall.Common.Data.AreaDataHelper.GetAreaList();
//if (CommonList != null && CommonList.Count > 0)
//{
// return ApiResult.Success("", CommonList.Where(qitem => qitem.P == ID).Select(qitem => new { ID = qitem.I, Name = qitem.N }));
//}
var list = destinationModule.GetChildList(ID).Select(item => new { item.ID, item.Name });
return ApiResult.Success("", list);
}
......
......@@ -236,7 +236,8 @@ namespace Mall.WebApi.Controllers.MarketingCenter
x.GoodsNum,
x.OrderNum,
x.PayMoney,
x.PayMemerNum
x.PayMemerNum,
x.RepurchaseNum
});
return ApiResult.Success("", pagelist);
}
......@@ -280,7 +281,8 @@ namespace Mall.WebApi.Controllers.MarketingCenter
new ExcelColumn(value: "付款人数") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "付款订单数") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "付款金额") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "付款件数") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER }
new ExcelColumn(value: "付款件数") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "复购人数") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER }
},
};
slist.Add(header);
......@@ -289,7 +291,7 @@ namespace Mall.WebApi.Controllers.MarketingCenter
{
demodel.TenantId = UserInfo.TenantId;
demodel.MallBaseId = parms.MallBaseId;
var list = statisticsModule.GetSellPageList(1,1000,out long rowsCount,demodel);
var list = statisticsModule.GetSellPageList(1,5000,out long rowsCount,demodel);
#region 组装数据
int Num = 0;
foreach (var item in list)
......@@ -307,6 +309,7 @@ namespace Mall.WebApi.Controllers.MarketingCenter
datarow.ExcelRows.Add(new ExcelColumn(value: item.OrderNum.ToString()) { });
datarow.ExcelRows.Add(new ExcelColumn(value: item.PayMoney.ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: item.PayMemerNum.ToString()) { });
datarow.ExcelRows.Add(new ExcelColumn(value: item.RepurchaseNum.ToString()) { });
slist.Add(datarow);
}
#endregion
......
......@@ -18,6 +18,8 @@ using Mall.Module.Product;
using Mall.Model.Extend.User;
using Mall.Model.Entity.BaseSetUp;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Authorization;
using Mall.Common.Enum.Goods;
namespace Mall.WebApi.Controllers.MallBase
{
......@@ -591,6 +593,144 @@ namespace Mall.WebApi.Controllers.MallBase
return orderModule.SetAppletSDGoodsOrderInfo(demodel);
}
/// <summary>
/// ERP下单
/// </summary>
/// <returns></returns>
[HttpPost]
[AllowAnonymous]
public ApiResult SetERPGoodsOrderInfo()
{
var req = RequestParm;
JObject parms = JObject.Parse(req.msg.ToString());
int NewUserId = parms.GetInt("NewUserId");
var userInfo = UserReidsCache.GetAppletUserLoginInfo(NewUserId);
RB_Goods_Order_Extend demodel = JsonConvert.DeserializeObject<RB_Goods_Order_Extend>(req.msg.ToString());
if (demodel.IsFormShoppingCart == 1)
{
if (demodel.ShoppingCartIdList == null || !demodel.ShoppingCartIdList.Any())
{
return ApiResult.ParamIsNull("请传递购物车id");
}
}
if (string.IsNullOrEmpty(demodel.Consignee))
{
return ApiResult.ParamIsNull("请传递收件人");
}
if (string.IsNullOrEmpty(demodel.Mobile))
{
return ApiResult.ParamIsNull("请传递收件人手机号码");
}
if (demodel.DeliveryMethod != Common.Enum.Goods.OrderDeliveryMethodEnum.VerificationShop)
{
if ((demodel.District ?? 0) <= 0)
{
return ApiResult.ParamIsNull("收货地址有误");
}
if (string.IsNullOrEmpty(demodel.ShoppingAddress))
{
return ApiResult.ParamIsNull("收货详细地址不能为空");
}
}
if (demodel.DetailList == null || !demodel.DetailList.Any())
{
return ApiResult.ParamIsNull("请传递商品信息");
}
foreach (var item in demodel.DetailList)
{
if ((item.GoodsId ?? 0) <= 0)
{
return ApiResult.ParamIsNull("请传递商品id");
}
if ((item.Number ?? 0) <= 0)
{
return ApiResult.ParamIsNull("请传递商品数量");
}
if (item.SpecificationList == null || !item.SpecificationList.Any())
{
return ApiResult.ParamIsNull("请传递规格名SpecificationList");
}
item.Specification = JsonConvert.SerializeObject(item.SpecificationList);
}
if ((demodel.Income ?? 0) <= 0)
{
return ApiResult.ParamIsNull("订单金额不正确");
}
demodel.BuyerMessage ??= "";//买家留言
demodel.OrderSource ??= UserSourceEnum.WeiXin;
#region 赋默认值
demodel.TenantId = userInfo.TenantId;
demodel.MallBaseId = userInfo.MallBaseId;
demodel.Country ??= 2;
demodel.OrderStatus = Common.Enum.Goods.OrderStatusEnum.NonPayment;
demodel.CreateDate = DateTime.Now;
demodel.Fee ??= 0;
demodel.FreightMoney ??= 0;
demodel.HistoryOrderStatus ??= 0;
demodel.IsApplyForCancel ??= 2;
demodel.IsOrderCommission ??= 2;
demodel.MerchantsNo ??= "";
demodel.Recycled ??= 2;
demodel.Refund ??= 0;
demodel.Status = 0;
demodel.AnchorName ??= "";
demodel.UpdateDate = DateTime.Now;
demodel.UserId = userInfo.UserId;
demodel.SmallShopsId = parms.GetInt("NewShopId");
#endregion
return orderModule.SetAppletGoodsOrderInfo(demodel);
}
/// <summary>
/// ERP修改订单状态
/// </summary>
/// <returns></returns>
[HttpPost]
[AllowAnonymous]
public ApiResult UpdateERPGoodsOrderInfo()
{
var req = RequestParm;
JObject parms = JObject.Parse(req.msg.ToString());
RB_Goods_Order_Extend extModel = new RB_Goods_Order_Extend()
{
OrderId=parms.GetInt("OrderId"),
MerchantsNo=parms.GetStringValue("MerchantsNo"),
OrderStatus= OrderStatusEnum.WaitSendGoods,
PaymentTime=DateTime.Now,
};
RB_Goods_Online_Trade_Extend tradeModel = new RB_Goods_Online_Trade_Extend()
{
User_Id = parms.GetInt("User_Id"),
Type = 1,
OrderId = parms.GetInt("OrderId"),
Out_Trade_No = parms.GetStringValue("Out_Trade_No"),
Transaction_Id = parms.GetStringValue("Transaction_Id"),
PayWay = (OrderPayTypeEnum)parms.GetInt("PayWay"),
PayType = "JSAPI",
Money = parms.GetDecimal("Money"),
Remarks = parms.GetStringValue("Remarks"),
Pay_Result = 0,
Pay_Date = DateTime.Now,
IsRefund = 2,
RefundMoney = 0,
RefundStatus = 0,
RefundTrade_Order = "",
Refund_Id = "",
Refund_Date = null,
FinanceId = 0,
MallBaseId = 1,
TenantId = 1,
CreateDate = DateTime.Now,
};
bool flag = orderModule.UpdateERPGoodsOrderInfoModule(extModel, tradeModel);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
/// <summary>
/// 返佣初始化
/// </summary>
......
......@@ -214,6 +214,9 @@ namespace Mall.WebApi.Controllers.User
return ApiResult.CouponFailed(ResultCode.Fail, "", "");
// return ApiResult.Failed("未能查询到用户信息");
}
if (umodel.Blacklist == 1) {
return ApiResult.Failed("账号已被冻结,请联系运营商");
}
TokenUserInfo userInfo = new TokenUserInfo { uid = umodel.Id.ToString(), requestFrom = ApiRequestFromEnum.MiniProgram };
#region JWT
IDateTimeProvider provider = new UtcDateTimeProvider();
......
......@@ -14,7 +14,9 @@ using Newtonsoft.Json.Linq;
using Mall.Model.Extend.Product;
using Mall.Model.Extend.MarketingCenter;
using Mall.Module.BaseSetUp;
using Mall.Common;
using Mall.CacheManager.User;
using Microsoft.AspNetCore.Authorization;
namespace Mall.WebApi.Controllers.User
{
......@@ -145,10 +147,17 @@ namespace Mall.WebApi.Controllers.User
/// </summary>
/// <returns></returns>
[HttpPost]
[AllowAnonymous]
public ApiResult SetUserShippingAddress()
{
var req = RequestParm;
var userInfo = AppletUserInfo;
JObject prams = JObject.Parse(req.msg.ToString());
int NewUserId = prams.GetInt("NewUserId");
if (NewUserId > 0)
{
userInfo = UserReidsCache.GetAppletUserLoginInfo(NewUserId);
}
RB_Member_ShippingAddress_Extend demodel = JsonConvert.DeserializeObject<RB_Member_ShippingAddress_Extend>(req.msg.ToString());
if (string.IsNullOrEmpty(demodel.Name))
{
......@@ -672,8 +681,11 @@ namespace Mall.WebApi.Controllers.User
public ApiResult GerUserMyTeamTitelListForFX()
{
var userInfo = AppletUserInfo;
var obj = userModule.GerUserMyTeamTitelListForFX(userInfo);
var req = RequestParm;
JObject parms = JObject.Parse(req.msg.ToString());
//是否直属
int IsDirect= parms.GetInt("IsDirect", 0);
var obj = userModule.GerUserMyTeamTitelListForFX(userInfo, IsDirect: IsDirect);
return ApiResult.Success("", obj);
}
......
......@@ -155,6 +155,10 @@ namespace Mall.WebApi.Controllers.User
extModel.TenantId = RequestParm.TenantId;
extModel.CreateDate = DateTime.Now;
extModel.EmpPwd = Common.DES.Encrypt(extModel.EmpPwd, Common.Config.WebApiKey, Common.Config.WebApiIV);
if (module.CheckExistsEmployeeModule(extModel))
{
return ApiResult.Failed("此账号【" + extModel.EmpAccount + "】已存在,请重新填写账号!");
}
var flag = module.SetEmployeeModule(extModel);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
......
......@@ -89,16 +89,7 @@ namespace Mall.WebApi.Controllers.User
public ApiResult Login()
{
var query = JsonConvert.DeserializeObject<RB_Tenant_Extend>(RequestParm.msg.ToString());
var model = new RB_Tenant_Extend();
if (query.MallBaseId > 0)
{
model = TenantModule.GetTenantByMallModule(query);
}
else
{
model = TenantModule.GetTenantListModule(query).FirstOrDefault();
}
var model = TenantModule.GetTenantByMallModule(query);
if (model == null)
{
return ApiResult.Failed("未找到此用户");
......@@ -131,7 +122,6 @@ namespace Mall.WebApi.Controllers.User
//再查询是否存在是否是账号登陆
erpUserInfo = authorizeModule.GetNewByAccountAndPwd(authorizeModel.Account, authorizeModel.Password, authorizeModel.ERPGroupId);
}
if (erpUserInfo != null && !string.IsNullOrWhiteSpace(erpUserInfo.EmLoginMobile) && erpUserInfo.IsLeave == 0)
{
TokenUserInfo erpUserInfoToken = new TokenUserInfo { uid = erpUserInfo.EmployeeId.ToString(), requestFrom = Common.Enum.ApiRequestFromEnum.ERP };
......@@ -153,30 +143,10 @@ namespace Mall.WebApi.Controllers.User
string erpsecret = Config.JwtSecretKey;
erptoken = erpencoder.Encode(erppayload, erpsecret);
#endregion
//ERPUserInfo erpObj = new ERPUserInfo
//{
// Domain = authorizeModel.DomainName,
// emName = erpUserInfo.EmName,
// EmployeeId = erpUserInfo.EmployeeId,
// RB_Group_id = erpUserInfo.RB_Group_id,
// RB_Branch_id = erpUserInfo.RB_Branch_id,
// RB_Post_Id = erpUserInfo.RB_Post_Id,
// RB_Department_Id = erpUserInfo.RB_Department_Id,
// token = erptoken,
// SecretKey = erpUserInfo.SecretKey,
// //ImAccount = imAccount?.AccID ?? model.EmLoginMobile, //model.EmLoginMobile,
// //ImToken = IMService.DefaultPassword(),
//};
//UserReidsCache.UserInfoSet(UserModuleCacheKeyConfig.ERP_Login_Info_+ erpUserInfo.EmployeeId, erpObj, Config.JwtExpirTime);
}
}
}
#endregion
TokenUserInfo userInfo = new TokenUserInfo { uid = model.TenantId.ToString(), requestFrom = ApiRequestFromEnum.Web };
#region JWT
IDateTimeProvider provider = new UtcDateTimeProvider();
......@@ -212,9 +182,9 @@ namespace Mall.WebApi.Controllers.User
MallBaseId = 0,
EmpId = model.EmpId,
erptoken = erptoken,
ERPEmpId = erpUserInfo.EmployeeId,
ERPBranchId = erpUserInfo.RB_Branch_id,
ERPGroupId = erpUserInfo.RB_Group_id
ERPEmpId = (erpUserInfo?.EmployeeId??0),
ERPBranchId = (erpUserInfo?.RB_Branch_id??-1),
ERPGroupId = (erpUserInfo?.RB_Group_id??0)
};
UserReidsCache.UserInfoSet(UserModuleCacheKeyConfig.Mall_Login_Info + model.TenantId, obj, Config.JwtExpirTime);
return ApiResult.Success("", obj);
......
......@@ -3370,5 +3370,43 @@ namespace Mall.WebApi.Controllers.User
}));
}
#endregion
/// <summary>
/// 获取收货地址列表
/// </summary>
/// <returns></returns>
[HttpPost]
[AllowAnonymous]
public ApiResult GetShippingAddressList()
{
var req = RequestParm;
RB_Member_ShippingAddress_Extend demodel = JsonConvert.DeserializeObject<RB_Member_ShippingAddress_Extend>(req.msg.ToString());
JObject parms = JObject.Parse(req.msg.ToString());
demodel.TenantId = req.TenantId;
demodel.MallBaseId = req.MallBaseId;
demodel.UserId = req.UserId;
//HK2020-09-09新增用户Id
if (parms.GetInt("NewUserId") > 0)
{
demodel.UserId = parms.GetInt("NewUserId");
}
var list = userModule.GetUserShippingAddressList(demodel);
return ApiResult.Success("", list.Select(x => new
{
x.Id,
x.Name,
x.Mobile,
x.Country,
x.Province,
x.City,
x.District,
x.DistrictAddress,
x.Address,
x.PostCode,
x.Lonlat,
x.IsDefault,
UpdateDate = x.UpdateDate.HasValue ? x.UpdateDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : ""
}));
}
}
}
\ 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