GroupsController.cs 120 KB

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