GroupsController.cs 120 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833
  1. using Aspose.Cells;
  2. using Aspose.Cells.Drawing.Texts;
  3. using Aspose.Words;
  4. using Aspose.Words.Tables;
  5. using NPOI.Util;
  6. using OASystem.API.OAMethodLib;
  7. using OASystem.API.OAMethodLib.File;
  8. using OASystem.Domain.Dtos.Groups;
  9. using OASystem.Domain.Entities.Groups;
  10. using OASystem.Domain.ViewModels.Groups;
  11. using OASystem.Infrastructure.Repositories.Groups;
  12. using TencentCloud.Ocr.V20181119.Models;
  13. using OASystem.Infrastructure.Tools;
  14. using System.Web;
  15. using System.Data;
  16. using static OASystem.Infrastructure.Repositories.Groups.AirTicketResRepository;
  17. using static OpenAI.GPT3.ObjectModels.SharedModels.IOpenAiModels;
  18. using Cell = Aspose.Words.Tables.Cell;
  19. using Row = Aspose.Words.Tables.Row;
  20. using System.Runtime.Intrinsics.Arm;
  21. using Microsoft.AspNetCore.Mvc.Filters;
  22. using OASystem.Domain.Entities.Customer;
  23. using NPOI.SS.Formula.Functions;
  24. using OASystem.Domain.Dtos.CRM;
  25. using System.Diagnostics;
  26. using MathNet.Numerics.Statistics.Mcmc;
  27. using AlibabaCloud.OpenApiClient.Models;
  28. using System;
  29. using NPOI.HPSF;
  30. using SqlSugar;
  31. namespace OASystem.API.Controllers
  32. {
  33. /// <summary>
  34. /// 团组相关
  35. /// </summary>
  36. //[Authorize]
  37. [Route("api/[controller]/[action]")]
  38. public class GroupsController : ControllerBase
  39. {
  40. private readonly GrpScheduleRepository _grpScheduleRep;
  41. private readonly IMapper _mapper;
  42. private readonly DelegationInfoRepository _groupRepository;
  43. private readonly TaskAssignmentRepository _taskAssignmentRep;
  44. private readonly AirTicketResRepository _airTicketResRep;
  45. private readonly DecreasePaymentsRepository _decreasePaymentsRep;
  46. private readonly InvitationOfficialActivitiesRepository _InvitationOfficialActivitiesRep;
  47. private readonly DelegationEnDataRepository _delegationEnDataRep;
  48. private readonly DelegationVisaRepository _delegationVisaRep;
  49. private readonly MessageRepository _message;
  50. private readonly SqlSugarClient _sqlSugar;
  51. private string url;
  52. private string path;
  53. private readonly EnterExitCostRepository _enterExitCostRep;
  54. public GroupsController(IMapper mapper, SqlSugarClient sqlSugar, GrpScheduleRepository grpScheduleRep, DelegationInfoRepository groupRepository,
  55. TaskAssignmentRepository taskAssignmentRep, AirTicketResRepository airTicketResRep, DecreasePaymentsRepository decreasePaymentsRep,
  56. InvitationOfficialActivitiesRepository InvitationOfficialActivitiesRep, DelegationEnDataRepository delegationEnDataRep, EnterExitCostRepository enterExitCostRep
  57. , DelegationVisaRepository delegationVisaRep, MessageRepository message)
  58. {
  59. _mapper = mapper;
  60. _grpScheduleRep = grpScheduleRep;
  61. _groupRepository = groupRepository;
  62. _taskAssignmentRep = taskAssignmentRep;
  63. _airTicketResRep = airTicketResRep;
  64. _sqlSugar = sqlSugar;
  65. url = AppSettingsHelper.Get("ExcelBaseUrl");
  66. path = AppSettingsHelper.Get("ExcelBasePath");
  67. if (!System.IO.Directory.Exists(path))
  68. {
  69. System.IO.Directory.CreateDirectory(path);//不存在就创建文件夹
  70. }
  71. _decreasePaymentsRep = decreasePaymentsRep;
  72. _InvitationOfficialActivitiesRep = InvitationOfficialActivitiesRep;
  73. _delegationEnDataRep = delegationEnDataRep;
  74. _enterExitCostRep = enterExitCostRep;
  75. _delegationVisaRep = delegationVisaRep;
  76. _message = message;
  77. }
  78. #region 流程管控
  79. /// <summary>
  80. /// 获取团组流程管控信息
  81. /// </summary>
  82. /// <param name="paras">参数Json字符串</param>
  83. /// <returns></returns>
  84. [HttpPost]
  85. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  86. public async Task<IActionResult> PostSearchGrpSchedule(JsonDtoBase _jsonDto)
  87. {
  88. if (string.IsNullOrEmpty(_jsonDto.Paras))
  89. {
  90. return Ok(JsonView(false, "参数为空"));
  91. }
  92. Grp_ScheduleDto _ScheduleDto = JsonConvert.DeserializeObject<Grp_ScheduleDto>(_jsonDto.Paras);
  93. if (_ScheduleDto != null)
  94. {
  95. if (_ScheduleDto.SearchType == 2)//获取列表
  96. {
  97. List<Grp_ScheduleView> _grpScheduleViewList = await _grpScheduleRep.GetViewList_GrpSchedule(_ScheduleDto);
  98. return Ok(JsonView(_grpScheduleViewList));
  99. }
  100. else//获取对象
  101. {
  102. Grp_ScheduleCombinView _grpScheduleView = await _grpScheduleRep.GetView_GrpSchedule(_ScheduleDto);
  103. if (_grpScheduleView != null)
  104. {
  105. return Ok(JsonView(_grpScheduleView));
  106. }
  107. }
  108. }
  109. else
  110. {
  111. return Ok(JsonView(false, "参数反序列化失败"));
  112. }
  113. return Ok(JsonView(false, "暂无数据!"));
  114. }
  115. /// <summary>
  116. /// 修改团组流程管控详细表数据
  117. /// </summary>
  118. /// <param name="paras"></param>
  119. /// <returns></returns>
  120. [HttpPost]
  121. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  122. public async Task<IActionResult> PostUpdateGrpScheduleDetail(Grp_ScheduleDetailUpdDto dto)
  123. {
  124. Grp_ScheduleDetailInfo _detail = _mapper.Map<Grp_ScheduleDetailInfo>(dto);
  125. var result = await _grpScheduleRep._sqlSugar.Updateable<Grp_ScheduleDetailInfo>()
  126. .SetColumns(it => it.Duty == _detail.Duty)
  127. .SetColumns(it => it.ExpectBeginDt == _detail.ExpectBeginDt)
  128. .SetColumns(it => it.ExpectEndDt == _detail.ExpectEndDt)
  129. .SetColumns(it => it.JobContent == _detail.JobContent)
  130. .SetColumns(it => it.Remark == _detail.Remark)
  131. .SetColumns(it => it.StepStatus == _detail.StepStatus)
  132. .Where(s => s.Id == dto.Id)
  133. //.UpdateColumns(s => new { s.Duty, s.ExpectBeginDt, s.ExpectEndDt, s.JobContent, s.Remark, s.StepStatus })
  134. .ExecuteCommandAsync();
  135. if (result > 0)
  136. {
  137. return Ok(JsonView(true, "保存成功!"));
  138. }
  139. return Ok(JsonView(false, "保存失败!"));
  140. }
  141. /// <summary>
  142. /// 删除团组流程管控详细表数据,删除人Id请放在Duty
  143. /// </summary>
  144. /// <param name="dto"></param>
  145. /// <returns></returns>
  146. [HttpPost]
  147. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  148. public async Task<ActionResult> PostDeleteGrpScheduleDetail(Grp_ScheduleDetailUpdDto dto)
  149. {
  150. Grp_ScheduleDetailInfo _detail = _mapper.Map<Grp_ScheduleDetailInfo>(dto);
  151. _detail.IsDel = 1;
  152. _detail.DeleteUserId = dto.Duty;
  153. _detail.DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  154. var result = await _grpScheduleRep._sqlSugar.Updateable<Grp_ScheduleDetailInfo>()
  155. .SetColumns(it => it.IsDel == _detail.IsDel)
  156. .SetColumns(it => it.DeleteUserId == _detail.DeleteUserId)
  157. .SetColumns(it => it.DeleteTime == _detail.DeleteTime)
  158. .Where(it => it.Id == dto.Id)
  159. //.UpdateColumns(s => new { s.IsDel, s.DeleteUserId, s.DeleteTime })
  160. //.WhereColumns(s => s.Id == dto.Id)
  161. .ExecuteCommandAsync();
  162. if (result > 0)
  163. {
  164. return Ok(JsonView(true, "删除成功!"));
  165. }
  166. return Ok(JsonView(false, "删除失败!"));
  167. }
  168. /// <summary>
  169. /// 增加团组流程管控详细表数据
  170. /// </summary>
  171. /// <param name="dto"></param>
  172. /// <returns></returns>
  173. [HttpPost]
  174. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  175. public async Task<ActionResult> PostInsertGrpScheduleDetail(Grp_ScheduleDetailInsertDto dto)
  176. {
  177. Grp_ScheduleDetailInfo _detail = _mapper.Map<Grp_ScheduleDetailInfo>(dto);
  178. if (DateTime.Now < _detail.ExpectBeginDt)
  179. {
  180. _detail.StepStatus = 0;
  181. }
  182. else
  183. {//若大于设置时间,不考虑设置的预计结束日期,统一视为进行中
  184. _detail.StepStatus = 1;
  185. }
  186. var result = await _grpScheduleRep._sqlSugar.Insertable(_detail).ExecuteReturnIdentityAsync();
  187. if (result > 0)
  188. {
  189. Grp_ScheduleDetailView _result = await _grpScheduleRep.GetInsertBackData(result);
  190. return Ok(JsonView(true, "添加成功!", _result));
  191. }
  192. return Ok(JsonView(false, "添加失败!"));
  193. }
  194. #endregion
  195. #region 团组基本信息
  196. /// <summary>
  197. /// 接团信息列表
  198. /// </summary>
  199. /// <param name="dto">团组列表请求dto</param>
  200. /// <returns></returns>
  201. [HttpPost]
  202. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  203. public async Task<IActionResult> GetGroupList(GroupListDto dto)
  204. {
  205. var groupData = await _groupRepository.GetGroupList(dto);
  206. if (groupData.Code != 0)
  207. {
  208. return Ok(JsonView(false, groupData.Msg));
  209. }
  210. return Ok(JsonView(groupData.Data));
  211. }
  212. /// <summary>
  213. /// 接团信息详情
  214. /// </summary>
  215. /// <param name="dto">团组info请求dto</param>
  216. /// <returns></returns>
  217. [HttpPost]
  218. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  219. public async Task<IActionResult> GetGroupInfo(GroupInfoDto dto)
  220. {
  221. var groupData = await _groupRepository.GetGroupInfo(dto);
  222. if (groupData.Code != 0)
  223. {
  224. return Ok(JsonView(false, groupData.Msg));
  225. }
  226. return Ok(JsonView(groupData.Data));
  227. }
  228. /// <summary>
  229. /// 接团信息 编辑添加
  230. /// 基础信息数据源
  231. /// </summary>
  232. /// <param name="dto"></param>
  233. /// <returns></returns>
  234. [HttpPost]
  235. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  236. public async Task<IActionResult> GroupEditBasicSource(GroupListDto dto)
  237. {
  238. var groupData = await _groupRepository.GroupEditBasicSource(dto);
  239. if (groupData.Code != 0)
  240. {
  241. return Ok(JsonView(false, groupData.Msg));
  242. }
  243. return Ok(JsonView(groupData.Data));
  244. }
  245. /// <summary>
  246. /// 接团信息 操作(增改)
  247. /// </summary>
  248. /// <param name="dto"></param>
  249. /// <returns></returns>
  250. [HttpPost]
  251. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  252. public async Task<IActionResult> GroupOperation(GroupOperationDto dto)
  253. {
  254. try
  255. {
  256. var groupData = await _groupRepository.GroupOperation(dto);
  257. if (groupData.Code != 0)
  258. {
  259. return Ok(JsonView(false, groupData.Msg));
  260. }
  261. return Ok(JsonView(true));
  262. }
  263. catch (Exception ex)
  264. {
  265. Logs("[response]" + JsonConvert.SerializeObject(dto));
  266. Logs(ex.Message);
  267. return Ok(JsonView(false, ex.Message));
  268. }
  269. }
  270. /// <summary>
  271. /// 接团信息 操作(删除)
  272. /// </summary>
  273. /// <param name="dto"></param>
  274. /// <returns></returns>
  275. [HttpPost]
  276. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  277. public async Task<IActionResult> GroupDel(GroupDelDto dto)
  278. {
  279. try
  280. {
  281. var groupData = await _groupRepository.GroupDel(dto);
  282. if (groupData.Code != 0)
  283. {
  284. return Ok(JsonView(false, groupData.Msg));
  285. }
  286. return Ok(JsonView(true));
  287. }
  288. catch (Exception ex)
  289. {
  290. Logs("[response]" + JsonConvert.SerializeObject(dto));
  291. Logs(ex.Message);
  292. return Ok(JsonView(false, ex.Message));
  293. }
  294. }
  295. /// <summary>
  296. /// 获取团组销售报价号
  297. /// 团组添加时 使用
  298. /// </summary>
  299. /// <returns></returns>
  300. [HttpPost]
  301. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  302. public async Task<IActionResult> GetGroupSalesQuoteNo()
  303. {
  304. var groupData = await _groupRepository.GetGroupSalesQuoteNo();
  305. if (groupData.Code != 0)
  306. {
  307. return Ok(JsonView(false, groupData.Msg));
  308. }
  309. object salesQuoteNo = new
  310. {
  311. SalesQuoteNo = groupData.Data
  312. };
  313. return Ok(JsonView(salesQuoteNo));
  314. }
  315. /// <summary>
  316. /// 设置确认出团
  317. /// </summary>
  318. /// <param name="dto"></param>
  319. /// <returns></returns>
  320. [HttpPost]
  321. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  322. public async Task<IActionResult> SetConfirmationGroup(ConfirmationGroupDto dto)
  323. {
  324. var groupData = await _groupRepository.ConfirmationGroup(dto);
  325. if (groupData.Code != 0)
  326. {
  327. return Ok(JsonView(false, groupData.Msg));
  328. }
  329. GroupStepForDelegation.CreateWorkStep(dto.GroupId); //创建管控流程
  330. return Ok(JsonView(groupData.Data));
  331. }
  332. /// <summary>
  333. /// 获取团组名称 List
  334. /// </summary>
  335. /// <param name="dto"></param>
  336. /// <returns></returns>
  337. [HttpPost]
  338. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  339. public async Task<IActionResult> GetGroupNameList(GroupNameDto dto)
  340. {
  341. var groupData = await _groupRepository.GetGroupNameList(dto);
  342. if (groupData.Code != 0)
  343. {
  344. return Ok(JsonView(false, groupData.Msg));
  345. }
  346. return Ok(JsonView(groupData.Data, groupData.Data.Count));
  347. }
  348. /// <summary>
  349. /// 获取团组名称data And 签证国别Data
  350. /// </summary>
  351. /// <param name="dto"></param>
  352. /// <returns></returns>
  353. [HttpPost]
  354. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  355. public async Task<IActionResult> GetGroupNameAndVisaNationality(GroupNameDto dto)
  356. {
  357. var groupData = await _groupRepository.GetGroupNameAndVisaNationality(dto);
  358. if (groupData.Code != 0)
  359. {
  360. return Ok(JsonView(false, groupData.Msg));
  361. }
  362. return Ok(JsonView(groupData.Data));
  363. }
  364. /// <summary>
  365. /// 根据CTable类型返回对应的团组名称及简单数据(APP端)
  366. /// </summary>
  367. /// <returns></returns>
  368. [HttpPost]
  369. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  370. public async Task<IActionResult> PostGroupNameAndEasy(DecreasePaymentsDto dto)
  371. {
  372. try
  373. {
  374. Result groupData = await _decreasePaymentsRep.PostGroupNameAndEasy(dto);
  375. if (groupData.Code != 0)
  376. {
  377. return Ok(JsonView(false, groupData.Msg));
  378. }
  379. return Ok(JsonView(true, groupData.Msg, groupData.Data));
  380. }
  381. catch (Exception ex)
  382. {
  383. return Ok(JsonView(false, "程序错误!"));
  384. throw;
  385. }
  386. }
  387. #endregion
  388. #region 团组&签证
  389. /// <summary>
  390. /// 根据团组Id获取签证客户信息List
  391. /// </summary>
  392. /// <param name="dto">请求dto</param>
  393. /// <returns></returns>
  394. [HttpPost]
  395. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  396. public async Task<IActionResult> GetCrmByGroupId(ClientByGroupIdDto dto)
  397. {
  398. var groupData = await _groupRepository.GetCrmByGroupId(dto);
  399. if (groupData.Code != 0)
  400. {
  401. return Ok(JsonView(false, groupData.Msg));
  402. }
  403. return Ok(JsonView(groupData.Data));
  404. }
  405. /// <summary>
  406. /// IOS获取团组签证拍照上传进度01(团组列表)
  407. /// </summary>
  408. /// <param name="dto">请求dto</param>
  409. /// <returns></returns>
  410. [HttpPost]
  411. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  412. public async Task<IActionResult> PostIOSVisaProgress(IOS_VisaDto dto)
  413. {
  414. if (dto == null)
  415. {
  416. return Ok(JsonView(false, "参数为空"));
  417. }
  418. DelegationVisaViewList visaList = _delegationVisaRep.GetDelegationList(dto);
  419. return Ok(JsonView(visaList));
  420. }
  421. /// <summary>
  422. /// IOS获取团组签证拍照上传进度02(团组签证详情\人员列表\国家)
  423. /// </summary>
  424. /// <returns></returns>
  425. [HttpPost]
  426. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  427. public async Task<ActionResult> PostIOSVisaProgressContent(IOS_VisaCustomerListDto dto)
  428. {
  429. if (dto == null)
  430. {
  431. return Ok(JsonView(false, "请求错误:"));
  432. }
  433. List<DelegationVisaProgressView> list = _delegationVisaRep.GetDelegationProgressList(dto.diId);
  434. return Ok(JsonView(list));
  435. }
  436. /// <summary>
  437. /// IOS获取团组签证拍照上传进度03(相册)
  438. /// </summary>
  439. /// <returns></returns>
  440. [HttpPost]
  441. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  442. public async Task<ActionResult> PostIOSVisaProgressImageList(IOS_VisaImageListDto dto)
  443. {
  444. if (dto == null)
  445. {
  446. return Ok(JsonView(false, "请求错误:"));
  447. }
  448. List<VisaProgressImageView> list = _delegationVisaRep.GetVisaProgressImageList(dto.visaProgressCustomerId, dto.picType);
  449. string url = AppSettingsHelper.Get("VisaProgressImageBaseUrl") + AppSettingsHelper.Get("VisaProgressImageFtpPath");
  450. list.ForEach(s => s.url = url);
  451. return Ok(JsonView(list));
  452. }
  453. /// <summary>
  454. /// IOS获取团组签证拍照上传进度04(图片上传)
  455. /// </summary>
  456. /// <param name="dto"></param>
  457. /// <returns></returns>
  458. [HttpPost]
  459. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  460. public async Task<ActionResult> PostIOSVisaProgressUploadImage(IOS_VisaUploadImageDto dto)
  461. {
  462. //string result = decodeBase64ToImage(dto.base64DataURL, dto.imageName);
  463. //if (!string.IsNullOrEmpty(result))
  464. //{
  465. //}
  466. //else {
  467. // return Ok(JsonView(false, "上传失败"));
  468. //}
  469. DateTime dt1970 = new DateTime(1970, 1, 1, 0, 0, 0, 0);
  470. int sucNum = 0;
  471. try
  472. {
  473. foreach (var item in dto.base64DataList)
  474. {
  475. string imageName = dto.imageName + ((DateTime.Now.Ticks - dt1970.Ticks) / 10000).ToString();
  476. string result = decodeBase64ToImage(item, imageName);
  477. if (!string.IsNullOrEmpty(result))
  478. {
  479. Grp_VisaProgressCustomerPicture pic = new Grp_VisaProgressCustomerPicture();
  480. pic.CreateUserId = dto.CreateUserId;
  481. pic.PicName = imageName;
  482. pic.PicPath = result;
  483. pic.VisaProgressCustomerId = dto.visaProgressCustomerId;
  484. int insertResult = await _delegationVisaRep.AddAsync<Grp_VisaProgressCustomerPicture>(pic);
  485. if (insertResult > 0)
  486. {
  487. sucNum++;
  488. }
  489. }
  490. }
  491. }
  492. catch (Exception ex)
  493. {
  494. return Ok(JsonView(false, ex.Message));
  495. }
  496. string msg = string.Format(@"成功上传{0}张", sucNum);
  497. return Ok(JsonView(true, msg));
  498. }
  499. private string decodeBase64ToImage(string base64DataURL, string imgName)
  500. {
  501. string filename = "";//声明一个string类型的相对路径
  502. String base64 = base64DataURL.Substring(base64DataURL.IndexOf(",") + 1); //将‘,’以前的多余字符串删除
  503. System.Drawing.Bitmap bitmap = null;//定义一个Bitmap对象,接收转换完成的图片
  504. try//会有异常抛出,try,catch一下
  505. {
  506. byte[] arr = Convert.FromBase64String(base64);//将纯净资源Base64转换成等效的8位无符号整形数组
  507. System.IO.MemoryStream ms = new System.IO.MemoryStream(arr);//转换成无法调整大小的MemoryStream对象
  508. bitmap = new System.Drawing.Bitmap(ms);//将MemoryStream对象转换成Bitmap对象
  509. var fileDir = AppSettingsHelper.Get("VisaProgressImageBasePath");
  510. //文件名称
  511. filename = "VisaProgress_" + DateTime.Now.ToString("yyyyMMddHHmmss") + "_" + imgName + ".jpeg";//所要保存的相对路径及名字
  512. //上传的文件的路径
  513. string filePath = "";
  514. if (!Directory.Exists(fileDir))
  515. {
  516. Directory.CreateDirectory(fileDir);
  517. }
  518. //上传的文件的路径
  519. filePath = fileDir + filename;
  520. //string url = HttpRuntime.AppDomainAppPath.ToString();
  521. //string tmpRootDir = System.Web.HttpContext.Current.Server.MapPath(System.Web.HttpContext.Current.Request.ApplicationPath.ToString()); //获取程序根目录
  522. //string imagesurl2 = tmpRootDir + filename; //转换成绝对路径
  523. bitmap.Save(filePath, System.Drawing.Imaging.ImageFormat.Jpeg);//保存到服务器路径
  524. //bitmap.Save(filePath + ".bmp", System.Drawing.Imaging.ImageFormat.Bmp);
  525. //bitmap.Save(filePath + ".gif", System.Drawing.Imaging.ImageFormat.Gif);
  526. //bitmap.Save(filePath, System.Drawing.Imaging.ImageFormat.Png);
  527. ms.Close();//关闭当前流,并释放所有与之关联的资源
  528. bitmap.Dispose();
  529. }
  530. catch (Exception e)
  531. {
  532. string massage = e.Message;
  533. Logs("IOS图片上传Error:" + massage);
  534. //filename = e.Message;
  535. }
  536. return filename;//返回相对路径
  537. }
  538. /// <summary>
  539. /// IOS获取团组签证拍照上传进度05(修改签证状态/通知)
  540. /// </summary>
  541. /// <param name="dto"></param>
  542. /// <returns></returns>
  543. [HttpPost]
  544. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  545. public async Task<ActionResult> PostIOSVisaProgressChangeStatus(IOS_VisaChangeStatusDto dto)
  546. {
  547. if (dto == null)
  548. {
  549. return Ok(JsonView(false, "请求错误:"));
  550. }
  551. string msg = "参数错误";
  552. if (dto.diId > 0 && dto.visaStatus > 0 && dto.visaStatus < 4)
  553. {
  554. try
  555. {
  556. //_delegationVisaRep.BeginTran();
  557. var updCount = await _delegationVisaRep._sqlSugar.Updateable<Grp_VisaProgressCustomer>()
  558. .SetColumns(it => it.WorkStatus == dto.visaStatus)
  559. .Where(s => s.Id == dto.visaProgressCustomerId)
  560. .ExecuteCommandAsync();
  561. if (updCount > 0 && dto.publishCode == 1) {
  562. _delegationVisaRep.ChangeDataBase(DBEnum.OA2014DB); //切换到新OA后删除
  563. GroupInfoDto grpDto = new GroupInfoDto() { Id = dto.diId };
  564. var groupData = await _groupRepository.GetGroupInfo(grpDto);
  565. _delegationVisaRep.ChangeDataBase(DBEnum.OA2023DB); //切换到新OA后删除
  566. if (groupData.Code != 0)
  567. {
  568. _delegationVisaRep.RollbackTran();
  569. }
  570. string title = string.Format(@"[签证进度更新]");
  571. string content = string.Format(@"测试文本");
  572. bool rst = await _message.AddMsg(new MessageDto()
  573. {
  574. Type = 5,
  575. IssuerId = dto.publisher,
  576. Title = dto.title,
  577. Content = content,
  578. ReleaseTime = DateTime.Now,
  579. UIdList = new List<int> {
  580. 234
  581. }
  582. });
  583. if (rst) {
  584. return Ok(JsonView(true, "发送通知成功"));
  585. }
  586. }
  587. //_delegationVisaRep.CommitTran();
  588. }
  589. catch (Exception)
  590. {
  591. //_delegationVisaRep.RollbackTran();
  592. }
  593. }
  594. return Ok(JsonView(true, msg));
  595. }
  596. #endregion
  597. #region 团组任务分配
  598. /// <summary>
  599. /// 团组任务分配初始化
  600. /// </summary>
  601. /// <param name="dto"></param>
  602. /// <returns></returns>
  603. [HttpPost]
  604. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  605. public async Task<IActionResult> GetTaskAssignmen()
  606. {
  607. var groupData = await _taskAssignmentRep.GetTaskAssignmen();
  608. if (groupData.Code != 0)
  609. {
  610. return Ok(JsonView(false, groupData.Msg));
  611. }
  612. return Ok(JsonView(true, groupData.Msg, groupData.Data));
  613. }
  614. /// <summary>
  615. /// 团组任务分配查询
  616. /// </summary>
  617. /// <param name="dto"></param>
  618. /// <returns></returns>
  619. [HttpPost]
  620. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  621. public async Task<IActionResult> TaskAssignmenQuery(TaskAssignmenQueryDto dto)
  622. {
  623. var groupData = await _taskAssignmentRep.TaskAssignmenQuery(dto);
  624. if (groupData.Code != 0)
  625. {
  626. return Ok(JsonView(false, groupData.Msg));
  627. }
  628. return Ok(JsonView(true, groupData.Msg, groupData.Data));
  629. }
  630. /// <summary>
  631. /// 团组任务分配操作
  632. /// </summary>
  633. /// <param name="dto"></param>
  634. /// <returns></returns>
  635. [HttpPost]
  636. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  637. public async Task<IActionResult> GetTaskAssignmenOp(TaskAssignmenDto dto)
  638. {
  639. Result groupData = await _taskAssignmentRep.GetTaskAssignmenOp(dto);
  640. if (groupData.Code != 0)
  641. {
  642. return Ok(JsonView(false, groupData.Msg));
  643. }
  644. return Ok(JsonView(true, groupData.Msg, groupData.Data));
  645. }
  646. #endregion
  647. #region 团组费用审核
  648. /// <summary>
  649. /// 获取团组费用审核
  650. /// </summary>
  651. /// <param name="paras">参数Json字符串</param>
  652. /// <returns></returns>
  653. [HttpPost]
  654. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  655. public async Task<IActionResult> PostSearchGrpCreditCardPayment(Search_GrpCreditCardPaymentDto _dto)
  656. {
  657. if (_dto.DiId < 1)
  658. {
  659. return Ok(JsonView(false, "团组Id为空"));
  660. }
  661. Grp_CreditCardPaymentView _view = new Grp_CreditCardPaymentView();
  662. #region 团组基本信息
  663. Grp_DelegationInfo _delegation = _groupRepository.Query<Grp_DelegationInfo>(s => s.Id == _dto.DiId).First();
  664. if (_delegation != null)
  665. {
  666. _view.ClientName = _delegation.ClientName;
  667. _view.DiId = _dto.DiId;
  668. _view.TeamName = _delegation.TeamName;
  669. _view.VisitCountry = _delegation.VisitCountry;
  670. _view.VisitDate = _delegation.VisitStartDate.ToString("yyyy-MM-dd") + " ~ " + _delegation.VisitEndDate.ToString("yyyy-MM-dd");
  671. _view.VisitDays = _delegation.VisitDays;
  672. _view.VisitPNumber = _delegation.VisitPNumber;
  673. }
  674. else
  675. {
  676. return Ok(JsonView(false, "团组信息为空"));
  677. }
  678. #endregion
  679. #region 费用清单
  680. var exp = Expressionable.Create<Grp_CreditCardPayment>();
  681. exp.AndIF(_dto.AuditStatus != -1, it => it.IsAuditGM == _dto.AuditStatus);
  682. exp.AndIF(_dto.Label != -1, it => it.CTable == _dto.Label);
  683. List<Grp_CreditCardPayment> entityList = _groupRepository
  684. .Query<Grp_CreditCardPayment>(s => s.DIId == _dto.DiId && s.IsDel == 0 && s.CreateUserId > 0)
  685. .Where(exp.ToExpression())
  686. .ToList();
  687. List<Grp_CreditCardPaymentDetailView> detailList = new List<Grp_CreditCardPaymentDetailView>();
  688. decimal CNY = 0;
  689. decimal PayCNY = 0;
  690. decimal BalanceCNY = 0;
  691. decimal YSFYCNY = 0;
  692. decimal USD = 0;
  693. decimal PayUSD = 0;
  694. decimal BalanceUSD = 0;
  695. decimal YSFYUSD = 0;
  696. decimal EUR = 0;
  697. decimal PayEUR = 0;
  698. decimal BalanceEUR = 0;
  699. decimal YSFYEUR = 0;
  700. foreach (var entity in entityList)
  701. {
  702. Grp_CreditCardPaymentDetailView _detail = new Grp_CreditCardPaymentDetailView();
  703. _detail.Id = entity.Id;
  704. /*
  705. * Bus名称
  706. */
  707. _detail.BusName = "";
  708. /*
  709. *费用所属
  710. */
  711. switch (entity.CTable)
  712. {
  713. case 85:
  714. Grp_AirTicketReservations jpRes = _groupRepository.Query<Grp_AirTicketReservations>(s => s.Id == entity.CId).First();
  715. if (jpRes != null)
  716. {
  717. string FlightsDescription = jpRes.FlightsDescription;
  718. string PriceDescription = jpRes.PriceDescription;
  719. _detail.PriceMsgContent = "航班号:" + jpRes.FlightsCode + "<br/>城市A-B:" + jpRes.FlightsCity + "<br/>航班描述:" + FlightsDescription.Replace("\r\n", "<br />") + "<br/>" + "价格描述:" + PriceDescription;
  720. _detail.PriceNameContent = "(" + jpRes.FlightsCode + ")";
  721. }
  722. break;
  723. case 79:
  724. _detail.BusName = "待增加";
  725. break;
  726. case 98:
  727. Grp_DecreasePayments gdpRes = _groupRepository.Query<Grp_DecreasePayments>(s => s.Id == entity.CId).First();
  728. if (gdpRes != null)
  729. {
  730. _detail.PriceMsgContent = "备注:" + gdpRes.Remark;
  731. _detail.PriceNameContent = gdpRes.PriceName;
  732. }
  733. break;
  734. default:
  735. break;
  736. }
  737. /*
  738. * 费用模块
  739. */
  740. Sys_SetData sdPriceName = _groupRepository.Query<Sys_SetData>(s => s.Id == entity.CTable).First();
  741. if (sdPriceName != null)
  742. {
  743. _detail.PriceName = sdPriceName.Name;
  744. }
  745. /*
  746. * 应付款金额
  747. */
  748. Sys_SetData sdPaymentCurrency_WaitPay = _groupRepository.Query<Sys_SetData>(s => s.Id == entity.PaymentCurrency).First();
  749. string PaymentCurrency_WaitPay = "Unknown";
  750. if (sdPaymentCurrency_WaitPay != null)
  751. {
  752. PaymentCurrency_WaitPay = sdPaymentCurrency_WaitPay.Name;
  753. }
  754. _detail.WaitPay = entity.PayMoney.ToString("#0.00") + " " + PaymentCurrency_WaitPay;
  755. /*
  756. * 此次付款金额
  757. */
  758. decimal CurrPayStr = 0;
  759. if (entity.PayPercentage == 0)
  760. {
  761. if (entity.PayThenMoney != 0)
  762. CurrPayStr = entity.PayThenMoney * entity.DayRate;
  763. }
  764. else
  765. {
  766. CurrPayStr = entity.PayMoney * (decimal.Parse(entity.PayPercentage.ToString("#0.00")) / 100 * entity.DayRate);
  767. }
  768. _detail.CurrPay = CurrPayStr.ToString("#0.00") + " CNY";
  769. /*
  770. * 剩余尾款
  771. */
  772. decimal BalanceStr = 0;
  773. if (entity.PayMoney - (CurrPayStr / entity.DayRate) < 0.01M)
  774. BalanceStr = 0;
  775. else
  776. BalanceStr = (entity.PayMoney - CurrPayStr / entity.DayRate);
  777. _detail.Balance = BalanceStr.ToString("#0.00") + " " + PaymentCurrency_WaitPay;
  778. /*
  779. * 申请人
  780. */
  781. string operatorName = "无";
  782. Sys_Users _opUser = _groupRepository.Query<Sys_Users>(s => s.Id == entity.CreateUserId).First();
  783. if (_opUser != null)
  784. {
  785. operatorName = _opUser.CnName;
  786. }
  787. _detail.OperatorName = operatorName;
  788. /*
  789. * 审核人
  790. */
  791. string auditOperatorName = "Unknown";
  792. if (entity.AuditGMOperate == 0)
  793. auditOperatorName = "无";
  794. else if (entity.AuditGMOperate == 4)
  795. auditOperatorName = "自动审核";
  796. else
  797. {
  798. Sys_Users _adUser = _groupRepository.Query<Sys_Users>(s => s.Id == entity.AuditGMOperate).First();
  799. if (_adUser != null)
  800. {
  801. auditOperatorName = _adUser.CnName;
  802. }
  803. }
  804. _detail.AuditOperatorName = auditOperatorName;
  805. /*
  806. *
  807. * *超预算比例
  808. */
  809. string overBudgetStr = "";
  810. if (entity.ExceedBudget == -1)
  811. overBudgetStr = sdPriceName.Name + "尚无预算";
  812. else if (entity.ExceedBudget == 0)
  813. overBudgetStr = "未超预算";
  814. else
  815. overBudgetStr = entity.ExceedBudget.ToString("P");
  816. _detail.OverBudget = overBudgetStr;
  817. /*
  818. * 费用总计
  819. */
  820. if (entity.PaymentCurrency == 48)
  821. {
  822. CNY += entity.PayMoney;
  823. PayCNY += CurrPayStr;
  824. BalanceCNY += BalanceStr;
  825. YSFYCNY += CurrPayStr;
  826. }
  827. if (entity.PaymentCurrency == 49)
  828. {
  829. USD += entity.PayMoney;
  830. PayUSD += CurrPayStr;
  831. BalanceUSD += BalanceStr;
  832. YSFYUSD += CurrPayStr;
  833. }
  834. if (entity.PaymentCurrency == 51)
  835. {
  836. EUR += entity.PayMoney;
  837. PayEUR += CurrPayStr;
  838. BalanceEUR += BalanceStr;
  839. YSFYEUR += CurrPayStr;
  840. }
  841. _detail.IsAuditGM = entity.IsAuditGM;
  842. detailList.Add(_detail);
  843. }
  844. #endregion
  845. _view.DetailList = new List<Grp_CreditCardPaymentDetailView>(detailList);
  846. _view.TotalStr1 = string.Format(@"应付款总金额:{0}CNY&nbsp;|&nbsp;{1}USD&nbsp;|&nbsp;{2}EUR", CNY, USD, EUR);
  847. _view.TotalStr2 = string.Format(@"此次付款总金额:{0}CNY&nbsp;|&nbsp;{1}USD&nbsp;|&nbsp;{2}EUR", PayCNY, PayUSD, PayEUR);
  848. _view.TotalStr3 = string.Format(@"目前剩余尾款总金额:{0}CNY&nbsp;|&nbsp;{1}USD&nbsp;|&nbsp;{2}EUR", BalanceCNY, BalanceUSD, BalanceEUR);
  849. _view.TotalStr4 = string.Format(@"已审费用总额:{0}CNY&nbsp;|&nbsp;{1}USD&nbsp;|&nbsp;{2}EUR", YSFYCNY, YSFYUSD, YSFYEUR);
  850. return Ok(JsonView(_view));
  851. }
  852. /// <summary>
  853. /// 修改团组费用审核状态
  854. /// </summary>
  855. /// <param name="paras">参数Json字符串</param>
  856. /// <returns></returns>
  857. [HttpPost]
  858. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  859. public async Task<IActionResult> PostAuditGrpCreditCardPayment(Edit_GrpCreditCardPaymentDto _dto)
  860. {
  861. List<string> idList = _dto.CreditIdStr.Split(',').ToList();
  862. Grp_CreditCardPayment _detail = _mapper.Map<Grp_CreditCardPayment>(_dto);
  863. DateTime dtNow = DateTime.Now;
  864. _groupRepository.BeginTran();
  865. int rst = 0;
  866. foreach (var item in idList)
  867. {
  868. int CreditId = int.Parse(item);
  869. var result = await _grpScheduleRep._sqlSugar.Updateable<Grp_CreditCardPayment>()
  870. .SetColumns(it => it.IsAuditGM == _dto.AuditCode)
  871. .SetColumns(it => it.AuditGMOperate == _dto.User)
  872. .SetColumns(it => it.AuditGMDate == dtNow.ToString())
  873. .Where(s => s.Id == CreditId)
  874. .ExecuteCommandAsync();
  875. if (result < 1)
  876. {
  877. rst = -1;
  878. }
  879. else
  880. {
  881. _groupRepository.RollbackTran();
  882. return Ok(JsonView(false, "保存失败并回滚!"));
  883. }
  884. }
  885. _groupRepository.CommitTran();
  886. if (rst == 0)
  887. {
  888. return Ok(JsonView(true, "保存成功!"));
  889. }
  890. return Ok(JsonView(false, "保存失败!"));
  891. }
  892. #endregion
  893. #region 机票费用录入
  894. /// <summary>
  895. /// 机票录入当前登录人可操作团组
  896. /// </summary>
  897. /// <param name="dto"></param>
  898. /// <returns></returns>
  899. [HttpPost]
  900. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  901. public async Task<IActionResult> AirTicketResSelect(AirTicketResDto dto)
  902. {
  903. try
  904. {
  905. Result groupData = await _airTicketResRep.AirTicketResSelect(dto);
  906. if (groupData.Code != 0)
  907. {
  908. return Ok(JsonView(false, groupData.Msg));
  909. }
  910. return Ok(JsonView(true, groupData.Msg, groupData.Data));
  911. }
  912. catch (Exception ex)
  913. {
  914. return Ok(JsonView(false, "程序错误!"));
  915. throw;
  916. }
  917. }
  918. /// <summary>
  919. /// 机票费用录入列表
  920. /// </summary>
  921. /// <param name="dto"></param>
  922. /// <returns></returns>
  923. [HttpPost]
  924. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  925. public async Task<IActionResult> AirTicketResList(AirTicketResDto dto)
  926. {
  927. try
  928. {
  929. Result groupData = await _airTicketResRep.AirTicketResList(dto);
  930. if (groupData.Code != 0)
  931. {
  932. return Ok(JsonView(false, groupData.Msg));
  933. }
  934. return Ok(JsonView(true, groupData.Msg, groupData.Data));
  935. }
  936. catch (Exception ex)
  937. {
  938. return Ok(JsonView(false, "程序错误!"));
  939. throw;
  940. }
  941. }
  942. /// <summary>
  943. /// 根据id查询费用录入信息
  944. /// </summary>
  945. /// <param name="dto"></param>
  946. /// <returns></returns>
  947. [HttpPost]
  948. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  949. public async Task<IActionResult> AirTicketResById(AirTicketResByIdDto dto)
  950. {
  951. try
  952. {
  953. Result groupData = await _airTicketResRep.AirTicketResById(dto);
  954. if (groupData.Code != 0)
  955. {
  956. return Ok(JsonView(false, groupData.Msg));
  957. }
  958. return Ok(JsonView(true, groupData.Msg, groupData.Data));
  959. }
  960. catch (Exception ex)
  961. {
  962. return Ok(JsonView(false, "程序错误!"));
  963. throw;
  964. }
  965. }
  966. /// <summary>
  967. /// 机票费用录入操作(Status:1.新增,2.修改)
  968. /// </summary>
  969. /// <param name="dto"></param>
  970. /// <returns></returns>
  971. [HttpPost]
  972. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  973. public async Task<IActionResult> OpAirTicketRes(AirTicketResOpDto dto)
  974. {
  975. try
  976. {
  977. Result groupData = await _airTicketResRep.OpAirTicketRes(dto);
  978. if (groupData.Code != 0)
  979. {
  980. return Ok(JsonView(false, groupData.Msg));
  981. }
  982. return Ok(JsonView(true, groupData.Msg, groupData.Data));
  983. }
  984. catch (Exception ex)
  985. {
  986. return Ok(JsonView(false, "程序错误!"));
  987. throw;
  988. }
  989. }
  990. /// <summary>
  991. /// 根据舱位类型查询接团客户名单信息
  992. /// </summary>
  993. /// <param name="dto"></param>
  994. /// <returns></returns>
  995. [HttpPost]
  996. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  997. public async Task<IActionResult> tankType(AirTicketResByIdDto dto)
  998. {
  999. try
  1000. {
  1001. List<Crm_GroupCustomer> crm_Groups = _sqlSugar.Queryable<Crm_GroupCustomer>().Where(a => a.IsDel == 0 && a.AirType == dto.Id).ToList();
  1002. if (crm_Groups.Count != 0)
  1003. {
  1004. List<dynamic> Customer = new List<dynamic>();
  1005. foreach (var item in crm_Groups)
  1006. {
  1007. var data = new
  1008. {
  1009. Id = item.Id,
  1010. Pinyin = item.Pinyin,
  1011. Name = item.LastName + item.FirstName
  1012. };
  1013. Customer.Add(data);
  1014. }
  1015. return Ok(JsonView(true, "查询成功!", Customer));
  1016. }
  1017. return Ok(JsonView(true, "暂无数据", crm_Groups));
  1018. }
  1019. catch (Exception ex)
  1020. {
  1021. return Ok(JsonView(false, "程序错误!"));
  1022. throw;
  1023. }
  1024. }
  1025. /// <summary>
  1026. /// 机票费用录入,删除
  1027. /// </summary>
  1028. /// <param name="dto"></param>
  1029. /// <returns></returns>
  1030. [HttpPost]
  1031. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  1032. public async Task<IActionResult> DelAirTicketRes(DelBaseDto dto)
  1033. {
  1034. try
  1035. {
  1036. var res = await _airTicketResRep.SoftDeleteByIdAsync<Grp_AirTicketReservations>(dto.Id.ToString(), dto.DeleteUserId);
  1037. if (!res)
  1038. {
  1039. var result = await _sqlSugar.Updateable<Grp_CreditCardPayment>().Where(a => a.CId == dto.Id && a.CTable == 85).SetColumns(a => new Grp_CreditCardPayment()
  1040. {
  1041. IsDel = 1,
  1042. DeleteUserId = dto.DeleteUserId,
  1043. DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
  1044. }).ExecuteCommandAsync();
  1045. return Ok(JsonView(false, "删除失败"));
  1046. }
  1047. return Ok(JsonView(true, "删除成功!"));
  1048. }
  1049. catch (Exception ex)
  1050. {
  1051. return Ok(JsonView(false, "程序错误!"));
  1052. throw;
  1053. }
  1054. }
  1055. /// <summary>
  1056. /// 导出机票录入报表
  1057. /// </summary>
  1058. /// <param name="dto"></param>
  1059. /// <returns></returns>
  1060. [HttpPost]
  1061. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  1062. public async Task<IActionResult> DeriveAirTicketRes(AirTicketResDto dto)
  1063. {
  1064. try
  1065. {
  1066. Result groupData = await _airTicketResRep.DeriveAirTicketRes(dto);
  1067. if (groupData.Code != 0)
  1068. {
  1069. return Ok(JsonView(false, groupData.Msg));
  1070. }
  1071. else
  1072. {
  1073. List<AirTicketReservationsPayView> AirTicketReservations = groupData.Data.GetType().GetProperty("AirTicketRes").GetValue(groupData.Data);
  1074. if (AirTicketReservations.Count != 0)
  1075. {
  1076. Grp_DelegationInfo DelegationInfo = groupData.Data.GetType().GetProperty("Delegation").GetValue(groupData.Data);
  1077. Sys_Users _Users = groupData.Data.GetType().GetProperty("Users").GetValue(groupData.Data);
  1078. string diCode = DelegationInfo != null ? DelegationInfo.TourCode : "XXX";
  1079. string diName = DelegationInfo != null ? DelegationInfo.TeamName : "XXX";
  1080. WorkbookDesigner designer = new WorkbookDesigner();
  1081. designer.Workbook = new Workbook(AppSettingsHelper.Get("ExcelBasePath") + "Template/机票预订费用报表模板.xlsx");
  1082. decimal countCost = 0;
  1083. foreach (var item in AirTicketReservations)
  1084. {
  1085. if (item.BankType == "其他")
  1086. {
  1087. item.BankNo = "--";
  1088. }
  1089. else
  1090. {
  1091. item.BankNo = item.BankType + ":" + item.BankNo.Substring(0, 3);
  1092. }
  1093. item.PrePrice = System.Decimal.Round(item.PrePrice, 2);
  1094. item.Price = System.Decimal.Round(item.Price, 2);
  1095. countCost += Convert.ToDecimal(item.Price);
  1096. }
  1097. designer.SetDataSource("Export", AirTicketReservations);
  1098. designer.SetDataSource("ExportDiCode", diCode);
  1099. designer.SetDataSource("ExportDiName", diName);
  1100. designer.SetDataSource("ExportOpUserName", _Users.CnName);
  1101. designer.SetDataSource("ExportCountCost", countCost + "(" + AirTicketReservations[0].CurrencyStr);
  1102. designer.Process();
  1103. string fileName = "AirfareStatement/" + diName + "机票费用报表" + "_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xlsx";
  1104. designer.Workbook.Save(AppSettingsHelper.Get("ExcelBasePath") + fileName);
  1105. string rst = AppSettingsHelper.Get("ExcelBaseUrl") + AppSettingsHelper.Get("ExcelFtpPath") + fileName;
  1106. return Ok(JsonView(true, "成功", url = rst));
  1107. }
  1108. else
  1109. {
  1110. return Ok(JsonView(false, "暂无数据!"));
  1111. }
  1112. }
  1113. }
  1114. catch (Exception ex)
  1115. {
  1116. return Ok(JsonView(false, "程序错误!"));
  1117. throw;
  1118. }
  1119. }
  1120. Dictionary<string, string> transDic = new Dictionary<string, string>();
  1121. /// <summary>
  1122. /// 行程单导出
  1123. /// </summary>
  1124. /// <param name="dto"></param>
  1125. /// <returns></returns>
  1126. [HttpPost]
  1127. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  1128. public async Task<IActionResult> ItineraryAirTicketRes(ItineraryAirTicketResDto dto)
  1129. {
  1130. try
  1131. {
  1132. Result groupData = await _airTicketResRep.ItineraryAirTicketRes(dto);
  1133. if (groupData.Code != 0)
  1134. {
  1135. return Ok(JsonView(false, groupData.Msg));
  1136. }
  1137. else
  1138. {
  1139. List<AirTicketReservationsView> _AirTicketReservations = groupData.Data;
  1140. if (dto.Language == "CN")
  1141. {
  1142. Document doc = new Document(AppSettingsHelper.Get("WordBasePath") + "Template/电子客票行程单模板_CN.docx");
  1143. DocumentBuilder builder = new DocumentBuilder(doc);
  1144. int tableIndex = 0;//表格索引
  1145. //得到文档中的第一个表格
  1146. Table table = (Table)doc.GetChild(NodeType.Table, tableIndex, true);
  1147. foreach (var item in _AirTicketReservations)
  1148. {
  1149. #region 处理固定数据
  1150. string[] FlightsCode = item.FlightsCode.Split('/');
  1151. if (FlightsCode.Length != 0)
  1152. {
  1153. Res_AirCompany _AirCompany = _sqlSugar.Queryable<Res_AirCompany>().First(a => a.ShortCode == FlightsCode[0].Substring(0, 2));
  1154. if (_AirCompany != null)
  1155. {
  1156. table.Range.Bookmarks["AirlineCompany"].Text = _AirCompany.CnName;
  1157. }
  1158. else
  1159. {
  1160. table.Range.Bookmarks["AirlineCompany"].Text = "--";
  1161. }
  1162. }
  1163. table.Range.Bookmarks["AirlineRecordCode"].Text = "--";
  1164. table.Range.Bookmarks["ReservationRecordCode"].Text = "--";
  1165. string[] nameArray = Regex.Split(item.ClientName, "\\d+\\.", RegexOptions.IgnoreCase);
  1166. nameArray = nameArray.Where(str => str != "" && str != " " && !string.IsNullOrEmpty(str)).ToArray();
  1167. string name = "";
  1168. foreach (string clientName in nameArray)
  1169. {
  1170. if (!name.Contains(clientName))
  1171. {
  1172. name += clientName + ",";
  1173. }
  1174. }
  1175. if (!string.IsNullOrWhiteSpace(name))
  1176. {
  1177. table.Range.Bookmarks["ClientName"].Text = name.Substring(0, name.Length - 1);
  1178. }
  1179. else
  1180. {
  1181. table.Range.Bookmarks["ClientName"].Text = "--";
  1182. }
  1183. table.Range.Bookmarks["TicketNumber"].Text = "--";
  1184. table.Range.Bookmarks["IdentificationCode"].Text = "--";
  1185. table.Range.Bookmarks["JointTicket"].Text = "--";
  1186. table.Range.Bookmarks["TimeIssue"].Text = "--";
  1187. table.Range.Bookmarks["DrawingAgent"].Text = "--";
  1188. table.Range.Bookmarks["NavigationCode"].Text = "--";
  1189. table.Range.Bookmarks["AgentsAddress"].Text = "--";
  1190. table.Range.Bookmarks["AgentPhone"].Text = "--";
  1191. table.Range.Bookmarks["AgentFacsimile"].Text = "--";
  1192. #endregion
  1193. #region 循环数据处理
  1194. List<AirInfo> airs = new List<AirInfo>();
  1195. string[] DayArray = Regex.Split(item.FlightsDescription, "\\d+\\.", RegexOptions.IgnoreCase);
  1196. DayArray = DayArray.Where(s => s != " " && s != "" && !string.IsNullOrEmpty(s)).ToArray();
  1197. for (int i = 0; i < FlightsCode.Length; i++)
  1198. {
  1199. AirInfo air = new AirInfo();
  1200. string[] tempstr = DayArray[i]
  1201. .Replace("\r\n", string.Empty)
  1202. .Replace("\\r\\n", string.Empty)
  1203. .TrimStart().TrimEnd()
  1204. .Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
  1205. Res_ThreeCode star_Three = _sqlSugar.Queryable<Res_ThreeCode>().First(a => a.Three == tempstr[3].Substring(0, 3));
  1206. string starCity = "";
  1207. if (star_Three != null)
  1208. {
  1209. starCity = star_Three.AirPort;
  1210. }
  1211. Res_ThreeCode End_Three = _sqlSugar.Queryable<Res_ThreeCode>().First(a => a.Three == tempstr[3].Substring(3, 3));
  1212. string EndCity = "";
  1213. if (End_Three != null)
  1214. {
  1215. EndCity = End_Three.AirPort;
  1216. }
  1217. air.Destination = starCity + "/" + EndCity;
  1218. air.Flight = FlightsCode[i];
  1219. air.SeatingClass = item.CTypeName;
  1220. string dateTime = tempstr[2];
  1221. string DateTemp = dateTime.Substring(2, 5).ToUpper();
  1222. air.FlightDate = DateTemp;
  1223. air.DepartureTime = tempstr[5];
  1224. air.LandingTime = tempstr[6];
  1225. air.ValidityPeriod = DateTemp + "/" + DateTemp;
  1226. air.TicketStatus = "--";
  1227. air.Luggage = "--";
  1228. air.DepartureTerminal = "--";
  1229. air.LandingTerminal = "--";
  1230. airs.Add(air);
  1231. }
  1232. int row = 13;
  1233. for (int i = 0; i < airs.Count; i++)
  1234. {
  1235. if (airs.Count > 2)
  1236. {
  1237. for (int j = 0; j < airs.Count - 2; j++)
  1238. {
  1239. var CopyRow = table.Rows[12].Clone(true);
  1240. table.Rows.Add(CopyRow);
  1241. }
  1242. }
  1243. PropertyInfo[] properties = airs[i].GetType().GetProperties();
  1244. int index = 0;
  1245. foreach (PropertyInfo property in properties)
  1246. {
  1247. string value = property.GetValue(airs[i]).ToString();
  1248. Cell ishcel0 = table.Rows[row].Cells[index];
  1249. Paragraph p = new Paragraph(doc);
  1250. string s = value;
  1251. p.AppendChild(new Run(doc, s));
  1252. p.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
  1253. ishcel0.AppendChild(p);
  1254. ishcel0.CellFormat.VerticalAlignment = CellVerticalAlignment.Center;//垂直居中对齐
  1255. index++;
  1256. }
  1257. row++;
  1258. }
  1259. #endregion
  1260. Paragraph lastParagraph = new Paragraph(doc);
  1261. //第一个表格末尾加段落
  1262. table.ParentNode.InsertAfter(lastParagraph, table);
  1263. //复制第一个表格
  1264. Table cloneTable = (Table)table.Clone(true);
  1265. //在文档末尾段落后面加入复制的表格
  1266. table.ParentNode.InsertAfter(cloneTable, lastParagraph);
  1267. if (item != _AirTicketReservations[_AirTicketReservations.Count - 1])
  1268. {
  1269. int rownewsIndex = 13;
  1270. for (int i = 0; i < 2; i++)
  1271. {
  1272. var CopyRow = table.Rows[12].Clone(true);
  1273. table.Rows.RemoveAt(13);
  1274. table.Rows.Add(CopyRow);
  1275. rownewsIndex++;
  1276. }
  1277. }
  1278. else
  1279. {
  1280. table.Rows.RemoveAt(12);
  1281. }
  1282. cloneTable.Rows.RemoveAt(12);
  1283. }
  1284. if (_AirTicketReservations.Count != 0)
  1285. {
  1286. string[] FlightsCode = _AirTicketReservations[0].FlightsCode.Split('/');
  1287. if (FlightsCode.Length != 0)
  1288. {
  1289. Res_AirCompany _AirCompany = _sqlSugar.Queryable<Res_AirCompany>().First(a => a.ShortCode == FlightsCode[0].Substring(0, 2));
  1290. if (_AirCompany != null)
  1291. {
  1292. table.Range.Bookmarks["AirlineCompany"].Text = _AirCompany.CnName;
  1293. }
  1294. else
  1295. {
  1296. table.Range.Bookmarks["AirlineCompany"].Text = "--";
  1297. }
  1298. }
  1299. table.Range.Bookmarks["AirlineRecordCode"].Text = "--";
  1300. table.Range.Bookmarks["ReservationRecordCode"].Text = "--";
  1301. string[] nameArray = Regex.Split(_AirTicketReservations[0].ClientName, "\\d+\\.", RegexOptions.IgnoreCase);
  1302. nameArray = nameArray.Where(str => str != "" && str != " " && !string.IsNullOrEmpty(str)).ToArray();
  1303. string name = "";
  1304. foreach (string clientName in nameArray)
  1305. {
  1306. if (!name.Contains(clientName))
  1307. {
  1308. name += clientName + ",";
  1309. }
  1310. }
  1311. if (!string.IsNullOrWhiteSpace(name))
  1312. {
  1313. table.Range.Bookmarks["ClientName"].Text = name.Substring(0, name.Length - 1);
  1314. }
  1315. else
  1316. {
  1317. table.Range.Bookmarks["ClientName"].Text = "--";
  1318. }
  1319. table.Range.Bookmarks["TicketNumber"].Text = "--";
  1320. table.Range.Bookmarks["IdentificationCode"].Text = "--";
  1321. table.Range.Bookmarks["JointTicket"].Text = "--";
  1322. table.Range.Bookmarks["TimeIssue"].Text = "--";
  1323. table.Range.Bookmarks["DrawingAgent"].Text = "--";
  1324. table.Range.Bookmarks["NavigationCode"].Text = "--";
  1325. table.Range.Bookmarks["AgentsAddress"].Text = "--";
  1326. table.Range.Bookmarks["AgentPhone"].Text = "--";
  1327. table.Range.Bookmarks["AgentFacsimile"].Text = "--";
  1328. }
  1329. doc.MailMerge.Execute(new[] { "PageCount" }, new object[] { doc.PageCount });
  1330. //保存合并后的文档
  1331. string fileName = "AirItinerary/电子客票中文行程单_CN.docx";
  1332. string rst = AppSettingsHelper.Get("WordBaseUrl") + AppSettingsHelper.Get("WordFtpPath") + fileName;
  1333. doc.Save(AppSettingsHelper.Get("WordBasePath") + fileName);
  1334. return Ok(JsonView(true, "成功!", rst));
  1335. }
  1336. else
  1337. {
  1338. Document doc = new Document(AppSettingsHelper.Get("WordBasePath") + "Template/电子客票行程单模板_EN.docx");
  1339. DocumentBuilder builder = new DocumentBuilder(doc);
  1340. int tableIndex = 0;//表格索引
  1341. //得到文档中的第一个表格
  1342. Table table = (Table)doc.GetChild(NodeType.Table, tableIndex, true);
  1343. List<string> texts = new List<string>();
  1344. foreach (var item in _AirTicketReservations)
  1345. {
  1346. string[] FlightsCode = item.FlightsCode.Split('/');
  1347. if (FlightsCode.Length != 0)
  1348. {
  1349. Res_AirCompany _AirCompany = _sqlSugar.Queryable<Res_AirCompany>().First(a => a.ShortCode == FlightsCode[0].Substring(0, 2));
  1350. if (_AirCompany != null)
  1351. {
  1352. if (!transDic.ContainsKey(_AirCompany.CnName))
  1353. {
  1354. transDic.Add(_AirCompany.CnName, _AirCompany.EnName);
  1355. }
  1356. }
  1357. else
  1358. {
  1359. if (!transDic.ContainsKey("--"))
  1360. {
  1361. transDic.Add("--", "--");
  1362. }
  1363. }
  1364. }
  1365. string[] nameArray = Regex.Split(item.ClientName, "\\d+\\.", RegexOptions.IgnoreCase);
  1366. nameArray = nameArray.Where(str => str != "" && str != " " && !string.IsNullOrEmpty(str)).ToArray();
  1367. string name = "";
  1368. foreach (string clientName in nameArray)
  1369. {
  1370. name += clientName + ",";
  1371. }
  1372. if (!texts.Contains(name))
  1373. {
  1374. texts.Add(name);
  1375. }
  1376. List<AirInfo> airs = new List<AirInfo>();
  1377. string[] DayArray = Regex.Split(item.FlightsDescription, "\\d+\\.", RegexOptions.IgnoreCase);
  1378. DayArray = DayArray.Where(s => s != " " && s != "" && !string.IsNullOrEmpty(s)).ToArray();
  1379. for (int i = 0; i < FlightsCode.Length; i++)
  1380. {
  1381. AirInfo air = new AirInfo();
  1382. string[] tempstr = DayArray[i]
  1383. .Replace("\r\n", string.Empty)
  1384. .Replace("\\r\\n", string.Empty)
  1385. .TrimStart().TrimEnd()
  1386. .Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
  1387. Res_ThreeCode star_Three = _sqlSugar.Queryable<Res_ThreeCode>().First(a => a.Three == tempstr[3].Substring(0, 3));
  1388. if (star_Three != null)
  1389. {
  1390. if (!transDic.ContainsKey(star_Three.AirPort))
  1391. {
  1392. transDic.Add(star_Three.AirPort, star_Three.AirPort_En);
  1393. }
  1394. }
  1395. Res_ThreeCode End_Three = _sqlSugar.Queryable<Res_ThreeCode>().First(a => a.Three == tempstr[3].Substring(3, 3));
  1396. if (End_Three != null)
  1397. {
  1398. if (!transDic.ContainsKey(End_Three.AirPort))
  1399. {
  1400. transDic.Add(End_Three.AirPort, End_Three.AirPort_En);
  1401. }
  1402. }
  1403. if (!texts.Contains(item.CTypeName))
  1404. {
  1405. texts.Add(item.CTypeName);
  1406. }
  1407. }
  1408. }
  1409. List<TranslateResult> transData = _airTicketResRep.ReTransBatch(texts, "en");
  1410. if (transData.Count > 0)
  1411. {
  1412. foreach (TranslateResult item in transData)
  1413. {
  1414. if (!transDic.ContainsKey(item.Query))
  1415. {
  1416. transDic.Add(item.Query, item.Translation);
  1417. }
  1418. }
  1419. }
  1420. foreach (var item in _AirTicketReservations)
  1421. {
  1422. #region 处理固定数据
  1423. string[] FlightsCode = item.FlightsCode.Split('/');
  1424. if (FlightsCode.Length != 0)
  1425. {
  1426. Res_AirCompany _AirCompany = _sqlSugar.Queryable<Res_AirCompany>().First(a => a.ShortCode == FlightsCode[0].Substring(0, 2));
  1427. if (_AirCompany != null)
  1428. {
  1429. string str = "--";
  1430. string translateResult = transDic.Where(s => s.Key == _AirCompany.CnName).FirstOrDefault().Value;
  1431. if (!string.IsNullOrEmpty(translateResult))
  1432. {
  1433. str = translateResult;
  1434. str = _airTicketResRep.Processing(str);
  1435. }
  1436. table.Range.Bookmarks["AirlineCompany"].Text = str;
  1437. }
  1438. else
  1439. {
  1440. table.Range.Bookmarks["AirlineCompany"].Text = "--";
  1441. }
  1442. }
  1443. table.Range.Bookmarks["AirlineRecordCode"].Text = "--";
  1444. table.Range.Bookmarks["ReservationRecordCode"].Text = "--";
  1445. string[] nameArray = Regex.Split(item.ClientName, "\\d+\\.", RegexOptions.IgnoreCase);
  1446. nameArray = nameArray.Where(str => str != "" && str != " " && !string.IsNullOrEmpty(str)).ToArray();
  1447. string names = "";
  1448. foreach (string clientName in nameArray)
  1449. {
  1450. names += clientName + ",";
  1451. }
  1452. if (!string.IsNullOrWhiteSpace(names))
  1453. {
  1454. string str = "--";
  1455. string translateResult = transDic.Where(s => s.Key == names).FirstOrDefault().Value;
  1456. if (!string.IsNullOrEmpty(translateResult))
  1457. {
  1458. str = translateResult;
  1459. str = _airTicketResRep.Processing(str);
  1460. }
  1461. table.Range.Bookmarks["ClientName"].Text = str;
  1462. }
  1463. else
  1464. {
  1465. table.Range.Bookmarks["ClientName"].Text = "--";
  1466. }
  1467. table.Range.Bookmarks["TicketNumber"].Text = "--";
  1468. table.Range.Bookmarks["IdentificationCode"].Text = "--";
  1469. table.Range.Bookmarks["JointTicket"].Text = "--";
  1470. table.Range.Bookmarks["TimeIssue"].Text = "--";
  1471. table.Range.Bookmarks["DrawingAgent"].Text = "--";
  1472. table.Range.Bookmarks["NavigationCode"].Text = "--";
  1473. table.Range.Bookmarks["AgentsAddress"].Text = "--";
  1474. table.Range.Bookmarks["AgentPhone"].Text = "--";
  1475. table.Range.Bookmarks["AgentFacsimile"].Text = "--";
  1476. #endregion
  1477. #region 循环数据处理
  1478. List<AirInfo> airs = new List<AirInfo>();
  1479. string[] DayArray = Regex.Split(item.FlightsDescription, "\\d+\\.", RegexOptions.IgnoreCase);
  1480. DayArray = DayArray.Where(s => s != " " && s != "" && !string.IsNullOrEmpty(s)).ToArray();
  1481. for (int i = 0; i < FlightsCode.Length; i++)
  1482. {
  1483. AirInfo air = new AirInfo();
  1484. string[] tempstr = DayArray[i]
  1485. .Replace("\r\n", string.Empty)
  1486. .Replace("\\r\\n", string.Empty)
  1487. .TrimStart().TrimEnd()
  1488. .Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
  1489. Res_ThreeCode star_Three = _sqlSugar.Queryable<Res_ThreeCode>().First(a => a.Three == tempstr[3].Substring(0, 3));
  1490. string starCity = "";
  1491. if (star_Three != null)
  1492. {
  1493. string str2 = "--";
  1494. string translateResult2 = transDic.Where(s => s.Key == star_Three.AirPort).FirstOrDefault().Value;
  1495. if (!string.IsNullOrEmpty(translateResult2))
  1496. {
  1497. str2 = translateResult2;
  1498. str2 = _airTicketResRep.Processing(str2);
  1499. }
  1500. starCity = str2;
  1501. }
  1502. Res_ThreeCode End_Three = _sqlSugar.Queryable<Res_ThreeCode>().First(a => a.Three == tempstr[3].Substring(3, 3));
  1503. string EndCity = "";
  1504. if (End_Three != null)
  1505. {
  1506. string str1 = "--";
  1507. string translateResult1 = transDic.Where(s => s.Key == End_Three.AirPort).FirstOrDefault().Value;
  1508. if (!string.IsNullOrEmpty(translateResult1))
  1509. {
  1510. str1 = translateResult1;
  1511. str1 = _airTicketResRep.Processing(str1);
  1512. }
  1513. EndCity = str1;
  1514. }
  1515. air.Destination = starCity + "/" + EndCity;
  1516. air.Flight = FlightsCode[i];
  1517. string str = "--";
  1518. string translateResult = transDic.Where(s => s.Key == item.CTypeName).FirstOrDefault().Value;
  1519. if (!string.IsNullOrEmpty(translateResult))
  1520. {
  1521. str = translateResult;
  1522. str = _airTicketResRep.Processing(str);
  1523. }
  1524. air.SeatingClass = str;
  1525. string dateTime = tempstr[2];
  1526. string DateTemp = dateTime.Substring(2, 5).ToUpper();
  1527. air.FlightDate = DateTemp;
  1528. air.DepartureTime = tempstr[5];
  1529. air.LandingTime = tempstr[6];
  1530. air.ValidityPeriod = DateTemp + "/" + DateTemp;
  1531. air.TicketStatus = "--";
  1532. air.Luggage = "--";
  1533. air.DepartureTerminal = "--";
  1534. air.LandingTerminal = "--";
  1535. airs.Add(air);
  1536. }
  1537. int row = 13;
  1538. for (int i = 0; i < airs.Count; i++)
  1539. {
  1540. if (airs.Count > 2)
  1541. {
  1542. for (int j = 0; j < airs.Count - 2; j++)
  1543. {
  1544. var CopyRow = table.Rows[12].Clone(true);
  1545. table.Rows.Add(CopyRow);
  1546. }
  1547. }
  1548. PropertyInfo[] properties = airs[i].GetType().GetProperties();
  1549. int index = 0;
  1550. foreach (PropertyInfo property in properties)
  1551. {
  1552. string value = property.GetValue(airs[i]).ToString();
  1553. Cell ishcel0 = table.Rows[row].Cells[index];
  1554. Paragraph p = new Paragraph(doc);
  1555. string s = value;
  1556. p.AppendChild(new Run(doc, s));
  1557. p.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
  1558. ishcel0.AppendChild(p);
  1559. ishcel0.CellFormat.VerticalAlignment = CellVerticalAlignment.Center;//垂直居中对齐
  1560. //ishcel0.CellFormat.VerticalAlignment=
  1561. index++;
  1562. }
  1563. row++;
  1564. }
  1565. #endregion
  1566. Paragraph lastParagraph = new Paragraph(doc);
  1567. //第一个表格末尾加段落
  1568. table.ParentNode.InsertAfter(lastParagraph, table);
  1569. //复制第一个表格
  1570. Table cloneTable = (Table)table.Clone(true);
  1571. //在文档末尾段落后面加入复制的表格
  1572. table.ParentNode.InsertAfter(cloneTable, lastParagraph);
  1573. if (item != _AirTicketReservations[_AirTicketReservations.Count - 1])
  1574. {
  1575. int rownewsIndex = 13;
  1576. for (int i = 0; i < 2; i++)
  1577. {
  1578. var CopyRow = table.Rows[12].Clone(true);
  1579. table.Rows.RemoveAt(13);
  1580. table.Rows.Add(CopyRow);
  1581. rownewsIndex++;
  1582. }
  1583. }
  1584. else
  1585. {
  1586. table.Rows.RemoveAt(12);
  1587. }
  1588. cloneTable.Rows.RemoveAt(12);
  1589. }
  1590. if (_AirTicketReservations.Count != 0)
  1591. {
  1592. string[] FlightsCode = _AirTicketReservations[0].FlightsCode.Split('/');
  1593. if (FlightsCode.Length != 0)
  1594. {
  1595. Res_AirCompany _AirCompany = _sqlSugar.Queryable<Res_AirCompany>().First(a => a.ShortCode == FlightsCode[0].Substring(0, 2));
  1596. if (_AirCompany != null)
  1597. {
  1598. string str = "--";
  1599. string translateResult = transDic.Where(s => s.Key == _AirCompany.CnName).FirstOrDefault().Value;
  1600. if (!string.IsNullOrEmpty(translateResult))
  1601. {
  1602. str = translateResult;
  1603. str = _airTicketResRep.Processing(str);
  1604. }
  1605. table.Range.Bookmarks["AirlineCompany"].Text = str;
  1606. }
  1607. else
  1608. {
  1609. table.Range.Bookmarks["AirlineCompany"].Text = "--";
  1610. }
  1611. }
  1612. table.Range.Bookmarks["AirlineRecordCode"].Text = "--";
  1613. table.Range.Bookmarks["ReservationRecordCode"].Text = "--";
  1614. string[] nameArray = Regex.Split(_AirTicketReservations[0].ClientName, "\\d+\\.", RegexOptions.IgnoreCase);
  1615. nameArray = nameArray.Where(str => str != "" && str != " " && !string.IsNullOrEmpty(str)).ToArray();
  1616. string names = "";
  1617. foreach (string clientName in nameArray)
  1618. {
  1619. names += clientName + ",";
  1620. }
  1621. if (!string.IsNullOrWhiteSpace(names))
  1622. {
  1623. string str = "--";
  1624. string translateResult = transDic.Where(s => s.Key == names).FirstOrDefault().Value;
  1625. if (!string.IsNullOrEmpty(translateResult))
  1626. {
  1627. str = translateResult;
  1628. str = _airTicketResRep.Processing(str);
  1629. }
  1630. table.Range.Bookmarks["ClientName"].Text = str;
  1631. }
  1632. else
  1633. {
  1634. table.Range.Bookmarks["ClientName"].Text = "--";
  1635. }
  1636. table.Range.Bookmarks["TicketNumber"].Text = "--";
  1637. table.Range.Bookmarks["IdentificationCode"].Text = "--";
  1638. table.Range.Bookmarks["JointTicket"].Text = "--";
  1639. table.Range.Bookmarks["TimeIssue"].Text = "--";
  1640. table.Range.Bookmarks["DrawingAgent"].Text = "--";
  1641. table.Range.Bookmarks["NavigationCode"].Text = "--";
  1642. table.Range.Bookmarks["AgentsAddress"].Text = "--";
  1643. table.Range.Bookmarks["AgentPhone"].Text = "--";
  1644. table.Range.Bookmarks["AgentFacsimile"].Text = "--";
  1645. }
  1646. doc.MailMerge.Execute(new[] { "PageCount" }, new object[] { doc.PageCount });
  1647. //保存合并后的文档
  1648. string fileName = "AirItinerary/电子客票英文行程单_EN.docx";
  1649. string rst = AppSettingsHelper.Get("WordBaseUrl") + AppSettingsHelper.Get("WordFtpPath") + fileName;
  1650. doc.Save(AppSettingsHelper.Get("WordBasePath") + fileName);
  1651. return Ok(JsonView(true, "成功!", rst));
  1652. }
  1653. }
  1654. }
  1655. catch (Exception ex)
  1656. {
  1657. return Ok(JsonView(false, "程序错误!"));
  1658. throw;
  1659. }
  1660. }
  1661. #endregion
  1662. #region 团组增减款项
  1663. /// <summary>
  1664. /// 团组增减款项下拉框绑定
  1665. /// </summary>
  1666. /// <param name="dto"></param>
  1667. /// <returns></returns>
  1668. [HttpPost]
  1669. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  1670. public async Task<IActionResult> DecreasePaymentsSelect(DecreasePaymentsDto dto)
  1671. {
  1672. try
  1673. {
  1674. Result groupData = await _decreasePaymentsRep.DecreasePaymentsSelect(dto);
  1675. if (groupData.Code != 0)
  1676. {
  1677. return Ok(JsonView(false, groupData.Msg));
  1678. }
  1679. return Ok(JsonView(true, groupData.Msg, groupData.Data));
  1680. }
  1681. catch (Exception ex)
  1682. {
  1683. return Ok(JsonView(false, "程序错误!"));
  1684. throw;
  1685. }
  1686. }
  1687. /// <summary>
  1688. /// 根据团组Id查询团组增减款项
  1689. /// </summary>
  1690. /// <param name="dto"></param>
  1691. /// <returns></returns>
  1692. [HttpPost]
  1693. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  1694. public async Task<IActionResult> DecreasePaymentsList(DecreasePaymentsListDto dto)
  1695. {
  1696. try
  1697. {
  1698. Result groupData = await _decreasePaymentsRep.DecreasePaymentsList(dto);
  1699. if (groupData.Code != 0)
  1700. {
  1701. return Ok(JsonView(false, groupData.Msg));
  1702. }
  1703. return Ok(JsonView(true, groupData.Msg, groupData.Data));
  1704. }
  1705. catch (Exception ex)
  1706. {
  1707. return Ok(JsonView(false, "程序错误!"));
  1708. throw;
  1709. }
  1710. }
  1711. /// <summary>
  1712. /// 团组增减款项操作(Status:1.新增,2.修改)
  1713. /// </summary>
  1714. /// <param name="dto"></param>
  1715. /// <returns></returns>
  1716. [HttpPost]
  1717. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  1718. public async Task<IActionResult> OpDecreasePayments(DecreasePaymentsOpDto dto)
  1719. {
  1720. try
  1721. {
  1722. Result groupData = await _decreasePaymentsRep.OpDecreasePayments(dto);
  1723. if (groupData.Code != 0)
  1724. {
  1725. return Ok(JsonView(false, groupData.Msg));
  1726. }
  1727. return Ok(JsonView(true, groupData.Msg, groupData.Data));
  1728. }
  1729. catch (Exception ex)
  1730. {
  1731. return Ok(JsonView(false, "程序错误!"));
  1732. throw;
  1733. }
  1734. }
  1735. /// <summary>
  1736. /// 团组增减款项操作 删除
  1737. /// </summary>
  1738. /// <param name="dto"></param>
  1739. /// <returns></returns>
  1740. [HttpPost]
  1741. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  1742. public async Task<IActionResult> DelDecreasePayments(DelBaseDto dto)
  1743. {
  1744. try
  1745. {
  1746. var res = await _decreasePaymentsRep.SoftDeleteByIdAsync<Grp_DecreasePayments>(dto.Id.ToString(), dto.DeleteUserId);
  1747. if (!res)
  1748. {
  1749. var result = await _sqlSugar.Updateable<Grp_CreditCardPayment>().Where(a => a.CId == dto.Id && a.CTable == 98).SetColumns(a => new Grp_CreditCardPayment()
  1750. {
  1751. IsDel = 1,
  1752. DeleteUserId = dto.DeleteUserId,
  1753. DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
  1754. }).ExecuteCommandAsync();
  1755. return Ok(JsonView(false, "删除失败"));
  1756. }
  1757. return Ok(JsonView(true, "删除成功!"));
  1758. }
  1759. catch (Exception ex)
  1760. {
  1761. return Ok(JsonView(false, "程序错误!"));
  1762. throw;
  1763. }
  1764. }
  1765. /// <summary>
  1766. /// 根据团组增减款项Id查询
  1767. /// </summary>
  1768. /// <param name="dto"></param>
  1769. /// <returns></returns>
  1770. [HttpPost]
  1771. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  1772. public async Task<IActionResult> QueryDecreasePaymentsById(DecreasePaymentsByIdDto dto)
  1773. {
  1774. try
  1775. {
  1776. Result groupData = await _decreasePaymentsRep.QueryDecreasePaymentsById(dto);
  1777. if (groupData.Code != 0)
  1778. {
  1779. return Ok(JsonView(false, groupData.Msg));
  1780. }
  1781. return Ok(JsonView(true, groupData.Msg, groupData.Data));
  1782. }
  1783. catch (Exception ex)
  1784. {
  1785. return Ok(JsonView(false, "程序错误!"));
  1786. throw;
  1787. }
  1788. }
  1789. #endregion
  1790. #region 文件上传、删除
  1791. /// <summary>
  1792. /// region 文件上传 可以带参数
  1793. /// </summary>
  1794. /// <param name="file"></param>
  1795. /// <returns></returns>
  1796. [HttpPost]
  1797. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  1798. public async Task<IActionResult> UploadProject(IFormFile file)
  1799. {
  1800. try
  1801. {
  1802. var TypeName = Request.Headers["TypeName"].ToString();
  1803. if (file != null)
  1804. {
  1805. var fileDir = AppSettingsHelper.Get("GrpFileBasePath");
  1806. //文件名称
  1807. string projectFileName = file.FileName;
  1808. //上传的文件的路径
  1809. string filePath = "";
  1810. if (TypeName == "A")//A代表团组增减款项
  1811. {
  1812. if (!Directory.Exists(fileDir))
  1813. {
  1814. Directory.CreateDirectory(fileDir);
  1815. }
  1816. //上传的文件的路径
  1817. filePath = fileDir + $@"\团组增减款项相关文件\{projectFileName}";
  1818. }
  1819. else if (TypeName == "B")//B代表商邀相关文件
  1820. {
  1821. if (!Directory.Exists(fileDir))
  1822. {
  1823. Directory.CreateDirectory(fileDir);
  1824. }
  1825. //上传的文件的路径
  1826. filePath = fileDir + $@"\商邀相关文件\{projectFileName}";
  1827. }
  1828. using (FileStream fs = System.IO.File.Create(filePath))
  1829. {
  1830. file.CopyTo(fs);
  1831. fs.Flush();
  1832. }
  1833. return Ok(JsonView(true, "上传成功!", projectFileName));
  1834. }
  1835. else
  1836. {
  1837. return Ok(JsonView(false, "上传失败!"));
  1838. }
  1839. }
  1840. catch (Exception ex)
  1841. {
  1842. return Ok(JsonView(false, "程序错误!"));
  1843. throw;
  1844. }
  1845. }
  1846. /// <summary>
  1847. /// 删除指定文件
  1848. /// </summary>
  1849. /// <param name="dto"></param>
  1850. /// <returns></returns>
  1851. [HttpPost]
  1852. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  1853. public async Task<IActionResult> DelFile(DelFileDto dto)
  1854. {
  1855. try
  1856. {
  1857. var TypeName = Request.Headers["TypeName"].ToString();
  1858. string filePath = "";
  1859. var fileDir = AppSettingsHelper.Get("GrpFileBasePath");
  1860. // 返回与指定虚拟路径相对应的物理路径即绝对路径
  1861. int id = 0;
  1862. if (TypeName == "A")
  1863. {
  1864. filePath = fileDir + "/团组增减款项相关文件/" + dto.fileName;
  1865. // 删除该文件
  1866. System.IO.File.Delete(filePath);
  1867. id = await _sqlSugar.Updateable<Grp_DecreasePayments>().Where(a => a.Id == dto.Id).SetColumns(a => new Grp_DecreasePayments { FilePath = "" }).ExecuteCommandAsync();
  1868. }
  1869. else if (TypeName == "B")
  1870. {
  1871. filePath = fileDir + "/商邀相关文件/" + dto.fileName;
  1872. // 删除该文件
  1873. System.IO.File.Delete(filePath);
  1874. id = await _sqlSugar.Updateable<Grp_InvitationOfficialActivities>().Where(a => a.Id == dto.Id).SetColumns(a => new Grp_InvitationOfficialActivities { Attachment = "" }).ExecuteCommandAsync();
  1875. }
  1876. if (id != 0)
  1877. {
  1878. return Ok(JsonView(true, "成功!"));
  1879. }
  1880. else
  1881. {
  1882. return Ok(JsonView(false, "失败!"));
  1883. }
  1884. }
  1885. catch (Exception ex)
  1886. {
  1887. return Ok(JsonView(false, "程序错误!"));
  1888. throw;
  1889. }
  1890. }
  1891. #endregion
  1892. #region 商邀费用录入
  1893. /// <summary>
  1894. /// 根据团组Id查询商邀费用列表
  1895. /// </summary>
  1896. /// <param name="dto"></param>
  1897. /// <returns></returns>
  1898. [HttpPost]
  1899. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  1900. public async Task<IActionResult> InvitationOfficialActivitiesList(InvitationOfficialActivitiesListDto dto)
  1901. {
  1902. try
  1903. {
  1904. Result groupData = await _InvitationOfficialActivitiesRep.InvitationOfficialActivitiesList(dto);
  1905. if (groupData.Code != 0)
  1906. {
  1907. return Ok(JsonView(false, groupData.Msg));
  1908. }
  1909. return Ok(JsonView(true, groupData.Msg, groupData.Data));
  1910. }
  1911. catch (Exception ex)
  1912. {
  1913. return Ok(JsonView(false, "程序错误!"));
  1914. throw;
  1915. }
  1916. }
  1917. /// <summary>
  1918. /// 根据商邀费用ID查询C表和商邀费用数据
  1919. /// </summary>
  1920. /// <param name="dto"></param>
  1921. /// <returns></returns>
  1922. [HttpPost]
  1923. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  1924. public async Task<IActionResult> InvitationOfficialActivitiesById(InvitationOfficialActivitiesByIdDto dto)
  1925. {
  1926. try
  1927. {
  1928. Result groupData = await _InvitationOfficialActivitiesRep.InvitationOfficialActivitiesById(dto);
  1929. if (groupData.Code != 0)
  1930. {
  1931. return Ok(JsonView(false, groupData.Msg));
  1932. }
  1933. return Ok(JsonView(true, groupData.Msg, groupData.Data));
  1934. }
  1935. catch (Exception ex)
  1936. {
  1937. return Ok(JsonView(false, "程序错误!"));
  1938. throw;
  1939. }
  1940. }
  1941. /// <summary>
  1942. /// 商邀费用录入操作(Status:1.新增,2.修改)
  1943. /// </summary>
  1944. /// <param name="dto"></param>
  1945. /// <returns></returns>
  1946. [HttpPost]
  1947. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  1948. public async Task<IActionResult> OpInvitationOfficialActivities(OpInvitationOfficialActivitiesDto dto)
  1949. {
  1950. try
  1951. {
  1952. Result groupData = await _InvitationOfficialActivitiesRep.OpInvitationOfficialActivities(dto);
  1953. if (groupData.Code != 0)
  1954. {
  1955. return Ok(JsonView(false, groupData.Msg));
  1956. }
  1957. return Ok(JsonView(true, groupData.Msg, groupData.Data));
  1958. }
  1959. catch (Exception ex)
  1960. {
  1961. return Ok(JsonView(false, "程序错误!"));
  1962. throw;
  1963. }
  1964. }
  1965. /// <summary>
  1966. /// 商邀删除
  1967. /// </summary>
  1968. /// <param name="dto"></param>
  1969. /// <returns></returns>
  1970. [HttpPost]
  1971. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  1972. public async Task<IActionResult> DelInvitationOfficialActivities(DelBaseDto dto)
  1973. {
  1974. try
  1975. {
  1976. var res = await _InvitationOfficialActivitiesRep.SoftDeleteByIdAsync<Grp_InvitationOfficialActivities>(dto.Id.ToString(), dto.DeleteUserId);
  1977. if (!res)
  1978. {
  1979. var result = await _sqlSugar.Updateable<Grp_CreditCardPayment>().Where(a => a.CId == dto.Id && a.CTable == 81).SetColumns(a => new Grp_CreditCardPayment()
  1980. {
  1981. IsDel = 1,
  1982. DeleteUserId = dto.DeleteUserId,
  1983. DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
  1984. }).ExecuteCommandAsync();
  1985. return Ok(JsonView(false, "删除失败"));
  1986. }
  1987. return Ok(JsonView(true, "删除成功!"));
  1988. }
  1989. catch (Exception ex)
  1990. {
  1991. return Ok(JsonView(false, "程序错误!"));
  1992. throw;
  1993. }
  1994. }
  1995. #endregion
  1996. #region 团组英文资料
  1997. /// <summary>
  1998. /// 查询团组英文所有资料
  1999. /// </summary>
  2000. /// <param name="dto"></param>
  2001. /// <returns></returns>
  2002. [HttpPost]
  2003. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  2004. public async Task<IActionResult> QueryDelegationEnData(QueryDelegationEnDataDto dto)
  2005. {
  2006. try
  2007. {
  2008. Result groupData = await _delegationEnDataRep.QueryDelegationEnData(dto);
  2009. if (groupData.Code != 0)
  2010. {
  2011. return Ok(JsonView(false, groupData.Msg));
  2012. }
  2013. return Ok(JsonView(true, groupData.Msg, groupData.Data));
  2014. }
  2015. catch (Exception ex)
  2016. {
  2017. return Ok(JsonView(false, "程序错误!"));
  2018. throw;
  2019. }
  2020. }
  2021. /// <summary>
  2022. /// 团组英文资料操作(Status:1.新增,2.修改)
  2023. /// </summary>
  2024. /// <param name="dto"></param>
  2025. /// <returns></returns>
  2026. [HttpPost]
  2027. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  2028. public async Task<IActionResult> OpDelegationEnData(OpDelegationEnDataDto dto)
  2029. {
  2030. try
  2031. {
  2032. Result groupData = await _delegationEnDataRep.OpDelegationEnData(dto);
  2033. if (groupData.Code != 0)
  2034. {
  2035. return Ok(JsonView(false, groupData.Msg));
  2036. }
  2037. return Ok(JsonView(true, groupData.Msg, groupData.Data));
  2038. }
  2039. catch (Exception ex)
  2040. {
  2041. return Ok(JsonView(false, "程序错误!"));
  2042. throw;
  2043. }
  2044. }
  2045. /// <summary>
  2046. /// 团组英文资料Id查询数据
  2047. /// </summary>
  2048. /// <param name="dto"></param>
  2049. /// <returns></returns>
  2050. [HttpPost]
  2051. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  2052. public async Task<IActionResult> QueryDelegationEnDataById(QueryDelegationEnDataByIdDto dto)
  2053. {
  2054. try
  2055. {
  2056. Grp_DelegationEnData _DelegationEnData = await _sqlSugar.Queryable<Grp_DelegationEnData>().FirstAsync(it => it.Id == dto.Id && it.IsDel == 0);
  2057. if (_DelegationEnData != null)
  2058. {
  2059. return Ok(JsonView(true, "查询成功!", _DelegationEnData));
  2060. }
  2061. return Ok(JsonView(true, "暂无数据!", _DelegationEnData));
  2062. }
  2063. catch (Exception ex)
  2064. {
  2065. return Ok(JsonView(false, "程序错误!"));
  2066. throw;
  2067. }
  2068. }
  2069. /// <summary>
  2070. /// 团组英文资料删除
  2071. /// </summary>
  2072. /// <param name="dto"></param>
  2073. /// <returns></returns>
  2074. [HttpPost]
  2075. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  2076. public async Task<IActionResult> DelDelegationEnData(DelBaseDto dto)
  2077. {
  2078. try
  2079. {
  2080. var res = await _delegationEnDataRep.SoftDeleteByIdAsync<Grp_DelegationEnData>(dto.Id.ToString(), dto.DeleteUserId);
  2081. if (!res)
  2082. {
  2083. return Ok(JsonView(false, "删除失败"));
  2084. }
  2085. return Ok(JsonView(true, "删除成功!"));
  2086. }
  2087. catch (Exception ex)
  2088. {
  2089. return Ok(JsonView(false, "程序错误!"));
  2090. throw;
  2091. }
  2092. }
  2093. #endregion
  2094. #region 导出邀请函
  2095. /// <summary>
  2096. /// 导出邀请函页面初始化
  2097. /// </summary>
  2098. /// <param name="dto"></param>
  2099. /// <returns></returns>
  2100. [HttpPost]
  2101. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  2102. public async Task<IActionResult> QueryinvitationLetter(DecreasePaymentsListDto dto)
  2103. {
  2104. try
  2105. {
  2106. List<Grp_DelegationInfo> grp_Delegations = await _sqlSugar.Queryable<Grp_DelegationInfo>().Where(a => a.IsDel == 0).OrderBy(a => a.Id, OrderByType.Desc).ToListAsync();
  2107. List<Crm_DeleClient> crm_Deles = new List<Crm_DeleClient>();
  2108. if (dto.DiId == 0)
  2109. {
  2110. crm_Deles = await _sqlSugar.Queryable<Crm_DeleClient>().Where(a => a.DiId == grp_Delegations[0].Id && a.IsDel == 0).ToListAsync();
  2111. }
  2112. else
  2113. {
  2114. crm_Deles = await _sqlSugar.Queryable<Crm_DeleClient>().Where(a => a.DiId == dto.DiId && a.IsDel == 0).ToListAsync();
  2115. }
  2116. return Ok(JsonView(true, "查询成功!", new
  2117. {
  2118. deleClient = crm_Deles,
  2119. delegations = grp_Delegations
  2120. }));
  2121. }
  2122. catch (Exception ex)
  2123. {
  2124. return Ok(JsonView(false, "程序错误!"));
  2125. throw;
  2126. }
  2127. }
  2128. /// <summary>
  2129. /// 导出邀请函
  2130. /// </summary>
  2131. /// <param name="dto"></param>
  2132. /// <returns></returns>
  2133. [HttpPost]
  2134. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  2135. public async Task<IActionResult> invitationLetter(DecreasePaymentsListDto dto)
  2136. {
  2137. try
  2138. {
  2139. Dictionary<string, string> transDic = new Dictionary<string, string>();
  2140. List<Crm_DeleClient> crm_DeleClients = await _sqlSugar.Queryable<Crm_DeleClient>().Where(a => a.DiId == dto.DiId && a.IsDel == 0).ToListAsync();
  2141. List<string> texts = new List<string>();
  2142. if (crm_DeleClients.Count != 0)
  2143. {
  2144. foreach (Crm_DeleClient item in crm_DeleClients)
  2145. {
  2146. if (!string.IsNullOrWhiteSpace(item.Pinyin))
  2147. {
  2148. transDic.Add(item.LastName + item.FirstName, item.Pinyin);
  2149. }
  2150. else
  2151. {
  2152. string name = item.LastName + item.FirstName;
  2153. texts.Add(name);
  2154. }
  2155. if (!string.IsNullOrEmpty(item.Job) && !texts.Contains(item.Job))
  2156. {
  2157. if (!transDic.ContainsKey(item.Job))
  2158. {
  2159. texts.Add(item.Job);
  2160. }
  2161. }
  2162. if (item.CrmCompanyId != 0)
  2163. {
  2164. Crm_CustomerCompany crm_Customer = await _sqlSugar.Queryable<Crm_CustomerCompany>().FirstAsync(a => a.Id == item.CrmCompanyId && a.IsDel == 0);
  2165. if (!transDic.ContainsKey(crm_Customer.CompanyName))
  2166. {
  2167. texts.Add(crm_Customer.CompanyName);
  2168. }
  2169. }
  2170. }
  2171. List<TranslateResult> transData = _airTicketResRep.ReTransBatch(texts, "en");
  2172. if (transData.Count > 0)
  2173. {
  2174. foreach (TranslateResult item in transData)
  2175. {
  2176. if (!transDic.ContainsKey(item.Query))
  2177. {
  2178. transDic.Add(item.Query, item.Translation);
  2179. }
  2180. }
  2181. }
  2182. List<guestList> list = new List<guestList>();
  2183. foreach (Crm_DeleClient dele in crm_DeleClients)
  2184. {
  2185. guestList guestList = new guestList();
  2186. if (!string.IsNullOrWhiteSpace(dele.Pinyin))
  2187. {
  2188. guestList.Name = dele.Pinyin;
  2189. }
  2190. else
  2191. {
  2192. string Name = transDic.Where(s => s.Key == dele.LastName + dele.FirstName).FirstOrDefault().Value;
  2193. guestList.Name = Name;
  2194. }
  2195. if (dele.Sex == 0)
  2196. {
  2197. guestList.Sex = "Male";
  2198. }
  2199. else if (dele.Sex == 1)
  2200. {
  2201. guestList.Sex = "Female";
  2202. }
  2203. guestList.DOB = dele.BirthDay.Replace('-', '.');
  2204. Crm_CustomerCompany crm_Customer = await _sqlSugar.Queryable<Crm_CustomerCompany>().FirstAsync(a => a.Id == dele.CrmCompanyId && a.IsDel == 0);
  2205. string jobName = transDic.Where(s => s.Key == crm_Customer.CompanyName).FirstOrDefault().Value + " " + transDic.Where(s => s.Key == dele.Job).FirstOrDefault().Value;
  2206. guestList.Job = jobName;
  2207. list.Add(guestList);
  2208. }
  2209. //载入模板
  2210. Document doc = new Document(AppSettingsHelper.Get("WordBasePath") + "Template/邀请函模板0210.docx");
  2211. DocumentBuilder builder = new DocumentBuilder(doc);
  2212. //获取word里所有表格
  2213. NodeCollection allTables = doc.GetChildNodes(NodeType.Table, true);
  2214. //获取所填表格的序数
  2215. Aspose.Words.Tables.Table tableOne = allTables[0] as Aspose.Words.Tables.Table;
  2216. var rowStart = tableOne.Rows[0]; //获取第1行
  2217. //循环赋值
  2218. for (int i = 0; i < list.Count; i++)
  2219. {
  2220. builder.MoveToCell(0, i + 1, 0, 0);
  2221. builder.Write(list[i].Name.ToString());
  2222. builder.MoveToCell(0, i + 1, 1, 0);
  2223. builder.Write(list[i].Sex.ToString());
  2224. builder.MoveToCell(0, i + 1, 2, 0);
  2225. builder.Write(list[i].DOB.ToString());
  2226. builder.MoveToCell(0, i + 1, 3, 0);
  2227. builder.Write(list[i].Job.ToString());
  2228. }
  2229. //删除多余行
  2230. while (tableOne.Rows.Count > list.Count + 1)
  2231. {
  2232. tableOne.Rows.RemoveAt(list.Count + 1);
  2233. }
  2234. var fileDir = AppSettingsHelper.Get("GrpFileBasePath");
  2235. string fileName = "邀请函" + DateTime.Now.ToString("yyyy-MM-dd") + ".docx";
  2236. string filePath = fileDir + $@"商邀相关文件/{fileName}";
  2237. doc.Save(filePath);
  2238. string Url = AppSettingsHelper.Get("WordBaseUrl") + "Office/GrpFile/商邀相关文件" + fileName;
  2239. return Ok(JsonView(true, "成功!", Url));
  2240. }
  2241. else
  2242. {
  2243. return Ok(JsonView(false, "失败,该团组没有客户名单!"));
  2244. }
  2245. }
  2246. catch (Exception ex)
  2247. {
  2248. return Ok(JsonView(false, "程序错误!"));
  2249. throw;
  2250. }
  2251. }
  2252. #endregion
  2253. #region 团组经理模块 出入境费用
  2254. ///// <summary>
  2255. ///// 团组模块 - 出入境费用
  2256. ///// </summary>
  2257. ///// <returns></returns>
  2258. //[HttpPost]
  2259. //[ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  2260. //public async Task<IActionResult> SetEnterExitCostCurrencyChange()
  2261. //{
  2262. // try
  2263. // {
  2264. // var data = await _enterExitCostRep.SetEnterExitCostCurrencyChange();
  2265. // if (data.Code != 0)
  2266. // {
  2267. // return Ok(JsonView(false, data.Msg));
  2268. // }
  2269. // return Ok(JsonView(true, "查询成功!"));
  2270. // }
  2271. // catch (Exception ex)
  2272. // {
  2273. // return Ok(JsonView(false, ex.Message));
  2274. // throw;
  2275. // }
  2276. //}
  2277. /// <summary>
  2278. /// 团组模块 - 出入境费用 - 子项 地区更改为 nationalTravelFee 的id
  2279. /// </summary>
  2280. /// <returns></returns>
  2281. [HttpPost]
  2282. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  2283. public async Task<IActionResult> SetDayAndCostAreaChange()
  2284. {
  2285. try
  2286. {
  2287. var nationalTravelFee = await _sqlSugar.Queryable<Grp_NationalTravelFee>().ToListAsync();
  2288. var dayAndCost = await _sqlSugar.Queryable<Grp_DayAndCost>().Where(it => it.IsDel == 0).ToListAsync();
  2289. var unite = dayAndCost.Where(a => nationalTravelFee.Any(b => a.Place.Trim() == b.City)).ToList(); //交集
  2290. var merge = dayAndCost.Where(a => !nationalTravelFee.Any(b => a.Place.Trim() == b.City)).ToList(); //差集
  2291. foreach (var item in unite) //处理交集数据
  2292. {
  2293. dayAndCost.Where(it => it.Id == item.Id).FirstOrDefault().NationalTravelFeeId = nationalTravelFee.Where(it => it.City.Trim() == item.Place.Trim()).FirstOrDefault().Id;
  2294. }
  2295. foreach (var item in merge) //处理差集数据
  2296. {
  2297. int nationalTravelFeeId = 0;
  2298. var cityData = nationalTravelFee.Where(it => it.City.Trim() == item.Place.Trim()).FirstOrDefault();
  2299. if (cityData != null) nationalTravelFeeId = cityData.Id;
  2300. else
  2301. {
  2302. var countryData = nationalTravelFee.Where(it => it.Country.Trim() == item.Place.Trim()).FirstOrDefault();
  2303. if (countryData != null) nationalTravelFeeId = countryData.Id;
  2304. }
  2305. dayAndCost.Where(it => it.Id == item.Id).FirstOrDefault().NationalTravelFeeId = nationalTravelFeeId;
  2306. }
  2307. //只更新dayAndCost 的 nationalTravelFeeId;
  2308. var result = _sqlSugar.Updateable(dayAndCost).UpdateColumns(it => new { it.NationalTravelFeeId }).ExecuteCommand();
  2309. if (result > 0) return Ok(JsonView(true, "nationalTravelFeeId列更新成功!"));
  2310. else return Ok(JsonView(false, "nationalTravelFeeId列更新失败!"));
  2311. }
  2312. catch (Exception ex)
  2313. {
  2314. return Ok(JsonView(false, ex.Message));
  2315. throw;
  2316. }
  2317. }
  2318. /// <summary>
  2319. /// 团组模块 - 出入境费用 - 基础数据源(团组名称/币种类型)
  2320. /// </summary>
  2321. /// <returns></returns>
  2322. [HttpPost]
  2323. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  2324. public async Task<IActionResult> GetEnterExitCostDataSource(PortDtoBase dto)
  2325. {
  2326. try
  2327. {
  2328. var groupNameData = await _groupRepository.GetGroupNameList(new GroupNameDto { PortType = dto.PortType });
  2329. string currencySql = string.Format("Select * From Sys_SetData Where STid = 66 And IsDel = 0");
  2330. var currencyData = await _sqlSugar.SqlQueryable<SetDataInfoView>(currencySql).ToListAsync();
  2331. //string nationalTravelFeeSql = string.Format(@"Select ssd.Name as CurrencyCode, ssd.Remark as CurrencyName,su.CnName as LastUpdateUserName,gntf.* From Grp_NationalTravelFee gntf
  2332. // Left Join Sys_SetData ssd On ssd.STid = 66 And gntf.Currency = ssd.Id
  2333. // Left Join Sys_Users su On gntf.LastUpdateUserId = su.Id
  2334. // Where gntf.Isdel = 0");
  2335. //var nationalTravelFeeData = await _sqlSugar.SqlQueryable<NationalTravelFeeInfoView>(nationalTravelFeeSql).ToListAsync();
  2336. return Ok(JsonView(true, "查询成功!", new
  2337. {
  2338. GroupNameData = groupNameData.Data,
  2339. CurrencyData = currencyData,
  2340. //NationalTravelFeeData = nationalTravelFeeData
  2341. }));
  2342. }
  2343. catch (Exception ex)
  2344. {
  2345. return Ok(JsonView(false, ex.Message));
  2346. throw;
  2347. }
  2348. }
  2349. /// <summary>
  2350. /// 团组模块 - 出入境费用 - Info
  2351. /// </summary>
  2352. /// <returns></returns>
  2353. [HttpPost]
  2354. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  2355. public async Task<IActionResult> GetEnterExitCostInfobyDiId(EnterExitCostInfobyDiIdDto dto)
  2356. {
  2357. try
  2358. {
  2359. var data = await _enterExitCostRep.GetEnterExitCostInfoByDiId(dto);
  2360. if (data.Code != 0)
  2361. {
  2362. return Ok(JsonView(false, data.Msg));
  2363. }
  2364. return Ok(JsonView(true, "查询成功!", data.Data));
  2365. }
  2366. catch (Exception ex)
  2367. {
  2368. return Ok(JsonView(false, ex.Message));
  2369. }
  2370. }
  2371. /// <summary>
  2372. /// 团组模块 - 出入境费用 - Add And Update
  2373. /// </summary>
  2374. /// <returns></returns>
  2375. [HttpPost]
  2376. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  2377. public async Task<IActionResult> PostEnterExitCostOperate(EnterExitCostOperateDto dto)
  2378. {
  2379. try
  2380. {
  2381. var data = await _enterExitCostRep.PostEnterExitCostOperate(dto);
  2382. if (data.Code != 0)
  2383. {
  2384. return Ok(JsonView(false, data.Msg));
  2385. }
  2386. return Ok(JsonView(true, data.Msg, data.Data));
  2387. }
  2388. catch (Exception ex)
  2389. {
  2390. return Ok(JsonView(false, ex.Message));
  2391. }
  2392. }
  2393. /// <summary>
  2394. /// 团组模块 - 出入境费用 - 子项删除
  2395. /// </summary>
  2396. /// <returns></returns>
  2397. [HttpPost]
  2398. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  2399. public async Task<IActionResult> PostEnterExitCostSubItemDel(EnterExitCostSubItemDelDto dto)
  2400. {
  2401. try
  2402. {
  2403. var data = await _enterExitCostRep.PostEnterExitCostSubItemDel(dto);
  2404. if (data.Code != 0)
  2405. {
  2406. return Ok(JsonView(false, data.Msg));
  2407. }
  2408. return Ok(JsonView(true, "操作成功!", data.Data));
  2409. }
  2410. catch (Exception ex)
  2411. {
  2412. return Ok(JsonView(false, ex.Message));
  2413. }
  2414. }
  2415. /// <summary>
  2416. /// 团组模块 - 出入境国家费用标准 List
  2417. /// </summary>
  2418. /// <returns></returns>
  2419. [HttpPost]
  2420. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  2421. public async Task<IActionResult> GetNationalTravelFeeData(PortDtoBase dto)
  2422. {
  2423. try
  2424. {
  2425. Stopwatch sw = new Stopwatch();
  2426. sw.Start();
  2427. string nationalTravelFeeSql = string.Format(@"Select ssd.Name as CurrencyCode, ssd.Remark as CurrencyName,su.CnName as LastUpdateUserName,gntf.* From Grp_NationalTravelFee gntf
  2428. Left Join Sys_SetData ssd On ssd.STid = 66 And gntf.Currency = ssd.Id
  2429. Left Join Sys_Users su On gntf.LastUpdateUserId = su.Id
  2430. Where gntf.Isdel = 0");
  2431. var nationalTravelFeeData = await _sqlSugar.SqlQueryable<NationalTravelFeeInfoView>(nationalTravelFeeSql).ToListAsync();
  2432. //var nationalTravel = nationalTravelFeeData.GroupBy(it => it.Country).Select(it1 => it1.FirstOrDefault());
  2433. //List<dynamic> nationalTravelFeeData1 = new List<dynamic>();
  2434. //foreach (var item in nationalTravel)
  2435. //{
  2436. // var cityData = nationalTravelFeeData.Where(it => it.Country == item.Country).ToList();
  2437. // var otherData = cityData.Where(it => it.City.Contains("其他城市")).FirstOrDefault();
  2438. // if (otherData != null)
  2439. // {
  2440. // cityData.Remove(otherData);
  2441. // cityData.Add(otherData);
  2442. // }
  2443. // nationalTravelFeeData1.Add(new
  2444. // {
  2445. // Country = item.Country,
  2446. // CityData = cityData
  2447. // });
  2448. //}
  2449. sw.Stop();
  2450. return Ok(JsonView(true, "查询成功!耗时:" + sw.ElapsedMilliseconds + "ms", nationalTravelFeeData));
  2451. }
  2452. catch (Exception ex)
  2453. {
  2454. return Ok(JsonView(false, ex.Message));
  2455. throw;
  2456. }
  2457. }
  2458. /// <summary>
  2459. /// 团组模块 - 出入境国家费用标准 Page List Data Source
  2460. /// </summary>
  2461. /// <returns></returns>
  2462. [HttpPost]
  2463. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  2464. public async Task<IActionResult> GetNationalTravelFeePageDataSource()
  2465. {
  2466. string sql = string.Format(@"Select * From Grp_NationalTravelFee Where Isdel = 0 ");
  2467. var nationalTravelFeeData = await _groupRepository._sqlSugar.SqlQueryable<Grp_NationalTravelFee>(sql).ToListAsync();
  2468. List<string> countryData = new List<string>();
  2469. countryData.AddRange( nationalTravelFeeData.Select(it => it.Country ).ToList());
  2470. countryData = countryData.Distinct().ToList();
  2471. List<dynamic> dataSource = new List<dynamic>();
  2472. foreach (var item in countryData)
  2473. {
  2474. List<string> cityData1 = new List<string>();
  2475. cityData1 = nationalTravelFeeData.Where(it => it.Country == item).Select(it => it.City).ToList();
  2476. var countryData2 = new
  2477. {
  2478. CountryName = item,
  2479. CityData = cityData1
  2480. };
  2481. dataSource.Add(countryData2);
  2482. }
  2483. return Ok(JsonView(true, "查询成功!", dataSource));
  2484. }
  2485. /// <summary>
  2486. /// 团组模块 - 出入境国家费用标准 Page List
  2487. /// </summary>
  2488. /// <returns></returns>
  2489. [HttpPost]
  2490. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  2491. public async Task<IActionResult> PostNationalTravelFeePage(NationalTravelFeePageDto dto)
  2492. {
  2493. int portId = dto.PortType;
  2494. if (portId != 1 && portId != 2 && portId != 3) return Ok(JsonView(false, "请输入正确的端口号!\r\n请求端口分类1 Web 2 Android 3 IOS"));
  2495. if (dto.PageIndex == 0) return Ok(JsonView(false, "当前页码数不能为0!"));
  2496. if (dto.PageSize == 0) return Ok(JsonView(false, "每页条数不能0!"));
  2497. string whereSql = string.Empty;
  2498. if (!string.IsNullOrEmpty(dto.Country))
  2499. {
  2500. whereSql += string.Format(@" And gntf.Country ='{0}'", dto.Country);
  2501. }
  2502. if (!string.IsNullOrEmpty(dto.City))
  2503. {
  2504. whereSql += string.Format(@" And gntf.City='{0}'", dto.City);
  2505. }
  2506. string pageSql = string.Format(@"Select * From (
  2507. Select row_number() over(order by gntf.LastUpdateTime Desc) as RowNumber,
  2508. ssd.Name as CurrencyCode, ssd.Remark as CurrencyName,su.CnName as LastUpdateUserName,gntf.*
  2509. From Grp_NationalTravelFee gntf
  2510. Left Join Sys_SetData ssd On ssd.STid = 66 And gntf.Currency = ssd.Id
  2511. Left Join Sys_Users su On gntf.LastUpdateUserId = su.Id
  2512. Where gntf.Isdel = 0 {0} ) temp ", whereSql);
  2513. RefAsync<int> total = 0;
  2514. var nationalTravelFeeData = await _groupRepository._sqlSugar.SqlQueryable<NationalTravelFeePageInfoView>(pageSql).ToPageListAsync(dto.PageIndex, dto.PageSize, total);
  2515. return Ok(JsonView(true, "查询成功!", nationalTravelFeeData, (int)total));
  2516. }
  2517. /// <summary>
  2518. /// 团组模块 - 出入境国家费用标准 - Add Or Update
  2519. /// </summary>
  2520. /// <returns></returns>
  2521. [HttpPost]
  2522. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  2523. public async Task<IActionResult> PostNationalTravelFeeOperate(NationalTravelFeeOperateDto dto)
  2524. {
  2525. try
  2526. {
  2527. var data = await _enterExitCostRep.PostNationalTravelFeeOperate(dto);
  2528. if (data.Code != 0)
  2529. {
  2530. return Ok(JsonView(false, data.Msg));
  2531. }
  2532. return Ok(JsonView(true, "操作成功!", data.Data));
  2533. }
  2534. catch (Exception ex)
  2535. {
  2536. return Ok(JsonView(false, ex.Message));
  2537. }
  2538. }
  2539. /// <summary>
  2540. /// 团组模块 - 出入境国家费用标准 - Del
  2541. /// </summary>
  2542. /// <returns></returns>
  2543. [HttpPost]
  2544. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  2545. public async Task<IActionResult> PostNationalTravelFeeDel(NationalTravelFeeDelDto dto)
  2546. {
  2547. try
  2548. {
  2549. Grp_NationalTravelFee _nationalTravelFee = new Grp_NationalTravelFee() {
  2550. Id = dto.Id,
  2551. DeleteUserId = dto.DeleteUserId,
  2552. DeleteTime = DateTime.Now.ToString("yyyy-MM-dd"),
  2553. IsDel = 1
  2554. };
  2555. var delStatus = await _enterExitCostRep._sqlSugar.Updateable<Grp_NationalTravelFee>(_nationalTravelFee)
  2556. .UpdateColumns(it => new { it.DeleteTime, it.DeleteUserId, it.IsDel })
  2557. .WhereColumns(it => new { it.Id })
  2558. .ExecuteCommandAsync();
  2559. if (delStatus <= 0)
  2560. {
  2561. return Ok(JsonView(false, "删除失败!"));
  2562. }
  2563. return Ok(JsonView(true, "操作成功!"));
  2564. }
  2565. catch (Exception ex)
  2566. {
  2567. return Ok(JsonView(false, ex.Message));
  2568. }
  2569. }
  2570. #endregion
  2571. }
  2572. }