|
@@ -2524,3 +2524,87 @@ func (c *TaskController) StatisticalRanking() {
|
|
|
c.ServeJSON()
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+// 添加-
|
|
|
+func (c *TaskController) Copy() {
|
|
|
+
|
|
|
+ // 验证登录 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_name := c.GetString("T_name")
|
|
|
+ T_task_id := c.GetString("T_task_id")
|
|
|
+ r, is := Task.Read_Task(T_task_id)
|
|
|
+ if !is {
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "获取信息采集失败!"}
|
|
|
+ c.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ // 查询信息采集信息
|
|
|
+ infoCollection, is := InfoCollection.Read_InfoCollection(r.T_InfoCollection_id)
|
|
|
+ if !is {
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "获取信息采集失败!"}
|
|
|
+ c.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ var_ := Task.Task{
|
|
|
+ T_Distributor_id: User_r.T_Distributor_id,
|
|
|
+ T_InfoCollection_id: r.T_InfoCollection_id,
|
|
|
+ T_InfoTemplate_id: infoCollection.T_InfoTemplate_id,
|
|
|
+ T_start_time: infoCollection.T_start_time, // 项目开始时间使用信息采集开始时间
|
|
|
+ T_class: r.T_class,
|
|
|
+ T_uuid: r.T_uuid,
|
|
|
+ T_name: T_name,
|
|
|
+ T_VerifyTemplate_class: r.T_VerifyTemplate_class,
|
|
|
+ T_VerifyTemplate_id: r.T_VerifyTemplate_id,
|
|
|
+ T_deadline: r.T_deadline,
|
|
|
+ T_scheme: r.T_scheme,
|
|
|
+ T_collection: r.T_collection,
|
|
|
+ T_reporting: r.T_reporting,
|
|
|
+ T_delivery: r.T_delivery,
|
|
|
+ T_Show: 1,
|
|
|
+ T_State: 1,
|
|
|
+
|
|
|
+ T_project: r.T_project,
|
|
|
+ T_province: r.T_province,
|
|
|
+ T_city: r.T_city,
|
|
|
+ T_district: r.T_district,
|
|
|
+ T_province_code: r.T_province_code,
|
|
|
+ T_city_code: r.T_city_code,
|
|
|
+ T_district_code: r.T_district_code,
|
|
|
+ T_category: r.T_category,
|
|
|
+ T_device_type: r.T_device_type,
|
|
|
+ T_volume: r.T_volume,
|
|
|
+ T_verify_type: r.T_verify_type,
|
|
|
+ T_subject_matter: r.T_subject_matter,
|
|
|
+ T_temp_range: r.T_temp_range,
|
|
|
+ T_report_number: r.T_report_number,
|
|
|
+ T_report_type: r.T_report_type,
|
|
|
+ }
|
|
|
+
|
|
|
+ id, is := Task.Add_Task(var_)
|
|
|
+ if !is {
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "添加失败!"}
|
|
|
+ c.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ NatsServer.Create_Local_Table(T_task_id)
|
|
|
+
|
|
|
+ // 通知
|
|
|
+ _, company_r := Account.Read_User_ByT_uuid(var_.T_uuid)
|
|
|
+ go wx.WxSend(var_.T_scheme, fmt.Sprintf("【%s-%s】任务派发", company_r.T_name, var_.T_name))
|
|
|
+ go wx.WxSend(var_.T_collection, fmt.Sprintf("【%s-%s】任务派发", company_r.T_name, var_.T_name))
|
|
|
+ go wx.WxSend(var_.T_reporting, fmt.Sprintf("【%s-%s】任务派发", company_r.T_name, var_.T_name))
|
|
|
+ go wx.WxSend(var_.T_delivery, fmt.Sprintf("【%s-%s】任务派发", company_r.T_name, var_.T_name))
|
|
|
+
|
|
|
+ // 添加任务操作日志
|
|
|
+ Task.Add_TaskLogs_T(User_r.T_uuid, id, "任务管理", "添加", var_)
|
|
|
+ System.Add_UserLogs_T(User_r.T_uuid, "任务管理", "添加", var_)
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!", Data: id}
|
|
|
+ c.ServeJSON()
|
|
|
+ return
|
|
|
+}
|