321
This commit is contained in:
parent
bf7c67daa9
commit
b53ae616ff
|
|
@ -95,5 +95,9 @@ namespace CoreCms.Net.IServices
|
||||||
Expression<Func<SQReservationParticipants, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
Expression<Func<SQReservationParticipants, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
||||||
int pageSize = 20, bool blUseNoLock = false);
|
int pageSize = 20, bool blUseNoLock = false);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region 用户支付鸽子费
|
||||||
|
Task Pay(string paymentId);
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -113,5 +113,7 @@ namespace CoreCms.Net.IServices
|
||||||
/// <param name="participants">需通知的参与人集合</param>
|
/// <param name="participants">需通知的参与人集合</param>
|
||||||
Task NotifyReservationSuccessAsync(SQReservations reservation, IEnumerable<SQReservationParticipants> participants);
|
Task NotifyReservationSuccessAsync(SQReservations reservation, IEnumerable<SQReservationParticipants> participants);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -128,9 +128,9 @@ namespace CoreCms.Net.Model.Entities
|
||||||
public System.String important_data { get; set; }
|
public System.String important_data { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 是否需要退款。0 无需退款,未交押金,1 交押金,待退款,2,交押金,退款中,3 退款成功,9退款失败
|
/// 是否需要退款。0 无需退款,未交押金,1 待支付 ,2 已支付 ,9退款失败
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Display(Name = "是否需要退款。0 无需退款,未交押金,1 交押金,待退款,2,交押金,退款中,3 退款成功,9退款失败")]
|
[Display(Name = "是否需要退款。0 无需退款,未交押金,1 待支付 ,2 已支付 ,9退款失败")]
|
||||||
public System.Int32 is_refund { get; set; }
|
public System.Int32 is_refund { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -145,5 +145,11 @@ namespace CoreCms.Net.Model.Entities
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Display(Name = "是否评论过")]
|
[Display(Name = "是否评论过")]
|
||||||
public System.Int32 is_evaluation { get; set; }
|
public System.Int32 is_evaluation { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 订单id
|
||||||
|
/// </summary>
|
||||||
|
[Display(Name = "订单id")]
|
||||||
|
public string paymentId { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ namespace CoreCms.Net.Services
|
||||||
private readonly IUnitOfWork _unitOfWork;
|
private readonly IUnitOfWork _unitOfWork;
|
||||||
private readonly IServiceProvider _serviceProvider;
|
private readonly IServiceProvider _serviceProvider;
|
||||||
|
|
||||||
|
private readonly ISQReservationParticipantsServices _sqReservationParticipantsServices;
|
||||||
private readonly ICoreCmsSettingServices _settingServices;
|
private readonly ICoreCmsSettingServices _settingServices;
|
||||||
private readonly ICoreCmsUserBalanceServices _userBalanceServices;
|
private readonly ICoreCmsUserBalanceServices _userBalanceServices;
|
||||||
private readonly ICoreCmsFormSubmitServices _formSubmitServices;
|
private readonly ICoreCmsFormSubmitServices _formSubmitServices;
|
||||||
|
|
@ -81,6 +81,7 @@ namespace CoreCms.Net.Services
|
||||||
, ICoreCmsUserServicesOrderServices userServicesOrderServices
|
, ICoreCmsUserServicesOrderServices userServicesOrderServices
|
||||||
, ICoreCmsUserWeChatInfoServices userWeChatInfoServices
|
, ICoreCmsUserWeChatInfoServices userWeChatInfoServices
|
||||||
, IOptions<WeChatOptions> weChatOptions
|
, IOptions<WeChatOptions> weChatOptions
|
||||||
|
, ISQReservationParticipantsServices sqReservationParticipantsServices
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
this._dal = dal;
|
this._dal = dal;
|
||||||
|
|
@ -100,6 +101,7 @@ namespace CoreCms.Net.Services
|
||||||
_userServicesOrderServices = userServicesOrderServices;
|
_userServicesOrderServices = userServicesOrderServices;
|
||||||
_userWeChatInfoServices = userWeChatInfoServices;
|
_userWeChatInfoServices = userWeChatInfoServices;
|
||||||
_weChatOptions = weChatOptions.Value;
|
_weChatOptions = weChatOptions.Value;
|
||||||
|
_sqReservationParticipantsServices = sqReservationParticipantsServices;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region 生成支付单的时候,格式化支付单明细
|
#region 生成支付单的时候,格式化支付单明细
|
||||||
|
|
@ -699,6 +701,11 @@ namespace CoreCms.Net.Services
|
||||||
var id = billPaymentInfo.sourceId.ObjectToInt(0);
|
var id = billPaymentInfo.sourceId.ObjectToInt(0);
|
||||||
await _formSubmitServices.Pay(id);
|
await _formSubmitServices.Pay(id);
|
||||||
}
|
}
|
||||||
|
else if (billPaymentInfo.type == (int)GlobalEnumVars.BillPaymentsType.GeZiFei)
|
||||||
|
{
|
||||||
|
//form表单支付
|
||||||
|
await _sqReservationParticipantsServices.Pay(paymentId);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//::todo 其他业务逻辑
|
//::todo 其他业务逻辑
|
||||||
|
|
|
||||||
|
|
@ -115,7 +115,8 @@ namespace CoreCms.Net.Services
|
||||||
SpBillCreateIp = entity.ip,
|
SpBillCreateIp = entity.ip,
|
||||||
NotifyUrl = weChatPayUrl,
|
NotifyUrl = weChatPayUrl,
|
||||||
TradeType = tradeType,
|
TradeType = tradeType,
|
||||||
OpenId = openId
|
OpenId = openId,
|
||||||
|
TimeExpire= DateTime.Now.AddMinutes(5).ToString("yyyyMMddHHmmss")
|
||||||
};
|
};
|
||||||
|
|
||||||
var response = await _client.ExecuteAsync(request, _optionsAccessor.Value);
|
var response = await _client.ExecuteAsync(request, _optionsAccessor.Value);
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
using CoreCms.Net.Configuration;
|
using CoreCms.Net.Configuration;
|
||||||
using CoreCms.Net.IRepository;
|
using CoreCms.Net.IRepository;
|
||||||
using CoreCms.Net.IRepository.UnitOfWork;
|
using CoreCms.Net.IRepository.UnitOfWork;
|
||||||
|
|
@ -19,6 +20,7 @@ using CoreCms.Net.IServices;
|
||||||
using CoreCms.Net.Model.Entities;
|
using CoreCms.Net.Model.Entities;
|
||||||
using CoreCms.Net.Model.ViewModels.Basics;
|
using CoreCms.Net.Model.ViewModels.Basics;
|
||||||
using CoreCms.Net.Model.ViewModels.UI;
|
using CoreCms.Net.Model.ViewModels.UI;
|
||||||
|
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -114,7 +116,7 @@ namespace CoreCms.Net.Services
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 重写根据条件查询分页数据
|
#region 重写根据条件查询分页数据
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 重写根据条件查询分页数据
|
/// 重写根据条件查询分页数据
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -131,7 +133,30 @@ namespace CoreCms.Net.Services
|
||||||
{
|
{
|
||||||
return await _dal.QueryPageAsync(predicate, orderByExpression, orderByType, pageIndex, pageSize, blUseNoLock);
|
return await _dal.QueryPageAsync(predicate, orderByExpression, orderByType, pageIndex, pageSize, blUseNoLock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task Pay(string paymentId)
|
||||||
|
{
|
||||||
|
var model = await _dal.QueryByClauseAsync(it => it.paymentId == paymentId);
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
throw new Exception("未找到订单记录");
|
||||||
|
}
|
||||||
|
if (model.status == 1)
|
||||||
|
{
|
||||||
|
model.is_refund = 2;
|
||||||
|
await _dal.UpdateAsync(model);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//订单出错
|
||||||
|
throw new Exception("订单状态异常");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ namespace CoreCms.Net.Services
|
||||||
private readonly IUnitOfWork _unitOfWork;
|
private readonly IUnitOfWork _unitOfWork;
|
||||||
private readonly IRedisOperationRepository _redisOperationRepository;
|
private readonly IRedisOperationRepository _redisOperationRepository;
|
||||||
|
|
||||||
public SQReservationsServices(IUnitOfWork unitOfWork, ISQReservationsRepository dal, IRedisOperationRepository redisOperationRepository)
|
public SQReservationsServices(IUnitOfWork unitOfWork, ISQReservationsRepository dal, IRedisOperationRepository redisOperationRepository)
|
||||||
{
|
{
|
||||||
this._dal = dal;
|
this._dal = dal;
|
||||||
base.BaseDal = dal;
|
base.BaseDal = dal;
|
||||||
|
|
@ -98,7 +98,7 @@ namespace CoreCms.Net.Services
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 获取缓存的所有数据==========================================================
|
#region 获取缓存的所有数据==========================================================
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取缓存的所有数据
|
/// 获取缓存的所有数据
|
||||||
|
|
@ -119,7 +119,7 @@ namespace CoreCms.Net.Services
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 重写根据条件查询分页数据
|
#region 重写根据条件查询分页数据
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 重写根据条件查询分页数据
|
/// 重写根据条件查询分页数据
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -138,57 +138,60 @@ namespace CoreCms.Net.Services
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 预约模板消息通知==========================================================
|
#region 预约模板消息通知==========================================================
|
||||||
public async Task NotifyReservationFailedAsync(SQReservations reservation, IEnumerable<SQReservationParticipants> participants,string tips= "组局人数未满,自动解散!")
|
public async Task NotifyReservationFailedAsync(SQReservations reservation, IEnumerable<SQReservationParticipants> participants, string tips = "组局人数未满,自动解散!")
|
||||||
{
|
{
|
||||||
if (reservation == null || participants == null)
|
if (reservation == null || participants == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
foreach (var user in participants)
|
foreach (var user in participants)
|
||||||
{
|
{
|
||||||
var parameters = new JObject();
|
var parameters = new JObject();
|
||||||
parameters.Add("title", reservation.title);
|
parameters.Add("title", reservation.title);
|
||||||
parameters.Add("context", "组局失败!");
|
parameters.Add("context", "组局失败!");
|
||||||
parameters.Add("createTime", reservation.start_time);
|
parameters.Add("createTime", reservation.start_time);
|
||||||
parameters.Add("tips", "组局人数未满,自动解散!");
|
parameters.Add("tips", "组局人数未满,自动解散!");
|
||||||
var @params = new JObject();
|
var @params = new JObject();
|
||||||
@params.Add("parameters", parameters);
|
@params.Add("parameters", parameters);
|
||||||
var data = new
|
var data = new
|
||||||
{
|
{
|
||||||
userId = user.user_id,
|
userId = user.user_id,
|
||||||
code = GlobalEnumVars.WeChatMsgTemplateType.reservation_change.ToString(),
|
code = GlobalEnumVars.WeChatMsgTemplateType.reservation_change.ToString(),
|
||||||
parameters = @params
|
parameters = @params
|
||||||
};
|
};
|
||||||
await _redisOperationRepository.ListLeftPushAsync(RedisMessageQueueKey.SendWxTemplateMessage, JsonConvert.SerializeObject(data));
|
await _redisOperationRepository.ListLeftPushAsync(RedisMessageQueueKey.SendWxTemplateMessage, JsonConvert.SerializeObject(data));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task NotifyReservationSuccessAsync(SQReservations reservation, IEnumerable<SQReservationParticipants> participants)
|
public async Task NotifyReservationSuccessAsync(SQReservations reservation, IEnumerable<SQReservationParticipants> participants)
|
||||||
{
|
{
|
||||||
if (reservation == null || participants == null)
|
if (reservation == null || participants == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
foreach (var user in participants)
|
foreach (var user in participants)
|
||||||
{
|
{
|
||||||
var parameters = new JObject();
|
var parameters = new JObject();
|
||||||
parameters.Add("title", reservation.title);
|
parameters.Add("title", reservation.title);
|
||||||
parameters.Add("roomName", reservation.room_name);
|
parameters.Add("roomName", reservation.room_name);
|
||||||
parameters.Add("createTime", reservation.start_time);
|
parameters.Add("createTime", reservation.start_time);
|
||||||
parameters.Add("tips", "组局成功!");
|
parameters.Add("tips", "组局成功!");
|
||||||
var @params = new JObject();
|
var @params = new JObject();
|
||||||
@params.Add("parameters", parameters);
|
@params.Add("parameters", parameters);
|
||||||
var data = new
|
var data = new
|
||||||
{
|
{
|
||||||
userId = user.user_id,
|
userId = user.user_id,
|
||||||
code = GlobalEnumVars.WeChatMsgTemplateType.reservation_success.ToString(),
|
code = GlobalEnumVars.WeChatMsgTemplateType.reservation_success.ToString(),
|
||||||
parameters = @params
|
parameters = @params
|
||||||
};
|
};
|
||||||
await _redisOperationRepository.ListLeftPushAsync(RedisMessageQueueKey.SendWxTemplateMessage, JsonConvert.SerializeObject(data));
|
await _redisOperationRepository.ListLeftPushAsync(RedisMessageQueueKey.SendWxTemplateMessage, JsonConvert.SerializeObject(data));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ using ToolGood.Words.internals;
|
||||||
using NPOI.SS.Formula.PTG;
|
using NPOI.SS.Formula.PTG;
|
||||||
using NPOI.OpenXmlFormats.Dml;
|
using NPOI.OpenXmlFormats.Dml;
|
||||||
using Humanizer;
|
using Humanizer;
|
||||||
|
using Newtonsoft.Json;
|
||||||
namespace CoreCms.Net.Web.WebApi.Controllers;
|
namespace CoreCms.Net.Web.WebApi.Controllers;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -534,7 +535,31 @@ public class SQController : ControllerBase
|
||||||
Msg = "该时间段房间已被预约"
|
Msg = "该时间段房间已被预约"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
string paymentId = "";
|
||||||
|
if (dto.deposit_fee > 0)
|
||||||
|
{
|
||||||
|
var imdata = JsonConvert.DeserializeObject<Dictionary<string, object>>(dto.important_data);
|
||||||
|
if (imdata == null || !imdata.ContainsKey("paymentId") || string.IsNullOrEmpty(imdata["paymentId"].ToString()))
|
||||||
|
{
|
||||||
|
return new WebApiDto()
|
||||||
|
{
|
||||||
|
Code = 500,
|
||||||
|
Data = null,
|
||||||
|
Msg = "押金支付信息错误!"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
//订单编号
|
||||||
|
paymentId = imdata["paymentId"].ToString();
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(paymentId))
|
||||||
|
{
|
||||||
|
return new WebApiDto()
|
||||||
|
{
|
||||||
|
Code = 500,
|
||||||
|
Data = null,
|
||||||
|
Msg = "生成订单失败!"
|
||||||
|
};
|
||||||
|
}
|
||||||
// 5. 创建预约记录
|
// 5. 创建预约记录
|
||||||
var reservation = new SQReservations
|
var reservation = new SQReservations
|
||||||
{
|
{
|
||||||
|
|
@ -581,7 +606,8 @@ public class SQController : ControllerBase
|
||||||
role = 1,
|
role = 1,
|
||||||
status = 0,
|
status = 0,
|
||||||
is_refund = dto.deposit_fee > 0 ? 1 : 0,
|
is_refund = dto.deposit_fee > 0 ? 1 : 0,
|
||||||
important_data = dto.important_data
|
important_data = dto.important_data,
|
||||||
|
paymentId = paymentId
|
||||||
};
|
};
|
||||||
await _SQReservationParticipantsServices.InsertAsync(participant);
|
await _SQReservationParticipantsServices.InsertAsync(participant);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -844,6 +844,13 @@
|
||||||
<param name="dto"></param>
|
<param name="dto"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:CoreCms.Net.Web.WebApi.Controllers.SQController.CanCreateSQReservation(CoreCms.Net.Model.ViewModels.SQ.SQReservationsAddDto)">
|
||||||
|
<summary>
|
||||||
|
用户是否可以创建预约(仅校验,不创建)
|
||||||
|
</summary>
|
||||||
|
<param name="dto">创建预约所需参数</param>
|
||||||
|
<returns>返回可否创建及原因</returns>
|
||||||
|
</member>
|
||||||
<member name="M:CoreCms.Net.Web.WebApi.Controllers.SQController.JoinReservation(CoreCms.Net.Model.ViewModels.SQ.SQReservationParticipantsAddDto)">
|
<member name="M:CoreCms.Net.Web.WebApi.Controllers.SQController.JoinReservation(CoreCms.Net.Model.ViewModels.SQ.SQReservationParticipantsAddDto)">
|
||||||
<summary>
|
<summary>
|
||||||
用户加入预约接口
|
用户加入预约接口
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user