Răsfoiți Sursa

fix_ddl&fields

Ethan 4 luni în urmă
părinte
comite
38e3f5a0d1

+ 4 - 1
app/dao/project_dao.go

@@ -113,7 +113,7 @@ func (d ProjectDAO) GetProjectPreviews(param *vo.ProjectSearchParam) ([]vo.RePro
 		query = query.Where("project_name LIKE ?", "%"+param.ProjectName+"%")
 	}
 	query.Count(&total)
-	query = query.Select("enterprise_id, sub_account_id, project_id, project_platform, project_status, estimated_cost, project_form, content_type, need_review, need_quality, need_calculate, product_id, tools")
+	query = query.Select("enterprise_id, sub_account_id, project_id, project_platform, project_status, estimated_cost, project_form, content_type, need_review, need_quality, need_calculate, before_delivery_num, delivery_num, after_delivery_num, product_id, tools")
 	offset := (param.Page - 1) * param.PageSize
 	if param.Order == 1 {
 		if err := query.Order("created_at asc").Offset(offset).Limit(param.PageSize).Find(&projects).Error; err != nil {
@@ -139,6 +139,9 @@ func (d ProjectDAO) GetProjectPreviews(param *vo.ProjectSearchParam) ([]vo.RePro
 			NeedCalculate:   project.NeedCalculate,
 			ProductId:       project.ProductID,
 			Tools:           project.Tools,
+			NeedDelivery:    project.BeforeDeliveryNum,
+			NeedReceive:     project.DeliveryNum,
+			Received:        project.AfterDeliveryNum,
 		}
 		reProjectTaskPreviews = append(reProjectTaskPreviews, reProjectTaskPreview)
 	}

+ 3 - 0
app/entity/project.go

@@ -50,6 +50,9 @@ type Project struct {
 	TotalRecruitNum   int64     `gorm:"column:total_recruit_num"`              // 各策略招募人数总和
 	Tools             string    `gorm:"column:tools"`                          // 工具选择,1邀约招募 2结算账单 3样品物流 4审稿工具 5作品审查 6数据巡检(,分隔)
 	InvoiceStatus     int64     `gorm:"column:invoice_status"`                 // 开票状态(1开票中 2已开票)
+	BeforeDeliveryNum int64     `gorm:"column:before_delivery_num"`
+	DeliveryNum       int64     `gorm:"column:delivery_num"`
+	AfterDeliveryNum  int64     `gorm:"column:after_delivery_num"`
 }
 
 func (m *Project) TableName() string {

+ 6 - 3
app/service/local_life_service.go

@@ -47,7 +47,7 @@ func (s LocalLifeService) CreateLocalLife(localCreateParam *vo.LocalCreateParam)
 	infoAutoDefault = dao.InfoAutoDefaultDao{}.GetAutoDefaultLast(localCreateParam.EnterpriseId)
 	t := time.Now()
 	if recruitDdl.Before(t) {
-		return nil, errors.New("截止时间异常,请重试")
+		return nil, errors.New("请修改截止时间")
 	}
 	newLocalLife := entity.LocalLifeInfo{
 		EnterpriseID:        localCreateParam.EnterpriseId,
@@ -174,6 +174,11 @@ func (s LocalLifeService) UpdateLocal(localUpdateParam *vo.LocalUpdateParam) (*s
 	if localLife == nil {
 		return nil, errors.New("本地生活项目不存在")
 	}
+	recruitDdl := time.Time{} //赋零值
+	recruitDdl, _ = time.ParseInLocation("2006-01-02 15:04:05", localUpdateParam.RecruitDdl, time.Local)
+	if recruitDdl.Before(localLife.CreatedAt) {
+		return nil, errors.New("请修改截止时间")
+	}
 	// 更新公开种草任务的招募策略
 	var totalRecruitNum int64
 	var estimatedCost float64
@@ -224,8 +229,6 @@ func (s LocalLifeService) UpdateLocal(localUpdateParam *vo.LocalUpdateParam) (*s
 	//productInfoToJson, _ := json.Marshal(product)
 	//productPhotosToJson, _ := json.Marshal(productPhotos)
 	// d) 任务截止时间
-	recruitDdl := time.Time{} //赋零值
-	recruitDdl, _ = time.ParseInLocation("2006-01-02 15:04:05", localUpdateParam.RecruitDdl, time.Local)
 	//// f) 更新选品状态
 	//if localUpdateParam.LocalStatus != 2 && localUpdateParam.LocalStatus != 8 {
 	//	localUpdateParam.LocalStatus = 1

+ 6 - 3
app/service/project_service.go

@@ -51,7 +51,7 @@ func (s ProjectService) CreateProject(projectCreateParam *vo.ProjectCreateParam)
 	infoAutoDefault = dao.InfoAutoDefaultDao{}.GetAutoDefaultLast(projectCreateParam.EnterpriseId)
 	t := time.Now()
 	if recruitDdl.Before(t) {
-		return nil, errors.New("截止时间异常,请重试")
+		return nil, errors.New("请修改截止时间")
 	}
 	newProject := entity.Project{
 		ProjectStatus:    1,
@@ -173,6 +173,11 @@ func (s ProjectService) UpdateProject(projectUpdateParam *vo.ProjectUpdateParam)
 	if project == nil {
 		return nil, errors.New("种草项目不存在")
 	}
+	recruitDdl := time.Time{} //赋零值
+	recruitDdl, _ = time.ParseInLocation("2006-01-02 15:04:05", projectUpdateParam.RecruitDdl, time.Local)
+	if recruitDdl.Before(project.CreatedAt) {
+		return nil, errors.New("请修改截止时间")
+	}
 	// 更新公开种草任务的招募策略
 	var totalRecruitNum int64
 	var estimatedCost float64
@@ -223,8 +228,6 @@ func (s ProjectService) UpdateProject(projectUpdateParam *vo.ProjectUpdateParam)
 	productInfoToJson, _ := json.Marshal(product)
 	productPhotosToJson, _ := json.Marshal(productPhotos)
 	// d) 任务截止时间
-	recruitDdl := time.Time{} //赋零值
-	recruitDdl, _ = time.ParseInLocation("2006-01-02 15:04:05", projectUpdateParam.RecruitDdl, time.Local)
 	//// f) 更新选品状态
 	//if projectUpdateParam.ProjectStatus != 2 && projectUpdateParam.ProjectStatus != 8 {
 	//	projectUpdateParam.ProjectStatus = 1

+ 4 - 1
app/service/selection_info_service.go

@@ -79,7 +79,7 @@ func (s SelectionInfoService) CreateSelectionInfo(selectionCreateParam *vo.Selec
 	infoAutoTask = dao.InfoAutoTaskDao{}.GetAutoTaskLast(selectionCreateParam.EnterpriseId)
 	t := time.Now()
 	if taskDdl.Before(t) {
-		return nil, errors.New("截止时间异常,请重试")
+		return nil, errors.New("请修改截止时间")
 	}
 	var sampleMode, taskMode int64
 	var poolRewardSum float64
@@ -231,6 +231,9 @@ func (s SelectionInfoService) UpdateSelectionInfo(selectionUpdateParam *vo.Selec
 	// d) 任务截止时间
 	taskDdl := time.Time{} //赋零值
 	taskDdl, _ = time.ParseInLocation("2006-01-02 15:04:05", selectionUpdateParam.TaskDdl, time.Local)
+	if taskDdl.Before(selectionInfo.CreatedAt) {
+		return nil, errors.New("请修改截止时间")
+	}
 	//// f) 更新选品状态
 	//if selectionUpdateParam.SelectionStatus != 2 && selectionUpdateParam.SelectionStatus != 7 {
 	//	selectionUpdateParam.SelectionStatus = 1

+ 3 - 0
app/vo/re_project_task_preview.go

@@ -18,6 +18,9 @@ type ReProjectTaskPreview struct {
 	NeedReview      int64   `json:"needReview"`    // 待审稿
 	NeedQuality     int64   `json:"needQuality"`   // 待质检
 	NeedCalculate   int64   `json:"needCalculate"` // 待结算
+	NeedDelivery    int64   `json:"needDelivery"`  // 待发货
+	NeedReceive     int64   `json:"needReceive"`   // 待签收
+	Received        int64   `json:"received"`      // 已签收
 	CreatorName     string  `json:"creatorName"`
 	ProjectType     int64   `json:"projectType"`
 	CreatedAt       string  `json:"createdAt"`