Browse Source

修改签收物流

yuliang1112 2 years ago
parent
commit
370caf503b
4 changed files with 36 additions and 21 deletions
  1. 5 2
      db/logistics.go
  2. 16 12
      model/gorm_model/logistics.go
  3. 15 3
      pack/task_logistics_list.go
  4. 0 4
      service/logistics.go

+ 5 - 2
db/logistics.go

@@ -44,8 +44,11 @@ func UpdateLogistics(ctx context.Context, logistics gorm_model.YoungeeTaskLogist
 // 更改签收时间
 // 更改签收时间
 func SignForReceipt(ctx context.Context, taskID string) error {
 func SignForReceipt(ctx context.Context, taskID string) error {
 	db := GetReadDB(ctx)
 	db := GetReadDB(ctx)
-	time := time.Now()
-	err := db.Model(gorm_model.YoungeeTaskLogistics{}).Where("task_id = ?", taskID).Update("signed_time", time).Error
+	t := time.Now()
+	err := db.Model(gorm_model.YoungeeTaskLogistics{}).Where("task_id = ?", taskID).Updates(gorm_model.YoungeeTaskLogistics{
+		Status:     1,
+		SignedTime: &t,
+	}).Error
 	if err != nil {
 	if err != nil {
 		logrus.WithContext(ctx).Errorf("[logistics db] call UpdateLogistics error,err:%+v", err)
 		logrus.WithContext(ctx).Errorf("[logistics db] call UpdateLogistics error,err:%+v", err)
 		return err
 		return err

+ 16 - 12
model/gorm_model/logistics.go

@@ -6,15 +6,19 @@ import (
 )
 )
 
 
 type YoungeeTaskLogistics struct {
 type YoungeeTaskLogistics struct {
-	LogisticsID           int64       `gorm:"column:logistics_id;primary_key;AUTO_INCREMENT"` // 货物-id
-	CompanyName           string    `gorm:"column:company_name"`                            // 实物商品-物流公司名称
-	LogisticsNumber       string    `gorm:"column:logistics_number"`                        // 实物商品-物流单号
-	ExplorestoreStarttime time.Time `gorm:"column:explorestore_starttime"`                  // 线下探店-探店开始时间
-	ExplorestoreEndtime   time.Time `gorm:"column:explorestore_endtime"`                    // 线下探店-探店结束时间
-	ExplorestorePeriod    string    `gorm:"column:explorestore_period"`                     // 线下探店-探店持续时间
-	CouponCodeInformation string    `gorm:"column:coupon_code_information"`                 // 虚拟产品-券码信息
-	TaskID                string       `gorm:"column:task_id;NOT NULL"`                        // 任务id
-	DeliveryTime          time.Time `gorm:"column:delivery_time"`                           // 发货时间
-	ThingsType            int64       `gorm:"column:things_type;NOT NULL"`                    // 任务类型:1 实物,2:线下探店,3:虚拟产品
-	SignedTime            time.Time `gorm:"column:signed_time"`                             // 实物商品-签收时间
-}
+	LogisticsID           int64      `gorm:"column:logistics_id;primary_key;AUTO_INCREMENT"` // 货物-id
+	CompanyName           string     `gorm:"column:company_name"`                            // 实物商品-物流公司名称
+	LogisticsNumber       string     `gorm:"column:logistics_number"`                        // 实物商品-物流单号
+	ExplorestoreStarttime time.Time  `gorm:"column:explorestore_starttime"`                  // 线下探店-探店开始时间
+	ExplorestoreEndtime   time.Time  `gorm:"column:explorestore_endtime"`                    // 线下探店-探店结束时间
+	ExplorestorePeriod    string     `gorm:"column:explorestore_period"`                     // 线下探店-探店持续时间
+	CouponCodeInformation string     `gorm:"column:coupon_code_information"`                 // 虚拟产品-券码信息
+	TaskID                string     `gorm:"column:task_id;NOT NULL"`                        // 任务id
+	DeliveryTime          time.Time  `gorm:"column:delivery_time"`                           // 发货时间
+	ThingsType            int64      `gorm:"column:things_type;NOT NULL"`                    // 任务类型:1 实物,2:线下探店,3:虚拟产品
+	SignedTime            *time.Time `gorm:"column:signed_time"`                             // 实物商品-签收时间
+	AutoSignAt            *time.Time `gorm:"column:auto_sign_at"`                            // 自动签收时间
+	AutoScriptBreakAt     *time.Time `gorm:"column:auto_script_break_at"`                    // 脚本违约自动处理时间
+	AutoSketchBreakAt     *time.Time `gorm:"column:auto_sketch_break_at"`                    // 初稿违约自动处理时间
+	Status                int        `gorm:"column:status;default:0"`                        // 签收状态,0为未签收,1为已签收
+}

+ 15 - 3
pack/task_logistics_list.go

@@ -19,7 +19,13 @@ func MGormTaskLogisticsInfoListToHttpTaskLogisticsPreviewList(gormTaskLogisticsI
 
 
 func MGormTaskLogisticsInfoToHttpTaskLogisticsPreview(TaskLogisticsInfo *http_model.TaskLogisticsInfo) *http_model.TaskLogisticsPreview {
 func MGormTaskLogisticsInfoToHttpTaskLogisticsPreview(TaskLogisticsInfo *http_model.TaskLogisticsInfo) *http_model.TaskLogisticsPreview {
 	deliveryTime := conv.MustString(TaskLogisticsInfo.DeliveryTime)[0:19]
 	deliveryTime := conv.MustString(TaskLogisticsInfo.DeliveryTime)[0:19]
-	signedTime := conv.MustString(TaskLogisticsInfo.SignedTime)[0:19]
+	//signedTime := conv.MustString(TaskLogisticsInfo.SignedTime)[0:19]
+	SignedTime := ""
+	if TaskLogisticsInfo.SignedTime == "" {
+		SignedTime = ""
+	} else {
+		SignedTime = TaskLogisticsInfo.SignedTime[:19]
+	}
 	return &http_model.TaskLogisticsPreview{
 	return &http_model.TaskLogisticsPreview{
 		TaskID:                TaskLogisticsInfo.TaskID,
 		TaskID:                TaskLogisticsInfo.TaskID,
 		PlatformNickname:      conv.MustString(TaskLogisticsInfo.PlatformNickname),
 		PlatformNickname:      conv.MustString(TaskLogisticsInfo.PlatformNickname),
@@ -30,7 +36,7 @@ func MGormTaskLogisticsInfoToHttpTaskLogisticsPreview(TaskLogisticsInfo *http_mo
 		CompanyName:           conv.MustString(TaskLogisticsInfo.CompanyName),
 		CompanyName:           conv.MustString(TaskLogisticsInfo.CompanyName),
 		LogisticsNumber:       conv.MustString(TaskLogisticsInfo.LogisticsNumber),
 		LogisticsNumber:       conv.MustString(TaskLogisticsInfo.LogisticsNumber),
 		DeliveryTime:          deliveryTime,
 		DeliveryTime:          deliveryTime,
-		SignedTime:            signedTime,
+		SignedTime:            SignedTime,
 		ExplorestoreStarttime: TaskLogisticsInfo.ExplorestoreStarttime,
 		ExplorestoreStarttime: TaskLogisticsInfo.ExplorestoreStarttime,
 		ExplorestoreEndtime:   TaskLogisticsInfo.ExplorestoreEndtime,
 		ExplorestoreEndtime:   TaskLogisticsInfo.ExplorestoreEndtime,
 		ExplorestorePeriod:    conv.MustString(TaskLogisticsInfo.ExplorestorePeriod),
 		ExplorestorePeriod:    conv.MustString(TaskLogisticsInfo.ExplorestorePeriod),
@@ -50,6 +56,12 @@ func TaskLogisticsToTaskInfo(TaskLogisticss []*http_model.TaskLogistics) []*http
 func GetTalentInfoStruct(TaskLogistics *http_model.TaskLogistics) *http_model.TaskLogisticsInfo {
 func GetTalentInfoStruct(TaskLogistics *http_model.TaskLogistics) *http_model.TaskLogisticsInfo {
 	TalentPlatformInfoSnap := TaskLogistics.Talent.TalentPlatformInfoSnap
 	TalentPlatformInfoSnap := TaskLogistics.Talent.TalentPlatformInfoSnap
 	TalentPostAddrSnap := TaskLogistics.Talent.TalentPostAddrSnap
 	TalentPostAddrSnap := TaskLogistics.Talent.TalentPostAddrSnap
+	SignedTime := ""
+	if TaskLogistics.Logistics.SignedTime == nil {
+		SignedTime = ""
+	} else {
+		SignedTime = conv.MustString(TaskLogistics.Logistics.SignedTime, "")
+	}
 	return &http_model.TaskLogisticsInfo{
 	return &http_model.TaskLogisticsInfo{
 		TaskID:                TaskLogistics.Talent.TaskID,
 		TaskID:                TaskLogistics.Talent.TaskID,
 		PlatformNickname:      conv.MustString(gjson.Get(TalentPlatformInfoSnap, "platform_nickname")),
 		PlatformNickname:      conv.MustString(gjson.Get(TalentPlatformInfoSnap, "platform_nickname")),
@@ -59,7 +71,7 @@ func GetTalentInfoStruct(TaskLogistics *http_model.TaskLogistics) *http_model.Ta
 		CompanyName:           TaskLogistics.Logistics.CompanyName,
 		CompanyName:           TaskLogistics.Logistics.CompanyName,
 		LogisticsNumber:       TaskLogistics.Logistics.LogisticsNumber,
 		LogisticsNumber:       TaskLogistics.Logistics.LogisticsNumber,
 		DeliveryTime:          conv.MustString(TaskLogistics.Logistics.DeliveryTime),
 		DeliveryTime:          conv.MustString(TaskLogistics.Logistics.DeliveryTime),
-		SignedTime:            conv.MustString(TaskLogistics.Logistics.SignedTime),
+		SignedTime:            SignedTime,
 		ExplorestoreStarttime: TaskLogistics.Logistics.ExplorestoreStarttime,
 		ExplorestoreStarttime: TaskLogistics.Logistics.ExplorestoreStarttime,
 		ExplorestoreEndtime:   TaskLogistics.Logistics.ExplorestoreEndtime,
 		ExplorestoreEndtime:   TaskLogistics.Logistics.ExplorestoreEndtime,
 		ExplorestorePeriod:    TaskLogistics.Logistics.ExplorestorePeriod,
 		ExplorestorePeriod:    TaskLogistics.Logistics.ExplorestorePeriod,

+ 0 - 4
service/logistics.go

@@ -29,7 +29,6 @@ func (*logistics) Create(ctx context.Context, newLogistics http_model.CreateLogi
 		ExplorestoreStarttime: time.Now(),
 		ExplorestoreStarttime: time.Now(),
 		ExplorestoreEndtime:   time.Now(),
 		ExplorestoreEndtime:   time.Now(),
 		DeliveryTime:          time.Now(),
 		DeliveryTime:          time.Now(),
-		SignedTime:            time.Now(),
 	}
 	}
 	fmt.Println("ThingsType:", ThingsType)
 	fmt.Println("ThingsType:", ThingsType)
 	//实物
 	//实物
@@ -44,8 +43,6 @@ func (*logistics) Create(ctx context.Context, newLogistics http_model.CreateLogi
 		ExplorestoreEndtime, _ := time.ParseInLocation("2006-01-02 15:04:05", newLogistics.ExplorestoreEndtime, time.Local)
 		ExplorestoreEndtime, _ := time.ParseInLocation("2006-01-02 15:04:05", newLogistics.ExplorestoreEndtime, time.Local)
 		Logistics.ExplorestoreStarttime = ExplorestoreStarttime
 		Logistics.ExplorestoreStarttime = ExplorestoreStarttime
 		Logistics.ExplorestoreEndtime = ExplorestoreEndtime
 		Logistics.ExplorestoreEndtime = ExplorestoreEndtime
-		Logistics.SignedTime = ExplorestoreEndtime
-		// Logistics.ExplorestorePeriod = newLogistics.ExplorestorePeriod
 	} else {
 	} else {
 		Logistics.CouponCodeInformation = newLogistics.CouponCodeInformation
 		Logistics.CouponCodeInformation = newLogistics.CouponCodeInformation
 	}
 	}
@@ -125,7 +122,6 @@ func (*logistics) Update(ctx context.Context, newLogistics http_model.CreateLogi
 		TaskID:       newLogistics.TaskID,
 		TaskID:       newLogistics.TaskID,
 		ThingsType:   int64(ThingsType),
 		ThingsType:   int64(ThingsType),
 		DeliveryTime: time.Now(),
 		DeliveryTime: time.Now(),
-		SignedTime:   time.Now(),
 	}
 	}
 	//实物
 	//实物
 	if ThingsType == 1 {
 	if ThingsType == 1 {