InvitationOfficialActivitiesRepository.cs 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515
  1. using AutoMapper;
  2. using MathNet.Numerics.Statistics.Mcmc;
  3. using NPOI.SS.Formula.Functions;
  4. using OASystem.Domain;
  5. using OASystem.Domain.Dtos.Groups;
  6. using OASystem.Domain.Entities.Financial;
  7. using OASystem.Domain.Entities.Groups;
  8. using OASystem.Domain.Entities.Resource;
  9. using OASystem.Domain.ViewModels.Groups;
  10. using OASystem.Domain.ViewModels.QiYeWeChat;
  11. using System;
  12. using System.Collections.Generic;
  13. using System.Linq;
  14. using System.Security.Cryptography;
  15. using System.Text;
  16. using System.Threading.Tasks;
  17. namespace OASystem.Infrastructure.Repositories.Groups
  18. {
  19. public class InvitationOfficialActivitiesRepository : BaseRepository<Grp_InvitationOfficialActivities, InvitationOfficialActivitiesListDto>
  20. {
  21. private readonly IMapper _mapper;
  22. public InvitationOfficialActivitiesRepository(SqlSugarClient sqlSugar, IMapper mapper) :
  23. base(sqlSugar)
  24. {
  25. this._mapper = mapper;
  26. }
  27. /// <summary>
  28. /// 根据商邀费用Id查询C表和商邀资料及费用表
  29. /// </summary>
  30. /// <param name="dto"></param>
  31. /// <returns></returns>
  32. public async Task<Result> InvitationOfficialActivitiesById(InvitationOfficialActivitiesByIdDto dto)
  33. {
  34. Result result = new Result() { Code = -2, Msg = "程序错误" };
  35. try
  36. {
  37. Grp_InvitationOfficialActivities grp_Invitation = _sqlSugar.Queryable<Grp_InvitationOfficialActivities>().First(a => a.Id == dto.Id && a.IsDel == 0);
  38. Grp_CreditCardPayment grp_CreditCard = _sqlSugar.Queryable<Grp_CreditCardPayment>().First(a => a.CId == dto.Id && a.IsDel == 0 && a.CTable==81);
  39. Res_InvitationOfficialActivityData res_InvitationOfficialActivityData = new Res_InvitationOfficialActivityData();
  40. if (grp_Invitation!=null)
  41. {
  42. res_InvitationOfficialActivityData = _sqlSugar.Queryable<Res_InvitationOfficialActivityData>().First(a =>a.Country==grp_Invitation.InviterArea && a.UnitName==grp_Invitation.Inviter && a.IsDel == 0);
  43. if (dto.PortType == 1)
  44. {
  45. var data = new
  46. {
  47. _Invitation = grp_Invitation,
  48. _InvitationData = res_InvitationOfficialActivityData,
  49. _CreditCard = grp_CreditCard,
  50. };
  51. result = new Result() { Code = 0, Msg = "查询成功!", Data = data };
  52. }
  53. else
  54. {
  55. InvitationOfficialActivitiesByIdView invitation = _mapper.Map<InvitationOfficialActivitiesByIdView>(grp_Invitation);
  56. res_InvitationOfficialActivityData ??= new Res_InvitationOfficialActivityData();
  57. invitation.PayDId = grp_CreditCard.PayDId;
  58. invitation.OrbitalPrivateTransfer = grp_CreditCard.OrbitalPrivateTransfer;
  59. invitation.Payee = grp_CreditCard.Payee;
  60. invitation.Address = res_InvitationOfficialActivityData.Address;
  61. invitation.Contact = res_InvitationOfficialActivityData.Contact;
  62. invitation.Job = res_InvitationOfficialActivityData.Job;
  63. invitation.Tel = res_InvitationOfficialActivityData.Tel;
  64. invitation.Email = res_InvitationOfficialActivityData.Email;
  65. invitation.Fax = res_InvitationOfficialActivityData.Fax;
  66. invitation.OtherInformation = res_InvitationOfficialActivityData.Remark;
  67. result = new Result() { Code = 0, Msg = "查询成功!", Data = invitation };
  68. }
  69. }
  70. else
  71. {
  72. if (dto.PortType == 1)
  73. {
  74. var data = new
  75. {
  76. _Invitation = grp_Invitation,
  77. _InvitationData = res_InvitationOfficialActivityData,
  78. _CreditCard = grp_CreditCard,
  79. };
  80. result = new Result() { Code = 0, Msg = "暂无数据!", Data = data };
  81. }
  82. else
  83. {
  84. InvitationOfficialActivitiesByIdView invitation = _mapper.Map<InvitationOfficialActivitiesByIdView>(grp_Invitation);
  85. result = new Result() { Code = 0, Msg = "暂无数据!", Data = invitation };
  86. }
  87. }
  88. }
  89. catch (Exception)
  90. {
  91. result = new Result() { Code = -2, Msg = "程序错误" };
  92. throw;
  93. }
  94. return result;
  95. }
  96. /// <summary>
  97. /// 根据团组id查询商邀费用数据
  98. /// </summary>
  99. /// <param name="dto"></param>
  100. /// <returns></returns>
  101. public async Task<Result> InvitationOfficialActivitiesList(InvitationOfficialActivitiesListDto dto)
  102. {
  103. Result result = new Result() { Code = -2, Msg = "未知错误" };
  104. try
  105. {
  106. ListViewBase<InvitationOfficialActivitiesView> rst = new ListViewBase<InvitationOfficialActivitiesView>() { ReceiveDt=DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") };
  107. string sqlWhere = string.Empty;
  108. if (!string.IsNullOrWhiteSpace(dto.Inviter))
  109. {
  110. sqlWhere += string.Format(@" And Inviter like '%{0}%'", dto.Inviter);
  111. }
  112. if (!string.IsNullOrWhiteSpace(dto.StartInviteTime) && !string.IsNullOrWhiteSpace(dto.EndInviteTime))
  113. {
  114. sqlWhere += string.Format(@" And i.InviteTime between '{0}' and '{1}'", dto.StartInviteTime, dto.EndInviteTime);
  115. }
  116. sqlWhere += string.Format(@" And i.DiId={0} And i.IsDel={1}", dto.DiId, 0);
  117. string UserId = "";
  118. List<Grp_GroupsTaskAssignment> gtaUIdList = _sqlSugar.Queryable<Grp_GroupsTaskAssignment>().Where(a => a.DIId == dto.DiId && a.IsDel == 0 && a.CTId == 81).ToList();
  119. foreach (Grp_GroupsTaskAssignment gta in gtaUIdList)
  120. UserId += gta.UId + ",";
  121. if (!string.IsNullOrWhiteSpace(UserId))
  122. {
  123. UserId = UserId.Substring(0, UserId.Length - 1);
  124. }
  125. else
  126. {
  127. UserId = "0";
  128. }
  129. sqlWhere += string.Format(@" And i.CreateUserId in ({0})", UserId);
  130. if (!string.IsNullOrEmpty(sqlWhere.Trim()))
  131. {
  132. Regex r = new Regex("And");
  133. sqlWhere = r.Replace(sqlWhere, "Where", 1);
  134. }
  135. //10011
  136. string sql = string.Format(@"Select Id,DiId,InviterArea,Inviter,InviteTime,
  137. InviteCost,(Select Name From Sys_SetData Where id=i.InviteCurrency And IsDel=0) As InviteCurrency,
  138. SendCost,(Select Name From Sys_SetData Where id=i.SendCurrency And IsDel=0) As SendCurrency,
  139. EventsCost,(Select Name From Sys_SetData Where id=i.EventsCurrency And IsDel=0) As EventsCurrency,
  140. TranslateCost,(Select Name From Sys_SetData Where id=i.TranslateCurrency And IsDel=0) As TranslateCurrency,
  141. IsGoOfficaiaBussiness,
  142. (Select PayMoney From Grp_CreditCardPayment Where CTable=81 And CId=i.Id And IsDel=0) As PayMoney,
  143. (Select (Select Name From Sys_SetData Where Id =ccp.PaymentCurrency And IsDel=0 ) As PaymentCurrency
  144. From Grp_CreditCardPayment ccp Where CTable=81 And CId=i.Id And IsDel=0) As PaymentCurrency,
  145. (Select IsAuditGM From Grp_CreditCardPayment Where CTable=81 And CId=i.Id And IsDel=0) As IsAudit,
  146. Attachment From Grp_InvitationOfficialActivities i {0} Order By i.id Desc", sqlWhere);
  147. List<InvitationOfficialActivitiesView> _DecreasePayments = await _sqlSugar.SqlQueryable<InvitationOfficialActivitiesView>(sql).ToListAsync();
  148. if (_DecreasePayments.Count != 0)
  149. {
  150. if (dto.PageIndex != 0 && dto.PageSize != 0)
  151. {
  152. int count = _DecreasePayments.Count;
  153. float totalPage = (float)count / dto.PageSize;//总页数
  154. if (totalPage == 0) totalPage = 1;
  155. else totalPage = (int)Math.Ceiling((double)totalPage);
  156. List<InvitationOfficialActivitiesView> invitationOfficialActivities = new List<InvitationOfficialActivitiesView>();
  157. for (int i = 0; i < dto.PageSize; i++)
  158. {
  159. var RowIndex = i + (dto.PageIndex - 1) * dto.PageSize;
  160. if (RowIndex < _DecreasePayments.Count)
  161. {
  162. invitationOfficialActivities.Add(_DecreasePayments[RowIndex]);
  163. }
  164. else
  165. {
  166. break;
  167. }
  168. }
  169. rst.DataList = invitationOfficialActivities;
  170. rst.DataCount = count;
  171. rst.CurrPageIndex = dto.PageIndex;
  172. rst.CurrPageSize = dto.PageSize;
  173. rst.ReturnDt = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  174. return result = new Result() { Code = 0, Msg = "查询成功!", Data = rst };
  175. }
  176. else
  177. {
  178. return result = new Result() { Code = 0, Msg = "查询成功!", Data = _DecreasePayments };
  179. }
  180. }
  181. else
  182. {
  183. if (dto.PageIndex != 0 && dto.PageSize != 0)
  184. {
  185. rst.DataList = _DecreasePayments;
  186. rst.DataCount = _DecreasePayments.Count;
  187. rst.CurrPageIndex = dto.PageIndex;
  188. rst.CurrPageSize = dto.PageSize;
  189. rst.ReturnDt = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  190. return result = new Result() { Code = 0, Msg = "暂无数据!", Data = rst };
  191. }
  192. else
  193. {
  194. return result = new Result() { Code = 0, Msg = "暂无数据!", Data = _DecreasePayments };
  195. }
  196. }
  197. }
  198. catch (Exception ex)
  199. {
  200. return result = new Result() { Code = -2, Msg = "未知错误" };
  201. }
  202. }
  203. /// <summary>
  204. /// Info Page Basic Data
  205. /// </summary>
  206. /// <returns></returns>
  207. public async Task<Result> _InitBasicData()
  208. {
  209. Result result = new Result() { Code = -2, Msg = "程序错误!" };
  210. var setDatas = _sqlSugar.Queryable<Sys_SetData>().Where(it => it.IsDel == 0).ToList();
  211. //支付方式
  212. var _payTypeDatas = setDatas.Where(it => it.STid == 14).Select(it => new { Id = it.Id, Name = it.Name, Remark = it.Remark }).ToList();
  213. ///转账标识
  214. var _costIdentificationDatas = new List<dynamic>()
  215. {
  216. new { Id = 0,Name = "公转" },
  217. new { Id = 1,Name = "私转" }
  218. };
  219. //卡类型
  220. var _cardTypeDatas = setDatas.Where(it => it.STid == 15).Select(it => new SetDataCurrencyInfoView { Id = it.Id, Name = it.Name, Remark = it.Remark }).ToList();
  221. var data = new {
  222. PayTypeData = _payTypeDatas,
  223. CostIdentificationData = _costIdentificationDatas,
  224. CardTypeData = _cardTypeDatas
  225. };
  226. result.Code = 0;
  227. result.Data = data;
  228. return result;
  229. }
  230. /// <summary>
  231. /// 商邀费用操作(Status:1.新增,2.修改)
  232. /// </summary>
  233. /// <param name="dto"></param>
  234. /// <returns></returns>
  235. public async Task<Result> OpInvitationOfficialActivities(OpInvitationOfficialActivitiesDto dto, Func<int, int, int, Task<Result>> fn)
  236. {
  237. Result result = new Result() { Code = -2, Msg = "程序错误!" };
  238. BeginTran();
  239. try
  240. {
  241. int id = 0;
  242. Grp_InvitationOfficialActivities grp_Invitation = _mapper.Map<Grp_InvitationOfficialActivities>(dto);
  243. if (dto.Status == 1)//添加
  244. {
  245. string selectSql = string.Format(@"select * from Grp_InvitationOfficialActivities where InviterArea='{0}' and Inviter='{1}' and DiId={2} and IsDel={3}"
  246. , dto.InviterArea, dto.Inviter, dto.DiId, 0);
  247. var _InvitationOfficialActivities = await _sqlSugar.SqlQueryable<Grp_InvitationOfficialActivities>(selectSql).FirstAsync();//查询是否存在
  248. if (_InvitationOfficialActivities != null)
  249. {
  250. return result = new Result() { Code = -1, Msg = "该数据已存在,请勿重复添加!" };
  251. }
  252. else
  253. {
  254. id = await AddAsyncReturnId(grp_Invitation);
  255. if (id != 0)//修改或添加商邀资料
  256. {
  257. Res_InvitationOfficialActivityData res_InvitationData = _mapper.Map<Res_InvitationOfficialActivityData>(dto);
  258. res_InvitationData.Country = dto.InviterArea;
  259. res_InvitationData.UnitName = dto.Inviter;
  260. res_InvitationData.Delegation = dto.DiId.ToString();
  261. Res_InvitationOfficialActivityData ifNullUp = await _sqlSugar.Queryable<Res_InvitationOfficialActivityData>().FirstAsync
  262. (a => a.Country == res_InvitationData.Country && a.City == res_InvitationData.City && a.UnitName == res_InvitationData.UnitName && a.IsDel == 0);
  263. if (ifNullUp == null)///添加或修改商邀资料
  264. {
  265. res_InvitationData.Remark = dto.OtherInformation;
  266. int DataID = await _sqlSugar.Insertable(res_InvitationData).ExecuteReturnIdentityAsync();
  267. if (DataID != 0)
  268. {
  269. result = new Result() { Code = 0, Msg = "添加成功!" };
  270. }
  271. else
  272. {
  273. RollbackTran();
  274. result = new Result() { Code = -1, Msg = "添加失败!" };
  275. }
  276. }
  277. else
  278. {
  279. int CTable = await _sqlSugar.Updateable<Res_InvitationOfficialActivityData>().Where(a => a.Id == ifNullUp.Id).SetColumns(a => new Res_InvitationOfficialActivityData
  280. {
  281. Contact = dto.Contact,
  282. Tel = dto.Tel,
  283. Email = dto.Email,
  284. Fax = dto.Fax,
  285. Address = dto.Address,
  286. Remark = dto.OtherInformation,
  287. }).ExecuteCommandAsync();
  288. }
  289. Grp_CreditCardPayment C = new Grp_CreditCardPayment();
  290. C.PayDId = dto.PayDId;
  291. C.ConsumptionPatterns = "";
  292. C.ConsumptionDate = "";
  293. C.CTDId = dto.CTDId;
  294. C.BankNo = dto.BankNo;
  295. C.CardholderName = dto.CardholderName;
  296. C.PayMoney = dto.PayMoney;
  297. C.PaymentCurrency = dto.PaymentCurrency;
  298. C.CompanyBankNo = dto.CompanyBankNo;
  299. C.OtherBankName = dto.OtherBankName;
  300. C.OtherSideNo = dto.OtherSideNo;
  301. C.OtherSideName = dto.OtherSideName;
  302. C.Remark = "";
  303. C.CreateUserId = dto.CreateUserId;
  304. C.MFOperator = 0;
  305. C.MFOperatorDate = "";
  306. C.IsAuditDM = 0;
  307. C.AuditDMOperate = 0;
  308. C.AuditDMDate = "";
  309. C.IsAuditMF = 0;
  310. C.AuditMFOperate = 0;
  311. C.AuditMFDate = "";
  312. C.IsAuditGM = 0;
  313. C.AuditGMOperate = 0;
  314. C.AuditGMDate = "";
  315. C.IsPay = 0;
  316. C.DIId = dto.DiId;
  317. C.CId = id;
  318. C.CTable = 81;
  319. C.PayPercentage = 100;
  320. C.PayThenMoney = 0;
  321. C.PayPercentageOld = 0;
  322. C.PayThenMoneyOld = 0;
  323. C.UpdateDate = "";
  324. C.Payee = dto.Payee;
  325. C.OrbitalPrivateTransfer = dto.OrbitalPrivateTransfer;
  326. C.ExceedBudget = 0;
  327. //获取新汇率 int diId,int CId, int currencyId
  328. var rate = await fn(dto.DiId, 81, dto.InviteCurrency);
  329. if (rate.Code == 0)
  330. {
  331. var rateInfo = (rate.Data as CurrencyInfo);
  332. if (rateInfo is not null)
  333. {
  334. C.DayRate = rateInfo.Rate;
  335. C.RMBPrice = rateInfo.Rate * C.PayMoney;
  336. }
  337. else
  338. {
  339. C.DayRate = 1;
  340. C.RMBPrice = C.PayMoney;
  341. }
  342. }
  343. int cId = await _sqlSugar.Insertable(C).ExecuteReturnIdentityAsync();
  344. if (cId != 0)
  345. {
  346. result = new Result() { Code = 0, Msg = "添加成功!" };
  347. }
  348. else
  349. {
  350. RollbackTran();
  351. result = new Result() { Code = -1, Msg = "添加失败!" };
  352. }
  353. }
  354. }
  355. }
  356. else//修改
  357. {
  358. var thisTime = new DateTime();
  359. DateTime.TryParse(dto.InviteTime, out thisTime);
  360. bool res = await UpdateAsync(a => a.Id == grp_Invitation.Id, a => new Grp_InvitationOfficialActivities
  361. {
  362. DiId = dto.DiId,
  363. InviterArea = dto.InviterArea,
  364. Inviter = dto.Inviter,
  365. InviteTime = thisTime,
  366. Attachment = dto.Attachment,
  367. InviteCost = dto.InviteCost,
  368. InviteCurrency = dto.InviteCurrency,
  369. SendCost = dto.SendCost,
  370. SendCurrency = dto.SendCurrency,
  371. EventsCost = dto.EventsCost,
  372. EventsCurrency = dto.EventsCurrency,
  373. TranslateCost = dto.TranslateCost,
  374. TranslateCurrency = dto.TranslateCurrency,
  375. IsGoOfficaiaBussiness = dto.IsGoOfficaiaBussiness,
  376. Remark = dto.Remark,
  377. });
  378. if (res)
  379. {
  380. Res_InvitationOfficialActivityData res_InvitationData = _mapper.Map<Res_InvitationOfficialActivityData>(dto);
  381. res_InvitationData.Country = dto.InviterArea;
  382. res_InvitationData.UnitName = dto.Inviter;
  383. Res_InvitationOfficialActivityData ifNullUp = await _sqlSugar.Queryable<Res_InvitationOfficialActivityData>().FirstAsync
  384. (a => a.Country == res_InvitationData.Country && a.City == res_InvitationData.City && a.UnitName == res_InvitationData.UnitName && a.IsDel == 0);
  385. if (ifNullUp == null)///添加或修改商邀资料
  386. {
  387. res_InvitationData.Remark = dto.OtherInformation;
  388. res_InvitationData.Delegation = dto.DiId.ToString();
  389. int DataID = await _sqlSugar.Insertable(res_InvitationData).ExecuteReturnIdentityAsync();
  390. if (DataID != 0)
  391. {
  392. result = new Result() { Code = 0, Msg = "添加成功!" };
  393. }
  394. else
  395. {
  396. RollbackTran();
  397. result = new Result() { Code = -1, Msg = "添加失败!" };
  398. }
  399. }
  400. else
  401. {
  402. int CTable = await _sqlSugar.Updateable<Res_InvitationOfficialActivityData>()
  403. .Where(a => a.Id == ifNullUp.Id)
  404. .SetColumns(a => new Res_InvitationOfficialActivityData
  405. {
  406. Contact = dto.Contact,
  407. Tel = dto.Tel,
  408. Email = dto.Email,
  409. Fax = dto.Fax,
  410. Address = dto.Address,
  411. Remark = dto.OtherInformation,
  412. }).ExecuteCommandAsync();
  413. }
  414. Grp_CreditCardPayment grp_CreditCardPayment = _sqlSugar.Queryable<Grp_CreditCardPayment>().First(a => a.CId == grp_Invitation.Id && a.CTable == 81 && a.IsDel == 0);
  415. if (grp_CreditCardPayment != null)
  416. {
  417. grp_CreditCardPayment.PayMoney = dto.PayMoney;
  418. grp_CreditCardPayment.PaymentCurrency = dto.PaymentCurrency;
  419. grp_CreditCardPayment.Payee = dto.Payee;
  420. grp_CreditCardPayment.OrbitalPrivateTransfer = dto.OrbitalPrivateTransfer;
  421. //获取新汇率 int diId,int CId, int currencyId
  422. var rate = await fn(dto.DiId, 81, dto.InviteCurrency);
  423. grp_CreditCardPayment.DayRate = 1;
  424. grp_CreditCardPayment.RMBPrice = grp_CreditCardPayment.PayMoney;
  425. if (rate.Code == 0)
  426. {
  427. var rateInfo = (rate.Data as CurrencyInfo);
  428. if (rateInfo is not null)
  429. {
  430. grp_CreditCardPayment.DayRate = rateInfo.Rate;
  431. grp_CreditCardPayment.RMBPrice = rateInfo.Rate * grp_CreditCardPayment.PayMoney;
  432. }
  433. }
  434. int CTable = await _sqlSugar.Updateable<Grp_CreditCardPayment>()
  435. .Where(a => a.Id == grp_CreditCardPayment.Id)
  436. .SetColumns(a => new Grp_CreditCardPayment
  437. {
  438. CTDId = dto.CTDId,
  439. BankNo = dto.BankNo,
  440. CardholderName = dto.CardholderName,
  441. CompanyBankNo = dto.CompanyBankNo,
  442. OtherBankName = dto.OtherBankName,
  443. OtherSideNo = dto.OtherSideNo,
  444. OtherSideName = dto.OtherSideName,
  445. PayMoney = grp_CreditCardPayment.PayMoney,
  446. PaymentCurrency = grp_CreditCardPayment.PaymentCurrency,
  447. Payee = grp_CreditCardPayment.Payee,
  448. OrbitalPrivateTransfer = grp_CreditCardPayment.OrbitalPrivateTransfer,
  449. DayRate = grp_CreditCardPayment.DayRate,
  450. RMBPrice = grp_CreditCardPayment.RMBPrice,
  451. }).ExecuteCommandAsync();
  452. if (CTable != 0)
  453. {
  454. result = new Result() { Code = 0, Msg = "修改成功!" };
  455. }
  456. else
  457. {
  458. result = new Result() { Code = -1, Msg = "修改失败!" };
  459. RollbackTran();
  460. }
  461. }
  462. else
  463. {
  464. RollbackTran();
  465. result = new Result() { Code = -1, Msg = "修改失败!" };
  466. }
  467. }
  468. else
  469. {
  470. RollbackTran();
  471. result = new Result() { Code = -1, Msg = "修改失败!" };
  472. }
  473. }
  474. CommitTran();
  475. }
  476. catch (Exception ex)
  477. {
  478. result = new Result() { Code = -2, Msg = "程序错误!" };
  479. throw;
  480. }
  481. return result;
  482. }
  483. }
  484. }