|
@@ -4,6 +4,7 @@ import (
|
|
|
"ColdVerify_server/Nats/NatsServer"
|
|
|
"ColdVerify_server/conf"
|
|
|
"ColdVerify_server/lib"
|
|
|
+ "ColdVerify_server/lib/wx"
|
|
|
"ColdVerify_server/logs"
|
|
|
"ColdVerify_server/models/Account"
|
|
|
"ColdVerify_server/models/Device"
|
|
@@ -68,6 +69,7 @@ func (c *TaskController) List() {
|
|
|
T_reporting_state := c.GetString("T_reporting_state") // 报告编写 状态 0 未完成 1 已完成(客户通过) 2已退回(客户) 3已通过(负责人) 4已退回(负责人) 5已提交
|
|
|
T_delivery_state := c.GetString("T_delivery_state") // 交付审核 状态 0 未完成 1 已完成 2 处理中
|
|
|
T_marking_state := c.GetString("T_marking_state") // 验证标识 状态 0 未完成 1 已完成
|
|
|
+ CreateTime := c.GetString("CreateTime") // 任务添加时间
|
|
|
|
|
|
UserMap := Account.UserListToMap(Account.Read_User_List_ALL_1())
|
|
|
AdminMap := Account.AdminListToMap(Account.Read_Admin_List_ALL_1())
|
|
@@ -85,7 +87,7 @@ func (c *TaskController) List() {
|
|
|
var cnt int
|
|
|
List, cnt := Task.Read_Task_List(T_uuid, T_admin, T_name, T_InfoCollection_id, T_scheme, T_collection, T_reporting, T_delivery,
|
|
|
T_scheme_state, T_collection_state, T_reporting_state, T_delivery_state, T_marking_state,
|
|
|
- T_company_list, UserMap, AdminMap, page, page_z)
|
|
|
+ T_company_list, UserMap, AdminMap,CreateTime, page, page_z)
|
|
|
|
|
|
page_size := math.Ceil(float64(cnt) / float64(page_z))
|
|
|
r_jsons.List = List
|
|
@@ -134,6 +136,7 @@ func (c *TaskController) Stat() {
|
|
|
T_reporting_state := c.GetString("T_reporting_state") // 报告编写 状态 0 未完成 1 已完成(客户通过) 2已退回(客户) 3已通过(负责人) 4已退回(负责人) 5已提交
|
|
|
T_delivery_state := c.GetString("T_delivery_state") // 交付审核 状态 0 未完成 1 已完成 2 处理中
|
|
|
T_marking_state := c.GetString("T_marking_state") // 验证标识 状态 0 未完成 1 已完成
|
|
|
+ CreateTime := c.GetString("CreateTime") // 任务添加时间
|
|
|
|
|
|
UserMap := Account.UserListToMap(Account.Read_User_List_ALL_1())
|
|
|
AdminMap := Account.AdminListToMap(Account.Read_Admin_List_ALL_1())
|
|
@@ -151,7 +154,7 @@ func (c *TaskController) Stat() {
|
|
|
var cnt int
|
|
|
List, cnt := Task.Read_Task_Stat(T_uuid, T_admin, T_name, T_InfoCollection_id, T_project, T_scheme, T_collection, T_reporting, T_delivery,
|
|
|
T_scheme_state, T_collection_state, T_reporting_state, T_delivery_state, T_marking_state,
|
|
|
- T_company_list, UserMap, AdminMap, page, page_z)
|
|
|
+ T_company_list, UserMap, AdminMap,CreateTime, page, page_z)
|
|
|
|
|
|
page_size := math.Ceil(float64(cnt) / float64(page_z))
|
|
|
r_jsons.List = List
|
|
@@ -190,6 +193,7 @@ func (c *TaskController) Stat_Excel() {
|
|
|
T_reporting_state := c.GetString("T_reporting_state") // 报告编写 状态 0 未完成 1 已完成(客户通过) 2已退回(客户) 3已通过(负责人) 4已退回(负责人) 5已提交
|
|
|
T_delivery_state := c.GetString("T_delivery_state") // 交付审核 状态 0 未完成 1 已完成 2 处理中
|
|
|
T_marking_state := c.GetString("T_marking_state") // 验证标识 状态 0 未完成 1 已完成
|
|
|
+ CreateTime := c.GetString("CreateTime") // 任务添加时间
|
|
|
|
|
|
UserMap := Account.UserListToMap(Account.Read_User_List_ALL_1())
|
|
|
AdminMap := Account.AdminListToMap(Account.Read_Admin_List_ALL_1())
|
|
@@ -206,7 +210,7 @@ func (c *TaskController) Stat_Excel() {
|
|
|
|
|
|
List, _ := Task.Read_Task_Stat(T_uuid, T_admin, T_name, T_InfoCollection_id, T_project, T_scheme, T_collection, T_reporting, T_delivery,
|
|
|
T_scheme_state, T_collection_state, T_reporting_state, T_delivery_state, T_marking_state,
|
|
|
- T_company_list, UserMap, AdminMap, 0, 9999)
|
|
|
+ T_company_list, UserMap, AdminMap,CreateTime, 0, 9999)
|
|
|
|
|
|
f := excelize.NewFile() // 设置单元格的值
|
|
|
line := 1
|
|
@@ -227,7 +231,6 @@ func (c *TaskController) Stat_Excel() {
|
|
|
f.MergeCell("Sheet1", fmt.Sprintf("N%d", line), fmt.Sprintf("N%d", line+1))
|
|
|
f.MergeCell("Sheet1", fmt.Sprintf("O%d", line), fmt.Sprintf("O%d", line+1))
|
|
|
f.MergeCell("Sheet1", fmt.Sprintf("P%d", line), fmt.Sprintf("P%d", line+1))
|
|
|
-
|
|
|
f.MergeCell("Sheet1", fmt.Sprintf("Q%d", line), fmt.Sprintf("U%d", line))
|
|
|
f.MergeCell("Sheet1", fmt.Sprintf("V%d", line), fmt.Sprintf("AA%d", line))
|
|
|
f.MergeCell("Sheet1", fmt.Sprintf("AB%d", line), fmt.Sprintf("AG%d", line))
|
|
@@ -277,6 +280,7 @@ func (c *TaskController) Stat_Excel() {
|
|
|
f.SetCellValue("Sheet1", fmt.Sprintf("AK%d", line+1), "退回次数")
|
|
|
f.SetCellValue("Sheet1", fmt.Sprintf("AL%d", line+1), "所需时间")
|
|
|
f.SetCellValue("Sheet1", fmt.Sprintf("AM%d", line+1), "超时时间")
|
|
|
+ f.SetCellValue("Sheet1", fmt.Sprintf("AN%d", line+1), "领导备注")
|
|
|
|
|
|
// 设置列宽
|
|
|
f.SetColWidth("Sheet1", "A", "A", 7)
|
|
@@ -384,6 +388,7 @@ func (c *TaskController) Stat_Excel() {
|
|
|
f.SetCellValue("Sheet1", fmt.Sprintf("AK%d", line), v.T_reporting_return_times)
|
|
|
f.SetCellValue("Sheet1", fmt.Sprintf("AL%d", line), v.T_reporting_time_interval)
|
|
|
f.SetCellValue("Sheet1", fmt.Sprintf("AM%d", line), v.T_reporting_overtime)
|
|
|
+ f.SetCellValue("Sheet1", fmt.Sprintf("AN%d", line), v.T_record)
|
|
|
}
|
|
|
|
|
|
Style2, _ := f.NewStyle(
|
|
@@ -468,6 +473,7 @@ func (c *TaskController) Stat_Excel() {
|
|
|
f.SetCellStyle("Sheet1", "V1", "AA1", StyleOrangeFill)
|
|
|
f.SetCellStyle("Sheet1", "AB1", "AG1", StyleYellowFill)
|
|
|
f.SetCellStyle("Sheet1", "AH1", "AM1", StyleGreenFill)
|
|
|
+ f.SetCellStyle("Sheet1", "AN1", "AN2", StyleBlueFill)
|
|
|
|
|
|
// 冻结1-2行
|
|
|
f.SetPanes("Sheet1", &excelize.Panes{
|
|
@@ -694,6 +700,15 @@ func (c *TaskController) Add() {
|
|
|
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, T_task_id, "任务管理", "添加", var_)
|
|
|
System.Add_UserLogs_T(User_r.T_uuid, "任务管理", "添加", var_)
|
|
@@ -714,6 +729,7 @@ func (c *TaskController) ReceiptInfoCollection() {
|
|
|
}
|
|
|
// 修改信息采集状态为已接收
|
|
|
T_InfoCollection_id := c.GetString("T_InfoCollection_id")
|
|
|
+ //T_status,_ := c.GetInt("T_status")
|
|
|
infoCollection, is := InfoCollection.Read_InfoCollection(T_InfoCollection_id)
|
|
|
if !is {
|
|
|
c.Data["json"] = lib.JSONS{Code: 202, Msg: "Id 错误!"}
|
|
@@ -725,36 +741,41 @@ func (c *TaskController) ReceiptInfoCollection() {
|
|
|
c.ServeJSON()
|
|
|
return
|
|
|
}
|
|
|
- infoCollection.T_status = InfoCollection.InfoCollectionStatusReceipt
|
|
|
- if len(infoCollection.T_end_time) == 0 {
|
|
|
- infoCollection.T_end_time = time.Now().Format("2006-01-02 15:04:05")
|
|
|
- infoCollection.T_time_interval, _ = lib.MinutesDifference(infoCollection.T_start_time, infoCollection.T_end_time)
|
|
|
- }
|
|
|
+ //infoCollection.T_status = InfoCollection.InfoCollectionStatusReceipt
|
|
|
+ //if len(infoCollection.T_end_time) == 0 {
|
|
|
+ // infoCollection.T_end_time = time.Now().Format("2006-01-02 15:04:05")
|
|
|
+ // infoCollection.T_time_interval, _ = lib.MinutesDifference(infoCollection.T_start_time, infoCollection.T_end_time)
|
|
|
+ //}
|
|
|
|
|
|
- if !InfoCollection.Update_InfoCollection(infoCollection, "T_status", "T_end_time", "T_time_interval") {
|
|
|
+ //if !InfoCollection.Update_InfoCollection(infoCollection, "T_status", "T_end_time", "T_time_interval") {
|
|
|
+ infoCollection.T_status = 3 // 已接收
|
|
|
+ if !InfoCollection.Update_InfoCollection(infoCollection, "T_status") {
|
|
|
c.Data["json"] = lib.JSONS{Code: 202, Msg: "修改失败!"}
|
|
|
c.ServeJSON()
|
|
|
return
|
|
|
}
|
|
|
System.Add_UserLogs_T(User_r.T_uuid, "信息采集管理", "接收信息采集", infoCollection)
|
|
|
|
|
|
+ //if T_status == InfoCollection.InfoCollectionStatusReturn{
|
|
|
+ // // 通知 报告负责人审核
|
|
|
+ // _, company_r := Account.Read_User_ByT_uuid(infoCollection.T_uuid)
|
|
|
+ // System.Add_News(conf.VdelUuid, fmt.Sprintf("【%s-%s】信息采集 已退回", company_r.T_name, infoCollection.T_name), "")
|
|
|
+ // go wx.WxSend(conf.VdelUuid, fmt.Sprintf("【%s-%s】信息采集 已退回", company_r.T_name, infoCollection.T_name))
|
|
|
+ //
|
|
|
+ //}
|
|
|
+
|
|
|
// 修改任务管理实施方案开始时间
|
|
|
- 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: "Id 错误!"}
|
|
|
- c.ServeJSON()
|
|
|
- return
|
|
|
- }
|
|
|
- task.T_scheme_start_time = time.Now().Format("2006-01-02 15:04:05")
|
|
|
- if !Task.Update_Task(task, "T_scheme_start_time") {
|
|
|
- c.Data["json"] = lib.JSONS{Code: 202, Msg: "修改失败!"}
|
|
|
- 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: "Id 错误!"}
|
|
|
+ // c.ServeJSON()
|
|
|
+ // return
|
|
|
+ //}
|
|
|
+
|
|
|
// 添加任务操作日志
|
|
|
- Task.Add_TaskLogs_T(User_r.T_uuid, T_task_id, "任务管理", "接收信息采集", task)
|
|
|
- System.Add_UserLogs_T(User_r.T_uuid, "任务管理", "接收信息采集", task)
|
|
|
+ //Task.Add_TaskLogs_T(User_r.T_uuid, T_task_id, "任务管理", "接收信息采集", task)
|
|
|
+ //System.Add_UserLogs_T(User_r.T_uuid, "任务管理", "接收信息采集", task)
|
|
|
c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!"}
|
|
|
c.ServeJSON()
|
|
|
return
|
|
@@ -874,11 +895,10 @@ func (c *TaskController) UpCollectionState() {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- AdminMap := Account.AdminListToMap(Account.Read_Admin_List_ALL_1())
|
|
|
- if T_collection_state == Task.TaskCollectionStateReturn ||
|
|
|
- T_collection_state == Task.TaskCollectionStatePass {
|
|
|
- System.Add_News(r.T_collection, fmt.Sprintf("【数据编辑】您提交的数据编辑【%s-%s】审核%s", company_r.T_name, r.T_name, Task.TaskCollectionStateMap[T_collection_state]), "")
|
|
|
- go System.Send_Weichat_News(AdminMap[r.T_collection], fmt.Sprintf("【数据编辑】您提交的数据编辑【%s-%s】审核%s", company_r.T_name, r.T_name, Task.TaskCollectionStateMap[T_collection_state]), "")
|
|
|
+ // 已退回(负责人)
|
|
|
+ if T_collection_state == Task.TaskCollectionStateReturn {
|
|
|
+ System.Add_News(r.T_collection, fmt.Sprintf("【%s-%s】数据编辑 %s,%s", company_r.T_name, r.T_name, Task.TaskCollectionStateMap[T_collection_state],T_reason), "")
|
|
|
+ go wx.WxSend(r.T_collection, fmt.Sprintf("【%s-%s】数据编辑 %s,%s", company_r.T_name, r.T_name, Task.TaskCollectionStateMap[T_collection_state],T_reason))
|
|
|
}
|
|
|
|
|
|
// 添加任务操作日志
|
|
@@ -922,6 +942,38 @@ func (c *TaskController) UpDeliveryState() {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+// 更新线上数据后台执行
|
|
|
+func (c *TaskDataController) TaskData_Up_TaskData_Back() {
|
|
|
+ // 验证登录 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")
|
|
|
+ r, is := Task.Read_Task(T_task_id)
|
|
|
+ if !is {
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "Id 错误!"}
|
|
|
+ c.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ // 通知 报告人员
|
|
|
+ _, company_r := Account.Read_User_ByT_uuid(r.T_uuid)
|
|
|
+ infoCollection, _ := InfoCollection.Read_InfoCollection(r.T_InfoCollection_id)
|
|
|
+ System.Add_News(infoCollection.T_submit_uuid, fmt.Sprintf("【%s-%s】报告已完成,请及时通知客户审核", company_r.T_name, r.T_name), "")
|
|
|
+ go wx.WxSend(infoCollection.T_submit_uuid, fmt.Sprintf("【%s-%s】报告已完成,请及时通知客户审核", company_r.T_name, r.T_name))
|
|
|
+
|
|
|
+
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!"}
|
|
|
+ c.ServeJSON()
|
|
|
+ return
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
// 修改-
|
|
|
func (c *TaskController) Up() {
|
|
|
// 验证登录 User_is, User_r
|
|
@@ -944,6 +996,8 @@ func (c *TaskController) Up() {
|
|
|
T_collection_signature := c.GetString("T_collection_signature") // 完成编辑签字图片
|
|
|
T_reporting := c.GetString("T_reporting")
|
|
|
T_delivery := c.GetString("T_delivery")
|
|
|
+ T_record := c.GetString("T_record")
|
|
|
+
|
|
|
T_doc1 := c.GetString("T_doc1")
|
|
|
T_pdf1 := c.GetString("T_pdf1")
|
|
|
T_doc2 := c.GetString("T_doc2")
|
|
@@ -951,6 +1005,9 @@ func (c *TaskController) Up() {
|
|
|
T_doc3 := c.GetString("T_doc3")
|
|
|
T_pdf3 := c.GetString("T_pdf3")
|
|
|
T_pdf4 := c.GetString("T_pdf4") // 验证标识
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
T_VerifyDeviceDataStartTime := c.GetString("T_VerifyDeviceDataStartTime") // 验证设备数据开始时间
|
|
|
T_VerifyDeviceDataEndTime := c.GetString("T_VerifyDeviceDataEndTime") // 验证设备数据开始时间
|
|
|
T_BindDeviceDataStartTime := c.GetString("T_BindDeviceDataStartTime") // 绑定设备数据开始时间
|
|
@@ -972,6 +1029,7 @@ func (c *TaskController) Up() {
|
|
|
T_subject_matter := c.GetString("T_subject_matter") // 标的物名称
|
|
|
T_temp_range := c.GetString("T_temp_range") // 验证温度范围
|
|
|
T_report_number := c.GetString("T_report_number") // 报告编号
|
|
|
+ T_report_type := c.GetString("T_report_type") // 报告编号
|
|
|
|
|
|
T_task_id := c.GetString("T_task_id")
|
|
|
r, is := Task.Read_Task(T_task_id)
|
|
@@ -1003,6 +1061,7 @@ func (c *TaskController) Up() {
|
|
|
r.T_deadline = T_deadline
|
|
|
clos = append(clos, "T_deadline")
|
|
|
}
|
|
|
+
|
|
|
if len(T_scheme) > 0 {
|
|
|
r.T_scheme = T_scheme
|
|
|
clos = append(clos, "T_scheme")
|
|
@@ -1019,6 +1078,11 @@ func (c *TaskController) Up() {
|
|
|
r.T_delivery = T_delivery
|
|
|
clos = append(clos, "T_delivery")
|
|
|
}
|
|
|
+ if len(T_record) > 0 {
|
|
|
+ r.T_record = T_record
|
|
|
+ clos = append(clos, "T_record")
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
// 完成编辑后设置实施结束时间
|
|
|
if T_collection_state == 4 {
|
|
@@ -1030,20 +1094,31 @@ func (c *TaskController) Up() {
|
|
|
clos = append(clos, "T_collection_end_time")
|
|
|
if len(r.T_collection_start_time) > 0 {
|
|
|
r.T_collection_time_interval, _ = lib.MinutesDifference(r.T_collection_start_time, r.T_collection_end_time)
|
|
|
+ // 扣除暂停时间
|
|
|
+ Task_Compute := Task.Read_TaskTime_Compute(r.T_task_id, 1)
|
|
|
+ if Task_Compute > 0 {
|
|
|
+ r.T_collection_time_interval -= float64(Task_Compute)
|
|
|
+ }
|
|
|
+
|
|
|
clos = append(clos, "T_collection_time_interval")
|
|
|
// 所需时间 > 超时时间
|
|
|
if r.T_collection_time_interval > Task.TaskCollectionTimeLimit && len(r.T_report_type) > 0 {
|
|
|
r.T_collection_overtime = r.T_collection_time_interval - Task.TaskCollectionTimeLimit // 超时时间
|
|
|
- clos = append(clos, "T_scheme_overtime")
|
|
|
+ clos = append(clos, "T_collection_overtime")
|
|
|
}
|
|
|
+
|
|
|
+ // 通知 报告人员
|
|
|
+ _, company_r := Account.Read_User_ByT_uuid(r.T_uuid)
|
|
|
+ System.Add_News(r.T_reporting, fmt.Sprintf("【%s-%s】数据采集 已提交", company_r.T_name, r.T_name), "")
|
|
|
+ go wx.WxSend(r.T_reporting, fmt.Sprintf("【%s-%s】数据采集 已提交", company_r.T_name, r.T_name))
|
|
|
+
|
|
|
}
|
|
|
// 添加已提交状态数据编辑记录
|
|
|
auditRecordJson, err := Task.Add_AuditRecord(r.T_collection_audit_record, "", User_r.T_uuid, r.T_collection_state, "", "")
|
|
|
- if err != nil {
|
|
|
- return
|
|
|
+ if err == nil {
|
|
|
+ r.T_collection_audit_record = auditRecordJson
|
|
|
+ clos = append(clos, "T_collection_audit_record")
|
|
|
}
|
|
|
- r.T_collection_audit_record = auditRecordJson
|
|
|
- clos = append(clos, "T_collection_audit_record")
|
|
|
}
|
|
|
|
|
|
if len(T_doc1) > 0 {
|
|
@@ -1069,16 +1144,28 @@ func (c *TaskController) Up() {
|
|
|
clos = append(clos, "T_scheme_audit_record")
|
|
|
r.T_scheme_end_time = time.Now().Format("2006-01-02 15:04:05")
|
|
|
clos = append(clos, "T_scheme_end_time")
|
|
|
- if len(r.T_scheme_start_time) > 0 {
|
|
|
- r.T_scheme_time_interval, _ = lib.MinutesDifference(r.T_scheme_start_time, r.T_scheme_end_time)
|
|
|
- clos = append(clos, "T_scheme_time_interval")
|
|
|
- // 所需时间 > 超时时间
|
|
|
- if r.T_scheme_time_interval > Task.TaskSchemeTimeLimit[r.T_report_type] && len(r.T_report_type) > 0 {
|
|
|
- r.T_scheme_overtime = r.T_scheme_time_interval - Task.TaskSchemeTimeLimit[r.T_report_type] // 超时时间
|
|
|
- clos = append(clos, "T_scheme_overtime")
|
|
|
+
|
|
|
+ r.T_scheme_time_interval, _ = lib.MinutesDifference(r.T_scheme_start_time, r.T_scheme_end_time)
|
|
|
+ Task_Compute := Task.Read_TaskTime_Compute(r.T_task_id, 0)
|
|
|
+ if Task_Compute > 0 {
|
|
|
+ r.T_scheme_time_interval -= float64(Task_Compute)
|
|
|
+ }
|
|
|
+ clos = append(clos, "T_scheme_time_interval")
|
|
|
+
|
|
|
+ // 所需时间 > 超时时间
|
|
|
+ if r.T_scheme_time_interval > Task.TaskSchemeTimeLimit[r.T_report_type] && len(r.T_report_type) > 0 {
|
|
|
+ r.T_scheme_overtime = r.T_scheme_time_interval - Task.TaskSchemeTimeLimit[r.T_report_type] // 超时时间
|
|
|
+ if Task.TaskSchemeTimeLimit[r.T_report_type] == 0 {
|
|
|
+ r.T_scheme_overtime = 0
|
|
|
}
|
|
|
+ clos = append(clos, "T_scheme_overtime")
|
|
|
}
|
|
|
|
|
|
+ // 通知 实施人员进场
|
|
|
+ _, company_r := Account.Read_User_ByT_uuid(r.T_uuid)
|
|
|
+ System.Add_News(r.T_collection, fmt.Sprintf("【%s-%s】验证方案 已提交", company_r.T_name, r.T_name), "")
|
|
|
+ go wx.WxSend(r.T_collection, fmt.Sprintf("【%s-%s】验证方案 已提交", company_r.T_name, r.T_name))
|
|
|
+
|
|
|
}
|
|
|
if len(T_doc2) > 0 {
|
|
|
r.T_doc2 = T_doc2
|
|
@@ -1097,22 +1184,37 @@ func (c *TaskController) Up() {
|
|
|
clos = append(clos, "T_reporting_state")
|
|
|
// 添加已提交状态验证报告记录
|
|
|
auditRecordJson, err := Task.Add_AuditRecord(r.T_reporting_audit_record, "", User_r.T_uuid, r.T_reporting_state, "", "")
|
|
|
- if err != nil {
|
|
|
- return
|
|
|
- }
|
|
|
- r.T_reporting_audit_record = auditRecordJson
|
|
|
- clos = append(clos, "T_reporting_audit_record")
|
|
|
- r.T_reporting_end_time = time.Now().Format("2006-01-02 15:04:05")
|
|
|
- clos = append(clos, "T_reporting_end_time")
|
|
|
- if len(r.T_reporting_start_time) > 0 {
|
|
|
- r.T_reporting_time_interval, _ = lib.MinutesDifference(r.T_reporting_start_time, r.T_reporting_end_time)
|
|
|
- clos = append(clos, "T_reporting_time_interval")
|
|
|
- // 所需时间 > 超时时间
|
|
|
- if r.T_reporting_time_interval > Task.TaskReportingTimeLimit[r.T_report_type] && len(r.T_report_type) > 0 {
|
|
|
- r.T_reporting_overtime = r.T_reporting_time_interval - Task.TaskReportingTimeLimit[r.T_report_type] // 超时时间
|
|
|
- clos = append(clos, "T_reporting_overtime")
|
|
|
+ if err == nil {
|
|
|
+ r.T_reporting_audit_record = auditRecordJson
|
|
|
+ clos = append(clos, "T_reporting_audit_record")
|
|
|
+ r.T_reporting_end_time = time.Now().Format("2006-01-02 15:04:05")
|
|
|
+ clos = append(clos, "T_reporting_end_time")
|
|
|
+ if len(r.T_reporting_start_time) > 0 {
|
|
|
+ r.T_reporting_time_interval, _ = lib.MinutesDifference(r.T_reporting_start_time, r.T_reporting_end_time)
|
|
|
+ clos = append(clos, "T_reporting_time_interval")
|
|
|
+ // 扣除暂停时间
|
|
|
+ Task_Compute := Task.Read_TaskTime_Compute(r.T_task_id, 2)
|
|
|
+ if Task_Compute > 0 {
|
|
|
+ r.T_reporting_time_interval -= float64(Task_Compute)
|
|
|
+ }
|
|
|
+ clos = append(clos, "T_reporting_time_interval")
|
|
|
+ // 所需时间 > 超时时间
|
|
|
+ if r.T_reporting_time_interval > Task.TaskReportingTimeLimit[r.T_report_type] && len(r.T_report_type) > 0 {
|
|
|
+ r.T_reporting_overtime = r.T_reporting_time_interval - Task.TaskReportingTimeLimit[r.T_report_type] // 超时时间
|
|
|
+ if Task.TaskReportingTimeLimit[r.T_report_type] == 0 {
|
|
|
+ r.T_reporting_overtime = 0
|
|
|
+ }
|
|
|
+ clos = append(clos, "T_reporting_overtime")
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ // 通知 报告人员
|
|
|
+ _, company_r := Account.Read_User_ByT_uuid(r.T_uuid)
|
|
|
+ System.Add_News(r.T_delivery, fmt.Sprintf("【%s-%s】验证报告 已提交", company_r.T_name, r.T_name), "")
|
|
|
+ go wx.WxSend(r.T_delivery, fmt.Sprintf("【%s-%s】验证报告 已提交", company_r.T_name, r.T_name))
|
|
|
+
|
|
|
}
|
|
|
if len(T_doc3) > 0 {
|
|
|
r.T_doc3 = T_doc3
|
|
@@ -1156,28 +1258,21 @@ func (c *TaskController) Up() {
|
|
|
clos = append(clos, "T_CalibrationExpirationTime")
|
|
|
}
|
|
|
|
|
|
- if len(T_sn) > 0 && len(T_CalibrationExpirationTime) > 0 {
|
|
|
- err := NatsServer.Cold_UpdateDevice_CalibrationTime(T_sn, T_CalibrationExpirationTime)
|
|
|
- if err != nil {
|
|
|
- c.Data["json"] = lib.JSONS{Code: 202, Msg: err.Error()}
|
|
|
- c.ServeJSON()
|
|
|
- return
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
// 从3.0获取校准时间
|
|
|
if len(T_sn) > 0 && len(T_CalibrationExpirationTime) == 0 {
|
|
|
- device, err := NatsServer.Cold_ReadDeviceByT_sn(T_sn)
|
|
|
- if err != nil {
|
|
|
- err = errors.New("获取SN信息失败,请检查SN是否正确!")
|
|
|
- c.Data["json"] = lib.JSONS{Code: 202, Msg: err.Error()}
|
|
|
- c.ServeJSON()
|
|
|
- return
|
|
|
- }
|
|
|
- if !device.T_CalibrationTime.IsZero() {
|
|
|
- r.T_CalibrationExpirationTime = device.T_CalibrationTime.Format("2006-01-02")
|
|
|
- clos = append(clos, "T_CalibrationExpirationTime")
|
|
|
- }
|
|
|
+
|
|
|
+ go func(r Task.Task,T_sn ,T_CalibrationExpirationTime string) {
|
|
|
+ NatsServer.Cold_UpdateDevice_CalibrationTime(T_sn, T_CalibrationExpirationTime)
|
|
|
+ device, err := NatsServer.Cold_ReadDeviceByT_sn(T_sn)
|
|
|
+ if err == nil {
|
|
|
+ if !device.T_CalibrationTime.IsZero() {
|
|
|
+ r.T_CalibrationExpirationTime = device.T_CalibrationTime.Format("2006-01-02")
|
|
|
+ clos = append(clos, "T_CalibrationExpirationTime")
|
|
|
+ Task.Update_Task(r, "T_CalibrationExpirationTime")
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }(r,T_sn,T_CalibrationExpirationTime)
|
|
|
+
|
|
|
}
|
|
|
|
|
|
if len(T_project) > 0 {
|
|
@@ -1236,6 +1331,10 @@ func (c *TaskController) Up() {
|
|
|
r.T_report_number = T_report_number
|
|
|
clos = append(clos, "T_report_number")
|
|
|
}
|
|
|
+ if len(T_report_type) > 0 {
|
|
|
+ r.T_report_type = T_report_type
|
|
|
+ clos = append(clos, "T_report_type")
|
|
|
+ }
|
|
|
|
|
|
if !Task.Update_Task(r, clos...) {
|
|
|
c.Data["json"] = lib.JSONS{Code: 202, Msg: "修改失败!"}
|
|
@@ -1338,19 +1437,37 @@ func (c *TaskController) UpSchemeState() {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- AdminMap := Account.AdminListToMap(Account.Read_Admin_List_ALL_1())
|
|
|
+ //AdminMap := Account.AdminListToMap(Account.Read_Admin_List_ALL_1())
|
|
|
+ // 已提交
|
|
|
+ if T_scheme_state == Task.TaskSchemeStateSubmitted {
|
|
|
+ System.Add_News(r.T_collection, fmt.Sprintf("【%s-%s】验证方案 %s,请尽快与客户沟通确定", company_r.T_name, r.T_name, Task.TaskSchemeStateMap[T_scheme_state]), "")
|
|
|
+ go wx.WxSend(r.T_collection, fmt.Sprintf("【%s-%s】验证方案 %s,请尽快与客户沟通确定", company_r.T_name, r.T_name, Task.TaskSchemeStateMap[T_scheme_state]))
|
|
|
+ }
|
|
|
|
|
|
- if T_scheme_state == Task.TaskSchemeStateClientReturn ||
|
|
|
- T_scheme_state == Task.TaskSchemeStateReturn ||
|
|
|
- T_scheme_state == Task.TaskSchemeStatePass ||
|
|
|
- T_scheme_state == Task.TaskSchemeStateClientPass {
|
|
|
- System.Add_News(r.T_scheme, fmt.Sprintf("【验证方案】您提交的验证方案【%s-%s】 %s", company_r.T_name, r.T_name, Task.TaskSchemeStateMap[T_scheme_state]), "")
|
|
|
- go System.Send_Weichat_News(AdminMap[r.T_scheme], fmt.Sprintf("【验证方案】您提交的验证方案【%s-%s】 %s", company_r.T_name, r.T_name, Task.TaskSchemeStateMap[T_scheme_state]), "")
|
|
|
+ // 已通过
|
|
|
+ if T_scheme_state == Task.TaskSchemeStatePass {
|
|
|
+ infoCollection, _ := InfoCollection.Read_InfoCollection(r.T_InfoCollection_id)
|
|
|
+ System.Add_News(infoCollection.T_submit_uuid, fmt.Sprintf("【%s-%s】验证方案 %s,请尽快与客户沟通确定", company_r.T_name, r.T_name, Task.TaskSchemeStateMap[T_scheme_state]), "")
|
|
|
+ go wx.WxSend(infoCollection.T_submit_uuid, fmt.Sprintf("【%s-%s】验证方案 %s,请尽快与客户沟通确定", company_r.T_name, r.T_name, Task.TaskSchemeStateMap[T_scheme_state]))
|
|
|
}
|
|
|
|
|
|
- if T_scheme_state == Task.TaskSchemeStateClientPass {
|
|
|
- System.Add_News(r.T_collection, fmt.Sprintf("【%s-%s】验证方案客户已通过,可以进场实施,请到平台进行查看验证方案,确认好后选择进场时间", company_r.T_name, r.T_name), "")
|
|
|
- go System.Send_Weichat_News(AdminMap[r.T_collection], fmt.Sprintf("【%s-%s】验证方案客户已通过,可以进场实施,请到平台进行查看验证方案,确认好后选择进场时间", company_r.T_name, r.T_name), "")
|
|
|
+
|
|
|
+ // 已退回(负责人)
|
|
|
+ if T_scheme_state == Task.TaskSchemeStateReturn {
|
|
|
+ System.Add_News(r.T_scheme, fmt.Sprintf("【%s-%s】验证方案 %s,%s", company_r.T_name, r.T_name, Task.TaskSchemeStateMap[T_scheme_state],T_reason), "")
|
|
|
+ go wx.WxSend(r.T_scheme, fmt.Sprintf("【%s-%s】验证方案 %s,%s", company_r.T_name, r.T_name, Task.TaskSchemeStateMap[T_scheme_state],T_reason))
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ // 已退回(客户)
|
|
|
+ if T_scheme_state == Task.TaskSchemeStateClientReturn {
|
|
|
+ System.Add_News(r.T_scheme, fmt.Sprintf("!!!【%s-%s】验证方案 %s,%s", company_r.T_name, r.T_name, Task.TaskSchemeStateMap[T_scheme_state],T_reason), "")
|
|
|
+ go wx.WxSend(r.T_scheme, fmt.Sprintf("!!!【%s-%s】验证方案 %s,%s", company_r.T_name, r.T_name,Task.TaskSchemeStateMap[T_scheme_state],T_reason))
|
|
|
+
|
|
|
+ System.Add_News(conf.VdelUuid, fmt.Sprintf("!!!【%s-%s】验证方案 %s,%s", company_r.T_name, r.T_name, Task.TaskSchemeStateMap[T_scheme_state],T_reason), "")
|
|
|
+ go wx.WxSend(conf.VdelUuid, fmt.Sprintf("!!!【%s-%s】验证方案 %s,%s", company_r.T_name, r.T_name,Task.TaskSchemeStateMap[T_scheme_state],T_reason))
|
|
|
+
|
|
|
+ go wx.WxSend(conf.BoosUuid, fmt.Sprintf("!!!【%s-%s】验证方案 %s,%s", company_r.T_name, r.T_name,Task.TaskSchemeStateMap[T_scheme_state],T_reason))
|
|
|
}
|
|
|
|
|
|
// 添加任务操作日志
|
|
@@ -1390,7 +1507,7 @@ func (c *TaskController) UpReportingState() {
|
|
|
c.ServeJSON()
|
|
|
return
|
|
|
}
|
|
|
- _, user_r := Account.Read_User_ByT_uuid(r.T_uuid)
|
|
|
+ //_, user_r := Account.Read_User_ByT_uuid(r.T_uuid)
|
|
|
|
|
|
clos := make([]string, 0)
|
|
|
if T_reporting_state > 0 {
|
|
@@ -1444,11 +1561,20 @@ func (c *TaskController) UpReportingState() {
|
|
|
r.T_reporting_audit_record = auditRecordJson
|
|
|
|
|
|
clos = append(clos, "T_reporting_audit_record")
|
|
|
-
|
|
|
+ // 查询信息采集信息
|
|
|
+ infoCollection, is := InfoCollection.Read_InfoCollection(r.T_InfoCollection_id)
|
|
|
+ if !is {
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "获取信息采集失败!"}
|
|
|
+ c.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
// 验证报告客户审核通过后设置结束时间
|
|
|
if T_reporting_state == Task.TaskReportingStateClientPass {
|
|
|
r.T_end_time = time.Now().Format("2006-01-02 15:04:05")
|
|
|
- r.T_time_interval, _ = lib.MinutesDifference(r.T_start_time, r.T_end_time)
|
|
|
+ r.T_time_interval, err = lib.MinutesDifference(infoCollection.T_start_time, r.T_end_time)
|
|
|
+ if err != nil {
|
|
|
+ logs.Error("UpReportingState:", err.Error())
|
|
|
+ }
|
|
|
clos = append(clos, "T_end_time")
|
|
|
clos = append(clos, "T_time_interval")
|
|
|
}
|
|
@@ -1459,13 +1585,41 @@ func (c *TaskController) UpReportingState() {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- AdminMap := Account.AdminListToMap(Account.Read_Admin_List_ALL_1())
|
|
|
- if T_reporting_state == Task.TaskSchemeStateClientReturn ||
|
|
|
- T_reporting_state == Task.TaskSchemeStateReturn ||
|
|
|
- T_reporting_state == Task.TaskSchemeStatePass ||
|
|
|
- T_reporting_state == Task.TaskSchemeStateClientPass {
|
|
|
- System.Add_News(r.T_scheme, fmt.Sprintf("【验证报告】您提交的验证报告【%s-%s】 %s", user_r.T_name, r.T_name, Task.TaskReportingStateMap[T_reporting_state]), "")
|
|
|
- go System.Send_Weichat_News(AdminMap[r.T_scheme], fmt.Sprintf("【验证报告】您提交的验证报告【%s-%s】 %s", user_r.T_name, r.T_name, Task.TaskReportingStateMap[T_reporting_state]), "")
|
|
|
+ // 已通过
|
|
|
+ if T_reporting_state == Task.TaskReportingStatePass {
|
|
|
+ System.Add_News(infoCollection.T_submit_uuid, fmt.Sprintf("【%s-%s】验证报告 %s", infoCollection.T_name, r.T_name, Task.TaskReportingStateMap[T_reporting_state]), "")
|
|
|
+ go wx.WxSend(infoCollection.T_submit_uuid, fmt.Sprintf("【%s-%s】验证报告 %s", infoCollection.T_name, r.T_name,Task.TaskReportingStateMap[T_reporting_state]))
|
|
|
+
|
|
|
+ System.Add_News(r.T_reporting, fmt.Sprintf("【%s-%s】验证报告 %s,请及时 打印报告", infoCollection.T_name, r.T_name, Task.TaskReportingStateMap[T_reporting_state]), "")
|
|
|
+ go wx.WxSend(r.T_reporting, fmt.Sprintf("【%s-%s】验证报告 %s,请及时 打印报告", infoCollection.T_name, r.T_name,Task.TaskReportingStateMap[T_reporting_state]))
|
|
|
+ }
|
|
|
+ // 已退回
|
|
|
+ if T_reporting_state == Task.TaskReportingStateReturn {
|
|
|
+ System.Add_News(r.T_reporting, fmt.Sprintf("【%s-%s】验证报告 %s,%s", infoCollection.T_name, r.T_name, Task.TaskReportingStateMap[T_reporting_state],T_reason), "")
|
|
|
+ go wx.WxSend(r.T_reporting, fmt.Sprintf("【%s-%s】验证报告 %s,%s", infoCollection.T_name, r.T_name,Task.TaskReportingStateMap[T_reporting_state],T_reason))
|
|
|
+ }
|
|
|
+ // 已通过(客户) 通知销售
|
|
|
+ if T_reporting_state == Task.TaskReportingStateClientPass {
|
|
|
+ go wx.WxSend(infoCollection.T_submit_uuid, fmt.Sprintf("【%s-%s】 %s,请尽快安排客户回款", infoCollection.T_name, r.T_name, Task.TaskReportingStateMap[T_reporting_state]))
|
|
|
+ }
|
|
|
+
|
|
|
+ if T_reporting_state == Task.TaskReportingStateClientReturn {
|
|
|
+ System.Add_News(r.T_scheme, fmt.Sprintf("!!!【%s-%s】验证报告 %s,%s", infoCollection.T_name, r.T_name, Task.TaskReportingStateMap[T_reporting_state],T_reason), "")
|
|
|
+ go wx.WxSend(r.T_scheme, fmt.Sprintf("!!!【%s-%s】验证报告 %s,%s", infoCollection.T_name, r.T_name,Task.TaskReportingStateMap[T_reporting_state],T_reason))
|
|
|
+
|
|
|
+ System.Add_News(r.T_collection, fmt.Sprintf("!!!【%s-%s】验证报告 %s,%s", infoCollection.T_name, r.T_name, Task.TaskReportingStateMap[T_reporting_state],T_reason), "")
|
|
|
+ go wx.WxSend(r.T_collection, fmt.Sprintf("!!!【%s-%s】验证报告 %s,%s", infoCollection.T_name, r.T_name,Task.TaskReportingStateMap[T_reporting_state],T_reason))
|
|
|
+
|
|
|
+ System.Add_News(r.T_reporting, fmt.Sprintf("!!!【%s-%s】验证报告 %s,%s", infoCollection.T_name, r.T_name, Task.TaskReportingStateMap[T_reporting_state],T_reason), "")
|
|
|
+ go wx.WxSend(r.T_reporting, fmt.Sprintf("!!!【%s-%s】验证报告 %s,%s", infoCollection.T_name, r.T_name,Task.TaskReportingStateMap[T_reporting_state],T_reason))
|
|
|
+
|
|
|
+ //System.Add_News(r.T_delivery, fmt.Sprintf("!!!【%s-%s】验证报告 %s", infoCollection.T_name, r.T_name, Task.TaskReportingStateMap[T_reporting_state]), "")
|
|
|
+ //go wx.WxSend(r.T_delivery, fmt.Sprintf("!!!【%s-%s】验证报告 %s", infoCollection.T_name, r.T_name,Task.TaskReportingStateMap[T_reporting_state]))
|
|
|
+
|
|
|
+ System.Add_News(conf.VdelUuid, fmt.Sprintf("!!!【%s-%s】验证报告 %s,%s", infoCollection.T_name, r.T_name, Task.TaskReportingStateMap[T_reporting_state],T_reason), "")
|
|
|
+ go wx.WxSend(conf.VdelUuid, fmt.Sprintf("!!!【%s-%s】验证报告 %s,%s", infoCollection.T_name, r.T_name,Task.TaskReportingStateMap[T_reporting_state],T_reason))
|
|
|
+
|
|
|
+ go wx.WxSend(conf.BoosUuid, fmt.Sprintf("!!!【%s-%s】验证报告 %s,%s", infoCollection.T_name, r.T_name, Task.TaskReportingStateMap[T_reporting_state],T_reason))
|
|
|
}
|
|
|
|
|
|
// 添加任务操作日志
|
|
@@ -1476,7 +1630,7 @@ func (c *TaskController) UpReportingState() {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-// 进场
|
|
|
+// 进场 改成 方案开始
|
|
|
func (c *TaskController) EnterArea() {
|
|
|
// 验证登录 User_is, User_r
|
|
|
User_r, User_is := Account.Verification_Admin(c.Ctx.GetCookie("User_tokey"), c.GetString("User_tokey"))
|
|
@@ -1487,7 +1641,6 @@ func (c *TaskController) EnterArea() {
|
|
|
}
|
|
|
|
|
|
T_task_id := c.GetString("T_task_id")
|
|
|
- T_time := c.GetString("T_time") // 进场时间
|
|
|
r, is := Task.Read_Task(T_task_id)
|
|
|
if !is {
|
|
|
c.Data["json"] = lib.JSONS{Code: 202, Msg: "Id 错误!"}
|
|
@@ -1495,15 +1648,15 @@ func (c *TaskController) EnterArea() {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- r.T_enter_area_time = T_time
|
|
|
- if !Task.Update_Task(r, "T_enter_area_time") {
|
|
|
- c.Data["json"] = lib.JSONS{Code: 202, Msg: "修改进场时间失败!"}
|
|
|
- c.ServeJSON()
|
|
|
- return
|
|
|
+ // 方案开始
|
|
|
+ if len(r.T_scheme_start_time) == 0 {
|
|
|
+ r.T_scheme_start_time = time.Now().Format("2006-01-02 15:04:05")
|
|
|
+ Task.Update_Task(r,"T_scheme_start_time")
|
|
|
}
|
|
|
+
|
|
|
// 添加任务操作日志
|
|
|
- Task.Add_TaskLogs_T(User_r.T_uuid, T_task_id, "任务管理", "进场", r)
|
|
|
- System.Add_UserLogs_T(User_r.T_uuid, "任务管理", "进场", r)
|
|
|
+ Task.Add_TaskLogs_T(User_r.T_uuid, T_task_id, "任务管理", "方案开始", r)
|
|
|
+ System.Add_UserLogs_T(User_r.T_uuid, "任务管理", "方案开始", r)
|
|
|
c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!"}
|
|
|
c.ServeJSON()
|
|
|
return
|
|
@@ -2009,7 +2162,7 @@ func horizontalLine(xmin, xmax, y float64) *plotter.Line {
|
|
|
pts[1].Y = y
|
|
|
line, err := plotter.NewLine(pts)
|
|
|
if err != nil {
|
|
|
- panic(err)
|
|
|
+ panic(any(err))
|
|
|
}
|
|
|
line.LineStyle.Dashes = []vg.Length{vg.Points(8), vg.Points(5), vg.Points(1), vg.Points(5)}
|
|
|
line.Color = color.RGBA{R: 255, A: 255}
|
|
@@ -2115,3 +2268,260 @@ func GetWatermarkPdf(task Task.Task, pdfURL string, flag string) (pdf string) {
|
|
|
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+// 暂停申请
|
|
|
+// 列表 -
|
|
|
+func (c *TaskController) TaskTimeList() {
|
|
|
+ // 验证登录 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
|
|
|
+ }
|
|
|
+
|
|
|
+ var r_jsons lib.R_JSONS
|
|
|
+
|
|
|
+ T_task_id := c.GetString("T_task_id")
|
|
|
+ T_task_type, _ := c.GetInt("T_task_type", 0) // 公司名称
|
|
|
+
|
|
|
+ var cnt int64
|
|
|
+ List, cnt := Task.Read_TaskTime_List(T_task_id, T_task_type)
|
|
|
+
|
|
|
+ r_jsons.List = List
|
|
|
+ r_jsons.Num = int(cnt)
|
|
|
+
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!", Data: r_jsons}
|
|
|
+ c.ServeJSON()
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+// 添加-
|
|
|
+func (c *TaskController) TaskTimeAdd() {
|
|
|
+
|
|
|
+ // 验证登录 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
|
|
|
+ }
|
|
|
+ dc := Device.DeviceClass{
|
|
|
+ T_uuid: User_r.T_uuid,
|
|
|
+ T_State: 1,
|
|
|
+ }
|
|
|
+
|
|
|
+ System.Add_UserLogs_T(User_r.T_uuid, "任务暂停", "暂停申请", dc)
|
|
|
+
|
|
|
+ T_task_id := c.GetString("T_task_id")
|
|
|
+
|
|
|
+ T_task_type, _ := c.GetInt("T_task_type", 0) // 公司名称
|
|
|
+ T_aaa := c.GetString("T_aaa")
|
|
|
+
|
|
|
+ var_ := Task.TaskTime{
|
|
|
+ T_task_id: T_task_id,
|
|
|
+ T_task_type: T_task_type,
|
|
|
+ T_uuid: User_r.T_uuid,
|
|
|
+ T_remarks: T_aaa,
|
|
|
+ T_start_time: time.Now().Format("2006-01-02 15:04:05"),
|
|
|
+ }
|
|
|
+ List, _ := Task.Read_TaskTime_List(T_task_id, T_task_type)
|
|
|
+ if len(List) > 0 {
|
|
|
+ if len(List[len(List)-1].T_end_time) == 0 {
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "上一个任务还没结束!"}
|
|
|
+ c.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ is := Task.Add_TaskTime(var_)
|
|
|
+ if !is {
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "添加失败!"}
|
|
|
+ c.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ // 添加任务操作日志
|
|
|
+ Task.Add_TaskLogs_T(User_r.T_uuid, T_task_id, "任务暂停", "暂停申请", var_)
|
|
|
+ System.Add_UserLogs_T(User_r.T_uuid, "任务暂停", "暂停申请", var_)
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!", Data: T_task_id}
|
|
|
+ c.ServeJSON()
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+// 添加-
|
|
|
+func (c *TaskController) TaskTimeEnd() {
|
|
|
+
|
|
|
+ // 验证登录 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
|
|
|
+ }
|
|
|
+ dc := Device.DeviceClass{
|
|
|
+ T_uuid: User_r.T_uuid,
|
|
|
+ T_State: 1,
|
|
|
+ }
|
|
|
+
|
|
|
+ System.Add_UserLogs_T(User_r.T_uuid, "任务暂停", "暂停结束", dc)
|
|
|
+
|
|
|
+ Id, _ := c.GetInt("Id", 0)
|
|
|
+
|
|
|
+ TaskTime_r, is := Task.Read_TaskTime_ById(Id)
|
|
|
+ if !is {
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "Id 错误!"}
|
|
|
+ c.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ TaskTime_r.T_end_time = time.Now().Format("2006-01-02 15:04:05")
|
|
|
+ is = Task.Update_TaskTime(TaskTime_r, "T_end_time")
|
|
|
+ if !is {
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "修改失败!"}
|
|
|
+ c.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ // 添加任务操作日志
|
|
|
+ Task.Add_TaskLogs_T(User_r.T_uuid, TaskTime_r.T_task_id, "任务暂停", "暂停结束", TaskTime_r)
|
|
|
+ System.Add_UserLogs_T(User_r.T_uuid, "任务暂停", "暂停结束", TaskTime_r)
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!", Data: TaskTime_r.T_task_id}
|
|
|
+ c.ServeJSON()
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+// 列表 - 统计排名
|
|
|
+func (c *TaskController) StatisticalRanking() {
|
|
|
+ // 验证登录 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_power, _ := c.GetInt("T_power", 0) // 5 数据采集工程师 6 验证报告工程师
|
|
|
+ type Admin_T struct {
|
|
|
+ T_name string
|
|
|
+
|
|
|
+ T_scheme int // 实施方案
|
|
|
+ T_scheme_returnnum int // 退回
|
|
|
+ T_scheme_overnum int // 超时
|
|
|
+ T_scheme_log string // 日志
|
|
|
+
|
|
|
+ T_collection int // 数据采集
|
|
|
+ T_collection_returnnum int // 退回
|
|
|
+ T_collection_overnum int // 超时
|
|
|
+ T_collection_log string // 日志
|
|
|
+
|
|
|
+ T_reporting int // 报告编写
|
|
|
+ T_reporting_returnnum int // 退回
|
|
|
+ T_reporting_overnum int // 超时
|
|
|
+ T_reporting_log string // 日志
|
|
|
+
|
|
|
+ T_rejectdnum int // 驳回数量
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ var Admin_T_List []Admin_T
|
|
|
+ Admin_List := Account.Read_Admin_List_ALL_T_power(T_power)
|
|
|
+ for _, A := range Admin_List {
|
|
|
+ Admin_t := Admin_T{T_name: A.T_name}
|
|
|
+
|
|
|
+ // 方案
|
|
|
+ Task_List := Task.Read_UserTask_StatisticalRanking(A.T_uuid, "T_scheme") //T_scheme T_collection T_reporting
|
|
|
+ for _, T := range Task_List {
|
|
|
+ if len(T.T_scheme_end_time) > 0 {
|
|
|
+ if is, _ := lib.IsInCurrentMonth(T.T_scheme_end_time); !is {
|
|
|
+ continue // 不是本月
|
|
|
+ }
|
|
|
+ Admin_t.T_scheme += 1
|
|
|
+ Admin_t.T_scheme_log += T.T_name
|
|
|
+ // 退回
|
|
|
+ if T.T_scheme_return_times > 0 {
|
|
|
+ Admin_t.T_scheme_returnnum += T.T_scheme_return_times
|
|
|
+ Admin_t.T_scheme_log += " | 退回"+ lib.To_string(int(T.T_scheme_return_times))
|
|
|
+ }
|
|
|
+ // 超时
|
|
|
+ if T.T_scheme_overtime > 0 {
|
|
|
+ Admin_t.T_scheme_overnum += 1
|
|
|
+ Admin_t.T_scheme_log += " | 超时"+ lib.ConvertMinutesToDHM(int(T.T_scheme_overtime))
|
|
|
+ }
|
|
|
+ // 驳回
|
|
|
+ if T.T_reject_times > 0 {
|
|
|
+ Admin_t.T_rejectdnum += T.T_reject_times
|
|
|
+ Admin_t.T_scheme_log += " | 驳回"+ lib.To_string(int(T.T_reject_times))
|
|
|
+ }
|
|
|
+
|
|
|
+ Admin_t.T_scheme_log += "\n"
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 实施
|
|
|
+ Task_List = Task.Read_UserTask_StatisticalRanking(A.T_uuid, "T_collection") //T_scheme T_collection T_reporting
|
|
|
+ for _, T := range Task_List {
|
|
|
+ if len(T.T_collection_end_time) > 0 {
|
|
|
+ if is, _ := lib.IsInCurrentMonth(T.T_collection_end_time); !is {
|
|
|
+ continue // 不是本月
|
|
|
+ }
|
|
|
+ Admin_t.T_collection += 1
|
|
|
+ Admin_t.T_collection_log += T.T_name
|
|
|
+ // 退回
|
|
|
+ if T.T_collection_return_times > 0 {
|
|
|
+ Admin_t.T_collection_returnnum += T.T_collection_return_times
|
|
|
+ Admin_t.T_collection_log += " | 退回"+ lib.To_string(int(T.T_collection_return_times))
|
|
|
+ }
|
|
|
+ // 超时
|
|
|
+ if T.T_collection_overtime > 0 {
|
|
|
+ Admin_t.T_collection_overnum += 1
|
|
|
+ Admin_t.T_collection_log += " | 超时"+ lib.ConvertMinutesToDHM(int(T.T_collection_overtime))
|
|
|
+ }
|
|
|
+ // 驳回
|
|
|
+ if T.T_reject_times > 0 {
|
|
|
+ Admin_t.T_rejectdnum += T.T_reject_times
|
|
|
+ Admin_t.T_collection_log += " | 驳回"+ lib.To_string(int(T.T_reject_times))
|
|
|
+ }
|
|
|
+
|
|
|
+ Admin_t.T_collection_log += "\n"
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 报告
|
|
|
+ Task_List = Task.Read_UserTask_StatisticalRanking(A.T_uuid, "T_reporting") //T_scheme T_collection T_reporting
|
|
|
+ for _, T := range Task_List {
|
|
|
+ if len(T.T_reporting_end_time) > 0 {
|
|
|
+ if is, _ := lib.IsInCurrentMonth(T.T_reporting_end_time); !is {
|
|
|
+ continue // 不是本月
|
|
|
+ }
|
|
|
+ Admin_t.T_reporting += 1
|
|
|
+ Admin_t.T_reporting_log += T.T_name
|
|
|
+ // 退回
|
|
|
+ if T.T_reporting_return_times > 0 {
|
|
|
+ Admin_t.T_reporting_returnnum += T.T_reporting_return_times
|
|
|
+ Admin_t.T_reporting_log += " | 退回"+ lib.To_string(int(T.T_reporting_return_times))
|
|
|
+ }
|
|
|
+ // 超时
|
|
|
+ if T.T_reporting_overtime > 0 {
|
|
|
+ Admin_t.T_reporting_overnum += 1
|
|
|
+ Admin_t.T_reporting_log += " | 超时"+ lib.ConvertMinutesToDHM(int(T.T_reporting_overtime))
|
|
|
+ }
|
|
|
+ // 驳回
|
|
|
+ if T.T_reject_times > 0 {
|
|
|
+ Admin_t.T_rejectdnum += T.T_reject_times
|
|
|
+ Admin_t.T_reporting_log += " | 驳回"+ lib.To_string(int(T.T_reject_times))
|
|
|
+ }
|
|
|
+ Admin_t.T_reporting_log += "\n"
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Admin_T_List = append(Admin_T_List, Admin_t)
|
|
|
+ }
|
|
|
+
|
|
|
+ var r_jsons lib.R_JSONS
|
|
|
+ r_jsons.List = Admin_T_List
|
|
|
+ r_jsons.Page = 0
|
|
|
+ r_jsons.Page_size = 0
|
|
|
+ r_jsons.Pages = lib.Func_page(int64(0), int64(0))
|
|
|
+ r_jsons.Num = 0
|
|
|
+
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!", Data: r_jsons}
|
|
|
+ c.ServeJSON()
|
|
|
+ return
|
|
|
+}
|