|
|
@@ -1,6 +1,7 @@
|
|
|
using AutoMapper;
|
|
|
using Newtonsoft.Json;
|
|
|
using Newtonsoft.Json.Linq;
|
|
|
+using NPOI.POIFS.Properties;
|
|
|
using OASystem.Domain;
|
|
|
using OASystem.Domain.AesEncryption;
|
|
|
using OASystem.Domain.Dtos.Groups;
|
|
|
@@ -9,16 +10,23 @@ using OASystem.Domain.Entities.Financial;
|
|
|
using OASystem.Domain.Entities.Groups;
|
|
|
using OASystem.Domain.Entities.Resource;
|
|
|
using OASystem.Domain.ViewModels.Groups;
|
|
|
+using OASystem.Domain.ViewModels.JuHeExchangeRate;
|
|
|
+using System.Drawing;
|
|
|
using System.Security.Cryptography;
|
|
|
+using static Google.Protobuf.Reflection.FieldOptions.Types;
|
|
|
|
|
|
namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
{
|
|
|
public class AirTicketResRepository : BaseRepository<Grp_AirTicketReservations, Grp_AirTicketReservations>
|
|
|
{
|
|
|
private readonly IMapper _mapper;
|
|
|
- public AirTicketResRepository(SqlSugarClient sqlSugar, IMapper mapper) : base(sqlSugar)
|
|
|
+ private readonly DelegationInfoRepository _groupInfoRep;
|
|
|
+ private readonly TeamRateRepository _groupRateRep;
|
|
|
+ public AirTicketResRepository(SqlSugarClient sqlSugar, DelegationInfoRepository groupInfoRep, TeamRateRepository groupRateRep, IMapper mapper) : base(sqlSugar)
|
|
|
{
|
|
|
_mapper = mapper;
|
|
|
+ _groupInfoRep = groupInfoRep;
|
|
|
+ _groupRateRep = groupRateRep;
|
|
|
}
|
|
|
|
|
|
public async Task<Result> AirTicketResById(AirTicketResByIdDto dto)
|
|
|
@@ -50,7 +58,6 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
catch (Exception)
|
|
|
{
|
|
|
return result = new Result() { Code = -2, Msg = "未知错误" };
|
|
|
- throw;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -436,7 +443,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
{
|
|
|
Grp_CreditCardPayment grp_CreditCard = _mapper.Map<Grp_CreditCardPayment>(dto.CardPaymentOpData);
|
|
|
|
|
|
- //2025-04-07 第四次更改 PayDId == 72(刷卡) IsPay == 1
|
|
|
+ // 2025-04-07 第四次更改 PayDId == 72(刷卡) IsPay == 1
|
|
|
if (grp_CreditCard.PayDId == 72) grp_CreditCard.IsPay = 1;
|
|
|
else grp_CreditCard.IsPay = 0;
|
|
|
|
|
|
@@ -1093,5 +1100,928 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
public string VerifyResult { get; set; }
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ #region 2026版
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// list 2026版
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto">查询参数</param>
|
|
|
+ /// <returns>机票费用列表</returns>
|
|
|
+ public async Task<JsonView> ListAsync(AirTicketFeeListDto dto)
|
|
|
+ {
|
|
|
+ // 1. 参数校验
|
|
|
+ if (!SharingStaticData.PortTypes.Contains(dto.PortType))
|
|
|
+ return JsonView.Fail(MsgTips.Port);
|
|
|
+
|
|
|
+ if (dto.DiId <= 0)
|
|
|
+ return JsonView.Fail("团组ID无效");
|
|
|
+
|
|
|
+ // 2. 获取团组信息
|
|
|
+ var groupInfo = await _groupInfoRep.GetGroupAirInfo(dto.DiId);
|
|
|
+ if (groupInfo == null)
|
|
|
+ return JsonView.Fail("暂无团组数据!");
|
|
|
+
|
|
|
+ // 3. 查询机票费用列表
|
|
|
+ var airTicketFeeList = await _sqlSugar.Queryable<Grp_AirTicketReservations>()
|
|
|
+ .InnerJoin<Grp_CreditCardPayment>((x, y) => x.Id == y.CId && x.DIId == y.DIId)
|
|
|
+ .LeftJoin<Sys_SetData>((x, y, z) => x.CType == z.Id)
|
|
|
+ .LeftJoin<Sys_SetData>((x, y, z, z1) => x.Currency == z1.Id)
|
|
|
+ .LeftJoin<Sys_Users>((x, y, z, z1, u) => x.CreateUserId == u.Id)
|
|
|
+ .Where((x, y, z, z1, u) => x.IsDel == 0 && y.IsDel == 0 && x.DIId == dto.DiId)
|
|
|
+ .WhereIF(dto.IsPaySign != -1, (x, y, z, z1, u) => y.IsPay == dto.IsPaySign)
|
|
|
+ .Select((x, y, z, z1, u) => new AirTicketFeeListView()
|
|
|
+ {
|
|
|
+ Id = x.Id,
|
|
|
+ CabinName = z.Name,
|
|
|
+ FlightDesc = x.FlightsDescription,
|
|
|
+ ClientNameList = x.ClientName,
|
|
|
+ ClientCount = x.ClientNum,
|
|
|
+ TotalTicketPrice = x.Price,
|
|
|
+ Currency = z1.Name,
|
|
|
+ AuditStatus = y.IsAuditGM.ToString(),
|
|
|
+ Remark = y.Remark,
|
|
|
+ Applicant = u.CnName,
|
|
|
+ ApplyTime = x.CreateTime.ToString("yyyy-MM-dd HH:mm:ss")
|
|
|
+ })
|
|
|
+ .ToListAsync();
|
|
|
+
|
|
|
+ // 4. 获取黑屏代码(三字码映射)
|
|
|
+ var threeCodes = await _sqlSugar.Queryable<Res_ThreeCode>()
|
|
|
+ .Where(x => x.IsDel == 0)
|
|
|
+ .ToDictionaryAsync(x => x.Three, x => x.AirPort);
|
|
|
+
|
|
|
+ // 5. 获取团组成本预算
|
|
|
+ var groupCostParameter = await _sqlSugar.Queryable<Grp_GroupCostParameter>()
|
|
|
+ .FirstAsync(a => a.DiId == dto.DiId && a.IsDel == 0 && a.CostType == "A" && a.IsShare == 1);
|
|
|
+ var airgroupCostParameter = _mapper.Map<AirGroupCostParameterView>(groupCostParameter);
|
|
|
+
|
|
|
+ // 6. 获取客户信息映射
|
|
|
+ var groupClientIds = await _sqlSugar.Queryable<Grp_TourClientList>()
|
|
|
+ .Where(a => a.DiId == dto.DiId && a.IsDel == 0)
|
|
|
+ .Select(x => x.ClientId)
|
|
|
+ .ToListAsync();
|
|
|
+
|
|
|
+ var clientInfoMap = new Dictionary<int, (string FirstName, string LastName, string Pinyin)>();
|
|
|
+ if (groupClientIds.Any())
|
|
|
+ {
|
|
|
+ var encryptedClients = await _sqlSugar.Queryable<Crm_DeleClient>()
|
|
|
+ .Where(a => a.IsDel == 0 && groupClientIds.Contains(a.Id))
|
|
|
+ .Select(x => new { x.Id, x.FirstName, x.LastName, x.Pinyin })
|
|
|
+ .ToListAsync();
|
|
|
+
|
|
|
+ foreach (var client in encryptedClients)
|
|
|
+ {
|
|
|
+ clientInfoMap[client.Id] = (
|
|
|
+ AesEncryptionHelper.Decrypt(client.FirstName),
|
|
|
+ AesEncryptionHelper.Decrypt(client.LastName),
|
|
|
+ AesEncryptionHelper.Decrypt(client.Pinyin)
|
|
|
+ );
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 7. 处理航班描述和客户名称
|
|
|
+ foreach (var item in airTicketFeeList)
|
|
|
+ {
|
|
|
+ // 7.1 处理航班描述
|
|
|
+ if (!string.IsNullOrWhiteSpace(item.FlightDesc))
|
|
|
+ {
|
|
|
+ var flightInfos = FlightParser.ParseFlights(item.FlightDesc);
|
|
|
+ var flightDescBuilder = new StringBuilder();
|
|
|
+
|
|
|
+ foreach (var flightInfo in flightInfos)
|
|
|
+ {
|
|
|
+ string departAirport = threeCodes.ContainsKey(flightInfo.DepartureAirport)
|
|
|
+ ? threeCodes[flightInfo.DepartureAirport]?.ToString() ?? flightInfo.DepartureAirport
|
|
|
+ : flightInfo.DepartureAirport;
|
|
|
+
|
|
|
+ string arrivalAirport = threeCodes.ContainsKey(flightInfo.ArrivalAirport)
|
|
|
+ ? threeCodes[flightInfo.ArrivalAirport]?.ToString() ?? flightInfo.ArrivalAirport
|
|
|
+ : flightInfo.ArrivalAirport;
|
|
|
+
|
|
|
+ string desc = $"{flightInfo.SequenceNo}.{departAirport}→{arrivalAirport}({flightInfo.DepartureDate})";
|
|
|
+ flightDescBuilder.AppendLine(desc);
|
|
|
+ }
|
|
|
+
|
|
|
+ item.FlightDesc = flightDescBuilder.ToString().TrimEnd();
|
|
|
+ }
|
|
|
+
|
|
|
+ // 7.2 处理客户名称
|
|
|
+ if (!string.IsNullOrWhiteSpace(item.ClientNameList))
|
|
|
+ {
|
|
|
+ var clientArr = item.ClientNameList.Split(',')
|
|
|
+ .Where(x => !string.IsNullOrWhiteSpace(x))
|
|
|
+ .ToArray();
|
|
|
+
|
|
|
+ var clientNames = new List<string>();
|
|
|
+
|
|
|
+ foreach (var clientItem in clientArr)
|
|
|
+ {
|
|
|
+ if (int.TryParse(clientItem, out int clientId))
|
|
|
+ {
|
|
|
+ if (clientId == -1)
|
|
|
+ {
|
|
|
+ clientNames.Add("行程单");
|
|
|
+ }
|
|
|
+ else if (clientInfoMap.TryGetValue(clientId, out var clientInfo))
|
|
|
+ {
|
|
|
+ clientNames.Add(clientInfo.Pinyin);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ clientNames.Add(clientItem);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ item.ClientNameList = clientNames.Any() ? string.Join(",", clientNames) : string.Empty;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 8. 根据端口类型返回数据
|
|
|
+ if (dto.PortType == 1)
|
|
|
+ {
|
|
|
+ var data = new
|
|
|
+ {
|
|
|
+ DelegationInfo = groupInfo,
|
|
|
+ AirTicketReservations = airTicketFeeList,
|
|
|
+ AirGroupCostParameter = airgroupCostParameter
|
|
|
+ };
|
|
|
+ return JsonView.Success(data);
|
|
|
+ }
|
|
|
+ else if (dto.PortType == 2 || dto.PortType == 3)
|
|
|
+ {
|
|
|
+ int totalCount = airTicketFeeList.Count;
|
|
|
+ int totalPages = (int)Math.Ceiling((double)totalCount / dto.PageSize);
|
|
|
+ if (totalPages == 0) totalPages = 1;
|
|
|
+
|
|
|
+ // 分页数据
|
|
|
+ var pagedData = airTicketFeeList
|
|
|
+ .Skip((dto.PageIndex - 1) * dto.PageSize)
|
|
|
+ .Take(dto.PageSize)
|
|
|
+ .ToList();
|
|
|
+
|
|
|
+ var rst = new ListViewBase<AirTicketFeeListView>
|
|
|
+ {
|
|
|
+ DataList = pagedData,
|
|
|
+ DataCount = totalCount,
|
|
|
+ CurrPageIndex = dto.PageIndex,
|
|
|
+ CurrPageSize = dto.PageSize
|
|
|
+ };
|
|
|
+
|
|
|
+ var data = new
|
|
|
+ {
|
|
|
+ AirData = rst,
|
|
|
+ AirGroupCostParameter = airgroupCostParameter
|
|
|
+ };
|
|
|
+ return JsonView.Success(data);
|
|
|
+ }
|
|
|
+
|
|
|
+ return JsonView.Fail("暂无团组数据!");
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 机票费用基础数据 2026版
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task<JsonView> BasicDataAsync(int userId)
|
|
|
+ {
|
|
|
+ var setDatas = _sqlSugar.Queryable<Sys_SetData>().Where(a => a.IsDel == 0).ToList();
|
|
|
+
|
|
|
+ // 附加服务类型
|
|
|
+ var additionalServiceTypes = setDatas
|
|
|
+ .Where(a => a.STid == 139 && a.IsDel == 0)
|
|
|
+ .Select(a => _mapper.Map<SetDataInfoView>(a))
|
|
|
+ .OrderBy(x => x.RemarkSort)
|
|
|
+ .ToList();
|
|
|
+
|
|
|
+ // 舱位类型
|
|
|
+ var ticketClass = setDatas
|
|
|
+ .Where(a => a.STid == 44 && a.IsDel == 0)
|
|
|
+ .Select(a => _mapper.Map<SetDataInfoView>(a))
|
|
|
+ .ToList();
|
|
|
+
|
|
|
+ // 支付方式
|
|
|
+ var payments = setDatas
|
|
|
+ .Where(a => a.STid == 14 && a.IsDel == 0)
|
|
|
+ .Select(a => _mapper.Map<SetDataInfoView>(a))
|
|
|
+ .ToList();
|
|
|
+
|
|
|
+ // 卡类型
|
|
|
+ var cardTypes = setDatas
|
|
|
+ .Where(a => a.STid == 15 && a.IsDel == 0)
|
|
|
+ .Select(a => _mapper.Map<SetDataInfoView>(a))
|
|
|
+ .ToList();
|
|
|
+
|
|
|
+ // 合作方资料
|
|
|
+ var airTicketAgents = _sqlSugar.Queryable<Res_AirTicketAgent>().Where(a => a.IsDel == 0).ToList();
|
|
|
+ foreach (var item in airTicketAgents)
|
|
|
+ {
|
|
|
+ EncryptionProcessor.DecryptProperties(item);
|
|
|
+ }
|
|
|
+
|
|
|
+ var airTicketAgentsView = airTicketAgents.Select(x => new
|
|
|
+ {
|
|
|
+ x.Id,
|
|
|
+ x.Name,
|
|
|
+ x.Account,
|
|
|
+ x.Bank
|
|
|
+ }).ToList();
|
|
|
+
|
|
|
+
|
|
|
+ #region 团组下拉框
|
|
|
+
|
|
|
+ var permGroupIds = Query<Grp_GroupsTaskAssignment>(a => a.IsDel == 0 && a.UId == userId && a.CTId == 85).Select(a => a.DIId).ToList();
|
|
|
+
|
|
|
+ var teamNames = _sqlSugar.Queryable<Grp_DelegationInfo>()
|
|
|
+ .Where(x => x.IsDel == 0 && permGroupIds.Contains(x.Id))
|
|
|
+ .OrderByDescending(x => x.VisitDate)
|
|
|
+ .Select(x => new
|
|
|
+ {
|
|
|
+ x.Id,
|
|
|
+ x.TeamName
|
|
|
+ })
|
|
|
+ .ToList();
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ // 获取第一个团组的基本信息
|
|
|
+ var firstGroupInfo = await _groupInfoRep.GetGroupAirInfo(teamNames.FirstOrDefault()?.Id ?? 0);
|
|
|
+
|
|
|
+ return JsonView.Success(new
|
|
|
+ {
|
|
|
+ additionalServiceTypes,
|
|
|
+ ticketClass,
|
|
|
+ payment = payments,
|
|
|
+ cardType = cardTypes,
|
|
|
+ airTicketAgents = airTicketAgentsView,
|
|
|
+ firstGroupInfo,
|
|
|
+ groupName = teamNames
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 详情 2026版
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task<JsonView> InfoAsync(int userId, int groupId)
|
|
|
+ {
|
|
|
+ var view = new AirTicketFeeInfoView()
|
|
|
+ {
|
|
|
+ CurrUserId = userId,
|
|
|
+ GroupAirInfo = new GroupAirTicketInfo(),
|
|
|
+ AirTicketFeeInfos = new List<AirTicketFeeInfo>()
|
|
|
+ };
|
|
|
+
|
|
|
+ if (userId < 1) return JsonView.Fail<AirTicketFeeInfoView>("用户ID无效");
|
|
|
+ if (groupId < 1) return JsonView.Fail<AirTicketFeeInfoView>("团组ID无效");
|
|
|
+
|
|
|
+ var groupVaild = Query<Grp_GroupsTaskAssignment>(a => a.IsDel == 0 && a.UId == userId && a.CTId == 85 && a.DIId == groupId).Any();
|
|
|
+ if (!groupVaild) return JsonView.Fail<AirTicketFeeInfoView>("没有查看权限");
|
|
|
+
|
|
|
+ // 获取第一个团组的基本信息
|
|
|
+ var firstGroupInfo = await _groupInfoRep.GetGroupAirInfo(groupId);
|
|
|
+ if (firstGroupInfo == null)
|
|
|
+ return JsonView.Fail<AirTicketFeeInfoView>("团组信息不存在");
|
|
|
+
|
|
|
+ // 团组公共信息
|
|
|
+ var groupInfo = _mapper.Map<GroupAirTicketInfo>(firstGroupInfo);
|
|
|
+
|
|
|
+ // 机票信息集合
|
|
|
+ var airTicketFeeInfos = await _sqlSugar.Queryable<Grp_AirTicketReservations>()
|
|
|
+ .InnerJoin<Grp_CreditCardPayment>((x, y) => x.Id == y.CId && x.DIId == y.DIId && y.CTable == 85)
|
|
|
+ .Where((x, y) => x.IsDel == 0 && y.IsDel == 0 && x.DIId == groupId && x.RecordType == 0)
|
|
|
+ .Select((x, y) => new AirTicketFeeInfo
|
|
|
+ {
|
|
|
+ // 机票信息
|
|
|
+ Id = x.Id,
|
|
|
+ FlightsDescription = x.FlightsDescription,
|
|
|
+ AirTicketBasicInfos = x.AirTicketBasicInfos,
|
|
|
+ ClientName = x.ClientName,
|
|
|
+ CustTicketInfos = x.CustTicketInfos,
|
|
|
+ PriceDescription = x.PriceDescription,
|
|
|
+ // 支付信息
|
|
|
+ PayDId = y.PayDId,
|
|
|
+ ConsumptionPatterns = y.ConsumptionPatterns,
|
|
|
+ ConsumptionDate = y.ConsumptionDate,
|
|
|
+ PayMoney = y.PayMoney,
|
|
|
+ PaymentCurrency = y.PaymentCurrency,
|
|
|
+ CTDId = y.CTDId,
|
|
|
+ BankNo = y.BankNo,
|
|
|
+ CardholderName = y.CardholderName,
|
|
|
+ DayRate = y.DayRate,
|
|
|
+ CompanyBankNo = y.CompanyBankNo,
|
|
|
+ OtherSideNo = y.OtherSideNo,
|
|
|
+ OtherSideName = y.OtherSideName,
|
|
|
+ Payee = y.Payee,
|
|
|
+ OrbitalPrivateTransfer = y.OrbitalPrivateTransfer,
|
|
|
+ Remark = y.Remark,
|
|
|
+ IsAuditGM = y.IsAuditGM,
|
|
|
+ AuditGMOperate = y.AuditGMOperate,
|
|
|
+ AuditGMDate = y.AuditGMDate
|
|
|
+ })
|
|
|
+ .ToListAsync();
|
|
|
+
|
|
|
+ // 如果没有数据,返回空结果
|
|
|
+ if (!airTicketFeeInfos.Any())
|
|
|
+ {
|
|
|
+ groupInfo.FlightsDescription = string.Empty;
|
|
|
+ return JsonView.Success(new AirTicketFeeInfoView()
|
|
|
+ {
|
|
|
+ CurrUserId = userId,
|
|
|
+ GroupAirInfo = groupInfo,
|
|
|
+ AirTicketFeeInfos = new List<AirTicketFeeInfo>()
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ // 航班舱位类型
|
|
|
+ var cabinTypes = await _sqlSugar.Queryable<Sys_SetData>().Where(x => x.IsDel == 0 && x.STid == 44).ToListAsync();
|
|
|
+
|
|
|
+ // 分组统计一个航班行程的信息
|
|
|
+ var groupedByFlights = airTicketFeeInfos
|
|
|
+ .GroupBy(x => x.FlightsDescription)
|
|
|
+ .Select(g =>
|
|
|
+ {
|
|
|
+ var first = g.First();
|
|
|
+
|
|
|
+ // 合并航班基础信息(去重)
|
|
|
+ var airTicketBasicInfos = g.SelectMany(x => x.AirTicketBasicInfos ?? new List<AirTicketBasicInfo>()).Distinct().ToList();
|
|
|
+
|
|
|
+ // 合并客户名称(去重)
|
|
|
+ var clientNames = string.Join(",", g.Select(x => x.ClientName).ToList());
|
|
|
+ var clientNameIds = ParseToIntListSafe(clientNames);
|
|
|
+
|
|
|
+ // 处理审核状态
|
|
|
+ var auditsStr = new StringBuilder();
|
|
|
+ foreach (var item in g)
|
|
|
+ {
|
|
|
+ var auditStatus = item.IsAuditGM switch
|
|
|
+ {
|
|
|
+ 0 => "未审核",
|
|
|
+ 1 => "审核通过",
|
|
|
+ 2 => "审核驳回",
|
|
|
+ 3 => "自动审核",
|
|
|
+ _ => "未知状态"
|
|
|
+ };
|
|
|
+
|
|
|
+ var cabinTypeName = cabinTypes.FirstOrDefault(c => c.Id == item.CustTicketInfos.FirstOrDefault()?.CType)?.Name ?? "未知舱位";
|
|
|
+
|
|
|
+ auditsStr.Append($"{cabinTypeName}:{auditStatus};");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 处理多舱位审核描述
|
|
|
+ var newFlight = new AirTicketFeeInfo
|
|
|
+ {
|
|
|
+ Id = first.Id,
|
|
|
+ FlightsDescription = g.Key,
|
|
|
+
|
|
|
+ // 合并航班基础信息(去重)
|
|
|
+ AirTicketBasicInfos = airTicketBasicInfos,
|
|
|
+
|
|
|
+ // 合并客户人员
|
|
|
+ ClientName = clientNames,
|
|
|
+ ClientNameIds = clientNameIds,
|
|
|
+
|
|
|
+ // 合并所有客户的机票信息
|
|
|
+ CustTicketInfos = g.SelectMany(x => x.CustTicketInfos ?? new List<CustTicketInfo>()).ToList(),
|
|
|
+
|
|
|
+ PriceDescription = first.PriceDescription,
|
|
|
+
|
|
|
+ // 付款信息
|
|
|
+ PayDId = first.PayDId,
|
|
|
+ ConsumptionPatterns = first.ConsumptionPatterns,
|
|
|
+ ConsumptionDate = first.ConsumptionDate,
|
|
|
+ PayMoney = g.Sum(x => x.PayMoney),
|
|
|
+ PaymentCurrency = first.PaymentCurrency,
|
|
|
+ CTDId = first.CTDId,
|
|
|
+ BankNo = first.BankNo,
|
|
|
+ CardholderName = first.CardholderName,
|
|
|
+ DayRate = first.DayRate,
|
|
|
+ CompanyBankNo = first.CompanyBankNo,
|
|
|
+ OtherSideNo = first.OtherSideNo,
|
|
|
+ OtherSideName = first.OtherSideName,
|
|
|
+ Payee = first.Payee,
|
|
|
+ OrbitalPrivateTransfer = first.OrbitalPrivateTransfer,
|
|
|
+ Remark = first.Remark,
|
|
|
+ IsAuditGM = first.IsAuditGM,
|
|
|
+ AuditGMOperate = first.AuditGMOperate,
|
|
|
+ AuditGMDate = first.AuditGMDate,
|
|
|
+ AuditStr = auditsStr.ToString().Trim()
|
|
|
+ };
|
|
|
+
|
|
|
+ return newFlight;
|
|
|
+ })
|
|
|
+ .ToList();
|
|
|
+
|
|
|
+ // 按序号排序
|
|
|
+ groupedByFlights = groupedByFlights
|
|
|
+ .OrderBy(x => ExtractSequenceNo(x.FlightsDescription))
|
|
|
+ .ToList();
|
|
|
+
|
|
|
+ // 提取完整的航班行程信息
|
|
|
+ var flightsDescAll = new StringBuilder();
|
|
|
+ foreach (var item in groupedByFlights)
|
|
|
+ {
|
|
|
+ flightsDescAll.AppendLine(item.FlightsDescription);
|
|
|
+
|
|
|
+ // 添加测试数据
|
|
|
+ if (!item.AirTicketBasicInfos.Any())
|
|
|
+ {
|
|
|
+ item.AirTicketBasicInfos = FlightParser.ParseFlights(item.FlightsDescription)
|
|
|
+ .Select(x => new AirTicketBasicInfo()
|
|
|
+ {
|
|
|
+ No = x.SequenceNo,
|
|
|
+ FlightsCode = x.FlightNumber,
|
|
|
+ FlightsCity = $"{x.DepartureAirport}/{x.ArrivalAirport}",
|
|
|
+ FlightsDate = x.DepartureDate,
|
|
|
+ FlightsTime = x.DepartureTime,
|
|
|
+ ArrivedTime = x.ArrivalTime
|
|
|
+ })
|
|
|
+ .ToList();
|
|
|
+ }
|
|
|
+
|
|
|
+ // 添加测试费用数据(仅用于测试,生产环境应移除)
|
|
|
+ if (!item.CustTicketInfos.Any())
|
|
|
+ {
|
|
|
+ item.CustTicketInfos = GetTestCustomerData();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ groupInfo.FlightsDescription = flightsDescAll.ToString();
|
|
|
+
|
|
|
+ return JsonView.Success(new AirTicketFeeInfoView()
|
|
|
+ {
|
|
|
+ CurrUserId = userId,
|
|
|
+ GroupAirInfo = groupInfo,
|
|
|
+ AirTicketFeeInfos = groupedByFlights
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ #region info 辅助方法
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 将逗号分隔的字符串解析为 List<int>(带错误处理)
|
|
|
+ /// </summary>
|
|
|
+ public static List<int> ParseToIntListSafe(string input)
|
|
|
+ {
|
|
|
+ if (string.IsNullOrWhiteSpace(input))
|
|
|
+ return new List<int>();
|
|
|
+
|
|
|
+ var result = new List<int>();
|
|
|
+ var parts = input.Split(',');
|
|
|
+
|
|
|
+ foreach (var part in parts)
|
|
|
+ {
|
|
|
+ if (int.TryParse(part.Trim(), out int value))
|
|
|
+ {
|
|
|
+ result.Add(value);
|
|
|
+ }
|
|
|
+ // 可选:记录解析失败的值
|
|
|
+ }
|
|
|
+
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 提取序号辅助方法
|
|
|
+ /// </summary>
|
|
|
+ private static int ExtractSequenceNo(string flightsDescription)
|
|
|
+ {
|
|
|
+ if (string.IsNullOrWhiteSpace(flightsDescription))
|
|
|
+ return int.MaxValue;
|
|
|
+
|
|
|
+ var match = Regex.Match(flightsDescription, @"^(\d+)\.");
|
|
|
+ return match.Success ? int.Parse(match.Groups[1].Value) : int.MaxValue;
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 获取测试数据
|
|
|
+ /// </summary>
|
|
|
+ private static List<CustTicketInfo> GetTestCustomerData()
|
|
|
+ {
|
|
|
+ var testData = new CustTicketInfo()
|
|
|
+ {
|
|
|
+ ClientId = 1081,
|
|
|
+ CType = 460,
|
|
|
+ ActualPrice = 1000,
|
|
|
+ TicketCode = "9991234567890",
|
|
|
+ TicketNumber = "ABC123",
|
|
|
+ SelectedServiceIds = new List<int> { 1561, 1563 },
|
|
|
+ AdditionalServices = new List<AdditionalService>()
|
|
|
+ {
|
|
|
+ new AdditionalService() { ServiceTypeId = 1561, Amount = 100 },
|
|
|
+ new AdditionalService() { ServiceTypeId = 1563, Amount = 50 }
|
|
|
+ },
|
|
|
+ TotalTicketPrice = 1150,
|
|
|
+ IsRefund = true,
|
|
|
+ RefundRecord = new RefundRecord()
|
|
|
+ {
|
|
|
+ RefundAmount = -200,
|
|
|
+ NonRefundableTax = -100,
|
|
|
+ RefundReason = "航班取消",
|
|
|
+ RefundTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
|
|
|
+ RefundAccount = 0,
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ return new List<CustTicketInfo>
|
|
|
+ {
|
|
|
+ testData,
|
|
|
+ new CustTicketInfo
|
|
|
+ {
|
|
|
+ ClientId = 1720,
|
|
|
+ CType = 460,
|
|
|
+ ActualPrice = 1000,
|
|
|
+ TicketCode = "9991234567890",
|
|
|
+ TicketNumber = "ABC123"
|
|
|
+ },
|
|
|
+ new CustTicketInfo
|
|
|
+ {
|
|
|
+ ClientId = 163,
|
|
|
+ CType = 460,
|
|
|
+ ActualPrice = 1000,
|
|
|
+ TicketCode = "9991234567890",
|
|
|
+ TicketNumber = "ABC123"
|
|
|
+ }
|
|
|
+ };
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 保存 2026版
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task<JsonView<AppPushBodyView>> SaveAsync(AirTicketFeeSaveDto dto)
|
|
|
+ {
|
|
|
+ // 1. 基础字段设置
|
|
|
+ var currUserId = dto.CurrUserId;
|
|
|
+ var groupId = dto.GroupAirInfo?.Id ?? 0;
|
|
|
+ var successMsg = new StringBuilder();
|
|
|
+ var appPushBodyInfos = new List<AppPushBodyInfo>();
|
|
|
+ var index = 1;
|
|
|
+
|
|
|
+ // 2. 整理数据
|
|
|
+ var airFeeRecords = await OrganizeAirTicketDataAsync(dto.AirTicketFeeInfos, groupId);
|
|
|
+
|
|
|
+ if (airFeeRecords == null || !airFeeRecords.Any())
|
|
|
+ {
|
|
|
+ return JsonView<AppPushBodyView>.Success("没有需要保存的数据");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 3. 开启事务
|
|
|
+ _sqlSugar.Ado.BeginTran();
|
|
|
+
|
|
|
+ try
|
|
|
+ {
|
|
|
+ foreach (var airInfo in airFeeRecords)
|
|
|
+ {
|
|
|
+ var airFeeInfo = _mapper.Map<Grp_AirTicketReservations>(airInfo);
|
|
|
+ var cardPaymentInfo = _mapper.Map<Grp_CreditCardPayment>(airInfo);
|
|
|
+
|
|
|
+ // 设置公共字段
|
|
|
+ airFeeInfo.CreateUserId = currUserId;
|
|
|
+ airFeeInfo.IsDel = 0;
|
|
|
+
|
|
|
+ cardPaymentInfo.CreateUserId = currUserId;
|
|
|
+ cardPaymentInfo.DIId = groupId;
|
|
|
+ cardPaymentInfo.CTable = 85;
|
|
|
+ cardPaymentInfo.UpdateDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
+ cardPaymentInfo.IsPay = cardPaymentInfo.PayDId == 72 ? 1 : 0;
|
|
|
+ cardPaymentInfo.PayThenMoney = cardPaymentInfo.PayMoney;
|
|
|
+ cardPaymentInfo.RMBPrice = cardPaymentInfo.PayMoney * cardPaymentInfo.DayRate;
|
|
|
+ cardPaymentInfo.IsDel = 0;
|
|
|
+
|
|
|
+ // 判断是否存在(通过唯一键)
|
|
|
+ var existingAir = await _sqlSugar.Queryable<Grp_AirTicketReservations>()
|
|
|
+ .FirstAsync(x => x.DIId == groupId
|
|
|
+ && x.FlightsDescription == airFeeInfo.FlightsDescription
|
|
|
+ && x.CType == airFeeInfo.CType
|
|
|
+ && x.RecordType == airFeeInfo.RecordType
|
|
|
+ && x.IsDel == 0);
|
|
|
+
|
|
|
+ int airId = 0;
|
|
|
+ int cardId = 0;
|
|
|
+
|
|
|
+ if (existingAir == null)
|
|
|
+ {
|
|
|
+ // ========== 新增 ==========
|
|
|
+ var (Success, ErrorMessage, AirId, CardId) = await InsertNewRecord(airFeeInfo, cardPaymentInfo, index);
|
|
|
+ if (!Success)
|
|
|
+ {
|
|
|
+ RollbackTran();
|
|
|
+ return JsonView<AppPushBodyView>.Fail(ErrorMessage);
|
|
|
+ }
|
|
|
+ airId = AirId;
|
|
|
+ cardId = CardId;
|
|
|
+
|
|
|
+ appPushBodyInfos.Add(new AppPushBodyInfo()
|
|
|
+ {
|
|
|
+ OperationType = 1,
|
|
|
+ AirTicketId = airId,
|
|
|
+ CardId = cardId,
|
|
|
+ CardCNYAmount = cardPaymentInfo.RMBPrice
|
|
|
+ });
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ // ========== 修改 ==========
|
|
|
+ var result = await UpdateExistingRecord(airFeeInfo, cardPaymentInfo, existingAir, groupId, index);
|
|
|
+ if (!result.Success)
|
|
|
+ {
|
|
|
+ if (result.IsSkip)
|
|
|
+ {
|
|
|
+ successMsg.AppendLine(result.ErrorMessage);
|
|
|
+ index++;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ RollbackTran();
|
|
|
+ return JsonView<AppPushBodyView>.Fail(result.ErrorMessage);
|
|
|
+ }
|
|
|
+ airId = result.AirId;
|
|
|
+ cardId = result.CardId;
|
|
|
+
|
|
|
+ appPushBodyInfos.Add(new AppPushBodyInfo()
|
|
|
+ {
|
|
|
+ OperationType = 2,
|
|
|
+ AirTicketId = airId,
|
|
|
+ CardId = cardId,
|
|
|
+ CardCNYAmount = cardPaymentInfo.RMBPrice
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ index++;
|
|
|
+ }
|
|
|
+
|
|
|
+ _sqlSugar.Ado.CommitTran();
|
|
|
+
|
|
|
+ var view = new AppPushBodyView()
|
|
|
+ {
|
|
|
+ GroupName = dto.GroupAirInfo.TeamName,
|
|
|
+ AppPushBodyInfos = appPushBodyInfos
|
|
|
+ };
|
|
|
+
|
|
|
+ if (successMsg.Length > 0) successMsg.Append("其他新增成功!");
|
|
|
+ else successMsg.Append("保存成功!");
|
|
|
+
|
|
|
+ return JsonView<AppPushBodyView>.Success(successMsg.ToString(),view);
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ RollbackTran();
|
|
|
+ return JsonView<AppPushBodyView>.Fail($"保存失败:{ex.Message}");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ #region 保存 辅助方法
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 整理数据(按舱位类型分组,分离退票和正常记录)
|
|
|
+ /// </summary>
|
|
|
+ private Task<List<AirTicketFeeInfo>> OrganizeAirTicketDataAsync(List<AirTicketFeeInfo> airTicketFeeInfos, int groupId)
|
|
|
+ {
|
|
|
+ var result = new List<AirTicketFeeInfo>();
|
|
|
+
|
|
|
+ foreach (var airInfo in airTicketFeeInfos)
|
|
|
+ {
|
|
|
+ if (airInfo.CustTicketInfos == null || !airInfo.CustTicketInfos.Any())
|
|
|
+ continue;
|
|
|
+
|
|
|
+ var custRecord = _mapper.Map<AirTicketFeeOpInfo>(airInfo);
|
|
|
+
|
|
|
+ // 按舱位类型分组
|
|
|
+ var groupByCabinType = airInfo.CustTicketInfos
|
|
|
+ .GroupBy(x => x.CType)
|
|
|
+ .ToList();
|
|
|
+
|
|
|
+ foreach (var cabinGroup in groupByCabinType)
|
|
|
+ {
|
|
|
+ var customers = cabinGroup.ToList();
|
|
|
+
|
|
|
+ // 有退票的客户
|
|
|
+ var refundCustomers = customers.Where(x => x.IsRefund).ToList();
|
|
|
+
|
|
|
+ // 1. 同类型舱位(有退票信息的客户正常存储)- 合并成一条数据
|
|
|
+ if (customers.Any())
|
|
|
+ {
|
|
|
+ custRecord.ClientNum = customers.Count;
|
|
|
+ custRecord.ClientName = string.Join(",", customers.Select(x => x.ClientId));
|
|
|
+ custRecord.CustTicketInfos = customers;
|
|
|
+ custRecord.Price = customers.Sum(x => x.ActualPrice);
|
|
|
+ custRecord.Currency = airInfo.PaymentCurrency;
|
|
|
+ custRecord.PayMoney = customers.Sum(x => x.TotalTicketPrice);
|
|
|
+
|
|
|
+ result.Add(custRecord);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 2. 有退票记录的客户信息 - 按舱位类型合并成一条数据
|
|
|
+ if (refundCustomers.Any())
|
|
|
+ {
|
|
|
+ custRecord.RecordType = 1; // 退票记录
|
|
|
+ custRecord.OriginalReservationId = custRecord.Id; // 关联原始记录
|
|
|
+ custRecord.ClientNum = refundCustomers.Count;
|
|
|
+ custRecord.ClientName = string.Join(",", refundCustomers.Select(x => x.ClientId));
|
|
|
+ custRecord.CustTicketInfos = refundCustomers;
|
|
|
+
|
|
|
+ // 计算退款金额, 当前金额为负数
|
|
|
+ decimal totalRefundAmount = refundCustomers.Sum(x => (x.RefundRecord?.RefundAmount ?? 0) + (x.RefundRecord?.NonRefundableTax ?? 0));
|
|
|
+ custRecord.Price = totalRefundAmount;
|
|
|
+ custRecord.Currency = airInfo.PaymentCurrency;
|
|
|
+ custRecord.PayMoney = totalRefundAmount;
|
|
|
+ custRecord.CTDId = refundCustomers.FirstOrDefault()?.RefundRecord?.RefundAccount ?? 0;
|
|
|
+ result.Add(custRecord);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return Task.FromResult(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 新增记录
|
|
|
+ /// </summary>
|
|
|
+ private async Task<(bool Success, string ErrorMessage, int AirId, int CardId)> InsertNewRecord(
|
|
|
+ Grp_AirTicketReservations airFeeInfo,
|
|
|
+ Grp_CreditCardPayment cardPaymentInfo,
|
|
|
+ int index)
|
|
|
+ {
|
|
|
+ // 如果是退票记录,需要先获取关联的正常机票ID
|
|
|
+ if (airFeeInfo.RecordType == 1)
|
|
|
+ {
|
|
|
+ // 根据唯一键查找关联的正常机票记录
|
|
|
+ var normalAir = await _sqlSugar.Queryable<Grp_AirTicketReservations>()
|
|
|
+ .FirstAsync(x => x.DIId == airFeeInfo.DIId
|
|
|
+ && x.FlightsDescription == airFeeInfo.FlightsDescription
|
|
|
+ && x.CType == airFeeInfo.CType
|
|
|
+ && x.RecordType == 0
|
|
|
+ && x.IsDel == 0);
|
|
|
+
|
|
|
+ // 设置关联的正常机票ID
|
|
|
+ airFeeInfo.OriginalReservationId = normalAir?.Id ?? 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 插入机票信息
|
|
|
+ var airIdLong = await _sqlSugar.Insertable(airFeeInfo).ExecuteReturnIdentityAsync();
|
|
|
+ var airId = (int)airIdLong;
|
|
|
+
|
|
|
+ if (airId < 1)
|
|
|
+ {
|
|
|
+ return (false, $"第{index}条,机票信息添加失败", 0, 0);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 插入付款信息
|
|
|
+ cardPaymentInfo.CId = airId;
|
|
|
+ var cardIdLong = await _sqlSugar.Insertable(cardPaymentInfo).ExecuteReturnIdentityAsync();
|
|
|
+ var cardId = (int)cardIdLong;
|
|
|
+
|
|
|
+ if (cardId < 1)
|
|
|
+ {
|
|
|
+ return (false, $"第{index}条,机票付款信息添加失败", 0, 0);
|
|
|
+ }
|
|
|
+
|
|
|
+ return (true, string.Empty, airId, cardId);
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 更新记录
|
|
|
+ /// </summary>
|
|
|
+ private async Task<(bool Success, bool IsSkip, string ErrorMessage, int AirId, int CardId)> UpdateExistingRecord(
|
|
|
+ Grp_AirTicketReservations airFeeInfo,
|
|
|
+ Grp_CreditCardPayment cardPaymentInfo,
|
|
|
+ Grp_AirTicketReservations existingAir,
|
|
|
+ int groupId,
|
|
|
+ int index)
|
|
|
+ {
|
|
|
+ var airId = existingAir.Id;
|
|
|
+ airFeeInfo.Id = airId;
|
|
|
+
|
|
|
+ // 如果是退票记录,需要关联正常机票ID
|
|
|
+ if (airFeeInfo.RecordType == 1)
|
|
|
+ {
|
|
|
+ // 如果还没有关联正常机票ID,或者需要更新关联
|
|
|
+ if (airFeeInfo.OriginalReservationId <= 0)
|
|
|
+ {
|
|
|
+ var normalAir1 = await _sqlSugar.Queryable<Grp_AirTicketReservations>()
|
|
|
+ .FirstAsync(x => x.DIId == groupId
|
|
|
+ && x.FlightsDescription == airFeeInfo.FlightsDescription
|
|
|
+ && x.CType == airFeeInfo.CType
|
|
|
+ && x.RecordType == 0
|
|
|
+ && x.IsDel == 0);
|
|
|
+
|
|
|
+ if (normalAir1 == null)
|
|
|
+ {
|
|
|
+ return (false, true, $"第{index}条,退票记录关联的正常机票不存在,请先添加正常机票", 0, 0);
|
|
|
+ }
|
|
|
+
|
|
|
+ airFeeInfo.OriginalReservationId = normalAir1.Id;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 获取付款信息
|
|
|
+ var existingCard = await _sqlSugar.Queryable<Grp_CreditCardPayment>()
|
|
|
+ .FirstAsync(x => x.CId == airId && x.DIId == groupId && x.CTable == 85 && x.IsDel == 0);
|
|
|
+
|
|
|
+ // 审核验证
|
|
|
+ if (existingCard != null)
|
|
|
+ {
|
|
|
+ if (existingCard.IsAuditGM == 1 || existingCard.IsAuditGM == 3)
|
|
|
+ {
|
|
|
+ return (false, true, $"第{index}条,机票费用已审核,不可操作!", 0, 0);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (existingCard.IsPay == 1)
|
|
|
+ {
|
|
|
+ return (false, true, $"第{index}条,机票费用已付款,不可操作!", 0, 0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 更新机票信息
|
|
|
+ var airUpdateCount = await _sqlSugar.Updateable(airFeeInfo)
|
|
|
+ .IgnoreColumns(ignoreAllNullColumns: true)
|
|
|
+ .Where(x => x.Id == airId)
|
|
|
+ .ExecuteCommandAsync();
|
|
|
+
|
|
|
+ if (airUpdateCount < 1)
|
|
|
+ {
|
|
|
+ return (false, false, $"第{index}条,机票信息保存失败", 0, 0);
|
|
|
+ }
|
|
|
+
|
|
|
+ int cardId = 0;
|
|
|
+
|
|
|
+ // 更新或新增付款信息
|
|
|
+ if (existingCard != null)
|
|
|
+ {
|
|
|
+ cardPaymentInfo.Id = existingCard.Id;
|
|
|
+ var cardUpdateCount = await _sqlSugar.Updateable(cardPaymentInfo)
|
|
|
+ .IgnoreColumns(ignoreAllNullColumns: true)
|
|
|
+ .Where(x => x.Id == existingCard.Id)
|
|
|
+ .ExecuteCommandAsync();
|
|
|
+
|
|
|
+ if (cardUpdateCount < 1)
|
|
|
+ {
|
|
|
+ return (false, false, $"第{index}条,机票费用信息保存失败", 0, 0);
|
|
|
+ }
|
|
|
+
|
|
|
+ cardId = existingCard.Id;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ cardPaymentInfo.CId = airId;
|
|
|
+ var cardIdLong = await _sqlSugar.Insertable(cardPaymentInfo).ExecuteReturnIdentityAsync();
|
|
|
+
|
|
|
+ if (cardIdLong < 1)
|
|
|
+ {
|
|
|
+ return (false, false, $"第{index}条,机票费用信息保存失败", 0, 0);
|
|
|
+ }
|
|
|
+
|
|
|
+ cardId = (int)cardIdLong;
|
|
|
+ }
|
|
|
+
|
|
|
+ return (true, false, string.Empty, airId, cardId);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 单条删除 2026版
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task<JsonView> SoftDelAsync(int userId, int id)
|
|
|
+ {
|
|
|
+ BeginTran();
|
|
|
+ try
|
|
|
+ {
|
|
|
+ var ar_res = await SoftDeleteByIdAsync<Grp_AirTicketReservations>(id.ToString(), userId);
|
|
|
+ if (!ar_res)
|
|
|
+ {
|
|
|
+
|
|
|
+ RollbackTran();
|
|
|
+ return JsonView.Fail("删除失败!");
|
|
|
+ }
|
|
|
+
|
|
|
+ var ccp_res = await _sqlSugar.Updateable<Grp_CreditCardPayment>()
|
|
|
+ .SetColumns(x => x.IsDel == 1)
|
|
|
+ .SetColumns(x => x.DeleteUserId == userId)
|
|
|
+ .SetColumns(x => x.DeleteTime == DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))
|
|
|
+ .Where(a => a.CId == id && a.CTable == 85)
|
|
|
+ .ExecuteCommandAsync();
|
|
|
+ if (ccp_res < 1)
|
|
|
+ {
|
|
|
+ RollbackTran();
|
|
|
+ return JsonView.Fail("删除失败!");
|
|
|
+ }
|
|
|
+
|
|
|
+ CommitTran();
|
|
|
+ return JsonView.Success("删除成功!");
|
|
|
+
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ RollbackTran();
|
|
|
+ return JsonView.Fail("删除失败!Error:" + ex.Message);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
}
|
|
|
}
|