From 288d78f66ecd1b628e8d1df7a3da99fc5e6880ec Mon Sep 17 00:00:00 2001 From: zhangqian <zhangqian@123.com> Date: 星期五, 08 十二月 2023 14:13:37 +0800 Subject: [PATCH] debug --- service/report_work.go | 14 ++++++-------- 1 files changed, 6 insertions(+), 8 deletions(-) diff --git a/service/report_work.go b/service/report_work.go index 4a9db04..4d7a0cb 100644 --- a/service/report_work.go +++ b/service/report_work.go @@ -10,6 +10,7 @@ "encoding/json" "errors" "github.com/jinzhu/gorm" + "github.com/spf13/cast" "time" ) @@ -33,17 +34,12 @@ for _, worker := range procedure.ProceduresInfo.Workers { if params.WorkerID == worker.WorkerID { workerName = worker.WorkerName - if worker.StartTime < nowTs { - startTs = worker.StartTime - } } } if workerName == "" { return errors.New("娌℃湁鎵惧埌褰撳墠鍊肩彮浜哄憳") } - if startTs == 0 { - return errors.New("娌℃湁鎵惧埌褰撳墠鍊肩彮浜哄憳寮�濮嬫椂闂�") - } + finishAmount := params.ReportAmount lastReportWork, err := GetLastReportWork(params.ProcedureId) if err == nil { @@ -52,6 +48,8 @@ } finishAmount = params.ReportAmount - lastReportWork.ReportAmount startTs = lastReportWork.EndTime + } else { + startTs = procedure.RealStartTime } record := &model.ReportWork{ @@ -68,7 +66,7 @@ WorkerID: params.WorkerID, WorkerName: workerName, WorkerTime: nowTs - startTs, - BarCode: snowflake.GenerateIdStr(), + BarCode: cast.ToString(snowflake.GenerateID()), } err = model.WithTransaction(func(db *gorm.DB) error { err = model.NewReportWorkSearch(db).Create(record) @@ -95,7 +93,7 @@ return err } - err = NewProgressService().UpdateProgressByProceduresId(procedure.ID, int64(params.ReportAmount)) + err = NewProgressService().UpdateProgressByProceduresId(procedure.ID, params.ReportAmount) return nil } -- Gitblit v1.8.0