12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931 |
- using NPOI.HPSF;
- using OASystem.API.OAMethodLib;
- using OASystem.Domain.Dtos.Resource;
- using OASystem.Domain.Entities.Groups;
- using OASystem.Infrastructure.Repositories.Groups;
- using Org.BouncyCastle.Utilities;
- using Quartz.Util;
- using System.Collections.Generic;
- using System.Net.Http.Headers;
- namespace OASystem.API.Controllers
- {
- /// <summary>
- /// 资料相关
- /// </summary>
- //[Authorize]
- [Route("api/[controller]/[action]")]
- public class ResourceController : ControllerBase
- {
- private readonly IMapper _mapper;
- private readonly SqlSugarClient _sqlSugar;
- private readonly IConfiguration _config;
- private readonly CarDataRepository _carDataRep;
- private readonly LocalGuideDataRepository _localGuideDataRep;
- private readonly ThreeCodeRepository _ThreeCodeRep;
- private readonly HotelDataRepository _hotelDataRep;
- private readonly ResItemInfoRepository _resItemInfoRep;
- private readonly SetDataRepository _setDataRepository;
- private readonly CountryFeeRepository _countryFeeRep;
- private readonly SetDataTypeRepository _setDataTypeRep;
- private readonly AirTicketAgentRepository _airTicketAgentRep;
- private readonly InvitationOfficialActivityDataRepository _InvitationOfficialActivityDataRep;
- private readonly OfficialActivitiesRepository _officialActivitiesRep;
- private readonly AskDataRepository _askDataRep;
- private readonly TicketBlackCodeRepository _ticketBlackCodeRep;
- public ResourceController(IMapper mapper, IConfiguration config, SqlSugarClient sqlSugar, CarDataRepository carDataRep,LocalGuideDataRepository localGuideDataRep,
- ThreeCodeRepository threeCodeRep,HotelDataRepository hotelDataRep, ResItemInfoRepository resItemInfoRep, SetDataRepository setDataRepository,
- CountryFeeRepository countryFeeRep, SetDataTypeRepository setDataTypeRep, AirTicketAgentRepository airTicketAgentRep,
- InvitationOfficialActivityDataRepository invitationOfficialActivityDataRep, OfficialActivitiesRepository officialActivitiesRep, AskDataRepository askDataRep,
- TicketBlackCodeRepository ticketBlackCodeRep)
- {
- _mapper = mapper;
- _config = config;
- _sqlSugar = sqlSugar;
- _carDataRep = carDataRep;
- _localGuideDataRep = localGuideDataRep;
- _ThreeCodeRep = threeCodeRep;
- _hotelDataRep = hotelDataRep;
- _resItemInfoRep = resItemInfoRep;
- _setDataRepository = setDataRepository;
- _countryFeeRep = countryFeeRep;
- _setDataTypeRep = setDataTypeRep;
- _airTicketAgentRep = airTicketAgentRep;
- _InvitationOfficialActivityDataRep = invitationOfficialActivityDataRep;
- _officialActivitiesRep = officialActivitiesRep;
- _askDataRep = askDataRep;
- _ticketBlackCodeRep=ticketBlackCodeRep;
- }
- #region 车公司资料板块
- /// <summary>
- /// 车公司信息查询
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> QueryCarData(QueryCarDataDto dto)
- {
- try
- {
- Result LocalGuide = await _carDataRep.QueryCarData(dto);
- if (LocalGuide.Code == 0)
- {
- return Ok(JsonView(true, "查询成功", LocalGuide.Data));
- }
- else
- {
- return Ok(JsonView(false, LocalGuide.Msg));
- }
- }
- catch (Exception)
- {
- return Ok(JsonView(false, "程序错误!"));
- throw;
- }
- }
- /// <summary>
- /// 车公司资料下拉框数据
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> QueryCarSelect()
- {
- try
- {
- var CarData = _carDataRep.QueryDto<Res_CarData, CarDataSelectView>().ToList();
- if (CarData.Count == 0)
- {
- return Ok(JsonView(false, "暂无数据!"));
- }
- CarData.Add(new CarDataSelectView { Id = 0, UnitArea = "全部" });
- CarData = CarData.Where((x, i) => CarData.FindIndex(z => z.UnitArea == x.UnitArea) == i).ToList();
- CarData = CarData.OrderBy(x => x.Id).ToList();
- List<CarDataSelectView> data = new List<CarDataSelectView>();
- foreach (CarDataSelectView car in CarData)
- {
- if (!string.IsNullOrWhiteSpace(car.UnitArea))
- {
- data.Add(car);
- }
- }
- return Ok(JsonView(true, "查询成功", data));
- }
- catch (Exception)
- {
- return Ok(JsonView(false, "程序错误!"));
- throw;
- }
- }
- /// <summary>
- /// 车公司信息添加
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> AddCarData(AddCarDataDto dto)
- {
- try
- {
- if (dto.UnitArea == "")
- {
- return Ok(JsonView(false, "请检查单位区域是否填写!"));
- }
- if (dto.UnitName == "")
- {
- return Ok(JsonView(false, "请检查单位名称是否填写!"));
- }
- if (dto.Contact == "")
- {
- return Ok(JsonView(false, "请检查单位联系人是否填写!"));
- }
- if (dto.ContactTel == "")
- {
- return Ok(JsonView(false, "请检查联系方式是否填写正确!"));
- }
- 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();
- if (carDada.Count != 0)
- {
- return Ok(JsonView(false, "该信息已存在,请勿重复添加!"));
- }
- Res_CarData _CarData = _mapper.Map<Res_CarData>(dto);
- int id = await _carDataRep.AddAsyncReturnId(_CarData);
- if (id == 0)
- {
- return Ok(JsonView(false, "添加失败!"));
- }
- return Ok(JsonView(true, "添加成功", new { Id = id }));
- }
- catch (Exception ex)
- {
- return Ok(JsonView(false, "程序错误!"));
- throw;
- }
- }
- /// <summary>
- /// 车公司信息修改
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> UpCarData(UpCarDataDto dto)
- {
- try
- {
- if (dto.UnitArea == "")
- {
- return Ok(JsonView(false, "请检查单位区域是否填写!"));
- }
- if (dto.UnitName == "")
- {
- return Ok(JsonView(false, "请检查单位名称是否填写!"));
- }
- if (dto.Contact == "")
- {
- return Ok(JsonView(false, "请检查单位联系人是否填写!"));
- }
- if (dto.ContactTel == "")
- {
- return Ok(JsonView(false, "请检查联系方式是否填写正确!"));
- }
- bool res = await _carDataRep.UpdateAsync(a => a.Id == dto.Id, a => new Res_CarData
- {
- UnitArea = dto.UnitArea,
- UnitName = dto.UnitName,
- Address = dto.Address,
- Contact = dto.Contact,
- ContactTel = dto.ContactTel,
- ContactEmail = dto.ContactEmail,
- ContactFax = dto.ContactFax,
- CarDes = dto.CarDes,
- CarPicPaths = dto.CarPicPaths,
- OtherInfo = dto.OtherInfo,
- Score = dto.Score,
- QualificationScore = dto.QualificationScore,
- CarAgeScore = dto.CarAgeScore,
- CleanImgScore = dto.CleanImgScore,
- SmellScore = dto.SmellScore,
- WaterPaperScore = dto.WaterPaperScore,
- HardwareScore = dto.HardwareScore,
- TimeScore = dto.TimeScore,
- SafetyScore = dto.SafetyScore,
- DrivingAgeScore = dto.DrivingAgeScore,
- Remark = dto.Remark,
- });
- if (!res) { return Ok(JsonView(false, "修改失败!")); }
- return Ok(JsonView(true, "修改成功"));
- }
- catch (Exception ex)
- {
- return Ok(JsonView(false, "程序错误!"));
- throw;
- }
- }
- /// <summary>
- /// 车公司信息删除
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> DelCarData(DelCarDataDto dto)
- {
- try
- {
- bool res = await _carDataRep.SoftDeleteByIdAsync<Res_CarData>(dto.Id.ToString(), dto.DeleteUserId);
- if (!res) { return Ok(JsonView(false, "删除失败!")); }
- return Ok(JsonView(true, "删除成功"));
- }
- catch (Exception ex)
- {
- return Ok(JsonView(false, "程序错误!"));
- throw;
- }
- }
- #endregion
- #region 导游地接资料板块
- /// <summary>
- /// 导游地接资料查询
- /// </summary>
- /// <param name="dto"></param>
- /// <returns></returns>
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> QueryLocalGuide(QueryLocalGuide dto)
- {
- try
- {
- Result LocalGuide = await _localGuideDataRep.QueryLocalGuide(dto);
- if (LocalGuide.Code == 0)
- {
- return Ok(JsonView(true, "查询成功", LocalGuide.Data));
- }
- else
- {
- return Ok(JsonView(false, LocalGuide.Msg));
- }
- }
- catch (Exception ex)
- {
- return Ok(JsonView(false, "程序错误!"));
- throw;
- }
- }
- /// <summary>
- /// 导游地接资料下拉框数据
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> QueryLocalGuideSelect()
- {
- try
- {
- var LocalGuide = _carDataRep.QueryDto<Res_LocalGuideData, QueryLocalGuideSelectView>().ToList();
- if (LocalGuide.Count == 0)
- {
- return Ok(JsonView(false, "暂无数据!"));
- }
- LocalGuide.Add(new QueryLocalGuideSelectView { Id = 0, UnitArea = "全部" });
- LocalGuide = LocalGuide.Where((x, i) => LocalGuide.FindIndex(z => z.UnitArea == x.UnitArea && z.UnitArea != "") == i).ToList();
- LocalGuide = LocalGuide.OrderBy(x => x.Id).ToList();
- List<QueryLocalGuideSelectView> data = new List<QueryLocalGuideSelectView>();
- foreach (QueryLocalGuideSelectView Local in LocalGuide)
- {
- if (!string.IsNullOrWhiteSpace(Local.UnitArea))
- {
- data.Add(Local);
- }
- }
- return Ok(JsonView(true, "查询成功", data));
- }
- catch (Exception)
- {
- return Ok(JsonView(false, "程序错误!"));
- throw;
- }
- }
- /// <summary>
- /// 导游地接信息操作(Status:1.新增,2.修改)
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> OperationLocalGuide(LocalGuideOperationDto dto)
- {
- try
- {
- if (dto.UnitArea == "")
- {
- return Ok(JsonView(false, "请检查单位区域是否填写!"));
- }
- if (dto.UnitName == "")
- {
- return Ok(JsonView(false, "请检查单位名称是否填写!"));
- }
- if (dto.Contact == "")
- {
- return Ok(JsonView(false, "请检查单位联系人是否填写!"));
- }
- if (dto.ContactTel == "")
- {
- return Ok(JsonView(false, "请检查联系方式是否填写正确!"));
- }
- Result result = await _localGuideDataRep.LocalGuideOperation(dto);
- if (result.Code != 0)
- {
- return Ok(JsonView(false, result.Msg));
- }
- return Ok(JsonView(true, result.Msg));
- }
- catch (Exception ex)
- {
- return Ok(JsonView(false, "程序错误!"));
- throw;
- }
- }
- /// <summary>
- /// 导游地接信息操作(删除)
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> DelLocalGuide(LocalGuideDelDto dto)
- {
- try
- {
- var res = await _localGuideDataRep.SoftDeleteByIdAsync<Res_LocalGuideData>(dto.Id.ToString(), dto.DeleteUserId);
- if (!res)
- {
- return Ok(JsonView(false, "删除失败"));
- }
- return Ok(JsonView(true, "删除成功!"));
- }
- catch (Exception ex)
- {
- return Ok(JsonView(false, "程序错误!"));
- throw;
- }
- }
- #endregion
- #region 机场三字码信息
- /// <summary>
- /// 机场三字码查询
- /// </summary>
- /// <param name="dto"></param>
- /// <returns></returns>
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> QueryThreeCode(QueryThreeCodeDto dto)
- {
- try
- {
- Result LocalGuide = await _ThreeCodeRep.QueryThreeCode(dto);
- if (LocalGuide.Code == 0)
- {
- return Ok(JsonView(true, "查询成功", LocalGuide.Data));
- }
- else
- {
- return Ok(JsonView(false, LocalGuide.Msg));
- }
- }
- catch (Exception ex)
- {
- return Ok(JsonView(false, "程序错误!"));
- throw;
- }
- }
- /// <summary>
- /// 机场三字码数据城市下拉框数据
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> QueryThreeCodeSelect()
- {
- try
- {
- var ThreeCode = _carDataRep.QueryDto<Res_ThreeCode, ThreeCodeSelectView>().ToList();
- if (ThreeCode.Count == 0)
- {
- return Ok(JsonView(false, "暂无数据!"));
- }
- ThreeCode.Add(new ThreeCodeSelectView { Id = 0, City = "全部" });
- ThreeCode = ThreeCode.Where((x, i) => ThreeCode.FindIndex(z => z.City == x.City && z.City != "") == i).ToList();
- ThreeCode = ThreeCode.OrderBy(x => x.Id).ToList();
- List<ThreeCodeSelectView> data = new List<ThreeCodeSelectView>();
- foreach (ThreeCodeSelectView _ThreeCode in ThreeCode)
- {
- if (!string.IsNullOrWhiteSpace(_ThreeCode.City))
- {
- data.Add(_ThreeCode);
- }
- }
- return Ok(JsonView(true, "查询成功", data));
- }
- catch (Exception)
- {
- return Ok(JsonView(false, "程序错误!"));
- throw;
- }
- }
- /// <summary>
- /// 机场三字码资料操作(Status:1.新增,2.修改)
- /// </summary>
- /// <param name="dto"></param>
- /// <returns></returns>
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> OperationThreeCode(ThreeCodeOperationDto dto)
- {
- try
- {
- if (dto.Three == "")
- {
- return Ok(JsonView(false, "请检查三字码是否填写!"));
- }
- if (dto.Country == "")
- {
- return Ok(JsonView(false, "请检查国家是否填写!"));
- }
- if (dto.City == "")
- {
- return Ok(JsonView(false, "请检查城市是否填写正确!"));
- }
- if (dto.AirPort == "")
- {
- return Ok(JsonView(false, "请检查机场是否填写正确!"));
- }
- Result result = await _ThreeCodeRep.ThreeCodeOperation(dto);
- if (result.Code != 0)
- {
- return Ok(JsonView(false, result.Msg));
- }
- return Ok(JsonView(true, result.Msg));
- }
- catch (Exception ex)
- {
- return Ok(JsonView(false, "程序错误!"));
- throw;
- }
- }
- /// <summary>
- /// 机场三字码资料操作(删除)
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> DelThreeCode(ThreeCodeDelDto dto)
- {
- try
- {
- var res = await _ThreeCodeRep.SoftDeleteByIdAsync<Res_ThreeCode>(dto.Id.ToString(), dto.DeleteUserId);
- if (!res)
- {
- return Ok(JsonView(false, "删除失败"));
- }
- return Ok(JsonView(true, "删除成功!"));
- }
- catch (Exception ex)
- {
- return Ok(JsonView(false, "程序错误!"));
- throw;
- }
- }
- #endregion
- #region 代理出票合作方资料
- /// <summary>
- /// 代理出票合作方资料
- /// </summary>
- /// <param name="dto"></param>
- /// <returns></returns>
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> QueryAirTicketAgent(DtoBase dto)
- {
- try
- {
- List<Res_AirTicketAgent> res_AirTicketAgents = _airTicketAgentRep.Query<Res_AirTicketAgent>(a => a.IsDel == 0).ToList();
- if (res_AirTicketAgents.Count != 0)
- {
- res_AirTicketAgents = res_AirTicketAgents.OrderByDescending(a => a.CreateTime).ToList();
- if (dto.PageSize == 0 && dto.PageIndex == 0)
- {
- return Ok(JsonView(true, "查询成功!", res_AirTicketAgents));
- }
- else
- {
- int count = res_AirTicketAgents.Count;
- float totalPage = (float)count / dto.PageSize;//总页数
- if (totalPage == 0) totalPage = 1;
- else totalPage = (int)Math.Ceiling((double)totalPage);
- List<Res_AirTicketAgent> _AirTicketAgent = new List<Res_AirTicketAgent>();
- for (int i = 0; i < dto.PageSize; i++)
- {
- var RowIndex = i + (dto.PageIndex - 1) * dto.PageSize;
- if (RowIndex < res_AirTicketAgents.Count)
- {
- _AirTicketAgent.Add(res_AirTicketAgents[RowIndex]);
- }
- else
- {
- break;
- }
- }
- return Ok(JsonView(true, "查询成功!", new { pageCount = count, totalPage = (int)totalPage, pageIndex = dto.PageIndex, pageSize = dto.PageSize, pageSource = _AirTicketAgent }));
- }
- }
- else
- {
- return Ok(JsonView(false, "暂无数据!"));
- }
- }
- catch (Exception ex)
- {
- return Ok(JsonView(false, "程序错误!"));
- throw;
- }
- }
- /// <summary>
- /// 代理出票合作方资料操作(Status:1.新增,2.修改)
- /// </summary>
- /// <param name="dto"></param>
- /// <returns></returns>
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> OpAirTicketAgent(OpAirTicketAgentDto dto)
- {
- try
- {
- if (dto.Account == "")
- {
- return Ok(JsonView(false, "请检查代理商账户是否填写!"));
- }
- if (dto.Bank == "")
- {
- return Ok(JsonView(false, "请检查代理商银行是否填写!"));
- }
- if (dto.Name == "")
- {
- return Ok(JsonView(false, "请检查代理商名称是否填写正确!"));
- }
- Result result = await _airTicketAgentRep.OpAirTicketAgent(dto);
- if (result.Code != 0)
- {
- return Ok(JsonView(false, result.Msg));
- }
- return Ok(JsonView(true, result.Msg));
- }
- catch (Exception ex)
- {
- return Ok(JsonView(false, "程序错误!"));
- throw;
- }
- }
- /// <summary>
- /// 代理出票合作方资料操作(删除)
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> DelAirTicketAgent(DelBaseDto dto)
- {
- try
- {
- var res = await _airTicketAgentRep.SoftDeleteByIdAsync<Res_AirTicketAgent>(dto.Id.ToString(), dto.DeleteUserId);
- if (!res)
- {
- return Ok(JsonView(false, "删除失败"));
- }
- return Ok(JsonView(true, "删除成功!"));
- }
- catch (Exception ex)
- {
- return Ok(JsonView(false, "程序错误!"));
- throw;
- }
- }
- #endregion
- #region 酒店资料数据
- /// <summary>
- /// 酒店信息查询
- /// </summary>
- /// <param name="dto"></param>
- /// <returns></returns>
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> QueryHotelData(QueryHotelDataDto dto)
- {
- try
- {
- Result hotelData = await _hotelDataRep.QueryHotelData(dto);
- if (hotelData.Code == 0)
- {
- return Ok(JsonView(true, "查询成功", hotelData.Data));
- }
- else
- {
- return Ok(JsonView(false, hotelData.Msg));
- }
- }
- catch (Exception ex)
- {
- return Ok(JsonView(false, "程序错误!"));
- throw;
- }
- }
- /// <summary>
- /// 酒店资料下拉框数据
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> QueryHotelDataSelect()
- {
- try
- {
- var HotelData = _carDataRep.QueryDto<Res_HotelData, QueryHotelDataSelect>().ToList();
- if (HotelData.Count == 0)
- {
- return Ok(JsonView(false, "暂无数据!"));
- }
- HotelData.Add(new QueryHotelDataSelect { Id = 0, City = "全部" });
- HotelData = HotelData.Where((x, i) => HotelData.FindIndex(z => z.City == x.City && z.City != "") == i).ToList();
- HotelData = HotelData.OrderBy(x => x.Id).ToList();
- List<QueryHotelDataSelect> data = new List<QueryHotelDataSelect>();
- foreach (QueryHotelDataSelect Hotel in HotelData)
- {
- if (!string.IsNullOrWhiteSpace(Hotel.City))
- {
- data.Add(Hotel);
- }
- }
- return Ok(JsonView(true, "查询成功", data));
- }
- catch (Exception)
- {
- return Ok(JsonView(false, "程序错误!"));
- throw;
- }
- }
- /// <summary>
- /// 酒店资料操作(Status:1.新增,2.修改)
- /// </summary>
- /// <param name="dto"></param>
- /// <returns></returns>
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> OperationHotelData(OperationHotelDto dto)
- {
- try
- {
- if (dto.City == "")
- {
- return Ok(JsonView(false, "请检查酒店所在城市是否填写!"));
- }
- if (dto.Name == "")
- {
- return Ok(JsonView(false, "请检查酒店名称是否填写!"));
- }
- if (dto.Address == "")
- {
- return Ok(JsonView(false, "请检查酒店地址是否填写正确!"));
- }
- if (dto.Tel == "")
- {
- return Ok(JsonView(false, "请检查酒店联系方式是否填写正确!"));
- }
- Result result = await _hotelDataRep.OperationHotelData(dto);
- if (result.Code != 0)
- {
- return Ok(JsonView(false, result.Msg));
- }
- return Ok(JsonView(true, result.Msg));
- }
- catch (Exception ex)
- {
- return Ok(JsonView(false, "程序错误!"));
- throw;
- }
- }
- /// <summary>
- /// 酒店资料操作(删除)
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> DelHotelData(DelHotelDataDto dto)
- {
- try
- {
- var res = await _hotelDataRep.SoftDeleteByIdAsync<Res_HotelData>(dto.Id.ToString(), dto.DeleteUserId);
- if (!res)
- {
- return Ok(JsonView(false, "删除失败"));
- }
- return Ok(JsonView(true, "删除成功!"));
- }
- catch (Exception ex)
- {
- return Ok(JsonView(false, "程序错误!"));
- throw;
- }
- }
- #endregion
- #region 签证费用资料
- /// <summary>
- /// 签证费用资料查询
- /// </summary>
- /// <param name="dto"></param>
- /// <returns></returns>
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> QueryCountryFeeCost(DtoBase dto)
- {
- try
- {
- if (dto.PortType == 1)
- {
- var CountryFee = _countryFeeRep.QueryDto<Res_CountryFeeCost, CountryFeeCostView>().ToList();
- if (CountryFee.Count == 0)
- {
- return Ok(JsonView(false, "暂无数据!"));
- }
- CountryFee = CountryFee.OrderByDescending(s => s.CreateTime).ToList();
- return Ok(JsonView(true, "查询成功", CountryFee));
- }
- else if (dto.PortType == 2)
- {
- var CountryFee = _countryFeeRep.QueryDto<Res_CountryFeeCost, CountryFeeCostView>().ToList();
- if (CountryFee.Count == 0)
- {
- return Ok(JsonView(false, "暂无数据!"));
- }
- CountryFee = CountryFee.OrderByDescending(s => s.CreateTime).ToList();
- return Ok(JsonView(true, "查询成功", CountryFee));
- }
- else
- {
- return Ok(JsonView(false, "请传入PortType参数!1:Web,2:Android,3:IOS"));
- }
- }
- catch (Exception ex)
- {
- return Ok(JsonView(false, "程序错误!"));
- throw;
- }
- }
- /// <summary>
- /// 签证费用资料操作(Status:1.新增,2.修改)
- /// </summary>
- /// <param name="dto"></param>
- /// <returns></returns>
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> OperationCountryFeeCost(OperationCountryFeeCostDto dto)
- {
- try
- {
- if (dto.VisaContinent == "")
- {
- return Ok(JsonView(false, "请检查州名是否填写!"));
- }
- if (dto.VisaCountry == "")
- {
- return Ok(JsonView(false, "请检查国家名是否填写!"));
- }
- if (dto.VisaTime == "1")
- {
- return Ok(JsonView(false, "请检一般签证时间是否填写正确!"));
- }
- if (dto.UrgentTime == "1")
- {
- return Ok(JsonView(false, "请检加急时间是否填写正确!"));
- }
- if (dto.VisaPrice == 0)
- {
- return Ok(JsonView(false, "请检查签证费用是否填写正确,小数点后可1到2位!"));
- }
- if (dto.VisaPrice == 1)
- {
- return Ok(JsonView(false, "请检查签证加急费用是否填写正确,小数点后可1到2位!"));
- }
- Result result = await _countryFeeRep.OperationCountryFeeCost(dto);
- if (result.Code != 0)
- {
- return Ok(JsonView(false, result.Msg));
- }
- return Ok(JsonView(true, result.Msg));
- }
- catch (Exception ex)
- {
- return Ok(JsonView(false, "程序错误!"));
- throw;
- }
- }
- /// <summary>
- /// 签证费用资料操作(删除)
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> DelCountryFeeCost(DelCountryFeeCostDto dto)
- {
- try
- {
- var res = await _countryFeeRep.SoftDeleteByIdAsync<Res_CountryFeeCost>(dto.Id.ToString(), dto.DeleteUserId);
- if (!res)
- {
- return Ok(JsonView(false, "删除失败"));
- }
- return Ok(JsonView(true, "删除成功!"));
- }
- catch (Exception ex)
- {
- return Ok(JsonView(false, "程序错误!"));
- throw;
- }
- }
- #endregion
- #region 物料信息、供应商维护
- #region 供应商
- /// <summary>
- /// 物料供应商查询
- /// </summary>
- /// <param name="paras">Json序列化</param>
- /// <returns></returns>
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> PostSearchItemVendor(JsonDtoBase _jsonDto)
- {
- if (string.IsNullOrEmpty(_jsonDto.Paras))
- {
- return Ok(JsonView(false, "参数为空"));
- }
- Search_ResItemVendorDto _ItemVendorDto = System.Text.Json.JsonSerializer.Deserialize<Search_ResItemVendorDto>(_jsonDto.Paras);
- if (_ItemVendorDto != null)
- {
- if (_ItemVendorDto.SearchType == 2) //获取列表
- {
- Res_ItemVendorListView rstList = _resItemInfoRep.GetVendorList(_ItemVendorDto);
- return Ok(rstList);
- }
- else
- {
- Res_ItemVendorView rstInfo = _resItemInfoRep.getVendorInfo(_ItemVendorDto);
- return Ok(rstInfo);
- }
- }
- else
- {
- return Ok(JsonView(false, "参数反序列化失败"));
- }
- return Ok(JsonView(false));
- }
- /// <summary>
- /// 创建/编辑/删除供应商信息
- /// </summary>
- /// <param name="_dto"></param>
- /// <returns></returns>
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> PostEditItemVendor(Edit_ResItemVendorDto _dto)
- {
- bool rst = false;
- if (_dto.EditType >= 0)
- {
- if (string.IsNullOrEmpty(_dto.VendorFullName))
- {
- return Ok(JsonView(false, "全称未填写"));
- }
- if (string.IsNullOrEmpty(_dto.VendorLinker))
- {
- return Ok(JsonView(false, "联系人未填写"));
- }
- if (string.IsNullOrEmpty(_dto.VendorMobile))
- {
- return Ok(JsonView(false, "联系人手机号未填写"));
- }
- if (string.IsNullOrEmpty(_dto.BusRange))
- {
- return Ok(JsonView(false, "经营范围未选择"));
- }
- if (_dto.EditType == 0)
- {
- var checkEmpty = _resItemInfoRep.Query<Res_ItemVendor>(s => s.FullName == _dto.VendorFullName).First();
- if (checkEmpty != null)
- {
- return Ok(JsonView(false, "已存在同名供应商"));
- }
- rst = await _resItemInfoRep.addVendorInfo(_dto);
- }
- else if (_dto.EditType == 1)
- {
- if (_dto.VendorId > 0)
- {
- Res_ItemVendor _entity = _mapper.Map<Res_ItemVendor>(_dto);
- rst = await _resItemInfoRep.updVendorInfo(_entity);
- }
- else
- {
- return Ok(JsonView(false, "供应商不存在"));
- }
- }
- }
- else
- {
- if (_dto.VendorId < 1 || _dto.SysUserId < 1)
- {
- return Ok(JsonView(false, "用户Id或供应商Id不存在"));
- }
- Res_ItemVendor _entity = _mapper.Map<Res_ItemVendor>(_dto);
- rst = await _resItemInfoRep.delVendorInfo(_entity);
- }
- return Ok(JsonView(rst));
- }
- #endregion
- #region 物料信息
- /// <summary>
- /// 物料信息查询
- /// </summary>
- /// <param name="paras">Json序列化</param>
- /// <returns></returns>
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> PostSearchItemInfo(string paras)
- {
- if (string.IsNullOrEmpty(paras))
- {
- return Ok(JsonView(false, "参数为空"));
- }
- Search_ItemInfoDto _ItemInfoDto = System.Text.Json.JsonSerializer.Deserialize<Search_ItemInfoDto>(paras);
- if (_ItemInfoDto != null)
- {
- if (_ItemInfoDto.SearchType == 2) //获取列表
- {
- Res_ItemInfoListView rstList = _resItemInfoRep.GetItemList(_ItemInfoDto);
- return Ok(rstList);
- }
- else
- {
- Res_ItemInfoView rstInfo = _resItemInfoRep.getItemInfo(_ItemInfoDto);
- return Ok(rstInfo);
- }
- }
- else
- {
- return Ok(JsonView(false, "参数反序列化失败"));
- }
- return Ok(JsonView(false));
- }
- /// <summary>
- /// 创建/编辑/删除物料信息
- /// </summary>
- ///
- /// <returns></returns>
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> PostEditItemInfo(Edit_ResItemInfoDto _dto)
- {
- bool rst = false;
- if (_dto.EditType >= 0)
- {
- if (_dto.VendorId < 1)
- {
- return Ok(JsonView(false, "未选择供应商"));
- }
- if (string.IsNullOrEmpty(_dto.ItemName))
- {
- return Ok(JsonView(false, "物料名称为空"));
- }
- if (_dto.ItemTypeId < 1)
- {
- return Ok(JsonView(false, "未选择物料类型"));
- }
- if (_dto.SysUserId < 1)
- {
- return Ok(JsonView(false, "当前操作用户Id为空"));
- }
- if (_dto.CurrRate <= 0)
- {
- return Ok(JsonView(false, "物料录入价格不能小于等于0"));
- }
- if (_dto.EditType == 0)
- {
- //判断物料名称、类型、供应商全部重复
- var checkEmpty = _resItemInfoRep.Query<Res_ItemDetailInfo>(s => s.ItemName == _dto.ItemName && s.ItemTypeId == _dto.ItemTypeId && s.VendorId == _dto.VendorId).First();
- if (checkEmpty != null)
- {
- return Ok(JsonView(false, "已存在重复物料信息"));
- }
- Res_ItemDetailInfo _entity = _mapper.Map<Res_ItemDetailInfo>(_dto);
- DateTime dtNow = DateTime.Now;
- _entity.CreateUserId = _dto.SysUserId;
- _entity.IsDel = 0;
- _entity.MaxRate = _dto.CurrRate;
- _entity.MaxDt = dtNow;
- _entity.CurrRate = _dto.CurrRate;
- _entity.CurrDt = dtNow;
- _entity.MinRate = _dto.CurrRate;
- _entity.MinDt = dtNow;
- rst = await _resItemInfoRep.AddAsync<Res_ItemDetailInfo>(_entity) > 0;
- }
- else if (_dto.EditType == 1)
- {
- if (_dto.ItemId > 0)
- {
- Res_ItemDetailInfo _entity = _mapper.Map<Res_ItemDetailInfo>(_dto);
- _entity.Id = _dto.ItemId;
- rst = await _resItemInfoRep.updItemInfo(_entity);
- }
- else
- {
- return Ok(JsonView(false, "供应商不存在"));
- }
- }
- }
- else
- {
- if (_dto.ItemId < 1 || _dto.SysUserId < 1)
- {
- return Ok(JsonView(false, "用户Id或物料信息Id不存在"));
- }
- Res_ItemDetailInfo _entity = _mapper.Map<Res_ItemDetailInfo>(_dto);
- rst = await _resItemInfoRep.delItemInfo(_entity);
- }
- return Ok(JsonView(rst));
- }
- #endregion
- #region 物料类型获取
- #endregion
- #endregion
- #region 备忘录
- /// <summary>
- /// 备忘录查询
- /// </summary>
- /// <param name="paras">Json序列化</param>
- /// <returns></returns>
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> PostSearchMemo(JsonDtoBase _jsonDto)
- {
- if (string.IsNullOrEmpty(_jsonDto.Paras))
- {
- return Ok(JsonView(false, "参数为空"));
- }
- Search_ResMemoDto _memoDto = JsonConvert.DeserializeObject<Search_ResMemoDto>(_jsonDto.Paras);
- if (_memoDto != null)
- {
- if (_memoDto.SearchType == 2)
- {
- //获取列表
- string sqlWhere = string.Format(" Where IsDel=0 ");
- #region SqlWhere
- if (!string.IsNullOrEmpty(_memoDto.Abstracts))
- {
- sqlWhere += string.Format(@" And m.Abstracts Like '%{0}%' ", _memoDto.Abstracts);
- }
- if (!string.IsNullOrEmpty(_memoDto.Title))
- {
- sqlWhere += string.Format(@" And m.Title Like '%{0}%' ", _memoDto.Title);
- }
- if (_memoDto.ReadLevel > 0)
- {
- sqlWhere += string.Format(@" And m.ReadLevel = {0} ", _memoDto.ReadLevel);
- }
- #endregion
- int currPIndex = (((_memoDto.PageIndex > 0) ? (_memoDto.PageIndex - 1) : 0) * _memoDto.PageSize) + 1;
- int currPSize = (((_memoDto.PageIndex > 0) ? (_memoDto.PageIndex - 1) : 0) + 1) * _memoDto.PageSize;
- string sql = string.Format(@" Select * From(Select ROW_NUMBER() Over(order By m.Id desc) as RowNumber,
- m.Id as MemoId,d.DepName as DepartmentName,m.ReadLevel,m.Title,m.Abstracts,
- m.LastedEditDt,m.LastedEditorId
- From Res_Memo as m With(Nolock) Inner Join Sys_Users as u With(Nolock) On m.CreateUserId=u.Id
- Inner Join Sys_Department as d With(Nolock) On u.DepId=d.Id {2}
- ) as tb Where tb.RowNumber Between {0} And {1} ", currPIndex, currPSize, sqlWhere);
- Res_MemoListView rst = new Res_MemoListView();
- rst.CurrPageIndex = currPIndex;
- rst.CurrPageSize = currPSize;
- List<Res_MemoView> dataSource = _carDataRep._sqlSugar.SqlQueryable<Res_MemoView>(sql).ToList();
- Dictionary<int, string> userDic = new Dictionary<int, string>();
- foreach (var item in dataSource)
- {
- if (userDic.ContainsKey(item.LastedEditorId))
- {
- item.LastedEditor = userDic[item.LastedEditorId];
- }
- else
- {
- Sys_Users _sysUser = _carDataRep.Query<Sys_Users>(s => s.Id == item.LastedEditorId).First();
- userDic[item.LastedEditorId] = _sysUser.CnName;
- item.LastedEditor = _sysUser.CnName;
- }
- }
- rst.DataList = new List<Res_MemoView>(dataSource);
- if (rst.DataList.Count > 0)
- {
- string sqlCount = string.Format(@" Select Id From Res_Memo as m With(Nolock) {0} ", sqlWhere);
- int dataCount = _carDataRep._sqlSugar.SqlQueryable<Res_MemoInfo>(sqlCount).Count();
- rst.DataCount = dataCount;
- }
- return Ok(JsonView(rst));
- }
- else
- {
- //获取对象
- string sqlSingle = string.Format(@" Select
- m.Id as MemoId,d.DepName as DepartmentName,m.ReadLevel,m.Title,m.Abstracts,
- m.LastedEditDt,m.LastedEditor,m.MDFilePath
- From Res_Memo as m With(Nolock) Inner Join Sys_Users as u With(Nolock) On m.CreateUserId=u.Id
- Inner Join Sys_Department as d With(Nolock) On u.DepId=d.Id Where m.Id={0} ", _memoDto.MemoId);
- Res_MemoView _result = _carDataRep._sqlSugar.SqlQueryable<Res_MemoView>(sqlSingle).First();
- if (_result != null)
- {
- Sys_Users _sysUser = _carDataRep.Query<Sys_Users>(s => s.Id == _result.LastedEditorId).First();
- _result.LastedEditor = _sysUser.CnName;
- _result.MarkDownContent = new IOOperatorHelper().Read(_result.MDFilePath);
- return Ok(JsonView(_result));
- }
- }
- }
- else
- {
- return Ok(JsonView(false, "参数反序列化失败"));
- }
- return Ok(JsonView(false));
- }
- /// <summary>
- /// 创建/编辑/删除备忘录信息
- /// </summary>
- /// <param name="_dto"></param>
- /// <returns></returns>
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> PostEditMemo(Edit_ResMemoDto _dto)
- {
- bool rst = false;
- if (_dto.SysUserId < 1)
- {
- return Ok(JsonView(false, "操作人失效"));
- }
- Sys_Users _sysUser = _resItemInfoRep.Query<Sys_Users>(s => s.Id == _dto.SysUserId).First();
- if (_sysUser == null)
- {
- return Ok(JsonView(false, "操作人失效02"));
- }
- if (_dto.EditType >= 0)
- {
- if (_dto.ReadLevel < 1)
- {
- return Ok(JsonView(false, "未知的阅读等级"));
- }
- if (string.IsNullOrEmpty(_dto.Title.Trim()))
- {
- return Ok(JsonView(false, "标题不能为空"));
- }
- if (string.IsNullOrEmpty(_dto.Content.Trim()))
- {
- return Ok(JsonView(false, "正文内容不能为空"));
- }
- //新增备忘录
- DateTime dtNow = DateTime.Now;
- string dir = AppSettingsHelper.Get("MemoCurrPath");
- string fileName = dtNow.ToString("yyyyMMddHHmmss") + _dto.Title + ".md";
- string content = JsonConvert.SerializeObject(_dto.Content);
- if (_dto.EditType == 0)//新增
- {
- string savePath = new IOOperatorHelper().Write_CoverFile(content, dir, fileName);
- if (savePath.Length > 0)
- {
- Res_MemoInfo _insert = new Res_MemoInfo();
- _insert.Abstracts = _dto.Abstracts;
- _insert.Title = _dto.Title;
- _insert.DepartmentId = _sysUser.DepId;
- _insert.CreateUserId = _sysUser.Id;
- _insert.LastedEditDt = dtNow;
- _insert.LastedEditor = _sysUser.Id;
- _insert.MDFilePath = savePath;
- _insert.ReadLevel = _dto.ReadLevel;
- _insert.Title = _dto.Title;
- int result = await _resItemInfoRep.AddAsync(_insert);
- return Ok(JsonView(result > 0));
- }
- else
- {
- return Ok(JsonView(false, "路径保存失败"));
- }
- }
- else//修改
- {
- if (_dto.MemoId < 1)
- {
- return Ok(JsonView(false, "MemoId不存在"));
- }
- Res_MemoInfo _source = _resItemInfoRep.Query<Res_MemoInfo>(s => s.Id == _dto.MemoId).First();
- if (_source == null)
- {
- return Ok(JsonView(false, "MemoInfo不存在"));
- }
- //修改
- string sourcePath = _source.MDFilePath;
- string recycDir = AppSettingsHelper.Get("MemoRecycleBinPath");
- new IOOperatorHelper().MoveFile(sourcePath, recycDir);
- string savePath = new IOOperatorHelper().Write_CoverFile(content, dir, fileName);
- if (savePath.Length > 0)
- {
- var result = await _resItemInfoRep._sqlSugar.Updateable<Res_MemoInfo>()
- .SetColumns(it => it.LastedEditDt == DateTime.Now)
- .SetColumns(it => it.LastedEditor == _sysUser.Id)
- .SetColumns(it => it.Abstracts == _dto.Abstracts)
- .SetColumns(it => it.MDFilePath == savePath)
- .SetColumns(it => it.ReadLevel == _dto.ReadLevel)
- .SetColumns(it => it.Title == _dto.Title)
- .Where(s => s.Id == _source.Id)
- .ExecuteCommandAsync();
- return Ok(JsonView(result > 0));
- }
- }
- }
- else
- {
- //删除
- if (_dto.MemoId < 1)
- {
- return Ok(JsonView(false, "MemoId不存在"));
- }
- Res_MemoInfo _source = _resItemInfoRep.Query<Res_MemoInfo>(s => s.Id == _dto.MemoId).First();
- if (_source == null)
- {
- return Ok(JsonView(false, "MemoInfo不存在"));
- }
- //修改
- string sourcePath = _source.MDFilePath;
- string recycDir = AppSettingsHelper.Get("MemoRecycleBinPath");
- new IOOperatorHelper().MoveFile(sourcePath, recycDir);
- var result = await _resItemInfoRep._sqlSugar.Updateable<Res_MemoInfo>()
- .SetColumns(it => it.IsDel == 1)
- .SetColumns(it => it.DeleteUserId == _sysUser.Id)
- .SetColumns(it => it.DeleteTime == DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))
- .Where(s => s.Id == _source.Id)
- .ExecuteCommandAsync();
- return Ok(JsonView(result > 0));
- }
- return Ok(JsonView(rst));
- }
- #endregion
- #region 商邀资料
- /// <summary>
- /// 商邀资料查询
- /// </summary>
- /// <param name="dto"></param>
- /// <returns></returns>
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> QueryInvitationOfficialActivityData(QueryInvitationOfficialActivityDataDto dto)
- {
- try
- {
- Result groupData = await _InvitationOfficialActivityDataRep.QueryInvitationOfficialActivityData(dto);
- if (groupData.Code != 0)
- {
- return Ok(JsonView(false, groupData.Msg));
- }
- return Ok(JsonView(true, groupData.Msg, groupData.Data));
- }
- catch (Exception ex)
- {
- return Ok(JsonView(false, "程序错误!"));
- throw;
- }
- }
- /// <summary>
- /// 根据商邀资料Id查询信息
- /// </summary>
- /// <param name="dto"></param>
- /// <returns></returns>
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> QueryInvitationOfficialActivityById(QueryInvitationOfficialActivityByIdDto dto)
- {
- try
- {
- Result groupData = await _InvitationOfficialActivityDataRep.QueryInvitationOfficialActivityById(dto);
- if (groupData.Code != 0)
- {
- return Ok(JsonView(false, groupData.Msg));
- }
- return Ok(JsonView(true, groupData.Msg, groupData.Data));
- }
- catch (Exception ex)
- {
- return Ok(JsonView(false, "程序错误!"));
- throw;
- }
- }
- /// <summary>
- /// 商邀资料操作(Status:1.新增,2.修改)
- /// </summary>
- /// <param name="dto"></param>
- /// <returns></returns>
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> OpInvitationOfficialActivity(OpInvitationOfficialActivityDto dto)
- {
- try
- {
- Result groupData = await _InvitationOfficialActivityDataRep.OpInvitationOfficialActivity(dto);
- if (groupData.Code != 0)
- {
- return Ok(JsonView(false, groupData.Msg));
- }
- return Ok(JsonView(true, groupData.Msg, groupData.Data));
- }
- catch (Exception ex)
- {
- return Ok(JsonView(false, "程序错误!"));
- throw;
- }
- }
- /// <summary>
- /// 删除商邀资料信息
- /// </summary>
- /// <param name="dto"></param>
- /// <returns></returns>
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> DelInvitationOfficialActivity(DelBaseDto dto)
- {
- try
- {
- var res = await _InvitationOfficialActivityDataRep.SoftDeleteByIdAsync<Res_InvitationOfficialActivityData>(dto.Id.ToString(), dto.DeleteUserId);
- if (!res)
- {
- return Ok(JsonView(false, "删除失败"));
- }
- return Ok(JsonView(true, "删除成功!"));
- }
- catch (Exception ex)
- {
- return Ok(JsonView(false, "程序错误!"));
- throw;
- }
- }
- #endregion
- #region 公务出访
- /// <summary>
- /// 获取团组所有信息,绑定下拉框
- /// </summary>
- /// <param name="dto"></param>
- /// <returns></returns>
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> GetGroupAllList(OfficialActivitiesByDiIdDto dto)
- {
- List<Grp_DelegationInfo> _DelegationInfos = _sqlSugar.Queryable<Grp_DelegationInfo>().Where(a => a.IsDel == 0).OrderBy(a => a.CreateTime, OrderByType.Desc).ToList();
- List<Sys_SetData> data = await _sqlSugar.Queryable<Sys_SetData>().Where(a => a.IsDel == 0 && a.STid == 38).ToListAsync();
- List<Grp_DeleFile> _DeleFile = _sqlSugar.Queryable<Grp_DeleFile>().Where(a => a.Diid == dto.DiId && a.IsDel == 0 && a.Category == 970).ToList();
- return Ok(JsonView(true, "查询成功!", new { Delegation = _DelegationInfos, SetData = data, DeleFile = _DeleFile }));
- }
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> QueryOfficialActivitiesByDiId(OfficialActivitiesByDiIdDto dto)
- {
- try
- {
- Result groupData = await _officialActivitiesRep.QueryOfficialActivitiesByDiId(dto);
- if (groupData.Code != 0)
- {
- return Ok(JsonView(false, groupData.Msg));
- }
- return Ok(JsonView(true, groupData.Msg, groupData.Data));
- }
- catch (Exception ex)
- {
- return Ok(JsonView(false, "程序错误!"));
- throw;
- }
- }
- /// <summary>
- /// 根据公务出访数据Id查询数据
- /// </summary>
- /// <param name="dto"></param>
- /// <returns></returns>
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> QueryOfficialActivitiesById(OfficialActivitiesDiIdDto dto)
- {
- try
- {
- Result groupData = await _officialActivitiesRep.QueryOfficialActivitiesById(dto);
- if (groupData.Code != 0)
- {
- return Ok(JsonView(false, groupData.Msg));
- }
- return Ok(JsonView(true, groupData.Msg, groupData.Data));
- }
- catch (Exception ex)
- {
- return Ok(JsonView(false, "程序错误!"));
- throw;
- }
- }
- /// <summary>
- /// 公务出访操作(Status:1.新增,2.修改)
- /// </summary>
- /// <param name="dto"></param>
- /// <returns></returns>
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> OpOfficialActivities(OpOfficialActivitiesDto dto)
- {
- try
- {
- Result groupData = await _officialActivitiesRep.OpOfficialActivities(dto);
- if (groupData.Code != 0)
- {
- return Ok(JsonView(false, groupData.Msg));
- }
- return Ok(JsonView(true, groupData.Msg, groupData.Data));
- }
- catch (Exception ex)
- {
- return Ok(JsonView(false, "程序错误!"));
- throw;
- }
- }
- /// <summary>
- /// 上传文件
- /// </summary>
- /// <param name="file"></param>
- /// <returns></returns>
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> UploadOfficialActivities(IFormFile file)
- {
- try
- {
- int Type = int.Parse(Request.Headers["Type"]);//1公务方简介,2公务活动图片,3发票
- int DiId = int.Parse(Request.Headers["DiId"]);
- int CreateUserId = int.Parse(Request.Headers["CreateUserId"]);
- if (file != null)
- {
- var fileDir = AppSettingsHelper.Get("GrpFileBasePath");
- //文件名称
- string projectFileName = file.FileName;
- //上传的文件的路径
- string filePath = "";
- if (!Directory.Exists(fileDir))
- {
- Directory.CreateDirectory(fileDir);
- }
- //上传的文件的路径
- filePath = fileDir + $@"\商邀相关文件\{projectFileName}";
- using (FileStream fs = System.IO.File.Create(filePath))
- {
- file.CopyTo(fs);
- fs.Flush();
- }
- Grp_DeleFile d = new Grp_DeleFile();
- d.Diid = DiId;
- d.Category = 970;
- if (Type == 1) d.Kind = 1;
- else if (Type == 2) d.Kind = 2;
- else if (Type == 3) d.Kind = 3;
- d.FileName = projectFileName;
- d.FilePath = "";
- d.CreateUserId = CreateUserId;
- int id = await _sqlSugar.Insertable(d).ExecuteReturnIdentityAsync();
- return Ok(JsonView(true, "上传成功!", projectFileName));
- }
- else
- {
- return Ok(JsonView(false, "上传失败!"));
- }
- }
- catch (Exception ex)
- {
- return Ok(JsonView(false, "程序错误!"));
- throw;
- }
- }
- /// <summary>
- /// 删除文件
- /// </summary>
- /// <param name="dto"></param>
- /// <returns></returns>
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> DelloadOfficialActivities(DelBaseDto dto)
- {
- try
- {
- var fileDir = AppSettingsHelper.Get("GrpFileBasePath");
- Grp_DeleFile _DeleFile = await _sqlSugar.Queryable<Grp_DeleFile>().FirstAsync(a => a.Id == dto.Id);
- if (_DeleFile != null)
- {
- string fileName = _DeleFile.FileName;
- string filePath = fileDir + "/团组增减款项相关文件/" + fileName;
- // 删除该文件
- System.IO.File.Delete(filePath);
- 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();
- return Ok(JsonView(true, "取消文件成功!"));
- }
- else
- {
- return Ok(JsonView(false, "取消文件失败!"));
- }
-
- }
- catch (Exception ex)
- {
- return Ok(JsonView(false, "程序错误!"));
- throw;
- }
- }
- /// <summary>
- /// 删除公务出访信息
- /// </summary>
- /// <param name="dto"></param>
- /// <returns></returns>
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> DelOfficialActivities(DelBaseDto dto)
- {
- try
- {
- var res = await _officialActivitiesRep.SoftDeleteByIdAsync<Res_OfficialActivities>(dto.Id.ToString(), dto.DeleteUserId);
- if (!res)
- {
- return Ok(JsonView(false, "删除失败"));
- }
- return Ok(JsonView(true, "删除成功!"));
- }
- catch (Exception ex)
- {
- return Ok(JsonView(false, "程序错误!"));
- throw;
- }
- }
- #endregion
- #region 请示数据库
- /// <summary>
- /// 查询请示数据库初始化
- /// </summary>
- /// <param name="dto"></param>
- /// <returns></returns>
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> QueryAskData(QueryAskDataDto dto)
- {
- try
- {
- Result groupData = await _askDataRep.QueryAskData(dto);
- if (groupData.Code != 0)
- {
- return Ok(JsonView(false, groupData.Msg));
- }
- return Ok(JsonView(true, groupData.Msg, groupData.Data));
- }
- catch (Exception ex)
- {
- return Ok(JsonView(false, "程序错误!"));
- throw;
- }
- }
- /// <summary>
- /// 根据Id查询请示数据库单挑数据
- /// </summary>
- /// <param name="dto"></param>
- /// <returns></returns>
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> QueryAskDataById(QueryAskDataByIdDto dto)
- {
- try
- {
- Res_AskData _AskData = await _sqlSugar.Queryable<Res_AskData>().FirstAsync(a => a.IsDel == 0 && a.Id == dto.id);
- if (_AskData==null)
- {
- return Ok(JsonView(true, "暂无数据!", _AskData));
- }
- return Ok(JsonView(true, "查询成功!", _AskData));
- }
- catch (Exception ex)
- {
- return Ok(JsonView(false, "程序错误!"));
- throw;
- }
- }
- /// <summary>
- /// 请示数据库操作(Status:1.新增,2.修改)
- /// </summary>
- /// <param name="dto"></param>
- /// <returns></returns>
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> OpAskData(OpAskDataDto dto)
- {
- try
- {
- Result groupData = await _askDataRep.OpAskData(dto);
- if (groupData.Code != 0)
- {
- return Ok(JsonView(false, groupData.Msg));
- }
- return Ok(JsonView(true, groupData.Msg, groupData.Data));
- }
- catch (Exception ex)
- {
- return Ok(JsonView(false, "程序错误!"));
- throw;
- }
- }
- /// <summary>
- /// 删除请示资料信息
- /// </summary>
- /// <param name="dto"></param>
- /// <returns></returns>
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> DelAskData(DelBaseDto dto)
- {
- try
- {
- var res = await _askDataRep.SoftDeleteByIdAsync<Res_AskData>(dto.Id.ToString(), dto.DeleteUserId);
- if (!res)
- {
- return Ok(JsonView(false, "删除失败"));
- }
- return Ok(JsonView(true, "删除成功!"));
- }
- catch (Exception ex)
- {
- return Ok(JsonView(false, "程序错误!"));
- throw;
- }
- }
- /// <summary>
- /// 导出省外办请示
- /// </summary>
- /// <param name="dto"></param>
- /// <returns></returns>
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> AskAdviceDerive(AskAdviceDerive dto)
- {
- try
- {
- string Air = "";//机票信息
- string Area = "";//城市
- string Area2 = "";//城市
- string ClientName = "";//人员
- string ClientName2 = "";//人员
- int ClientNumber =0;//总人数
- string Content = "";//行程安排
- string CountryAndDay = "";//各个国家待的天数
- string Destination = "";//此行目的
- string Destination2 = "";//此行目的
- string Duration = "";//出访时间
- int Durationdays = 0;//出访天数
- int Durationdays2 =0;//出访天数
- string Official = "";//对谁的邀请
- string Temp = "";//出访任务
- string VisitDate = "";//出访日期,多少号到多少号
- return Ok(JsonView(true, "导出成功!"));
- }
- catch (Exception ex)
- {
- return Ok(JsonView(false, "程序错误!"));
- throw;
- }
- }
- /// <summary>
- /// 导出市外办请示
- /// </summary>
- /// <param name="dto"></param>
- /// <returns></returns>
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> AskCityDerive(AskAdviceDerive dto)
- {
- try
- {
-
- return Ok(JsonView(true, "导出成功!"));
- }
- catch (Exception ex)
- {
- return Ok(JsonView(false, "程序错误!"));
- throw;
- }
- }
- #endregion
- #region 机票黑屏代码
- /// <summary>
- /// 根据团组Id查询黑屏代码列表
- /// </summary>
- /// <param name="dto"></param>
- /// <returns></returns>
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> QueryTicketBlackCodeByDiId(QueryTicketBlackCodeByDiIdDto dto)
- {
- try
- {
- Result groupData = await _ticketBlackCodeRep.QueryTicketBlackCodeByDiId(dto);
- if (groupData.Code != 0)
- {
- return Ok(JsonView(false, groupData.Msg));
- }
- return Ok(JsonView(true, groupData.Msg, groupData.Data));
- }
- catch (Exception ex)
- {
- return Ok(JsonView(false, "程序错误!"));
- throw;
- }
- }
- /// <summary>
- /// 根据黑屏代码数据Id查询信息
- /// </summary>
- /// <param name="dto"></param>
- /// <returns></returns>
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> QueryTicketBlackCodeById(QueryTicketBlackCodeByIdDto dto)
- {
- try
- {
- Result groupData = await _ticketBlackCodeRep.QueryTicketBlackCodeById(dto);
- if (groupData.Code != 0)
- {
- return Ok(JsonView(false, groupData.Msg));
- }
- return Ok(JsonView(true, groupData.Msg, groupData.Data));
- }
- catch (Exception ex)
- {
- return Ok(JsonView(false, "程序错误!"));
- throw;
- }
- }
- /// <summary>
- /// 黑屏代码操作(Status:1.新增,2.修改)
- /// </summary>
- /// <param name="dto"></param>
- /// <returns></returns>
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> OpTicketBlackCode(OpTicketBlackCodeDto dto)
- {
- try
- {
- Result groupData = await _ticketBlackCodeRep.OpTicketBlackCode(dto);
- if (groupData.Code != 0)
- {
- return Ok(JsonView(false, groupData.Msg));
- }
- return Ok(JsonView(true, groupData.Msg, groupData.Data));
- }
- catch (Exception ex)
- {
- return Ok(JsonView(false, "程序错误!"));
- throw;
- }
- }
- /// <summary>
- /// 删除黑屏代码
- /// </summary>
- /// <param name="dto"></param>
- /// <returns></returns>
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> DelTicketBlackCode(DelBaseDto dto)
- {
- try
- {
- var res = await _ticketBlackCodeRep.SoftDeleteByIdAsync<Air_TicketBlackCode>(dto.Id.ToString(), dto.DeleteUserId);
- if (!res)
- {
- return Ok(JsonView(false, "删除失败"));
- }
- return Ok(JsonView(true, "删除成功!"));
- }
- catch (Exception ex)
- {
- return Ok(JsonView(false, "程序错误!"));
- throw;
- }
- }
- #endregion
- }
- }
|