This commit is contained in:
2026-01-27 19:00:09 +08:00
parent 43e4daa45b
commit 847d48d276
2 changed files with 45 additions and 0 deletions

View File

@@ -31,6 +31,15 @@ func ProcessPDFG01GZRequest(ctx context.Context, params []byte, deps *processors
// 获取全局logger
zapLogger := logger.GetGlobalLogger()
// Debug记录入口参数
zapLogger.Debug("PDFG01GZ请求开始",
zap.String("name", paramsDto.Name),
zap.String("id_card", paramsDto.IDCard),
zap.String("mobile_no", paramsDto.MobileNo),
zap.String("authorized", paramsDto.Authorized),
zap.String("auth_authorize_file_code", paramsDto.AuthAuthorizeFileCode),
)
// 从context获取config如果存在
var cacheTTL time.Duration = 24 * time.Hour
var cacheDir string
@@ -46,6 +55,18 @@ func ProcessPDFG01GZRequest(ctx context.Context, params []byte, deps *processors
var maxSize int64
if cfg, ok := ctx.Value("config").(*config.Config); ok && cfg != nil {
maxSize = cfg.PDFGen.Cache.MaxSize
// Debug记录PDF生成服务配置
zapLogger.Debug("PDFG01GZ加载配置",
zap.String("env", cfg.App.Env),
zap.String("pdfgen_production_url", cfg.PDFGen.ProductionURL),
zap.String("pdfgen_development_url", cfg.PDFGen.DevelopmentURL),
zap.String("pdfgen_api_path", cfg.PDFGen.APIPath),
zap.Duration("pdfgen_timeout", cfg.PDFGen.Timeout),
zap.String("cache_dir", cacheDir),
zap.Duration("cache_ttl", cacheTTL),
zap.Int64("cache_max_size", maxSize),
)
}
// 创建PDF缓存管理器
@@ -107,6 +128,11 @@ func ProcessPDFG01GZRequest(ctx context.Context, params []byte, deps *processors
// 格式化数据为PDF生成服务需要的格式为缺失的数据提供默认值
formattedData := formatDataForPDF(apiData, paramsDto, zapLogger)
zapLogger.Debug("PDFG01GZ数据准备完成",
zap.Int("api_data_count", len(apiData)),
zap.Int("formatted_items", len(formattedData)),
)
// 从APPLICANT_BASIC_INFO中提取报告编号如果存在
var reportNumber string
if len(formattedData) > 0 {
@@ -130,6 +156,11 @@ func ProcessPDFG01GZRequest(ctx context.Context, params []byte, deps *processors
// 调用PDF生成服务
// 即使部分子处理器失败只要有APPLICANT_BASIC_INFO就可以生成PDF
zapLogger.Debug("PDFG01GZ开始调用PDF生成服务",
zap.String("report_number", reportNumber),
zap.Int("data_items", len(formattedData)),
)
pdfResp, err := pdfGenService.GenerateGuangzhouPDF(ctx, pdfReq)
if err != nil {
zapLogger.Error("生成PDF失败",