Ver código fonte

解决项目详情刷新

Ohio-HYF 2 anos atrás
pai
commit
cec7d3da73
52 arquivos alterados com 694 adições e 200 exclusões
  1. 24 13
      db/data.go
  2. 15 14
      db/default.go
  3. 3 2
      db/enterprise.go
  4. 15 3
      db/finish.go
  5. 2 2
      db/link.go
  6. 7 20
      db/logistics.go
  7. 6 0
      db/number_info.go
  8. 3 2
      db/pay_record.go
  9. 38 20
      db/project.go
  10. 2 2
      db/script.go
  11. 2 2
      db/sketch.go
  12. 61 0
      db/task.go
  13. 61 0
      handler/get_creating_number.go
  14. 59 0
      handler/get_finish_data.go
  15. 59 0
      handler/logisitics_number_info.go
  16. 4 4
      handler/project_draft_list.go
  17. 4 4
      handler/project_list.go
  18. 4 4
      handler/task_logistics_list.go
  19. 1 1
      model/common_model/project_condition.go
  20. 7 4
      model/gorm_model/enterprise.go
  21. 2 2
      model/gorm_model/pay_record.go
  22. 7 5
      model/gorm_model/project.go
  23. 14 4
      model/gorm_model/recruit_strategy.go
  24. 18 0
      model/http_model/GetCreatingNumberRequest.go
  25. 3 3
      model/http_model/data_accept.go
  26. 6 6
      model/http_model/enterprise_balance.go
  27. 43 0
      model/http_model/get_finish_data.go
  28. 2 2
      model/http_model/pay_sum.go
  29. 0 1
      model/http_model/project_create.go
  30. 2 2
      model/http_model/project_pay.go
  31. 8 5
      model/http_model/project_show.go
  32. 1 0
      model/http_model/project_update.go
  33. 3 0
      model/http_model/task_data.go
  34. 16 13
      model/http_model/task_finish.go
  35. 8 8
      pack/full_project_condition.go
  36. 43 0
      pack/get_finish_data.go
  37. 3 2
      pack/project_draft_condition.go
  38. 2 0
      pack/task_data_list.go
  39. 4 4
      pack/task_data_list_conditions.go
  40. 16 16
      pack/task_default_list_conditions.go
  41. 2 0
      pack/task_finish_list.go
  42. 3 3
      pack/task_finish_list_conditions.go
  43. 4 4
      pack/task_link_list_conditions.go
  44. 4 4
      pack/task_logistics_list_conditions.go
  45. 4 4
      pack/task_script_list_conditions.go
  46. 4 4
      pack/task_sketch_list_conditions.go
  47. 5 2
      route/init.go
  48. 26 2
      service/data.go
  49. 30 0
      service/finish.go
  50. 15 0
      service/number_info.go
  51. 11 7
      service/project.go
  52. 8 0
      util/type.go

+ 24 - 13
db/data.go

@@ -51,8 +51,6 @@ func GetTaskDataList(ctx context.Context, projectID string, pageSize, pageNum in
 					strategyIdList = append(strategyIdList, conv.MustInt(strategyId))
 				}
 				db = db.Where("strategy_id in ?", strategyIdList)
-			} else {
-				db = db.Where(fmt.Sprintf("%s like '%%%v%%'", tag, value.Interface()))
 			}
 		}
 	}
@@ -73,15 +71,31 @@ func GetTaskDataList(ctx context.Context, projectID string, pageSize, pageNum in
 		taskIds = append(taskIds, taskInfo.TaskID)
 		taskMap[taskInfo.TaskID] = taskInfo
 	}
+
+	// 查询链接
 	db1 := GetReadDB(ctx)
 	db1 = db1.Debug().Model(gorm_model.YounggeeDataInfo{})
+	var LinkInfos []gorm_model.YounggeeLinkInfo
+	db1 = db1.Model(gorm_model.YounggeeLinkInfo{}).Where("task_id IN ? AND is_submit=? AND is_ok = 1", taskIds, 1)
+	err := db1.Find(&LinkInfos).Error
+	if err != nil {
+		logrus.WithContext(ctx).Errorf("[GetProjectTalentList] error query mysql total, err:%+v", err)
+		return nil, 0, err
+	}
+	LinkMap := make(map[int]gorm_model.YounggeeLinkInfo)
+	for _, LinkInfo := range LinkInfos {
+		LinkMap[conv.MustInt(LinkInfo.TaskID)] = LinkInfo
+	}
+
+	db2 := GetReadDB(ctx)
+	db2 = db1.Debug().Model(gorm_model.YounggeeDataInfo{})
 
 	var DataInfos []gorm_model.YounggeeDataInfo
-	db1 = db1.Model(gorm_model.YounggeeDataInfo{}).Where("task_id IN ? AND is_submit=? ", taskIds, 1)
+	db2 = db2.Model(gorm_model.YounggeeDataInfo{}).Where("task_id IN ? AND is_submit=? ", taskIds, 1)
 	if conditions.DataStatus == int64(0) {
-		db1 = db1.Where("is_review = 0").Find(&DataInfos)
+		db2 = db2.Where("is_review = 0").Find(&DataInfos)
 	} else {
-		db1 = db1.Where("is_ok = 1").Find(&DataInfos)
+		db2 = db2.Where("is_ok = 1").Find(&DataInfos)
 	}
 	DataMap := make(map[int]gorm_model.YounggeeDataInfo)
 	for _, DataInfo := range DataInfos {
@@ -89,7 +103,7 @@ func GetTaskDataList(ctx context.Context, projectID string, pageSize, pageNum in
 	}
 	// 查询总数
 	var totalData int64
-	if err := db1.Count(&totalData).Error; err != nil {
+	if err := db2.Count(&totalData).Error; err != nil {
 		logrus.WithContext(ctx).Errorf("[GetProjectTalentList] error query mysql total, err:%+v", err)
 		return nil, 0, err
 	}
@@ -104,8 +118,7 @@ func GetTaskDataList(ctx context.Context, projectID string, pageSize, pageNum in
 	// 查询该页数据
 	limit := pageSize + misNum
 	offset := pageSize * pageNum // assert pageNum start with 0
-	err := db.Order("task_id").Limit(int(limit)).Offset(int(offset)).Error
-
+	err = db.Order("task_id").Limit(int(limit)).Offset(int(offset)).Error
 	if err != nil {
 		logrus.WithContext(ctx).Errorf("[GetProjectTaskList] error query mysql total, err:%+v", err)
 		return nil, 0, err
@@ -118,6 +131,7 @@ func GetTaskDataList(ctx context.Context, projectID string, pageSize, pageNum in
 		TaskData := new(http_model.TaskData)
 		TaskData.Talent = taskMap[taskId]
 		TaskData.Data = DataMap[taskId]
+		TaskData.Link = LinkMap[taskId]
 		TaskDatas = append(TaskDatas, TaskData)
 	}
 
@@ -128,6 +142,8 @@ func GetTaskDataList(ctx context.Context, projectID string, pageSize, pageNum in
 			newTaskDatas = append(newTaskDatas, v)
 		} else if strings.Contains(v.PlatformNickname, platform_nickname) {
 			newTaskDatas = append(newTaskDatas, v)
+		} else if strings.Contains(conv.MustString(v.TaskID), platform_nickname) {
+			newTaskDatas = append(newTaskDatas, v)
 		} else {
 			totalTask--
 		}
@@ -165,10 +181,5 @@ func AcceptData(ctx context.Context, TaskIDs []int) error {
 		logrus.WithContext(ctx).Errorf("[Data db] Update YounggeeDataInfo error,err:%+v", err)
 		return err
 	}
-	err = db.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id in ?", TaskIDs).Updates(gorm_model.YoungeeTaskInfo{DataStatus: 5, TaskStage: 15, CompleteStatus: 2}).Error
-	if err != nil {
-		logrus.WithContext(ctx).Errorf("[Data db] Update YoungeeTaskInfo error,err:%+v", err)
-		return err
-	}
 	return nil
 }

+ 15 - 14
db/default.go

@@ -167,8 +167,6 @@ func GetTaskDefaultDataList(ctx context.Context, projectID string, pageSize, pag
 					strategyIdList = append(strategyIdList, conv.MustInt(strategyId))
 				}
 				db = db.Where("strategy_id in ?", strategyIdList)
-			} else {
-				db = db.Where(fmt.Sprintf("%s like '%%%v%%'", tag, value.Interface()))
 			}
 		}
 	}
@@ -250,6 +248,8 @@ func GetTaskDefaultDataList(ctx context.Context, projectID string, pageSize, pag
 			newTaskDefaultDatas = append(newTaskDefaultDatas, v)
 		} else if strings.Contains(v.PlatformNickname, platform_nickname) {
 			newTaskDefaultDatas = append(newTaskDefaultDatas, v)
+		} else if strings.Contains(conv.MustString(v.TaskID), platform_nickname) {
+			newTaskDefaultDatas = append(newTaskDefaultDatas, v)
 		} else {
 			totalTask--
 		}
@@ -310,8 +310,6 @@ func GetTaskTerminatingList(ctx context.Context, projectID string, pageSize, pag
 					strategyIdList = append(strategyIdList, conv.MustInt(strategyId))
 				}
 				db1 = db1.Where("strategy_id in ?", strategyIdList)
-			} else {
-				db1 = db1.Where(fmt.Sprintf("%s like '%%%v%%'", tag, value.Interface()))
 			}
 		}
 	}
@@ -367,6 +365,8 @@ func GetTaskTerminatingList(ctx context.Context, projectID string, pageSize, pag
 			newTaskTerminatings = append(newTaskTerminatings, v)
 		} else if strings.Contains(v.PlatformNickname, platform_nickname) {
 			newTaskTerminatings = append(newTaskTerminatings, v)
+		} else if strings.Contains(conv.MustString(v.TaskID), platform_nickname) {
+			newTaskTerminatings = append(newTaskTerminatings, v)
 		} else {
 			totalTask--
 		}
@@ -406,8 +406,6 @@ func GetTaskTerminatedList(ctx context.Context, projectID string, pageSize, page
 					strategyIdList = append(strategyIdList, conv.MustInt(strategyId))
 				}
 				db = db.Where("strategy_id in ?", strategyIdList)
-			} else {
-				db = db.Where(fmt.Sprintf("%s like '%%%v%%'", tag, value.Interface()))
 			}
 		}
 	}
