Exemplo n.º 1
0
        /// <summary>
        /// 导出单次结算的交易记录
        /// </summary>
        public HttpFileOutput ExportSingleSettlementDetail(ExportSingleSettlementDetailInput inputDto)
        {
            var details = this.GetSingleSettlementDetail(new GetSingleSettlementDetailInput()
            {
                SettlementId = inputDto.SettlementId
            });
            // 创建对应格式的Formatter
            var excelFormatter = _formatterFactory.Create(FomatterType.Excel);

            // 准备输出文件的路径(绝对路径)
            var filePath = Path.Combine(
                AppDomain.CurrentDomain.BaseDirectory,
                PlatformServiceConst.TEMP_FILE_NAME,
                $"{Guid.NewGuid().ToString()}.excel");

            var tempDictionary = _serviceBus.Send <List <DataItemDto> >(new GetDataItemRequest()
            {
                Categorys = new string[] { "PayType", "BillingType" }
            });

            // 数据字典转换
            details.DataItemTransform((category, key) =>
            {
                return(tempDictionary.Where(p => p.Category == category && p.Key == key).FirstOrDefault()?.Value);
            });

            // 把Studen实体列表输出到指定路径
            excelFormatter.FromListToFile(details, filePath);
            return(new HttpFileOutput()
            {
                FilePath = filePath,
                FileName = $"日结明细_{DateTime.Now.ToString("yyyyMMdd_HHmm")}.xlsx"
            });
        }
Exemplo n.º 2
0
        /// <summary>
        /// 导出用卡明细列表数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public HttpFileOutput DeriveBillingRecordList(InputBillingRecordListDto input)
        {
            string sql          = string.Empty;
            var    parameters   = HandleSQL(input, "export", out sql);
            var    pagerWrapper = new PagerResult <OutputDeriveBillingRecordListDto>();

            pagerWrapper.Result = _databaseMediator.ExcuteSqlQueryAsync <OutputDeriveBillingRecordListDto>(sql, parameters).Result;
            //预留:ex操作组件 begin
            var excelFormatter = _formatterFactory.Create(FomatterType.Excel);
            // 准备输出文件的路径(绝对路径)
            var filePath = Path.Combine(
                AppDomain.CurrentDomain.BaseDirectory,
                PlatformServiceConst.TEMP_FILE_NAME,
                $"{Guid.NewGuid().ToString()}.xlsx");

            // 把Studen实体列表输出到指定路径
            excelFormatter.FromListToFile <OutputDeriveBillingRecordListDto>(pagerWrapper.Result, filePath);

            //预留:ex操作组件 end
            return(new HttpFileOutput()
            {
                FilePath = filePath,
                FileName = $"用卡明细列表数据{DateTime.Now.ToString("yyyyMMdd_HH:mm")}.xlsx"
            });
        }
Exemplo n.º 3
0
        public void WriteToPdf()
        {
            var dirInfo = new DirectoryInfo(_config.SourcePath);

            if (!dirInfo.Exists)
            {
                return;
            }

            var tocFilePath = PathHelper.GetTableOfContentsFilePath(_config.TargetFile);

            var sourceDoc = _formatterFactory.Create(_config.TargetFile);
            var tocDoc    = _formatterFactory.Create(tocFilePath);

            sourceDoc.AddTitle(_config.ProductName, "Source code", DateTime.Now);
            tocDoc.AddTitle(_config.ProductName, "Table of contents", DateTime.Now);

            ScanDirectory(dirInfo, dirInfo.FullName, sourceDoc, tocDoc);

            sourceDoc.Close();
            tocDoc.Close();
        }