Commit a1219fd1 authored by liudong1993's avatar liudong1993

司导订单

parent b81fb3f3
......@@ -80,6 +80,13 @@ namespace Mall.Common.Enum
/// CRM营销发送发送直客生日祝福
/// </summary>
[EnumField("SMS_187570365")]
CRMGuestBirth = 14
CRMGuestBirth = 14,
/// <summary>
/// 导游通知
/// </summary>
[EnumField("SMS_201716853")]
GuideMsg =15
}
}
......@@ -11,6 +11,7 @@
<ProjectReference Include="..\Mall.Model\Mall.Model.csproj" />
<ProjectReference Include="..\Mall.Module.User\Mall.Module.User.csproj" />
<ProjectReference Include="..\Mall.Repository\Mall.Repository.csproj" />
<ProjectReference Include="..\Mall.ThirdCore\Mall.ThirdCore.csproj" />
</ItemGroup>
</Project>
......@@ -5,6 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using Mall.Common;
using Mall.Common.API;
using Mall.Common.Enum;
using Mall.Common.Enum.Goods;
using Mall.Common.Enum.User;
using Mall.Common.Plugin;
......@@ -17,9 +18,11 @@ using Mall.Module.User;
using Mall.Repository;
using Mall.Repository.BaseSetUp;
using Mall.Repository.Finance;
using Mall.Repository.GuideCar;
using Mall.Repository.MarketingCenter;
using Mall.Repository.Product;
using Mall.Repository.User;
using Mall.ThirdCore.Message;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Configuration.Json;
using Newtonsoft.Json;
......@@ -280,6 +283,14 @@ namespace Mall.Module.Product
/// 商品可预定日期
/// </summary>
private readonly RB_Goods_TargetDateRepository goods_TargetDateRepository = new RB_Goods_TargetDateRepository();
/// <summary>
/// 司导-导游
/// </summary>
private readonly RB_GuideCar_GuideRepository guideCar_GuideRepository = new RB_GuideCar_GuideRepository();
/// <summary>
/// 司导-车辆
/// </summary>
private readonly RB_GuideCar_CarRepository guideCar_CarRepository = new RB_GuideCar_CarRepository();
#region 购物车
......@@ -3842,6 +3853,7 @@ namespace Mall.Module.Product
{
return ApiResult.Failed("预定日期与商品使用天数不一致");
}
item.OrderType = OrderTypeEnum.SDGoods;
item.CarType = gmodel.CarType;
item.UseDay = gmodel.UseDay;
item.TripSTime = demodel.TripSTime;
......@@ -4297,7 +4309,6 @@ namespace Mall.Module.Product
demodel.PaymentWay = OrderPaymentTypeEnum.OnlinePayment;//先默认在线支付
demodel.Remark ??= "";
demodel.ApplyForCancelStatus ??= 0;
demodel.OrderType = (int)OrderTypeEnum.SDGoods;
int OrderId = goods_OrderRepository.Insert(demodel, trans);
if (OrderId > 0)
{
......@@ -10595,6 +10606,74 @@ namespace Mall.Module.Product
#endregion
#region 司导订单
/// <summary>
/// 司导订单确认
/// </summary>
/// <param name="orderId"></param>
/// <param name="empId"></param>
/// <returns></returns>
public bool SetSDOrderConfirm(int orderId,int Type, int empId)
{
Dictionary<string, object> keyValues = new Dictionary<string, object>() { };
if (Type == 1)
{
keyValues.Add(nameof(RB_Goods_Order.OrderStatus), OrderStatusEnum.WaitReceiving);
keyValues.Add(nameof(RB_Goods_Order.DeliveryTime), DateTime.Now);
}
else if (Type == 2)
{
keyValues.Add(nameof(RB_Goods_Order.OrderStatus), OrderStatusEnum.Received);
keyValues.Add(nameof(RB_Goods_Order.ReceivingTime), DateTime.Now);
}
else if (Type == 3) {
keyValues.Add(nameof(RB_Goods_Order.OrderStatus), OrderStatusEnum.Completed);
keyValues.Add(nameof(RB_Goods_Order.FinishTime), DateTime.Now);
}
List<WhereHelper> wheres = new List<WhereHelper>() {
new WhereHelper(){
FiledName=nameof(RB_Goods_Order.OrderId),
FiledValue=orderId,
OperatorEnum=OperatorEnum.Equal
}
};
bool flag = goods_OrderRepository.Update(keyValues, wheres);
if (flag && Type == 1) {
//发送短信通知导游接单
var omodel = goods_OrderRepository.GetEntity(orderId);
var list = goods_OrderDetailRepository.GetOrderDetailList(new RB_Goods_OrderDetail_Extend() { OrderId = orderId });
int IsNormalServer = Convert.ToInt32(Config.IsNormalServer);//为正式才发送短信
if (IsNormalServer == 1)
{
foreach (var item in list) {
if (item.GuideId > 0) {
//查询导游信息
var guideModel = guideCar_GuideRepository.GetEntity(item.GuideId ?? 0);
var carModel = guideCar_CarRepository.GetEntity(item.CarId ?? 0);
if (guideModel!=null && carModel!=null && !string.IsNullOrEmpty(guideModel.Telephone))
{
string Telephone = guideModel.Telephone;
MobileCodeTypeEnum mobileCodeType = MobileCodeTypeEnum.GuideMsg;//导游通知
if (ValidateHepler.IsMobileNumber(Telephone))
{
object PhoneMessage = new
{
omodel.OrderNo,
StartDate = item.TripSTime.Value.ToString("yyyy-MM-dd HH:mm"),
guideModel.Name,
CarName = carModel.Name + "(" + item.CarNumber + ")"
};
SMSService.SendMsg(Telephone, PhoneMessage, EnumHelper.GetEnumName(mobileCodeType));
}
}
}
}
}
}
return flag;
}
#endregion
#region 订单评论
/// <summary>
......
......@@ -387,6 +387,9 @@ namespace Mall.WebApi.Controllers.MallBase
}
else
{
if (Convert.ToDateTime(StartDate) < Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd"))) {
return ApiResult.Failed("开始时间不能小于当前时间");
}
DateTime endDate = Convert.ToDateTime(EndDate);
for (DateTime dt = Convert.ToDateTime(StartDate); dt <= endDate;)
{
......@@ -405,6 +408,9 @@ namespace Mall.WebApi.Controllers.MallBase
return ApiResult.ParamIsNull("请选择月份");
}
DateTime StartTime = Convert.ToDateTime(Month + "-01");
if (StartTime < Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM") + "-01")) {
return ApiResult.Failed("月份不能小于当前月份");
}
DateTime EndTime = StartTime.AddMonths(1).AddDays(-1);
for (DateTime dt = StartTime; dt <= EndTime;)
{
......@@ -433,7 +439,10 @@ namespace Mall.WebApi.Controllers.MallBase
StartTime = Convert.ToDateTime(Year + "-01" + "-01");
EndTime = StartTime.AddYears(1).AddDays(-1);
}
if (StartTime < Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM") + "-01"))
{
return ApiResult.Failed("月份不能小于当前月份");
}
for (DateTime dt = StartTime; dt <= EndTime;)
{
//将日期转换为周几
......
......@@ -992,7 +992,64 @@ namespace Mall.WebApi.Controllers.MallBase
}));
}
#region 司导订单管理
/// <summary>
/// 司导订单确认
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetSDOrderConfirm()
{
var req = RequestParm;
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) {
return ApiResult.ParamIsNull("请传递订单id");
}
var omodel = orderModule.GetOrderInfo(OrderId);
if (omodel == null) {
return ApiResult.ParamIsNull("订单信息不存在");
}
if (omodel.OrderClassify != 1) {
return ApiResult.ParamIsNull("该订单不是司导订单");
}
if (Type == 1)
{
if (omodel.OrderStatus != OrderStatusEnum.WaitSendGoods)
{
return ApiResult.ParamIsNull("订单状态不正确,请核实后再试");
}
}
else if (Type == 2)
{
if (omodel.OrderStatus != OrderStatusEnum.WaitReceiving)
{
return ApiResult.ParamIsNull("订单状态不正确,请核实后再试");
}
}
else if (Type == 3)
{
if (omodel.OrderStatus != OrderStatusEnum.Received)
{
return ApiResult.ParamIsNull("订单状态不正确,请核实后再试");
}
}
else {
return ApiResult.Failed();
}
bool flag = orderModule.SetSDOrderConfirm(OrderId, Type, req.EmpId);
if (flag)
{
return ApiResult.Success();
}
else {
return ApiResult.Failed();
}
}
#endregion
#region 修改运费成本以及商品成本、供应商
/// <summary>
......
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