feat(phase3): 备案对接/全国统计/号段管理/BFF安全化/链合约源码
- A.1 备案对接: BindFiling/QueryFiling 关联网标号+备案号 - A.2 监管上报: DailyRegulatoryReport 日报 - B.1 号段管理: ListSegments + /admin/segments - C.1/C.2 全国统计按省聚合 + 跨省协同(单一可信源天然联动) - F.2 全国监管大屏: NationalStats(按省/类目/状态) - B(遗留) 监管大屏BFF: internal/bff + cmd/console-bff, 密钥仅存后端浏览器只用会话令牌 - G 真实链合约源码: contracts/tcs_registry/registry.go (ChainMaker Go) - 新增9个API+BFF服务; 5项新测试; 端到端BFF验证 - D/E(压测/等保/HSM)/F.1(标准)/真实链部署 标注需外部环境
This commit is contained in:
@@ -55,6 +55,11 @@ func (h *Handler) Register(rg *gin.RouterGroup) {
|
||||
rg.POST("/content/add-episodes", h.addEpisodes) // 追更新集(需求24)
|
||||
rg.POST("/content/cross-province", h.crossProvince) // 跨省复用准入(需求13)
|
||||
rg.POST("/terminal/verify-segment", h.terminalVerify) // 终端片段抽检(需求8)
|
||||
rg.POST("/content/bind-filing", h.bindFiling) // 备案/网标关联(三期A.1)
|
||||
rg.GET("/content/filing", h.queryFiling) // 查询备案关联
|
||||
rg.GET("/regulatory/national-stats", h.nationalStats) // 全国监管统计(三期F.2)
|
||||
rg.GET("/regulatory/daily-report", h.dailyReport) // 监管数据上报日报(三期A.2)
|
||||
rg.GET("/admin/segments", h.listSegments) // 号段管理(三期B.1)
|
||||
}
|
||||
|
||||
func roleOf(c *gin.Context) chain.Role {
|
||||
@@ -617,3 +622,61 @@ func (h *Handler) terminalVerify(c *gin.Context) {
|
||||
ok, msg := h.svc.TerminalVerifySegment(req.MACode, req.Episode, req.SegHash)
|
||||
httpx.OK(c, gin.H{"ok": ok, "message": msg})
|
||||
}
|
||||
|
||||
// ---- 三期:备案对接/全国统计/监管上报/号段管理 ----
|
||||
|
||||
type bindFilingReq struct {
|
||||
MACode string `json:"ma_code"`
|
||||
LicenseNo string `json:"license_no"`
|
||||
FilingNo string `json:"filing_no"`
|
||||
}
|
||||
|
||||
func (h *Handler) bindFiling(c *gin.Context) {
|
||||
var req bindFilingReq
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
httpx.Error(c, http.StatusBadRequest, "INVALID_REQUEST", err.Error())
|
||||
return
|
||||
}
|
||||
rec, err := h.svc.BindFiling(req.MACode, req.LicenseNo, req.FilingNo)
|
||||
if err != nil {
|
||||
httpx.Error(c, http.StatusBadRequest, "BIND_FILING_FAILED", err.Error())
|
||||
return
|
||||
}
|
||||
httpx.OK(c, rec)
|
||||
}
|
||||
|
||||
func (h *Handler) queryFiling(c *gin.Context) {
|
||||
maCode := c.Query("ma_code")
|
||||
rec, ok := h.svc.QueryFiling(maCode)
|
||||
if !ok {
|
||||
httpx.Error(c, http.StatusNotFound, "NOT_FOUND", "未关联备案")
|
||||
return
|
||||
}
|
||||
httpx.OK(c, rec)
|
||||
}
|
||||
|
||||
func (h *Handler) nationalStats(c *gin.Context) {
|
||||
st, err := h.svc.NationalStats()
|
||||
if err != nil {
|
||||
httpx.Error(c, http.StatusInternalServerError, "INTERNAL_ERROR", err.Error())
|
||||
return
|
||||
}
|
||||
httpx.OK(c, st)
|
||||
}
|
||||
|
||||
func (h *Handler) dailyReport(c *gin.Context) {
|
||||
date := c.Query("date")
|
||||
if date == "" {
|
||||
date = time.Now().Format("2006-01-02")
|
||||
}
|
||||
rep, err := h.svc.DailyRegulatoryReport(date)
|
||||
if err != nil {
|
||||
httpx.Error(c, http.StatusInternalServerError, "INTERNAL_ERROR", err.Error())
|
||||
return
|
||||
}
|
||||
httpx.OK(c, rep)
|
||||
}
|
||||
|
||||
func (h *Handler) listSegments(c *gin.Context) {
|
||||
httpx.OK(c, gin.H{"segments": h.svc.ListSegments()})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user