feat: kpi支持界面控制状态修改英文名称
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"be.ems/lib/log"
|
||||
"be.ems/src/framework/datasource"
|
||||
"be.ems/src/framework/i18n"
|
||||
"be.ems/src/framework/resp"
|
||||
"be.ems/src/framework/utils/ctx"
|
||||
"be.ems/src/framework/vo/result"
|
||||
"be.ems/src/modules/network_data/model"
|
||||
@@ -120,3 +121,79 @@ func (s *PerfKPIController) Title(c *gin.Context) {
|
||||
|
||||
c.JSON(200, result.OkData(kpiTitles))
|
||||
}
|
||||
|
||||
// 获取统计标题
|
||||
//
|
||||
// GET /title
|
||||
//
|
||||
// @Tags network_data/kpi
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param neType query string true "NE Type only IMS" Enums(IMS)
|
||||
// @Param callerParty query string false "callerParty"
|
||||
// @Param calledParty query string false "calledParty"
|
||||
// @Param pageNum query number true "pageNum" default(1)
|
||||
// @Param pageSize query number true "pageSize" default(10)
|
||||
// @Success 200 {object} object "Response Results"
|
||||
// @Security TokenAuth
|
||||
// @Summary Get Statistical Headings
|
||||
// @Description Get Statistical Headings
|
||||
// @Router /neData/kpi/title/list [get]
|
||||
func (s *PerfKPIController) TitleList(c *gin.Context) {
|
||||
query := ctx.QueryMapString(c)
|
||||
|
||||
// 查询数据
|
||||
rows, total := s.perfKPIService.TitleSelectByPage(query)
|
||||
c.JSON(200, resp.OkData(map[string]any{"total": total, "rows": rows}))
|
||||
}
|
||||
|
||||
// 统计标题修改
|
||||
//
|
||||
// PUT /title
|
||||
//
|
||||
// @Tags network_data/kpi
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body struct true "body"
|
||||
// @Success 200 {object} object "Response Results"
|
||||
// @Security TokenAuth
|
||||
// @Summary Customize Title Modification
|
||||
// @Description Customize Title Modification
|
||||
// @Router /neData/kpi/title [put]
|
||||
func (s PerfKPIController) TitleUpdate(c *gin.Context) {
|
||||
var body struct {
|
||||
ID string `json:"id" binding:"required"`
|
||||
Title string `json:"enTitle"`
|
||||
StatusFlag string `json:"statusFlag"`
|
||||
}
|
||||
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
item := s.perfKPIService.TitleFind(model.GoldKPITitle{ID: body.ID})
|
||||
if len(item) != 1 {
|
||||
c.JSON(200, resp.ErrMsg("not found"))
|
||||
return
|
||||
}
|
||||
itemInfo := item[0]
|
||||
if itemInfo.StatusFlag == body.StatusFlag {
|
||||
c.JSON(200, resp.ErrMsg("no change"))
|
||||
return
|
||||
}
|
||||
if body.StatusFlag != "" && (body.StatusFlag == "0" || body.StatusFlag == "1") {
|
||||
itemInfo.StatusFlag = body.StatusFlag
|
||||
}
|
||||
if body.Title != "" {
|
||||
itemInfo.EnTitle = body.Title
|
||||
}
|
||||
|
||||
rows := s.perfKPIService.TitleUpdate(itemInfo)
|
||||
if rows > 0 {
|
||||
c.JSON(200, resp.Ok(nil))
|
||||
return
|
||||
}
|
||||
c.JSON(200, resp.Err(nil))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user