Browse Source

LocalBillList

Xingyu Xian 2 months ago
parent
commit
28ae783e9b

+ 32 - 0
db/local_life_task.go

@@ -99,3 +99,35 @@ func ChangeLocalTaskStatus(ctx context.Context, taskIds []string, supplierStatus
 	}
 	return recruitStrategysIDs, nil
 }
+
+// GetSLocalTaskList 服务商本地生活子任务账单列表
+func GetSLocalTaskList(ctx context.Context, sLocalId int, talentId string, pageSize, pageNum int32) ([]*gorm_model.YoungeeLocalTaskInfo, int64, error) {
+	db := GetReadDB(ctx)
+	whereCondition := gorm_model.YoungeeLocalTaskInfo{
+		SLocalID: sLocalId,
+		TalentID: talentId,
+	}
+	// 查询task表信息
+	db = db.Debug().Model(gorm_model.YoungeeLocalTaskInfo{}).Where(whereCondition)
+
+	var taskInfos []*gorm_model.YoungeeLocalTaskInfo
+	db = db.Model(gorm_model.YoungeeLocalTaskInfo{})
+	// 查询总数
+	var totalTask int64
+	if err := db.Count(&totalTask).Error; err != nil {
+		logrus.WithContext(ctx).Errorf("[GetProjectTaskList] error query mysql total, err:%+v", err)
+		return nil, 0, err
+	}
+	db.Order("task_id").Find(&taskInfos)
+
+	// 查询该页数据
+	limit := pageSize
+	offset := pageSize * pageNum // assert pageNum start with 0
+	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
+	}
+
+	return taskInfos, totalTask, nil
+}

+ 25 - 0
db/s_local_life.go

@@ -221,3 +221,28 @@ func UpdateSLocal(ctx context.Context, sLocalInfo *gorm_model.YounggeeSLocalLife
 	}
 	return nil
 }
+
+func GetFullSLocalBillList(ctx context.Context, pageSize, pageNum int32, supplierId int) ([]*gorm_model.YounggeeSLocalLifeInfo, int64, error) {
+	db := GetReadDB(ctx)
+
+	// 根据带货任务状态过滤
+	db = db.Debug().Model(gorm_model.YounggeeSLocalLifeInfo{}).Where("task_status = 4 and local_type = 1")
+
+	// 查询总数
+	var total int64
+	var fullLocals []*gorm_model.YounggeeSLocalLifeInfo
+	if err := db.Count(&total).Error; err != nil {
+		logrus.WithContext(ctx).Errorf("[GetFullProjectList] error query mysql total, err:%+v", err)
+		return nil, 0, err
+	}
+
+	// 查询该页数据
+	limit := pageSize
+	offset := pageSize * pageNum // assert pageNum start with 0
+	err := db.Order("s_local_id desc").Limit(int(limit)).Offset(int(offset)).Find(&fullLocals).Error
+	if err != nil {
+		logrus.WithContext(ctx).Errorf("[GetFullProjectList] error query mysql total, err:%+v", err)
+		return nil, 0, err
+	}
+	return fullLocals, total, nil
+}

+ 31 - 0
db/s_project.go

@@ -190,3 +190,34 @@ func FindSProjectByProjectIdAndSupplierId(ctx context.Context, projectId string,
 	}
 	return total, nil
 }
+
+func GetSProjectTaskList(ctx context.Context, sProjectId int, talentId string, pageSize, pageNum int32) ([]*gorm_model.YoungeeTaskInfo, int64, error) {
+	db := GetReadDB(ctx)
+	whereCondition := gorm_model.YoungeeTaskInfo{
+		SProjectId: sProjectId,
+		TalentID:   talentId,
+	}
+	// 查询task表信息
+	db = db.Debug().Model(gorm_model.YoungeeTaskInfo{}).Where(whereCondition)
+
+	var taskInfos []*gorm_model.YoungeeTaskInfo
+	db = db.Model(gorm_model.YoungeeTaskInfo{})
+	// 查询总数
+	var totalTask int64
+	if err := db.Count(&totalTask).Error; err != nil {
+		logrus.WithContext(ctx).Errorf("[GetProjectTaskList] error query mysql total, err:%+v", err)
+		return nil, 0, err
+	}
+	db.Order("task_id").Find(&taskInfos)
+
+	// 查询该页数据
+	limit := pageSize
+	offset := pageSize * pageNum // assert pageNum start with 0
+	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
+	}
+
+	return taskInfos, totalTask, nil
+}

+ 48 - 0
handler/full_s_local_bill_list.go

