|
@@ -1,7 +1,9 @@
|
|
-using NPOI.HPSF;
|
|
+using Aspose.Words;
|
|
|
|
+using NPOI.HPSF;
|
|
using OASystem.API.OAMethodLib;
|
|
using OASystem.API.OAMethodLib;
|
|
using OASystem.Domain.Dtos.Resource;
|
|
using OASystem.Domain.Dtos.Resource;
|
|
using OASystem.Domain.Entities.Groups;
|
|
using OASystem.Domain.Entities.Groups;
|
|
|
|
+using OASystem.Domain.ViewModels.Groups;
|
|
using OASystem.Infrastructure.Repositories.Groups;
|
|
using OASystem.Infrastructure.Repositories.Groups;
|
|
using Org.BouncyCastle.Utilities;
|
|
using Org.BouncyCastle.Utilities;
|
|
using Quartz.Util;
|
|
using Quartz.Util;
|
|
@@ -35,12 +37,13 @@ namespace OASystem.API.Controllers
|
|
private readonly OfficialActivitiesRepository _officialActivitiesRep;
|
|
private readonly OfficialActivitiesRepository _officialActivitiesRep;
|
|
private readonly AskDataRepository _askDataRep;
|
|
private readonly AskDataRepository _askDataRep;
|
|
private readonly TicketBlackCodeRepository _ticketBlackCodeRep;
|
|
private readonly TicketBlackCodeRepository _ticketBlackCodeRep;
|
|
|
|
+ private readonly TourClientListRepository _tourClientListRep;
|
|
|
|
|
|
- public ResourceController(IMapper mapper, IConfiguration config, SqlSugarClient sqlSugar, CarDataRepository carDataRep,LocalGuideDataRepository localGuideDataRep,
|
|
+ public ResourceController(IMapper mapper, IConfiguration config, SqlSugarClient sqlSugar, CarDataRepository carDataRep, LocalGuideDataRepository localGuideDataRep,
|
|
- ThreeCodeRepository threeCodeRep,HotelDataRepository hotelDataRep, ResItemInfoRepository resItemInfoRep, SetDataRepository setDataRepository,
|
|
+ ThreeCodeRepository threeCodeRep, HotelDataRepository hotelDataRep, ResItemInfoRepository resItemInfoRep, SetDataRepository setDataRepository,
|
|
CountryFeeRepository countryFeeRep, SetDataTypeRepository setDataTypeRep, AirTicketAgentRepository airTicketAgentRep,
|
|
CountryFeeRepository countryFeeRep, SetDataTypeRepository setDataTypeRep, AirTicketAgentRepository airTicketAgentRep,
|
|
- InvitationOfficialActivityDataRepository invitationOfficialActivityDataRep, OfficialActivitiesRepository officialActivitiesRep, AskDataRepository askDataRep,
|
|
+ InvitationOfficialActivityDataRepository invitationOfficialActivityDataRep, OfficialActivitiesRepository officialActivitiesRep, AskDataRepository askDataRep,
|
|
- TicketBlackCodeRepository ticketBlackCodeRep)
|
|
+ TicketBlackCodeRepository ticketBlackCodeRep, TourClientListRepository tourClientListRep)
|
|
{
|
|
{
|
|
_mapper = mapper;
|
|
_mapper = mapper;
|
|
_config = config;
|
|
_config = config;
|
|
@@ -57,7 +60,8 @@ namespace OASystem.API.Controllers
|
|
_InvitationOfficialActivityDataRep = invitationOfficialActivityDataRep;
|
|
_InvitationOfficialActivityDataRep = invitationOfficialActivityDataRep;
|
|
_officialActivitiesRep = officialActivitiesRep;
|
|
_officialActivitiesRep = officialActivitiesRep;
|
|
_askDataRep = askDataRep;
|
|
_askDataRep = askDataRep;
|
|
- _ticketBlackCodeRep=ticketBlackCodeRep;
|
|
+ _ticketBlackCodeRep = ticketBlackCodeRep;
|
|
|
|
+ _tourClientListRep = tourClientListRep;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -1845,57 +1849,113 @@ Inner Join Sys_Department as d With(Nolock) On u.DepId=d.Id Where m.Id={0} ", _m
|
|
|
|
|
|
[HttpPost]
|
|
[HttpPost]
|
|
[ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
[ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
- public async Task<IActionResult> AskAdviceDerive(AskAdviceDerive dto)
|
|
+ public async Task<IActionResult> AskFileDownload(AskFileDownloadDto dto)
|
|
{
|
|
{
|
|
- try
|
|
+ #region 参数验证
|
|
- {
|
|
+
|
|
- string Air = "";
|
|
+ if (dto.FileType < 1 || dto.FileType > 2) return Ok(JsonView(false, "请传入有效的FileType参数. 1 省外办出访请示 2 市外办出访请示"));
|
|
- string Area = "";
|
|
+ if (dto.DiId < 1 ) return Ok(JsonView(false, "请传入有效的DiId参数."));
|
|
- string Area2 = "";
|
|
+
|
|
- string ClientName = "";
|
|
+ #endregion
|
|
- string ClientName2 = "";
|
|
+
|
|
- int ClientNumber =0;
|
|
+ var groupInfo = _sqlSugar.Queryable<Grp_DelegationInfo>().Where(it => it.IsDel == 0 && it.Id == dto.DiId).First();
|
|
- string Content = "";
|
|
+ if (groupInfo == null) return Ok(JsonView(false, "该团组基本信息不存在"));
|
|
- string CountryAndDay = "";
|
|
+
|
|
- string Destination = "";
|
|
+
|
|
- string Destination2 = "";
|
|
+ var guestResult = _tourClientListRep._ItemByDiId(1, dto.DiId);
|
|
- string Duration = "";
|
|
+ List<TourClientListByDiIdView> guestInfos = new List<TourClientListByDiIdView>();
|
|
- int Durationdays = 0;
|
|
+ if (guestResult.Result.Code == 0) guestInfos = guestResult.Result.Data as List<TourClientListByDiIdView>;
|
|
- int Durationdays2 =0;
|
|
+
|
|
- string Official = "";
|
|
+
|
|
- string Temp = "";
|
|
+ var officialBusiness = _sqlSugar.Queryable<Res_OfficialActivities>().Where(it => it.IsDel == 0 && it.DiId == dto.DiId).ToList();
|
|
- string VisitDate = "";
|
|
+ var obInfo = officialBusiness.FirstOrDefault();
|
|
-
|
|
+
|
|
-
|
|
+
|
|
- return Ok(JsonView(true, "导出成功!"));
|
|
+ string tempPath = AppSettingsHelper.Get("WordBasePath") + "Template/省外办出访请示 - 模板.docx";
|
|
- }
|
|
+ var doc = new Document(tempPath);
|
|
- catch (Exception ex)
|
|
+ DocumentBuilder builder = new DocumentBuilder(doc);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ Dictionary<string, string> dic = new Dictionary<string, string>();
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ dic.Add("GroupClient",groupInfo.ClientUnit);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ string guestName = "";
|
|
|
|
+ string guestJob = "";
|
|
|
|
+ string guestInfoStr = "";
|
|
|
|
+ var guestFirstInfo = guestInfos.FirstOrDefault();
|
|
|
|
+ if (guestFirstInfo != null)
|
|
{
|
|
{
|
|
- return Ok(JsonView(false, "程序错误!"));
|
|
+ guestName = guestFirstInfo.LastName + guestFirstInfo.FirstName;
|
|
- throw;
|
|
+ guestJob = guestFirstInfo.Job;
|
|
|
|
+ guestInfoStr = $@"{guestJob}、{guestName}";
|
|
}
|
|
}
|
|
- }
|
|
+ string askTitle = $@"关于{guestInfoStr}等{guestInfos.Count}人赴{groupInfo.VisitCountry}进行{groupInfo.VisitPurpose}的请示";
|
|
|
|
+ dic.Add("AskTitle", askTitle);
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ string visitDateStr = @$"{groupInfo.VisitDate.Year}年{groupInfo.VisitDate.Month}月{groupInfo.VisitDate.Day}日";
|
|
-
|
|
+ string askSubTitle = $@"应{obInfo.Client}{obInfo.Job}{obInfo.Contact}的邀请,我单位拟派{guestInfoStr}等{guestInfos.Count}人于{visitDateStr}赴{groupInfo.VisitCountry}进行{groupInfo.VisitPurpose}。现请示如下。";
|
|
-
|
|
+ dic.Add("AskSubTitle", askSubTitle);
|
|
-
|
|
+
|
|
- [HttpPost]
|
|
+
|
|
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
+ dic.Add("AskTitle", askTitle);
|
|
- public async Task<IActionResult> AskCityDerive(AskAdviceDerive dto)
|
|
+
|
|
- {
|
|
+ #region 填充word模板书签内容
|
|
- try
|
|
+ foreach (var key in dic.Keys)
|
|
{
|
|
{
|
|
-
|
|
+ builder.MoveToBookmark(key);
|
|
- return Ok(JsonView(true, "导出成功!"));
|
|
+ builder.Write(dic[key]);
|
|
}
|
|
}
|
|
- catch (Exception ex)
|
|
+ #endregion
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ NodeCollection allTables = doc.GetChildNodes(NodeType.Table, true);
|
|
|
|
+
|
|
|
|
+ Aspose.Words.Tables.Table tableOne = allTables[0] as Aspose.Words.Tables.Table;
|
|
|
|
+
|
|
|
|
+ var rowStart = tableOne.Rows[0];
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ for (int i = 0; i < guestInfos.Count; i++)
|
|
{
|
|
{
|
|
- return Ok(JsonView(false, "程序错误!"));
|
|
+ var guestInfo = guestInfos[i];
|
|
- throw;
|
|
+ builder.MoveToCell(0, i + 1, 0, 0);
|
|
|
|
+ builder.Write(guestInfo.LastName + guestInfo.FirstName);
|
|
|
|
+
|
|
|
|
+ builder.MoveToCell(0, i + 1, 1, 0);
|
|
|
|
+ int sex = guestInfo.Sex;
|
|
|
|
+ string sexStr = string.Empty;
|
|
|
|
+ if (sex == 0) sexStr = "男";
|
|
|
|
+ else if (sex == 1) sexStr = "女";
|
|
|
|
+ else sexStr = "未设置";
|
|
|
|
+ builder.Write(sexStr);
|
|
|
|
+
|
|
|
|
+ builder.MoveToCell(0, i + 1, 2, 0);
|
|
|
|
+ builder.Write(guestInfo.CompanyFullName + guestInfo.Job);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ builder.MoveToCell(0, i + 1, 3, 0);
|
|
|
|
+ string birthDay = guestInfo.;
|
|
|
|
+ string birthDayStr = string.Empty;
|
|
|
|
+ if (!string.IsNullOrEmpty(birthDay))
|
|
|
|
+ {
|
|
|
|
+ birthDayStr = Convert.ToDateTime(birthDay).ToString("yyyy-MM-dd");
|
|
|
|
+ }
|
|
|
|
+ builder.Write(birthDayStr);
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ var fileDir = AppSettingsHelper.Get("WordBasePath");
|
|
|
|
+ string fileName = $"{groupInfo.TeamName}省外办出访请示.docx";
|
|
|
|
+ string filePath = fileDir + $@"Ask/{fileName}";
|
|
|
|
+ doc.Save(filePath);
|
|
|
|
+ string Url = $@"{AppSettingsHelper.Get("WordBaseUrl")}Office/Word/Ask/{fileName}";
|
|
|
|
+ return Ok(JsonView(true, "操作成功!", Url));
|
|
}
|
|
}
|
|
|
|
+
|
|
#endregion
|
|
#endregion
|
|
|
|
|
|
#region 机票黑屏代码
|
|
#region 机票黑屏代码
|