Commit 3e70ccea authored by liudong1993's avatar liudong1993

Merge branch 'sdzq' of http://gitlab.oytour.com/Kui2/mall.oytour.com into sdzq-ld

parents e1c1ef13 1830f509
......@@ -311,4 +311,109 @@ namespace Mall.Common.Enum.Goods
[EnumField("备注/表单")]
BZBD = 27
}
/// <summary>
/// 教育订单列表导出选项枚举
/// </summary>
public enum OrderListExportForEducationEnum
{
/// <summary>
/// 所属平台
/// </summary>
[EnumField("所属平台")]
SSPT = 1,
/// <summary>
/// 订单号
/// </summary>
[EnumField("订单号")]
DDH = 2,
/// <summary>
/// 商户单号
/// </summary>
[EnumField("商户单号")]
SHDH = 3,
/// <summary>
/// 下单用户
/// </summary>
[EnumField("下单用户")]
XDYH = 4,
/// <summary>
/// 商品名
/// </summary>
[EnumField("商品名")]
SPM = 5,
/// <summary>
/// 副标题
/// </summary>
[EnumField("副标题")]
FBT = 28,
/// <summary>
/// 数量
/// </summary>
[EnumField("人数")]
SL = 7,
/// <summary>
/// 成本价
/// </summary>
[EnumField("成本价")]
CBJ = 9,
/// <summary>
/// 总金额
/// </summary>
[EnumField("总金额")]
ZJE = 10,
/// <summary>
/// 实际付款
/// </summary>
[EnumField("实际付款")]
SJFK = 11,
/// <summary>
/// 下单时间
/// </summary>
[EnumField("下单时间")]
XDSJ = 12,
/// <summary>
/// 支付方式
/// </summary>
[EnumField("支付方式")]
ZFFS = 13,
/// <summary>
/// 订单状态
/// </summary>
[EnumField("订单状态")]
DDZT = 14,
/// <summary>
/// 付款状态
/// </summary>
[EnumField("付款状态")]
FKZT = 15,
/// <summary>
/// 付款时间
/// </summary>
[EnumField("付款时间")]
FKSJ = 16,
/// <summary>
/// 老师
/// </summary>
[EnumField("老师")]
Teacher = 17,
/// <summary>
/// 卖家留言
/// </summary>
[EnumField("卖家留言")]
MJLY = 18,
/// <summary>
/// 商家备注
/// </summary>
[EnumField("商家备注")]
SJBZ = 19,
/// <summary>
/// 备注/表单
/// </summary>
[EnumField("备注/表单")]
BZBD = 20
}
}
......@@ -26,6 +26,16 @@ namespace Mall.Model.Extend.Product
/// 订单财务单据列表
/// </summary>
public List<RB_Finance_Extend> FinanceList { get; set; }
/// <summary>
/// 教师列表
/// </summary>
public List<RB_Goods_WK_Teacher_Extend> TeacherList { get; set; }
/// <summary>
/// 课程卡信息 //2020-10-11 Add By:w
/// </summary>
public List<Education.RB_Education_MemberCoupon_Extend> MemberEducationCouponList { get; set; }
/// <summary>
/// 是否直播订单
/// </summary>
......
......@@ -137,6 +137,9 @@ namespace Mall.Model.Extend.Product
/// 优惠券信息 //2020-08-25 Add By:w
/// </summary>
public List<User.RB_Member_DiscountCoupon_Extend> MemberDiscountCouponList { get; set; }
/// <summary>
/// 是否发放佣金 1是 2否
/// </summary>
......
......@@ -308,7 +308,14 @@ namespace Mall.Module.Product
/// </summary>
private RB_GuideCar_CarColorRepository guideCar_CarColorRepository = new RB_GuideCar_CarColorRepository();
/// <summary>
/// 教育订单对应的老师
/// </summary>
private RB_Goods_WK_TeacherRepository goodsWKTeacherRepository = new RB_Goods_WK_TeacherRepository();
/// <summary>
/// 教育对应的订单课程卡
/// </summary>
private Mall.Repository.Education.RB_Education_MemberCouponRepository educationMemberCouponRepository = new Mall.Repository.Education.RB_Education_MemberCouponRepository();
#region 购物车
/// <summary>
......@@ -3568,12 +3575,14 @@ namespace Mall.Module.Product
item.FreightMoney = Express;
item.CommentGiveIntegral = 0;
if (gmodel.IntegralComment > 0) {
if (gmodel.IntegralComment > 0)
{
if (gmodel.IntegralCommentType == 1)
{
item.CommentGiveIntegral = Convert.ToInt32(Math.Floor((gmodel.IntegralComment ?? 0) * (item.Final_Price ?? 0) / 100));
}
else {
else
{
item.CommentGiveIntegral = Convert.ToInt32((gmodel.IntegralComment ?? 0) * (item.Number ?? 0));
}
}
......@@ -3786,7 +3795,7 @@ namespace Mall.Module.Product
/// <param name="extModel"></param>
/// <param name="tradeModel"></param>
/// <returns></returns>
public bool UpdateERPGoodsOrderInfoModule(RB_Goods_Order_Extend extModel, RB_Goods_Online_Trade_Extend tradeModel,int FinanceId=0)
public bool UpdateERPGoodsOrderInfoModule(RB_Goods_Order_Extend extModel, RB_Goods_Online_Trade_Extend tradeModel, int FinanceId = 0)
{
bool flag = false;
Dictionary<string, object> fileds = new Dictionary<string, object>()
......@@ -3796,7 +3805,7 @@ namespace Mall.Module.Product
{nameof(RB_Goods_Order_Extend.PaymentTime),extModel.PaymentTime },
{nameof(RB_Goods_Order_Extend.Fee),extModel.Fee}
};
var detailsList= goods_OrderDetailRepository.GetOrderDetailList(new RB_Goods_OrderDetail_Extend() { OrderId = extModel.OrderId });
var detailsList = goods_OrderDetailRepository.GetOrderDetailList(new RB_Goods_OrderDetail_Extend() { OrderId = extModel.OrderId });
if (detailsList != null && detailsList.Count > 0)
{
foreach (var item in detailsList)
......@@ -3929,7 +3938,8 @@ namespace Mall.Module.Product
{
return ApiResult.Failed("商品服务类型不一致");
}
if (gmodel.CarType != GuideCarGoodsTypeEnum.Line) {
if (gmodel.CarType != GuideCarGoodsTypeEnum.Line)
{
item.Number = 1;//设置为单人 用于计算一口价
}
int uday = Convert.ToInt32((gmodel.UseDay ?? 0).Equals(Convert.ToDecimal(0.5)) ? 1 : (gmodel.UseDay ?? 0));
......@@ -4927,9 +4937,12 @@ namespace Mall.Module.Product
try
{
#region 司导商品处理
if (demodel.OrderClassify == 1) {
if (demodel.DetailList.Where(x => x.CarType != GuideCarGoodsTypeEnum.Line).Any()) {
foreach (var item in demodel.DetailList.Where(x => x.CarType != GuideCarGoodsTypeEnum.Line)) {
if (demodel.OrderClassify == 1)
{
if (demodel.DetailList.Where(x => x.CarType != GuideCarGoodsTypeEnum.Line).Any())
{
foreach (var item in demodel.DetailList.Where(x => x.CarType != GuideCarGoodsTypeEnum.Line))
{
item.Number = 1;//司导的 除了线路 其他的都算包车
}
}
......@@ -7137,6 +7150,363 @@ namespace Mall.Module.Product
return list;
}
/// <summary>
/// 获取教育后台订单分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="demodel"></param>
/// <returns></returns>
public List<RB_Goods_Order_Extend> GetEducationGoodsOrderPageList(int pageIndex, int pageSize, out long count, RB_Goods_Order_Extend demodel)
{
var list = goods_OrderRepository.GetEducationOrderPageList(pageIndex, pageSize, out count, demodel);
if (list.Any())
{
//查询订单明细
var dlist = goods_OrderDetailRepository.GetOrderDetailList(new RB_Goods_OrderDetail_Extend() { TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId, OrderIds = string.Join(",", list.Select(x => x.OrderId)) });
List<RB_Finance_Extend> flist = new List<RB_Finance_Extend>();
if (pageSize != 10000 && demodel.TenantId == 1)
{
//查询所有财务单据
string detailIds = string.Join(",", dlist.Select(x => x.Id));
flist = financeRepository.GetList(new RB_Finance_Extend() { ECOrderIds = string.Join(",", list.Select(x => x.OrderId)) });
}
//查询图片
List<RB_Material_Info_Extend> Mlist = new List<RB_Material_Info_Extend>();
if (dlist.Any())
{
//剑鱼兄需求 2020=07-30 再查询一次商品表
string GoodsIds = string.Join(",", dlist.Select(x => x.GoodsId).Distinct());
var GList = goodsRepository.GetSingleListForGoodsSubName(new RB_Goods_Extend() { TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId, GoodsIds = GoodsIds }, true);
//查询订单对应的老师
var teacherList = goodsWKTeacherRepository.GetList(new RB_Goods_WK_Teacher_Extend { TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId, GoodsIds = GoodsIds });
//查询订单详情对应的课程卡信息
string educationCouponIds = string.Join(",", dlist.Where(x => x.EducationCouponId > 0).Select(x => x.EducationCouponId).Distinct());
List<RB_Education_MemberCoupon_Extend> educationCouponList = new List<RB_Education_MemberCoupon_Extend>();
if (!string.IsNullOrWhiteSpace(educationCouponIds))
{
educationCouponList = educationMemberCouponRepository.GetList(new RB_Education_MemberCoupon_Extend { TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId, Ids = educationCouponIds });
}
foreach (var item in dlist)
{
item.CoverImagePath = item.CoverImage;
item.GoodsSubName = GList.Where(x => x.Id == item.GoodsId).FirstOrDefault()?.SubName ?? "";
item.FinanceList = flist.Where(x => x.ECOrderDetailId == item.Id).ToList();// 2020-08-19 新增财务单据列表
item.TeacherList = teacherList.Where(x => x.GoodsId == item.GoodsId).ToList();// 2020-10-11 订单对应的老师
item.MemberEducationCouponList = educationCouponList.Where(x => x.Id == item.EducationCouponId).ToList();// 2020-10-11 订单详情对应的课程卡
}
}
//2020-08-25 Add By:W Start
List<RB_Member_DiscountCoupon_Extend> memberCouponList = new List<RB_Member_DiscountCoupon_Extend>();
if (list.Any(x => !string.IsNullOrWhiteSpace(x.CouponsIds)))
{
memberCouponList = member_CouponRepository.GetList(new RB_Member_DiscountCoupon_Extend { TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId, UseState = -1, Ids = string.Join(",", list.Where(x => !string.IsNullOrWhiteSpace(x.CouponsIds)).Select(x => x.CouponsIds)) });
}
//2020-08-25 Add By:W End
foreach (var item in list)
{
item.DetailList = dlist.Where(x => x.OrderId == item.OrderId).ToList();
item.MemberDiscountCouponList = new List<RB_Member_DiscountCoupon_Extend>();
if (!string.IsNullOrWhiteSpace(item.CouponsIds))
{
foreach (var itemCoupons in item.CouponsIds.Split(','))
{
item.MemberDiscountCouponList.AddRange(memberCouponList.Where(x => itemCoupons == x.Id.ToString()));
}
}
}
}
return list;
}
/// <summary>
/// 获取教育后台订单信息
/// </summary>
/// <param name="orderId"></param>
/// <param name="tenantId"></param>
/// <param name="mallBaseId"></param>
/// <returns></returns>
public ApiResult GetEducationGoodsOrderInfo(int orderId, int tenantId, int mallBaseId)
{
var model = goods_OrderRepository.GetEntity(orderId).RefMapperTo<RB_Goods_Order_Extend>();
if (model == null)
{
return ApiResult.Failed("订单信息不存在,请核实后再试");
}
//查询订单所属微店 2020-08-14 Add By:W
if (model.SmallShopsId.HasValue && model.SmallShopsId > 0)
{
var smallShop = smallShopsInfoRepository.GetEntity(model.SmallShopsId ?? 0);
if (smallShop != null)
{
model.SmallShopsName = smallShop.Name;
}
}
// 2020-08-14 Add By:W End
//查询订单明细
var dlist = goods_OrderDetailRepository.GetOrderDetailList(new RB_Goods_OrderDetail_Extend() { TenantId = tenantId, MallBaseId = mallBaseId, OrderId = orderId });
//查询图片
List<RB_Material_Info_Extend> Mlist = new List<RB_Material_Info_Extend>();
if (dlist.Any())
{
//剑鱼兄需求 2020=07-30 再查询一次商品表
string GoodsIds = string.Join(",", dlist.Select(x => x.GoodsId).Distinct());
//查询订单对应的老师
var teacherList = goodsWKTeacherRepository.GetList(new RB_Goods_WK_Teacher_Extend { TenantId = tenantId, MallBaseId = mallBaseId, GoodsIds = GoodsIds });
List<RB_Education_MemberCoupon_Extend> educationCouponList = new List<RB_Education_MemberCoupon_Extend>();
//查询订单详情对应的课程卡信息
string educationCouponIds = string.Join(",", dlist.Where(x => x.EducationCouponId > 0).Select(x => x.EducationCouponId).Distinct());
if (!string.IsNullOrWhiteSpace(educationCouponIds))
{
educationCouponList = educationMemberCouponRepository.GetList(new RB_Education_MemberCoupon_Extend { TenantId = tenantId, MallBaseId = mallBaseId, Ids = educationCouponIds });
}
foreach (var item in dlist)
{
item.CoverImagePath = item.CoverImage;
item.TeacherList = teacherList.Where(x => x.GoodsId == item.GoodsId).ToList();// 2020-10-11 订单对应的老师
item.MemberEducationCouponList = educationCouponList.Where(x => x.Id == item.EducationCouponId).ToList();// 2020-10-11 订单详情对应的课程卡
}
}
model.DetailList = dlist;
//获取返佣列表
var ocList = goods_OrderCommissionRepository.GetListGroupByUser(new RB_Goods_OrderCommission_Extend() { TenantId = tenantId, MallBaseId = mallBaseId, OrderId = orderId }).OrderBy(x => x.Grade).ToList();
if (ocList.Any())
{
var FXGradeList = new List<RB_Distributor_FXGrade_Extend>();
if (ocList.Where(x => x.Type == 3).Any())
{
string gradeIds = string.Join(",", ocList.Where(x => x.Type == 3).Select(x => x.Grade).Distinct());
FXGradeList = distributor_FXGradeRepository.GetList(new RB_Distributor_FXGrade_Extend() { GradeIds = gradeIds, TenantId = tenantId, MallBaseId = mallBaseId });
}
var ulist = member_UserRepository.GetList(new RB_Member_User_Extend() { TenantId = tenantId, MallBaseId = mallBaseId, UserIds = string.Join(",", ocList.Select(x => x.UserId).Distinct()) });
foreach (var item in ocList)
{
var umodel = ulist.Where(x => x.Id == item.UserId).FirstOrDefault();
item.UserName = umodel?.Name ?? "";
item.Mobile = umodel?.Moblie ?? "";
if (item.Type == 1)
{
if (item.Grade == 0)
{
item.GradeDescription = "自购返利";
}
else if (item.Grade == 1)
{
item.GradeDescription = "一级佣金";
}
else if (item.Grade == 2)
{
item.GradeDescription = "二级佣金";
}
else if (item.Grade == 3)
{
item.GradeDescription = "三级佣金";
}
}
else if (item.Type == 3)
{
var fxGModel = FXGradeList.Where(x => x.Id == item.Grade).FirstOrDefault();
item.GradeDescription = fxGModel?.GradeName ?? "暂无等级";
}
}
}
var vipList = vip_BuyRepository.GetVipBuyList(new RB_Vip_Buy_Extend() { TenantId = tenantId, MallBaseId = mallBaseId, ReOrderId = model.OrderId });
List<RB_VipBuy_Commission_Extend> clist = new List<RB_VipBuy_Commission_Extend>();
if (vipList.Any())
{
string vipIds = string.Join(",", vipList.Select(x => x.Id));
clist = vipBuy_CommissionRepository.GetList(new RB_VipBuy_Commission_Extend() { TenantId = tenantId, MallBaseId = mallBaseId, OrderIds = vipIds });
var FXList = distributor_FXGradeRepository.GetList(new RB_Distributor_FXGrade_Extend() { TenantId = tenantId, MallBaseId = mallBaseId });
//获取用户
var ulist = new List<RB_Member_User_Extend>();
if (clist.Any())
{
ulist = member_UserRepository.GetList(new RB_Member_User_Extend() { TenantId = tenantId, MallBaseId = mallBaseId, UserIds = string.Join(",", clist.Select(x => x.UserId).Distinct()) });
foreach (var qitem in clist)
{
var fxmodel = FXList.Where(x => x.Id == qitem.Grade).FirstOrDefault();
qitem.GradeDescription = fxmodel.GradeName;
qitem.UserName = ulist.Where(x => x.Id == qitem.UserId).FirstOrDefault()?.Name ?? "";
}
}
}
#region 推荐返佣
List<RB_Goods_OrderIntroduction_Extend> OrderIntroduction = new List<RB_Goods_OrderIntroduction_Extend>();
var introductList = goods_OrderIntroductionRepository.GetList(new RB_Goods_OrderIntroduction_Extend() { TenantId = tenantId, MallBaseId = mallBaseId, OrderId = orderId });
if (introductList.Any())
{
var ulist = member_UserRepository.GetList(new RB_Member_User_Extend() { TenantId = tenantId, MallBaseId = mallBaseId, UserIds = string.Join(",", introductList.Select(x => x.UserId).Distinct()) });
foreach (var item in ulist)
{
decimal Commission = introductList.Where(x => x.UserId == item.Id).Sum(x => x.Commission ?? 0);
OrderIntroduction.Add(new RB_Goods_OrderIntroduction_Extend()
{
UserId = item.Id,
UserName = item.Name,
Commission = Commission
});
}
}
#endregion
#region 微店返佣
List<RB_SmallShops_Commission_Extend> SmallShopsCommission = new List<RB_SmallShops_Commission_Extend>();
var ssList = smallShops_CommissionRepository.GetList(new RB_SmallShops_Commission_Extend() { TenantId = tenantId, MallBaseId = mallBaseId, OrderId = orderId });
if (ssList.Any())
{
var ulist = member_UserRepository.GetList(new RB_Member_User_Extend() { TenantId = tenantId, MallBaseId = mallBaseId, UserIds = string.Join(",", ssList.Select(x => x.UserId).Distinct()) });
var slist = smallShops_InfoRepository.GetListForSingle(new RB_SmallShops_Info_Extend() { TenantId = tenantId, MallBaseId = mallBaseId, UserIds = string.Join(",", ssList.Select(x => x.UserId).Distinct()) });
foreach (var item in ulist)
{
decimal Commission = ssList.Where(x => x.UserId == item.Id).Sum(x => x.Commission ?? 0);
var smodel = slist.Where(x => x.UserId == item.Id).FirstOrDefault();
SmallShopsCommission.Add(new RB_SmallShops_Commission_Extend()
{
UserId = item.Id,
UserName = item.Name,
Name = smodel?.Name ?? "",
Commission = Commission
});
}
}
#endregion
#region 优惠券 2020-08-25 Add By:W Start
List<RB_Member_DiscountCoupon_Extend> memberCouponList = new List<RB_Member_DiscountCoupon_Extend>();
if (!string.IsNullOrWhiteSpace(model.CouponsIds))
{
memberCouponList = member_CouponRepository.GetList(new RB_Member_DiscountCoupon_Extend { TenantId = model.TenantId, MallBaseId = model.MallBaseId, UseState = -1, Ids = model.CouponsIds });
}
#endregion 2020-08-25 Add By:W End
return ApiResult.Success("", new
{
model.OrderId,
model.OrderStatus,
OrderStatusName = model.OrderStatus.GetEnumName(),
CreateDate = model.CreateDate.HasValue ? model.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
PaymentTime = model.PaymentTime.HasValue ? model.PaymentTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
DeliveryTime = model.DeliveryTime.HasValue ? model.DeliveryTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
ReceivingTime = model.ReceivingTime.HasValue ? model.ReceivingTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
FinishTime = model.FinishTime.HasValue ? model.FinishTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
CancelTime = model.CancelTime.HasValue ? model.CancelTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
model.Remark,
model.BuyerMessage,
model.PreferPrice,
model.Income,
model.FreightMoney,
CouponMoney = model.CouponMoney ?? 0,
EducationMoney = model.EducationMoney ?? 0,
IntegralMoney = (model.DetailList != null && model.DetailList.Any()) ? (model.DetailList.Sum(x => x.IntegralMoney ?? 0)) : 0,
IntegralNumber = (model.DetailList != null && model.DetailList.Any()) ? (model.DetailList.Sum(x => x.IntegralNumber ?? 0)) : 0,
MemberDiscountCouponList = memberCouponList.Select(y => new
{
y.Name,
y.MinConsumePrice,
y.MaxDiscountsPrice,
y.UseType,
y.CouponType,
y.DiscountsPrice
}),
OrderInfo = new
{
model.OrderNo,
model.MerchantsNo,
model.PaymentWay,
PaymentWayName = model.PaymentWay.GetEnumName(),
model.DeliveryMethod,
DeliveryMethodName = model.DeliveryMethod.GetEnumName(),
UserName = member_UserRepository.GetEntity(model.UserId)?.Name ?? "",
model.Consignee,
model.Mobile,
model.DistrictAddress,
model.ShoppingAddress,
model.Country,
model.Province,
model.City,
model.District,
model.SmallShopsName,
model.SmallShopsId
},
DistributionInfo = ocList.Select(x => new
{
x.Id,
x.Grade,
x.GradeDescription,
x.UserName,
x.Mobile,
x.Commission
}),
VipCommissionInfo = clist.Select(x => new
{
x.Id,
x.Grade,
x.GradeDescription,
x.UserName,
x.Commission
}),
OrderIntroductionInfo = OrderIntroduction.Select(x => new
{
x.UserId,
x.UserName,
x.Commission
}),
SmallShopsCommissionInfo = SmallShopsCommission.Select(x => new
{
x.UserId,
x.UserName,
SmallShopsName = x.Name,
x.Commission
}),
DetailList = model.DetailList.Select(x => new
{
x.Id,
x.GoodsName,
x.CoverImage,
x.CoverImagePath,
SpecificationList = x.TeacherList.Select(y => y.Name), //JsonConvert.DeserializeObject<List<string>>(x.Specification),
x.Unit_Price,
x.Number,
x.Original_Price,
x.Final_Price,
x.IsBindExpress,
x.FreeShippingRemarks,
x.SmallShopsCostPrice,
CouponMoney = x.CouponMoney ?? 0,
InsuranceMoney = x.InsuranceMoney ?? 0,
IntegralMoney = x.IntegralMoney ?? 0,
IntegralNumber = x.IntegralNumber ?? 0,
MemberEducationCouponList = x.MemberEducationCouponList.Select(z => new
{
z.Name,
z.UseHeXiao,
z.HeXiao
}),
})
});
}
/// <summary>
/// 获取直播订单分页列表
/// </summary>
......@@ -8307,8 +8677,10 @@ namespace Mall.Module.Product
var item = financeConfigurineList.FirstOrDefault();
var dlist = goods_OrderDetailRepository.GetOrderDetailList(new RB_Goods_OrderDetail_Extend() { OrderId = dmodel.OrderId ?? 0 });
string Remark1 = "";
if (dlist.Any()) {
foreach (var qqitem in dlist) {
if (dlist.Any())
{
foreach (var qqitem in dlist)
{
Remark1 += qqitem.GoodsName + " " + qqitem.Specification + " ";
}
}
......@@ -9493,7 +9865,8 @@ namespace Mall.Module.Product
{
var uclist = education_MemberUseCouponRepository.GetList(new Model.Entity.Education.RB_Education_MemberUseCoupon() { OrderId = omodel.OrderId });
var ucModel = uclist.FirstOrDefault();
if (ucModel != null) {
if (ucModel != null)
{
Dictionary<string, object> keyValues1 = new Dictionary<string, object>() {
{ nameof(Model.Entity.Education.RB_Education_MemberUseCoupon.Status),1}
};
......@@ -9569,8 +9942,10 @@ namespace Mall.Module.Product
var item = financeConfigurineList.FirstOrDefault();
var dlist = goods_OrderDetailRepository.GetOrderDetailList(new RB_Goods_OrderDetail_Extend() { OrderId = omodel.OrderId });
string Remark1 = "";
if (dlist.Any()) {
foreach (var qqitem in dlist) {
if (dlist.Any())
{
foreach (var qqitem in dlist)
{
Remark1 += qqitem.GoodsName + " " + qqitem.Specification + " ";
}
}
......
......@@ -592,7 +592,7 @@ namespace Mall.WebApi.Controllers.MallBase
case 24:
datarow.ExcelRows.Add(new ExcelColumn(value: item.ReceivingTime.HasValue ? item.ReceivingTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : "") { }); break;
case 29:
datarow.ExcelRows.Add(new ExcelColumn(value: (item2.GuideName??"")) { }); break;
datarow.ExcelRows.Add(new ExcelColumn(value: (item2.GuideName ?? "")) { }); break;
case 30:
datarow.ExcelRows.Add(new ExcelColumn(value: (item2.CarName ?? "")) { }); break;
case 31:
......@@ -1327,14 +1327,17 @@ namespace Mall.WebApi.Controllers.MallBase
JObject parms = JObject.Parse(req.msg.ToString());
int OrderId = parms.GetInt("OrderId", 0);
int Type = parms.GetInt("Type", 1);//类型 1确认 2出行 3完成
if (OrderId <= 0) {
if (OrderId <= 0)
{
return ApiResult.ParamIsNull("请传递订单id");
}
var omodel = orderModule.GetOrderInfo(OrderId);
if (omodel == null) {
if (omodel == null)
{
return ApiResult.ParamIsNull("订单信息不存在");
}
if (omodel.OrderClassify != 1) {
if (omodel.OrderClassify != 1)
{
return ApiResult.ParamIsNull("该订单不是司导订单");
}
if (Type == 1)
......@@ -1358,7 +1361,8 @@ namespace Mall.WebApi.Controllers.MallBase
return ApiResult.ParamIsNull("订单状态不正确,请核实后再试");
}
}
else {
else
{
return ApiResult.Failed();
}
......@@ -1367,7 +1371,8 @@ namespace Mall.WebApi.Controllers.MallBase
{
return ApiResult.Success();
}
else {
else
{
return ApiResult.Failed();
}
}
......@@ -1406,6 +1411,409 @@ namespace Mall.WebApi.Controllers.MallBase
#endregion
#region 教育订单
/// <summary>
/// 商品订单后台分页列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetEducationGoodsOrderPageList()
{
var parms = RequestParm;
JObject newParms = JObject.Parse(RequestParm.msg.ToString());
ResultPageModel pagelist = JsonConvert.DeserializeObject<ResultPageModel>(parms.msg.ToString());
RB_Goods_Order_Extend demodel = new RB_Goods_Order_Extend()
{
UserName = newParms.GetStringValue("UserName"),
OrderSource = (UserSourceEnum)newParms.GetInt("OrderSource"),
OrderType = newParms.GetInt("OrderType"),
OrderId = newParms.GetInt("OrderId"),
StartTime = newParms.GetStringValue("StartTime"),
EndTime = newParms.GetStringValue("EndTime"),
OrderStatus = (OrderStatusEnum)newParms.GetInt("OrderStatus"),
OrderNo = newParms.GetStringValue("OrderNo"),
MerchantsNo = newParms.GetStringValue("MerchantsNo"),
UserId = newParms.GetInt("UserId"),
GoodsName = newParms.GetStringValue("GoodsName"),
Consignee = newParms.GetStringValue("Consignee"),
Recycled = newParms.GetInt("Recycled"),
AnchorName = newParms.GetStringValue("AnchorName"),
IsSelectPayMoney = newParms.GetInt("IsSelectPayMoney", 0)
};
demodel.TenantId = parms.TenantId;
demodel.MallBaseId = parms.MallBaseId;
demodel.OrderClassify = 2;
var list = orderModule.GetEducationGoodsOrderPageList(pagelist.pageIndex, pagelist.pageSize, out long count, demodel);
pagelist.count = Convert.ToInt32(count);
pagelist.pageData = list.Select(x => new
{
x.OrderId,
x.OrderNo,
x.MerchantsNo,
x.OrderSource,
OrderSourceName = x.OrderSource.GetEnumName(),
x.UserId,
x.UserName,
x.DeliveryMethod,
DeliveryMethodName = x.DeliveryMethod.GetEnumName(),
x.Income,
x.FreightMoney,
x.PaymentWay,
PaymentWayName = x.PaymentWay.GetEnumName(),
CouponMoney = x.CouponMoney ?? 0,
EducationMoney = x.EducationMoney ?? 0,
IntegralMoney = (x.DetailList != null && x.DetailList.Any()) ? (x.DetailList.Sum(x => x.IntegralMoney ?? 0)) : 0,
IntegralNumber = (x.DetailList != null && x.DetailList.Any()) ? (x.DetailList.Sum(x => x.IntegralNumber ?? 0)) : 0,
MemberDiscountCouponList = x.MemberDiscountCouponList.Select(y => new
{
y.Name,
y.MinConsumePrice,
y.MaxDiscountsPrice,
y.UseType,
y.CouponType,
y.DiscountsPrice
}),
DetailList = x.DetailList.Select(y => new
{
y.SupplierId,
y.SupplierName,
y.FreightCostMoney,
y.FreightMoney,
y.CostMoney,
y.Id,
y.CoverImage,
y.CoverImagePath,
y.OrderType,
OrderTypeName = y.OrderType.GetEnumName(),
y.GoodsName,
SpecificationList = y.TeacherList.Select(x => x.Name),
y.ProductCode,
y.Final_Price,
y.Number,
y.IsBindExpress,
y.FreeShippingRemarks,
y.SmallShopsCostPrice,
y.YSMoney,
y.RealMoney,
y.YFMoney,
y.PayMoney,
CouponMoney = y.CouponMoney ?? 0,
InsuranceMoney = y.InsuranceMoney ?? 0,
InsuranceCostMoney = y.InsuranceCostMoney ?? 0,
IntegralMoney = y.IntegralMoney ?? 0,
IntegralNumber = y.IntegralNumber ?? 0,
MemberEducationCouponList = y.MemberEducationCouponList.Select(z => new
{
z.Name,
}),
SFinanceList = y.FinanceList.Where(z => z.Type == 1).Select(z => new
{
z.FrID,
z.Status,
z.Is_Cashier
}),
ZFinanceList = y.FinanceList.Where(z => z.Type == 2).Select(z => new
{
z.FrID,
z.Status,
z.Is_Cashier
})
}),
x.Consignee,
x.Mobile,
x.DistrictAddress,
x.ShoppingAddress,
x.BuyerMessage,
x.Remark,
x.OrderStatus,
OrderStatusName = x.OrderStatus.GetEnumName(),
PaymentTime = x.PaymentTime.HasValue ? x.PaymentTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
DeliveryTime = x.DeliveryTime.HasValue ? x.DeliveryTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
ReceivingTime = x.ReceivingTime.HasValue ? x.ReceivingTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
FinishTime = x.FinishTime.HasValue ? x.FinishTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
x.Country,
x.Province,
x.City,
x.District,
x.TenantId,
x.MallBaseId,
x.SmallShopsId,
x.SmallShopsName,
CreateDate = x.CreateDate.HasValue ? x.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : ""
});
return ApiResult.Success("", pagelist);
}
/// <summary>
/// 获取订单详情
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetEducationGoodsOrderInfo()
{
var req = RequestParm;
JObject parms = JObject.Parse(req.msg.ToString());
int OrderId = parms.GetInt("OrderId", 0);
if (OrderId <= 0)
{
return ApiResult.Failed();
}
return orderModule.GetEducationGoodsOrderInfo(OrderId, req.TenantId, req.MallBaseId);
}
/// <summary>
/// 获取商品订单导出选项列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetEducationOrderListExportForEnumList()
{
var list = EnumHelper.GetEnumList(typeof(OrderListExportForEducationEnum));
return ApiResult.Success("", list.Select(x => new
{
Name = x.Key,
Id = Convert.ToInt32(x.Value)
}));
}
/// <summary>
/// 商品订单下载
/// </summary>
[HttpPost]
public FileContentResult GetEduGoodsOrderListToExcel()
{
var parms = RequestParm;
RB_Goods_Order_Extend demodel = JsonConvert.DeserializeObject<RB_Goods_Order_Extend>(parms.msg.ToString());
string ExcelName = "教育订单列表" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls";
List<ExcelDataSource> slist = new List<ExcelDataSource>();
if (demodel.ExcelEnumIds == null || !demodel.ExcelEnumIds.Any())
{
var byteData1 = ExcelTempLateHelper.ToExcelExtend(slist);
return File(byteData1, "application/octet-stream", ExcelName);
}
var Enumlist = EnumHelper.GetEnumList(typeof(OrderListExportForEducationEnum));
ExcelDataSource header = new ExcelDataSource()
{
ExcelRows = new List<ExcelColumn>(30) {
new ExcelColumn(value: "序号") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER }
}
};
foreach (var item in demodel.ExcelEnumIds)
{
var Name = Enumlist.Where(x => x.Value == item.ToString()).FirstOrDefault().Key ?? "";
header.ExcelRows.Add(new ExcelColumn(value: Name) { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER });
}
slist.Add(header);
try
{
demodel.TenantId = Convert.ToInt32(parms.uid);
demodel.MallBaseId = parms.MallBaseId;
if (!(demodel.OrderStatus > 0))
{
demodel.IsNotSelectCancel = 1;
}
var list = orderModule.GetEducationGoodsOrderPageList(1, 10000, out long count, demodel);
#region 组装数据
int Num = 0;
foreach (var item in list)
{
foreach (var item2 in item.DetailList)
{
Num++;
ExcelDataSource datarow = new ExcelDataSource()
{
ExcelRows = new List<ExcelColumn>(20) {
new ExcelColumn(value:Num.ToString()){ },
},
ColumnHight = 30
};
foreach (var qitem in demodel.ExcelEnumIds)
{
switch (qitem)
{
case 1:
datarow.ExcelRows.Add(new ExcelColumn(value: item.OrderSource.GetEnumName()) { }); break;
case 2:
datarow.ExcelRows.Add(new ExcelColumn(value: item.OrderNo) { }); break;
case 3:
datarow.ExcelRows.Add(new ExcelColumn(value: item.MerchantsNo) { }); break;
case 4:
datarow.ExcelRows.Add(new ExcelColumn(value: item.UserName) { }); break;
case 5:
datarow.ExcelRows.Add(new ExcelColumn(value: item2.GoodsName) { }); break;
case 28:
datarow.ExcelRows.Add(new ExcelColumn(value: item2.GoodsSubName) { }); break;
case 7:
datarow.ExcelRows.Add(new ExcelColumn(value: (item2.Number ?? 0).ToString()) { }); break;
case 9:
datarow.ExcelRows.Add(new ExcelColumn(value: (item2.CostMoney ?? 0).ToString()) { }); break;
case 10:
datarow.ExcelRows.Add(new ExcelColumn(value: (item2.Original_Price ?? 0).ToString()) { }); break;
case 11:
datarow.ExcelRows.Add(new ExcelColumn(value: (item2.Final_Price ?? 0).ToString()) { }); break;
case 12:
datarow.ExcelRows.Add(new ExcelColumn(value: item.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss")) { }); break;
case 13:
datarow.ExcelRows.Add(new ExcelColumn(value: item.PaymentWay.GetEnumName()) { }); break;
case 14:
datarow.ExcelRows.Add(new ExcelColumn(value: item.OrderStatus.GetEnumName()) { }); break;
case 15:
datarow.ExcelRows.Add(new ExcelColumn(value: item.OrderStatus > OrderStatusEnum.NonPayment ? "已付款" : "未付款") { }); break;
case 16:
datarow.ExcelRows.Add(new ExcelColumn(value: item.PaymentTime.HasValue ? item.PaymentTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : "") { }); break;
case 17:
datarow.ExcelRows.Add(new ExcelColumn(value: (item2.TeacherList != null && item2.TeacherList.Any() ? (string.Join(",", item2.TeacherList.Select(x => x.Name))):"")) { }); break;
case 18:
datarow.ExcelRows.Add(new ExcelColumn(value: "") { }); break;
case 19:
datarow.ExcelRows.Add(new ExcelColumn(value: item.Remark) { }); break;
case 20:
datarow.ExcelRows.Add(new ExcelColumn(value: item.BuyerMessage) { }); break;
}
}
slist.Add(datarow);
}
}
#endregion
var byteData = ExcelTempLateHelper.ToExcelExtend(slist);
return File(byteData, "application/octet-stream", ExcelName);
}
catch (Exception ex)
{
LogHelper.Write(ex, string.Format("GetFileFromWebApi_requestData: {0}", JsonHelper.Serialize(RequestParm)));
var byteData1 = ExcelTempLateHelper.ToExcelExtend(slist);
return File(byteData1, "application/octet-stream", ExcelName);
}
}
/// <summary>
/// 后台订单强制取消
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetEducationOrderForcedToCancel()
{
var req = RequestParm;
JObject parms = JObject.Parse(req.msg.ToString());
int OrderId = parms.GetInt("OrderId", 0);
//string Remark = parms.GetStringValue("Remark");
if (OrderId <= 0)
{
return ApiResult.ParamIsNull();
}
var omodel = orderModule.GetOrderInfo(OrderId);
if (omodel == null)
{
return ApiResult.Failed("订单不存在");
}
if (omodel.Status == 1)
{
return ApiResult.Failed("订单已删除");
}
if (omodel.Recycled == 1)
{
return ApiResult.Failed("订单已进入回收站无法操作");
}
if (omodel.OrderStatus != OrderStatusEnum.NonPayment && omodel.OrderStatus != OrderStatusEnum.WaitSendGoods)
{
return ApiResult.Failed("该订单已无法取消");
}
int IsNormalServer = Convert.ToInt32(new ConfigurationBuilder().Add(new JsonConfigurationSource { Path = "appsettings.json" }).Build().GetSection("IsNormalServer").Value);
if (IsNormalServer == 1 && omodel.OrderStatus == OrderStatusEnum.WaitSendGoods && omodel.OrderSource != UserSourceEnum.ERP)
{
//获取小程序信息
var mallModel = orderModule.GetMiniProgramExtend(req.MallBaseId);
int RefundNum = orderModule.GetOrderRefundOnlineTradeNum(OrderId, req.TenantId, req.MallBaseId);
string RefundOrderNo = omodel.OrderNo + (RefundNum + 1);
var pram = new Common.Pay.WeChatPat.PayParam()
{
TotalFee = Convert.ToInt32((omodel.Income ?? 0) * 100),
RefundFee = Convert.ToInt32((omodel.Income ?? 0) * 100),
OrderNumber = omodel.MerchantsNo,
RefundNumber = RefundOrderNo
};
var Robj = new App_Code.PayUtil().Refund(pram, mallModel, _accessor);
if (Robj.IsSuccess)
{
//获取商品信息
var orderGoodsList = orderModule.GetOrderDetailList(new RB_Goods_OrderDetail_Extend { TenantId = omodel.TenantId, MallBaseId = omodel.MallBaseId, OrderId = omodel.OrderId });
string goodsName = orderGoodsList.FirstOrDefault().GoodsName;
if (orderGoodsList.Count > 1)
{
if (goodsName.Length > 12)
{
goodsName = goodsName.Substring(0, 11) + "..";
}
goodsName += "等" + orderGoodsList.Count + "件商品";
}
else
{
if (goodsName.Length > 18)
{
goodsName = goodsName.Substring(0, 18) + "..";
}
}
//退款成功发送退款成功的订阅消息
//根据订单下单人获取openid
var userModel = orderModule.GetMemberUserInfo(omodel.UserId.Value);
if (userModel != null)
{
miniProgramMsgModule.SendOrderRefundMsg(mallModel.TenantId.Value, mallModel.MallBaseId, userModel.OpenId, "已退款,请注意查收", omodel.OrderNo, (omodel.Income ?? 0).ToString(), goodsName);
}
var dic = ((Dictionary<string, string>)Robj.Data);
bool flag = orderModule.SetOrderForcedToCancel(omodel, RefundOrderNo, req.TenantId, req.MallBaseId, Common.Enum.Goods.OrderPayTypeEnum.WeChatPay, dic["dPrice"], dic["sOrderNo"], dic["sTradeNo"], dic["refundid"]);
if (flag)
{
return ApiResult.Success();
}
else
{
return ApiResult.Failed();
}
}
else
{
LogHelper.Write(JsonConvert.SerializeObject(Robj));
return ApiResult.Failed();
}
}
else
{
bool flag = orderModule.SetOrderForcedToCancel(omodel, "", req.TenantId, req.MallBaseId, Common.Enum.Goods.OrderPayTypeEnum.WeChatPay, "", "", "", "");
if (flag)
{
return ApiResult.Success();
}
else
{
return ApiResult.Failed();
}
}
}
#endregion
#region 修改运费成本以及商品成本、供应商
/// <summary>
/// 修改订单商品成本运费
......@@ -3143,7 +3551,8 @@ namespace Mall.WebApi.Controllers.MallBase
return ApiResult.Failed();
}
}
else if (IsNormalServer == 1 && omodel.OrderSource == UserSourceEnum.ERP) {
else if (IsNormalServer == 1 && omodel.OrderSource == UserSourceEnum.ERP)
{
bool refundflag = orderModule.SetMallOrderSalesTheWayRefund(omodel.OrderId, ReModel.FinanceId);
if (refundflag)
{
......@@ -3157,7 +3566,8 @@ namespace Mall.WebApi.Controllers.MallBase
return ApiResult.Failed();
}
}
else {
else
{
LogHelper.Write("调用erp退款接口失败");
return ApiResult.Failed();
}
......
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