|
@@ -8,6 +8,7 @@ import (
|
|
"ColdVerify_server/models/Task"
|
|
"ColdVerify_server/models/Task"
|
|
"ColdVerify_server/models/VerifyTemplate"
|
|
"ColdVerify_server/models/VerifyTemplate"
|
|
"encoding/json"
|
|
"encoding/json"
|
|
|
|
+ "fmt"
|
|
beego "github.com/beego/beego/v2/server/web"
|
|
beego "github.com/beego/beego/v2/server/web"
|
|
"math"
|
|
"math"
|
|
"strconv"
|
|
"strconv"
|
|
@@ -480,7 +481,7 @@ func (c *VerifyTemplateController) Map_Data_List() {
|
|
}
|
|
}
|
|
|
|
|
|
T_task_id := c.GetString("T_task_id")
|
|
T_task_id := c.GetString("T_task_id")
|
|
- _, is := Task.Read_Task(T_task_id)
|
|
|
|
|
|
+ task, is := Task.Read_Task(T_task_id)
|
|
if !is {
|
|
if !is {
|
|
c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_task_id 错误!"}
|
|
c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_task_id 错误!"}
|
|
c.ServeJSON()
|
|
c.ServeJSON()
|
|
@@ -490,7 +491,15 @@ func (c *VerifyTemplateController) Map_Data_List() {
|
|
Map_List := VerifyTemplate.Read_VerifyTemplateMap_List_For_Data(T_VerifyTemplate_id, T_source, T_flow)
|
|
Map_List := VerifyTemplate.Read_VerifyTemplateMap_List_For_Data(T_VerifyTemplate_id, T_source, T_flow)
|
|
Data := VerifyTemplate.Read_VerifyTemplateMapData_List(T_source, T_task_id, T_VerifyTemplate_id, Map_List)
|
|
Data := VerifyTemplate.Read_VerifyTemplateMapData_List(T_source, T_task_id, T_VerifyTemplate_id, Map_List)
|
|
|
|
|
|
- c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!", Data: Data}
|
|
|
|
|
|
+ type JSONS struct {
|
|
|
|
+ //必须的大写开头
|
|
|
|
+ Code int16
|
|
|
|
+ Msg string
|
|
|
|
+ Data interface{} // 泛型
|
|
|
|
+ T_step int
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ c.Data["json"] = JSONS{Code: 200, Msg: "ok!", Data: Data, T_step: task.T_step}
|
|
c.ServeJSON()
|
|
c.ServeJSON()
|
|
return
|
|
return
|
|
}
|
|
}
|
|
@@ -512,6 +521,7 @@ func (c *VerifyTemplateController) Map_Data_Pu() {
|
|
T_source int
|
|
T_source int
|
|
T_task_id string
|
|
T_task_id string
|
|
T_VerifyTemplate_id string
|
|
T_VerifyTemplate_id string
|
|
|
|
+ T_step int // 进行步骤下标
|
|
VerifyTemplateMapData []VerifyTemplate.VerifyTemplateMapData_R
|
|
VerifyTemplateMapData []VerifyTemplate.VerifyTemplateMapData_R
|
|
}
|
|
}
|
|
|
|
|
|
@@ -532,13 +542,20 @@ func (c *VerifyTemplateController) Map_Data_Pu() {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
- _, is := Task.Read_Task(body.T_task_id)
|
|
|
|
|
|
+ task, is := Task.Read_Task(body.T_task_id)
|
|
if !is {
|
|
if !is {
|
|
c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_task_id 错误!"}
|
|
c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_task_id 错误!"}
|
|
c.ServeJSON()
|
|
c.ServeJSON()
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ task.T_step = body.T_step
|
|
|
|
+ if !Task.Update_Task(task, "T_step") {
|
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "修改任务步骤失败!"}
|
|
|
|
+ c.ServeJSON()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
MapDataList := make([]VerifyTemplate.VerifyTemplateMapData, 0)
|
|
MapDataList := make([]VerifyTemplate.VerifyTemplateMapData, 0)
|
|
for _, v := range body.VerifyTemplateMapData {
|
|
for _, v := range body.VerifyTemplateMapData {
|
|
val := VerifyTemplate.VerifyTemplateMapData{
|
|
val := VerifyTemplate.VerifyTemplateMapData{
|
|
@@ -551,11 +568,12 @@ func (c *VerifyTemplateController) Map_Data_Pu() {
|
|
T_max_time: v.T_max_time,
|
|
T_max_time: v.T_max_time,
|
|
T_min_time: v.T_min_time,
|
|
T_min_time: v.T_min_time,
|
|
|
|
|
|
- T_value: v.T_value,
|
|
|
|
|
|
+ T_value: v.T_value,
|
|
|
|
+ T_start_time: v.T_start_time,
|
|
}
|
|
}
|
|
MapDataList = append(MapDataList, val)
|
|
MapDataList = append(MapDataList, val)
|
|
}
|
|
}
|
|
- ids, is := VerifyTemplate.AddOrUpdate_VerifyTemplateMapData(MapDataList)
|
|
|
|
|
|
+ ids, is := VerifyTemplate.AddOrUpdate_VerifyTemplateMapData_ADD_History(MapDataList, body.T_source)
|
|
if !is {
|
|
if !is {
|
|
c.Data["json"] = lib.JSONS{Code: 202, Msg: "保存失败"}
|
|
c.Data["json"] = lib.JSONS{Code: 202, Msg: "保存失败"}
|
|
c.ServeJSON()
|
|
c.ServeJSON()
|
|
@@ -627,7 +645,7 @@ func (c *VerifyTemplateController) Map_Data_Copy() {
|
|
MapDataList = append(MapDataList, val)
|
|
MapDataList = append(MapDataList, val)
|
|
}
|
|
}
|
|
var ids []int64
|
|
var ids []int64
|
|
- ids, is = VerifyTemplate.AddOrUpdate_VerifyTemplateMapData(MapDataList)
|
|
|
|
|
|
+ ids, is = VerifyTemplate.AddOrUpdate_VerifyTemplateMapData_ADD_History(MapDataList, T_source)
|
|
if !is {
|
|
if !is {
|
|
c.Data["json"] = lib.JSONS{Code: 202, Msg: "保存失败"}
|
|
c.Data["json"] = lib.JSONS{Code: 202, Msg: "保存失败"}
|
|
c.ServeJSON()
|
|
c.ServeJSON()
|
|
@@ -640,6 +658,183 @@ func (c *VerifyTemplateController) Map_Data_Copy() {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+// 添加标签数据
|
|
|
|
+func (c *VerifyTemplateController) Map_Data_History_List() {
|
|
|
|
+ // 验证登录 User_is, User_r
|
|
|
|
+ _, User_is := Account.Verification_Admin(c.Ctx.GetCookie("User_tokey"), c.GetString("User_tokey"))
|
|
|
|
+ if !User_is {
|
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 201, Msg: "请重新登录!"}
|
|
|
|
+ c.ServeJSON()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ T_task_id := c.GetString("T_task_id")
|
|
|
|
+ T_source, _ := c.GetInt("T_source")
|
|
|
|
+ _, is := Task.Read_Task(T_task_id)
|
|
|
|
+ if !is {
|
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_task_id 错误!"}
|
|
|
|
+ c.ServeJSON()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!", Data: VerifyTemplate.Read_VerifyTemplateMapDataHistory_History_List(T_task_id, T_source)}
|
|
|
|
+ c.ServeJSON()
|
|
|
|
+ return
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// 标签数据列表 -
|
|
|
|
+func (c *VerifyTemplateController) Map_Data_History_Data_List() {
|
|
|
|
+ // 验证登录 User_is, User_r
|
|
|
|
+ _, User_is := Account.Verification_Admin(c.Ctx.GetCookie("User_tokey"), c.GetString("User_tokey"))
|
|
|
|
+ if !User_is {
|
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 201, Msg: "请重新登录!"}
|
|
|
|
+ c.ServeJSON()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ T_time := c.GetString("T_time")
|
|
|
|
+ if len(T_time) == 0 {
|
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "请选择时间点!"}
|
|
|
|
+ c.ServeJSON()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ T_source, _ := c.GetInt("T_source")
|
|
|
|
+
|
|
|
|
+ if T_source == 0 {
|
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_source Err!"}
|
|
|
|
+ c.ServeJSON()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ T_task_id := c.GetString("T_task_id")
|
|
|
|
+ task, is := Task.Read_Task(T_task_id)
|
|
|
|
+ if !is {
|
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_task_id 错误!"}
|
|
|
|
+ c.ServeJSON()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Map_List := VerifyTemplate.Read_VerifyTemplateMap_List_For_Data(task.T_VerifyTemplate_id, T_source, 0)
|
|
|
|
+ Data := VerifyTemplate.Read_VerifyTemplateMapDataHistory_List(T_source, T_task_id, task.T_VerifyTemplate_id, T_time, Map_List)
|
|
|
|
+
|
|
|
|
+ type JSONS struct {
|
|
|
|
+ //必须的大写开头
|
|
|
|
+ Code int16
|
|
|
|
+ Msg string
|
|
|
|
+ Data interface{} // 泛型
|
|
|
|
+ T_step int
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ c.Data["json"] = JSONS{Code: 200, Msg: "ok!", Data: Data, T_step: task.T_step}
|
|
|
|
+ c.ServeJSON()
|
|
|
|
+ return
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// 清除数据
|
|
|
|
+func (c *VerifyTemplateController) Map_Data_Clear_Value() {
|
|
|
|
+ // 验证登录 User_is, User_r
|
|
|
|
+ User_r, User_is := Account.Verification_Admin(c.Ctx.GetCookie("User_tokey"), c.GetString("User_tokey"))
|
|
|
|
+ if !User_is {
|
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 201, Msg: "请重新登录!"}
|
|
|
|
+ c.ServeJSON()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ T_VerifyTemplate_id := c.GetString("T_VerifyTemplate_id")
|
|
|
|
+ T_VerifyTemplateMap_id := c.GetString("T_VerifyTemplateMap_id")
|
|
|
|
+
|
|
|
|
+ T_task_id := c.GetString("T_task_id")
|
|
|
|
+ _, is := Task.Read_Task(T_task_id)
|
|
|
|
+ if !is {
|
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_task_id 错误!"}
|
|
|
|
+ c.ServeJSON()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ VerifyTemplate.Clear_VerifyTemplateMapData_T_value(T_task_id, T_VerifyTemplate_id, T_VerifyTemplateMap_id)
|
|
|
|
+
|
|
|
|
+ System.Add_UserLogs_T(User_r.T_uuid, "验证模版标签数据", "清除数据", fmt.Sprintf("T_task_id:%s T_VerifyTemplate_id:%s T_VerifyTemplateMap_id:%s", T_task_id, T_VerifyTemplate_id, T_VerifyTemplateMap_id))
|
|
|
|
+
|
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!"}
|
|
|
|
+ c.ServeJSON()
|
|
|
|
+ return
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// 历史数据恢复
|
|
|
|
+func (c *VerifyTemplateController) Map_Data_History_Recover() {
|
|
|
|
+ // 验证登录 User_is, User_r
|
|
|
|
+ User_r, User_is := Account.Verification_Admin(c.Ctx.GetCookie("User_tokey"), c.GetString("User_tokey"))
|
|
|
|
+ if !User_is {
|
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 201, Msg: "请重新登录!"}
|
|
|
|
+ c.ServeJSON()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ T_time := c.GetString("T_time")
|
|
|
|
+ if len(T_time) == 0 {
|
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "请选择时间点!"}
|
|
|
|
+ c.ServeJSON()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ T_source, _ := c.GetInt("T_source")
|
|
|
|
+
|
|
|
|
+ if T_source == 0 {
|
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_source Err!"}
|
|
|
|
+ c.ServeJSON()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ T_task_id := c.GetString("T_task_id")
|
|
|
|
+ task, is := Task.Read_Task(T_task_id)
|
|
|
|
+ if !is {
|
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_task_id 错误!"}
|
|
|
|
+ c.ServeJSON()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ HistoryList := VerifyTemplate.Read_MapDataHistory_List(T_source, T_task_id, task.T_VerifyTemplate_id, T_time)
|
|
|
|
+
|
|
|
|
+ list := VerifyTemplate.Read_MapData_List(T_source, T_task_id, task.T_VerifyTemplate_id)
|
|
|
|
+ HistoryListMap := make(map[string]VerifyTemplate.VerifyTemplateMapDataHistory)
|
|
|
|
+ for _, data := range HistoryList {
|
|
|
|
+ HistoryListMap[data.T_VerifyTemplateMap_id] = data
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ MapDataList := make([]VerifyTemplate.VerifyTemplateMapData, 0)
|
|
|
|
+ for _, v := range list {
|
|
|
|
+ if len(v.T_value) > 0 {
|
|
|
|
+ continue
|
|
|
|
+ }
|
|
|
|
+ if HistoryListMap[v.T_VerifyTemplateMap_id].T_value == "" {
|
|
|
|
+ continue
|
|
|
|
+ }
|
|
|
|
+ val := VerifyTemplate.VerifyTemplateMapData{
|
|
|
|
+ T_source: T_source,
|
|
|
|
+ T_task_id: task.T_task_id,
|
|
|
|
+ T_VerifyTemplate_id: task.T_VerifyTemplate_id,
|
|
|
|
+ T_VerifyTemplateMap_id: v.T_VerifyTemplateMap_id,
|
|
|
|
+
|
|
|
|
+ T_flow_sort: v.T_flow_sort,
|
|
|
|
+ T_max_time: v.T_max_time,
|
|
|
|
+ T_min_time: v.T_min_time,
|
|
|
|
+
|
|
|
|
+ T_value: HistoryListMap[v.T_VerifyTemplateMap_id].T_value,
|
|
|
|
+ }
|
|
|
|
+ MapDataList = append(MapDataList, val)
|
|
|
|
+ }
|
|
|
|
+ var ids []int64
|
|
|
|
+ ids, is = VerifyTemplate.AddOrUpdate_VerifyTemplateMapData(MapDataList)
|
|
|
|
+ if !is {
|
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "保存失败"}
|
|
|
|
+ c.ServeJSON()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ System.Add_UserLogs_T(User_r.T_uuid, "验证模版标签数据", "恢复", MapDataList)
|
|
|
|
+
|
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!", Data: ids}
|
|
|
|
+ c.ServeJSON()
|
|
|
|
+ return
|
|
|
|
+}
|
|
|
|
+
|
|
func (c *VerifyTemplateController) Class_List() {
|
|
func (c *VerifyTemplateController) Class_List() {
|
|
// 验证登录 User_is, User_r
|
|
// 验证登录 User_is, User_r
|
|
_, User_is := Account.Verification_Admin(c.Ctx.GetCookie("User_tokey"), c.GetString("User_tokey"))
|
|
_, User_is := Account.Verification_Admin(c.Ctx.GetCookie("User_tokey"), c.GetString("User_tokey"))
|