ResourceController.cs 72 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931
  1. using NPOI.HPSF;
  2. using OASystem.API.OAMethodLib;
  3. using OASystem.Domain.Dtos.Resource;
  4. using OASystem.Domain.Entities.Groups;
  5. using OASystem.Infrastructure.Repositories.Groups;
  6. using Org.BouncyCastle.Utilities;
  7. using Quartz.Util;
  8. using System.Collections.Generic;
  9. using System.Net.Http.Headers;
  10. namespace OASystem.API.Controllers
  11. {
  12. /// <summary>
  13. /// 资料相关
  14. /// </summary>
  15. //[Authorize]
  16. [Route("api/[controller]/[action]")]
  17. public class ResourceController : ControllerBase
  18. {
  19. private readonly IMapper _mapper;
  20. private readonly SqlSugarClient _sqlSugar;
  21. private readonly IConfiguration _config;
  22. private readonly CarDataRepository _carDataRep;
  23. private readonly LocalGuideDataRepository _localGuideDataRep;
  24. private readonly ThreeCodeRepository _ThreeCodeRep;
  25. private readonly HotelDataRepository _hotelDataRep;
  26. private readonly ResItemInfoRepository _resItemInfoRep;
  27. private readonly SetDataRepository _setDataRepository;
  28. private readonly CountryFeeRepository _countryFeeRep;
  29. private readonly SetDataTypeRepository _setDataTypeRep;
  30. private readonly AirTicketAgentRepository _airTicketAgentRep;
  31. private readonly InvitationOfficialActivityDataRepository _InvitationOfficialActivityDataRep;
  32. private readonly OfficialActivitiesRepository _officialActivitiesRep;
  33. private readonly AskDataRepository _askDataRep;
  34. private readonly TicketBlackCodeRepository _ticketBlackCodeRep;
  35. public ResourceController(IMapper mapper, IConfiguration config, SqlSugarClient sqlSugar, CarDataRepository carDataRep,LocalGuideDataRepository localGuideDataRep,
  36. ThreeCodeRepository threeCodeRep,HotelDataRepository hotelDataRep, ResItemInfoRepository resItemInfoRep, SetDataRepository setDataRepository,
  37. CountryFeeRepository countryFeeRep, SetDataTypeRepository setDataTypeRep, AirTicketAgentRepository airTicketAgentRep,
  38. InvitationOfficialActivityDataRepository invitationOfficialActivityDataRep, OfficialActivitiesRepository officialActivitiesRep, AskDataRepository askDataRep,
  39. TicketBlackCodeRepository ticketBlackCodeRep)
  40. {
  41. _mapper = mapper;
  42. _config = config;
  43. _sqlSugar = sqlSugar;
  44. _carDataRep = carDataRep;
  45. _localGuideDataRep = localGuideDataRep;
  46. _ThreeCodeRep = threeCodeRep;
  47. _hotelDataRep = hotelDataRep;
  48. _resItemInfoRep = resItemInfoRep;
  49. _setDataRepository = setDataRepository;
  50. _countryFeeRep = countryFeeRep;
  51. _setDataTypeRep = setDataTypeRep;
  52. _airTicketAgentRep = airTicketAgentRep;
  53. _InvitationOfficialActivityDataRep = invitationOfficialActivityDataRep;
  54. _officialActivitiesRep = officialActivitiesRep;
  55. _askDataRep = askDataRep;
  56. _ticketBlackCodeRep=ticketBlackCodeRep;
  57. }
  58. #region 车公司资料板块
  59. /// <summary>
  60. /// 车公司信息查询
  61. /// </summary>
  62. /// <returns></returns>
  63. [HttpPost]
  64. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  65. public async Task<IActionResult> QueryCarData(QueryCarDataDto dto)
  66. {
  67. try
  68. {
  69. Result LocalGuide = await _carDataRep.QueryCarData(dto);
  70. if (LocalGuide.Code == 0)
  71. {
  72. return Ok(JsonView(true, "查询成功", LocalGuide.Data));
  73. }
  74. else
  75. {
  76. return Ok(JsonView(false, LocalGuide.Msg));
  77. }
  78. }
  79. catch (Exception)
  80. {
  81. return Ok(JsonView(false, "程序错误!"));
  82. throw;
  83. }
  84. }
  85. /// <summary>
  86. /// 车公司资料下拉框数据
  87. /// </summary>
  88. /// <returns></returns>
  89. [HttpPost]
  90. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  91. public async Task<IActionResult> QueryCarSelect()
  92. {
  93. try
  94. {
  95. var CarData = _carDataRep.QueryDto<Res_CarData, CarDataSelectView>().ToList();
  96. if (CarData.Count == 0)
  97. {
  98. return Ok(JsonView(false, "暂无数据!"));
  99. }
  100. CarData.Add(new CarDataSelectView { Id = 0, UnitArea = "全部" });
  101. CarData = CarData.Where((x, i) => CarData.FindIndex(z => z.UnitArea == x.UnitArea) == i).ToList();
  102. CarData = CarData.OrderBy(x => x.Id).ToList();
  103. List<CarDataSelectView> data = new List<CarDataSelectView>();
  104. foreach (CarDataSelectView car in CarData)
  105. {
  106. if (!string.IsNullOrWhiteSpace(car.UnitArea))
  107. {
  108. data.Add(car);
  109. }
  110. }
  111. return Ok(JsonView(true, "查询成功", data));
  112. }
  113. catch (Exception)
  114. {
  115. return Ok(JsonView(false, "程序错误!"));
  116. throw;
  117. }
  118. }
  119. /// <summary>
  120. /// 车公司信息添加
  121. /// </summary>
  122. /// <returns></returns>
  123. [HttpPost]
  124. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  125. public async Task<IActionResult> AddCarData(AddCarDataDto dto)
  126. {
  127. try
  128. {
  129. if (dto.UnitArea == "")
  130. {
  131. return Ok(JsonView(false, "请检查单位区域是否填写!"));
  132. }
  133. if (dto.UnitName == "")
  134. {
  135. return Ok(JsonView(false, "请检查单位名称是否填写!"));
  136. }
  137. if (dto.Contact == "")
  138. {
  139. return Ok(JsonView(false, "请检查单位联系人是否填写!"));
  140. }
  141. if (dto.ContactTel == "")
  142. {
  143. return Ok(JsonView(false, "请检查联系方式是否填写正确!"));
  144. }
  145. var carDada = _carDataRep.QueryDto<Res_CarData, CarDataView>(a => a.UnitArea == dto.UnitArea && a.UnitName == dto.UnitName && a.Contact == dto.Contact && a.ContactTel == dto.ContactTel).ToList();
  146. if (carDada.Count != 0)
  147. {
  148. return Ok(JsonView(false, "该信息已存在,请勿重复添加!"));
  149. }
  150. Res_CarData _CarData = _mapper.Map<Res_CarData>(dto);
  151. int id = await _carDataRep.AddAsyncReturnId(_CarData);
  152. if (id == 0)
  153. {
  154. return Ok(JsonView(false, "添加失败!"));
  155. }
  156. return Ok(JsonView(true, "添加成功", new { Id = id }));
  157. }
  158. catch (Exception ex)
  159. {
  160. return Ok(JsonView(false, "程序错误!"));
  161. throw;
  162. }
  163. }
  164. /// <summary>
  165. /// 车公司信息修改
  166. /// </summary>
  167. /// <returns></returns>
  168. [HttpPost]
  169. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  170. public async Task<IActionResult> UpCarData(UpCarDataDto dto)
  171. {
  172. try
  173. {
  174. if (dto.UnitArea == "")
  175. {
  176. return Ok(JsonView(false, "请检查单位区域是否填写!"));
  177. }
  178. if (dto.UnitName == "")
  179. {
  180. return Ok(JsonView(false, "请检查单位名称是否填写!"));
  181. }
  182. if (dto.Contact == "")
  183. {
  184. return Ok(JsonView(false, "请检查单位联系人是否填写!"));
  185. }
  186. if (dto.ContactTel == "")
  187. {
  188. return Ok(JsonView(false, "请检查联系方式是否填写正确!"));
  189. }
  190. bool res = await _carDataRep.UpdateAsync(a => a.Id == dto.Id, a => new Res_CarData
  191. {
  192. UnitArea = dto.UnitArea,
  193. UnitName = dto.UnitName,
  194. Address = dto.Address,
  195. Contact = dto.Contact,
  196. ContactTel = dto.ContactTel,
  197. ContactEmail = dto.ContactEmail,
  198. ContactFax = dto.ContactFax,
  199. CarDes = dto.CarDes,
  200. CarPicPaths = dto.CarPicPaths,
  201. OtherInfo = dto.OtherInfo,
  202. Score = dto.Score,
  203. QualificationScore = dto.QualificationScore,
  204. CarAgeScore = dto.CarAgeScore,
  205. CleanImgScore = dto.CleanImgScore,
  206. SmellScore = dto.SmellScore,
  207. WaterPaperScore = dto.WaterPaperScore,
  208. HardwareScore = dto.HardwareScore,
  209. TimeScore = dto.TimeScore,
  210. SafetyScore = dto.SafetyScore,
  211. DrivingAgeScore = dto.DrivingAgeScore,
  212. Remark = dto.Remark,
  213. });
  214. if (!res) { return Ok(JsonView(false, "修改失败!")); }
  215. return Ok(JsonView(true, "修改成功"));
  216. }
  217. catch (Exception ex)
  218. {
  219. return Ok(JsonView(false, "程序错误!"));
  220. throw;
  221. }
  222. }
  223. /// <summary>
  224. /// 车公司信息删除
  225. /// </summary>
  226. /// <returns></returns>
  227. [HttpPost]
  228. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  229. public async Task<IActionResult> DelCarData(DelCarDataDto dto)
  230. {
  231. try
  232. {
  233. bool res = await _carDataRep.SoftDeleteByIdAsync<Res_CarData>(dto.Id.ToString(), dto.DeleteUserId);
  234. if (!res) { return Ok(JsonView(false, "删除失败!")); }
  235. return Ok(JsonView(true, "删除成功"));
  236. }
  237. catch (Exception ex)
  238. {
  239. return Ok(JsonView(false, "程序错误!"));
  240. throw;
  241. }
  242. }
  243. #endregion
  244. #region 导游地接资料板块
  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> QueryLocalGuide(QueryLocalGuide dto)
  253. {
  254. try
  255. {
  256. Result LocalGuide = await _localGuideDataRep.QueryLocalGuide(dto);
  257. if (LocalGuide.Code == 0)
  258. {
  259. return Ok(JsonView(true, "查询成功", LocalGuide.Data));
  260. }
  261. else
  262. {
  263. return Ok(JsonView(false, LocalGuide.Msg));
  264. }
  265. }
  266. catch (Exception ex)
  267. {
  268. return Ok(JsonView(false, "程序错误!"));
  269. throw;
  270. }
  271. }
  272. /// <summary>
  273. /// 导游地接资料下拉框数据
  274. /// </summary>
  275. /// <returns></returns>
  276. [HttpPost]
  277. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  278. public async Task<IActionResult> QueryLocalGuideSelect()
  279. {
  280. try
  281. {
  282. var LocalGuide = _carDataRep.QueryDto<Res_LocalGuideData, QueryLocalGuideSelectView>().ToList();
  283. if (LocalGuide.Count == 0)
  284. {
  285. return Ok(JsonView(false, "暂无数据!"));
  286. }
  287. LocalGuide.Add(new QueryLocalGuideSelectView { Id = 0, UnitArea = "全部" });
  288. LocalGuide = LocalGuide.Where((x, i) => LocalGuide.FindIndex(z => z.UnitArea == x.UnitArea && z.UnitArea != "") == i).ToList();
  289. LocalGuide = LocalGuide.OrderBy(x => x.Id).ToList();
  290. List<QueryLocalGuideSelectView> data = new List<QueryLocalGuideSelectView>();
  291. foreach (QueryLocalGuideSelectView Local in LocalGuide)
  292. {
  293. if (!string.IsNullOrWhiteSpace(Local.UnitArea))
  294. {
  295. data.Add(Local);
  296. }
  297. }
  298. return Ok(JsonView(true, "查询成功", data));
  299. }
  300. catch (Exception)
  301. {
  302. return Ok(JsonView(false, "程序错误!"));
  303. throw;
  304. }
  305. }
  306. /// <summary>
  307. /// 导游地接信息操作(Status:1.新增,2.修改)
  308. /// </summary>
  309. /// <returns></returns>
  310. [HttpPost]
  311. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  312. public async Task<IActionResult> OperationLocalGuide(LocalGuideOperationDto dto)
  313. {
  314. try
  315. {
  316. if (dto.UnitArea == "")
  317. {
  318. return Ok(JsonView(false, "请检查单位区域是否填写!"));
  319. }
  320. if (dto.UnitName == "")
  321. {
  322. return Ok(JsonView(false, "请检查单位名称是否填写!"));
  323. }
  324. if (dto.Contact == "")
  325. {
  326. return Ok(JsonView(false, "请检查单位联系人是否填写!"));
  327. }
  328. if (dto.ContactTel == "")
  329. {
  330. return Ok(JsonView(false, "请检查联系方式是否填写正确!"));
  331. }
  332. Result result = await _localGuideDataRep.LocalGuideOperation(dto);
  333. if (result.Code != 0)
  334. {
  335. return Ok(JsonView(false, result.Msg));
  336. }
  337. return Ok(JsonView(true, result.Msg));
  338. }
  339. catch (Exception ex)
  340. {
  341. return Ok(JsonView(false, "程序错误!"));
  342. throw;
  343. }
  344. }
  345. /// <summary>
  346. /// 导游地接信息操作(删除)
  347. /// </summary>
  348. /// <returns></returns>
  349. [HttpPost]
  350. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  351. public async Task<IActionResult> DelLocalGuide(LocalGuideDelDto dto)
  352. {
  353. try
  354. {
  355. var res = await _localGuideDataRep.SoftDeleteByIdAsync<Res_LocalGuideData>(dto.Id.ToString(), dto.DeleteUserId);
  356. if (!res)
  357. {
  358. return Ok(JsonView(false, "删除失败"));
  359. }
  360. return Ok(JsonView(true, "删除成功!"));
  361. }
  362. catch (Exception ex)
  363. {
  364. return Ok(JsonView(false, "程序错误!"));
  365. throw;
  366. }
  367. }
  368. #endregion
  369. #region 机场三字码信息
  370. /// <summary>
  371. /// 机场三字码查询
  372. /// </summary>
  373. /// <param name="dto"></param>
  374. /// <returns></returns>
  375. [HttpPost]
  376. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  377. public async Task<IActionResult> QueryThreeCode(QueryThreeCodeDto dto)
  378. {
  379. try
  380. {
  381. Result LocalGuide = await _ThreeCodeRep.QueryThreeCode(dto);
  382. if (LocalGuide.Code == 0)
  383. {
  384. return Ok(JsonView(true, "查询成功", LocalGuide.Data));
  385. }
  386. else
  387. {
  388. return Ok(JsonView(false, LocalGuide.Msg));
  389. }
  390. }
  391. catch (Exception ex)
  392. {
  393. return Ok(JsonView(false, "程序错误!"));
  394. throw;
  395. }
  396. }
  397. /// <summary>
  398. /// 机场三字码数据城市下拉框数据
  399. /// </summary>
  400. /// <returns></returns>
  401. [HttpPost]
  402. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  403. public async Task<IActionResult> QueryThreeCodeSelect()
  404. {
  405. try
  406. {
  407. var ThreeCode = _carDataRep.QueryDto<Res_ThreeCode, ThreeCodeSelectView>().ToList();
  408. if (ThreeCode.Count == 0)
  409. {
  410. return Ok(JsonView(false, "暂无数据!"));
  411. }
  412. ThreeCode.Add(new ThreeCodeSelectView { Id = 0, City = "全部" });
  413. ThreeCode = ThreeCode.Where((x, i) => ThreeCode.FindIndex(z => z.City == x.City && z.City != "") == i).ToList();
  414. ThreeCode = ThreeCode.OrderBy(x => x.Id).ToList();
  415. List<ThreeCodeSelectView> data = new List<ThreeCodeSelectView>();
  416. foreach (ThreeCodeSelectView _ThreeCode in ThreeCode)
  417. {
  418. if (!string.IsNullOrWhiteSpace(_ThreeCode.City))
  419. {
  420. data.Add(_ThreeCode);
  421. }
  422. }
  423. return Ok(JsonView(true, "查询成功", data));
  424. }
  425. catch (Exception)
  426. {
  427. return Ok(JsonView(false, "程序错误!"));
  428. throw;
  429. }
  430. }
  431. /// <summary>
  432. /// 机场三字码资料操作(Status:1.新增,2.修改)
  433. /// </summary>
  434. /// <param name="dto"></param>
  435. /// <returns></returns>
  436. [HttpPost]
  437. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  438. public async Task<IActionResult> OperationThreeCode(ThreeCodeOperationDto dto)
  439. {
  440. try
  441. {
  442. if (dto.Three == "")
  443. {
  444. return Ok(JsonView(false, "请检查三字码是否填写!"));
  445. }
  446. if (dto.Country == "")
  447. {
  448. return Ok(JsonView(false, "请检查国家是否填写!"));
  449. }
  450. if (dto.City == "")
  451. {
  452. return Ok(JsonView(false, "请检查城市是否填写正确!"));
  453. }
  454. if (dto.AirPort == "")
  455. {
  456. return Ok(JsonView(false, "请检查机场是否填写正确!"));
  457. }
  458. Result result = await _ThreeCodeRep.ThreeCodeOperation(dto);
  459. if (result.Code != 0)
  460. {
  461. return Ok(JsonView(false, result.Msg));
  462. }
  463. return Ok(JsonView(true, result.Msg));
  464. }
  465. catch (Exception ex)
  466. {
  467. return Ok(JsonView(false, "程序错误!"));
  468. throw;
  469. }
  470. }
  471. /// <summary>
  472. /// 机场三字码资料操作(删除)
  473. /// </summary>
  474. /// <returns></returns>
  475. [HttpPost]
  476. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  477. public async Task<IActionResult> DelThreeCode(ThreeCodeDelDto dto)
  478. {
  479. try
  480. {
  481. var res = await _ThreeCodeRep.SoftDeleteByIdAsync<Res_ThreeCode>(dto.Id.ToString(), dto.DeleteUserId);
  482. if (!res)
  483. {
  484. return Ok(JsonView(false, "删除失败"));
  485. }
  486. return Ok(JsonView(true, "删除成功!"));
  487. }
  488. catch (Exception ex)
  489. {
  490. return Ok(JsonView(false, "程序错误!"));
  491. throw;
  492. }
  493. }
  494. #endregion
  495. #region 代理出票合作方资料
  496. /// <summary>
  497. /// 代理出票合作方资料
  498. /// </summary>
  499. /// <param name="dto"></param>
  500. /// <returns></returns>
  501. [HttpPost]
  502. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  503. public async Task<IActionResult> QueryAirTicketAgent(DtoBase dto)
  504. {
  505. try
  506. {
  507. List<Res_AirTicketAgent> res_AirTicketAgents = _airTicketAgentRep.Query<Res_AirTicketAgent>(a => a.IsDel == 0).ToList();
  508. if (res_AirTicketAgents.Count != 0)
  509. {
  510. res_AirTicketAgents = res_AirTicketAgents.OrderByDescending(a => a.CreateTime).ToList();
  511. if (dto.PageSize == 0 && dto.PageIndex == 0)
  512. {
  513. return Ok(JsonView(true, "查询成功!", res_AirTicketAgents));
  514. }
  515. else
  516. {
  517. int count = res_AirTicketAgents.Count;
  518. float totalPage = (float)count / dto.PageSize;//总页数
  519. if (totalPage == 0) totalPage = 1;
  520. else totalPage = (int)Math.Ceiling((double)totalPage);
  521. List<Res_AirTicketAgent> _AirTicketAgent = new List<Res_AirTicketAgent>();
  522. for (int i = 0; i < dto.PageSize; i++)
  523. {
  524. var RowIndex = i + (dto.PageIndex - 1) * dto.PageSize;
  525. if (RowIndex < res_AirTicketAgents.Count)
  526. {
  527. _AirTicketAgent.Add(res_AirTicketAgents[RowIndex]);
  528. }
  529. else
  530. {
  531. break;
  532. }
  533. }
  534. return Ok(JsonView(true, "查询成功!", new { pageCount = count, totalPage = (int)totalPage, pageIndex = dto.PageIndex, pageSize = dto.PageSize, pageSource = _AirTicketAgent }));
  535. }
  536. }
  537. else
  538. {
  539. return Ok(JsonView(false, "暂无数据!"));
  540. }
  541. }
  542. catch (Exception ex)
  543. {
  544. return Ok(JsonView(false, "程序错误!"));
  545. throw;
  546. }
  547. }
  548. /// <summary>
  549. /// 代理出票合作方资料操作(Status:1.新增,2.修改)
  550. /// </summary>
  551. /// <param name="dto"></param>
  552. /// <returns></returns>
  553. [HttpPost]
  554. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  555. public async Task<IActionResult> OpAirTicketAgent(OpAirTicketAgentDto dto)
  556. {
  557. try
  558. {
  559. if (dto.Account == "")
  560. {
  561. return Ok(JsonView(false, "请检查代理商账户是否填写!"));
  562. }
  563. if (dto.Bank == "")
  564. {
  565. return Ok(JsonView(false, "请检查代理商银行是否填写!"));
  566. }
  567. if (dto.Name == "")
  568. {
  569. return Ok(JsonView(false, "请检查代理商名称是否填写正确!"));
  570. }
  571. Result result = await _airTicketAgentRep.OpAirTicketAgent(dto);
  572. if (result.Code != 0)
  573. {
  574. return Ok(JsonView(false, result.Msg));
  575. }
  576. return Ok(JsonView(true, result.Msg));
  577. }
  578. catch (Exception ex)
  579. {
  580. return Ok(JsonView(false, "程序错误!"));
  581. throw;
  582. }
  583. }
  584. /// <summary>
  585. /// 代理出票合作方资料操作(删除)
  586. /// </summary>
  587. /// <returns></returns>
  588. [HttpPost]
  589. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  590. public async Task<IActionResult> DelAirTicketAgent(DelBaseDto dto)
  591. {
  592. try
  593. {
  594. var res = await _airTicketAgentRep.SoftDeleteByIdAsync<Res_AirTicketAgent>(dto.Id.ToString(), dto.DeleteUserId);
  595. if (!res)
  596. {
  597. return Ok(JsonView(false, "删除失败"));
  598. }
  599. return Ok(JsonView(true, "删除成功!"));
  600. }
  601. catch (Exception ex)
  602. {
  603. return Ok(JsonView(false, "程序错误!"));
  604. throw;
  605. }
  606. }
  607. #endregion
  608. #region 酒店资料数据
  609. /// <summary>
  610. /// 酒店信息查询
  611. /// </summary>
  612. /// <param name="dto"></param>
  613. /// <returns></returns>
  614. [HttpPost]
  615. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  616. public async Task<IActionResult> QueryHotelData(QueryHotelDataDto dto)
  617. {
  618. try
  619. {
  620. Result hotelData = await _hotelDataRep.QueryHotelData(dto);
  621. if (hotelData.Code == 0)
  622. {
  623. return Ok(JsonView(true, "查询成功", hotelData.Data));
  624. }
  625. else
  626. {
  627. return Ok(JsonView(false, hotelData.Msg));
  628. }
  629. }
  630. catch (Exception ex)
  631. {
  632. return Ok(JsonView(false, "程序错误!"));
  633. throw;
  634. }
  635. }
  636. /// <summary>
  637. /// 酒店资料下拉框数据
  638. /// </summary>
  639. /// <returns></returns>
  640. [HttpPost]
  641. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  642. public async Task<IActionResult> QueryHotelDataSelect()
  643. {
  644. try
  645. {
  646. var HotelData = _carDataRep.QueryDto<Res_HotelData, QueryHotelDataSelect>().ToList();
  647. if (HotelData.Count == 0)
  648. {
  649. return Ok(JsonView(false, "暂无数据!"));
  650. }
  651. HotelData.Add(new QueryHotelDataSelect { Id = 0, City = "全部" });
  652. HotelData = HotelData.Where((x, i) => HotelData.FindIndex(z => z.City == x.City && z.City != "") == i).ToList();
  653. HotelData = HotelData.OrderBy(x => x.Id).ToList();
  654. List<QueryHotelDataSelect> data = new List<QueryHotelDataSelect>();
  655. foreach (QueryHotelDataSelect Hotel in HotelData)
  656. {
  657. if (!string.IsNullOrWhiteSpace(Hotel.City))
  658. {
  659. data.Add(Hotel);
  660. }
  661. }
  662. return Ok(JsonView(true, "查询成功", data));
  663. }
  664. catch (Exception)
  665. {
  666. return Ok(JsonView(false, "程序错误!"));
  667. throw;
  668. }
  669. }
  670. /// <summary>
  671. /// 酒店资料操作(Status:1.新增,2.修改)
  672. /// </summary>
  673. /// <param name="dto"></param>
  674. /// <returns></returns>
  675. [HttpPost]
  676. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  677. public async Task<IActionResult> OperationHotelData(OperationHotelDto dto)
  678. {
  679. try
  680. {
  681. if (dto.City == "")
  682. {
  683. return Ok(JsonView(false, "请检查酒店所在城市是否填写!"));
  684. }
  685. if (dto.Name == "")
  686. {
  687. return Ok(JsonView(false, "请检查酒店名称是否填写!"));
  688. }
  689. if (dto.Address == "")
  690. {
  691. return Ok(JsonView(false, "请检查酒店地址是否填写正确!"));
  692. }
  693. if (dto.Tel == "")
  694. {
  695. return Ok(JsonView(false, "请检查酒店联系方式是否填写正确!"));
  696. }
  697. Result result = await _hotelDataRep.OperationHotelData(dto);
  698. if (result.Code != 0)
  699. {
  700. return Ok(JsonView(false, result.Msg));
  701. }
  702. return Ok(JsonView(true, result.Msg));
  703. }
  704. catch (Exception ex)
  705. {
  706. return Ok(JsonView(false, "程序错误!"));
  707. throw;
  708. }
  709. }
  710. /// <summary>
  711. /// 酒店资料操作(删除)
  712. /// </summary>
  713. /// <returns></returns>
  714. [HttpPost]
  715. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  716. public async Task<IActionResult> DelHotelData(DelHotelDataDto dto)
  717. {
  718. try
  719. {
  720. var res = await _hotelDataRep.SoftDeleteByIdAsync<Res_HotelData>(dto.Id.ToString(), dto.DeleteUserId);
  721. if (!res)
  722. {
  723. return Ok(JsonView(false, "删除失败"));
  724. }
  725. return Ok(JsonView(true, "删除成功!"));
  726. }
  727. catch (Exception ex)
  728. {
  729. return Ok(JsonView(false, "程序错误!"));
  730. throw;
  731. }
  732. }
  733. #endregion
  734. #region 签证费用资料
  735. /// <summary>
  736. /// 签证费用资料查询
  737. /// </summary>
  738. /// <param name="dto"></param>
  739. /// <returns></returns>
  740. [HttpPost]
  741. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  742. public async Task<IActionResult> QueryCountryFeeCost(DtoBase dto)
  743. {
  744. try
  745. {
  746. if (dto.PortType == 1)
  747. {
  748. var CountryFee = _countryFeeRep.QueryDto<Res_CountryFeeCost, CountryFeeCostView>().ToList();
  749. if (CountryFee.Count == 0)
  750. {
  751. return Ok(JsonView(false, "暂无数据!"));
  752. }
  753. CountryFee = CountryFee.OrderByDescending(s => s.CreateTime).ToList();
  754. return Ok(JsonView(true, "查询成功", CountryFee));
  755. }
  756. else if (dto.PortType == 2)
  757. {
  758. var CountryFee = _countryFeeRep.QueryDto<Res_CountryFeeCost, CountryFeeCostView>().ToList();
  759. if (CountryFee.Count == 0)
  760. {
  761. return Ok(JsonView(false, "暂无数据!"));
  762. }
  763. CountryFee = CountryFee.OrderByDescending(s => s.CreateTime).ToList();
  764. return Ok(JsonView(true, "查询成功", CountryFee));
  765. }
  766. else
  767. {
  768. return Ok(JsonView(false, "请传入PortType参数!1:Web,2:Android,3:IOS"));
  769. }
  770. }
  771. catch (Exception ex)
  772. {
  773. return Ok(JsonView(false, "程序错误!"));
  774. throw;
  775. }
  776. }
  777. /// <summary>
  778. /// 签证费用资料操作(Status:1.新增,2.修改)
  779. /// </summary>
  780. /// <param name="dto"></param>
  781. /// <returns></returns>
  782. [HttpPost]
  783. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  784. public async Task<IActionResult> OperationCountryFeeCost(OperationCountryFeeCostDto dto)
  785. {
  786. try
  787. {
  788. if (dto.VisaContinent == "")
  789. {
  790. return Ok(JsonView(false, "请检查州名是否填写!"));
  791. }
  792. if (dto.VisaCountry == "")
  793. {
  794. return Ok(JsonView(false, "请检查国家名是否填写!"));
  795. }
  796. if (dto.VisaTime == "1")
  797. {
  798. return Ok(JsonView(false, "请检一般签证时间是否填写正确!"));
  799. }
  800. if (dto.UrgentTime == "1")
  801. {
  802. return Ok(JsonView(false, "请检加急时间是否填写正确!"));
  803. }
  804. if (dto.VisaPrice == 0)
  805. {
  806. return Ok(JsonView(false, "请检查签证费用是否填写正确,小数点后可1到2位!"));
  807. }
  808. if (dto.VisaPrice == 1)
  809. {
  810. return Ok(JsonView(false, "请检查签证加急费用是否填写正确,小数点后可1到2位!"));
  811. }
  812. Result result = await _countryFeeRep.OperationCountryFeeCost(dto);
  813. if (result.Code != 0)
  814. {
  815. return Ok(JsonView(false, result.Msg));
  816. }
  817. return Ok(JsonView(true, result.Msg));
  818. }
  819. catch (Exception ex)
  820. {
  821. return Ok(JsonView(false, "程序错误!"));
  822. throw;
  823. }
  824. }
  825. /// <summary>
  826. /// 签证费用资料操作(删除)
  827. /// </summary>
  828. /// <returns></returns>
  829. [HttpPost]
  830. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  831. public async Task<IActionResult> DelCountryFeeCost(DelCountryFeeCostDto dto)
  832. {
  833. try
  834. {
  835. var res = await _countryFeeRep.SoftDeleteByIdAsync<Res_CountryFeeCost>(dto.Id.ToString(), dto.DeleteUserId);
  836. if (!res)
  837. {
  838. return Ok(JsonView(false, "删除失败"));
  839. }
  840. return Ok(JsonView(true, "删除成功!"));
  841. }
  842. catch (Exception ex)
  843. {
  844. return Ok(JsonView(false, "程序错误!"));
  845. throw;
  846. }
  847. }
  848. #endregion
  849. #region 物料信息、供应商维护
  850. #region 供应商
  851. /// <summary>
  852. /// 物料供应商查询
  853. /// </summary>
  854. /// <param name="paras">Json序列化</param>
  855. /// <returns></returns>
  856. [HttpPost]
  857. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  858. public async Task<IActionResult> PostSearchItemVendor(JsonDtoBase _jsonDto)
  859. {
  860. if (string.IsNullOrEmpty(_jsonDto.Paras))
  861. {
  862. return Ok(JsonView(false, "参数为空"));
  863. }
  864. Search_ResItemVendorDto _ItemVendorDto = System.Text.Json.JsonSerializer.Deserialize<Search_ResItemVendorDto>(_jsonDto.Paras);
  865. if (_ItemVendorDto != null)
  866. {
  867. if (_ItemVendorDto.SearchType == 2) //获取列表
  868. {
  869. Res_ItemVendorListView rstList = _resItemInfoRep.GetVendorList(_ItemVendorDto);
  870. return Ok(rstList);
  871. }
  872. else
  873. {
  874. Res_ItemVendorView rstInfo = _resItemInfoRep.getVendorInfo(_ItemVendorDto);
  875. return Ok(rstInfo);
  876. }
  877. }
  878. else
  879. {
  880. return Ok(JsonView(false, "参数反序列化失败"));
  881. }
  882. return Ok(JsonView(false));
  883. }
  884. /// <summary>
  885. /// 创建/编辑/删除供应商信息
  886. /// </summary>
  887. /// <param name="_dto"></param>
  888. /// <returns></returns>
  889. [HttpPost]
  890. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  891. public async Task<IActionResult> PostEditItemVendor(Edit_ResItemVendorDto _dto)
  892. {
  893. bool rst = false;
  894. if (_dto.EditType >= 0)
  895. {
  896. if (string.IsNullOrEmpty(_dto.VendorFullName))
  897. {
  898. return Ok(JsonView(false, "全称未填写"));
  899. }
  900. if (string.IsNullOrEmpty(_dto.VendorLinker))
  901. {
  902. return Ok(JsonView(false, "联系人未填写"));
  903. }
  904. if (string.IsNullOrEmpty(_dto.VendorMobile))
  905. {
  906. return Ok(JsonView(false, "联系人手机号未填写"));
  907. }
  908. if (string.IsNullOrEmpty(_dto.BusRange))
  909. {
  910. return Ok(JsonView(false, "经营范围未选择"));
  911. }
  912. if (_dto.EditType == 0)
  913. {
  914. var checkEmpty = _resItemInfoRep.Query<Res_ItemVendor>(s => s.FullName == _dto.VendorFullName).First();
  915. if (checkEmpty != null)
  916. {
  917. return Ok(JsonView(false, "已存在同名供应商"));
  918. }
  919. rst = await _resItemInfoRep.addVendorInfo(_dto);
  920. }
  921. else if (_dto.EditType == 1)
  922. {
  923. if (_dto.VendorId > 0)
  924. {
  925. Res_ItemVendor _entity = _mapper.Map<Res_ItemVendor>(_dto);
  926. rst = await _resItemInfoRep.updVendorInfo(_entity);
  927. }
  928. else
  929. {
  930. return Ok(JsonView(false, "供应商不存在"));
  931. }
  932. }
  933. }
  934. else
  935. {
  936. if (_dto.VendorId < 1 || _dto.SysUserId < 1)
  937. {
  938. return Ok(JsonView(false, "用户Id或供应商Id不存在"));
  939. }
  940. Res_ItemVendor _entity = _mapper.Map<Res_ItemVendor>(_dto);
  941. rst = await _resItemInfoRep.delVendorInfo(_entity);
  942. }
  943. return Ok(JsonView(rst));
  944. }
  945. #endregion
  946. #region 物料信息
  947. /// <summary>
  948. /// 物料信息查询
  949. /// </summary>
  950. /// <param name="paras">Json序列化</param>
  951. /// <returns></returns>
  952. [HttpPost]
  953. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  954. public async Task<IActionResult> PostSearchItemInfo(string paras)
  955. {
  956. if (string.IsNullOrEmpty(paras))
  957. {
  958. return Ok(JsonView(false, "参数为空"));
  959. }
  960. Search_ItemInfoDto _ItemInfoDto = System.Text.Json.JsonSerializer.Deserialize<Search_ItemInfoDto>(paras);
  961. if (_ItemInfoDto != null)
  962. {
  963. if (_ItemInfoDto.SearchType == 2) //获取列表
  964. {
  965. Res_ItemInfoListView rstList = _resItemInfoRep.GetItemList(_ItemInfoDto);
  966. return Ok(rstList);
  967. }
  968. else
  969. {
  970. Res_ItemInfoView rstInfo = _resItemInfoRep.getItemInfo(_ItemInfoDto);
  971. return Ok(rstInfo);
  972. }
  973. }
  974. else
  975. {
  976. return Ok(JsonView(false, "参数反序列化失败"));
  977. }
  978. return Ok(JsonView(false));
  979. }
  980. /// <summary>
  981. /// 创建/编辑/删除物料信息
  982. /// </summary>
  983. ///
  984. /// <returns></returns>
  985. [HttpPost]
  986. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  987. public async Task<IActionResult> PostEditItemInfo(Edit_ResItemInfoDto _dto)
  988. {
  989. bool rst = false;
  990. if (_dto.EditType >= 0)
  991. {
  992. if (_dto.VendorId < 1)
  993. {
  994. return Ok(JsonView(false, "未选择供应商"));
  995. }
  996. if (string.IsNullOrEmpty(_dto.ItemName))
  997. {
  998. return Ok(JsonView(false, "物料名称为空"));
  999. }
  1000. if (_dto.ItemTypeId < 1)
  1001. {
  1002. return Ok(JsonView(false, "未选择物料类型"));
  1003. }
  1004. if (_dto.SysUserId < 1)
  1005. {
  1006. return Ok(JsonView(false, "当前操作用户Id为空"));
  1007. }
  1008. if (_dto.CurrRate <= 0)
  1009. {
  1010. return Ok(JsonView(false, "物料录入价格不能小于等于0"));
  1011. }
  1012. if (_dto.EditType == 0)
  1013. {
  1014. //判断物料名称、类型、供应商全部重复
  1015. var checkEmpty = _resItemInfoRep.Query<Res_ItemDetailInfo>(s => s.ItemName == _dto.ItemName && s.ItemTypeId == _dto.ItemTypeId && s.VendorId == _dto.VendorId).First();
  1016. if (checkEmpty != null)
  1017. {
  1018. return Ok(JsonView(false, "已存在重复物料信息"));
  1019. }
  1020. Res_ItemDetailInfo _entity = _mapper.Map<Res_ItemDetailInfo>(_dto);
  1021. DateTime dtNow = DateTime.Now;
  1022. _entity.CreateUserId = _dto.SysUserId;
  1023. _entity.IsDel = 0;
  1024. _entity.MaxRate = _dto.CurrRate;
  1025. _entity.MaxDt = dtNow;
  1026. _entity.CurrRate = _dto.CurrRate;
  1027. _entity.CurrDt = dtNow;
  1028. _entity.MinRate = _dto.CurrRate;
  1029. _entity.MinDt = dtNow;
  1030. rst = await _resItemInfoRep.AddAsync<Res_ItemDetailInfo>(_entity) > 0;
  1031. }
  1032. else if (_dto.EditType == 1)
  1033. {
  1034. if (_dto.ItemId > 0)
  1035. {
  1036. Res_ItemDetailInfo _entity = _mapper.Map<Res_ItemDetailInfo>(_dto);
  1037. _entity.Id = _dto.ItemId;
  1038. rst = await _resItemInfoRep.updItemInfo(_entity);
  1039. }
  1040. else
  1041. {
  1042. return Ok(JsonView(false, "供应商不存在"));
  1043. }
  1044. }
  1045. }
  1046. else
  1047. {
  1048. if (_dto.ItemId < 1 || _dto.SysUserId < 1)
  1049. {
  1050. return Ok(JsonView(false, "用户Id或物料信息Id不存在"));
  1051. }
  1052. Res_ItemDetailInfo _entity = _mapper.Map<Res_ItemDetailInfo>(_dto);
  1053. rst = await _resItemInfoRep.delItemInfo(_entity);
  1054. }
  1055. return Ok(JsonView(rst));
  1056. }
  1057. #endregion
  1058. #region 物料类型获取
  1059. #endregion
  1060. #endregion
  1061. #region 备忘录
  1062. /// <summary>
  1063. /// 备忘录查询
  1064. /// </summary>
  1065. /// <param name="paras">Json序列化</param>
  1066. /// <returns></returns>
  1067. [HttpPost]
  1068. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  1069. public async Task<IActionResult> PostSearchMemo(JsonDtoBase _jsonDto)
  1070. {
  1071. if (string.IsNullOrEmpty(_jsonDto.Paras))
  1072. {
  1073. return Ok(JsonView(false, "参数为空"));
  1074. }
  1075. Search_ResMemoDto _memoDto = JsonConvert.DeserializeObject<Search_ResMemoDto>(_jsonDto.Paras);
  1076. if (_memoDto != null)
  1077. {
  1078. if (_memoDto.SearchType == 2)
  1079. {
  1080. //获取列表
  1081. string sqlWhere = string.Format(" Where IsDel=0 ");
  1082. #region SqlWhere
  1083. if (!string.IsNullOrEmpty(_memoDto.Abstracts))
  1084. {
  1085. sqlWhere += string.Format(@" And m.Abstracts Like '%{0}%' ", _memoDto.Abstracts);
  1086. }
  1087. if (!string.IsNullOrEmpty(_memoDto.Title))
  1088. {
  1089. sqlWhere += string.Format(@" And m.Title Like '%{0}%' ", _memoDto.Title);
  1090. }
  1091. if (_memoDto.ReadLevel > 0)
  1092. {
  1093. sqlWhere += string.Format(@" And m.ReadLevel = {0} ", _memoDto.ReadLevel);
  1094. }
  1095. #endregion
  1096. int currPIndex = (((_memoDto.PageIndex > 0) ? (_memoDto.PageIndex - 1) : 0) * _memoDto.PageSize) + 1;
  1097. int currPSize = (((_memoDto.PageIndex > 0) ? (_memoDto.PageIndex - 1) : 0) + 1) * _memoDto.PageSize;
  1098. string sql = string.Format(@" Select * From(Select ROW_NUMBER() Over(order By m.Id desc) as RowNumber,
  1099. m.Id as MemoId,d.DepName as DepartmentName,m.ReadLevel,m.Title,m.Abstracts,
  1100. m.LastedEditDt,m.LastedEditorId
  1101. From Res_Memo as m With(Nolock) Inner Join Sys_Users as u With(Nolock) On m.CreateUserId=u.Id
  1102. Inner Join Sys_Department as d With(Nolock) On u.DepId=d.Id {2}
  1103. ) as tb Where tb.RowNumber Between {0} And {1} ", currPIndex, currPSize, sqlWhere);
  1104. Res_MemoListView rst = new Res_MemoListView();
  1105. rst.CurrPageIndex = currPIndex;
  1106. rst.CurrPageSize = currPSize;
  1107. List<Res_MemoView> dataSource = _carDataRep._sqlSugar.SqlQueryable<Res_MemoView>(sql).ToList();
  1108. Dictionary<int, string> userDic = new Dictionary<int, string>();
  1109. foreach (var item in dataSource)
  1110. {
  1111. if (userDic.ContainsKey(item.LastedEditorId))
  1112. {
  1113. item.LastedEditor = userDic[item.LastedEditorId];
  1114. }
  1115. else
  1116. {
  1117. Sys_Users _sysUser = _carDataRep.Query<Sys_Users>(s => s.Id == item.LastedEditorId).First();
  1118. userDic[item.LastedEditorId] = _sysUser.CnName;
  1119. item.LastedEditor = _sysUser.CnName;
  1120. }
  1121. }
  1122. rst.DataList = new List<Res_MemoView>(dataSource);
  1123. if (rst.DataList.Count > 0)
  1124. {
  1125. string sqlCount = string.Format(@" Select Id From Res_Memo as m With(Nolock) {0} ", sqlWhere);
  1126. int dataCount = _carDataRep._sqlSugar.SqlQueryable<Res_MemoInfo>(sqlCount).Count();
  1127. rst.DataCount = dataCount;
  1128. }
  1129. return Ok(JsonView(rst));
  1130. }
  1131. else
  1132. {
  1133. //获取对象
  1134. string sqlSingle = string.Format(@" Select
  1135. m.Id as MemoId,d.DepName as DepartmentName,m.ReadLevel,m.Title,m.Abstracts,
  1136. m.LastedEditDt,m.LastedEditor,m.MDFilePath
  1137. From Res_Memo as m With(Nolock) Inner Join Sys_Users as u With(Nolock) On m.CreateUserId=u.Id
  1138. Inner Join Sys_Department as d With(Nolock) On u.DepId=d.Id Where m.Id={0} ", _memoDto.MemoId);
  1139. Res_MemoView _result = _carDataRep._sqlSugar.SqlQueryable<Res_MemoView>(sqlSingle).First();
  1140. if (_result != null)
  1141. {
  1142. Sys_Users _sysUser = _carDataRep.Query<Sys_Users>(s => s.Id == _result.LastedEditorId).First();
  1143. _result.LastedEditor = _sysUser.CnName;
  1144. _result.MarkDownContent = new IOOperatorHelper().Read(_result.MDFilePath);
  1145. return Ok(JsonView(_result));
  1146. }
  1147. }
  1148. }
  1149. else
  1150. {
  1151. return Ok(JsonView(false, "参数反序列化失败"));
  1152. }
  1153. return Ok(JsonView(false));
  1154. }
  1155. /// <summary>
  1156. /// 创建/编辑/删除备忘录信息
  1157. /// </summary>
  1158. /// <param name="_dto"></param>
  1159. /// <returns></returns>
  1160. [HttpPost]
  1161. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  1162. public async Task<IActionResult> PostEditMemo(Edit_ResMemoDto _dto)
  1163. {
  1164. bool rst = false;
  1165. if (_dto.SysUserId < 1)
  1166. {
  1167. return Ok(JsonView(false, "操作人失效"));
  1168. }
  1169. Sys_Users _sysUser = _resItemInfoRep.Query<Sys_Users>(s => s.Id == _dto.SysUserId).First();
  1170. if (_sysUser == null)
  1171. {
  1172. return Ok(JsonView(false, "操作人失效02"));
  1173. }
  1174. if (_dto.EditType >= 0)
  1175. {
  1176. if (_dto.ReadLevel < 1)
  1177. {
  1178. return Ok(JsonView(false, "未知的阅读等级"));
  1179. }
  1180. if (string.IsNullOrEmpty(_dto.Title.Trim()))
  1181. {
  1182. return Ok(JsonView(false, "标题不能为空"));
  1183. }
  1184. if (string.IsNullOrEmpty(_dto.Content.Trim()))
  1185. {
  1186. return Ok(JsonView(false, "正文内容不能为空"));
  1187. }
  1188. //新增备忘录
  1189. DateTime dtNow = DateTime.Now;
  1190. string dir = AppSettingsHelper.Get("MemoCurrPath");
  1191. string fileName = dtNow.ToString("yyyyMMddHHmmss") + _dto.Title + ".md";
  1192. string content = JsonConvert.SerializeObject(_dto.Content);
  1193. if (_dto.EditType == 0)//新增
  1194. {
  1195. string savePath = new IOOperatorHelper().Write_CoverFile(content, dir, fileName);
  1196. if (savePath.Length > 0)
  1197. {
  1198. Res_MemoInfo _insert = new Res_MemoInfo();
  1199. _insert.Abstracts = _dto.Abstracts;
  1200. _insert.Title = _dto.Title;
  1201. _insert.DepartmentId = _sysUser.DepId;
  1202. _insert.CreateUserId = _sysUser.Id;
  1203. _insert.LastedEditDt = dtNow;
  1204. _insert.LastedEditor = _sysUser.Id;
  1205. _insert.MDFilePath = savePath;
  1206. _insert.ReadLevel = _dto.ReadLevel;
  1207. _insert.Title = _dto.Title;
  1208. int result = await _resItemInfoRep.AddAsync(_insert);
  1209. return Ok(JsonView(result > 0));
  1210. }
  1211. else
  1212. {
  1213. return Ok(JsonView(false, "路径保存失败"));
  1214. }
  1215. }
  1216. else//修改
  1217. {
  1218. if (_dto.MemoId < 1)
  1219. {
  1220. return Ok(JsonView(false, "MemoId不存在"));
  1221. }
  1222. Res_MemoInfo _source = _resItemInfoRep.Query<Res_MemoInfo>(s => s.Id == _dto.MemoId).First();
  1223. if (_source == null)
  1224. {
  1225. return Ok(JsonView(false, "MemoInfo不存在"));
  1226. }
  1227. //修改
  1228. string sourcePath = _source.MDFilePath;
  1229. string recycDir = AppSettingsHelper.Get("MemoRecycleBinPath");
  1230. new IOOperatorHelper().MoveFile(sourcePath, recycDir);
  1231. string savePath = new IOOperatorHelper().Write_CoverFile(content, dir, fileName);
  1232. if (savePath.Length > 0)
  1233. {
  1234. var result = await _resItemInfoRep._sqlSugar.Updateable<Res_MemoInfo>()
  1235. .SetColumns(it => it.LastedEditDt == DateTime.Now)
  1236. .SetColumns(it => it.LastedEditor == _sysUser.Id)
  1237. .SetColumns(it => it.Abstracts == _dto.Abstracts)
  1238. .SetColumns(it => it.MDFilePath == savePath)
  1239. .SetColumns(it => it.ReadLevel == _dto.ReadLevel)
  1240. .SetColumns(it => it.Title == _dto.Title)
  1241. .Where(s => s.Id == _source.Id)
  1242. .ExecuteCommandAsync();
  1243. return Ok(JsonView(result > 0));
  1244. }
  1245. }
  1246. }
  1247. else
  1248. {
  1249. //删除
  1250. if (_dto.MemoId < 1)
  1251. {
  1252. return Ok(JsonView(false, "MemoId不存在"));
  1253. }
  1254. Res_MemoInfo _source = _resItemInfoRep.Query<Res_MemoInfo>(s => s.Id == _dto.MemoId).First();
  1255. if (_source == null)
  1256. {
  1257. return Ok(JsonView(false, "MemoInfo不存在"));
  1258. }
  1259. //修改
  1260. string sourcePath = _source.MDFilePath;
  1261. string recycDir = AppSettingsHelper.Get("MemoRecycleBinPath");
  1262. new IOOperatorHelper().MoveFile(sourcePath, recycDir);
  1263. var result = await _resItemInfoRep._sqlSugar.Updateable<Res_MemoInfo>()
  1264. .SetColumns(it => it.IsDel == 1)
  1265. .SetColumns(it => it.DeleteUserId == _sysUser.Id)
  1266. .SetColumns(it => it.DeleteTime == DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))
  1267. .Where(s => s.Id == _source.Id)
  1268. .ExecuteCommandAsync();
  1269. return Ok(JsonView(result > 0));
  1270. }
  1271. return Ok(JsonView(rst));
  1272. }
  1273. #endregion
  1274. #region 商邀资料
  1275. /// <summary>
  1276. /// 商邀资料查询
  1277. /// </summary>
  1278. /// <param name="dto"></param>
  1279. /// <returns></returns>
  1280. [HttpPost]
  1281. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  1282. public async Task<IActionResult> QueryInvitationOfficialActivityData(QueryInvitationOfficialActivityDataDto dto)
  1283. {
  1284. try
  1285. {
  1286. Result groupData = await _InvitationOfficialActivityDataRep.QueryInvitationOfficialActivityData(dto);
  1287. if (groupData.Code != 0)
  1288. {
  1289. return Ok(JsonView(false, groupData.Msg));
  1290. }
  1291. return Ok(JsonView(true, groupData.Msg, groupData.Data));
  1292. }
  1293. catch (Exception ex)
  1294. {
  1295. return Ok(JsonView(false, "程序错误!"));
  1296. throw;
  1297. }
  1298. }
  1299. /// <summary>
  1300. /// 根据商邀资料Id查询信息
  1301. /// </summary>
  1302. /// <param name="dto"></param>
  1303. /// <returns></returns>
  1304. [HttpPost]
  1305. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  1306. public async Task<IActionResult> QueryInvitationOfficialActivityById(QueryInvitationOfficialActivityByIdDto dto)
  1307. {
  1308. try
  1309. {
  1310. Result groupData = await _InvitationOfficialActivityDataRep.QueryInvitationOfficialActivityById(dto);
  1311. if (groupData.Code != 0)
  1312. {
  1313. return Ok(JsonView(false, groupData.Msg));
  1314. }
  1315. return Ok(JsonView(true, groupData.Msg, groupData.Data));
  1316. }
  1317. catch (Exception ex)
  1318. {
  1319. return Ok(JsonView(false, "程序错误!"));
  1320. throw;
  1321. }
  1322. }
  1323. /// <summary>
  1324. /// 商邀资料操作(Status:1.新增,2.修改)
  1325. /// </summary>
  1326. /// <param name="dto"></param>
  1327. /// <returns></returns>
  1328. [HttpPost]
  1329. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  1330. public async Task<IActionResult> OpInvitationOfficialActivity(OpInvitationOfficialActivityDto dto)
  1331. {
  1332. try
  1333. {
  1334. Result groupData = await _InvitationOfficialActivityDataRep.OpInvitationOfficialActivity(dto);
  1335. if (groupData.Code != 0)
  1336. {
  1337. return Ok(JsonView(false, groupData.Msg));
  1338. }
  1339. return Ok(JsonView(true, groupData.Msg, groupData.Data));
  1340. }
  1341. catch (Exception ex)
  1342. {
  1343. return Ok(JsonView(false, "程序错误!"));
  1344. throw;
  1345. }
  1346. }
  1347. /// <summary>
  1348. /// 删除商邀资料信息
  1349. /// </summary>
  1350. /// <param name="dto"></param>
  1351. /// <returns></returns>
  1352. [HttpPost]
  1353. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  1354. public async Task<IActionResult> DelInvitationOfficialActivity(DelBaseDto dto)
  1355. {
  1356. try
  1357. {
  1358. var res = await _InvitationOfficialActivityDataRep.SoftDeleteByIdAsync<Res_InvitationOfficialActivityData>(dto.Id.ToString(), dto.DeleteUserId);
  1359. if (!res)
  1360. {
  1361. return Ok(JsonView(false, "删除失败"));
  1362. }
  1363. return Ok(JsonView(true, "删除成功!"));
  1364. }
  1365. catch (Exception ex)
  1366. {
  1367. return Ok(JsonView(false, "程序错误!"));
  1368. throw;
  1369. }
  1370. }
  1371. #endregion
  1372. #region 公务出访
  1373. /// <summary>
  1374. /// 获取团组所有信息,绑定下拉框
  1375. /// </summary>
  1376. /// <param name="dto"></param>
  1377. /// <returns></returns>
  1378. [HttpPost]
  1379. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  1380. public async Task<IActionResult> GetGroupAllList(OfficialActivitiesByDiIdDto dto)
  1381. {
  1382. List<Grp_DelegationInfo> _DelegationInfos = _sqlSugar.Queryable<Grp_DelegationInfo>().Where(a => a.IsDel == 0).OrderBy(a => a.CreateTime, OrderByType.Desc).ToList();
  1383. List<Sys_SetData> data = await _sqlSugar.Queryable<Sys_SetData>().Where(a => a.IsDel == 0 && a.STid == 38).ToListAsync();
  1384. List<Grp_DeleFile> _DeleFile = _sqlSugar.Queryable<Grp_DeleFile>().Where(a => a.Diid == dto.DiId && a.IsDel == 0 && a.Category == 970).ToList();
  1385. return Ok(JsonView(true, "查询成功!", new { Delegation = _DelegationInfos, SetData = data, DeleFile = _DeleFile }));
  1386. }
  1387. [HttpPost]
  1388. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  1389. public async Task<IActionResult> QueryOfficialActivitiesByDiId(OfficialActivitiesByDiIdDto dto)
  1390. {
  1391. try
  1392. {
  1393. Result groupData = await _officialActivitiesRep.QueryOfficialActivitiesByDiId(dto);
  1394. if (groupData.Code != 0)
  1395. {
  1396. return Ok(JsonView(false, groupData.Msg));
  1397. }
  1398. return Ok(JsonView(true, groupData.Msg, groupData.Data));
  1399. }
  1400. catch (Exception ex)
  1401. {
  1402. return Ok(JsonView(false, "程序错误!"));
  1403. throw;
  1404. }
  1405. }
  1406. /// <summary>
  1407. /// 根据公务出访数据Id查询数据
  1408. /// </summary>
  1409. /// <param name="dto"></param>
  1410. /// <returns></returns>
  1411. [HttpPost]
  1412. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  1413. public async Task<IActionResult> QueryOfficialActivitiesById(OfficialActivitiesDiIdDto dto)
  1414. {
  1415. try
  1416. {
  1417. Result groupData = await _officialActivitiesRep.QueryOfficialActivitiesById(dto);
  1418. if (groupData.Code != 0)
  1419. {
  1420. return Ok(JsonView(false, groupData.Msg));
  1421. }
  1422. return Ok(JsonView(true, groupData.Msg, groupData.Data));
  1423. }
  1424. catch (Exception ex)
  1425. {
  1426. return Ok(JsonView(false, "程序错误!"));
  1427. throw;
  1428. }
  1429. }
  1430. /// <summary>
  1431. /// 公务出访操作(Status:1.新增,2.修改)
  1432. /// </summary>
  1433. /// <param name="dto"></param>
  1434. /// <returns></returns>
  1435. [HttpPost]
  1436. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  1437. public async Task<IActionResult> OpOfficialActivities(OpOfficialActivitiesDto dto)
  1438. {
  1439. try
  1440. {
  1441. Result groupData = await _officialActivitiesRep.OpOfficialActivities(dto);
  1442. if (groupData.Code != 0)
  1443. {
  1444. return Ok(JsonView(false, groupData.Msg));
  1445. }
  1446. return Ok(JsonView(true, groupData.Msg, groupData.Data));
  1447. }
  1448. catch (Exception ex)
  1449. {
  1450. return Ok(JsonView(false, "程序错误!"));
  1451. throw;
  1452. }
  1453. }
  1454. /// <summary>
  1455. /// 上传文件
  1456. /// </summary>
  1457. /// <param name="file"></param>
  1458. /// <returns></returns>
  1459. [HttpPost]
  1460. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  1461. public async Task<IActionResult> UploadOfficialActivities(IFormFile file)
  1462. {
  1463. try
  1464. {
  1465. int Type = int.Parse(Request.Headers["Type"]);//1公务方简介,2公务活动图片,3发票
  1466. int DiId = int.Parse(Request.Headers["DiId"]);
  1467. int CreateUserId = int.Parse(Request.Headers["CreateUserId"]);
  1468. if (file != null)
  1469. {
  1470. var fileDir = AppSettingsHelper.Get("GrpFileBasePath");
  1471. //文件名称
  1472. string projectFileName = file.FileName;
  1473. //上传的文件的路径
  1474. string filePath = "";
  1475. if (!Directory.Exists(fileDir))
  1476. {
  1477. Directory.CreateDirectory(fileDir);
  1478. }
  1479. //上传的文件的路径
  1480. filePath = fileDir + $@"\商邀相关文件\{projectFileName}";
  1481. using (FileStream fs = System.IO.File.Create(filePath))
  1482. {
  1483. file.CopyTo(fs);
  1484. fs.Flush();
  1485. }
  1486. Grp_DeleFile d = new Grp_DeleFile();
  1487. d.Diid = DiId;
  1488. d.Category = 970;
  1489. if (Type == 1) d.Kind = 1;
  1490. else if (Type == 2) d.Kind = 2;
  1491. else if (Type == 3) d.Kind = 3;
  1492. d.FileName = projectFileName;
  1493. d.FilePath = "";
  1494. d.CreateUserId = CreateUserId;
  1495. int id = await _sqlSugar.Insertable(d).ExecuteReturnIdentityAsync();
  1496. return Ok(JsonView(true, "上传成功!", projectFileName));
  1497. }
  1498. else
  1499. {
  1500. return Ok(JsonView(false, "上传失败!"));
  1501. }
  1502. }
  1503. catch (Exception ex)
  1504. {
  1505. return Ok(JsonView(false, "程序错误!"));
  1506. throw;
  1507. }
  1508. }
  1509. /// <summary>
  1510. /// 删除文件
  1511. /// </summary>
  1512. /// <param name="dto"></param>
  1513. /// <returns></returns>
  1514. [HttpPost]
  1515. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  1516. public async Task<IActionResult> DelloadOfficialActivities(DelBaseDto dto)
  1517. {
  1518. try
  1519. {
  1520. var fileDir = AppSettingsHelper.Get("GrpFileBasePath");
  1521. Grp_DeleFile _DeleFile = await _sqlSugar.Queryable<Grp_DeleFile>().FirstAsync(a => a.Id == dto.Id);
  1522. if (_DeleFile != null)
  1523. {
  1524. string fileName = _DeleFile.FileName;
  1525. string filePath = fileDir + "/团组增减款项相关文件/" + fileName;
  1526. // 删除该文件
  1527. System.IO.File.Delete(filePath);
  1528. int id = await _sqlSugar.Updateable<Grp_DeleFile>().Where(a => a.Id == dto.Id).SetColumns(a => new Grp_DeleFile { IsDel = 1, DeleteUserId = dto.DeleteUserId, DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }).ExecuteCommandAsync();
  1529. return Ok(JsonView(true, "取消文件成功!"));
  1530. }
  1531. else
  1532. {
  1533. return Ok(JsonView(false, "取消文件失败!"));
  1534. }
  1535. }
  1536. catch (Exception ex)
  1537. {
  1538. return Ok(JsonView(false, "程序错误!"));
  1539. throw;
  1540. }
  1541. }
  1542. /// <summary>
  1543. /// 删除公务出访信息
  1544. /// </summary>
  1545. /// <param name="dto"></param>
  1546. /// <returns></returns>
  1547. [HttpPost]
  1548. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  1549. public async Task<IActionResult> DelOfficialActivities(DelBaseDto dto)
  1550. {
  1551. try
  1552. {
  1553. var res = await _officialActivitiesRep.SoftDeleteByIdAsync<Res_OfficialActivities>(dto.Id.ToString(), dto.DeleteUserId);
  1554. if (!res)
  1555. {
  1556. return Ok(JsonView(false, "删除失败"));
  1557. }
  1558. return Ok(JsonView(true, "删除成功!"));
  1559. }
  1560. catch (Exception ex)
  1561. {
  1562. return Ok(JsonView(false, "程序错误!"));
  1563. throw;
  1564. }
  1565. }
  1566. #endregion
  1567. #region 请示数据库
  1568. /// <summary>
  1569. /// 查询请示数据库初始化
  1570. /// </summary>
  1571. /// <param name="dto"></param>
  1572. /// <returns></returns>
  1573. [HttpPost]
  1574. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  1575. public async Task<IActionResult> QueryAskData(QueryAskDataDto dto)
  1576. {
  1577. try
  1578. {
  1579. Result groupData = await _askDataRep.QueryAskData(dto);
  1580. if (groupData.Code != 0)
  1581. {
  1582. return Ok(JsonView(false, groupData.Msg));
  1583. }
  1584. return Ok(JsonView(true, groupData.Msg, groupData.Data));
  1585. }
  1586. catch (Exception ex)
  1587. {
  1588. return Ok(JsonView(false, "程序错误!"));
  1589. throw;
  1590. }
  1591. }
  1592. /// <summary>
  1593. /// 根据Id查询请示数据库单挑数据
  1594. /// </summary>
  1595. /// <param name="dto"></param>
  1596. /// <returns></returns>
  1597. [HttpPost]
  1598. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  1599. public async Task<IActionResult> QueryAskDataById(QueryAskDataByIdDto dto)
  1600. {
  1601. try
  1602. {
  1603. Res_AskData _AskData = await _sqlSugar.Queryable<Res_AskData>().FirstAsync(a => a.IsDel == 0 && a.Id == dto.id);
  1604. if (_AskData==null)
  1605. {
  1606. return Ok(JsonView(true, "暂无数据!", _AskData));
  1607. }
  1608. return Ok(JsonView(true, "查询成功!", _AskData));
  1609. }
  1610. catch (Exception ex)
  1611. {
  1612. return Ok(JsonView(false, "程序错误!"));
  1613. throw;
  1614. }
  1615. }
  1616. /// <summary>
  1617. /// 请示数据库操作(Status:1.新增,2.修改)
  1618. /// </summary>
  1619. /// <param name="dto"></param>
  1620. /// <returns></returns>
  1621. [HttpPost]
  1622. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  1623. public async Task<IActionResult> OpAskData(OpAskDataDto dto)
  1624. {
  1625. try
  1626. {
  1627. Result groupData = await _askDataRep.OpAskData(dto);
  1628. if (groupData.Code != 0)
  1629. {
  1630. return Ok(JsonView(false, groupData.Msg));
  1631. }
  1632. return Ok(JsonView(true, groupData.Msg, groupData.Data));
  1633. }
  1634. catch (Exception ex)
  1635. {
  1636. return Ok(JsonView(false, "程序错误!"));
  1637. throw;
  1638. }
  1639. }
  1640. /// <summary>
  1641. /// 删除请示资料信息
  1642. /// </summary>
  1643. /// <param name="dto"></param>
  1644. /// <returns></returns>
  1645. [HttpPost]
  1646. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  1647. public async Task<IActionResult> DelAskData(DelBaseDto dto)
  1648. {
  1649. try
  1650. {
  1651. var res = await _askDataRep.SoftDeleteByIdAsync<Res_AskData>(dto.Id.ToString(), dto.DeleteUserId);
  1652. if (!res)
  1653. {
  1654. return Ok(JsonView(false, "删除失败"));
  1655. }
  1656. return Ok(JsonView(true, "删除成功!"));
  1657. }
  1658. catch (Exception ex)
  1659. {
  1660. return Ok(JsonView(false, "程序错误!"));
  1661. throw;
  1662. }
  1663. }
  1664. /// <summary>
  1665. /// 导出省外办请示
  1666. /// </summary>
  1667. /// <param name="dto"></param>
  1668. /// <returns></returns>
  1669. [HttpPost]
  1670. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  1671. public async Task<IActionResult> AskAdviceDerive(AskAdviceDerive dto)
  1672. {
  1673. try
  1674. {
  1675. string Air = "";//机票信息
  1676. string Area = "";//城市
  1677. string Area2 = "";//城市
  1678. string ClientName = "";//人员
  1679. string ClientName2 = "";//人员
  1680. int ClientNumber =0;//总人数
  1681. string Content = "";//行程安排
  1682. string CountryAndDay = "";//各个国家待的天数
  1683. string Destination = "";//此行目的
  1684. string Destination2 = "";//此行目的
  1685. string Duration = "";//出访时间
  1686. int Durationdays = 0;//出访天数
  1687. int Durationdays2 =0;//出访天数
  1688. string Official = "";//对谁的邀请
  1689. string Temp = "";//出访任务
  1690. string VisitDate = "";//出访日期,多少号到多少号
  1691. return Ok(JsonView(true, "导出成功!"));
  1692. }
  1693. catch (Exception ex)
  1694. {
  1695. return Ok(JsonView(false, "程序错误!"));
  1696. throw;
  1697. }
  1698. }
  1699. /// <summary>
  1700. /// 导出市外办请示
  1701. /// </summary>
  1702. /// <param name="dto"></param>
  1703. /// <returns></returns>
  1704. [HttpPost]
  1705. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  1706. public async Task<IActionResult> AskCityDerive(AskAdviceDerive dto)
  1707. {
  1708. try
  1709. {
  1710. return Ok(JsonView(true, "导出成功!"));
  1711. }
  1712. catch (Exception ex)
  1713. {
  1714. return Ok(JsonView(false, "程序错误!"));
  1715. throw;
  1716. }
  1717. }
  1718. #endregion
  1719. #region 机票黑屏代码
  1720. /// <summary>
  1721. /// 根据团组Id查询黑屏代码列表
  1722. /// </summary>
  1723. /// <param name="dto"></param>
  1724. /// <returns></returns>
  1725. [HttpPost]
  1726. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  1727. public async Task<IActionResult> QueryTicketBlackCodeByDiId(QueryTicketBlackCodeByDiIdDto dto)
  1728. {
  1729. try
  1730. {
  1731. Result groupData = await _ticketBlackCodeRep.QueryTicketBlackCodeByDiId(dto);
  1732. if (groupData.Code != 0)
  1733. {
  1734. return Ok(JsonView(false, groupData.Msg));
  1735. }
  1736. return Ok(JsonView(true, groupData.Msg, groupData.Data));
  1737. }
  1738. catch (Exception ex)
  1739. {
  1740. return Ok(JsonView(false, "程序错误!"));
  1741. throw;
  1742. }
  1743. }
  1744. /// <summary>
  1745. /// 根据黑屏代码数据Id查询信息
  1746. /// </summary>
  1747. /// <param name="dto"></param>
  1748. /// <returns></returns>
  1749. [HttpPost]
  1750. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  1751. public async Task<IActionResult> QueryTicketBlackCodeById(QueryTicketBlackCodeByIdDto dto)
  1752. {
  1753. try
  1754. {
  1755. Result groupData = await _ticketBlackCodeRep.QueryTicketBlackCodeById(dto);
  1756. if (groupData.Code != 0)
  1757. {
  1758. return Ok(JsonView(false, groupData.Msg));
  1759. }
  1760. return Ok(JsonView(true, groupData.Msg, groupData.Data));
  1761. }
  1762. catch (Exception ex)
  1763. {
  1764. return Ok(JsonView(false, "程序错误!"));
  1765. throw;
  1766. }
  1767. }
  1768. /// <summary>
  1769. /// 黑屏代码操作(Status:1.新增,2.修改)
  1770. /// </summary>
  1771. /// <param name="dto"></param>
  1772. /// <returns></returns>
  1773. [HttpPost]
  1774. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  1775. public async Task<IActionResult> OpTicketBlackCode(OpTicketBlackCodeDto dto)
  1776. {
  1777. try
  1778. {
  1779. Result groupData = await _ticketBlackCodeRep.OpTicketBlackCode(dto);
  1780. if (groupData.Code != 0)
  1781. {
  1782. return Ok(JsonView(false, groupData.Msg));
  1783. }
  1784. return Ok(JsonView(true, groupData.Msg, groupData.Data));
  1785. }
  1786. catch (Exception ex)
  1787. {
  1788. return Ok(JsonView(false, "程序错误!"));
  1789. throw;
  1790. }
  1791. }
  1792. /// <summary>
  1793. /// 删除黑屏代码
  1794. /// </summary>
  1795. /// <param name="dto"></param>
  1796. /// <returns></returns>
  1797. [HttpPost]
  1798. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  1799. public async Task<IActionResult> DelTicketBlackCode(DelBaseDto dto)
  1800. {
  1801. try
  1802. {
  1803. var res = await _ticketBlackCodeRep.SoftDeleteByIdAsync<Air_TicketBlackCode>(dto.Id.ToString(), dto.DeleteUserId);
  1804. if (!res)
  1805. {
  1806. return Ok(JsonView(false, "删除失败"));
  1807. }
  1808. return Ok(JsonView(true, "删除成功!"));
  1809. }
  1810. catch (Exception ex)
  1811. {
  1812. return Ok(JsonView(false, "程序错误!"));
  1813. throw;
  1814. }
  1815. }
  1816. #endregion
  1817. }
  1818. }