@@ -416,7 +414,7 @@ func GetTaskTerminatedList(ctx context.Context, projectID string, pageSize, page
 	// 查询总数
 	var totalTask int64
 	if err := db.Count(&totalTask).Error; err != nil {
-		logrus.WithContext(ctx).Errorf("[GetProjectTaskList] error query mysql total, err:%+v", err)
+		logrus.WithContext(ctx).Errorf("[GetTaskTerminatedList] error query mysql total, err:%+v", err)
 		return nil, 0, err
 	}
 	db.Order("task_id").Find(&taskInfos)
@@ -433,11 +431,12 @@ func GetTaskTerminatedList(ctx context.Context, projectID string, pageSize, page
 
 	var TerminatedInfos []gorm_model.YoungeeContractInfo
 	db1 = db1.Model(gorm_model.YoungeeContractInfo{}).Where("task_id IN ? AND default_status = 1", taskIds)
-	if conditions.DefaultStatus == int64(0) {
-		db1 = db1.Where("is_review = 0").Find(&TerminatedInfos)
-	} else {
-		db1 = db1.Where("is_ok = 1").Find(&TerminatedInfos)
+	err := db1.Find(&TerminatedInfos).Error
+	if err != nil {
+		logrus.WithContext(ctx).Errorf("[GetTaskTerminatedList] error query mysql total, err:%+v", err)
+		return nil, 0, err
 	}
+
 	TerminatedMap := make(map[int]gorm_model.YoungeeContractInfo)
 	for _, TerminatedInfo := range TerminatedInfos {
 		TerminatedMap[conv.MustInt(TerminatedInfo.TaskID)] = TerminatedInfo
@@ -445,7 +444,7 @@ func GetTaskTerminatedList(ctx context.Context, projectID string, pageSize, page
 	// 查询总数
 	var totalTerminated int64
 	if err := db1.Count(&totalTerminated).Error; err != nil {
-		logrus.WithContext(ctx).Errorf("[GetProjectTalentList] error query mysql total, err:%+v", err)
+		logrus.WithContext(ctx).Errorf("[GetTaskTerminatedList] error query mysql total, err:%+v", err)
 		return nil, 0, err
 	}
 	var misNum int64
@@ -459,10 +458,10 @@ func GetTaskTerminatedList(ctx context.Context, projectID string, pageSize, page
 	// 查询该页数据
 	limit := pageSize + misNum
 	offset := pageSize * pageNum // assert pageNum start with 0
-	err := db.Order("task_id").Limit(int(limit)).Offset(int(offset)).Error
+	err = db.Order("task_id").Limit(int(limit)).Offset(int(offset)).Error
 
 	if err != nil {
-		logrus.WithContext(ctx).Errorf("[GetProjectTaskList] error query mysql total, err:%+v", err)
+		logrus.WithContext(ctx).Errorf("[GetTaskTerminatedList] error query mysql total, err:%+v", err)
 		return nil, 0, err
 	}
 
@@ -483,6 +482,8 @@ func GetTaskTerminatedList(ctx context.Context, projectID string, pageSize, page
 			newTaskTerminateds = append(newTaskTerminateds, v)
 		} else if strings.Contains(v.PlatformNickname, platform_nickname) {
 			newTaskTerminateds = append(newTaskTerminateds, v)
+		} else if strings.Contains(conv.MustString(v.TaskID), platform_nickname) {
+			newTaskTerminateds = append(newTaskTerminateds, v)
 		} else {
 			totalTask--
 		}

+ 3 - 2
db/enterprise.go

@@ -2,12 +2,13 @@ package db
 
 import (
 	"context"
-	"github.com/issue9/conv"
 	"time"
 	"youngee_b_api/model/gorm_model"
 	"youngee_b_api/model/http_model"
 	"youngee_b_api/util"
 
+	"github.com/issue9/conv"
+
 	"gorm.io/gorm"
 )
 
@@ -71,7 +72,7 @@ func GetEnterpriseBalance(ctx context.Context, EnterpriseID int64) (*http_model.
 }
 
 // 支付-修改企业账户余额
-func UpdateEnterpriseBalance(ctx context.Context, EnterpriseID int64, balance int64, availableBalance int64, frozenBalance int64) (*int64, error) {
+func UpdateEnterpriseBalance(ctx context.Context, EnterpriseID int64, balance float64, availableBalance float64, frozenBalance float64) (*float64, error) {
 	db := GetReadDB(ctx)
 	err := db.Model(gorm_model.Enterprise{}).Where("enterprise_id", EnterpriseID).
 		Updates(map[string]interface{}{"balance": gorm.Expr("balance + ?", balance), "available_balance": gorm.Expr("available_balance + ?", availableBalance), "frozen_balance": gorm.Expr("frozen_balance + ?", frozenBalance)}).Error

+ 15 - 3
db/finish.go

@@ -15,7 +15,7 @@ import (
 	"github.com/sirupsen/logrus"
 )
 
-func GetTaskFinishList(ctx context.Context, projectID string, pageSize, pageNum int64, conditions *common_model.TalentConditions) ([]*http_model.TaskFinishInfo, int64, error) {
+func GetTaskFinishList(ctx context.Context, pageSize, pageNum int64, conditions *common_model.TalentConditions) ([]*http_model.TaskFinishInfo, int64, error) {
 	db := GetReadDB(ctx)
 	// 查询Task表信息
 	db = db.Debug().Model(gorm_model.YoungeeTaskInfo{}).Where("task_status = 2 and task_stage = 15")
@@ -41,8 +41,6 @@ func GetTaskFinishList(ctx context.Context, projectID string, pageSize, pageNum
 					strategyIdList = append(strategyIdList, conv.MustInt(strategyId))
 				}
 				db = db.Where("strategy_id in ?", strategyIdList)
-			} else {
-				db = db.Where(fmt.Sprintf("%s like '%%%v%%'", tag, value.Interface()))
 			}
 		}
 	}
@@ -124,9 +122,23 @@ func GetTaskFinishList(ctx context.Context, projectID string, pageSize, pageNum
 			newTaskFinishs = append(newTaskFinishs, v)
 		} else if strings.Contains(v.PlatformNickname, platform_nickname) {
 			newTaskFinishs = append(newTaskFinishs, v)
+		} else if strings.Contains(conv.MustString(v.TaskID), platform_nickname) {
+			newTaskFinishs = append(newTaskFinishs, v)
 		} else {
 			totalTask--
 		}
 	}
 	return newTaskFinishs, totalTask, nil
 }
+
+func GetFinishData(ctx context.Context, projectID int64) ([]*gorm_model.RecruitStrategy, error) {
+	finishRecruitStrategy := []*gorm_model.RecruitStrategy{}
+	db := GetReadDB(ctx)
+	// 查询Task表信息
+	err := db.Debug().Model(gorm_model.RecruitStrategy{}).Where("project_id = ?", projectID).Scan(&finishRecruitStrategy).Order("strategy_id").Error
+	if err != nil {
+		logrus.WithContext(ctx).Errorf("[GetProjectTaskList] error query mysql total, err:%+v", err)
+		return nil, err
+	}
+	return finishRecruitStrategy, nil
+}

+ 2 - 2
db/link.go

@@ -51,8 +51,6 @@ func GetTaskLinkList(ctx context.Context, projectID string, pageSize, pageNum in
 					strategyIdList = append(strategyIdList, conv.MustInt(strategyId))
 				}
 				db = db.Where("strategy_id in ?", strategyIdList)
-			} else {
-				db = db.Where(fmt.Sprintf("%s like '%%%v%%'", tag, value.Interface()))
 			}
 		}
 	}
@@ -127,6 +125,8 @@ func GetTaskLinkList(ctx context.Context, projectID string, pageSize, pageNum in
 			newTaskLinks = append(newTaskLinks, v)
 		} else if strings.Contains(v.PlatformNickname, platform_nickname) {
 			newTaskLinks = append(newTaskLinks, v)
+		} else if strings.Contains(conv.MustString(v.TaskID), platform_nickname) {
+			newTaskLinks = append(newTaskLinks, v)
 		} else {
 			totalTask--
 		}

+ 7 - 20
db/logistics.go

@@ -69,7 +69,7 @@ func GetTaskLogisticsList(ctx context.Context, projectID string, pageSize, pageN
 			if tag == "platform_nickname" {
 				platform_nickname = fmt.Sprintf("%v", value.Interface())
 				continue
-			} else if tag == "project_id" {
+			} else if tag == "project_id" || tag == "logistics_status" {
 				db = db.Where(fmt.Sprintf("%s = ?", tag), value.Interface())
 			} else if tag == "strategy_ids" {
 				strategyIds := strings.Split(fmt.Sprintf("%v", value.Interface()), ",")
@@ -78,8 +78,6 @@ func GetTaskLogisticsList(ctx context.Context, projectID string, pageSize, pageN
 					strategyIdList = append(strategyIdList, conv.MustInt(strategyId))
 				}
 				db = db.Where("strategy_id in ?", strategyIdList)
-			} else {
-				db = db.Where(fmt.Sprintf("%s like '%%%v%%'", tag, value.Interface()))
 			}
 		}
 	}
@@ -103,18 +101,6 @@ func GetTaskLogisticsList(ctx context.Context, projectID string, pageSize, pageN
 	db1 := GetReadDB(ctx)
 	db1 = db1.Debug().Model(gorm_model.YoungeeTaskLogistics{})
 
-	// 根据Project条件过滤
-	conditionType2 := reflect.TypeOf(conditions).Elem()
-	conditionValue2 := reflect.ValueOf(conditions).Elem()
-	for i := 0; i < conditionType2.NumField(); i++ {
-		field := conditionType2.Field(i)
-		tag := field.Tag.Get("condition")
-		value := conditionValue2.FieldByName(field.Name)
-		//fmt.Printf("过滤展示 %+v %+v \n", value, tag)
-		if !util.IsBlank(value) && tag == "platform_nickname" { // input:1		taskIdsbase:1,2,3    string
-			db1 = db1.Where(fmt.Sprintf("%s = ?", tag), value.Interface())
-		}
-	}
 	var logisticsInfos []gorm_model.YoungeeTaskLogistics
 	db1 = db1.Model(gorm_model.YoungeeTaskLogistics{}).Where("task_id IN ?", taskIds).Find(&logisticsInfos)
 	logisticsMap := make(map[int]gorm_model.YoungeeTaskLogistics)
@@ -146,7 +132,7 @@ func GetTaskLogisticsList(ctx context.Context, projectID string, pageSize, pageN
 
 	var TaskLogisticss []*http_model.TaskLogistics
 	var taskLogisticss []*http_model.TaskLogisticsInfo
-	var newTaskLinks []*http_model.TaskLogisticsInfo
+	var newTaskLogisticss []*http_model.TaskLogisticsInfo
 	for _, taskId := range taskIds {
 		TaskLogistics := new(http_model.TaskLogistics)
 		TaskLogistics.Talent = taskMap[taskId]
@@ -158,15 +144,16 @@ func GetTaskLogisticsList(ctx context.Context, projectID string, pageSize, pageN
 
 	for _, v := range taskLogisticss {
 		if platform_nickname == "" {
-			newTaskLinks = append(newTaskLinks, v)
+			newTaskLogisticss = append(newTaskLogisticss, v)
 		} else if strings.Contains(v.PlatformNickname, platform_nickname) {
-			newTaskLinks = append(newTaskLinks, v)
+			newTaskLogisticss = append(newTaskLogisticss, v)
+		} else if strings.Contains(conv.MustString(v.TaskID), platform_nickname) {
+			newTaskLogisticss = append(newTaskLogisticss, v)
 		} else {
 			totalTask--
 		}
 	}
-	// return fulltaskLogisticss, total, nil
-	return newTaskLinks, totalTask, nil
+	return newTaskLogisticss, totalTask, nil
 }
 
 // 修改任务表的物流状态

+ 6 - 0
db/number_info.go

@@ -32,6 +32,12 @@ func GetLogisticsNumberInfo(ctx context.Context, projectId int64, strategyIds []
 			logrus.WithContext(ctx).Errorf("[GetProjectTaskList] error query mysql total, err:%+v", err)
 			return nil, err
 		}
+		db = GetReadDB(ctx).Model(gorm_model.YoungeeTaskInfo{}).Where("project_id = ? and strategy_id = ? and task_status = 2", projectId, strategyId)
+		err = db.Count(&LogisticsNumberInfoData.DeliverNumber).Error
+		if err != nil {
+			logrus.WithContext(ctx).Errorf("[GetProjectTaskList] error query mysql total, err:%+v", err)
+			return nil, err
+		}
 
 		LogisticsNumberInfoDataList.LogisticsNumberInfoList = append(LogisticsNumberInfoDataList.LogisticsNumberInfoList, &LogisticsNumberInfoData)
 	}

+ 3 - 2
db/pay_record.go

@@ -2,17 +2,18 @@ package db
 
 import (
 	"context"
-	"github.com/issue9/conv"
 	"time"
 	"youngee_b_api/consts"
 	"youngee_b_api/model/gorm_model"
 	"youngee_b_api/model/http_model"
 
+	"github.com/issue9/conv"
+
 	"github.com/sirupsen/logrus"
 )
 
 // CreatePayRecord 新增
-func CreatePayRecord(ctx context.Context, enterpriseId int64, payment int64, balance int64, payType int64, projectId int64) (*int64, error) {
+func CreatePayRecord(ctx context.Context, enterpriseId int64, payment float64, balance float64, payType int64, projectId int64) (*int64, error) {
 	db := GetReadDB(ctx)
 	payRecord := gorm_model.EnterprisePayRecord{
 		EnterpriseID: enterpriseId,

+ 38 - 20
db/project.go

@@ -3,7 +3,6 @@ package db
 import (
 	"context"
 	"fmt"
-	"github.com/issue9/conv"
 	"reflect"
 	"youngee_b_api/consts"
 	"youngee_b_api/model/common_model"
@@ -12,6 +11,8 @@ import (
 	"youngee_b_api/pack"
 	"youngee_b_api/util"
 
+	"github.com/issue9/conv"
+
 	"github.com/sirupsen/logrus"
 	log "github.com/sirupsen/logrus"
 	"gorm.io/gorm"
@@ -46,7 +47,7 @@ func DeleteProject(ctx context.Context, projectID int64) (*int64, error) {
 func GetFullProjectList(ctx context.Context, enterpriseID int64, pageSize, pageNum int32, condition *common_model.ProjectCondition) ([]*gorm_model.ProjectInfo, int64, error) {
 	db := GetReadDB(ctx)
 	// 根据企业id过滤
-	db = db.Debug().Model(gorm_model.ProjectInfo{}).Where("enterprise_id = ?", enterpriseID)
+	db = db.Debug().Model(gorm_model.ProjectInfo{}).Where("enterprise_id = ? and project_status <> 1", enterpriseID)
 	// 根据Project条件过滤
 	conditionType := reflect.TypeOf(condition).Elem()
 	conditionValue := reflect.ValueOf(condition).Elem()
@@ -54,16 +55,11 @@ func GetFullProjectList(ctx context.Context, enterpriseID int64, pageSize, pageN
 		field := conditionType.Field(i)
 		tag := field.Tag.Get("condition")
 		value := conditionValue.FieldByName(field.Name)
-		if tag == "project_status" && util.IsBlank(value) {
-			db = db.Where(fmt.Sprintf("project_status != 1"))
-		}
-		if !util.IsBlank(value) && tag != "updated_at" && tag != "project_name" {
-			db = db.Where(fmt.Sprintf("%s = ?", tag), value.Interface())
-		}
-		if tag == "updated_at" && value.Interface() != "0" {
+		if (tag == "project_id" || tag == "project_name") && !util.IsBlank(value) {
+			db = db.Where(fmt.Sprintf("project_id like '%%%v%%' or project_name like '%%%v%%'", value.Interface(), value.Interface()))
+		} else if tag == "updated_at" && value.Interface() != "0" {
 			db = db.Where(fmt.Sprintf("%s > ?", tag), value.Interface())
-		}
-		if tag == "project_name" && !util.IsBlank(value) {
+		} else if !util.IsBlank(value) && tag != "updated_at" {
 			db = db.Where(fmt.Sprintf("%s = ?", tag), value.Interface())
 		}
 	}
@@ -96,16 +92,11 @@ func GetProjectDraftList(ctx context.Context, enterpriseID int64, pageSize, page
 		field := conditionType.Field(i)
 		tag := field.Tag.Get("condition")
 		value := conditionValue.FieldByName(field.Name)
-		if tag == "project_status" && util.IsBlank(value) {
-			db = db.Where(fmt.Sprintf("project_status = 1"))
-		}
-		if !util.IsBlank(value) && tag != "updated_at" && tag != "project_name" {
-			db = db.Where(fmt.Sprintf("%s = ?", tag), value.Interface())
-		}
-		if tag == "updated_at" && value.Interface() != "0" {
+		if (tag == "project_id" || tag == "project_name") && !util.IsBlank(value) {
+			db = db.Where(fmt.Sprintf("project_id like '%%%v%%' or project_name like '%%%v%%'", value.Interface(), value.Interface()))
+		} else if tag == "updated_at" && value.Interface() != "0" {
 			db = db.Where(fmt.Sprintf("%s > ?", tag), value.Interface())
-		}
-		if tag == "project_name" && !util.IsBlank(value) {
+		} else if !util.IsBlank(value) && tag != "updated_at" {
 			db = db.Where(fmt.Sprintf("%s = ?", tag), value.Interface())
 		}
 	}
@@ -298,3 +289,30 @@ func GetFeeDetail(ctx context.Context, enterpriseID int64, EndTime string) (*htt
 	}
 	return &FeeDetailPreview, nil
 }
+
+func SetProjectFinish(ctx context.Context, projectId int64) error {
+	db := GetReadDB(ctx)
+	// 1. 更新项目状态为已结束
+	err := db.Model(gorm_model.ProjectInfo{}).Where("project_id = ?", projectId).Updates("project_status = 10").Error
+	if err != nil {
+		logrus.WithContext(ctx).Errorf("[Project db] Update ProjectInfo error,err:%+v", err)
+		return err
+	}
+	// 2. 释放企业账户因项目冻结的资金
+	// 	1). 计算剩余资金
+
+	// 	2). 释放剩余资金
+
+	return nil
+}
+
+func GetCreatingNumber(ctx context.Context, enterpriseID int64) (*int64, error) {
+	db := GetReadDB(ctx)
+	var creatingNumber int64
+	err := db.Model(gorm_model.ProjectInfo{}).Where("enterprise_id = ? and project_status = 1", enterpriseID).Count(&creatingNumber).Error
+	if err != nil {
+		logrus.WithContext(ctx).Errorf("[Project db] Update ProjectInfo error,err:%+v", err)
+		return nil, err
+	}
+	return &creatingNumber, nil
+}

+ 2 - 2
db/script.go

@@ -51,8 +51,6 @@ func GetTaskScriptList(ctx context.Context, projectID string, pageSize, pageNum
 					strategyIdList = append(strategyIdList, conv.MustInt(strategyId))
 				}
 				db = db.Where("strategy_id in ?", strategyIdList)
-			} else {
-				db = db.Where(fmt.Sprintf("%s like '%%%v%%'", tag, value.Interface()))
 			}
 		}
 	}
@@ -128,6 +126,8 @@ func GetTaskScriptList(ctx context.Context, projectID string, pageSize, pageNum
 			newTaskScripts = append(newTaskScripts, v)
 		} else if strings.Contains(v.PlatformNickname, platform_nickname) {
 			newTaskScripts = append(newTaskScripts, v)
+		} else if strings.Contains(conv.MustString(v.TaskID), platform_nickname) {
+			newTaskScripts = append(newTaskScripts, v)
 		} else {
 			totalTask--
 		}

+ 2 - 2
db/sketch.go

@@ -50,8 +50,6 @@ func GetTaskSketchList(ctx context.Context, projectID string, pageSize, pageNum
 					strategyIdList = append(strategyIdList, conv.MustInt(strategyId))
 				}
 				db = db.Where("strategy_id in ?", strategyIdList)
-			} else {
-				db = db.Where(fmt.Sprintf("%s like '%%%v%%'", tag, value.Interface()))
 			}
 		}
 	}
@@ -129,6 +127,8 @@ func GetTaskSketchList(ctx context.Context, projectID string, pageSize, pageNum
 			newTaskSketches = append(newTaskSketches, v)
 		} else if strings.Contains(v.PlatformNickname, platform_nickname) {
 			newTaskSketches = append(newTaskSketches, v)
+		} else if strings.Contains(conv.MustString(v.TaskID), platform_nickname) {
+			newTaskSketches = append(newTaskSketches, v)
 		} else {
 			totalTask--
 		}

+ 61 - 0
db/task.go

@@ -7,6 +7,8 @@ import (
 	"youngee_b_api/model/gorm_model"
 
 	"github.com/sirupsen/logrus"
+	"github.com/tidwall/gjson"
+	"gorm.io/gorm"
 )
 
 func GetTaskList(ctx context.Context, projectID int64) ([]gorm_model.YoungeeTaskInfo, error) {
@@ -95,3 +97,62 @@ func UpdateTaskStage(ctx context.Context, projectID int64, taskStatus int64, tas
 	}
 	return nil
 }
+
+func GetUnfinishedTaskNumber(ctx context.Context, projectID int64) (*int64, error) {
+	var unFinishedTaskNumber int64
+	db := GetReadDB(ctx)
+	err := db.Model(gorm_model.YoungeeTaskInfo{}).Where("project_id = ? and task_status = 2 and task_stage < 15", projectID).Count(&unFinishedTaskNumber).Error
+	if err != nil {
+		logrus.WithContext(ctx).Errorf("[Data db] Find YounggeeTaskInfo error,err:%+v", err)
+		return nil, err
+	}
+	return &unFinishedTaskNumber, nil
+}
+
+// 任务结案
+func SetTaskFinish(ctx context.Context, TaskIDs []int) error {
+	db := GetReadDB(ctx)
+	// 1. 修改任务表,更新任务阶段为已结案,结案方式为正常结束,数据状态为已通过,
+	err := db.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id in ?", TaskIDs).Updates(gorm_model.YoungeeTaskInfo{DataStatus: 5, TaskStage: 15, CompleteStatus: 2}).Error
+	if err != nil {
+		logrus.WithContext(ctx).Errorf("[Task db] Update YoungeeTaskInfo error,err:%+v", err)
+		return err
+	}
+
+	// 2. 修改招募策略表,更新粉丝量、播放量、点赞数、收藏数、评论数、总支付、结案数量
+	for _, v := range TaskIDs {
+		// 查询task_info
+		db = GetReadDB(ctx)
+		taskInfo := gorm_model.YoungeeTaskInfo{}
+		err1 := db.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", v).Scan(taskInfo).Error
+		if err1 != nil {
+			logrus.WithContext(ctx).Errorf("[Task db] Find YoungeeTaskInfo error,err:%+v", err)
+			return err1
+		}
+		// 查询data_info
+		db = GetReadDB(ctx)
+		dataInfo := gorm_model.YounggeeDataInfo{}
+		err1 = db.Model(gorm_model.YounggeeDataInfo{}).Where("task_id = ? and is_ok = 1", v).Scan(dataInfo).Error
+		if err1 != nil {
+			logrus.WithContext(ctx).Errorf("[Task db] Find YounggeeDataInfo error,err:%+v", err)
+			return err1
+		}
+
+		// 更新招募策略
+		db = GetReadDB(ctx)
+		db = db.Model(gorm_model.RecruitStrategy{}).Where("project_id = ? and strategy_id = ?", taskInfo.ProjectID, taskInfo.StrategyID)
+		err = db.Updates(map[string]interface{}{
+			"fan_number":     gorm.Expr("fan_number + ?", gjson.Get(taskInfo.TalentPlatformInfoSnap, "fans_count")),
+			"play_number":    gorm.Expr("play_number + ?", dataInfo.PlayNumber),
+			"like_number":    gorm.Expr("like_number + ?", dataInfo.LikeNumber),
+			"collect_number": gorm.Expr("collect_number + ?", dataInfo.CollectNumber),
+			"comment_number": gorm.Expr("comment_number + ?", dataInfo.CommentNumber),
+			"finish_number":  gorm.Expr("finish_number + 1"),
+			"total_offer":    gorm.Expr("total_offer + ?", taskInfo.RealPayment)}).Error
+		if err != nil {
+			logrus.WithContext(ctx).Errorf("[Task db] Update YounggeeDataInfo error,err:%+v", err)
+			return err
+		}
+	}
+	return nil
+}

+ 61 - 0
handler/get_creating_number.go

@@ -0,0 +1,61 @@
+package handler
+
+import (
+	"youngee_b_api/consts"
+	"youngee_b_api/db"
+	"youngee_b_api/middleware"
+	"youngee_b_api/model/http_model"
+	"youngee_b_api/util"
+
+	"github.com/gin-gonic/gin"
+	"github.com/sirupsen/logrus"
+)
+
+func WrapGetCreatingNumberHandler(ctx *gin.Context) {
+	handler := newGetCreatingNumberHandler(ctx)
+	baseRun(handler)
+}
+
+type GetCreatingNumberHandler struct {
+	ctx  *gin.Context
+	req  *http_model.GetCreatingNumberRequest
+	resp *http_model.CommonResponse
+}
+
+func (g GetCreatingNumberHandler) getContext() *gin.Context {
+	return g.ctx
+}
+
+func (g GetCreatingNumberHandler) getResponse() interface{} {
+	return g.resp
+}
+
+func (g GetCreatingNumberHandler) getRequest() interface{} {
+	return g.req
+}
+
+func (g GetCreatingNumberHandler) run() {
+	auth := middleware.GetSessionAuth(g.ctx)
+	enterpriseID := auth.EnterpriseID
+	data, err := db.GetCreatingNumber(g.ctx, enterpriseID)
+	if err != nil {
+		// 数据库查询失败,返回5001
+		logrus.Errorf("[GetCreatingNumberHandler] call GetCreatingNumber err:%+v\n", err)
+		util.HandlerPackErrorResp(g.resp, consts.ErrorInternal, "")
+		logrus.Info("GetCreatingNumber fail,req:%+v", g.req)
+		return
+	}
+	g.resp.Data = data
+}
+
+func (g GetCreatingNumberHandler) checkParam() error {
+	return nil
+}
+
+func newGetCreatingNumberHandler(ctx *gin.Context) *GetCreatingNumberHandler {
+	return &GetCreatingNumberHandler{
+		ctx:  ctx,
+		req:  http_model.NewGetCreatingNumberRequest(),
+		resp: http_model.NewGetCreatingNumberResponse(),
+	}
+}

+ 59 - 0
handler/get_finish_data.go

@@ -0,0 +1,59 @@
+package handler
+
+import (
+	"youngee_b_api/consts"
+	"youngee_b_api/model/http_model"
+	"youngee_b_api/service"
+	"youngee_b_api/util"
+
+	"github.com/gin-gonic/gin"
+	"github.com/sirupsen/logrus"
+	log "github.com/sirupsen/logrus"
+)
+
+func WrapGetFinishDataHandler(ctx *gin.Context) {
+	handler := newGetFinishDataHandler(ctx)
+	baseRun(handler)
+}
+
+func newGetFinishDataHandler(ctx *gin.Context) *GetFinishDataHandler {
+	return &GetFinishDataHandler{
+		req:  http_model.NewGetFinishDataRequest(),
+		resp: http_model.NewGetFinishDataResponse(),
+		ctx:  ctx,
+	}
+}
+
+type GetFinishDataHandler struct {
+	req  *http_model.GetFinishDataRequest
+	resp *http_model.CommonResponse
+	ctx  *gin.Context
+}
+
+func (h *GetFinishDataHandler) getRequest() interface{} {
+	return h.req
+}
+func (h *GetFinishDataHandler) getContext() *gin.Context {
+	return h.ctx
+}
+func (h *GetFinishDataHandler) getResponse() interface{} {
+	return h.resp
+}
+
+func (h *GetFinishDataHandler) run() {
+	data := http_model.GetFinishDataRequest{}
+	data = *h.req
+	res, err := service.Finish.GetFinishData(h.ctx, data)
+	if err != nil {
+		logrus.Errorf("[GetFinishDataHandler] call GetFinishData err:%+v\n", err)
+		util.HandlerPackErrorResp(h.resp, consts.ErrorInternal, "")
+		log.Info("GetFinishData fail,req:%+v", h.req)
+		return
+	}
+	h.resp.Message = ""
+	h.resp.Data = res
+}
+
+func (h *GetFinishDataHandler) checkParam() error {
+	return nil
+}

+ 59 - 0
handler/logisitics_number_info.go

@@ -0,0 +1,59 @@
+package handler
+
+import (
+	"youngee_b_api/consts"
+	"youngee_b_api/model/http_model"
+	"youngee_b_api/service"
+	"youngee_b_api/util"
+
+	"github.com/gin-gonic/gin"
+	"github.com/sirupsen/logrus"
+	log "github.com/sirupsen/logrus"
+)
+
+func WrapGetLogisticsNumberInfoHandler(ctx *gin.Context) {
+	handler := newGetLogisticsNumberInfoHandler(ctx)
+	baseRun(handler)
+}
+
+func newGetLogisticsNumberInfoHandler(ctx *gin.Context) *GetLogisticsNumberInfoHandler {
+	return &GetLogisticsNumberInfoHandler{
+		req:  http_model.NewGetLogisticsNumberInfoRequest(),
+		resp: http_model.NewGetLogisticsNumberInfoResponse(),
+		ctx:  ctx,
+	}
+}
+
+type GetLogisticsNumberInfoHandler struct {
+	req  *http_model.GetLogisticsNumberInfoRequest
+	resp *http_model.CommonResponse
+	ctx  *gin.Context
+}
+
+func (h *GetLogisticsNumberInfoHandler) getRequest() interface{} {
+	return h.req
+}
+func (h *GetLogisticsNumberInfoHandler) getContext() *gin.Context {
+	return h.ctx
+}
+func (h *GetLogisticsNumberInfoHandler) getResponse() interface{} {
+	return h.resp
+}
+
+func (h *GetLogisticsNumberInfoHandler) run() {
+	data := http_model.GetLogisticsNumberInfoRequest{}
+	data = *h.req
+	res, err := service.Number.GetLogisticsNumberInfo(h.ctx, data)
+	if err != nil {
+		logrus.Errorf("[GetLogisticsNumberInfoHandler] call GetLogisticsNumberInfo err:%+v\n", err)
+		util.HandlerPackErrorResp(h.resp, consts.ErrorInternal, "")
+		log.Info("GetLogisticsNumberInfo fail,req:%+v", h.req)
+		return
+	}
+	h.resp.Message = ""
+	h.resp.Data = res
+}
+
+func (h *GetLogisticsNumberInfoHandler) checkParam() error {
+	return nil
+}

+ 4 - 4
handler/project_draft_list.go

@@ -66,10 +66,10 @@ func (h *ProjectDraftListHandler) checkParam() error {
 	if _, err := conv.Int64(h.req.ProjectForm); err != nil {
 		errs = append(errs, err)
 	}
-	h.req.ProjectId = util.IsNull(h.req.ProjectId)
-	if _, err := conv.Int64(h.req.ProjectId); err != nil {
-		errs = append(errs, err)
-	}
+	// h.req.ProjectId = util.IsNull(h.req.ProjectId)
+	// if _, err := conv.Int64(h.req.ProjectId); err != nil {
+	// 	errs = append(errs, err)
+	// }
 	//h.req.ProjectName = util.IsNull(h.req.ProjectName)
 
 	h.req.ProjectStatus = util.IsNull(h.req.ProjectStatus)

+ 4 - 4
handler/project_list.go

@@ -78,10 +78,10 @@ func (h *FullProjectListHandler) checkParam() error {
 	if _, err := conv.Int64(h.req.ProjectForm); err != nil {
 		errs = append(errs, err)
 	}
-	h.req.ProjectId = util.IsNull(h.req.ProjectId)
-	if _, err := conv.Int64(h.req.ProjectId); err != nil {
-		errs = append(errs, err)
-	}
+	// h.req.ProjectId = util.IsNull(h.req.ProjectId)
+	// if _, err := conv.Int64(h.req.ProjectId); err != nil {
+	// 	errs = append(errs, err)
+	// }
 	//h.req.ProjectName = util.IsNull(h.req.ProjectName)
 
 	h.req.ProjectStatus = util.IsNull(h.req.ProjectStatus)

+ 4 - 4
handler/task_logistics_list.go

@@ -62,10 +62,10 @@ func (h *TaskLogisticsListHandler) checkParam() error {
 	if _, err := conv.Int64(h.req.ProjectId); err != nil {
 		errs = append(errs, err)
 	}
-	h.req.StrategyId = util.IsNull(h.req.StrategyId)
-	if _, err := conv.Int64(h.req.StrategyId); err != nil {
-		errs = append(errs, err)
-	}
+	// h.req.StrategyId = util.IsNull(h.req.StrategyId)
+	// if _, err := conv.Int64(h.req.StrategyId); err != nil {
+	// 	errs = append(errs, err)
+	// }
 	h.req.LogisticsStatus = util.IsNull(h.req.LogisticsStatus)
 	if _, err := conv.Int64(h.req.LogisticsStatus); err != nil {
 		errs = append(errs, err)

+ 1 - 1
model/common_model/project_condition.go

@@ -1,7 +1,7 @@
 package common_model
 
 type ProjectCondition struct {
-	ProjectId          int64 `condition:"project_id"`       // 项目ID
+	ProjectId          string `condition:"project_id"`       // 项目ID
 	ProjectName        string `condition:"project_name"`     // 项目名
 	ProjectStatus      int64  `condition:"project_status"`   // 项目状态
 	ProjectPlatform    int64  `condition:"project_platform"` // 项目平台

+ 7 - 4
model/gorm_model/enterprise.go

@@ -6,13 +6,16 @@ import (
 )
 
 type Enterprise struct {
-	EnterpriseID     int64       `gorm:"column:enterprise_id"` // 企业id
+	EnterpriseID     int64       `gorm:"column:enterprise_id;primary_key;AUTO_INCREMENT"` // 企业id
 	Industry         int64       `gorm:"column:industry"`                                 // 行业,1-14分别代表能源、化工、材料、机械设备/军工、企业服务/造纸印刷、运输设备、旅游酒店、媒体/信息通信服务、批发/零售、消费品、卫生保健/医疗、金融、建材/建筑/房地产、公共事业
 	BusinessName     string    `gorm:"column:business_name"`                            // 公司或组织名称
 	UserID           int64       `gorm:"column:user_id"`                                  // 对应用户id
-	Balance          int64       `gorm:"column:balance"`                                  // 账户余额
-	FrozenBalance    int64       `gorm:"column:frozen_balance"`                           // 冻结余额
-	AvailableBalance int64       `gorm:"column:available_balance"`                        // 可用余额
+	Balance          float64    `gorm:"column:balance"`                                  // 账户余额
+	FrozenBalance    float64    `gorm:"column:frozen_balance"`                           // 冻结余额
+	AvailableBalance float64    `gorm:"column:available_balance"`                        // 可用余额
+	BillableAmount   float64    `gorm:"column:billable_amount"`                          // 可开票金额
+	Invoicing        float64    `gorm:"column:invoicing"`                                // 开票中金额
+	Recharging       float64    `gorm:"column:recharging"`                               // 充值中金额
 	CreatedAt        time.Time `gorm:"column:created_at"`                               // 创建时间
 	UpdatedAt        time.Time `gorm:"column:updated_at"`                               // 更新时间
 }

+ 2 - 2
model/gorm_model/pay_record.go

@@ -7,8 +7,8 @@ import (
 
 type EnterprisePayRecord struct {
 	ID           int64       `gorm:"column:id;primary_key;AUTO_INCREMENT"` // id
-	Payment      int64       `gorm:"column:payment;NOT NULL"`              // 交易金额
-	Balance      int64       `gorm:"column:balance"`                       // 交易后账户可用余额
+	Payment      float64       `gorm:"column:payment;NOT NULL"`              // 交易金额
+	Balance      float64       `gorm:"column:balance"`                       // 交易后账户可用余额
 	PayType      int64       `gorm:"column:pay_type;NOT NULL"`             // 交易类型,1表示充值,2表示支付
 	RechargeType int64       `gorm:"column:recharge_type"`                 // 充值方式,1表示在线交易,2表示对公转账
 	EnterpriseID int64       `gorm:"column:enterprise_id;NOT NULL"`        // 企业id

+ 7 - 5
model/gorm_model/project.go

@@ -13,24 +13,26 @@ type ProjectInfo struct {
 	ProjectPlatform   int64       `gorm:"column:project_platform"`                      // 项目平台,1-7分别代表小红书、抖音、微博、快手、b站、大众点评、知乎
 	ProjectForm       int64       `gorm:"column:project_form"`                          // 项目形式,1-4分别代表实体商品寄拍、虚拟产品测评、线下探店打卡、素材微原创
 	TalentType        string    `gorm:"column:talent_type"`                           // 达人类型
-	RecruitDdl        time.Time `gorm:"column:recruit_ddl"`                           // 招募截止时间
+	RecruitDdl        *time.Time `gorm:"column:recruit_ddl"`                           // 招募截止时间
 	ContentType       int64       `gorm:"column:content_type"`                          // 内容形式,1代表图文,2代表视频
 	ProjectDetail     string    `gorm:"column:project_detail"`                        // 项目详情
 	ApplyNum          int64       `gorm:"column:apply_num;default:0;NOT NULL"`          // 报名人数
 	RecruitNum        int64       `gorm:"column:recruit_num;default:0;NOT NULL"`        // 已招募人数
 	EnterpriseID      int64       `gorm:"column:enterprise_id"`                         // 所属企业id
 	ProductID         int64       `gorm:"column:product_id"`                            // 关联商品id
-	CreatedAt         time.Time `gorm:"column:created_at"`                            // 创建时间
-	UpdatedAt         time.Time `gorm:"column:updated_at"`                            // 修改时间
+	CreatedAt         *time.Time `gorm:"column:created_at"`                            // 创建时间
+	UpdatedAt         *time.Time `gorm:"column:updated_at"`                            // 修改时间
 	FeeForm           string    `gorm:"column:fee_form"`                              // 稿费形式列表
 	AutoFailAt        *time.Time `gorm:"column:auto_fail_at"`                          // 失效自动处理时间
-	AutoTaskID        int64     `gorm:"column:auto_task_id;NOT NULL"`                 // 定时任务id
-	AutoDefaultID     int64     `gorm:"column:auto_default_id;NOT NULL"`              // 违约状态id
+	AutoTaskID        int64       `gorm:"column:auto_task_id;NOT NULL"`                 // 定时任务id
+	AutoDefaultID     int64       `gorm:"column:auto_default_id;NOT NULL"`              // 违约状态id
 	PaymentAmount     float64   `gorm:"column:payment_amount"`                        // 支付金额
 	PayAt             *time.Time `gorm:"column:pay_at"`                                // 支付时间
 	AutoScriptBreakAt *time.Time `gorm:"column:auto_script_break_at"`                  // 脚本违约自动处理时间
 	AutoSketchBreakAt *time.Time `gorm:"column:auto_sketch_break_at"`                  // 初稿违约自动处理时间
 	FailReason        int64       `gorm:"column:fail_reason"`                           // 失效原因,1、2分别表示逾期未支付、项目存在风险
+	PassAt            *time.Time `gorm:"column:pass_at"`                               // 审核通过时间
+	FinishAt          *time.Time `gorm:"column:finish_at"`                             // 结案时间
 }
 
 func (m *ProjectInfo) TableName() string {

+ 14 - 4
model/gorm_model/recruit_strategy.go

@@ -1,6 +1,7 @@
 // Code generated by sql2gorm. DO NOT EDIT.
 package gorm_model
 
+
 type RecruitStrategy struct {
 	RecruitStrategyID int64 `gorm:"column:recruit_strategy_id;primary_key;AUTO_INCREMENT"` // 招募策略id
 	FeeForm           int64 `gorm:"column:fee_form"`                                       // 稿费形式,1-3分别代表产品置换、固定稿费、自报价
@@ -11,10 +12,19 @@ type RecruitStrategy struct {
 	Offer             int64 `gorm:"column:offer"`                                          // 报价
 	ProjectID         int64 `gorm:"column:project_id"`                                     // 所属项目id
 	ServiceCharge     int64 `gorm:"column:service_charge"`                                 // 平台服务费,稿费形式为产品置换时必填
-	SelectedNumber    int64 `gorm:"column:selected_number"`                                // 已选数量,被企业选择的达人数量 应发货
-	WaitingNumber     int64 `gorm:"column:waiting_number"`                                 // 待发货
-	DeliveredNumber   int64 `gorm:"column:delivered_number"`                               // 已发货
-	SignedNumber      int64 `gorm:"column:signed_number"`                                  // 已签收
+	SelectedNumber    int64 `gorm:"column:selected_number;default:0"`                      // 已选数量,被企业选择的达人数量
+	WaitingNumber     int64 `gorm:"column:waiting_number;default:0"`                       // 待发货
+	DeliveredNumber   int64 `gorm:"column:delivered_number;default:0"`                     // 已发货
+	SignedNumber      int64 `gorm:"column:signed_number;default:0"`                        // 已签收
+	MaxOffer          int64 `gorm:"column:max_offer"`                                      // 报价上限
+	MinOffer          int64 `gorm:"column:min_offer"`                                      // 报价下限
+	FanNumber         int64 `gorm:"column:fan_number"`                                     // 总粉丝量
+	PlayNumber        int64 `gorm:"column:play_number"`                                    // 总播放量
+	LikeNumber        int64 `gorm:"column:like_number"`                                    // 总点赞数
+	CollectNumber     int64 `gorm:"column:collect_number"`                                 // 总收藏量
+	CommentNumber     int64 `gorm:"column:comment_number"`                                 // 总评论数
+	FinishNumber      int64 `gorm:"column:finish_number"`                                  // 结案数量
+	TotalOffer        int64 `gorm:"column:total_offer"`                                    // 支付合计
 }
 
 func (m *RecruitStrategy) TableName() string {

+ 18 - 0
model/http_model/GetCreatingNumberRequest.go

@@ -0,0 +1,18 @@
+package http_model
+
+type GetCreatingNumberRequest struct {
+}
+
+type GetCreatingNumberData struct {
+	CreatingNumber int64 `json:"creating_number"` // 应结案数量
+}
+
+func NewGetCreatingNumberRequest() *GetCreatingNumberRequest {
+	return new(GetCreatingNumberRequest)
+}
+
+func NewGetCreatingNumberResponse() *CommonResponse {
+	resp := new(CommonResponse)
+	resp.Data = new(GetCreatingNumberData)
+	return resp
+}

+ 3 - 3
model/http_model/data_accept.go

@@ -1,9 +1,9 @@
 package http_model
 
 type AcceptDataRequest struct {
-	Payment float64 `json:"payment"`      //招募策略id
-	TaskIds string  `json:"task_id_list"` //任务id列表
-	// TaskID     int64 `json:"task_id"`     //任务-id
+	Payment   float64 `json:"payment"`      //招募策略id
+	TaskIds   string  `json:"task_id_list"` //任务id列表
+	ProjectId int64   `json:"project_id"`   //项目id
 }
 
 type AcceptDataData struct {

+ 6 - 6
model/http_model/enterprise_balance.go

@@ -5,12 +5,12 @@ type EnterpriseBalanceRequest struct {
 }
 
 type EnterpriseBalanceData struct {
-	Balance          int64 `json:"balance"`
-	FrozenBalance    int64 `json:"frozen_balance"`
-	AvailableBalance int64 `json:"available_balance"`
-	Recharging       int64 `json:"recharging"`
-	BillableAmount   int64 `json:"billable_amount"`
-	Invoicing        int64 `json:"invoicing"`
+	Balance          float64 `json:"balance"`
+	FrozenBalance    float64 `json:"frozen_balance"`
+	AvailableBalance float64 `json:"available_balance"`
+	Recharging       float64 `json:"recharging"`
+	BillableAmount   float64 `json:"billable_amount"`
+	Invoicing        float64 `json:"invoicing"`
 }
 
 func NewEnterpriseBalanceRequest() *EnterpriseBalanceRequest {

+ 43 - 0
model/http_model/get_finish_data.go

@@ -0,0 +1,43 @@
+package http_model
+
+type GetFinishDataRequest struct {
+	ProjectId string `json:"project_id"` // 项目id
+}
+
+type GetFinishDataInfo struct {
+	FeeForm         string `json:"fee_form"`         // 稿费形式,1-3分别代表产品置换、固定稿费、自报价
+	StrategyID      string `json:"strategy_id"`      // 策略id
+	FollowersLow    string `json:"followers_low"`    // 达人粉丝数下限
+	FollowersUp     string `json:"followers_up"`     // 达人粉丝数上限
+	RecruitNumber   string `json:"recruit_number"`   // 招募数量
+	Offer           string `json:"offer"`            // 报价
+	ProjectID       string `json:"project_id"`       // 所属项目id
+	ServiceCharge   string `json:"service_charge"`   // 平台服务费,稿费形式为产品置换时必填
+	SelectedNumber  string `json:"selected_number"`  // 已选数量,被企业选择的达人数量
+	WaitingNumber   string `json:"waiting_number"`   // 待发货
+	DeliveredNumber string `json:"delivered_number"` // 已发货
+	SignedNumber    string `json:"signed_number"`    // 已签收
+	MaxOffer        string `json:"max_offer"`        // 报价上限
+	MinOffer        string `json:"min_offer"`        // 报价下限
+	FanNumber       string `json:"fan_number"`       // 总粉丝量
+	PlayNumber      string `json:"play_number"`      // 总播放量
+	LikeNumber      string `json:"like_number"`      // 总点赞数
+	CollectNumber   string `json:"collect_number"`   // 总收藏量
+	CommentNumber   string `json:"comment_number"`   // 总评论数
+	FinishNumber    string `json:"finish_number"`    // 结案数量
+	TotalOffer      string `json:"total_offer"`      // 支付合计
+
+}
+
+type GetFinishData struct {
+	FinishRecruitStrategy []*GetFinishDataInfo `json:"finish_recruit_strategys"`
+}
+
+func NewGetFinishDataRequest() *GetFinishDataRequest {
+	return new(GetFinishDataRequest)
+}
+func NewGetFinishDataResponse() *CommonResponse {
+	resp := new(CommonResponse)
+	resp.Data = new(GetFinishData)
+	return resp
+}

+ 2 - 2
model/http_model/pay_sum.go

@@ -4,8 +4,8 @@ type PaySumRequest struct {
 	ProjectId string `json:"project_id"` // 项目ID
 }
 type PaySum struct {
-	StrategyId int     `json:"strategy_id"`  // 策略ID
-	AllPayment float64 `json:"all_payment"'` //任务的全部费用
+	StrategyId int     `json:"strategy_id"` // 策略ID
+	AllPayment float64 `json:"all_payment"` //任务的全部费用
 }
 type PaySumResponce struct {
 	//ProjectId  string  `json:"project_id"`   // 项目ID

+ 0 - 1
model/http_model/project_create.go

@@ -29,7 +29,6 @@ type CreateProjectRequest struct {
 	RecruitStrategys []CreateRecruitStrategy `json:"recruit_strategys"` // 定价策略
 	ProjectPhotos    []CreateProjectPhoto    `json:"project_photos"`    // 项目图片
 	ProductID        int64                   `json:"product_id"`        // 关联商品id
-
 }
 
 type CreateProjectData struct {

+ 2 - 2
model/http_model/project_pay.go

@@ -1,8 +1,8 @@
 package http_model
 
 type ProjectPayRequest struct {
-	ProjectID string `json:"project_id"`
-	PaySum    int64  `json:"pay_sum"`
+	ProjectID string  `json:"project_id"`
+	PaySum    float64 `json:"pay_sum"`
 }
 
 type ProjectPayData struct {

+ 8 - 5
model/http_model/project_show.go

@@ -36,12 +36,15 @@ type ShowProjectData struct {
 	ProjectPhotos    []ShowProjectPhoto    `json:"project_photos"`    // 项目图片
 	ProductID        string                `json:"product_id"`        // 关联商品id
 	EnterpriseID     string                `json:"enterprise_id"`     // 企业id
-	Balance          string                `json:"balance"`           //企业余额
+	Balance          string                `json:"balance"`           // 企业余额
 	ProjectID        string                `json:"project_id"`        // 项目id
-	FailReason       string                `json:"fail_reason"`
-	CreateAt         time.Time             `json:"create_at"` //创建时间
-	UpdateAt         time.Time             `json:"update_at"` //更新时间
-	Phone            string                `json:"phone"`     //联系方式
+	FailReason       string                `json:"fail_reason"`       // 失效原因
+	Phone            string                `json:"phone"`             // 联系方式
+	CreateAt         time.Time             `json:"create_at"`         // 创建时间
+	UpdateAt         time.Time             `json:"update_at"`         // 更新时间
+	PassAt           time.Time             `json:"pass_at"`           // 审核通过时间
+	FinishAt         time.Time             `json:"finish_at"`         // 结案时间
+	PayAt            time.Time             `json:"pay_at"`            // 支付时间
 }
 
 type ShowProjectRequest struct {

+ 1 - 0
model/http_model/project_update.go

@@ -21,6 +21,7 @@ type UpdateProjectRequest struct {
 	TalentType       string                  `json:"talent_type"`       // 达人类型
 	RecruitDdl       time.Time               `json:"recruit_ddl"`       // 招募截止时间
 	ContentType      string                  `json:"content_type"`      // 内容形式,1代表图文,2代表视频
+	ProjectStatus    string                  `json:"project_status"`    // 项目阶段
 	ProjectDetail    string                  `json:"project_detail"`    // 项目详情
 	RecruitStrategys []UpdateRecruitStrategy `json:"recruit_strategys"` // 定价策略
 	ProjectPhotos    []UpdateProjectPhoto    `json:"project_photos"`    // 项目图片

+ 3 - 0
model/http_model/task_data.go

@@ -25,6 +25,7 @@ type TaskDataPreview struct {
 	LikeNumber        int     `json:"like_number"`         // 点赞数
 	CommentNumber     int     `json:"comment_number"`      // 评论数
 	CollectNumber     int     `json:"collect_number"`      // 收藏数
+	LinkUrl           string  `json:"link_url"`            // 上传链接url
 	PhotoUrl          string  `json:"photo_url"`           // 数据截图url
 	AllPayment        float64 `json:"all_payment"`         // 企业支付
 	RealPayment       float64 `json:"real_payment"`        // 企业实际支付(扣除违约扣款)
@@ -44,6 +45,7 @@ type TaskDataInfo struct {
 	LikeNumber        int       `json:"like_number"`         // 点赞数
 	CommentNumber     int       `json:"comment_number"`      // 评论数
 	CollectNumber     int       `json:"collect_number"`      // 收藏数
+	LinkUrl           string    `json:"link_url"`            // 上传链接url
 	PhotoUrl          string    `json:"photo_url"`           // 数据截图url
 	AllPayment        float64   `json:"all_payment"`         // 企业支付
 	RealPayment       float64   `json:"real_payment"`        // 企业实际支付(扣除违约扣款)
@@ -56,6 +58,7 @@ type TaskDataInfo struct {
 }
 
 type TaskData struct {
+	Link   gorm_model.YounggeeLinkInfo
 	Talent gorm_model.YoungeeTaskInfo
 	Data   gorm_model.YounggeeDataInfo
 }

+ 16 - 13
model/http_model/task_finish.go

@@ -1,6 +1,7 @@
 package http_model
 
 import (
+	"time"
 	"youngee_b_api/model/gorm_model"
 )
 
@@ -26,23 +27,25 @@ type TaskFinishPreview struct {
 	CollectNumber     int     `json:"collect_number"`      // 收藏数
 	PhotoUrl          string  `json:"photo_url"`           // 数据截图url
 	RealPayment       float64 `json:"real_payment"`        // 企业实际支付(扣除违约扣款)
+	SubmitAt          string  `json:"submit_at"`           // 提交时间
 	LinkUrl           string  `json:"link_url"`            // 上传链接url
 }
 
 type TaskFinishInfo struct {
-	TaskID            int     `json:"task_id"`             // 任务ID
-	PlatformNickname  string  `json:"platform_nickname"`   // 账号昵称
-	FansCount         string  `json:"fans_count"`          // 粉丝数
-	RecruitStrategyID int     `json:"recruit_strategy_id"` // 招募策略ID
-	StrategyID        int     `json:"strategy_id"`         // 报名选择的招募策略id
-	DataId            int     `json:"data_id"`             // 数据ID
-	PlayNumber        int     `json:"play_number"`         // 播放量/阅读量
-	LikeNumber        int     `json:"like_number"`         // 点赞数
-	CommentNumber     int     `json:"comment_number"`      // 评论数
-	CollectNumber     int     `json:"collect_number"`      // 收藏数
-	PhotoUrl          string  `json:"photo_url"`           // 数据截图url
-	RealPayment       float64 `json:"real_payment"`        // 企业实际支付(扣除违约扣款)
-	LinkUrl           string  `json:"link_url"`            // 上传链接url
+	TaskID            int       `json:"task_id"`             // 任务ID
+	PlatformNickname  string    `json:"platform_nickname"`   // 账号昵称
+	FansCount         string    `json:"fans_count"`          // 粉丝数
+	RecruitStrategyID int       `json:"recruit_strategy_id"` // 招募策略ID
+	StrategyID        int       `json:"strategy_id"`         // 报名选择的招募策略id
+	DataId            int       `json:"data_id"`             // 数据ID
+	PlayNumber        int       `json:"play_number"`         // 播放量/阅读量
+	LikeNumber        int       `json:"like_number"`         // 点赞数
+	CommentNumber     int       `json:"comment_number"`      // 评论数
+	CollectNumber     int       `json:"collect_number"`      // 收藏数
+	PhotoUrl          string    `json:"photo_url"`           // 数据截图url
+	RealPayment       float64   `json:"real_payment"`        // 企业实际支付(扣除违约扣款)
+	LinkUrl           string    `json:"link_url"`            // 上传链接url
+	SubmitAt          time.Time `json:"submit_at"`           // 提交时间
 }
 
 type TaskFinish struct {

+ 8 - 8
pack/full_project_condition.go

@@ -1,21 +1,21 @@
 package pack
 
 import (
-	"github.com/issue9/conv"
 	"youngee_b_api/model/common_model"
 	"youngee_b_api/model/http_model"
+
+	"github.com/issue9/conv"
 )
 
 func HttpFullProjectRequestToCondition(req *http_model.FullProjectListRequest) *common_model.ProjectCondition {
 	projectUpdated := conv.MustString(req.ProjectUpdated)
-	projectName := req.ProjectName
 	return &common_model.ProjectCondition{
-		ProjectId:          conv.MustInt64(req.ProjectId,0),
-		ProjectName:        projectName,
-		ProjectStatus:      conv.MustInt64(req.ProjectStatus,0),
-		ProjectPlatform:    conv.MustInt64(req.ProjectPlatform,0),
-		ProjectForm:        conv.MustInt64(req.ProjectForm,0),
-		ProjectContentType: conv.MustInt64(req.ProjectContentType,0),
+		ProjectId:          req.ProjectId,
+		ProjectName:        req.ProjectName,
+		ProjectStatus:      conv.MustInt64(req.ProjectStatus, 0),
+		ProjectPlatform:    conv.MustInt64(req.ProjectPlatform, 0),
+		ProjectForm:        conv.MustInt64(req.ProjectForm, 0),
+		ProjectContentType: conv.MustInt64(req.ProjectContentType, 0),
 		ProjectUpdated:     projectUpdated,
 	}
 }

+ 43 - 0
pack/get_finish_data.go

@@ -0,0 +1,43 @@
+package pack
+
+import (
+	"youngee_b_api/model/gorm_model"
+	"youngee_b_api/model/http_model"
+
+	"github.com/issue9/conv"
+)
+
+func MGormRecruitStrategyListToHttpGetFinishDataInfoList(gormRecruitStrategys []*gorm_model.RecruitStrategy) []*http_model.GetFinishDataInfo {
+	var httpGetFinishDataInfos []*http_model.GetFinishDataInfo
+	for _, gormRecruitStrategy := range gormRecruitStrategys {
+		httpGetFinishDataInfo := MGormRecruitStrategyToHttpGetFinishDataInfo(gormRecruitStrategy)
+		httpGetFinishDataInfos = append(httpGetFinishDataInfos, httpGetFinishDataInfo)
+	}
+	return httpGetFinishDataInfos
+}
+
+func MGormRecruitStrategyToHttpGetFinishDataInfo(RecruitStrategy *gorm_model.RecruitStrategy) *http_model.GetFinishDataInfo {
+	return &http_model.GetFinishDataInfo{
+		FeeForm:         conv.MustString(RecruitStrategy.FeeForm),
+		StrategyID:      conv.MustString(RecruitStrategy.StrategyID),
+		FollowersLow:    conv.MustString(RecruitStrategy.FollowersLow),
+		FollowersUp:     conv.MustString(RecruitStrategy.FollowersUp),
+		RecruitNumber:   conv.MustString(RecruitStrategy.RecruitNumber),
+		Offer:           conv.MustString(RecruitStrategy.Offer),
+		ProjectID:       conv.MustString(RecruitStrategy.ProjectID),
+		ServiceCharge:   conv.MustString(RecruitStrategy.ServiceCharge),
+		SelectedNumber:  conv.MustString(RecruitStrategy.SelectedNumber),
+		WaitingNumber:   conv.MustString(RecruitStrategy.WaitingNumber),
+		DeliveredNumber: conv.MustString(RecruitStrategy.DeliveredNumber),
+		SignedNumber:    conv.MustString(RecruitStrategy.SignedNumber),
+		MaxOffer:        conv.MustString(RecruitStrategy.MaxOffer),
+		MinOffer:        conv.MustString(RecruitStrategy.MinOffer),
+		FanNumber:       conv.MustString(RecruitStrategy.FanNumber),
+		PlayNumber:      conv.MustString(RecruitStrategy.PlayNumber),
+		LikeNumber:      conv.MustString(RecruitStrategy.LikeNumber),
+		CollectNumber:   conv.MustString(RecruitStrategy.CollectNumber),
+		CommentNumber:   conv.MustString(RecruitStrategy.CommentNumber),
+		FinishNumber:    conv.MustString(RecruitStrategy.FinishNumber),
+		TotalOffer:      conv.MustString(RecruitStrategy.TotalOffer),
+	}
+}

+ 3 - 2
pack/project_draft_condition.go

@@ -1,16 +1,17 @@
 package pack
 
 import (
-	"github.com/issue9/conv"
 	"youngee_b_api/model/common_model"
 	"youngee_b_api/model/http_model"
+
+	"github.com/issue9/conv"
 )
 
 func HttpProjectDraftRequestToCondition(req *http_model.ProjectDraftListRequest) *common_model.ProjectCondition {
 	projectUpdated := conv.MustString(req.ProjectUpdated)
 	projectName := req.ProjectName
 	return &common_model.ProjectCondition{
-		ProjectId:          conv.MustInt64(req.ProjectId, 0),
+		ProjectId:          req.ProjectId,
 		ProjectName:        projectName,
 		ProjectStatus:      conv.MustInt64(req.ProjectStatus, 0),
 		ProjectPlatform:    conv.MustInt64(req.ProjectPlatform, 0),

+ 2 - 0
pack/task_data_list.go

@@ -30,6 +30,7 @@ func MGormTaskDataInfoToHttpTaskDataPreview(TaskDataInfo *http_model.TaskDataInf
 		LikeNumber:        TaskDataInfo.LikeNumber,
 		CommentNumber:     TaskDataInfo.CommentNumber,
 		CollectNumber:     TaskDataInfo.CollectNumber,
+		LinkUrl:           TaskDataInfo.LinkUrl,
 		PhotoUrl:          TaskDataInfo.PhotoUrl,
 		AllPayment:        TaskDataInfo.AllPayment,
 		RealPayment:       TaskDataInfo.RealPayment,
@@ -60,6 +61,7 @@ func GetDataInfoStruct(TaskData *http_model.TaskData) *http_model.TaskDataInfo {
 		LikeNumber:       TaskData.Data.LikeNumber,
 		CommentNumber:    TaskData.Data.CommentNumber,
 		CollectNumber:    TaskData.Data.CollectNumber,
+		LinkUrl:          TaskData.Link.LinkUrl,
 		PhotoUrl:         TaskData.Data.PhotoUrl,
 		AllPayment:       TaskData.Talent.AllPayment,
 		RealPayment:      TaskData.Talent.RealPayment,

+ 4 - 4
pack/task_data_list_conditions.go

@@ -11,10 +11,10 @@ import (
 func HttpTaskDataListRequestToCondition(req *http_model.TaskDataListRequest) *common_model.TalentConditions {
 	fmt.Printf("初稿转换 %+v", req)
 	return &common_model.TalentConditions{
-		ProjectId:        conv.MustInt64(req.ProjectId),
-		DataStatus:       conv.MustInt64(req.DataStatus),
-		StrategyIds:      conv.MustString(req.StrategyIds),
-		TaskId:           conv.MustString(req.TaskId),
+		ProjectId:   conv.MustInt64(req.ProjectId),
+		DataStatus:  conv.MustInt64(req.DataStatus),
+		StrategyIds: conv.MustString(req.StrategyIds),
+		// TaskId:           conv.MustString(req.TaskId),
 		PlatformNickname: conv.MustString(req.PlatformNickname),
 	}
 }

+ 16 - 16
pack/task_default_list_conditions.go

@@ -9,40 +9,40 @@ import (
 
 func HttpTaskDefaultReviewListRequestToCondition(req *http_model.TaskDefaultReviewListRequest) *common_model.TalentConditions {
 	return &common_model.TalentConditions{
-		ProjectId:        conv.MustInt64(req.ProjectId),
-		DefaultStatus:    conv.MustInt64(req.DefaultStatus),
-		StrategyIds:      conv.MustString(req.StrategyIds),
-		TaskId:           conv.MustString(req.TaskId),
+		ProjectId:     conv.MustInt64(req.ProjectId),
+		DefaultStatus: conv.MustInt64(req.DefaultStatus),
+		StrategyIds:   conv.MustString(req.StrategyIds),
+		// TaskId:           conv.MustString(req.TaskId),
 		PlatformNickname: conv.MustString(req.PlatformNickname),
 	}
 }
 
 func HttpTaskDefaultDataListRequestToCondition(req *http_model.TaskDefaultDataListRequest) *common_model.TalentConditions {
 	return &common_model.TalentConditions{
-		ProjectId:        conv.MustInt64(req.ProjectId),
-		DefaultStatus:    conv.MustInt64(req.DefaultStatus),
-		StrategyIds:      conv.MustString(req.StrategyIds),
-		TaskId:           conv.MustString(req.TaskId),
+		ProjectId:     conv.MustInt64(req.ProjectId),
+		DefaultStatus: conv.MustInt64(req.DefaultStatus),
+		StrategyIds:   conv.MustString(req.StrategyIds),
+		// TaskId:           conv.MustString(req.TaskId),
 		PlatformNickname: conv.MustString(req.PlatformNickname),
 	}
 }
 
 func HttpTaskTerminatingListRequestToCondition(req *http_model.TaskTerminatingListRequest) *common_model.TalentConditions {
 	return &common_model.TalentConditions{
-		ProjectId:        conv.MustInt64(req.ProjectId),
-		DefaultStatus:    conv.MustInt64(req.DefaultStatus),
-		StrategyIds:      conv.MustString(req.StrategyIds),
-		TaskId:           conv.MustString(req.TaskId),
+		ProjectId:     conv.MustInt64(req.ProjectId),
+		DefaultStatus: conv.MustInt64(req.DefaultStatus),
+		StrategyIds:   conv.MustString(req.StrategyIds),
+		// TaskId:           conv.MustString(req.TaskId),
 		PlatformNickname: conv.MustString(req.PlatformNickname),
 	}
 }
 
 func HttpTaskTerminatedListRequestToCondition(req *http_model.TaskTerminatedListRequest) *common_model.TalentConditions {
 	return &common_model.TalentConditions{
-		ProjectId:        conv.MustInt64(req.ProjectId),
-		DefaultStatus:    conv.MustInt64(req.DefaultStatus),
-		StrategyIds:      conv.MustString(req.StrategyIds),
-		TaskId:           conv.MustString(req.TaskId),
+		ProjectId:     conv.MustInt64(req.ProjectId),
+		DefaultStatus: conv.MustInt64(req.DefaultStatus),
+		StrategyIds:   conv.MustString(req.StrategyIds),
+		// TaskId:           conv.MustString(req.TaskId),
 		PlatformNickname: conv.MustString(req.PlatformNickname),
 	}
 }

+ 2 - 0
pack/task_finish_list.go

@@ -31,6 +31,7 @@ func MGormTaskFinishInfoToHttpTaskFinishPreview(TaskFinishInfo *http_model.TaskF
 		RealPayment:       TaskFinishInfo.RealPayment,
 		PhotoUrl:          TaskFinishInfo.PhotoUrl,
 		LinkUrl:           TaskFinishInfo.LinkUrl,
+		SubmitAt:          conv.MustString(TaskFinishInfo.SubmitAt)[0:19],
 	}
 }
 
@@ -57,5 +58,6 @@ func GetFinishInfoStruct(TaskFinish *http_model.TaskFinish) *http_model.TaskFini
 		RealPayment:      TaskFinish.Talent.RealPayment,
 		PhotoUrl:         TaskFinish.Data.PhotoUrl,
 		LinkUrl:          TaskFinish.Link.LinkUrl,
+		SubmitAt:         TaskFinish.Data.SubmitAt,
 	}
 }

+ 3 - 3
pack/task_finish_list_conditions.go

@@ -11,9 +11,9 @@ import (
 func HttpTaskFinishListRequestToCondition(req *http_model.TaskFinishListRequest) *common_model.TalentConditions {
 	fmt.Printf("初稿转换 %+v", req)
 	return &common_model.TalentConditions{
-		ProjectId:        conv.MustInt64(req.ProjectId),
-		StrategyIds:      conv.MustString(req.StrategyIds),
-		TaskId:           conv.MustString(req.TaskId),
+		ProjectId:   conv.MustInt64(req.ProjectId),
+		StrategyIds: conv.MustString(req.StrategyIds),
+		// TaskId:           conv.MustString(req.TaskId),
 		PlatformNickname: conv.MustString(req.PlatformNickname),
 	}
 }

+ 4 - 4
pack/task_link_list_conditions.go

@@ -11,10 +11,10 @@ import (
 func HttpTaskLinkListRequestToCondition(req *http_model.TaskLinkListRequest) *common_model.TalentConditions {
 	fmt.Printf("链接转换 %+v", req)
 	return &common_model.TalentConditions{
-		ProjectId:        conv.MustInt64(req.ProjectId),
-		LinkStatus:       conv.MustInt64(req.LinkStatus),
-		StrategyIds:      conv.MustString(req.StrategyIds),
-		TaskId:           conv.MustString(req.TaskId),
+		ProjectId:   conv.MustInt64(req.ProjectId),
+		LinkStatus:  conv.MustInt64(req.LinkStatus),
+		StrategyIds: conv.MustString(req.StrategyIds),
+		// TaskId:           conv.MustString(req.TaskId),
 		PlatformNickname: conv.MustString(req.PlatformNickname),
 	}
 }

+ 4 - 4
pack/task_logistics_list_conditions.go

@@ -9,10 +9,10 @@ import (
 
 func HttpTaskLogisticsListRequestToCondition(req *http_model.TaskLogisticsListRequest) *common_model.TalentConditions {
 	return &common_model.TalentConditions{
-		ProjectId:        conv.MustInt64(req.ProjectId),
-		LogisticsStatus:  conv.MustInt64(req.LogisticsStatus),
-		StrategyIds:      conv.MustString(req.StrategyId),
-		TaskId:           conv.MustString(req.TaskId),
+		ProjectId:       conv.MustInt64(req.ProjectId),
+		LogisticsStatus: conv.MustInt64(req.LogisticsStatus),
+		StrategyIds:     conv.MustString(req.StrategyId),
+		// TaskId:           conv.MustString(req.TaskId),
 		PlatformNickname: conv.MustString(req.PlatformNickname),
 	}
 }

+ 4 - 4
pack/task_script_list_conditions.go

@@ -11,10 +11,10 @@ import (
 func HttpTaskScriptListRequestToCondition(req *http_model.TaskScriptListRequest) *common_model.TalentConditions {
 	fmt.Printf("%+v", req)
 	return &common_model.TalentConditions{
-		ProjectId:        conv.MustInt64(req.ProjectId),
-		ScriptStatus:     conv.MustInt64(req.ScriptStatus),
-		StrategyIds:      conv.MustString(req.StrategyIds),
-		TaskId:           conv.MustString(req.TaskId),
+		ProjectId:    conv.MustInt64(req.ProjectId),
+		ScriptStatus: conv.MustInt64(req.ScriptStatus),
+		StrategyIds:  conv.MustString(req.StrategyIds),
+		// TaskId:           conv.MustString(req.TaskId),
 		PlatformNickname: conv.MustString(req.PlatformNickname),
 	}
 }

+ 4 - 4
pack/task_sketch_list_conditions.go

@@ -11,10 +11,10 @@ import (
 func HttpTaskSketchListRequestToCondition(req *http_model.TaskSketchListRequest) *common_model.TalentConditions {
 	fmt.Printf("初稿转换 %+v", req)
 	return &common_model.TalentConditions{
-		ProjectId:        conv.MustInt64(req.ProjectId),
-		SketchStatus:     conv.MustInt64(req.SketchStatus),
-		StrategyIds:      conv.MustString(req.StrategyIds),
-		TaskId:           conv.MustString(req.TaskId),
+		ProjectId:    conv.MustInt64(req.ProjectId),
+		SketchStatus: conv.MustInt64(req.SketchStatus),
+		StrategyIds:  conv.MustString(req.StrategyIds),
+		// TaskId:           conv.MustString(req.TaskId),
 		PlatformNickname: conv.MustString(req.PlatformNickname),
 	}
 }

+ 5 - 2
route/init.go

@@ -50,9 +50,10 @@ func InitRoute(r *gin.Engine) {
 		m.POST("/project/update", handler.WrapUpdateProjectHandler)
 		m.POST("/project/delete", handler.WrapDeleteProjectHandler)
 		m.POST("/product/create", handler.WrapCreateProductHandler)
-		m.POST("/product/list", handler.WrapFullProjectListHandler)
+		m.POST("/project/list", handler.WrapFullProjectListHandler)
 		m.POST("/project/taskList", handler.WrapProjectTaskListHandler)
-		m.POST("/project/draftlist", handler.WrapProjectDraftBoxListHandler) //草稿箱查询
+		m.POST("/project/draftlist", handler.WrapProjectDraftBoxListHandler)      // 草稿箱查询
+		m.GET("/project/getCreatingNumber", handler.WrapGetCreatingNumberHandler) // 查询创建中项目数量
 		m.POST("/project/changeTaskStatus", handler.WrapProjectChangeTaskStatusHandler)
 		m.POST("/pay/paysum", handler.WrapPaySumHandler)
 		m.POST("/pay/projectpay", handler.WrapProjectPayHandler)
@@ -87,6 +88,7 @@ func InitRoute(r *gin.Engine) {
 		m.POST("/invoice/operateReceiveAddress", handler.WrapOperateReceiveAddressHandler) // 修改或删除发票信息
 		m.POST("/invoice/addInvoiceRecord", handler.WrapAddInvoiceRecordHandler)           // 修改或删除发票信息
 		m.POST("/project/getlinknumberinfo", handler.WrapGetLinkNumberInfoHandler)         //获取链接信息
+		m.POST("/project/getlogisticsnumberinfo", handler.WrapGetLogisticsNumberInfoHandler)
 		m.POST("/project/getdatanumberinfo", handler.WrapGetDataNumberInfoHandler)
 		m.POST("/project/getreviewnumberinfo", handler.WrapGetReviewNumberInfoHandler)
 		m.POST("/project/getdefaultnumberinfo", handler.WrapGetDefaultNumberInfoHandler)
@@ -98,5 +100,6 @@ func InitRoute(r *gin.Engine) {
 		m.POST("/project/getsketchinfo", handler.WrapGetSketchInfoHandler)                 // 获取初稿
 		m.POST("/project/taskfinishlist", handler.WrapTaskFinishListHandler)               // 查询违约列表-数据违约
 		m.POST("/project/getfinishnumberinfo", handler.WrapGetFinishNumberInfoHandler)
+		m.POST("/project/getfinishdata", handler.WrapGetFinishDataHandler)
 	}
 }

+ 26 - 2
service/data.go

@@ -35,7 +35,7 @@ func (*data) DataOpinion(ctx context.Context, request http_model.DataOpinionRequ
 	return res, nil
 }
 
-// AcceptData
+// 任务结案service
 func (*data) AcceptData(ctx context.Context, request http_model.AcceptDataRequest) (*http_model.AcceptDataData, error) {
 	var TaskIDList []int
 	TaskIDs := strings.Split(request.TaskIds, ",")
@@ -43,13 +43,37 @@ func (*data) AcceptData(ctx context.Context, request http_model.AcceptDataReques
 		TaskIDList = append(TaskIDList, conv.MustInt(taskId))
 	}
 
+	// 1. 更新YounggeeDataInfo表,通过数据
 	fmt.Printf("acc request %+v", TaskIDList)
 	err := db.AcceptData(ctx, TaskIDList)
 	if err != nil {
-		logrus.WithContext(ctx).Errorf("[Data service] call CreateData error,err:%+v", err)
+		logrus.WithContext(ctx).Errorf("[Data service] call AcceptData error,err:%+v", err)
+		return nil, err
+	}
+
+	// 2. 更新YoungeeTaskInfo表,将任务结案
+	fmt.Printf("acc request %+v", TaskIDList)
+	err = db.SetTaskFinish(ctx, TaskIDList)
+	if err != nil {
+		logrus.WithContext(ctx).Errorf("[Data service] call SetTaskFinish error,err:%+v", err)
 		return nil, err
 	}
 
+	// 3. 判断是否全部任务已结案,若已全部结案则触发项目结案
+	// 查询task_stage<15的任务数量
+	unFinishedTaskNumber, err1 := db.GetUnfinishedTaskNumber(ctx, request.ProjectId)
+	if err1 != nil {
+		logrus.WithContext(ctx).Errorf("[Data service] call GetUnfinishedTaskNumber error,err:%+v", err)
+		return nil, err
+	}
+	if *unFinishedTaskNumber == 0 { // 若为0则触发项目结案
+		err := db.SetProjectFinish(ctx, request.ProjectId)
+		if err1 != nil {
+			logrus.WithContext(ctx).Errorf("[Data service] call SetProjectFinish error,err:%+v", err)
+			return nil, err
+		}
+	}
+
 	res := &http_model.AcceptDataData{
 		TaskIds: TaskIDList,
 	}

+ 30 - 0
service/finish.go

@@ -0,0 +1,30 @@
+package service
+
+import (
+	"context"
+	"youngee_b_api/db"
+	"youngee_b_api/model/http_model"
+	"youngee_b_api/pack"
+
+	"github.com/issue9/conv"
+
+	"github.com/sirupsen/logrus"
+)
+
+var Finish *finish
+
+type finish struct {
+}
+
+// FinishOpinion 在上传脚本表上提交修改意见
+func (*finish) GetFinishData(ctx context.Context, request http_model.GetFinishDataRequest) (*http_model.GetFinishData, error) {
+	finishRecruitStrategyList, err := db.GetFinishData(ctx, conv.MustInt64(request.ProjectId))
+	if err != nil {
+		logrus.WithContext(ctx).Errorf("[Finish service] call CreateFinish error,err:%+v", err)
+		return nil, err
+	}
+
+	res := new(http_model.GetFinishData)
+	res.FinishRecruitStrategy = pack.MGormRecruitStrategyListToHttpGetFinishDataInfoList(finishRecruitStrategyList)
+	return res, nil
+}

+ 15 - 0
service/number_info.go

@@ -90,3 +90,18 @@ func (*number) GetFinishNumberInfo(ctx context.Context, request http_model.GetFi
 
 	return NumberData, nil
 }
+
+func (*number) GetLogisticsNumberInfo(ctx context.Context, request http_model.GetLogisticsNumberInfoRequest) (*http_model.GetLogisticsNumberInfoData, error) {
+	var StrategyIdList []int64
+	StrategyIds := strings.Split(request.StrategyIds, ",")
+	for _, strategyId := range StrategyIds {
+		StrategyIdList = append(StrategyIdList, conv.MustInt64(strategyId))
+	}
+	NumberData, err := db.GetLogisticsNumberInfo(ctx, request.ProjectId, StrategyIdList)
+	if err != nil {
+		logrus.WithContext(ctx).Errorf("[Data service] call CreateData error,err:%+v", err)
+		return nil, err
+	}
+
+	return NumberData, nil
+}

+ 11 - 7
service/project.go

@@ -10,6 +10,7 @@ import (
 	"youngee_b_api/model/gorm_model"
 	"youngee_b_api/model/http_model"
 	"youngee_b_api/pack"
+	"youngee_b_api/util"
 
 	"github.com/gin-gonic/gin"
 
@@ -55,7 +56,7 @@ func (*project) Create(ctx context.Context, newProject http_model.CreateProjectR
 		TalentType:      newProject.TalentType,
 		ProjectPlatform: newProject.ProjectPlatform,
 		ProjectForm:     newProject.ProjectForm,
-		RecruitDdl:      newProject.RecruitDdl,
+		RecruitDdl:      &newProject.RecruitDdl,
 		ProjectDetail:   newProject.ProjectDetail,
 		ContentType:     newProject.ContentType,
 		EnterpriseID:    enterpriseID,
@@ -114,13 +115,13 @@ func (*project) Update(ctx context.Context, newProject http_model.UpdateProjectR
 	fmt.Println("newproject:", newProject)
 	project := gorm_model.ProjectInfo{
 		ProjectID:     conv.MustInt64(newProject.ProjectID),
-		RecruitDdl:    newProject.RecruitDdl,
+		RecruitDdl:    &newProject.RecruitDdl,
 		TalentType:    newProject.TalentType,
 		ContentType:   conv.MustInt64(newProject.ContentType),
 		ProjectDetail: newProject.ProjectDetail,
 		ProjectForm:   conv.MustInt64(newProject.ProjectForm),
 		EnterpriseID:  enterpriseID,
-		ProjectStatus: 2,
+		ProjectStatus: conv.MustInt64(newProject.ProjectStatus),
 	}
 	projectID, err := db.UpdateProject(ctx, project)
 	if err != nil {
@@ -268,16 +269,19 @@ func (*project) GetPorjectDetail(ctx context.Context, projectID int64) (*http_mo
 		ProjectPlatform: conv.MustString(project.ProjectPlatform),
 		ProjectForm:     conv.MustString(project.ProjectForm),
 		TalentType:      conv.MustString(project.TalentType),
-		RecruitDdl:      project.RecruitDdl,
+		RecruitDdl:      util.GetTimePoionter(project.RecruitDdl),
 		ContentType:     conv.MustString(project.ContentType),
 		ProjectDetail:   conv.MustString(project.ProjectDetail),
 		ProductID:       conv.MustString(project.ProductID),
 		EnterpriseID:    conv.MustString(project.EnterpriseID),
 		Balance:         conv.MustString(enterprise.Balance),
 		FailReason:      conv.MustString(project.FailReason),
-		CreateAt:        project.CreatedAt,
-		UpdateAt:        project.UpdatedAt,
+		CreateAt:        util.GetTimePoionter(project.CreatedAt),
+		UpdateAt:        util.GetTimePoionter(project.UpdatedAt),
 		Phone:           user.Phone,
+		FinishAt:        util.GetTimePoionter(project.FinishAt),
+		PassAt:          util.GetTimePoionter(project.PassAt),
+		PayAt:           util.GetTimePoionter(project.PayAt),
 	}
 	Strategys, err := db.GetRecruitStrategys(ctx, projectID)
 	fmt.Println("招募策略:", Strategys)
@@ -400,7 +404,7 @@ func (p *project) GetTaskDataList(ctx *gin.Context, projectID string, pageSize,
 }
 
 func (p *project) GetTaskFinishList(ctx *gin.Context, projectID string, pageSize, pageNum int64, conditions *common_model.TalentConditions) (*http_model.TaskFinishListData, error) {
-	TaskFinishs, total, err := db.GetTaskFinishList(ctx, projectID, pageSize, pageNum, conditions)
+	TaskFinishs, total, err := db.GetTaskFinishList(ctx, pageSize, pageNum, conditions)
 	if err != nil {
 		logrus.WithContext(ctx).Errorf("[project service] call GetTaskFinishList error,err:%+v", err)
 		return nil, err

+ 8 - 0
util/type.go

@@ -48,6 +48,14 @@ func GetNumString(num int64) string {
 	}
 }
 
+func GetTimePoionter(t *time.Time) time.Time {
+	if t == nil {
+		return time.Now()
+	} else {
+		return *t
+	}
+}
+
 func GetRandomString(l int) string {
 	str := "0123456789"
 	bytes := []byte(str)