first commit

This commit is contained in:
2026-03-18 00:01:48 +08:00
commit a0c623fd81
425 changed files with 42318 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
package query
import (
"context"
"fmt"
"in-server/app/main/api/internal/svc"
"in-server/app/main/api/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type DownloadReportPdfLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewDownloadReportPdfLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DownloadReportPdfLogic {
return &DownloadReportPdfLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *DownloadReportPdfLogic) DownloadReportPdf(req *types.DownloadReportPdfReq) (resp *types.DownloadReportPdfResp, err error) {
pdfBytes, err := l.svcCtx.ReportPDFService.GetOrGenerateReportPDF(l.ctx, req.OrderId, req.OrderNo)
if err != nil {
logx.Errorf("生成报告 PDF 失败, orderId=%s, orderNo=%s, err=%v", req.OrderId, req.OrderNo, err)
return nil, fmt.Errorf("生成报告 PDF 失败: %w", err)
}
resp = &types.DownloadReportPdfResp{
FileName: fmt.Sprintf("report_%s.pdf", req.OrderNo),
Content: pdfBytes,
}
return resp, nil
}