|
@@ -389,7 +389,7 @@ func (d ProjectDAO) GetBillProjectPreviews(param *vo.ProjectSearchParam) ([]vo.R
|
|
|
return reBillProjectTaskPreviews, total, nil
|
|
|
}
|
|
|
|
|
|
-// 待办
|
|
|
+// 种草任务待办
|
|
|
func (d ProjectDAO) GetProjectToDo(enterpriseId string, subAccountId int64, platform int64, taskType int64) (map[string]int64, error) {
|
|
|
resultMap := make(map[string]int64)
|
|
|
var needReview int64 // 待审核
|
|
@@ -401,7 +401,7 @@ func (d ProjectDAO) GetProjectToDo(enterpriseId string, subAccountId int64, plat
|
|
|
var projectInfos []entity.Project
|
|
|
//query := Db.Model(&entity.Project{}).Where("enterprise_id = ? and project_platform = ? and project_type = ?", enterpriseId, platform, taskType)
|
|
|
if subAccountId == 0 {
|
|
|
- // 待审核、待支付、达人未处理
|
|
|
+ // 待审核、待支付、达人未处理、初稿待审、链接待审、待结算
|
|
|
query1 := Db.Model(&entity.Project{}).Where("enterprise_id = ? and project_platform = ? and project_type = ?", enterpriseId, platform, taskType)
|
|
|
query1.Where("project_status = ?", 2).Count(&needReview)
|
|
|
query2 := Db.Model(&entity.Project{}).Where("enterprise_id = ? and project_platform = ? and project_type = ?", enterpriseId, platform, taskType)
|
|
@@ -438,13 +438,13 @@ func (d ProjectDAO) GetProjectToDo(enterpriseId string, subAccountId int64, plat
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
- // 待审核、待支付、达人未处理
|
|
|
+ // 待审核、待支付、达人未处理、初稿待审、链接待审、待结算
|
|
|
query1 := Db.Model(&entity.Project{}).Where("enterprise_id = ? and project_platform = ? and project_type = ?", enterpriseId, platform, taskType)
|
|
|
query1.Where("sub_account_id = ? and project_status = ?", subAccountId, 2).Count(&needReview)
|
|
|
query2 := Db.Model(&entity.Project{}).Where("enterprise_id = ? and project_platform = ? and project_type = ?", enterpriseId, platform, taskType)
|
|
|
query2.Where("sub_account_id = ? and project_status = ?", subAccountId, 6).Count(&needPay)
|
|
|
query3 := Db.Model(&entity.Project{}).Where("enterprise_id = ? and project_platform = ? and project_type = ?", enterpriseId, platform, taskType)
|
|
|
- err := query3.Where("sub_account_id = ? and project_status = ?", subAccountId, 8).Select("selection_id").Find(&projectInfos).Error
|
|
|
+ err := query3.Where("sub_account_id = ? and project_status = ?", subAccountId, 8).Select("project_id").Find(&projectInfos).Error
|
|
|
if err != nil {
|
|
|
if errors.Is(err, gorm.ErrRecordNotFound) {
|
|
|
needProcess = 0
|
|
@@ -481,5 +481,74 @@ func (d ProjectDAO) GetProjectToDo(enterpriseId string, subAccountId int64, plat
|
|
|
resultMap["needCheck"] = needCheck
|
|
|
resultMap["needQuality"] = needQuality
|
|
|
resultMap["needCalculate"] = needCalculate
|
|
|
+
|
|
|
+ return resultMap, nil
|
|
|
+}
|
|
|
+
|
|
|
+// 寄样物流任务待办
|
|
|
+func (d ProjectDAO) GetLogisticsToDo(enterpriseId string, subAccountId int64, platform int64) (map[string]int64, error) {
|
|
|
+ resultMap := make(map[string]int64)
|
|
|
+ var needDelivery int64
|
|
|
+ var needReceive int64
|
|
|
+ var projectInfos []entity.Project
|
|
|
+ //query := Db.Model(&entity.Project{}).Where("enterprise_id = ? and project_platform = ? and project_type = ?", enterpriseId, platform, taskType)
|
|
|
+ if subAccountId == 0 {
|
|
|
+ // 待发货、待签收
|
|
|
+ query1 := Db.Model(&entity.Project{}).Where("enterprise_id = ? and project_platform = ? and project_form = ?", enterpriseId, platform, 1)
|
|
|
+ err := query1.Where("project_status = ?", 8).Select("project_id").Find(&projectInfos).Error
|
|
|
+ if err != nil {
|
|
|
+ if errors.Is(err, gorm.ErrRecordNotFound) {
|
|
|
+ needDelivery = 0
|
|
|
+ needReceive = 0
|
|
|
+ } else {
|
|
|
+ return resultMap, err
|
|
|
+ }
|
|
|
+ } else if len(projectInfos) > 0 {
|
|
|
+ var projectIDs []string
|
|
|
+ for _, info := range projectInfos {
|
|
|
+ projectIDs = append(projectIDs, info.ProjectId)
|
|
|
+ }
|
|
|
+ if len(projectIDs) > 0 {
|
|
|
+ err1 := Db.Model(&entity.ProjectTaskInfo{}).Where("project_id in ? and task_stage = ?", projectIDs, 4).Count(&needDelivery).Error // task_stage=4待发货
|
|
|
+ if err1 != nil {
|
|
|
+ needDelivery = 0
|
|
|
+ }
|
|
|
+ err2 := Db.Model(&entity.ProjectTaskInfo{}).Where("project_id in ? and task_stage = ?", projectIDs, 5).Count(&needReceive).Error // task_stage=5已发货
|
|
|
+ if err2 != nil {
|
|
|
+ needReceive = 0
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // 待发货、待签收
|
|
|
+ query1 := Db.Model(&entity.Project{}).Where("enterprise_id = ? and project_platform = ? and project_form = ?", enterpriseId, platform, 1)
|
|
|
+ err := query1.Where("sub_account_id = ? and project_status = ?", subAccountId, 8).Select("project_id").Find(&projectInfos).Error
|
|
|
+ if err != nil {
|
|
|
+ if errors.Is(err, gorm.ErrRecordNotFound) {
|
|
|
+ needDelivery = 0
|
|
|
+ needReceive = 0
|
|
|
+ } else {
|
|
|
+ return resultMap, err
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ var projectIDs []string
|
|
|
+ for _, info := range projectInfos {
|
|
|
+ projectIDs = append(projectIDs, info.ProjectId)
|
|
|
+ }
|
|
|
+ if len(projectIDs) > 0 {
|
|
|
+ err1 := Db.Model(&entity.ProjectTaskInfo{}).Where("project_id in ? and task_stage = ?", projectIDs, 4).Count(&needDelivery).Error // task_stage=4待发货
|
|
|
+ if err1 != nil {
|
|
|
+ needDelivery = 0
|
|
|
+ }
|
|
|
+ err2 := Db.Model(&entity.ProjectTaskInfo{}).Where("project_id in ? and task_stage = ?", projectIDs, 5).Count(&needReceive).Error // task_stage=5已发货
|
|
|
+ if err2 != nil {
|
|
|
+ needReceive = 0
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ resultMap["needDelivery"] = needDelivery
|
|
|
+ resultMap["needReceive"] = needReceive
|
|
|
+
|
|
|
return resultMap, nil
|
|
|
}
|