Prechádzať zdrojové kódy

探店优化&账单查询优化

Ethan 4 mesiacov pred
rodič
commit
8a3ecbe6e3

+ 39 - 3
app/controller/bill_controller.go

@@ -11,16 +11,16 @@ type BillController struct{}
 
 // 电商带货账单列表
 func (f BillController) SelectionBillList(c *gin.Context) {
-	param := &vo.BalanceParam{}
+	param := &vo.SelectionSearchParam{}
 	err := c.BindJSON(param)
 	if err != nil {
 		logrus.Errorf("Request bind err:%+v\n", err)
 		returnError(c, 40000, "参数错误")
 		return
 	}
-	result, err := service.RechargeService{}.FrozenInfoList(param)
+	result, err := service.BillService{}.GetBillSelectionTaskList(param)
 	if err != nil {
-		logrus.Errorf("[FrozenInfoList] call Show err:%+v\n", err)
+		logrus.Errorf("[SelectionBillList] call Show err:%+v\n", err)
 		returnError(c, 40000, err.Error())
 		return
 	}
@@ -53,6 +53,24 @@ func (f BillController) SelectionPay(c *gin.Context) {
 	returnSuccess(c, 20000, nil)
 }
 
+// 品牌种草账单列表
+func (f BillController) ProjectBillList(c *gin.Context) {
+	param := &vo.ProjectSearchParam{}
+	err := c.BindJSON(param)
+	if err != nil {
+		logrus.Errorf("Request bind err:%+v\n", err)
+		returnError(c, 40000, "参数错误")
+		return
+	}
+	result, err := service.BillService{}.GetBillProjectTaskList(param)
+	if err != nil {
+		logrus.Errorf("[ProjectBillList] call Show err:%+v\n", err)
+		returnError(c, 40000, err.Error())
+		return
+	}
+	returnSuccess(c, 20000, result)
+}
+
 // 品牌种草账单支付
 func (f BillController) ProjectPay(c *gin.Context) {
 	param := &vo.PayParam{}
@@ -79,6 +97,24 @@ func (f BillController) ProjectPay(c *gin.Context) {
 	returnSuccess(c, 20000, nil)
 }
 
+// 本地生活账单列表
+func (f BillController) LocalLifeBillList(c *gin.Context) {
+	param := &vo.LocalSearchParam{}
+	err := c.BindJSON(param)
+	if err != nil {
+		logrus.Errorf("Request bind err:%+v\n", err)
+		returnError(c, 40000, "参数错误")
+		return
+	}
+	result, err := service.BillService{}.GetBillLocalLifeTaskList(param)
+	if err != nil {
+		logrus.Errorf("[LocalLifeBillList] call Show err:%+v\n", err)
+		returnError(c, 40000, err.Error())
+		return
+	}
+	returnSuccess(c, 20000, result)
+}
+
 // 本地生活账单支付
 func (f BillController) LocalLifePay(c *gin.Context) {
 	param := &vo.PayParam{}

+ 37 - 3
app/controller/task_controller.go

@@ -460,7 +460,7 @@ func (t TaskController) GetTargetDefaultTalentList(c *gin.Context) {
 func (t TaskController) CancelTalent(c *gin.Context) {
 	param := &vo.TalentCancelParam{}
 	err := c.BindJSON(param)
-	if err != nil {
+	if err != nil || param.TaskId == "" {
 		logrus.Errorf("Request bind err:%+v\n", err)
 		returnError(c, 40000, "参数错误")
 		return
@@ -480,7 +480,7 @@ func (t TaskController) CancelTalent(c *gin.Context) {
 func (t TaskController) CancelTalentList(c *gin.Context) {
 	param := &vo.TalentCancelParam{}
 	err := c.BindJSON(param)
-	if err != nil {
+	if err != nil || param.TaskIds == nil {
 		logrus.Errorf("Request bind err:%+v\n", err)
 		returnError(c, 40000, "参数错误")
 		return
@@ -794,7 +794,6 @@ func (t TaskController) StoreExploreList(c *gin.Context) {
 		returnError(c, 40000, err.Error())
 		return
 	}
-
 	returnSuccess(c, 20000, res)
 }
 
@@ -813,10 +812,45 @@ func (t TaskController) StoreExploreInfo(c *gin.Context) {
 		returnError(c, 40000, err.Error())
 		return
 	}
+	returnSuccess(c, 20000, res)
+}
 
+// 探店终止合作
+func (t TaskController) StoreExploreOver(c *gin.Context) {
+	param := &vo.LocalTalentOperateParam{}
+	err := c.BindJSON(param)
+	if err != nil || param.TaskId == "" {
+		logrus.Errorf("Request bind err:%+v\n", err)
+		returnError(c, 40000, "参数错误")
+		return
+	}
+	res, err := service.LocalLifeService{}.StoreExploreOver(param)
+	if err != nil {
+		logrus.Errorf("[StoreExploreOver] call Show err:%+v\n", err)
+		returnError(c, 40000, err.Error())
+		return
+	}
 	returnSuccess(c, 20000, res)
 }
 
+// 预约时间批量同意/驳回
+func (t TaskController) StoreExploreOperate(c *gin.Context) {
+	param := &vo.LocalTalentOperateParam{}
+	err := c.BindJSON(param)
+	if err != nil || param.TaskIds == nil {
+		logrus.Errorf("Request bind err:%+v\n", err)
+		returnError(c, 40000, "参数错误")
+		return
+	}
+	err = service.LocalLifeService{}.StoreExploreOperate(param)
+	if err != nil {
+		logrus.Errorf("[StoreExploreOperate] call Show err:%+v\n", err)
+		returnError(c, 40000, err.Error())
+		return
+	}
+	returnSuccess(c, 20000, nil)
+}
+
 // 电商带货看数据-达人数据
 func (t TaskController) TalentDataDetail(c *gin.Context) {
 	param := &vo.SelectionShowDataParam{}

+ 49 - 0
app/dao/book_info_dao.go

@@ -0,0 +1,49 @@
+package dao
+
+import (
+	"gorm.io/gorm"
+	"youngee_b_api/app/entity"
+)
+
+type BookInfoDao struct{}
+
+// 获取指定任务id的最新预约记录
+func (d BookInfoDao) GetLastByTaskId(taskId string) (*entity.BookInfo, error) {
+	var bookInfo entity.BookInfo
+	err := Db.Model(&entity.BookInfo{}).Where("task_id = ?", taskId).Order("create_at DESC").First(&bookInfo).Error
+	if err != nil {
+		if err == gorm.ErrRecordNotFound {
+			return &bookInfo, nil
+		} else {
+			return nil, err
+		}
+	}
+	return &bookInfo, nil
+}
+
+// 更新预约状态
+func (d BookInfoDao) UpdateBookStatus(bookIds []int64, bookInfo entity.BookInfo) error {
+	err := Db.Debug().Model(&entity.BookInfo{}).Where("book_id IN ?", bookIds).Updates(bookInfo).Error
+	if err != nil {
+		return err
+	}
+	return nil
+}
+
+// 更新字段
+func (d BookInfoDao) UpdateField(bookId int64, updateData map[string]interface{}) error {
+	err := Db.Model(&entity.BookInfo{}).Where("book_id = ?", bookId).Updates(updateData).Error
+	if err != nil {
+		return err
+	}
+	return nil
+}
+
+// 批量更新字段
+func (d BookInfoDao) UpdateFieldBatch(bookIds []int64, updateData map[string]interface{}) error {
+	err := Db.Model(&entity.BookInfo{}).Where("book_id IN ?", bookIds).Updates(updateData).Error
+	if err != nil {
+		return err
+	}
+	return nil
+}

+ 56 - 0
app/dao/local_life_dao.go

@@ -259,3 +259,59 @@ func (d LocalLifeDao) GetLocalStoreExplorePreviews(param *vo.LocalSearchParam) (
 
 	return reLocalStoreExplorePreviews, total, nil
 }
+
+// 获取本地生活账单列表
+func (d LocalLifeDao) GetBillLocalPreviews(param *vo.LocalSearchParam) ([]vo.ReBillLocalTaskPreview, int64, error) {
+	var reBillLocalTaskPreviews []vo.ReBillLocalTaskPreview
+	var localLifes []entity.LocalLifeInfo
+	var total int64
+	query := Db.Model(&entity.LocalLifeInfo{})
+	// 动态添加查询条件
+	if param.SubAccountId == 0 {
+		if param.EnterpriseId == "" {
+			return reBillLocalTaskPreviews, 0, errors.New("enterpriseId is empty")
+		}
+		query = query.Where("enterprise_id = ?", param.EnterpriseId)
+	} else {
+		query = query.Where("sub_account_id = ?", param.SubAccountId)
+	}
+	if param.LocalType != 0 {
+		query = query.Where("local_type = ?", param.LocalType)
+	}
+	if param.LocalPlatform != 0 {
+		query = query.Where("local_platform = ?", param.LocalPlatform)
+	}
+	if param.LocalStatus != 0 {
+		query = query.Where("task_status = ?", param.LocalStatus)
+	}
+	if param.LocalId != "" {
+		query = query.Where("local_id = ?", param.LocalId)
+	}
+	if param.LocalName != "" {
+		query = query.Where("local_name LIKE ?", "%"+param.LocalName+"%")
+	}
+	query.Count(&total)
+	query = query.Select("enterprise_id, sub_account_id, local_id, local_platform, task_status, estimated_cost, task_form, content_type, store_id, team_buying_id, settlement_amount")
+	offset := (param.Page - 1) * param.PageSize
+	if err := query.Order("created_at asc").Offset(offset).Limit(param.PageSize).Find(&localLifes).Error; err != nil {
+		return nil, 0, err
+	}
+	for _, localLife := range localLifes {
+		reBillLocalTaskPreview := vo.ReBillLocalTaskPreview{
+			EnterpriseId:  localLife.EnterpriseID,
+			SubAccountId:  localLife.SubAccountID,
+			LocalId:       localLife.LocalID,
+			LocalPlatform: localLife.LocalPlatform,
+			LocalStatus:   localLife.TaskStatus,
+			EstimatedCost: localLife.EstimatedCost,
+			LocalForm:     localLife.TaskForm,
+			ContentType:   localLife.ContentType,
+			StoreId:       localLife.StoreID,
+			TeamBuyingId:  localLife.TeamBuyingId,
+			CashAmount:    localLife.SettlementAmount,
+		}
+		reBillLocalTaskPreviews = append(reBillLocalTaskPreviews, reBillLocalTaskPreview)
+	}
+
+	return reBillLocalTaskPreviews, total, nil
+}

+ 9 - 0
app/dao/local_life_task_info_dao.go

@@ -144,3 +144,12 @@ func (d LocalLifeTaskInfoDao) UpdateFieldBatch(taskIds []string, updateData map[
 	}
 	return nil
 }
+
+// 批量更新字段
+func (d LocalLifeTaskInfoDao) UpdateLocalStatus(taskIds []string, localLifeTaskInfo entity.LocalLifeTaskInfo) error {
+	err := Db.Debug().Model(&entity.LocalLifeTaskInfo{}).Where("task_id IN ?", taskIds).Updates(localLifeTaskInfo).Error
+	if err != nil {
+		return err
+	}
+	return nil
+}

+ 56 - 1
app/dao/project_dao.go

@@ -14,7 +14,7 @@ type ProjectDAO struct{}
 // 根据projectId获取project信息
 func (d ProjectDAO) GetProjectById(projectId string) (*entity.Project, error) {
 	var project entity.Project
-	err := Db.Where("project_id = ?", projectId).First(&project).Error
+	err := Db.Where("project_id = ?", projectId).Find(&project).Error
 	if err != nil {
 		if errors.Is(err, gorm.ErrRecordNotFound) {
 			return nil, nil
@@ -324,3 +324,58 @@ func (d ProjectDAO) GetProjectFrozenCancelList(enterpriseId string) ([]*entity.P
 	}
 	return projects, nil
 }
+
+// 获取品牌种草账单列表
+func (d ProjectDAO) GetBillProjectPreviews(param *vo.ProjectSearchParam) ([]vo.ReBillProjectTaskPreview, int64, error) {
+	var reBillProjectTaskPreviews []vo.ReBillProjectTaskPreview
+	var projects []entity.Project
+	var total int64
+	query := Db.Model(&entity.Project{})
+	// 动态添加查询条件
+	if param.SubAccountId == 0 {
+		if param.EnterpriseId == "" {
+			return reBillProjectTaskPreviews, 0, errors.New("enterpriseId is empty")
+		}
+		query = query.Where("enterprise_id = ?", param.EnterpriseId)
+	} else {
+		query = query.Where("sub_account_id = ?", param.SubAccountId)
+	}
+	if param.ProjectType != 0 {
+		query = query.Where("project_type = ?", param.ProjectType)
+	}
+	if param.ProjectPlatform != 0 {
+		query = query.Where("project_platform = ?", param.ProjectPlatform)
+	}
+	if param.ProjectStatus != 0 {
+		query = query.Where("project_status = ?", param.ProjectStatus)
+	}
+	if param.ProjectId != "" {
+		query = query.Where("project_id = ?", param.ProjectId)
+	}
+	if param.ProjectName != "" {
+		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, product_id, settlement_amount")
+	offset := (param.Page - 1) * param.PageSize
+	if err := query.Order("created_at asc").Offset(offset).Limit(param.PageSize).Find(&projects).Error; err != nil {
+		return nil, 0, err
+	}
+	for _, project := range projects {
+		reBillProjectTaskPreview := vo.ReBillProjectTaskPreview{
+			EnterpriseId:    project.EnterpriseID,
+			SubAccountId:    project.SubAccountId,
+			ProjectId:       project.ProjectId,
+			ProjectPlatform: project.ProjectPlatform,
+			ProjectStatus:   project.ProjectStatus,
+			ProjectForm:     project.ProjectForm,
+			ContentType:     project.ContentType,
+			ProductId:       project.ProductID,
+			EstimatedCost:   project.EstimatedCost,    // 应付金额
+			CashAmount:      project.SettlementAmount, //实际结算金额
+		}
+		reBillProjectTaskPreviews = append(reBillProjectTaskPreviews, reBillProjectTaskPreview)
+	}
+
+	return reBillProjectTaskPreviews, total, nil
+}

+ 51 - 0
app/dao/selection_info_dao.go

@@ -219,3 +219,54 @@ func (d SelectionInfoDAO) GetSelectionFrozenCancelList(enterpriseId string) ([]*
 	}
 	return selectionInfos, nil
 }
+
+// 获取带货账单列表
+func (d SelectionInfoDAO) GetBillSelectionPreviews(param *vo.SelectionSearchParam) ([]vo.ReBillSelectionTaskPreview, int64, error) {
+	var reBillSelectionTaskPreviews []vo.ReBillSelectionTaskPreview
+	var selectionInfos []entity.SelectionInfo
+	var total int64
+	query := Db.Model(&entity.SelectionInfo{})
+	// 动态添加查询条件
+	if param.SubAccountId == 0 {
+		if param.EnterpriseId == "" {
+			return reBillSelectionTaskPreviews, 0, errors.New("enterpriseId is empty")
+		}
+		query = query.Where("enterprise_id = ?", param.EnterpriseId)
+	} else {
+		query = query.Where("sub_account_id = ?", param.SubAccountId)
+	}
+	if param.SelectionPlatform != 0 {
+		query = query.Where("platform = ?", param.SelectionPlatform)
+	}
+	if param.SelectionStatus != 0 {
+		query = query.Where("selection_status = ?", param.SelectionStatus)
+	}
+	if param.SelectionId != "" {
+		query = query.Where("selection_id = ?", param.SelectionId)
+	}
+	if param.SelectionName != "" {
+		query = query.Where("selection_name LIKE ?", "%"+param.SelectionName+"%")
+	}
+	query.Count(&total)
+	query = query.Select("enterprise_id, sub_account_id, selection_id, platform, selection_status, created_at, task_ddl, product_id, settlement_amount")
+	offset := (param.Page - 1) * param.PageSize
+	if err := query.Order("created_at asc").Offset(offset).Limit(param.PageSize).Find(&selectionInfos).Error; err != nil {
+		return nil, 0, err
+	}
+	for _, selectionInfo := range selectionInfos {
+		reBillSelectionTaskPreview := vo.ReBillSelectionTaskPreview{
+			EnterpriseId:      selectionInfo.EnterpriseID,
+			SubAccountId:      selectionInfo.SubAccountId,
+			SelectionId:       selectionInfo.SelectionID,
+			SelectionPlatform: selectionInfo.Platform,
+			SelectionStatus:   selectionInfo.SelectionStatus,
+			CreatedAt:         selectionInfo.CreatedAt.Format("2006-01-02 15:04:05"),
+			TaskDdl:           selectionInfo.TaskDdl.Format("2006-01-02 15:04:05"),
+			ProductId:         selectionInfo.ProductID,
+			CashAmount:        selectionInfo.SettlementAmount,
+		}
+		reBillSelectionTaskPreviews = append(reBillSelectionTaskPreviews, reBillSelectionTaskPreview)
+	}
+
+	return reBillSelectionTaskPreviews, total, nil
+}

+ 32 - 0
app/entity/book_info.go

@@ -0,0 +1,32 @@
+// Code generated by sql2gorm. DO NOT EDIT.
+package entity
+
+import (
+	"time"
+)
+
+// 种草任务初稿信息
+type BookInfo struct {
+	BookID            int64     `gorm:"column:book_id;primary_key;AUTO_INCREMENT"` // 探店id
+	TaskID            string    `gorm:"column:task_id;NOT NULL"`                   // 任务id
+	Day               time.Time `gorm:"column:day"`                                // 预计到店日期
+	Time              time.Time `gorm:"column:time"`                               // 预计到店时间
+	ReviseOpinion     string    `gorm:"column:revise_opinion"`                     // 反馈意见
+	IsSubmit          int64     `gorm:"column:is_submit;NOT NULL"`                 // 是否提交
+	IsReview          int64     `gorm:"column:is_review;default:0;NOT NULL"`       // 是否审核
+	IsOk              int64     `gorm:"column:is_ok;NOT NULL"`                     // 是否合格
+	CreateAt          time.Time `gorm:"column:create_at;NOT NULL"`                 // 创建时间
+	AgreeAt           time.Time `gorm:"column:agree_at"`                           // 同意时间
+	RejectAt          time.Time `gorm:"column:reject_at"`                          // 驳回时间
+	SubmitAt          time.Time `gorm:"column:submit_at"`                          // 提交时间
+	AutoAgreeAt       time.Time `gorm:"column:auto_agree_at"`                      // 初稿自动审核时间
+	AutoLinkBreakAt   time.Time `gorm:"column:auto_link_break_at"`                 // 链接违约自动处理时间
+	AutoSketchBreakAt time.Time `gorm:"column:auto_sketch_break_at"`               // 初稿违约自动处理时间
+	BOperator         string    `gorm:"column:b_operator"`                         // 商家确定达人操作人ID
+
+	BOperatorType int `gorm:"column:b_operator_type;default:0"` // 商家操作人类型,1商家用户,2商家子账号,3管理后台
+}
+
+func (m *BookInfo) TableName() string {
+	return "younggee_book_info"
+}

+ 156 - 3
app/service/bill_service.go

@@ -10,7 +10,7 @@ import (
 type BillService struct{}
 
 // 电商带货账单支付
-func (p BillService) PaySelection(param *vo.PayParam) error {
+func (s BillService) PaySelection(param *vo.PayParam) error {
 	selectionId := param.ObjectId
 	selectionInfo, err1 := dao.SelectionInfoDAO{}.GetSelectionInfoById(selectionId)
 	if err1 != nil {
@@ -33,7 +33,7 @@ func (p BillService) PaySelection(param *vo.PayParam) error {
 }
 
 // 品牌种草账单支付
-func (p BillService) PayProject(param *vo.PayParam) error {
+func (s BillService) PayProject(param *vo.PayParam) error {
 	projectId := param.ObjectId
 	projectInfo, err1 := dao.ProjectDAO{}.GetProjectById(projectId)
 	if err1 != nil {
@@ -56,7 +56,7 @@ func (p BillService) PayProject(param *vo.PayParam) error {
 }
 
 // 本地生活账单支付
-func (p BillService) PayLocalLife(param *vo.PayParam) error {
+func (s BillService) PayLocalLife(param *vo.PayParam) error {
 	localId := param.ObjectId
 	localInfo, err1 := dao.LocalLifeDao{}.GetLocalById(localId)
 	if err1 != nil {
@@ -77,3 +77,156 @@ func (p BillService) PayLocalLife(param *vo.PayParam) error {
 
 	return nil
 }
+
+// 电商带货账单列表
+func (s BillService) GetBillSelectionTaskList(param *vo.SelectionSearchParam) (vo.ResultVO, error) {
+	if param.Page == 0 {
+		param.Page = 1
+	}
+	if param.PageSize == 0 {
+		param.PageSize = 10
+	}
+	var result vo.ResultVO
+	reBillSelectionTaskPreviews, total, err := (&dao.SelectionInfoDAO{}).GetBillSelectionPreviews(param)
+	if err != nil {
+		return result, err
+	}
+	for i := range reBillSelectionTaskPreviews {
+		var creatorName string
+		var productName string
+		var productPrice float64
+		var mainImage string
+		var reward float64
+		if reBillSelectionTaskPreviews[i].SubAccountId == 0 {
+			enterprise, err := dao.EnterpriseDao{}.GetEnterprise(reBillSelectionTaskPreviews[i].EnterpriseId)
+			if err == nil && enterprise != nil {
+				creatorName = enterprise.BusinessName
+			}
+		} else {
+			subAccount, err := dao.SubAccountDao{}.GetSubAccount(reBillSelectionTaskPreviews[i].SubAccountId)
+			if err == nil && subAccount != nil {
+				creatorName = subAccount.SubAccountName
+			}
+		}
+		product, err := dao.ProductDAO{}.GetProductByID(reBillSelectionTaskPreviews[i].ProductId)
+		if err == nil && product != nil {
+			productName = product.ProductName
+			productPrice = product.ProductPrice
+		}
+		mainImage, err = dao.ProductPhotoDAO{}.GetMainPhotoByProductID(reBillSelectionTaskPreviews[i].ProductId)
+		rewardStrategys, err := dao.RewardStrategyDao{}.GetRewardStrategyBySelectionId(reBillSelectionTaskPreviews[i].SelectionId)
+		for _, rewardStrategy := range rewardStrategys {
+			reward += rewardStrategy.Reward
+		}
+		reBillSelectionTaskPreviews[i].CreatorName = creatorName
+		reBillSelectionTaskPreviews[i].ProductName = productName
+		reBillSelectionTaskPreviews[i].ProductPrice = productPrice
+		reBillSelectionTaskPreviews[i].MainImage = mainImage
+		reBillSelectionTaskPreviews[i].Reward = reward
+	}
+	result = vo.ResultVO{
+		Page:     param.Page,
+		PageSize: param.PageSize,
+		Total:    total,
+		Data:     reBillSelectionTaskPreviews,
+	}
+	return result, nil
+}
+
+// 品牌种草账单列表
+func (s BillService) GetBillProjectTaskList(param *vo.ProjectSearchParam) (vo.ResultVO, error) {
+	if param.Page == 0 {
+		param.Page = 1
+	}
+	if param.PageSize == 0 {
+		param.PageSize = 10
+	}
+	var result vo.ResultVO
+	reBillProjectTaskPreviews, total, err := (&dao.ProjectDAO{}).GetBillProjectPreviews(param)
+	if err != nil {
+		return result, err
+	}
+	for i := range reBillProjectTaskPreviews {
+		var creatorName string
+		var productName string
+		var productPrice float64
+		var mainImage string
+		if reBillProjectTaskPreviews[i].SubAccountId == 0 {
+			enterprise, err := dao.EnterpriseDao{}.GetEnterprise(reBillProjectTaskPreviews[i].EnterpriseId)
+			if err == nil && enterprise != nil {
+				creatorName = enterprise.BusinessName
+			}
+		} else {
+			subAccount, err := dao.SubAccountDao{}.GetSubAccount(reBillProjectTaskPreviews[i].SubAccountId)
+			if err == nil && subAccount != nil {
+				creatorName = subAccount.SubAccountName
+			}
+		}
+		product, err := dao.ProductDAO{}.GetProductByID(reBillProjectTaskPreviews[i].ProductId)
+		if err == nil && product != nil {
+			productName = product.ProductName
+			productPrice = product.ProductPrice
+		}
+		mainImage, err = dao.ProductPhotoDAO{}.GetMainPhotoByProductID(reBillProjectTaskPreviews[i].ProductId)
+		reBillProjectTaskPreviews[i].CreatorName = creatorName
+		reBillProjectTaskPreviews[i].ProductName = productName
+		reBillProjectTaskPreviews[i].ProductPrice = productPrice
+		reBillProjectTaskPreviews[i].MainImage = mainImage
+	}
+	result = vo.ResultVO{
+		Page:     param.Page,
+		PageSize: param.PageSize,
+		Total:    total,
+		Data:     reBillProjectTaskPreviews,
+	}
+	return result, nil
+}
+
+// 本地生活账单列表
+func (s BillService) GetBillLocalLifeTaskList(param *vo.LocalSearchParam) (vo.ResultVO, error) {
+	if param.Page == 0 {
+		param.Page = 1
+	}
+	if param.PageSize == 0 {
+		param.PageSize = 10
+	}
+	var result vo.ResultVO
+	reBillLocalTaskPreviews, total, err := (&dao.LocalLifeDao{}).GetBillLocalPreviews(param)
+	if err != nil {
+		return result, err
+	}
+	for i := range reBillLocalTaskPreviews {
+		var creatorName string
+		var storeName string
+		var storeLocation string
+		var mainImage string
+		if reBillLocalTaskPreviews[i].SubAccountId == 0 {
+			enterprise, err := dao.EnterpriseDao{}.GetEnterprise(reBillLocalTaskPreviews[i].EnterpriseId)
+			if err == nil && enterprise != nil {
+				creatorName = enterprise.BusinessName
+			}
+		} else {
+			subAccount, err := dao.SubAccountDao{}.GetSubAccount(reBillLocalTaskPreviews[i].SubAccountId)
+			if err == nil && subAccount != nil {
+				creatorName = subAccount.SubAccountName
+			}
+		}
+		store, err := dao.StoreDao{}.GetStoreByID(reBillLocalTaskPreviews[i].StoreId)
+		if err == nil && store != nil {
+			storeName = store.StoreName
+			storeLocation = store.StoreLocation
+		}
+		mainImage, err = dao.ProductPhotoDAO{}.GetMainPhotoByStoreID(reBillLocalTaskPreviews[i].StoreId)
+		reBillLocalTaskPreviews[i].CreatorName = creatorName
+		reBillLocalTaskPreviews[i].StoreName = storeName
+		reBillLocalTaskPreviews[i].StoreLocation = storeLocation
+		reBillLocalTaskPreviews[i].MainImage = mainImage
+	}
+	result = vo.ResultVO{
+		Page:     param.Page,
+		PageSize: param.PageSize,
+		Total:    total,
+		Data:     reBillLocalTaskPreviews,
+	}
+	return result, nil
+}

+ 22 - 1
app/service/default_service.go

@@ -1,6 +1,7 @@
 package service
 
 import (
+	"errors"
 	"strconv"
 	"time"
 	"youngee_b_api/app/dao"
@@ -57,7 +58,7 @@ func (s DefaultService) GetPublicDefaultList(param *vo.DefaultSearchParam) (vo.R
 		noLinkNum := dao.ProjectTaskInfoDao{}.CountByDefaultType(projectId, 6)
 		noDataNum := dao.ProjectTaskInfoDao{}.CountByDefaultType(projectId, 8)
 		// 终止合作还是解约字段待确认
-		endCooperationNum := dao.ProjectTaskInfoDao{}.CountByTaskStage(projectId, 17)
+		endCooperationNum := dao.ProjectTaskInfoDao{}.CountByTaskStage(projectId, 16)
 		reTaskDefaultPublics[i].NoSketchNum = noSketchNum
 		reTaskDefaultPublics[i].NoLinkNum = noLinkNum
 		reTaskDefaultPublics[i].NoDataNum = noDataNum
@@ -315,6 +316,9 @@ func (s DefaultService) GetTargetDefaultTalentList(param *vo.DefaultSearchParam)
 
 // 违约管理——达人解约
 func (s DefaultService) CancelTalent(param *vo.TalentCancelParam) error {
+	if param.TaskId == "" {
+		return errors.New("taskId is empty")
+	}
 	updateData := map[string]interface{}{
 		"task_stage":    16,
 		"settle_amount": param.RealPayment,
@@ -322,6 +326,13 @@ func (s DefaultService) CancelTalent(param *vo.TalentCancelParam) error {
 		"cancel_reason": param.CancelReason,
 		"cancel_time":   time.Now(),
 	}
+	if param.SubAccountId == 0 {
+		updateData["cancel_operator_type"] = 1
+		updateData["cancel_operator"] = param.EnterpriseId
+	} else {
+		updateData["cancel_operator_type"] = 2
+		updateData["cancel_operator"] = strconv.FormatInt(param.SubAccountId, 10)
+	}
 	err := dao.ProjectTaskInfoDao{}.UpdateField(param.TaskId, updateData)
 	if err != nil {
 		return err
@@ -331,6 +342,9 @@ func (s DefaultService) CancelTalent(param *vo.TalentCancelParam) error {
 
 // 违约管理——达人批量解约
 func (s DefaultService) CancelTalentList(param *vo.TalentCancelParam) error {
+	if param.TaskIds == nil {
+		return errors.New("taskIds is empty")
+	}
 	updateData := map[string]interface{}{
 		"task_stage":    16,
 		"settle_amount": param.RealPayment,
@@ -338,6 +352,13 @@ func (s DefaultService) CancelTalentList(param *vo.TalentCancelParam) error {
 		"cancel_reason": param.CancelReason,
 		"cancel_time":   time.Now(),
 	}
+	if param.SubAccountId == 0 {
+		updateData["cancel_operator_type"] = 1
+		updateData["cancel_operator"] = param.EnterpriseId
+	} else {
+		updateData["cancel_operator_type"] = 2
+		updateData["cancel_operator"] = strconv.FormatInt(param.SubAccountId, 10)
+	}
 	err := dao.ProjectTaskInfoDao{}.UpdateFieldBatch(param.TaskIds, updateData)
 	if err != nil {
 		return err

+ 81 - 0
app/service/local_life_service.go

@@ -4,6 +4,7 @@ import (
 	"errors"
 	"github.com/sirupsen/logrus"
 	"reflect"
+	"strconv"
 	"strings"
 	"time"
 	"youngee_b_api/app/dao"
@@ -885,6 +886,7 @@ func (s LocalLifeService) GetStoreExploreInfo(param *vo.StoreExploreParam) (*vo.
 		}
 		reStoreExploreTalent := &vo.ReStoreExploreTalent{
 			ReTalentPreview: talentPreview,
+			TaskId:          localLifeTaskInfo.TaskID,
 		}
 		if param.Status == 1 {
 			reStoreExploreTalent.CooperateTime = localLifeTaskInfo.SelectDate.Format("2006-01-02 15:04:05")
@@ -907,3 +909,82 @@ func (s LocalLifeService) GetStoreExploreInfo(param *vo.StoreExploreParam) (*vo.
 	}
 	return &result, nil
 }
+
+// 终止合作
+func (s LocalLifeService) StoreExploreOver(param *vo.LocalTalentOperateParam) (*string, error) {
+	taskId := param.TaskId
+	if taskId == "" {
+		return nil, errors.New("taskId is empty")
+	}
+	updateData := map[string]interface{}{
+		"task_stage":       17,
+		"terminate_reason": param.Reason,
+		"terminate_time":   time.Now(),
+	}
+	if param.SubAccountId == 0 {
+		updateData["terminate_operator_type"] = 1
+		updateData["terminate_operator"] = param.EnterpriseId
+	} else {
+		updateData["terminate_operator_type"] = 2
+		updateData["terminate_operator"] = param.SubAccountId
+	}
+	err := dao.LocalLifeTaskInfoDao{}.UpdateField(param.TaskId, updateData)
+	if err != nil {
+		return nil, err
+	}
+	return &taskId, nil
+}
+
+// 预约时间批量同意/驳回
+func (s LocalLifeService) StoreExploreOperate(param *vo.LocalTalentOperateParam) error {
+	taskIds := param.TaskIds
+	if taskIds == nil {
+		return errors.New("taskIds is empty")
+	}
+	var bookIds []int64
+	for _, taskId := range taskIds {
+		bookInfo, err := dao.BookInfoDao{}.GetLastByTaskId(taskId)
+		if err != nil {
+			return err
+		}
+		bookIds = append(bookIds, bookInfo.BookID)
+	}
+	var bookinfoNew entity.BookInfo
+	if param.Status == 2 {
+		bookinfoNew = entity.BookInfo{
+			IsReview:      1,
+			IsOk:          2,
+			RejectAt:      time.Now(),
+			ReviseOpinion: param.Reason,
+		}
+	} else if param.Status == 1 {
+		bookinfoNew = entity.BookInfo{
+			IsReview: 1,
+			IsOk:     1,
+			AgreeAt:  time.Now(),
+		}
+	} else {
+		return errors.New("status error")
+	}
+	if param.SubAccountId == 0 {
+		bookinfoNew.BOperatorType = 1
+		bookinfoNew.BOperator = param.EnterpriseId
+	} else {
+		bookinfoNew.BOperatorType = 2
+		bookinfoNew.BOperator = strconv.FormatInt(param.SubAccountId, 10)
+	}
+	err1 := dao.BookInfoDao{}.UpdateBookStatus(bookIds, bookinfoNew)
+	if err1 != nil {
+		return err1
+	}
+	if param.Status == 1 {
+		err2 := dao.LocalLifeTaskInfoDao{}.UpdateLocalStatus(taskIds, entity.LocalLifeTaskInfo{
+			TaskStage: 7,
+		})
+		if err2 != nil {
+			return err2
+		}
+	}
+
+	return nil
+}

+ 10 - 0
app/vo/local_talent_operate_param.go

@@ -0,0 +1,10 @@
+package vo
+
+type LocalTalentOperateParam struct {
+	TaskId       string   `json:"task_id"`
+	TaskIds      []string `json:"task_ids"`
+	Status       int64    `json:"status"` // 1同意 2拒绝
+	Reason       string   `json:"reason"`
+	EnterpriseId string   `json:"enterprise_id"`
+	SubAccountId int64    `json:"sub_account_id"`
+}

+ 26 - 0
app/vo/re_bill_local_task_preview.go

@@ -0,0 +1,26 @@
+package vo
+
+type ReBillLocalTaskPreview struct {
+	MainImage     string `json:"mainImage"`
+	StoreName     string `json:"storeName"`
+	StoreLocation string `json:"storeLocation"`
+	StoreId       int64  `json:"storeId"`
+	TeamBuyingId  int64  `json:"teamBuyingId"`
+
+	EnterpriseId  string  `json:"enterpriseId"`
+	SubAccountId  int64   `json:"subAccountId"`
+	LocalId       string  `json:"localId"`
+	LocalPlatform int64   `json:"localPlatform"`
+	LocalStatus   int64   `json:"localStatus"`
+	LocalForm     int64   `json:"localForm"`
+	ContentType   int64   `json:"contentType"`
+	EstimatedCost float64 `json:"estimatedCost"` // 应付金额
+	CashAmount    float64 `json:"cashAmount"`    // 实际结算金额
+	//NeedReview    int64   `json:"needReview"`
+	//NeedQuality   int64   `json:"needQuality"`
+	//NeedCalculate int64   `json:"needCalculate"`
+	CreatorName string `json:"creatorName"`
+	LocalType   int64  `json:"localType"`
+	CreatedAt   string `json:"createdAt"`
+	//Tools       string `json:"tools"`
+}

+ 25 - 0
app/vo/re_bill_project_task_preview.go

@@ -0,0 +1,25 @@
+package vo
+
+type ReBillProjectTaskPreview struct {
+	ProductId    int64   `json:"productId"`
+	MainImage    string  `json:"mainImage"`
+	ProductName  string  `json:"productName"`
+	ProductPrice float64 `json:"productPrice"`
+
+	EnterpriseId    string  `json:"enterpriseId"`
+	SubAccountId    int64   `json:"subAccountId"`
+	ProjectId       string  `json:"projectId"`
+	ProjectPlatform int64   `json:"projectPlatform"`
+	ProjectStatus   int64   `json:"projectStatus"`
+	ProjectForm     int64   `json:"projectForm"`
+	ContentType     int64   `json:"contentType"`
+	EstimatedCost   float64 `json:"estimatedCost"` // 应付金额
+	CashAmount      float64 `json:"cashAmount"`    // 实际结算金额
+	//NeedReview      int64   `json:"needReview"`
+	//NeedQuality     int64   `json:"needQuality"`
+	//NeedCalculate   int64   `json:"needCalculate"`
+	CreatorName string `json:"creatorName"`
+	ProjectType int64  `json:"projectType"`
+	CreatedAt   string `json:"createdAt"`
+	Tools       string `json:"tools"`
+}

+ 22 - 0
app/vo/re_bill_selection_task_preview.go

@@ -0,0 +1,22 @@
+package vo
+
+type ReBillSelectionTaskPreview struct {
+	ProductId    int64   `json:"productId"`
+	MainImage    string  `json:"mainImage"`
+	ProductName  string  `json:"productName"`
+	ProductPrice float64 `json:"productPrice"`
+
+	EnterpriseId      string `json:"enterpriseId"`
+	SubAccountId      int64  `json:"subAccountId"`
+	SelectionId       string `json:"selectionId"`
+	SelectionPlatform int64  `json:"selectionPlatform"`
+	SelectionStatus   int64  `json:"selectionStatus"`
+	CreatedAt         string `json:"createdAt"`
+	TaskDdl           string `json:"taskDdl"`
+	//SampleNum         int64   `json:"sampleNum"` // 样品数量
+	Reward float64 `json:"reward"` // 悬赏池总金额
+	//EnrollNum         int64   `json:"enrollNum"` // 报名数量
+	//ChooseNum         int64   `json:"chooseNum"` // 已选数量
+	CashAmount  float64 `json:"cashAmount"` // 实际兑现金额
+	CreatorName string  `json:"creatorName"`
+}

+ 1 - 1
app/vo/re_local_task_preview.go

@@ -12,7 +12,7 @@ type ReLocalTaskPreview struct {
 	LocalId       string  `json:"localId"`
 	LocalPlatform int64   `json:"localPlatform"`
 	LocalStatus   int64   `json:"localStatus"`
-	EstimatedCost float64 `json:"estimatedCost"`
+	EstimatedCost float64 `json:"estimatedCost"` // 任务成本
 	LocalForm     int64   `json:"localForm"`
 	ContentType   int64   `json:"contentType"`
 	NeedReview    int64   `json:"needReview"`

+ 1 - 1
app/vo/re_project_task_preview.go

@@ -11,7 +11,7 @@ type ReProjectTaskPreview struct {
 	ProjectId       string  `json:"projectId"`
 	ProjectPlatform int64   `json:"projectPlatform"`
 	ProjectStatus   int64   `json:"projectStatus"`
-	EstimatedCost   float64 `json:"estimatedCost"`
+	EstimatedCost   float64 `json:"estimatedCost"` // 任务成本
 	ProjectForm     int64   `json:"projectForm"`
 	ContentType     int64   `json:"contentType"`
 	NeedReview      int64   `json:"needReview"`

+ 5 - 4
app/vo/re_store_explore_talent.go

@@ -1,12 +1,13 @@
 package vo
 
 type ReStoreExploreTalent struct {
+	TaskId          string         `json:"taskId"`          // 子任务id
 	ReTalentPreview *TalentPreview `json:"reTalentPreview"` // 达人信息
 
-	CooperateTime     string `json:"cooperate_time"`      // 确认合作时间 select_date
-	ReserveTime       string `json:"reserve_time"`        // 探店时间预约
-	ExploreTime       string `json:"explore_time"`        // 探店时间
-	FinishExploreTime string `json:"finish_explore_time"` // 完成探店时间
+	CooperateTime     string `json:"cooperateTime"`     // 确认合作时间 select_date
+	ReserveTime       string `json:"reserveTime"`       // 探店时间预约
+	ExploreTime       string `json:"exploreTime"`       // 探店时间
+	FinishExploreTime string `json:"finishExploreTime"` // 完成探店时间
 
 	Operator string `json:"operator"` // 操作人
 }

+ 1 - 0
app/vo/store_explore_param.go

@@ -7,4 +7,5 @@ type StoreExploreParam struct {
 	SearchTime  string `json:"search_time"` // 预约探店时间/探店时间/完成探店时间
 	Page        int    `json:"page"`
 	PageSize    int    `json:"page_size"`
+	TaskId      string `json:"task_id"` // 子任务id
 }

+ 2 - 0
app/vo/talent_cancel_param.go

@@ -5,4 +5,6 @@ type TalentCancelParam struct {
 	TaskIds      []string `json:"task_ids"`
 	RealPayment  float64  `json:"real_payment"`
 	CancelReason string   `json:"cancel_reason"`
+	EnterpriseId string   `json:"enterprise_id"`
+	SubAccountId int64    `json:"sub_account_id"`
 }

+ 11 - 9
route/init.go

@@ -249,12 +249,12 @@ func InitRoute(r *gin.Engine) {
 		task.POST("/logistics/talent/list", controller.TaskController{}.LogisticsTalentList) // 达人物流列表
 
 		// 探店管理
-		task.POST("/store/explore/list", controller.TaskController{}.StoreExploreList) // 探店本地生活列表
-		task.POST("/store/explore/info", controller.TaskController{}.StoreExploreInfo) // 探店达人详情
-		// 终止合作
-		// 预约时间驳回
+		task.POST("/store/explore/list", controller.TaskController{}.StoreExploreList)       // 探店本地生活列表
+		task.POST("/store/explore/info", controller.TaskController{}.StoreExploreInfo)       // 探店达人详情
+		task.POST("/store/explore/over", controller.TaskController{}.StoreExploreOver)       // 终止合作
+		task.POST("/store/explore/operate", controller.TaskController{}.StoreExploreOperate) // 预约时间批量同意/驳回
 
-		// 服务商合作
+		// 服务商合作(其中品牌种草、本地生活列表限制类型为定向即可)
 		task.POST("/supplier/list", controller.TaskController{}.GetSupplierInTargetTaskList) // 服务商合作-服务商列表
 		task.POST("/supplier/invite", controller.TaskController{}.InviteSupplier)            // 服务商合作-邀约合作
 	}
@@ -277,10 +277,12 @@ func InitRoute(r *gin.Engine) {
 		finance.POST("/invoice/list/bill", controller.FinanceController{}.GetBillList)               // 开票记录
 		finance.POST("/invoice/list/billable", controller.FinanceController{}.GetBillableList)       // 可开票账单
 
-		//finance.POST("/bill/selection/list", controller.BillController{}.SelectionBillList) // 账单查询-电商带货
-		finance.POST("/bill/selection/pay", controller.BillController{}.SelectionPay) // 电商带货账单支付
-		finance.POST("/bill/project/pay", controller.BillController{}.ProjectPay)     // 品牌种草账单支付
-		finance.POST("/bill/local/pay", controller.BillController{}.LocalLifePay)     // 本地生活账单支付
+		finance.POST("/bill/selection/pay", controller.BillController{}.SelectionPay)       // 电商带货账单支付
+		finance.POST("/bill/project/pay", controller.BillController{}.ProjectPay)           // 品牌种草账单支付
+		finance.POST("/bill/local/pay", controller.BillController{}.LocalLifePay)           // 本地生活账单支付
+		finance.POST("/bill/selection/list", controller.BillController{}.SelectionBillList) // 账单查询-电商带货列表
+		finance.POST("/bill/project/list", controller.BillController{}.ProjectBillList)     // 账单查询-品牌种草列表
+		finance.POST("/bill/local/list", controller.BillController{}.LocalLifeBillList)     // 账单查询-本地生活列表
 
 	}
 	// 推广合作-服务商相关接口