DecreasePaymentsRepository.cs 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548
  1. using AutoMapper;
  2. using NPOI.HPSF;
  3. using NPOI.SS.Formula.Functions;
  4. using OASystem.Domain;
  5. using OASystem.Domain.AesEncryption;
  6. using OASystem.Domain.Dtos.Groups;
  7. using OASystem.Domain.Entities.Financial;
  8. using OASystem.Domain.Entities.Groups;
  9. using OASystem.Domain.Entities.Resource;
  10. using OASystem.Domain.ViewModels.Financial;
  11. using OASystem.Domain.ViewModels.Groups;
  12. using OASystem.Domain.ViewModels.QiYeWeChat;
  13. using OASystem.Domain.ViewModels.Resource;
  14. using OASystem.Infrastructure.Repositories.System;
  15. using System;
  16. using System.Collections.Generic;
  17. using System.Linq;
  18. using System.Runtime.Intrinsics.Arm;
  19. using System.Text;
  20. using System.Threading.Tasks;
  21. namespace OASystem.Infrastructure.Repositories.Groups
  22. {
  23. public class DecreasePaymentsRepository : BaseRepository<Grp_DecreasePayments, Grp_DecreasePayments>
  24. {
  25. private readonly IMapper _mapper;
  26. private readonly TeamRateRepository _teamRateRep;
  27. private readonly SetDataRepository _setDataRepository;
  28. public DecreasePaymentsRepository(SqlSugarClient sqlSugar, IMapper mapper, TeamRateRepository teamRateRep, SetDataRepository setDataRepository )
  29. : base(sqlSugar)
  30. {
  31. this._mapper = mapper;
  32. _teamRateRep = teamRateRep;
  33. this._setDataRepository = setDataRepository;
  34. }
  35. /// <summary>
  36. /// 根据团组Id查询数据
  37. /// </summary>
  38. /// <param name="dto"></param>
  39. /// <returns></returns>
  40. public async Task<JsonView> DecreasePaymentsList(DecreasePaymentsListDto dto)
  41. {
  42. string sqlWhere = "";
  43. if (dto.IsPaySign != -1)
  44. {
  45. sqlWhere += string.Format(@" And ccp.IsPay = {0} ", dto.IsPaySign);
  46. }
  47. //雷怡 2024-5-8 15:14 新增View字段 CreateTime
  48. string sql = string.Format(@" Select gdp.Id,gdp.DiId,gdp.PriceName,gdp.FeeTotal,sd1.[Name] as Currency,gdp.FilePath,su.CnName as CreateUserName,
  49. ccp.IsAuditGM as isAudit,ccp.IsPay,gdp.CreateTime
  50. From Grp_DecreasePayments as gdp With(Nolock) Left Join Grp_CreditCardPayment as ccp With(Nolock) On gdp.Id = ccp.CId
  51. Left Join Sys_SetData as sd1 On gdp.Currency = sd1.Id
  52. Left Join Sys_Users as su On gdp.CreateUserId = su.Id
  53. Where gdp.DiId = {0} And ccp.CTable = 98 {2} And ccp.IsDel = 0 And gdp.IsDel = 0 And gdp.CreateUserId in ({1}) ", dto.DiId, dto.UserId, sqlWhere);
  54. List<DecreasePaymentsView> _DecreasePayments = await _sqlSugar.SqlQueryable<DecreasePaymentsView>(sql).ToListAsync();
  55. return new JsonView() { Code = 200, Msg = MsgTips.Succeed, Data = _DecreasePayments };
  56. }
  57. public async Task<JsonView> DecreasePaymentsSelect(DecreasePaymentsDto dto)
  58. {
  59. #region 团组下拉框
  60. List<Grp_GroupsTaskAssignment> grp_GroupsTaskAssignment = Query<Grp_GroupsTaskAssignment>(a => a.IsDel == 0 && a.UId == dto.UserId && a.CTId == dto.CTId).ToList();
  61. string DiId = "";
  62. List<DecreasePaymentGroupView> _Delegations = new List<DecreasePaymentGroupView>();
  63. if (grp_GroupsTaskAssignment.Count > 0)
  64. {
  65. foreach (var item in grp_GroupsTaskAssignment)
  66. {
  67. DiId += item.DIId + ",";
  68. }
  69. if (DiId != "0")
  70. {
  71. DiId = DiId.Substring(0, DiId.Length - 1);
  72. }
  73. string sql = string.Format($@"Select
  74. (select ssd.name from Sys_SetData ssd WHERE ssd.id = di.TeamLevSId) as TeamLevSId,
  75. di.Id,
  76. di.TeamName,
  77. di.ClientUnit,
  78. di.ClientName,
  79. di.TourCode,
  80. di.TeamDid,
  81. sd.[Name] As TeamTypeName,
  82. di.VisitCountry,
  83. di.VisitStartDate,
  84. di.VisitEndDate,
  85. di.VisitDays,
  86. di.VisitPNumber,
  87. di.CreateTime
  88. From Grp_DelegationInfo di With(NoLock)
  89. Left Join Sys_SetData sd On di.TeamDid = sd.Id
  90. Where di.Id in({DiId}) and di.IsDel=0
  91. Order By di.VisitStartDate Desc");
  92. //DecreasePaymentGroupView
  93. _Delegations = _sqlSugar.SqlQueryable<DecreasePaymentGroupView>(sql).ToList();
  94. }
  95. #endregion
  96. #region 其他下拉框查询
  97. //支付方式
  98. List<Sys_SetData> Payment = _sqlSugar.Queryable<Sys_SetData>().Where(a => a.STid == 14 && a.IsDel == 0).ToList();
  99. List<SetDataInfoView> _Payment = _mapper.Map<List<SetDataInfoView>>(Payment);
  100. //供应商 supplier
  101. List<Sys_SetData> supplier = _sqlSugar.Queryable<Sys_SetData>().Where(a => a.STid == 21 && a.IsDel == 0).ToList();
  102. List<SetDataInfoView> _supplier = _mapper.Map<List<SetDataInfoView>>(supplier);
  103. if (_supplier.Count > 0)
  104. {
  105. var d1 = _supplier.Find(it => it.Name.Equals("策划 公司"));
  106. if (d1 != null) _supplier.Remove(d1);
  107. var d2 = _supplier.Find(it => it.Name.Equals("礼仪"));
  108. if (d2 != null) _supplier.Remove(d2);
  109. var d3 = _supplier.Find(it => it.Name.Equals("日常办公用品"));
  110. if (d3 != null) _supplier.Remove(d3);
  111. var d4 = _supplier.Find(it => it.Name.Equals("其他"));
  112. if (d4 != null)
  113. {
  114. _supplier.Remove(d4);
  115. _supplier.Add(d4);
  116. }
  117. }
  118. List<dynamic> _supplierArea = new List<dynamic>() {
  119. new { id=1,name = "国内" },
  120. new { id=2,name = "国外" },
  121. };
  122. #endregion
  123. var data = new
  124. {
  125. payment = _Payment,
  126. groupName = _Delegations,
  127. supplier = _supplier,
  128. supplierArea = _supplierArea
  129. };
  130. return new JsonView() { Code = 200, Msg = MsgTips.Succeed, Data = data };
  131. }
  132. public async Task<JsonView> OpDecreasePayments(DecreasePaymentsOpDto dto)
  133. {
  134. BeginTran();
  135. int id = 0;
  136. var grp_Decrease = _mapper.Map<Grp_DecreasePayments>(dto);
  137. //处理费用总计
  138. if (grp_Decrease.FeeTotal == 0.00M)
  139. {
  140. grp_Decrease.FeeTotal = grp_Decrease.Price * grp_Decrease.Price;
  141. }
  142. List<TeamRateDescAddCurrencyIdView> teamRates = await _teamRateRep.PostGroupTeamRateItemByDiIdAndCTableId(1, dto.DiId, 98);
  143. if (dto.Status == 1)//添加
  144. {
  145. string selectSql = string.Format(@"select * from Grp_DecreasePayments where PriceName='{0}' and IsDel={1} and DiId={2}"
  146. , dto.PriceName, 0, dto.DiId);
  147. //var DecreasePayments = await _sqlSugar.SqlQueryable<Grp_DecreasePayments>(selectSql).FirstAsync();//查询是否存在
  148. //if (DecreasePayments != null)
  149. //{
  150. // return new JsonView() { Code = 400, Msg = "该数据已存在,请勿重复添加!" };
  151. //}
  152. //else//不存在,可添加
  153. //{
  154. id = await AddAsyncReturnId(grp_Decrease);
  155. if (id < 1)
  156. {
  157. RollbackTran();
  158. return new JsonView() { Code = 400, Msg = "添加失败!" };
  159. }
  160. //进行C表添加
  161. Grp_CreditCardPayment C = new Grp_CreditCardPayment();
  162. C.PayDId = dto.PayDId;
  163. C.ConsumptionPatterns = "";
  164. C.ConsumptionDate = "";
  165. C.CTDId = 0;
  166. C.BankNo = "";
  167. C.CardholderName = "";
  168. C.PayMoney = grp_Decrease.FeeTotal;
  169. C.PaymentCurrency = grp_Decrease.Currency;
  170. //当天汇率
  171. //if (!string.IsNullOrEmpty(hfRate.Value))
  172. // C.DayRate = hfRate.Value;
  173. //else
  174. //C.DayRate = "";
  175. C.CompanyBankNo = "";
  176. C.OtherBankName = dto.OtherBankName;
  177. C.OtherSideNo = dto.OtherSideNo;
  178. C.OtherSideName = dto.OtherSideName;
  179. C.Remark = "";
  180. C.CreateUserId = grp_Decrease.CreateUserId;
  181. C.MFOperator = 0;
  182. C.MFOperatorDate = "";
  183. C.IsAuditDM = 0;
  184. C.AuditDMOperate = 0;
  185. C.AuditDMDate = "";
  186. C.IsAuditMF = 0;
  187. C.AuditMFOperate = 0;
  188. C.AuditMFDate = "";
  189. C.IsAuditGM = 0;
  190. C.AuditGMOperate = 21;
  191. C.AuditGMDate = "";
  192. //2025-04-07 第四次更改 PayDId == 72(刷卡) IsPay == 1
  193. if (C.PayDId == 72) C.IsPay = 1;
  194. C.DIId = grp_Decrease.DiId;
  195. C.CId = id;
  196. C.CTable = 98;
  197. C.PayPercentage = 100;
  198. C.PayThenMoney = 0;
  199. C.PayPercentageOld = 0;
  200. C.PayThenMoneyOld = 0;
  201. C.UpdateDate = "";
  202. C.Payee = dto.SupplierName;
  203. C.OrbitalPrivateTransfer = dto.OrbitalPrivateTransfer;
  204. C.ExceedBudget = 0;
  205. //C.RMBPrice = 0.00f;
  206. //设置该团组的汇率
  207. var teamRate = teamRates.Where(it => it.CurrencyId == grp_Decrease.Currency).FirstOrDefault();
  208. //Grp_TeamRate _TeamRate = _sqlSugar.Queryable<Grp_TeamRate>().First(a => a.DiId == grp_Decrease.DiId && a.IsDel == 0 && a.CTable == 98);
  209. if (teamRate != null)
  210. {
  211. if (teamRate.CurrencyCode.Equals("CNY"))
  212. {
  213. C.DayRate = 1.0000M;
  214. C.RMBPrice = C.PayMoney;
  215. }
  216. else
  217. {
  218. C.DayRate = teamRate.Rate;
  219. C.RMBPrice = C.PayMoney * C.DayRate;
  220. }
  221. }
  222. else
  223. {
  224. RollbackTran();
  225. return new JsonView() { Code = 400, Msg = $"添加失败!团组汇率未设置{_sqlSugar.Queryable<Sys_SetData>().First(it => it.IsDel == 0 && it.Id == grp_Decrease.Currency)?.Name ?? ""}该币种汇率!" };
  226. }
  227. int cId = await _sqlSugar.Insertable(C).ExecuteReturnIdentityAsync();
  228. if (cId > 1)
  229. {
  230. #region 策划部内容同步添加至资料库
  231. //var userInfo = _sqlSugar.Queryable<Sys_Users>()
  232. // .LeftJoin<Sys_Department>((u,d)=> d.IsDel == 0 && u.DepId == d.Id )
  233. // .Where((u, d) => u.Id == dto.CreateUserId && d.DepName == "策划部" && u.IsDel == 0)
  234. // .First();
  235. //if (userInfo != null)
  236. //{
  237. // Res_MediaSuppliers mediaSuppliersData = new Res_MediaSuppliers
  238. // {
  239. // CreateTime = DateTime.Now,
  240. // CreateUserId = dto.CreateUserId,
  241. // UnitName = dto.SupplierName,
  242. // TypeId = dto.SupplierTypeId,
  243. // UnitAddress = dto.SupplierAddress,
  244. // Contact = dto.SupplierContact,
  245. // Tel = dto.SupplierContactNumber,
  246. // Email = dto.SupplierEmail,
  247. // Privince = dto.SupplierArea == 1 ? "国内" :"国外",
  248. // };
  249. // EncryptionProcessor.EncryptProperties(mediaSuppliersData);
  250. // _sqlSugar.Insertable(mediaSuppliersData).ExecuteCommand();
  251. //}
  252. #endregion
  253. CommitTran();
  254. var data = new { ccpId = cId, sign = 1,dataId = id };
  255. return new JsonView() { Code = 200, Msg = "添加成功!", Data = data };
  256. }
  257. RollbackTran();
  258. return new JsonView() { Code = 400, Msg = "添加失败!" };
  259. // }
  260. }
  261. else if (dto.Status == 2)
  262. {
  263. //已审核、已支付 不可修改
  264. var grp_CreditCardPayment = _sqlSugar.Queryable<Grp_CreditCardPayment>().First(a => a.CId == grp_Decrease.Id && a.CTable == 98 && a.CId == grp_Decrease.Id && a.IsDel == 0);
  265. if (grp_CreditCardPayment == null) return new JsonView() { Code = 400, Msg = MsgTips.Fail };
  266. var isAuditGM = grp_CreditCardPayment.IsAuditGM;
  267. if (isAuditGM == 1 || isAuditGM == 3) return new JsonView() { Code = 400, Msg = $"该费用已通过审核,不可编辑" };
  268. if (grp_CreditCardPayment.IsPay == 1) return new JsonView() { Code = 400, Msg = $"该费用已付款,不可编辑!" };
  269. bool res = await UpdateAsync(a => a.Id == grp_Decrease.Id, a => new Grp_DecreasePayments
  270. {
  271. DiId = grp_Decrease.DiId,
  272. SupplierArea = grp_Decrease.SupplierArea,
  273. SupplierTypeId = grp_Decrease.SupplierTypeId,
  274. SupplierName = grp_Decrease.SupplierName,
  275. SupplierContact = grp_Decrease.SupplierContact,
  276. SupplierContactNumber = grp_Decrease.SupplierContactNumber,
  277. SupplierSocialAccount = grp_Decrease.SupplierSocialAccount,
  278. SupplierEmail = grp_Decrease.SupplierEmail,
  279. SupplierAddress = grp_Decrease.SupplierAddress,
  280. PriceName = grp_Decrease.PriceName,
  281. Price = grp_Decrease.Price,
  282. Quantity = grp_Decrease.Quantity,
  283. FeeTotal = grp_Decrease.FeeTotal,
  284. Currency = grp_Decrease.Currency,
  285. FilePath = grp_Decrease.FilePath,
  286. OTAOrderNo = grp_Decrease.OTAOrderNo,
  287. Remark = grp_Decrease.Remark,
  288. });
  289. if (res)
  290. {
  291. //设置该团组的汇率
  292. var teamRate = teamRates.Where(it => it.CurrencyId == grp_Decrease.Currency).FirstOrDefault();
  293. if (teamRate != null)
  294. {
  295. if (teamRate.CurrencyCode.Equals("CNY"))
  296. {
  297. grp_CreditCardPayment.DayRate = 1.0000M;
  298. grp_CreditCardPayment.RMBPrice = grp_CreditCardPayment.PayMoney;
  299. }
  300. else
  301. {
  302. grp_CreditCardPayment.DayRate = teamRate.Rate;
  303. grp_CreditCardPayment.RMBPrice = grp_CreditCardPayment.PayMoney * grp_CreditCardPayment.DayRate;
  304. }
  305. }
  306. else
  307. {
  308. RollbackTran();
  309. return new JsonView() { Code = 400, Msg = "修改失败!" };
  310. }
  311. //2025-04-07 第四次更改 PayDId == 72(刷卡) IsPay == 1
  312. int isPay = 0;
  313. if (dto.PayDId == 72) isPay = 1;
  314. int CTable = await _sqlSugar.Updateable<Grp_CreditCardPayment>()
  315. .Where(a => a.Id == grp_CreditCardPayment.Id)
  316. .SetColumns(a => new Grp_CreditCardPayment
  317. {
  318. OtherSideName = dto.OtherSideName,
  319. OtherSideNo = dto.OtherSideNo,
  320. OtherBankName = dto.OtherBankName,
  321. PayDId = dto.PayDId,
  322. IsPay = isPay,
  323. PayMoney = grp_Decrease.FeeTotal,
  324. PaymentCurrency = grp_Decrease.Currency,
  325. Payee = dto.SupplierName,
  326. OrbitalPrivateTransfer = dto.OrbitalPrivateTransfer,
  327. DayRate = grp_CreditCardPayment.DayRate,
  328. RMBPrice = grp_CreditCardPayment.RMBPrice,
  329. //IsAuditGM = auto ? 3 : grp_CreditCardPayment.IsAuditGM
  330. })
  331. .ExecuteCommandAsync();
  332. if (CTable > 0)
  333. {
  334. CommitTran();
  335. var data = new { ccpId = grp_CreditCardPayment.Id, sign = 2, dataId = grp_Decrease.Id };
  336. return new JsonView() { Code = 200, Msg = "修改成功!", Data = data };
  337. }
  338. }
  339. }
  340. RollbackTran();
  341. return new JsonView() { Code = 400, Msg = MsgTips.Fail };
  342. }
  343. public async Task<Result> PostGroupNameAndEasy(DecreasePaymentsDto dto)
  344. {
  345. Result result = new Result() { Code = -2, Msg = "未知错误" };
  346. try
  347. {
  348. #region 团组下拉框
  349. List<Grp_GroupsTaskAssignment> grp_GroupsTaskAssignment = Query<Grp_GroupsTaskAssignment>(a => a.IsDel == 0 && a.UId == dto.UserId && a.CTId == dto.CTId).ToList();
  350. string DiId = "";
  351. foreach (var item in grp_GroupsTaskAssignment)
  352. {
  353. DiId += item.DIId + ",";
  354. }
  355. if (!string.IsNullOrWhiteSpace(DiId))
  356. {
  357. DiId = DiId.Substring(0, DiId.Length - 1);
  358. }
  359. else
  360. {
  361. DiId = "0";
  362. }
  363. string sql = string.Format(@"select Id,TourCode,TeamName,ClientName,VisitStartDate,VisitEndDate,VisitCountry,VisitDays,VisitPNumber from Grp_DelegationInfo where Id in({0}) and IsDel={1}", DiId, 0);
  364. List<DelegationEasyView> grp_Delegations = _sqlSugar.SqlQueryable<DelegationEasyView>(sql).ToList();
  365. if (grp_Delegations.Count != 0)
  366. {
  367. int count = grp_Delegations.Count;
  368. float totalPage = (float)count / dto.PageSize;//总页数
  369. if (totalPage == 0) totalPage = 1;
  370. else totalPage = (int)Math.Ceiling((double)totalPage);
  371. List<DelegationEasyView> delegationEasyViews = new List<DelegationEasyView>();
  372. for (int i = 0; i < dto.PageSize; i++)
  373. {
  374. var RowIndex = i + (dto.PageIndex - 1) * dto.PageSize;
  375. if (RowIndex < grp_Delegations.Count)
  376. {
  377. delegationEasyViews.Add(grp_Delegations[RowIndex]);
  378. }
  379. else
  380. {
  381. break;
  382. }
  383. }
  384. ListViewBase<DelegationEasyView> rst = new ListViewBase<DelegationEasyView>();
  385. rst.DataList = delegationEasyViews;
  386. rst.DataCount = count;
  387. rst.CurrPageIndex = dto.PageIndex;
  388. rst.CurrPageSize = dto.PageSize;
  389. return result = new Result() { Code = 0, Msg = "查询成功!", Data = rst };
  390. }
  391. else
  392. {
  393. ListViewBase<DelegationEasyView> rst = new ListViewBase<DelegationEasyView>();
  394. rst.DataList = new List<DelegationEasyView>();
  395. return result = new Result() { Code = 0, Msg = "暂无数据!", Data = rst };
  396. }
  397. #endregion
  398. }
  399. catch (Exception ex)
  400. {
  401. return result = new Result() { Code = -2, Msg = "程序错误" };
  402. throw;
  403. }
  404. }
  405. /// <summary>
  406. /// 根据团组增减款项表Id查询数据
  407. /// </summary>
  408. /// <param name="dto"></param>
  409. /// <returns></returns>
  410. /// <exception cref="NotImplementedException"></exception>
  411. public async Task<JsonView> QueryDecreasePaymentsById(DecreasePaymentsByIdDto dto)
  412. {
  413. string sql = string.Format($@"Select
  414. dp.Id,
  415. dp.DiId,
  416. dp.SupplierArea,
  417. dp.SupplierTypeId,
  418. dp.SupplierName,
  419. dp.SupplierContact,
  420. dp.SupplierContactNumber,
  421. dp.SupplierSocialAccount,
  422. dp.SupplierEmail,
  423. dp.SupplierAddress,
  424. dp.PriceName,
  425. dp.Price,
  426. dp.Quantity,
  427. dp.FeeTotal,
  428. dp.Currency,
  429. dp.FilePath,
  430. dp.OTAOrderNo,
  431. dp.Remark,
  432. ccp.PayDId,
  433. ccp.OrbitalPrivateTransfer,
  434. ccp.OtherBankName,
  435. ccp.OtherSideName,
  436. ccp.OtherSideNo,
  437. ccp.IsAuditGM
  438. From Grp_DecreasePayments dp With(NoLock)
  439. Left Join Grp_CreditCardPayment ccp With(NoLock) On dp.Id = ccp.CId And dp.DiId = ccp.DIId And ccp.CTable = 98
  440. Where dp.IsDel = 0 And dp.Id = {dto.Id}");
  441. var info = await _sqlSugar.SqlQueryable<DecreasePaymentsInfoView>(sql).FirstAsync();
  442. return new JsonView() { Code = 200, Msg = MsgTips.Succeed, Data = info };
  443. }
  444. /// <summary>
  445. /// Del
  446. /// </summary>
  447. /// <param name="dto"></param>
  448. /// <returns></returns>
  449. /// <exception cref="NotImplementedException"></exception>
  450. public async Task<Result> _Del(int id, int userId)
  451. {
  452. Result result = new Result() { Code = -2, Msg = "删除失败!" };
  453. var ccpInfo =await _sqlSugar.Queryable<Grp_CreditCardPayment>()
  454. .FirstAsync(x => x.CId == id && x.CTable == 98 && x.IsDel == 0);
  455. if (ccpInfo == null) return new Result(-2, "删除失败!");
  456. if (ccpInfo.IsAuditGM > 0) return new Result(-2, "该费用已审核,不可删除!");
  457. if (ccpInfo.IsPay == 1) return new Result(-2, "该费用已付款,不可删除!");
  458. _sqlSugar.BeginTran();
  459. var del = await _sqlSugar.Updateable<Grp_DecreasePayments>()
  460. .SetColumns(it => new Grp_DecreasePayments()
  461. {
  462. IsDel = 1,
  463. DeleteUserId = userId,
  464. DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
  465. }).Where(it => it.Id == id)
  466. .ExecuteCommandAsync();
  467. if (del > 0)
  468. {
  469. var del1 = await _sqlSugar.Updateable<Grp_CreditCardPayment>()
  470. .SetColumns(a => new Grp_CreditCardPayment()
  471. {
  472. IsDel = 1,
  473. DeleteUserId = userId,
  474. DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
  475. })
  476. .Where(a => a.CId == id && a.CTable == 98)
  477. .ExecuteCommandAsync();
  478. if (del1 > 0)
  479. {
  480. _sqlSugar.CommitTran();
  481. result.Code = 0;
  482. result.Msg = "删除成功!";
  483. return result;
  484. }
  485. }
  486. _sqlSugar.RollbackTran();
  487. return result;
  488. }
  489. }
  490. }