|
@@ -20,6 +20,7 @@ using OASystem.API.OAMethodLib.Hub.Hubs;
|
|
|
using OASystem.API.OAMethodLib.JuHeAPI;
|
|
|
using OASystem.API.OAMethodLib.QiYeWeChatAPI.AppNotice;
|
|
|
using OASystem.Domain.AesEncryption;
|
|
|
+using OASystem.Domain.Attributes;
|
|
|
using OASystem.Domain.Dtos.CRM;
|
|
|
using OASystem.Domain.Dtos.FileDto;
|
|
|
using OASystem.Domain.Dtos.Financial;
|
|
@@ -19212,6 +19213,101 @@ ORDER by gctggrc.id DESC
|
|
|
}
|
|
|
|
|
|
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region 会务倒退表
|
|
|
+ /// <summary>
|
|
|
+ /// 会务倒退表
|
|
|
+ /// Init
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
+ public async Task<IActionResult> InforRetrogressTableInit()
|
|
|
+ {
|
|
|
+ var groupData = await _groupRepository.PostShareGroupInfos(1);
|
|
|
+ if (groupData.Code == 0) return Ok(JsonView(groupData.Data));
|
|
|
+
|
|
|
+ return Ok(JsonView(false, groupData.Msg));
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 会务倒退表
|
|
|
+ /// ExcelDownload
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ [ApiLog("InforRetrogressTable", OperationEnum.Download)]
|
|
|
+ [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
+ public async Task<IActionResult> InforRetrogressTableFileDownload(InforRetrogressTableFileDownloadDto dto)
|
|
|
+ {
|
|
|
+ var validator = new InforRetrogressTableFileDownloadDtoValidator();
|
|
|
+ var validatorRes = await validator.ValidateAsync(dto);
|
|
|
+ if (!validatorRes.IsValid)
|
|
|
+ {
|
|
|
+ StringBuilder sb = new StringBuilder();
|
|
|
+ foreach (var item in validatorRes.Errors)
|
|
|
+ {
|
|
|
+ sb.AppendLine(item.ErrorMessage);
|
|
|
+ }
|
|
|
+ return Ok(JsonView(false, sb.ToString()));
|
|
|
+ }
|
|
|
+
|
|
|
+ var groupInfo = await _sqlSugar.Queryable<Grp_DelegationInfo>().FirstAsync(x => x.Id == dto.GroupId);
|
|
|
+ if (groupInfo == null) return Ok(JsonView(false,$"该团组信息未填写!"));
|
|
|
+
|
|
|
+ //时间根据团组出访日期-接团录入日期的天数来判断用哪个模板
|
|
|
+ var days = groupInfo.VisitDate.Subtract(groupInfo.CreateTime).Days;
|
|
|
+
|
|
|
+ #region Excel
|
|
|
+ var tempPath = AppSettingsHelper.Get("ExcelTempPath");
|
|
|
+ var servicePath = AppSettingsHelper.Get("GrpFileBaseUrl");
|
|
|
+ var savePath = AppSettingsHelper.Get("ExcelBasePath") + "InforRetrogressTable/";
|
|
|
+ var ftpPath = AppSettingsHelper.Get("ExcelFtpPath") + "InforRetrogressTable/";
|
|
|
+ var fileNamePrefix = string.Empty;
|
|
|
+
|
|
|
+ if (days >= 30)
|
|
|
+ {
|
|
|
+ tempPath += $"会务工作倒推进度表(30天).xlsx";
|
|
|
+ fileNamePrefix = $"{groupInfo.TeamName}_会务工作倒推进度表(30天)";
|
|
|
+ }
|
|
|
+ else if (days < 30 && days > 7)
|
|
|
+ {
|
|
|
+ tempPath += $"会务工作倒推进度表(15天).xlsx";
|
|
|
+ fileNamePrefix = $"{groupInfo.TeamName}_会务工作倒推进度表(15天)";
|
|
|
+
|
|
|
+ }
|
|
|
+ else if (days <= 7)
|
|
|
+ {
|
|
|
+ tempPath += $"会务工作倒推进度表(7天).xlsx";
|
|
|
+ fileNamePrefix = $"{groupInfo.TeamName}_会务工作倒推进度表(7天)";
|
|
|
+ }
|
|
|
+ var fileName = $"{fileNamePrefix}{DateTime.Now.ToString("yyyyMMddHHmmss")}.xlsx";
|
|
|
+
|
|
|
+ fileName = CommonFun.ValidFileName(fileName);
|
|
|
+
|
|
|
+ //载入模板
|
|
|
+ WorkbookDesigner designer = new WorkbookDesigner();
|
|
|
+ designer.Workbook = new Workbook(tempPath);
|
|
|
+
|
|
|
+ designer.Process();
|
|
|
+
|
|
|
+ if (!Directory.Exists(savePath))
|
|
|
+ {
|
|
|
+ Directory.CreateDirectory(savePath);
|
|
|
+ }
|
|
|
+
|
|
|
+ string serverPath = $"{savePath}{fileName}";
|
|
|
+ designer.Workbook.Save(serverPath);
|
|
|
+ string rst = $"{servicePath}{ftpPath}{fileName}";
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ return Ok(JsonView(new { url = rst }));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
#endregion
|
|
|
|
|
|
#region 三公签证费用(签证费、代办费)
|