|
@@ -656,6 +656,8 @@ func (c *VerifyTemplateController) Map_Data_Pu() {
|
|
|
T_task_id string
|
|
T_task_id string
|
|
|
T_VerifyTemplate_id string
|
|
T_VerifyTemplate_id string
|
|
|
T_step int // 进行步骤下标
|
|
T_step int // 进行步骤下标
|
|
|
|
|
+ T_submit int // 1-app 2-报告生成
|
|
|
|
|
+ T_history int // 0不保存历史 1保存历史
|
|
|
VerifyTemplateMapData []VerifyTemplate.VerifyTemplateMapData_R
|
|
VerifyTemplateMapData []VerifyTemplate.VerifyTemplateMapData_R
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -667,6 +669,8 @@ func (c *VerifyTemplateController) Map_Data_Pu() {
|
|
|
c.ServeJSON()
|
|
c.ServeJSON()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ logs.Println(fmt.Sprintf("%+v", body))
|
|
|
|
|
+
|
|
|
User_r, User_is := Account.Verification_Admin(body.User_tokey, "")
|
|
User_r, User_is := Account.Verification_Admin(body.User_tokey, "")
|
|
|
if !User_is {
|
|
if !User_is {
|
|
|
System.Add_UserLogs_T(User_r.T_uuid, "验证模版标签数据", "未登录-保存", body)
|
|
System.Add_UserLogs_T(User_r.T_uuid, "验证模版标签数据", "未登录-保存", body)
|
|
@@ -682,9 +686,12 @@ func (c *VerifyTemplateController) Map_Data_Pu() {
|
|
|
c.ServeJSON()
|
|
c.ServeJSON()
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+ T_reporting_state := task.T_reporting_state
|
|
|
task.T_step = body.T_step
|
|
task.T_step = body.T_step
|
|
|
- if !Task.Update_Task(task, "T_step") {
|
|
|
|
|
|
|
+ if body.T_submit == 2 && T_reporting_state == 0 {
|
|
|
|
|
+ task.T_reporting_state = 6
|
|
|
|
|
+ }
|
|
|
|
|
+ if !Task.Update_Task(task, "T_step", "T_reporting_state") {
|
|
|
c.Data["json"] = lib.JSONS{Code: 202, Msg: "修改任务步骤失败!"}
|
|
c.Data["json"] = lib.JSONS{Code: 202, Msg: "修改任务步骤失败!"}
|
|
|
c.ServeJSON()
|
|
c.ServeJSON()
|
|
|
return
|
|
return
|
|
@@ -731,12 +738,46 @@ func (c *VerifyTemplateController) Map_Data_Pu() {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- ids, is := VerifyTemplate.AddOrUpdate_VerifyTemplateMapData_ADD_History(MapDataList, body.T_source, User_r.T_uuid)
|
|
|
|
|
|
|
+ var T_cover int
|
|
|
|
|
+ if body.T_submit == 1 && T_reporting_state > 0 {
|
|
|
|
|
+ T_cover = 1
|
|
|
|
|
+ }
|
|
|
|
|
+ ids, is := VerifyTemplate.AddOrUpdate_VerifyTemplateMapData_ADD_History(MapDataList, body.T_source, User_r.T_uuid, body.T_submit, T_cover, body.T_history)
|
|
|
if !is {
|
|
if !is {
|
|
|
c.Data["json"] = lib.JSONS{Code: 202, Msg: "保存失败"}
|
|
c.Data["json"] = lib.JSONS{Code: 202, Msg: "保存失败"}
|
|
|
c.ServeJSON()
|
|
c.ServeJSON()
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ // 手机app提交,发送消息通知
|
|
|
|
|
+ if body.T_submit == 1 {
|
|
|
|
|
+ _, company_r := Account.Read_User_ByT_uuid(task.T_uuid)
|
|
|
|
|
+ _, admin_r := Account.Read_Admin_ByT_uuid(task.T_collection)
|
|
|
|
|
+ System.Add_App_News(conf.VdelUuid, fmt.Sprintf("【%s-%s】数据采集工程师 %s 已提交", company_r.T_name, task.T_name, admin_r.T_name), "")
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 报告生成,备份数据
|
|
|
|
|
+ if body.T_submit == 2 {
|
|
|
|
|
+ var_ := Task.TaskCopy{
|
|
|
|
|
+ T_task_id: task.T_task_id,
|
|
|
|
|
+ T_time: "报告生成数据",
|
|
|
|
|
+ T_State: 2,
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ T_copy_id, is2 := Task.Add_TaskCopy(var_)
|
|
|
|
|
+ if !is2 {
|
|
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "添加失败!"}
|
|
|
|
|
+ c.ServeJSON()
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ // 创建数据表
|
|
|
|
|
+ Task.CREATE_TaskDataCopy("default", T_copy_id)
|
|
|
|
|
+ // 将数据表存档
|
|
|
|
|
+ Task.TaskData_Arhiving(task.T_task_id, T_copy_id)
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
System.Add_UserLogs_T(User_r.T_uuid, "验证模版标签数据", "保存", body)
|
|
System.Add_UserLogs_T(User_r.T_uuid, "验证模版标签数据", "保存", body)
|
|
|
|
|
|
|
|
c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!", Data: ids}
|
|
c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!", Data: ids}
|
|
@@ -806,7 +847,7 @@ func (c *VerifyTemplateController) Map_Data_Copy2() {
|
|
|
MapDataList = append(MapDataList, val)
|
|
MapDataList = append(MapDataList, val)
|
|
|
}
|
|
}
|
|
|
var ids []int64
|
|
var ids []int64
|
|
|
- ids, is = VerifyTemplate.AddOrUpdate_VerifyTemplateMapData_ADD_History(MapDataList, T_source, User_r.T_uuid)
|
|
|
|
|
|
|
+ ids, is = VerifyTemplate.AddOrUpdate_VerifyTemplateMapData_ADD_History(MapDataList, T_source, User_r.T_uuid, 0, 0, 0)
|
|
|
if !is {
|
|
if !is {
|
|
|
c.Data["json"] = lib.JSONS{Code: 202, Msg: "保存失败"}
|
|
c.Data["json"] = lib.JSONS{Code: 202, Msg: "保存失败"}
|
|
|
c.ServeJSON()
|
|
c.ServeJSON()
|
|
@@ -891,7 +932,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_ADD_History(MapDataList, 0, "")
|
|
|
|
|
|
|
+ ids, is = VerifyTemplate.AddOrUpdate_VerifyTemplateMapData_ADD_History(MapDataList, 0, "", 0, 0, 0)
|
|
|
if !is {
|
|
if !is {
|
|
|
c.Data["json"] = lib.JSONS{Code: 202, Msg: "保存失败"}
|
|
c.Data["json"] = lib.JSONS{Code: 202, Msg: "保存失败"}
|
|
|
c.ServeJSON()
|
|
c.ServeJSON()
|
|
@@ -915,7 +956,7 @@ func (c *VerifyTemplateController) Map_Data_History_List() {
|
|
|
}
|
|
}
|
|
|
T_task_id := c.GetString("T_task_id")
|
|
T_task_id := c.GetString("T_task_id")
|
|
|
T_source, _ := c.GetInt("T_source")
|
|
T_source, _ := c.GetInt("T_source")
|
|
|
- _, 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()
|
|
@@ -924,7 +965,15 @@ func (c *VerifyTemplateController) Map_Data_History_List() {
|
|
|
|
|
|
|
|
AdminMap := Account.AdminListToMap(Account.Read_Admin_List_ALL_1())
|
|
AdminMap := Account.AdminListToMap(Account.Read_Admin_List_ALL_1())
|
|
|
|
|
|
|
|
- c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!", Data: VerifyTemplate.Read_VerifyTemplateMapDataHistory_History_List(T_task_id, T_source, AdminMap)}
|
|
|
|
|
|
|
+ UseVerifyTemplateMapDataHistoryTime, _ := lib.TimeStrToTime(conf.UseVerifyTemplateMapDataHistoryTime)
|
|
|
|
|
+ var Data []VerifyTemplate.VerifyTemplateMapDataHistory_History_List_Res
|
|
|
|
|
+ if len(conf.UseVerifyTemplateMapDataHistoryTime) > 0 && task.CreateTime.After(UseVerifyTemplateMapDataHistoryTime) {
|
|
|
|
|
+ Data = VerifyTemplate.Read_VerifyTemplateMapDataHistory_History_List2(T_task_id, T_source, AdminMap)
|
|
|
|
|
+ } else {
|
|
|
|
|
+ Data = VerifyTemplate.Read_VerifyTemplateMapDataHistory_History_List(T_task_id, T_source, AdminMap)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!", Data: Data}
|
|
|
c.ServeJSON()
|
|
c.ServeJSON()
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
@@ -1085,6 +1134,92 @@ func (c *VerifyTemplateController) Map_Data_History_Recover() {
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+// 覆盖数据
|
|
|
|
|
+func (c *VerifyTemplateController) Map_Data_Cover() {
|
|
|
|
|
+ // 验证登录 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_cover, _ := c.GetInt("T_cover") // 1覆盖 0不覆盖
|
|
|
|
|
+
|
|
|
|
|
+ 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
|
|
|
|
|
+ }
|
|
|
|
|
+ var ids []int64
|
|
|
|
|
+ if T_cover == 1 {
|
|
|
|
|
+ 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_Required: v.T_Required,
|
|
|
|
|
+ T_Construction: v.T_Construction,
|
|
|
|
|
+
|
|
|
|
|
+ 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)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ 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)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ task.T_cover = 0
|
|
|
|
|
+ task.T_backup = ""
|
|
|
|
|
+ Task.Update_Task(task, "T_cover", "T_backup")
|
|
|
|
|
+
|
|
|
|
|
+ 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_r, User_is := Account.Verification_Admin(c.Ctx.GetCookie("User_tokey"), c.GetString("User_tokey"))
|
|
User_r, User_is := Account.Verification_Admin(c.Ctx.GetCookie("User_tokey"), c.GetString("User_tokey"))
|