@@ -0,0 +1,48 @@
+package handler
+
+import (
+	"github.com/gin-gonic/gin"
+	"youngee_b_api/model/http_model"
+	"youngee_b_api/service"
+)
+
+func WrapFullSLocalBillListHandler(ctx *gin.Context) {
+	handler := newFullSLocalBillListHandler(ctx)
+	baseRun(handler)
+}
+
+func newFullSLocalBillListHandler(ctx *gin.Context) *FullSLocalBillListHandler {
+	return &FullSLocalBillListHandler{
+		req:  http_model.NewFullSLocalBillRequest(),
+		resp: http_model.NewFullSLocalBillResponse(),
+		ctx:  ctx,
+	}
+}
+
+type FullSLocalBillListHandler struct {
+	req  *http_model.FullSLocalBillListRequest
+	resp *http_model.CommonResponse
+	ctx  *gin.Context
+}
+
+func (h *FullSLocalBillListHandler) getRequest() interface{} {
+	return h.req
+}
+func (h *FullSLocalBillListHandler) getContext() *gin.Context {
+	return h.ctx
+}
+func (h *FullSLocalBillListHandler) getResponse() interface{} {
+	return h.resp
+}
+func (h *FullSLocalBillListHandler) run() {
+	data, err := service.SLocalLife.GetFullSLocalBillList(h.ctx, h.req)
+	if err != nil {
+		h.resp.Message = err.Error()
+	}
+	h.resp.Data = data
+	h.resp.Message = "成功查询"
+}
+
+func (h *FullSLocalBillListHandler) checkParam() error {
+	return nil
+}

+ 48 - 0
handler/full_s_local_task_bill_list.go

@@ -0,0 +1,48 @@
+package handler
+
+import (
+	"github.com/gin-gonic/gin"
+	"youngee_b_api/model/http_model"
+	"youngee_b_api/service"
+)
+
+func WrapFullSLocalTaskBillListHandler(ctx *gin.Context) {
+	handler := newFullSLocalTaskBillListHandler(ctx)
+	baseRun(handler)
+}
+
+func newFullSLocalTaskBillListHandler(ctx *gin.Context) *FullSLocalBillTaskListHandler {
+	return &FullSLocalBillTaskListHandler{
+		req:  http_model.NewFullSLocalTaskBillRequest(),
+		resp: http_model.NewFullSlocalTaskBillResponse(),
+		ctx:  ctx,
+	}
+}
+
+type FullSLocalBillTaskListHandler struct {
+	req  *http_model.FullSLocalTaskBillListRequest
+	resp *http_model.CommonResponse
+	ctx  *gin.Context
+}
+
+func (h *FullSLocalBillTaskListHandler) getRequest() interface{} {
+	return h.req
+}
+func (h *FullSLocalBillTaskListHandler) getContext() *gin.Context {
+	return h.ctx
+}
+func (h *FullSLocalBillTaskListHandler) getResponse() interface{} {
+	return h.resp
+}
+func (h *FullSLocalBillTaskListHandler) run() {
+	data, err := service.SLocalLife.FullSLocalTaskBillList(h.ctx, h.req)
+	if err != nil {
+		h.resp.Message = err.Error()
+	}
+	h.resp.Data = data
+	h.resp.Message = "成功查询"
+}
+
+func (h *FullSLocalBillTaskListHandler) checkParam() error {
+	return nil
+}

+ 4 - 6
handler/local_life_detail.go

