|
@@ -44,9 +44,15 @@ func (*sLocalLife) CreateSLocalLife(ctx context.Context, request *http_model.Loc
|
|
|
sLocalLifeInfo.SLocalStatus = 2
|
|
|
|
|
|
// 1.2. 填入加入商单操作人信息
|
|
|
+ var operatorType int
|
|
|
+ if request.SubAccountId == 0 {
|
|
|
+ operatorType = 1
|
|
|
+ } else {
|
|
|
+ operatorType = 2
|
|
|
+ }
|
|
|
sLocalLifeInfo.SubAccountId = request.SubAccountId
|
|
|
sLocalLifeInfo.SupplierId = request.SupplierId
|
|
|
- sLocalLifeInfo.OperatorType = request.OperatorType
|
|
|
+ sLocalLifeInfo.OperatorType = operatorType
|
|
|
currTime := time.Now()
|
|
|
sLocalLifeInfo.CreateTime = &currTime
|
|
|
|
|
@@ -57,7 +63,7 @@ func (*sLocalLife) CreateSLocalLife(ctx context.Context, request *http_model.Loc
|
|
|
}
|
|
|
|
|
|
// 2. 建立新的recruitStrategy
|
|
|
- // 2.1. 根据projectId去查找原来的recruitStrategy
|
|
|
+ // 2.1. 根据localId去查找原来的recruitStrategy
|
|
|
recruitStrategys, strategyErr := db.GetRecruitStrategyByProjectId(ctx, request.LocalId)
|
|
|
if strategyErr != nil {
|
|
|
return strategyErr
|
|
@@ -272,13 +278,13 @@ func (*sLocalLife) GetFullSLocalLifeList(ctx context.Context, pageSize, pageNum
|
|
|
}
|
|
|
|
|
|
// GetLocalTaskList 查询本地生活子任务
|
|
|
-func (*sLocalLife) GetLocalTaskList(ctx context.Context, pageSize, pageNum int32, condition *common_model.LocalTaskConditions) (*http_model.LocalTaskListData, error) {
|
|
|
+func (*sLocalLife) GetLocalTaskList(ctx context.Context, pageSize, pageNum int32, orderBy []string, orderDesc []int, condition *common_model.LocalTaskConditions) (*http_model.LocalTaskListData, error) {
|
|
|
|
|
|
var localTaskListData *http_model.LocalTaskListData
|
|
|
localTaskListData = &http_model.LocalTaskListData{}
|
|
|
|
|
|
// 1. 根据condition查询子任务信息
|
|
|
- localTaskList, total, localTaskErr := db.GetLocalTaskList(ctx, pageSize, pageNum, condition)
|
|
|
+ localTaskList, total, localTaskErr := db.GetLocalTaskList(ctx, pageSize, pageNum, orderBy, orderDesc, condition)
|
|
|
if localTaskErr != nil {
|
|
|
return nil, localTaskErr
|
|
|
}
|
|
@@ -331,6 +337,10 @@ func (*sLocalLife) GetLocalTaskList(ctx context.Context, pageSize, pageNum int32
|
|
|
localTaskListData.SettleNum = sLocalInfo.SettleNum
|
|
|
localTaskListData.RecruitNum = sLocalInfo.RecruitNum
|
|
|
localTaskListData.ServiceChargeActual = sLocalInfo.ServiceChargeActual
|
|
|
+ localTaskListData.ServiceChargeSettle = sLocalInfo.ServiceChargeSettle
|
|
|
+ localTaskListData.EstimateServiceCharge = sLocalInfo.ServiceChargeActual
|
|
|
+ localTaskListData.EstimateDraftFee = sLocalInfo.EstimateDraftFee
|
|
|
+ localTaskListData.EstimateSupportFee = sLocalInfo.EstimateSupportFee
|
|
|
}
|
|
|
}
|
|
|
return localTaskListData, nil
|
|
@@ -338,7 +348,8 @@ func (*sLocalLife) GetLocalTaskList(ctx context.Context, pageSize, pageNum int32
|
|
|
|
|
|
// ChangeTaskSupplierStatus 本地生活达人报名通过、拒绝报名
|
|
|
func (*sLocalLife) ChangeTaskSupplierStatus(ctx context.Context, req *http_model.LocalChangeSupplierStatusRequest) error {
|
|
|
- RecruitStrategyIDs, err := db.ChangeLocalTaskStatus(ctx, req.TaskIds, req.SupplierStatus)
|
|
|
+ // 1. 同意/拒绝
|
|
|
+ RecruitStrategyIDs, err := db.ChangeLocalTaskStatus(ctx, req.TaskIds, req.SupplierStatus, req.SupplierId, req.SubAccountId)
|
|
|
if err != nil {
|
|
|
logrus.WithContext(ctx).Errorf("[project service] call ChangeTaskStatus error,err:%+v", err)
|
|
|
return err
|
|
@@ -351,10 +362,16 @@ func (*sLocalLife) ChangeTaskSupplierStatus(ctx context.Context, req *http_model
|
|
|
func (*sLocalLife) ChangeSupplierStatus(ctx context.Context, req *http_model.SpecialLocalAddToListRequest) error {
|
|
|
var sLocalInfo *gorm_model.YounggeeSLocalLifeInfo
|
|
|
sLocalInfo = &gorm_model.YounggeeSLocalLifeInfo{}
|
|
|
+ var operatorType int
|
|
|
+ if req.SubAccountId == 0 {
|
|
|
+ operatorType = 1
|
|
|
+ } else {
|
|
|
+ operatorType = 2
|
|
|
+ }
|
|
|
sLocalInfo.SLocalId = req.SLocalId
|
|
|
sLocalInfo.SupplierId = req.SupplierId
|
|
|
sLocalInfo.SubAccountId = req.SubAccountId
|
|
|
- sLocalInfo.OperatorType = req.OperatorType
|
|
|
+ sLocalInfo.OperatorType = operatorType
|
|
|
sLocalInfo.SLocalStatus = req.SLocalStatus
|
|
|
err := db.UpdateSLocal(ctx, sLocalInfo)
|
|
|
if err != nil {
|
|
@@ -383,10 +400,16 @@ func (*sLocalLife) CreateSpecialStrategy(ctx context.Context, request *http_mode
|
|
|
// 2. 修改sProject中的字段
|
|
|
var sLocalInfo *gorm_model.YounggeeSLocalLifeInfo
|
|
|
sLocalInfo = &gorm_model.YounggeeSLocalLifeInfo{}
|
|
|
+ if request.SubAccountId == 0 {
|
|
|
+ sLocalInfo.CreateStrategyType = 1
|
|
|
+ sLocalInfo.CreateStrategyId = request.SupplierId
|
|
|
+ } else {
|
|
|
+ sLocalInfo.CreateStrategyType = 2
|
|
|
+ sLocalInfo.CreateStrategyId = request.SubAccountId
|
|
|
+ }
|
|
|
sLocalInfo.SLocalId = request.SLocalId
|
|
|
sLocalInfo.StrategyStatus = 1
|
|
|
- sLocalInfo.CreateStrategyId = request.CreateStrategyId
|
|
|
- sLocalInfo.CreateStrategyType = request.CreateStrategyType
|
|
|
+
|
|
|
updateErr := db.UpdateSLocal(ctx, sLocalInfo)
|
|
|
if updateErr != nil {
|
|
|
return updateErr
|
|
@@ -504,3 +527,59 @@ func (*sLocalLife) FullSLocalTaskBillList(ctx context.Context, request *http_mod
|
|
|
}
|
|
|
return currSLocalTaskBillData, nil
|
|
|
}
|
|
|
+
|
|
|
+// CountLocalTask 按照状态统计子任务数量
|
|
|
+func (*sLocalLife) CountLocalTask(ctx context.Context, req *http_model.LocalTaskCountRequest) (*http_model.LocalTaskCountData, error) {
|
|
|
+ var counter *http_model.LocalTaskCountData
|
|
|
+ counter = &http_model.LocalTaskCountData{}
|
|
|
+
|
|
|
+ // 1. Stage1
|
|
|
+ stage1, stage1Err := db.CountLocalTaskNumByTaskStage(ctx, 0, 1, req.SLocalId)
|
|
|
+ if stage1Err != nil {
|
|
|
+ return nil, stage1Err
|
|
|
+ }
|
|
|
+ counter.Stage1 = stage1
|
|
|
+
|
|
|
+ // 2. Stage2
|
|
|
+ stage2, stage2Err := db.CountLocalTaskNumByTaskStage(ctx, 0, 2, req.SLocalId)
|
|
|
+ if stage2Err != nil {
|
|
|
+ return nil, stage2Err
|
|
|
+ }
|
|
|
+ counter.Stage2 = stage2
|
|
|
+
|
|
|
+ // 3. Stage3
|
|
|
+ stage3, stage3Err := db.CountLocalTaskNumByTaskStage(ctx, 0, 3, req.SLocalId)
|
|
|
+ if stage3Err != nil {
|
|
|
+ return nil, stage3Err
|
|
|
+ }
|
|
|
+ counter.Stage3 = stage3
|
|
|
+
|
|
|
+ // 4. Stage4
|
|
|
+ stage4, stage4Err := db.CountLocalTaskNumByTaskStage(ctx, 1, 2, req.SLocalId)
|
|
|
+ if stage4Err != nil {
|
|
|
+ return nil, stage4Err
|
|
|
+ }
|
|
|
+ counter.Stage4 = stage4
|
|
|
+
|
|
|
+ // 5. Stage5
|
|
|
+ stage5, stage5Err := db.CountLocalTaskNumByTaskStage(ctx, 2, 2, req.SLocalId)
|
|
|
+ if stage5Err != nil {
|
|
|
+ return nil, stage5Err
|
|
|
+ }
|
|
|
+ counter.Stage5 = stage5
|
|
|
+
|
|
|
+ // 6. Stage6
|
|
|
+ stage6, stage6Err := db.CountLocalTaskNumByTaskStage(ctx, 3, 2, req.SLocalId)
|
|
|
+ if stage6Err != nil {
|
|
|
+ return nil, stage6Err
|
|
|
+ }
|
|
|
+ counter.Stage6 = stage6
|
|
|
+
|
|
|
+ // 7. Stage7
|
|
|
+ stage7, stage7Err := db.CountLocalTaskNumByTaskStage(ctx, 0, 0, req.SLocalId)
|
|
|
+ if stage7Err != nil {
|
|
|
+ return nil, stage7Err
|
|
|
+ }
|
|
|
+ counter.Stage7 = stage7
|
|
|
+ return counter, nil
|
|
|
+}
|