GroupsController.cs 139 KB

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