@@ -17,14 +17,14 @@ func WrapLocalLifeDetailHandler(ctx *gin.Context) {
 
 func newLocalLifeDetailHandler(ctx *gin.Context) *LocalLifeDetailHandler {
 	return &LocalLifeDetailHandler{
-		req:  http_model.NewShowProjectRequest(),
-		resp: http_model.NewShowProjectResponse(),
+		req:  http_model.NewShowLocalRequest(),
+		resp: http_model.NewShowLocalResponse(),
 		ctx:  ctx,
 	}
 }
 
 type LocalLifeDetailHandler struct {
-	req  *http_model.ShowProjectRequest
+	req  *http_model.ShowLocalRequest
 	resp *http_model.CommonResponse
 	ctx  *gin.Context
 }
@@ -42,12 +42,10 @@ func (h *LocalLifeDetailHandler) getResponse() interface{} {
 }
 
 func (h *LocalLifeDetailHandler) run() {
-	data := http_model.ShowProjectRequest{}
-	data = *h.req
 	// auth := middleware.GetSessionAuth(h.ctx)
 	// enterpriseID := auth.EnterpriseID
 	// fmt.Printf("projectID %+v", data.ProjectID)
-	res, err := service.Project.GetPorjectDetail(h.ctx, data.ProjectID)
+	res, err := service.LocalLife.ShowLocalLife(h.ctx, h.req)
 	if err != nil {
 		logrus.Errorf("[ShowProjectHandler] call Show err:%+v\n", err)
 		util.HandlerPackErrorResp(h.resp, consts.ErrorInternal, "")

+ 4 - 4
model/gorm_model/local_life_task_info.go

@@ -13,10 +13,10 @@ type YoungeeLocalTaskInfo struct {
 	TalentPlatformInfoSnap string    `gorm:"column:talent_platform_info_snap;NOT NULL"`             // 达人平台信息快照
 	TalentPersonalInfoSnap string    `gorm:"column:talent_personal_info_snap;NOT NULL"`             // 达人个人信息快照
 	TalentPostAddrSnap     string    `gorm:"column:talent_post_addr_snap;NOT NULL"`                 // 收货地址快照
-	TaskReward             string    `gorm:"column:task_reward;NOT NULL"`                           // 达人报酬(3.0未用)
-	SettleAmount           string    `gorm:"column:settle_amount;NOT NULL"`                         // 达人实际所得(自动填充)(扣除违约扣款)
-	AllPayment             string    `gorm:"column:all_payment;NOT NULL"`                           // 企业支付(3.0未用)
-	RealPayment            string    `gorm:"column:real_payment;NOT NULL"`                          // 企业实际支付(加上服务商的服务费)(扣除违约扣款)
+	TaskReward             float64   `gorm:"column:task_reward;NOT NULL"`                           // 达人报酬(3.0未用)
+	SettleAmount           float64   `gorm:"column:settle_amount;NOT NULL"`                         // 达人实际所得(自动填充)(扣除违约扣款)
+	AllPayment             float64   `gorm:"column:all_payment;NOT NULL"`                           // 企业支付(3.0未用)
+	RealPayment            float64   `gorm:"column:real_payment;NOT NULL"`                          // 企业实际支付(加上服务商的服务费)(扣除违约扣款)
 	ServiceRate            int       `gorm:"column:service_rate"`                                   // 服务费率,千分之
 	ServiceCharge          float64   `gorm:"column:service_charge"`                                 // 服务费
 	RealServiceCharge      string    `gorm:"column:real_service_charge"`                            // 服务商实际所得服务费(扣除违约)

+ 1 - 0
model/gorm_model/s_local_life.go

@@ -24,6 +24,7 @@ type YounggeeSLocalLifeInfo struct {
 	SubAccountId        int       `gorm:"column:sub_account_id"`         // 服务商子账号ID
 	ServiceCharge       float64   `gorm:"column:service_charge"`         // 服务商预估可赚服务费
 	ServiceChargeActual float64   `gorm:"column:service_charge_actual"`  // 服务商实际可赚服务费
+	ServiceChargeSettle float64   `gorm:"column:service_charge_settle"`  // 服务商已结算服务费
 	OperatorType        int       `gorm:"column:operator_type"`          // 添加商单操作人类型,1为服务商主账号,2为服务商子账号
 	SLocalStatus        int       `gorm:"column:s_local_status"`         // 服务商本地生活任务状态,1待确认,2已确认,3已拒绝
 	StrategyStatus      int       `gorm:"column:strategy_status"`        // 定向本地生活任务是否替换招募策略

+ 45 - 0
model/http_model/full_s_local_bill_list.go

@@ -0,0 +1,45 @@
+package http_model
+
+type FullSLocalBillListRequest struct {
+	PageNum       int32  `json:"page_num"`
+	PageSize      int32  `json:"page_size"`
+	LocalPlatform int    `json:"local_platform"` // 任务平台,1-7分别代表小红书、抖音、微博、快手、b站、大众点评、知乎
+	SupplierId    int    `json:"supplier_id"`    // 服务商ID
+	TaskStatus    int    `json:"task_status"`    // 任务状态
+	SLocalId      int    `json:"s_local_id"`     // 本地生活ID
+	LocalName     string `json:"local_name"`     // 任务名称
+}
+
+type FullSLocalBillData struct {
+	SLocalList []*FullSLocalBillListData `json:"s_local_list"` // 服务商加入商单的本地生活任务信息
+	Total      int64                     `json:"total"`        // 数量
+}
+
+type FullSLocalBillListData struct {
+	SLocalId            int     `json:"s_local_id"`            // 服务商任务ID
+	LocalId             string  `json:"local_id"`              // 任务ID
+	LocalPlatform       int     `json:"local_platform"`        // 任务平台,1-7分别代表小红书、抖音、微博、快手、b站、大众点评、知乎
+	TaskForm            int     `json:"task_form"`             // 任务形式,1-2分别代表线下探店,素材分发
+	ContentType         int     `json:"content_type"`          // 内容形式,1代表图文,2代表视频
+	TaskStatus          int     `json:"task_status"`           // 任务状态
+	EnterpriseId        string  `json:"enterprise_id"`         // 所属企业ID
+	SupplierId          int     `json:"supplier_id"`           // 所属服务商ID
+	SubAccountId        int     `json:"sub_account_id"`        // 所属子账号ID
+	ServiceChargeActual float64 `json:"service_charge_actual"` // 服务商实际可赚服务费
+	ServiceChargeSettle float64 `json:"service_charge_settle"` // 已结算服务费
+	StorePhotoUrl       string  `json:"store_photo_url"`       // 门店主图URL
+	StorePhotoSymbol    int64   `json:"store_photo_symbol"`    // 门店标志位
+	StorePhotoUid       string  `json:"store_photo_uid"`       // 门店uid
+	StoreName           string  `json:"store_name"`            // 门店名称
+	StoreId             int     `json:"store_id"`              // 门店ID
+}
+
+func NewFullSLocalBillRequest() *FullSLocalBillListRequest {
+	return new(FullSLocalBillListRequest)
+}
+
+func NewFullSLocalBillResponse() *CommonResponse {
+	resp := new(CommonResponse)
+	resp.Data = new(FullSLocalBillData)
+	return resp
+}

+ 45 - 0
model/http_model/full_s_local_task_bill_list.go

@@ -0,0 +1,45 @@
+package http_model
+
+type FullSLocalTaskBillListRequest struct {
+	SProjectId int    `json:"s_project_id"` // 种草任务ID
+	TalentId   string `json:"talent_id"`    // 达人ID
+	PageNum    int32  `json:"page_num"`
+	PageSize   int32  `json:"page_size"`
+}
+
+type FullSLocalTaskBillData struct {
+	SLocalTaskList      []*FullSLocalTaskBillListData `json:"s_local_task_list"`     // 服务商加入商单的子任务信息
+	DraftFee            float64                       `json:"draft_fee"`             // 达人总稿费
+	ServiceCharge       float64                       `json:"service_charge"`        // 总服务费
+	ChooseNum           int                           `json:"choose_num"`            // 合作数量
+	SettleNum           int                           `json:"settle_num"`            // 结算人数
+	DraftFeeSettle      float64                       `json:"draft_fee_settle"`      // 稿费已结算
+	ServiceChargeSettle float64                       `json:"service_charge_settle"` // 服务费已结算
+	Total               int64                         `json:"total"`                 // 数量
+}
+
+type FullSLocalTaskBillListData struct {
+	TaskId            string  `json:"task_id"`             // 子任务ID
+	ViewNum           int     `json:"view_num"`            // 浏览量
+	VoteNum           int     `json:"vote_num"`            // 点赞数
+	CommitNum         int     `json:"commit_num"`          // 评论数
+	CollectNum        int     `json:"collect_num"`         // 收藏数
+	ServiceCharge     float64 `json:"service_charge"`      // 服务费
+	DraftFee          float64 `json:"draft_fee"`           // 达人稿费
+	DelayRate         int     `json:"delay_rate"`          // 违约扣款比例
+	RealServiceCharge float64 `json:"real_service_charge"` // 实际服务费
+	SettleAmount      float64 `json:"settle_amount"`       // 达人实际所得
+	SettleTime        string  `json:"settle_time"`         // 结算时间
+	TalentHeadUrl     string  `json:"talent_head_url"`     // 达人头像URL
+	TalentNackName    string  `json:"talent_nack_name"`    // 达人昵称
+}
+
+func NewFullSLocalTaskBillRequest() *FullSLocalTaskBillListRequest {
+	return new(FullSLocalTaskBillListRequest)
+}
+
+func NewFullSlocalTaskBillResponse() *CommonResponse {
+	resp := new(CommonResponse)
+	resp.Data = new(FullSLocalTaskBillData)
+	return resp
+}

+ 14 - 6
model/http_model/full_s_project_task_bill_list.go

@@ -1,15 +1,21 @@
 package http_model
 
 type FullSProjectTaskBillListRequest struct {
-	SProjectId int `json:"s_project_id"` // 种草任务ID
-	//TalentId   string `json:"talent_id"`    // 达人ID
-	PageNum  int32 `json:"page_num"`
-	PageSize int32 `json:"page_size"`
+	SProjectId int    `json:"s_project_id"` // 种草任务ID
+	TalentId   string `json:"talent_id"`    // 达人ID
+	PageNum    int32  `json:"page_num"`
+	PageSize   int32  `json:"page_size"`
 }
 
 type FullSProjectTaskBillData struct {
-	SProjectTaskList []*FullSProjectTaskBillListData `json:"s_project_task_info"` // 服务商加入商单的种草任务信息
-	Total            int64                           `json:"total"`               // 数量
+	SProjectTaskList    []*FullSProjectTaskBillListData `json:"s_project_task_info"`   // 服务商加入商单的种草任务信息
+	DraftFee            float64                         `json:"draft_fee"`             // 达人总稿费
+	ServiceCharge       float64                         `json:"service_charge"`        // 总服务费
+	ChooseNum           int                             `json:"choose_num"`            // 合作数量
+	SettleNum           int                             `json:"settle_num"`            // 结算人数
+	DraftFeeSettle      float64                         `json:"draft_fee_settle"`      // 稿费已结算
+	ServiceChargeSettle float64                         `json:"service_charge_settle"` // 服务费已结算
+	Total               int64                           `json:"total"`                 // 数量
 }
 
 type FullSProjectTaskBillListData struct {
@@ -24,6 +30,8 @@ type FullSProjectTaskBillListData struct {
 	RealServiceCharge float64 `json:"real_service_charge"` // 实际服务费
 	SettleAmount      float64 `json:"settle_amount"`       // 达人实际所得
 	SettleTime        string  `json:"settle_time"`         // 结算时间
+	TalentHeadUrl     string  `json:"talent_head_url"`     // 达人头像URL
+	TalentNackName    string  `json:"talent_nack_name"`    // 达人昵称
 }
 
 func NewFullSProjectTaskBillRequest() *FullSProjectTaskBillListRequest {

+ 67 - 0
model/http_model/local_life_detail.go

@@ -0,0 +1,67 @@
+package http_model
+
+import "youngee_b_api/model/gorm_model"
+
+type ShowLocalPhoto struct {
+	PhotoUrl string `json:"photo_url"` // 图片url
+	PhotoUid string `json:"photo_uid"` // uid
+	FileName string `json:"name"`      // 文件名
+}
+
+type ShowLocalData struct {
+	// 系统信息
+	SLocalId          int     `json:"s_local_id"`          // 主键ID
+	LocalId           string  `json:"local_id"`            // 被加入商单的原本地生活ID
+	LocalPlatform     int     `json:"local_platform"`      // 任务平台,1-7分别代表小红书、抖音、微博、快手、b站、大众点评、知乎
+	TaskStatus        int     `json:"task_status"`         // 任务状态
+	CreateAt          string  `json:"create_at"`           // 创建时间
+	EnterpriseId      string  `json:"enterprise_id"`       // 商家ID
+	EnterprisePhone   string  `json:"enterprise_phone"`    // 商家用户手机号码
+	EstimatedCost     string  `json:"estimated_cost"`      // 预估成本
+	ServiceChargeRate float64 `json:"service_charge_rate"` // 公开服务费率
+
+	// 关联主体
+	StoreId              int     `json:"store_id"`                // 关联门店id
+	StoreName            string  `json:"store_name"`              // 门店名称
+	StoreCategory        string  `json:"store_category"`          // 门店类目(/分隔)
+	StoreMainPhotoUrl    string  `json:"store_main_photo_url"`    // 门店主图URL
+	StoreMainPhotoUid    string  `json:"store_main_photo_uid"`    // 门店主图uid
+	StoreMainPhotoSymbol int     `json:"store_main_photo_symbol"` // 门店主图类型
+	StoreRelatedAt       string  `json:"store_related_at"`        // 关联门店时间
+	TeamBuyingId         int     `json:"team_buying_id"`          // 关联团购id
+	TeamBuyingCategory   string  `json:"team_buying_category"`    // 团购类目(/分隔)
+	TeamBuyingName       string  `json:"team_buying_name"`        // 团购标题
+	TeamMainPhotoUrl     string  `json:"team_main_photo_url"`     // 团购主图URL
+	TeamMainPhotoUid     string  `json:"team_main_photo_uid"`     // 团购主图uid
+	TeamMainPhotoSymbol  int     `json:"team_main_photo_symbol"`  // 团购主图类型
+	TeamBuyingPrice      float64 `json:"team_buying_price"`       // 团购售价
+	TeamBuyingRelatedAt  string  `json:"team_buying_related_at"`  // 关联团购时间
+
+	// 招募要求
+	TalentType       string                 `json:"talent_type"`       // 达人类型
+	RecruitDdl       string                 `json:"recruit_ddl"`       // 招募截至时间
+	RecruitStrategys []ShowSRecruitStrategy `json:"recruit_strategys"` // 招募策略
+
+	// 执行要求
+	TaskForm      int                            `json:"task_form"`      // 任务形式,1-2分别代表线下探店,素材分发
+	ContentType   int                            `json:"content_type"`   // 内容形式,1代表图文,2代表视频
+	TaskDetail    string                         `json:"task_detail"`    // 任务详情
+	LocalBrief    []gorm_model.LocalLifeBrief    `json:"local_brief"`    // Brief
+	LocalMaterial []gorm_model.LocalLifeMaterial `json:"local_material"` // 素材
+
+	// 工具选择
+	Tools string `json:"tools"` // 工具选择,1邀约招募 2探店邀约 3审稿工具 4作品审查 5数据巡检 6结算账单
+}
+
+type ShowLocalRequest struct {
+	LocalId string `json:"local_id"` // 本地生活ID
+}
+
+func NewShowLocalRequest() *ShowLocalRequest {
+	return new(ShowLocalRequest)
+}
+func NewShowLocalResponse() *CommonResponse {
+	resp := new(CommonResponse)
+	resp.Data = new(ShowLocalData)
+	return resp
+}

+ 3 - 1
route/init.go

@@ -207,8 +207,10 @@ func InitRoute(r *gin.Engine) {
 		f.Use(middleware.LoginAuthMiddleware)
 
 		// 财务管理
-		f.POST("/fullSProject/billList", handler.WrapFullSProjectBillListHandler)         // 种草账单列表
+		f.POST("/fullSProject/billList", handler.WrapFullSProjectBillListHandler)         // 种草任务账单列表
 		f.POST("/fullSProject/taskBillList", handler.WrapFullSProjectTaskBillListHandler) // 种草子任务账单列表
+		f.POST("/fullSLocal/billList", handler.WrapFullSLocalBillListHandler)             // 本地生活任务账单列表
+		f.POST("/fullSLocal/taskBillList", handler.WrapFullSLocalTaskBillListHandler)     // 本地生活子任务账单列表
 		f.POST("/supplierWithdraw/toList", handler.WrapSupplierToWithdrawListHandler)     // 服务商可提现账单列表
 		f.POST("/supplierWithdraw/create", handler.WrapCreateSupplierWithdrawHandler)     // 服务商提现
 

+ 118 - 0
service/local_life.go

@@ -3,6 +3,7 @@ package service
 import (
 	"context"
 	"fmt"
+	"github.com/issue9/conv"
 	"github.com/sirupsen/logrus"
 	"youngee_b_api/db"
 	"youngee_b_api/model/common_model"
@@ -181,3 +182,120 @@ func (*localLife) GetSpecialLocalLifeList(ctx context.Context, pageSize, pageNum
 	}
 	return specialLocalData, nil
 }
+
+// ShowLocalLife 商单广场-本地生活详情
+func (*localLife) ShowLocalLife(ctx context.Context, req *http_model.ShowLocalRequest) (*http_model.ShowLocalData, error) {
+	var localInfo *http_model.ShowLocalData
+	localInfo = &http_model.ShowLocalData{}
+
+	// 1. 查询系统信息
+	localData, localErr := db.GetLocalLifeDetail(ctx, req.LocalId)
+	if localErr != nil {
+		return nil, localErr
+	}
+	if localData != nil {
+		localInfo.LocalId = localData.LocalId
+		localInfo.LocalPlatform = localData.LocalPlatform
+		localInfo.TaskStatus = localData.TaskStatus
+		localInfo.EnterpriseId = localData.EnterpriseId
+		localInfo.ServiceChargeRate = localData.ServiceChargeRate
+		localInfo.EstimatedCost = localData.EstimatedCost
+		localInfo.CreateAt = conv.MustString(localData.CreatedAt)
+
+		// 2. 关联主体
+		// 2.1. 门店信息
+		storeInfo, storeErr := db.FindStoreById(ctx, localData.StoreId)
+		if storeErr != nil {
+			return nil, storeErr
+		}
+		if storeInfo != nil {
+			localInfo.StoreId = storeInfo.StoreId
+			localInfo.StoreName = storeInfo.StoreName
+			localInfo.StoreCategory = storeInfo.StoreCategory
+			localInfo.StoreRelatedAt = conv.MustString(localData.StoreRelatedAt)
+
+			// 2.2. 门店图片信息
+			storePhotoInfo, storePhotoErr := db.GetStorePhotoByStoreID(ctx, localData.StoreId)
+			if storePhotoErr != nil {
+				return nil, storePhotoErr
+			}
+			if storePhotoInfo != nil {
+				for _, photo := range storePhotoInfo {
+					if photo.Symbol == 1 {
+						localInfo.StoreMainPhotoSymbol = 1
+						localInfo.StoreMainPhotoUrl = photo.PhotoUrl
+						localInfo.StoreMainPhotoUid = photo.PhotoUid
+					}
+				}
+			}
+		}
+
+		// 2.3. 团购信息
+		teamInfo, teamErr := db.FindTeamById(ctx, localData.StoreId)
+		if teamErr != nil {
+			return nil, teamErr
+		}
+		if teamInfo != nil {
+			localInfo.TeamBuyingId = teamInfo.StoreId
+			localInfo.TeamBuyingName = teamInfo.TeamBuyingName
+			localInfo.TeamBuyingCategory = teamInfo.TeamBuyingCategory
+			localInfo.TeamBuyingRelatedAt = conv.MustString(localData.TeamBuyingRelatedAt)
+
+			// 2.4. 团购图片信息
+			teamPhotoInfo, teamPhotoErr := db.GetTeamPhotoByStoreID(ctx, localData.StoreId)
+			if teamPhotoErr != nil {
+				return nil, teamPhotoErr
+			}
+			if teamPhotoInfo != nil {
+				for _, photo := range teamPhotoInfo {
+					if photo.Symbol == 1 {
+						localInfo.TeamMainPhotoSymbol = 1
+						localInfo.TeamMainPhotoUrl = photo.PhotoUrl
+						localInfo.TeamMainPhotoUid = photo.PhotoUid
+					}
+				}
+			}
+		}
+
+		// 3. 招募要求
+		localInfo.TalentType = localData.TalentType
+		localInfo.RecruitDdl = conv.MustString(localData.RecruitDdl)
+		recruitStrategy, recruitErr := db.GetRecruitStrategyByProjectId(ctx, req.LocalId)
+		if recruitErr != nil {
+			return nil, recruitErr
+		}
+		if recruitStrategy != nil {
+			for _, strategy := range recruitStrategy {
+				showStrategy := http_model.ShowSRecruitStrategy{
+					StrategyID:    strategy.StrategyID,
+					FeeForm:       strategy.FeeForm,
+					FollowersLow:  strategy.FollowersLow,
+					FollowersUp:   strategy.FollowersUp,
+					RecruitNumber: strategy.RecruitNumber,
+					Offer:         strategy.Offer,
+				}
+				localInfo.RecruitStrategys = append(localInfo.RecruitStrategys, showStrategy)
+			}
+		}
+
+		// 4. 执行要求
+		localInfo.TaskForm = localData.TaskForm
+		localInfo.ContentType = localData.ContentType
+		briefInfo, briefErr := db.FindBriefByLocalId(ctx, req.LocalId)
+		if briefErr != nil {
+			return nil, briefErr
+		}
+		if briefInfo != nil {
+			localInfo.LocalBrief = briefInfo
+		}
+		materialInfo, materialErr := db.FindMaterialByLocalId(ctx, req.LocalId)
+		if materialErr != nil {
+			return nil, materialErr
+		}
+		if materialInfo != nil {
+			localInfo.LocalMaterial = materialInfo
+		}
+	}
+
+	return localInfo, nil
+}

+ 111 - 0
service/s_local_life.go

@@ -392,3 +392,114 @@ func (*sLocalLife) CreateSpecialStrategy(ctx context.Context, request *http_mode
 	}
 	return nil
 }
+
+// GetFullSLocalBillList 服务商本地生活任务账单列表
+func (*sLocalLife) GetFullSLocalBillList(ctx context.Context, req *http_model.FullSLocalBillListRequest) (*http_model.FullSLocalBillData, error) {
+
+	// 1. 查询本地生活任务基本信息
+	fullLocals, total, err := db.GetFullSLocalBillList(ctx, req.PageSize, req.PageNum, req.SupplierId)
+	if err != nil {
+		logrus.WithContext(ctx).Errorf("[fullLocals service] call GetFullSLocalLifeList error,err:%+v", err)
+		return nil, err
+	}
+	var fullLocalData *http_model.FullSLocalBillData
+	fullLocalData = &http_model.FullSLocalBillData{}
+	fullLocalData.Total = total
+	for _, fullLocal := range fullLocals {
+		var fullLocalPreview *http_model.FullSLocalBillListData
+		fullLocalPreview = &http_model.FullSLocalBillListData{}
+		fullLocalPreview.SLocalId = fullLocal.SLocalId
+		fullLocalPreview.LocalId = fullLocal.LocalId
+		fullLocalPreview.LocalPlatform = fullLocal.LocalPlatform
+		fullLocalPreview.TaskForm = fullLocal.TaskForm
+		fullLocalPreview.ContentType = fullLocal.ContentType
+		fullLocalPreview.TaskStatus = fullLocal.TaskStatus
+		fullLocalPreview.EnterpriseId = fullLocal.EnterpriseId
+		fullLocalPreview.SupplierId = fullLocal.SupplierId
+		fullLocalPreview.SubAccountId = fullLocal.SubAccountId
+		fullLocalPreview.ServiceChargeActual = fullLocal.ServiceChargeActual
+		fullLocalPreview.ServiceChargeSettle = fullLocal.ServiceChargeSettle
+		fullLocalPreview.StoreId = fullLocal.StoreId
+		fullLocalData.SLocalList = append(fullLocalData.SLocalList, fullLocalPreview)
+	}
+
+	// 2. 查询本地生活补充信息:门店信息,招募策略
+	for _, local := range fullLocalData.SLocalList {
+
+		// 2.1. 门店信息
+		storeInfo, productErr := db.FindStoreById(ctx, local.StoreId)
+		if productErr != nil {
+			return nil, productErr
+		}
+		if storeInfo != nil {
+			local.StoreId = storeInfo.StoreId
+			local.StoreName = storeInfo.StoreName
+		}
+
+		// 2.2. 门店图片信息
+		productPhotoInfo, productPhotoErr := db.GetStorePhotoByStoreID(ctx, local.StoreId)
+		if productPhotoErr != nil {
+			return nil, productPhotoErr
+		}
+		if productPhotoInfo != nil {
+			for _, photo := range productPhotoInfo {
+				fmt.Println(photo)
+				if photo.Symbol == 1 {
+					local.StorePhotoSymbol = 1
+					local.StorePhotoUrl = photo.PhotoUrl
+					local.StorePhotoUid = photo.PhotoUid
+				}
+			}
+		}
+	}
+	return fullLocalData, nil
+}
+
+// FullSLocalTaskBillList 服务商本地生活子任务账单列表
+func (*sLocalLife) FullSLocalTaskBillList(ctx context.Context, request *http_model.FullSLocalTaskBillListRequest) (*http_model.FullSLocalTaskBillData, error) {
+	var currSLocalTaskBillData *http_model.FullSLocalTaskBillData
+	currSLocalTaskBillData = &http_model.FullSLocalTaskBillData{}
+	currSLocalTaskBillData.DraftFee = 0
+	currSLocalTaskBillData.DraftFeeSettle = 0
+
+	// 1. 查找子任务
+	taskList, total, taskListErr := db.GetSLocalTaskList(ctx, request.SProjectId, request.TalentId, request.PageSize, request.PageNum)
+	if taskListErr != nil {
+		return nil, taskListErr
+	}
+	if taskList != nil {
+		currSLocalTaskBillData.Total = total
+		for _, task := range taskList {
+			var curr *http_model.FullSLocalTaskBillListData
+			curr = &http_model.FullSLocalTaskBillListData{}
+			curr.TaskId = task.TaskID
+			curr.ServiceCharge = task.ServiceCharge
+			curr.ViewNum = 0
+			curr.VoteNum = 0
+			curr.CommitNum = 0
+			curr.CollectNum = 0
+			curr.ServiceCharge = task.ServiceCharge
+			curr.DraftFee = task.DraftFee
+			curr.DelayRate = task.ScriptBreakRate + task.SketchBreakRate + task.LinkBreakRate + task.DataBreakRate
+			curr.RealServiceCharge = task.RealPayment - task.SettleAmount
+			curr.SettleAmount = task.SettleAmount
+			curr.SettleTime = conv.MustString(task.CompleteDate)
+			currSLocalTaskBillData.DraftFee += curr.DraftFee
+			currSLocalTaskBillData.DraftFeeSettle += curr.SettleAmount
+			currSLocalTaskBillData.SLocalTaskList = append(currSLocalTaskBillData.SLocalTaskList, curr)
+		}
+
+		// 2. 补充任务信息
+		sProjectInfo, sProjectErr := db.GetSProjectDetail(ctx, request.SProjectId)
+		if sProjectErr != nil {
+			return nil, sProjectErr
+		}
+		if sProjectInfo != nil {
+			currSLocalTaskBillData.SettleNum = sProjectInfo.SettleNum
+			currSLocalTaskBillData.ChooseNum = sProjectInfo.ApplyNum
+			currSLocalTaskBillData.ServiceCharge = sProjectInfo.ServiceCharge
+			currSLocalTaskBillData.ServiceChargeSettle = sProjectInfo.ServiceChargeSettle
+		}
+	}
+	return currSLocalTaskBillData, nil
+}

+ 42 - 0
service/s_project.go

@@ -556,5 +556,47 @@ func (*sProject) FullSProjectBillList(ctx context.Context, request *http_model.F
 func (*sProject) FullSProjectTaskBillList(ctx context.Context, request *http_model.FullSProjectTaskBillListRequest) (*http_model.FullSProjectTaskBillData, error) {
 	var currSProjectTaskBillData *http_model.FullSProjectTaskBillData
 	currSProjectTaskBillData = &http_model.FullSProjectTaskBillData{}
+	currSProjectTaskBillData.DraftFee = 0
+	currSProjectTaskBillData.DraftFeeSettle = 0
+
+	// 1. 查找子任务
+	taskList, total, taskListErr := db.GetSProjectTaskList(ctx, request.SProjectId, request.TalentId, request.PageSize, request.PageNum)
+	if taskListErr != nil {
+		return nil, taskListErr
+	}
+	if taskList != nil {
+		currSProjectTaskBillData.Total = total
+		for _, task := range taskList {
+			var curr *http_model.FullSProjectTaskBillListData
+			curr = &http_model.FullSProjectTaskBillListData{}
+			curr.TaskId = task.TaskID
+			curr.ServiceCharge = task.ServiceCharge
+			curr.ViewNum = 0
+			curr.VoteNum = 0
+			curr.CommitNum = 0
+			curr.CollectNum = 0
+			curr.ServiceCharge = task.ServiceCharge
+			curr.DraftFee = task.DraftFee
+			curr.DelayRate = task.ScriptBreakRate + task.SketchBreakRate + task.LinkBreakRate + task.DataBreakRate
+			curr.RealServiceCharge = task.RealPayment - task.SettleAmount
+			curr.SettleAmount = task.SettleAmount
+			curr.SettleTime = conv.MustString(task.CompleteDate)
+			currSProjectTaskBillData.DraftFee += curr.DraftFee
+			currSProjectTaskBillData.DraftFeeSettle += curr.SettleAmount
+			currSProjectTaskBillData.SProjectTaskList = append(currSProjectTaskBillData.SProjectTaskList, curr)
+		}
+
+		// 2. 补充任务信息
+		sProjectInfo, sProjectErr := db.GetSProjectDetail(ctx, request.SProjectId)
+		if sProjectErr != nil {
+			return nil, sProjectErr
+		}
+		if sProjectInfo != nil {
+			currSProjectTaskBillData.SettleNum = sProjectInfo.SettleNum
+			currSProjectTaskBillData.ChooseNum = sProjectInfo.ApplyNum
+			currSProjectTaskBillData.ServiceCharge = sProjectInfo.ServiceCharge
+			currSProjectTaskBillData.ServiceChargeSettle = sProjectInfo.ServiceChargeSettle
+		}
+	}
 	return currSProjectTaskBillData, nil
 }