Commit f12257b9 authored by liudong1993's avatar liudong1993

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

parents a1219fd1 ace21744
using Mall.Common.Plugin;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Mall.Common.Enum.Goods
{
/// <summary>
/// 订单状态枚举
/// </summary>
public enum GuidCarOrderStatusEnum
{
/// <summary>
/// 未付款
/// </summary>
[EnumField("未付款")]
NonPayment = 1,
/// <summary>
/// 待确认
/// </summary>
[EnumField("待确认")]
WaitSendGoods = 2,
/// <summary>
/// 待出行
/// </summary>
[EnumField("待出行")]
WaitReceiving = 3,
/// <summary>
/// 出行中
/// </summary>
[EnumField("出行中")]
Received = 4,
/// <summary>
/// 已完成
/// </summary>
[EnumField("已完成")]
Completed = 5,
/// <summary>
/// 待处理
/// </summary>
[EnumField("待处理")]
WaitDeal = 6,
/// <summary>
/// 已取消
/// </summary>
[EnumField("已取消")]
Cancel = 7
}
}
......@@ -39,6 +39,25 @@ namespace Mall.Model.Entity.Product
get;
set;
}
/// <summary>
/// 导游id
/// </summary>
public int? GuideId
{
get;
set;
}
/// <summary>
/// 车辆id
/// </summary>
public int? CarId
{
get;
set;
}
/// <summary>
/// 客人名称
/// </summary>
......@@ -67,6 +86,20 @@ namespace Mall.Model.Entity.Product
/// 评分 1-5分
/// </summary>
public int? CommentScore { get; set; }
/// <summary>
/// 评分 1-5分
/// </summary>
public int? GuideScore { get; set; }
/// <summary>
/// 评分 1-5分
/// </summary>
public int? CarScore { get; set; }
/// <summary>
/// 评论内容
/// </summary>
......
......@@ -29,6 +29,11 @@ namespace Mall.Model.Extend.GuideCar
/// </summary>
public int OrderNum { get; set; }
/// <summary>
/// 订单人数
/// </summary>
public int OrderGuestNum { get; set; }
/// <summary>
/// 商品数
/// </summary>
......
......@@ -37,5 +37,16 @@ namespace Mall.Model.Extend.Product
/// 评论数量
/// </summary>
public int CommentNum { get; set; }
/// <summary>
/// 评论总分
/// </summary>
public decimal TotalCarScore { get; set; }
/// <summary>
/// 评论总分
/// </summary>
public decimal TotalGuideScore { get; set; }
}
}
......@@ -231,6 +231,62 @@ namespace Mall.Model.Extend.Product
/// </summary>
public string DName { get; set; }
#endregion
#region 司导信息
/// <summary>
/// 导游名称
/// </summary>
public string GuideName { get; set; }
/// <summary>
/// 从业年限
/// </summary>
public decimal GuideWorkYears { get; set; }
/// <summary>
/// 用户评分
/// </summary>
public decimal GuideScore { get; set; }
/// <summary>
/// 联系电话
/// </summary>
public string GuideTelephone { get; set; }
/// <summary>
/// 头像
/// </summary>
public string GuidePhoto { get; set; }
/// <summary>
/// 车辆名称
/// </summary>
public string CarName { get; set; }
/// <summary>
/// 车辆颜色
/// </summary>
public string CarColorName { get; set; }
/// <summary>
/// 车辆类型
/// </summary>
public int? CarClass { get; set; }
/// <summary>
/// 车辆品牌
/// </summary>
public int? CarBrandId { get; set; }
#endregion
}
......
......@@ -31,6 +31,7 @@ namespace Mall.Module.Product
/// </summary>
public class GuideCarModule
{
/// <summary>
/// 素材分组
/// </summary>
......@@ -108,6 +109,14 @@ namespace Mall.Module.Product
/// </summary>
private readonly RB_Goods_OrderRepository goods_OrderRepository = new RB_Goods_OrderRepository();
/// <summary>
/// 订单明细
/// </summary>
private readonly RB_Goods_OrderDetailRepository goods_OrderDetailRepository = new RB_Goods_OrderDetailRepository();
/// <summary>
/// 商品评论
/// </summary>
private readonly RB_Goods_CommentRepository goods_CommentRepository = new RB_Goods_CommentRepository();
/// <summary>
/// 地区处理
/// </summary>
private readonly Rb_destinationRepository destinationRepository = new Rb_destinationRepository();
......@@ -2892,11 +2901,27 @@ namespace Mall.Module.Product
/// <summary>
/// 导游配置
///导游列表
/// </summary>
/// <param name="query"></param>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_GuideCar_Guide_Extend> GetGuideCarGuideList(RB_GuideCar_Guide_Extend query)
public RB_GuideCar_Guide_Extend GetGuideCarGuideOrderInfo(RB_GuideCar_Guide_Extend query)
{
RB_GuideCar_Guide_Extend model = GuideRepository.GetGuideCarGuideModel(query).FirstOrDefault();
return model;
}
/// <summary>
/// 导游配置
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_GuideCar_Guide_Extend> GetGuideCarGuideList(RB_GuideCar_Guide_Extend query)
{
return GuideRepository.GetGuideCarGuideList(query);
}
......@@ -3391,5 +3416,152 @@ namespace Mall.Module.Product
return flag;
}
#endregion
#region 司导评论
/// <summary>
/// 管理新增评论
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public bool SetGoodsCommentInfo(RB_Goods_Comment_Extend demodel)
{
RB_Goods_OrderDetail dmodel = new RB_Goods_OrderDetail();
if (demodel.OrderDetailId > 0)
{
dmodel = goods_OrderDetailRepository.GetEntity(demodel.OrderDetailId);
if (dmodel == null) { return false; }
if (dmodel.IsComment == 1) { return false; }
}
bool flag = goods_CommentRepository.Insert(demodel) > 0;
if (flag)
{
if (demodel.OrderDetailId > 0)
{
//更新订单商品为已评价
Dictionary<string, object> keyValues = new Dictionary<string, object>() {
{ nameof(RB_Goods_OrderDetail.IsComment),1}
};
List<WhereHelper> wheres = new List<WhereHelper>() {
new WhereHelper(){
FiledName=nameof(RB_Goods_OrderDetail.Id),
FiledValue=demodel.OrderDetailId,
OperatorEnum=OperatorEnum.Equal
}
};
goods_OrderDetailRepository.Update(keyValues, wheres);
//更新订单对应对应的车辆和导游评分
//先查找已评论的车辆信息
if (dmodel.CarId.HasValue && dmodel.CarId.Value > 0)
{
var carScoreList = goods_CommentRepository.GetAppletGoodsCommentscore(dmodel.CarId.Value, 0, dmodel.TenantId, dmodel.MallBaseId);
decimal carScore = 0;
if (carScoreList != null && carScoreList.Any())
{
carScore = (carScoreList.FirstOrDefault().TotalCarScore + (Convert.ToDecimal(demodel.CarScore ?? 0))) / (carScoreList.FirstOrDefault().CommentNum + 1);
}
else
{
carScore = Convert.ToDecimal(demodel.CarScore);
}
if (carScore > 0)//更新车辆的评分
{
//更新订单商品为已评价
Dictionary<string, object> keyValuesCar = new Dictionary<string, object>() {
{ nameof(RB_GuideCar_Car.Score),Math.Round(carScore,1, MidpointRounding.AwayFromZero)}
};
List<WhereHelper> wheresCar = new List<WhereHelper>() {
new WhereHelper(){
FiledName=nameof(RB_GuideCar_Car.ID),
FiledValue=dmodel.CarId,
OperatorEnum=OperatorEnum.Equal
}
};
GuideCarRepository.Update(keyValuesCar, wheresCar);
}
}
if (dmodel.GuideId.HasValue && dmodel.GuideId.Value > 0)
{
decimal guidScore = 0;
var guideScoreList = goods_CommentRepository.GetAppletGoodsCommentscore(0, dmodel.GuideId.Value, dmodel.TenantId, dmodel.MallBaseId);
if (guideScoreList != null && guideScoreList.Any())
{
guidScore = (guideScoreList.FirstOrDefault().TotalCarScore + (Convert.ToDecimal(demodel.GuideScore ?? 0))) / (guideScoreList.FirstOrDefault().CommentNum + 1);
}
else
{
guidScore = Convert.ToDecimal(demodel.GuideScore);
}
if (guidScore > 0)//更新车辆的评分
{
//更新订单商品为已评价
Dictionary<string, object> keyValuesCar = new Dictionary<string, object>() {
{ nameof(RB_GuideCar_Guide.Score),Math.Round(guidScore,1, MidpointRounding.AwayFromZero)}
};
List<WhereHelper> wheresCar = new List<WhereHelper>() {
new WhereHelper(){
FiledName=nameof(RB_GuideCar_Guide.ID),
FiledValue=dmodel.GuideId,
OperatorEnum=OperatorEnum.Equal
}
};
GuideRepository.Update(keyValuesCar, wheresCar);
}
}
}
}
return flag;
}
/// <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> GetAppletGoodsMyOrderPageList(int pageIndex, int pageSize, out long count, RB_Goods_Order_Extend demodel)
{
var list = goods_OrderRepository.GetGuidecarOrderPageList(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)) });
foreach (var item in dlist)
{
item.CoverImagePath = item.CoverImage;
}
string areaIds1 = string.Join(",", list.Select(x => x.Province ?? 0).Distinct());
string areaIds2 = string.Join(",", list.Select(x => x.City ?? 0).Distinct());
string areaIds3 = string.Join(",", list.Select(x => x.District ?? 0).Distinct());
string areaIds = "0";
if (!string.IsNullOrEmpty(areaIds1))
{
areaIds += "," + areaIds1;
}
if (!string.IsNullOrEmpty(areaIds2))
{
areaIds += "," + areaIds2;
}
if (!string.IsNullOrEmpty(areaIds3))
{
areaIds += "," + areaIds3;
}
var arealist = destinationRepository.GetDictvalueListForIds(areaIds);
foreach (var item in list)
{
item.DetailList = dlist.Where(x => x.OrderId == item.OrderId).ToList();
if (item.DetailList.Where(x => x.PresentFXGrade > 0).Any())
{
item.PresentFXGrade = 1;
}
item.DistrictAddress = (arealist.Where(x => x.ID == item.Province).FirstOrDefault()?.Name ?? "") + " " + (arealist.Where(x => x.ID == item.City).FirstOrDefault()?.Name ?? "") + " " + (arealist.Where(x => x.ID == item.District).FirstOrDefault()?.Name ?? "");
}
}
return list;
}
#endregion
}
}
......@@ -32,7 +32,11 @@ namespace Mall.Repository.GuideCar
public List<RB_GuideCar_Car_Extend> GetPageListRepository(int pageIndex, int pageSize, out long rowCount, RB_GuideCar_Car_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.Append($" SELECT a.*,b.`Name` as CarBrand FROM {TableName} as a LEFT JOIN {CarBrandTableName} as b on a.CarBrandId=b.ID WHERE a.{nameof(RB_GuideCar_Car_Extend.Status)}=0");
builder.Append(@$" SELECT a.*,b.`Name` as CarBrand,c.GoodsNum,d.OrderNum FROM {TableName} as a LEFT JOIN {CarBrandTableName} as b on a.CarBrandId=b.ID
LEFT JOIN (SELECT CarId,COUNT(*) as GoodsNum from rb_goods where `Status`=0 GROUP BY CarId) as c on a.ID=c.CarId
LEFT JOIN (SELECT CarId,COUNT(*) as OrderNum from rb_goods_orderdetail as od
LEFT JOIN rb_goods_order as o on od.OrderId=o.OrderId where o.`Status`=0 and o.OrderStatus !=7 GROUP BY od.CarId) as d on a.ID=d.CarId
WHERE a.{nameof(RB_GuideCar_Car_Extend.Status)}=0");
if (query != null)
{
if (query.TenantId > 0)
......
......@@ -30,7 +30,11 @@ namespace Mall.Repository.GuideCar
public List<RB_GuideCar_Guide_Extend> GetPageListRepository(int pageIndex, int pageSize, out long rowCount, RB_GuideCar_Guide_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.Append($" SELECT a.*,b.SiteName FROM {TableName} as a LEFT JOIN {SiteTableName} as b on a.SiteId=b.ID WHERE a.{nameof(RB_GuideCar_Guide_Extend.Status)}=0");
builder.Append(@$" SELECT a.*,b.SiteName,c.GoodsNum,d.OrderNum FROM {TableName} as a LEFT JOIN {SiteTableName} as b on a.SiteId=b.ID
LEFT JOIN (SELECT GuideId,COUNT(*) as GoodsNum from rb_goods where `Status`=0 GROUP BY GuideId) as c on a.ID=c.GuideId
LEFT JOIN (SELECT GuideId,COUNT(*) as OrderNum from rb_goods_orderdetail as od
LEFT JOIN rb_goods_order as o on od.OrderId=o.OrderId where o.`Status`=0 and o.OrderStatus !=7 GROUP BY od.GuideId) as d on a.ID=d.GuideId
WHERE a.{nameof(RB_GuideCar_Guide_Extend.Status)}=0");
if (query != null)
{
// where += $@" and {nameof(RB_Customer_InfoCreate.CustomerId)}={dmodel.CustomerId}";
......@@ -159,5 +163,81 @@ namespace Mall.Repository.GuideCar
}
return Get<RB_GuideCar_Guide_Extend>(builder.ToString()).ToList();
}
/// <summary>
///导游列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_GuideCar_Guide_Extend> GetGuideCarGuideModel(RB_GuideCar_Guide_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.Append(@$" SELECT a.*,d.OrderNum,d.OrderGuestNum FROM {TableName} as a
LEFT JOIN (SELECT GuideId,COUNT(*) as OrderNum,SUM(od.Number) as OrderGuestNum from rb_goods_orderdetail as od
LEFT JOIN rb_goods_order as o on od.OrderId=o.OrderId where o.`Status`=0 and o.OrderStatus !=7 GROUP BY od.GuideId) as d on a.ID=d.GuideId
WHERE a.{nameof(RB_GuideCar_Guide_Extend.Status)}=0");
if (query != null)
{
// where += $@" and {nameof(RB_Customer_InfoCreate.CustomerId)}={dmodel.CustomerId}";
if (query.TenantId > 0)
{
builder.Append($" AND a.{nameof(RB_GuideCar_Guide_Extend.TenantId)}={query.TenantId}");
}
if (query.TenantId > 0)
{
builder.Append($" AND a.{nameof(RB_GuideCar_Guide_Extend.MallBaseId)}={query.MallBaseId}");
}
if (!string.IsNullOrWhiteSpace(query.Name))
{
builder.Append($" AND a.{nameof(RB_GuideCar_Guide_Extend.Name)} like '%{query.Name}%'");
}
if (query.ID > 0)
{
builder.Append($" AND a.{nameof(RB_GuideCar_Guide_Extend.ID)}={query.ID}");
}
if (query.SiteId > 0)
{
builder.Append($" AND a.{nameof(RB_GuideCar_Guide_Extend.SiteId)}={query.SiteId}");
}
if (!string.IsNullOrEmpty(query.GuideIds))
{
builder.Append($" AND a.{nameof(RB_GuideCar_Guide_Extend.ID)} in({query.GuideIds})");
}
if (query.IsEnable > -1)
{
builder.Append($" AND a.{nameof(RB_GuideCar_Guide_Extend.IsEnable)}={query.IsEnable}");
}
if (query.StartWorkYears.HasValue && query.StartWorkYears > 0)
{
builder.Append($" AND a.{nameof(RB_GuideCar_Guide_Extend.WorkYears)}>={query.StartWorkYears}");
}
if (query.EndWorkYears.HasValue && query.EndWorkYears > 0)
{
builder.Append($" AND a.{nameof(RB_GuideCar_Guide_Extend.WorkYears)}<={query.EndWorkYears}");
}
if (query.StartScore.HasValue && query.StartScore > 0)
{
builder.Append($" AND a.{nameof(RB_GuideCar_Guide_Extend.Score)}>={query.StartScore}");
}
if (query.EndScore.HasValue && query.EndScore > 0)
{
builder.Append($" AND a.{nameof(RB_GuideCar_Guide_Extend.Score)}<={query.EndScore}");
}
if (!string.IsNullOrEmpty(query.StartTime))
{
builder.Append($" and a.{nameof(RB_GuideCar_Guide_Extend.CreateDate)} >='{query.StartTime}'");
}
if (!string.IsNullOrEmpty(query.EndTime))
{
builder.Append($" and a.{nameof(RB_GuideCar_Guide_Extend.CreateDate)} <='{query.EndTime} 23:59:59'");
}
}
return Get<RB_GuideCar_Guide_Extend>(builder.ToString()).ToList();
}
}
}
......@@ -145,5 +145,39 @@ where {where} order by c.Id desc";
string sql = $@"SELECT c.CommentGrade,COUNT(0) as CommentNum FROM RB_Goods_Comment c where {where} GROUP BY c.CommentGrade";
return Get<RB_Goods_Comment_Extend>(sql).ToList();
}
/// <summary>
/// 获取车辆和导游评分信息
/// </summary>
/// <param name="goodsId"></param>
/// <param name="tenantId"></param>
/// <param name="mallBaseId"></param>
/// <returns></returns>
public List<RB_Goods_Comment_Extend> GetAppletGoodsCommentscore(int carId, int guideId, int tenantId, int mallBaseId)
{
string where = $" 1=1 and c.{nameof(RB_Goods_Comment.Status)}=0 ";
if (tenantId > 0)
{
where += $@" and c.{nameof(RB_Goods_Comment.TenantId)}={tenantId}";
}
if (mallBaseId > 0)
{
where += $@" and c.{nameof(RB_Goods_Comment.MallBaseId)}={mallBaseId}";
}
if (carId > 0)
{
where += $@" and c.{nameof(RB_Goods_Comment.CarId)}={carId}";
}
if (guideId > 0)
{
where += $@" and c.{nameof(RB_Goods_Comment.GuideId)}={guideId}";
}
string sql = $@"SELECT COUNT(0) as CommentNum,SUM(c.CarScore) as TotalCarScore,SUM(c.GuideScore) as TotalGuideScore FROM RB_Goods_Comment c
where {where} ";
return Get<RB_Goods_Comment_Extend>(sql).ToList();
}
}
}
......@@ -1575,5 +1575,126 @@ where {where} group by o.OrderId order by o.CreateDate desc";
return GetPage<RB_Goods_Order_Extend>(pageIndex, pageSize, out count, sql).ToList();
}
#endregion
#region 司导订单
/// <summary>
/// 获取订单分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="dmodel"></param>
/// <returns></returns>
public List<RB_Goods_Order_Extend> GetGuidecarOrderPageList(int pageIndex, int pageSize, out long count, RB_Goods_Order_Extend dmodel)
{
var parameters = new DynamicParameters();
string where = $" 1=1 and o.{nameof(RB_Goods_Order.Status)}=0";
if (dmodel.TenantId > 0)
{
where += $@" and o.{nameof(RB_Goods_Order.TenantId)}={dmodel.TenantId}";
}
if (dmodel.MallBaseId > 0)
{
where += $@" and o.{nameof(RB_Goods_Order.MallBaseId)}={dmodel.MallBaseId}";
}
if (dmodel.OrderId > 0)
{
where += $@" and o.{nameof(RB_Goods_Order.OrderId)}={dmodel.OrderId}";
}
if (dmodel.OrderSource > 0)
{
where += $@" and o.{nameof(RB_Goods_Order.OrderSource)}={(int)dmodel.OrderSource}";
}
if (dmodel.OrderType > 0)
{
where += $@" and od.{nameof(RB_Goods_OrderDetail.OrderType)}={dmodel.OrderType}";
}
if (dmodel.DeliveryMethod > 0)
{
where += $@" and o.{nameof(RB_Goods_Order.DeliveryMethod)}={(int)dmodel.DeliveryMethod}";
}
if (!string.IsNullOrEmpty(dmodel.StartTime))
{
where += $@" and o.{nameof(RB_Goods_Order.CreateDate)} >='{dmodel.StartTime}'";
}
if (!string.IsNullOrEmpty(dmodel.EndTime))
{
where += $@" and o.{nameof(RB_Goods_Order.CreateDate)} <='{dmodel.EndTime} 23:59:59'";
}
if (dmodel.OrderStatus > 0)
{
where += $@" and o.{nameof(RB_Goods_Order.OrderStatus)}={(int)dmodel.OrderStatus}";
}
if (dmodel.IsNotSelectCancel == 1)
{
where += $@" and o.{nameof(RB_Goods_Order.OrderStatus)} <> {(int)OrderStatusEnum.Cancel}";
where += $@" and o.{nameof(RB_Goods_Order.Recycled)} =2";
}
if (!string.IsNullOrEmpty(dmodel.OrderStatusIds))
{
where += $@" and o.{nameof(RB_Goods_Order.OrderStatus)} in({dmodel.OrderStatusIds})";
}
if (!string.IsNullOrEmpty(dmodel.OrderNo))
{
where += $@" and o.{nameof(RB_Goods_Order.OrderNo)} like @OrderNo ";
parameters.Add("OrderNo", "%" + dmodel.OrderNo.Trim() + "%");
}
if (!string.IsNullOrEmpty(dmodel.MerchantsNo))
{
where += $@" and o.{nameof(RB_Goods_Order.MerchantsNo)} like @MerchantsNo ";
parameters.Add("MerchantsNo", "%" + dmodel.MerchantsNo.Trim() + "%");
}
if (!string.IsNullOrEmpty(dmodel.UserName))
{
where += $@" and u.{nameof(RB_Member_User.Name)} like @UserName ";
parameters.Add("UserName", "%" + dmodel.UserName.Trim() + "%");
}
if (dmodel.UserId > 0)
{
where += $@" and o.{nameof(RB_Goods_Order.UserId)}={(int)dmodel.UserId}";
}
if (!string.IsNullOrEmpty(dmodel.GoodsName))
{
where += $@" and od.{nameof(RB_Goods_OrderDetail.GoodsName)} like '%{dmodel.GoodsName}%'";
}
if (!string.IsNullOrEmpty(dmodel.Consignee))
{
where += $@" and o.{nameof(RB_Goods_Order.Consignee)} like '%{dmodel.Consignee}%'";
}
if (!string.IsNullOrEmpty(dmodel.Mobile))
{
where += $@" and o.{nameof(RB_Goods_Order.Mobile)} like '%{dmodel.Mobile}%'";
}
if (!string.IsNullOrEmpty(dmodel.ProductCode))
{
where += $@" and od.{nameof(RB_Goods_OrderDetail.ProductCode)} like '%{dmodel.ProductCode}%'";
}
if (!string.IsNullOrEmpty(dmodel.AnchorName))
{
where += $@" and o.{nameof(RB_Goods_Order.AnchorName)} like '%{dmodel.AnchorName}%'";
}
if (dmodel.Recycled > 0)
{
where += $@" and o.{nameof(RB_Goods_Order.Recycled)}={(int)dmodel.Recycled}";
}
if (dmodel.SmallShopsId.HasValue && dmodel.SmallShopsId > 0)
{
where += $@" and o.{nameof(RB_Goods_Order.SmallShopsId)}={dmodel.SmallShopsId}";
}
if (dmodel.IsSelectPayMoney == 1)
{
where += $@" and o.{nameof(RB_Goods_Order.PaymentTime)} IS NOT NULL";
}
string sql = $@"SELECT o.*,u.Name as UserName,sshop.`Name` as SmallShopsName,gcg.`Name` as GuideName,gcg.GuidePhoto,gcg.Telephone as GuideTelephone FROM rb_goods_order o
INNER JOIN rb_goods_orderdetail od on o.OrderId=od.OrderId
INNER JOIN rb_member_user u on o.UserId=u.Id
LEFT JOIN rb_smallshops_info as sshop on o.SmallShopsId=sshop.Id
LEFT JOIN rb_guidecar_guide as gcg on gcg.ID=od.GuideId
where {where} group by o.OrderId order by o.CreateDate desc";
return GetPage<RB_Goods_Order_Extend>(pageIndex, pageSize, out count, sql, parameters).ToList();
}
#endregion
}
}
......@@ -3,9 +3,11 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Mall.Common.API;
using Mall.Common.Enum.Goods;
using Mall.Common.Plugin;
using Mall.Model.Extend.GuideCar;
using Mall.Model.Extend.Product;
using Mall.Model.Extend.User;
using Mall.Module.Product;
using Mall.WebApi.Filter;
using Microsoft.AspNetCore.Cors;
......@@ -24,7 +26,7 @@ namespace Mall.WebApi.Controllers.Product
public class AppletGCOrderController : BaseController
{
private readonly GuideCarModule guideCarModule = new GuideCarModule();
private readonly Module.User.MiniProgramModule programModule = new Module.User.MiniProgramModule();
#region 订单信息
/// <summary>
......@@ -53,7 +55,8 @@ namespace Mall.WebApi.Controllers.Product
return ApiResult.ParamIsNull("请传递商品数量");
}
}
if (!demodel.TripSTime.HasValue) {
if (!demodel.TripSTime.HasValue)
{
return ApiResult.ParamIsNull("请传递预约起始时间");
}
demodel.TenantId = userInfo.TenantId;
......@@ -68,19 +71,195 @@ namespace Mall.WebApi.Controllers.Product
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetAppletSDGoodsTargetDateList() {
public ApiResult GetAppletSDGoodsTargetDateList()
{
var req = RequestParm;
JObject parms = JObject.Parse(req.msg.ToString());
int GoodsId = parms.GetInt("GoodsId", 0);
string Month = parms.GetStringValue("Month");
if (GoodsId <= 0) {
if (GoodsId <= 0)
{
return ApiResult.ParamIsNull("请传递商品id");
}
var list = guideCarModule.GetAppletSDGoodsTargetDateList(GoodsId, Month);
return ApiResult.Success("", list);
}
#endregion
#region 订单评论
/// <summary>
/// 用户新增评论
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetGuideCarCommentInfo()
{
var req = RequestParm;
var userInfo = AppletUserInfo;
RB_Goods_Comment_Extend demodel = JsonConvert.DeserializeObject<RB_Goods_Comment_Extend>(req.msg.ToString());
if ((demodel.OrderDetailId ?? 0) <= 0)
{
return ApiResult.ParamIsNull("请传递订单明细OrderDetailId");
}
if ((demodel.GoodsId ?? 0) <= 0)
{
return ApiResult.ParamIsNull("请传递商品");
}
if ((demodel.GuideId ?? 0) <= 0)
{
return ApiResult.ParamIsNull("请传递导游");
}
if ((demodel.CarId ?? 0) <= 0)
{
return ApiResult.ParamIsNull("请传递车辆");
}
if ((demodel.GuideScore ?? 0) <= 0)
{
return ApiResult.ParamIsNull("请您对导游评分");
}
if ((demodel.CarScore ?? 0) <= 0)
{
return ApiResult.ParamIsNull("请您对车辆评分");
}
if (string.IsNullOrEmpty(demodel.Content))
{
return ApiResult.ParamIsNull("请输入评价内容");
}
demodel.CommentImage = "";
if (demodel.CommentImgList != null && demodel.CommentImgList.Any())
{
demodel.CommentImage = JsonConvert.SerializeObject(demodel.CommentImgList);
}
demodel.CommentGrade ??= Common.Enum.Goods.GoodsCommentTypeEnum.Praise;
demodel.CommentScore ??= 5;
if (demodel.CommentScore == 3 || demodel.CommentScore == 2)
{
demodel.CommentGrade = Common.Enum.Goods.GoodsCommentTypeEnum.Medium;
}
else if (demodel.CommentScore == 1)
{
demodel.CommentGrade = Common.Enum.Goods.GoodsCommentTypeEnum.Negative;
}
demodel.UserPhoto ??= 0;
demodel.Is_Top ??= 2;
demodel.Is_Show ??= 1;
demodel.Is_Anonymity ??= 2;
demodel.UserId ??= 0;
demodel.Reply ??= "";
demodel.TenantId = userInfo.TenantId;
demodel.MallBaseId = userInfo.MallBaseId;
demodel.UserId = userInfo.UserId;
demodel.UserName = userInfo.Name;
demodel.PlatformSource = userInfo.Source;
demodel.Status = 0;
demodel.CreateDate = DateTime.Now;
demodel.UpdateDate = DateTime.Now;
bool flag = guideCarModule.SetGoodsCommentInfo(demodel);
if (flag) { return ApiResult.Success(); } else { return ApiResult.Failed(); }
}
/// <summary>
/// 获取司导订单状态枚举
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GuidCarOrderStatusEnumList()
{
var list = EnumHelper.GetEnumList(typeof(GuidCarOrderStatusEnum));
return ApiResult.Success("", list.OrderBy(x => Convert.ToInt32(x.Value)).Select(x => new
{
Name = x.Key,
Id = Convert.ToInt32(x.Value)
}));
}
/// <summary>
/// 我的订单分页列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetAppletGoodsMyOrderPageList()
{
var parms = RequestParm;
var userInfo = AppletUserInfo;
ResultPageModel pagelist = JsonConvert.DeserializeObject<ResultPageModel>(parms.msg.ToString());
RB_Goods_Order_Extend demodel = JsonConvert.DeserializeObject<RB_Goods_Order_Extend>(parms.msg.ToString());
demodel.TenantId = userInfo.TenantId;
demodel.MallBaseId = userInfo.MallBaseId;
demodel.UserId = userInfo.UserId;
demodel.Recycled = 2;
if (demodel.OrderStatus == Common.Enum.Goods.OrderStatusEnum.WaitSendGoods)
{
demodel.OrderStatusIds = "2,6";//待处理也是待发货状态才有的
demodel.OrderStatus = 0;
}
var list = guideCarModule.GetAppletGoodsMyOrderPageList(pagelist.pageIndex, pagelist.pageSize, out long count, demodel);
//获取订阅消息
var miniModel = programModule.GetMiniProgramModule(new RB_MiniProgram_Extend { TenantId = userInfo.TenantId, MallBaseId = userInfo.MallBaseId });
List<string> template_message_list = new List<string>();
if (miniModel != null)
{
if (!string.IsNullOrWhiteSpace(miniModel.RefundTpl))
{
template_message_list.Add(miniModel.RefundTpl);
}
if (!string.IsNullOrWhiteSpace(miniModel.OrderCancelTpl))
{
template_message_list.Add(miniModel.OrderCancelTpl);
}
}
pagelist.count = Convert.ToInt32(count);
pagelist.pageData = list.Select(x => new
{
template_message_list,
x.OrderId,
x.OrderNo,
x.DeliveryMethod,
DeliveryMethodName = x.DeliveryMethod.GetEnumName(),
x.Income,
x.FreightMoney,
x.CouponMoney,
x.PaymentWay,
PaymentWayName = x.PaymentWay.GetEnumName(),
DetailList = x.DetailList.Select(y => new
{
y.Id,
y.GoodsId,
y.CoverImagePath,
y.OrderType,
OrderTypeName = y.OrderType.GetEnumName(),
y.GoodsName,
y.SpecificationSort,
SpecificationList = JsonConvert.DeserializeObject<List<string>>(y.Specification),
y.ProductCode,
y.Final_Price,
y.Number,
y.IsComment,
TripSTime = y.TripSTime.HasValue ? y.TripSTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
TripETime = y.TripETime.HasValue ? y.TripETime.Value.ToString("yyyy-MM-dd HH:mm:ss") : ""
}),
x.OrderStatus,
OrderStatusName = x.OrderStatus.GetEnumName(),
x.TenantId,
x.MallBaseId,
x.PresentFXGrade,
CreateDate = x.CreateDate.HasValue ? x.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : ""
});
return ApiResult.Success("", pagelist);
}
#endregion
}
......
......@@ -371,7 +371,7 @@ namespace Mall.WebApi.Controllers.Product
#endregion
#region 订单信息
#endregion
......@@ -385,7 +385,7 @@ namespace Mall.WebApi.Controllers.Product
var query = JsonConvert.DeserializeObject<RB_GuideCar_Guide_Extend>(parms.msg.ToString());
query.TenantId = parms.TenantId;
query.MallBaseId = parms.MallBaseId;
var oldLogisticsModel = guideCarModule.GetGuideCarGuideModel(query);
var oldLogisticsModel = guideCarModule.GetGuideCarGuideOrderInfo(query);
if (oldLogisticsModel == null)
{
oldLogisticsModel = new RB_GuideCar_Guide_Extend();
......
......@@ -1502,5 +1502,76 @@ namespace Mall.WebApi.Controllers.MallBase
}
}
#endregion
#region 新增司导评论-车辆与导游评论
/// <summary>
/// 管理新增评论
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetGuideCarCommentInfo()
{
var req = RequestParm;
RB_Goods_Comment_Extend demodel = JsonConvert.DeserializeObject<RB_Goods_Comment_Extend>(req.msg.ToString());
if (string.IsNullOrEmpty(demodel.UserName))
{
return ApiResult.ParamIsNull("请输入用户名称");
}
if (!demodel.CreateDate.HasValue)
{
return ApiResult.ParamIsNull("请输入评论时间");
}
if ((demodel.GoodsId ?? 0) <= 0)
{
return ApiResult.ParamIsNull("请选择商品");
}
if ((demodel.GuideId ?? 0) <= 0)
{
return ApiResult.ParamIsNull("请选择导游");
}
if ((demodel.CarId ?? 0) <= 0)
{
return ApiResult.ParamIsNull("请选择车辆");
}
if ((demodel.GuideScore ?? 0) <= 0)
{
return ApiResult.ParamIsNull("请您对导游评分");
}
if ((demodel.CarScore ?? 0) <= 0)
{
return ApiResult.ParamIsNull("请您对车辆评分");
}
if (string.IsNullOrEmpty(demodel.Content))
{
return ApiResult.ParamIsNull("请输入评价内容");
}
if (!demodel.CommentGrade.HasValue)
{
return ApiResult.ParamIsNull("请选择评分");
}
demodel.CommentScore ??= 5;
demodel.CommentImage = "";
if (demodel.CommentImgList != null && demodel.CommentImgList.Any())
{
demodel.CommentImage = JsonConvert.SerializeObject(demodel.CommentImgList);
}
demodel.UserPhoto ??= 0;
demodel.Is_Top ??= 2;
demodel.Is_Show ??= 1;
demodel.Is_Anonymity ??= 2;
demodel.UserId ??= 0;
demodel.Reply ??= "";
demodel.TenantId = req.TenantId;
demodel.MallBaseId = req.MallBaseId;
demodel.Status = 0;
demodel.UpdateDate = DateTime.Now;
bool flag = guideCarModule.SetGoodsCommentInfo(demodel);
if (flag) { return ApiResult.Success(); } else { return ApiResult.Failed(); }
}
#endregion
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment