GroupsController.cs 146 KB

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