feat: 新增配送合同附件安全上传功能

- 增加合同专用 PDF 上传、鉴权预览和失败清理接口
- 支持草稿附件替换移除、并发保护和启用完整性校验
- 修复循环模板引用导致文件选择器无法打开的问题
- 补充专项测试、中文项目文档和操作日志
This commit is contained in:
czl231
2026-08-12 21:38:49 +08:00
parent deea31d79e
commit 99324acc89
16 changed files with 1379 additions and 16 deletions

View File

@@ -70,8 +70,11 @@ func registerGasorderRoute(group *gin.RouterGroup) {
contract := group.Group("/gasorder_contract")
contract.GET("", gasorder.ListGasorderContract)
contract.POST("", gasorder.CreateGasorderContract)
contract.POST("/attachment/upload", gasorder.UploadGasorderContractAttachment)
contract.POST("/attachment/cleanup", gasorder.CleanupGasorderContractAttachment)
contract.GET("/:identity", gasorder.GetGasorderContract)
contract.PUT("/:identity", gasorder.UpdateGasorderContract)
contract.GET("/:identity/attachment", gasorder.ServeGasorderContractAttachment)
contract.POST("/:identity/activate", gasorder.ActivateGasorderContract)
contract.POST("/:identity/renew", gasorder.RenewGasorderContract)
contract.POST("/:identity/terminate", gasorder.TerminateGasorderContract)

View File

@@ -0,0 +1,27 @@
// Package routers 测试平台合同附件专用路由注册。
// 版本v1.0.0
package routers
import (
"net/http"
"testing"
"github.com/gin-gonic/gin"
)
// TestPlatformRoutesExposeContractAttachmentEndpoints 验证专用接口独立于通用上传接口注册。
func TestPlatformRoutesExposeContractAttachmentEndpoints(t *testing.T) {
engine := gin.New()
group := engine.Group("/heqi/platform/v1")
registerGasorderRoute(group)
routes := make(map[string]map[string]bool)
for _, route := range engine.Routes() {
if routes[route.Path] == nil {
routes[route.Path] = make(map[string]bool)
}
routes[route.Path][route.Method] = true
}
assertRouteMethods(t, routes, "/heqi/platform/v1/gasorder_contract/attachment/upload", http.MethodPost)
assertRouteMethods(t, routes, "/heqi/platform/v1/gasorder_contract/attachment/cleanup", http.MethodPost)
assertRouteMethods(t, routes, "/heqi/platform/v1/gasorder_contract/:identity/attachment", http.MethodGet)
}