Ethan 5 сар өмнө
parent
commit
e1b4483a67

+ 90 - 0
app/controller/cooperation_controller.go

@@ -0,0 +1,90 @@
+package controller
+
+import (
+	"github.com/gin-gonic/gin"
+	"github.com/sirupsen/logrus"
+	"youngee_b_api/app/service"
+	"youngee_b_api/app/vo"
+)
+
+type CooperationController struct{}
+
+// 服务商端链接
+func (o CooperationController) GetSupplierLink(c *gin.Context) {
+	supplierLink := "服务商端链接"
+	resultMap := make(map[string]string)
+	resultMap["supplierLink"] = supplierLink
+	returnSuccess(c, 20000, resultMap)
+}
+
+// 服务商搜索
+func (o CooperationController) SearchSupplier(c *gin.Context) {
+	param := &vo.SupplierSearchParam{}
+	err := c.BindJSON(param)
+	if err != nil || "" == param.FieldName {
+		logrus.Errorf("Request bind err:%+v\n", err)
+		returnError(c, 40000, "参数错误")
+		return
+	}
+	reSupplierPreviews, err := service.CooperationService{}.SearchSupplier(param)
+	if err != nil {
+		logrus.Errorf("[SearchSupplier] call Show err:%+v\n", err)
+		returnError(c, 40000, err.Error())
+		return
+	}
+	returnSuccess(c, 20000, reSupplierPreviews)
+}
+
+// 服务商入库批量邀请
+func (o CooperationController) InviteSupplier(c *gin.Context) {
+	param := &vo.SupplierInviteParam{}
+	err := c.BindJSON(param)
+	if err != nil {
+		logrus.Errorf("Request bind err:%+v\n", err)
+		returnError(c, 40000, "参数错误")
+		return
+	}
+	err1 := service.CooperationService{}.InviteSupplier(param)
+	if err1 != nil {
+		logrus.Errorf("[InviteSupplier] call Show err:%+v\n", err)
+		returnError(c, 40000, err.Error())
+		return
+	}
+	returnSuccess(c, 20000, nil)
+}
+
+// 在库服务商列表
+func (o CooperationController) GetEnterprisePoolList(c *gin.Context) {
+	param := &vo.SupplierSearchInPoolParam{}
+	err := c.BindJSON(param)
+	if err != nil || "" == param.EnterpriseId {
+		logrus.Errorf("Request bind err:%+v\n", err)
+		returnError(c, 40000, "参数错误")
+		return
+	}
+	result, err1 := service.CooperationService{}.GetEnterprisePoolList(param)
+	if err1 != nil {
+		logrus.Errorf("[GetEnterprisePoolList] call Show err:%+v\n", err)
+		returnError(c, 40000, err.Error())
+		return
+	}
+	returnSuccess(c, 20000, result)
+}
+
+// 服务商邀请待确认列表
+func (o CooperationController) GetSupplierConfirmingList(c *gin.Context) {
+	param := &vo.SupplierConfirmingParam{}
+	err := c.BindJSON(param)
+	if err != nil || "" == param.EnterpriseId {
+		logrus.Errorf("Request bind err:%+v\n", err)
+		returnError(c, 40000, "参数错误")
+		return
+	}
+	result, err1 := service.CooperationService{}.GetSupplierConfirmingList(param)
+	if err1 != nil {
+		logrus.Errorf("[GetSupplierConfirmingList] call Show err:%+v\n", err)
+		returnError(c, 40000, err.Error())
+		return
+	}
+	returnSuccess(c, 20000, result)
+}

+ 12 - 12
app/controller/finance_controller.go

@@ -11,7 +11,7 @@ import (
 type FinanceController struct{}
 
 // 充值管理——对公转账
-func (t FinanceController) TransferToPublic(c *gin.Context) {
+func (f FinanceController) TransferToPublic(c *gin.Context) {
 	param := &vo.RechargeTransferParam{}
 	err := c.BindJSON(param)
 	if err != nil {
@@ -31,7 +31,7 @@ func (t FinanceController) TransferToPublic(c *gin.Context) {
 }
 
 // 获取微信支付CodeUrl
-func (t FinanceController) GetCodeUrl(c *gin.Context) {
+func (f FinanceController) GetCodeUrl(c *gin.Context) {
 	param := &vo.GetCodeUrlParam{}
 	err := c.BindJSON(param)
 	if err != nil {
@@ -55,7 +55,7 @@ func (t FinanceController) GetCodeUrl(c *gin.Context) {
 }
 
 // 根据交易id查询微信是否扫码付款
-func (t FinanceController) QueryOrderByTradeId(c *gin.Context) {
+func (f FinanceController) QueryOrderByTradeId(c *gin.Context) {
 	param := &vo.QueryOrderByTradeIdParam{}
 	err := c.BindJSON(param)
 	if err != nil {
@@ -75,7 +75,7 @@ func (t FinanceController) QueryOrderByTradeId(c *gin.Context) {
 }
 
 // 余额管理——总金额、可用余额、冻结金额
-func (t FinanceController) ShowBalance(c *gin.Context) {
+func (f FinanceController) ShowBalance(c *gin.Context) {
 	param := &vo.BalanceParam{}
 	err := c.BindJSON(param)
 	if err != nil {
@@ -93,7 +93,7 @@ func (t FinanceController) ShowBalance(c *gin.Context) {
 }
 
 // 余额管理——冻结记录
-func (t FinanceController) FrozenInfoList(c *gin.Context) {
+func (f FinanceController) FrozenInfoList(c *gin.Context) {
 	param := &vo.BalanceParam{}
 	err := c.BindJSON(param)
 	if err != nil {
@@ -111,7 +111,7 @@ func (t FinanceController) FrozenInfoList(c *gin.Context) {
 }
 
 // 充值管理——累计充值金额、确认中金额
-func (t FinanceController) ShowRecharge(c *gin.Context) {
+func (f FinanceController) ShowRecharge(c *gin.Context) {
 	param := &vo.RechargeParam{}
 	err := c.BindJSON(param)
 	if err != nil {
@@ -129,7 +129,7 @@ func (t FinanceController) ShowRecharge(c *gin.Context) {
 }
 
 // 充值管理——充值记录
-func (t FinanceController) RechargeInfoList(c *gin.Context) {
+func (f FinanceController) RechargeInfoList(c *gin.Context) {
 	param := &vo.RechargeParam{}
 	err := c.BindJSON(param)
 	if err != nil {
@@ -147,7 +147,7 @@ func (t FinanceController) RechargeInfoList(c *gin.Context) {
 }
 
 // 设置默认开票抬头
-func (t FinanceController) UpdateInvoiceDefault(c *gin.Context) {
+func (f FinanceController) UpdateInvoiceDefault(c *gin.Context) {
 	param := &vo.InvoiceDefaultParam{}
 	err := c.BindJSON(param)
 	if err != nil {
@@ -167,7 +167,7 @@ func (t FinanceController) UpdateInvoiceDefault(c *gin.Context) {
 }
 
 // 获取默认开票抬头
-func (t FinanceController) GetInvoiceDefault(c *gin.Context) {
+func (f FinanceController) GetInvoiceDefault(c *gin.Context) {
 	param := &vo.InvoiceDefaultParam{}
 	err := c.BindJSON(param)
 	if err != nil {
@@ -185,7 +185,7 @@ func (t FinanceController) GetInvoiceDefault(c *gin.Context) {
 }
 
 // 确认开票
-func (t FinanceController) BillInvoice(c *gin.Context) {
+func (f FinanceController) BillInvoice(c *gin.Context) {
 	param := &vo.InvoiceBillParam{}
 	err := c.BindJSON(param)
 	if err != nil || len(param.TaskIds) != 3 {
@@ -205,7 +205,7 @@ func (t FinanceController) BillInvoice(c *gin.Context) {
 }
 
 // 开票记录
-func (t FinanceController) GetBillList(c *gin.Context) {
+func (f FinanceController) GetBillList(c *gin.Context) {
 	param := &vo.InvoiceBillListParam{}
 	err := c.BindJSON(param)
 	if err != nil {
@@ -223,7 +223,7 @@ func (t FinanceController) GetBillList(c *gin.Context) {
 }
 
 // 可开票账单
-func (t FinanceController) GetBillableList(c *gin.Context) {
+func (f FinanceController) GetBillableList(c *gin.Context) {
 	param := &vo.InvoiceBillListParam{}
 	err := c.BindJSON(param)
 	if err != nil {

+ 55 - 0
app/dao/enterprise_supplier_cooperate_dao.go

@@ -0,0 +1,55 @@
+package dao
+
+import (
+	"youngee_b_api/app/entity"
+)
+
+type EnterpriseSupplierCooperateDao struct{}
+
+// 检查给定的服务商是否在该商家库中
+func (d EnterpriseSupplierCooperateDao) EnterpriseDatabaseCheck(enterpriseId string, supplierId int64) (bool, error) {
+	var count int64
+	err := Db.Debug().Model(&entity.EnterpriseSupplierCooperate{}).Where("enterprise_id = ? AND supplier_id = ? AND cooperate_status != 2", enterpriseId, supplierId).Count(&count).Error
+	if err != nil {
+		return false, err
+	}
+	return count > 0, nil
+}
+
+// 批量插入数据
+func (d EnterpriseSupplierCooperateDao) InsertBatch(records []*entity.EnterpriseSupplierCooperate) error {
+	result := Db.Debug().Model(&entity.EnterpriseSupplierCooperate{}).Omit("agree_time", "reject_time").Create(&records)
+	return result.Error
+}
+
+// 获取指定商家的服务商库
+func (d EnterpriseSupplierCooperateDao) GetSuppliersByEnterprise(enterpriseId string, page int, pageSize int) ([]*entity.EnterpriseSupplierCooperate, int64, error) {
+	var enterpriseSupplierCooperates []*entity.EnterpriseSupplierCooperate
+	var total int64
+	offset := (page - 1) * pageSize
+	query := Db.Debug().Model(&entity.EnterpriseSupplierCooperate{}).Where("enterprise_id = ? AND cooperate_status = 2", enterpriseId)
+	query.Count(&total)
+	query = query.Select("supplier_id, cooperate_num, upload_talent_num, cooperate_talent_num, b_operator, b_operator_type, agree_time")
+	err := query.Order("agree_time desc").Offset(offset).Limit(pageSize).Find(&enterpriseSupplierCooperates).Error
+	if err != nil {
+		return nil, 0, err
+	}
+
+	return enterpriseSupplierCooperates, total, nil
+}
+
+// 获取邀请待确认的服务商
+func (d EnterpriseSupplierCooperateDao) GetSupplierConfirmingList(enterpriseId string, page int, pageSize int) ([]*entity.EnterpriseSupplierCooperate, int64, error) {
+	var enterpriseSupplierCooperates []*entity.EnterpriseSupplierCooperate
+	var total int64
+	offset := (page - 1) * pageSize
+	query := Db.Debug().Model(&entity.EnterpriseSupplierCooperate{}).Where("enterprise_id = ? AND cooperate_status = 1", enterpriseId)
+	query.Count(&total)
+	query = query.Select("supplier_id,  b_operator, b_operator_type, cooperate_status, create_time")
+	err := query.Order("create_time desc").Offset(offset).Limit(pageSize).Find(&enterpriseSupplierCooperates).Error
+	if err != nil {
+		return nil, 0, err
+	}
+
+	return enterpriseSupplierCooperates, total, nil
+}

+ 1 - 1
app/dao/invoice_record_dao.go

@@ -29,7 +29,7 @@ func (d InvoiceRecordDao) GetBillList(enterpriseId string, subAccountId int64, s
 		query = query.Where("sub_account_id = ?", subAccountId)
 	}
 	query.Count(&total)
-	query = query.Select("billing_id, enterprise_id, sub_account_id, invoice_amount, invoice_body, invoice_type, task_ids, status, submit_at, billing_at")
+	query = query.Select("billing_id, enterprise_id, sub_account_id, invoice_amount, invoice_body, invoice_type, task_ids, status, submit_at, billing_at, invoice_url")
 	offset := (page - 1) * pageSize
 	var err error
 	if status == 1 {

+ 46 - 0
app/dao/supplier_dao.go

@@ -0,0 +1,46 @@
+package dao
+
+import (
+	"gorm.io/gorm"
+	"strconv"
+	"youngee_b_api/app/entity"
+)
+
+type SupplierDao struct{}
+
+func (d SupplierDao) GetSupplierInfoById(supplierId int64) (*entity.Supplier, error) {
+	var supplier entity.Supplier
+	err := Db.Debug().Model(&entity.Supplier{}).Where("supplier_id = ?", supplierId).First(&supplier).Error
+	if err != nil {
+		return nil, err
+	}
+	return &supplier, nil
+}
+
+// 根据服务商名称/认证名搜索
+func (d SupplierDao) GetSuppliersByMsg(fieldName string) ([]*entity.Supplier, error) {
+	var suppliers []*entity.Supplier
+	supplierId, err := strconv.ParseInt(fieldName, 10, 64)
+	if err == nil {
+		err1 := Db.Debug().Model(&entity.Supplier{}).Where("supplier_id = ? AND supplier_type != 0", supplierId).First(&suppliers).Error
+		if err1 != nil && err1 != gorm.ErrRecordNotFound {
+			return nil, err1
+		}
+	} else {
+		err1 := Db.Debug().Model(&entity.Supplier{}).Where("supplier_name = ? OR company_name = ? OR name = ? AND supplier_type != 0", fieldName, fieldName, fieldName).Find(&suppliers).Error
+		if err1 != nil {
+			return nil, err
+		}
+	}
+
+	return suppliers, nil
+}
+
+func (d SupplierDao) GetSupplierPhone(supplierId int64) (string, error) {
+	var phone string
+	err := Db.Debug().Model(&entity.Supplier{}).Where("supplier_id = ?", supplierId).Select("phone_number").First(&phone).Error
+	if err != nil {
+		return "", err
+	}
+	return phone, nil
+}

+ 24 - 0
app/entity/enterprise_supplier_cooperate.go

@@ -0,0 +1,24 @@
+package entity
+
+import "time"
+
+type EnterpriseSupplierCooperate struct {
+	CooperateId        int64     `gorm:"column:cooperate_id;primary_key;AUTO_INCREMENT"` // 合作表主键ID
+	EnterpriseId       string    `gorm:"column:enterprise_id"`                           // 商家ID
+	SupplierId         int64     `gorm:"column:supplier_id"`                             // 服务商ID
+	CooperateNum       int64     `gorm:"column:cooperate_num"`                           // 受邀合作次数
+	UploadTalentNum    int64     `gorm:"column:upload_talent_num"`                       // 提报达人数量
+	CooperateTalentNum int64     `gorm:"column:cooperate_talent_num"`                    // 合作达人人数
+	SOperator          int64     `gorm:"column:s_operator"`                              // 服务商同意/拒绝邀约操作人
+	SOperatorType      int64     `gorm:"column:s_operator_type"`                         // 服务商操作人类型:1主账号,2子账号
+	BOperator          string    `gorm:"column:b_operator"`                              // 商家发起入库邀约人
+	BOperatorType      int64     `gorm:"column:b_operator_type"`                         // 商家发起入库邀约人类型:1主账号,2子账号
+	CooperateStatus    int64     `gorm:"column:cooperate_status"`                        // 邀约状态:1待同意,2已同意,3已拒绝
+	CreateTime         time.Time `gorm:"column:create_time"`                             // 合作邀约时间
+	AgreeTime          time.Time `gorm:"column:agree_time"`                              // 同意邀约时间
+	RejectTime         time.Time `gorm:"column:reject_time"`                             // 拒绝邀约时间
+}
+
+func (m *EnterpriseSupplierCooperate) TableName() string {
+	return "enterprise_supplier_cooperate"
+}

+ 1 - 0
app/entity/invoice_record.go

@@ -25,6 +25,7 @@ type InvoiceRecord struct {
 	SubmitAt          time.Time `gorm:"column:submit_at;NOT NULL"`                     // 申请提交时间
 	BillingAt         time.Time `gorm:"column:billing_at;NOT NULL"`                    // 开票时间
 	TaskIds           string    `gorm:"column:task_ids;NOT NULL"`                      // 账单列表
+	InvoiceUrl        string    `gorm:"column:invoice_url;NOT NULL"`                   // 发票
 }
 
 func (m *InvoiceRecord) TableName() string {

+ 20 - 0
app/entity/supplier.go

@@ -0,0 +1,20 @@
+package entity
+
+type Supplier struct {
+	SupplierID      int64  `gorm:"column:supplier_id"`      // 服务商ID
+	SupplierName    string `gorm:"column:supplier_name"`    // 服务商名称
+	PhoneNumber     string `gorm:"column:phone_number"`     // 手机号
+	BusinessLicense string `gorm:"column:business_license"` // 营业执照url
+	USCI            string `gorm:"column:usci"`             // 统一社会信用代码
+	CompanyName     string `gorm:"column:company_name"`     // 公司名称
+	IDFront         string `gorm:"column:id_front"`         // 身份证人像面url
+	IDBack          string `gorm:"column:id_back"`          // 身份证国徽面url
+	IDNumber        string `gorm:"column:id_number"`        // 身份证号
+	Name            string `gorm:"column:name"`             // 姓名
+	UserID          int64  `gorm:"column:user_id"`          // 用户表中的用户ID
+	SupplierType    int64  `gorm:"column:supplier_type"`    // 服务商用户类型,1为个人PR,2为机构
+}
+
+func (Supplier) TableName() string {
+	return "younggee_supplier"
+}

+ 191 - 0
app/service/cooperation_service.go

@@ -0,0 +1,191 @@
+package service
+
+import (
+	"fmt"
+	"strconv"
+	"time"
+	"youngee_b_api/app/dao"
+	"youngee_b_api/app/entity"
+	"youngee_b_api/app/vo"
+)
+
+type CooperationService struct{}
+
+// 服务商搜索
+func (s CooperationService) SearchSupplier(param *vo.SupplierSearchParam) ([]*vo.ReSupplierPreview, error) {
+	var reSupplierPreviews []*vo.ReSupplierPreview
+	suppliers, err := dao.SupplierDao{}.GetSuppliersByMsg(param.FieldName)
+	if err != nil {
+		return reSupplierPreviews, err
+	}
+	for _, supplier := range suppliers {
+		// 判断该服务商是否已在商家库
+		exist, _ := dao.EnterpriseSupplierCooperateDao{}.EnterpriseDatabaseCheck(param.EnterpriseId, supplier.SupplierID)
+		reSupplierPreview := &vo.ReSupplierPreview{
+			SupplierId:   supplier.SupplierID,
+			HeadUrl:      "",
+			SupplierName: supplier.SupplierName,
+			SupplierType: supplier.SupplierType,
+			CompanyName:  supplier.CompanyName,
+			Name:         supplier.Name,
+			Existence:    exist,
+		}
+		reSupplierPreviews = append(reSupplierPreviews, reSupplierPreview)
+	}
+	return reSupplierPreviews, nil
+}
+
+// 服务商入库批量邀请
+func (s CooperationService) InviteSupplier(param *vo.SupplierInviteParam) error {
+	// 要求传入的服务商都是未在该商家库的
+	var records []*entity.EnterpriseSupplierCooperate
+	for _, supplierId := range param.SupplierIds {
+		record := &entity.EnterpriseSupplierCooperate{
+			EnterpriseId:    param.EnterpriseId,
+			SupplierId:      supplierId,
+			CooperateNum:    1,
+			CooperateStatus: 1,
+			CreateTime:      time.Now(),
+		}
+		if param.SubAccountId == 0 {
+			record.BOperator = param.EnterpriseId
+			record.BOperatorType = 1
+		} else {
+			record.BOperator = strconv.Itoa(int(param.SubAccountId))
+			record.BOperatorType = 2
+		}
+		records = append(records, record)
+	}
+	err := dao.EnterpriseSupplierCooperateDao{}.InsertBatch(records)
+
+	return err
+}
+
+// 在库服务商列表
+func (s CooperationService) GetEnterprisePoolList(param *vo.SupplierSearchInPoolParam) (vo.ResultVO, error) {
+	if param.Page <= 0 {
+		param.Page = 1
+	}
+	if param.PageSize <= 0 {
+		param.PageSize = 10
+	}
+	var result vo.ResultVO
+	var reSupplierPoolInfos []*vo.ReSupplierPoolInfo
+	var enterpriseOperator string
+	enterpriseSupplierCooperates, total, _ := dao.EnterpriseSupplierCooperateDao{}.GetSuppliersByEnterprise(param.EnterpriseId, param.Page, param.PageSize)
+	for _, enterpriseSupplierCooperate := range enterpriseSupplierCooperates {
+		// 获取商家操作人姓名
+		bOperator := enterpriseSupplierCooperate.BOperator
+		if enterpriseSupplierCooperate.BOperatorType == 1 {
+			enterprise, err := dao.EnterpriseDao{}.GetEnterprise(bOperator)
+			if err == nil && enterprise != nil {
+				enterpriseOperator = enterprise.BusinessName
+			}
+		} else if enterpriseSupplierCooperate.BOperatorType == 2 {
+			subAccountId, err := strconv.ParseInt(bOperator, 10, 64)
+			if err != nil {
+				fmt.Println("GetEnterprisePoolList==subAccountId 转换出错:", err)
+			} else {
+				subAccount, err := dao.SubAccountDao{}.GetSubAccount(subAccountId)
+				if err == nil && subAccount != nil {
+					enterpriseOperator = subAccount.SubAccountName
+				}
+			}
+		}
+		supplier, err := dao.SupplierDao{}.GetSupplierInfoById(enterpriseSupplierCooperate.SupplierId)
+		if err != nil {
+			continue
+		}
+		supplierPreview := &vo.ReSupplierPreview{
+			SupplierId:   supplier.SupplierID,
+			HeadUrl:      "",
+			SupplierName: supplier.SupplierName,
+			SupplierType: supplier.SupplierType,
+			CompanyName:  supplier.CompanyName,
+			Name:         supplier.Name,
+			Existence:    true,
+		}
+		reSupplierPoolInfo := &vo.ReSupplierPoolInfo{
+			SupplierPreview:    supplierPreview,
+			PhoneNumber:        supplier.PhoneNumber,
+			WechatId:           "",
+			WechatUrl:          "",
+			CooperateNum:       enterpriseSupplierCooperate.CooperateNum,
+			UploadTalentNum:    enterpriseSupplierCooperate.UploadTalentNum,
+			CooperateTalentNum: enterpriseSupplierCooperate.CooperateTalentNum,
+			AgreeTime:          enterpriseSupplierCooperate.AgreeTime.Format("2006-01-02 15:04:05"),
+			EnterpriseOperator: enterpriseOperator,
+		}
+		reSupplierPoolInfos = append(reSupplierPoolInfos, reSupplierPoolInfo)
+	}
+	result = vo.ResultVO{
+		Page:     param.Page,
+		PageSize: param.PageSize,
+		Total:    total,
+		Data:     reSupplierPoolInfos,
+	}
+	return result, nil
+}
+
+// 服务商邀请待确认列表
+func (s CooperationService) GetSupplierConfirmingList(param *vo.SupplierConfirmingParam) (vo.ResultVO, error) {
+	if param.Page <= 0 {
+		param.Page = 1
+	}
+	if param.PageSize <= 0 {
+		param.PageSize = 10
+	}
+	var result vo.ResultVO
+	var reSupplierConfirmingInfos []*vo.ReSupplierConfirmingInfo
+	var enterpriseOperator string
+	enterpriseSupplierCooperates, total, _ := dao.EnterpriseSupplierCooperateDao{}.GetSupplierConfirmingList(param.EnterpriseId, param.Page, param.PageSize)
+	for _, enterpriseSupplierCooperate := range enterpriseSupplierCooperates {
+		// 获取商家操作人姓名
+		bOperator := enterpriseSupplierCooperate.BOperator
+		if enterpriseSupplierCooperate.BOperatorType == 1 {
+			enterprise, err := dao.EnterpriseDao{}.GetEnterprise(bOperator)
+			if err == nil && enterprise != nil {
+				enterpriseOperator = enterprise.BusinessName
+			}
+		} else if enterpriseSupplierCooperate.BOperatorType == 2 {
+			subAccountId, err := strconv.ParseInt(bOperator, 10, 64)
+			if err != nil {
+				fmt.Println("GetSupplierConfirmingList==subAccountId 转换出错:", err)
+			} else {
+				subAccount, err := dao.SubAccountDao{}.GetSubAccount(subAccountId)
+				if err == nil && subAccount != nil {
+					enterpriseOperator = subAccount.SubAccountName
+				}
+			}
+		}
+		supplier, err := dao.SupplierDao{}.GetSupplierInfoById(enterpriseSupplierCooperate.SupplierId)
+		if err != nil {
+			continue
+		}
+		supplierPreview := &vo.ReSupplierPreview{
+			SupplierId:   supplier.SupplierID,
+			HeadUrl:      "",
+			SupplierName: supplier.SupplierName,
+			SupplierType: supplier.SupplierType,
+			CompanyName:  supplier.CompanyName,
+			Name:         supplier.Name,
+		}
+		reSupplierConfirmingInfo := &vo.ReSupplierConfirmingInfo{
+			SupplierPreview:    supplierPreview,
+			PhoneNumber:        supplier.PhoneNumber,
+			WechatId:           "",
+			WechatUrl:          "",
+			CreateTime:         enterpriseSupplierCooperate.CreateTime.Format("2006-01-02 15:04:05"),
+			Status:             enterpriseSupplierCooperate.CooperateStatus,
+			EnterpriseOperator: enterpriseOperator,
+		}
+		reSupplierConfirmingInfos = append(reSupplierConfirmingInfos, reSupplierConfirmingInfo)
+	}
+	result = vo.ResultVO{
+		Page:     param.Page,
+		PageSize: param.PageSize,
+		Total:    total,
+		Data:     reSupplierConfirmingInfos,
+	}
+	return result, nil
+}

+ 11 - 4
app/service/invoice_service.go

@@ -125,10 +125,16 @@ func (s InvoiceService) GetBillList(param *vo.InvoiceBillListParam) (vo.ResultVO
 	}
 	var result vo.ResultVO
 	var reInvoiceRecords []*vo.ReInvoiceRecord
-	invoiceRecords, total, err := dao.InvoiceRecordDao{}.GetBillList(param.EnterpriseId, param.SubAccountId, param.BillStatus, param.Page, param.PageSize)
-	if err != nil {
-		return result, err
-	}
+	invoiceRecords, total, _ := dao.InvoiceRecordDao{}.GetBillList(param.EnterpriseId, param.SubAccountId, param.BillStatus, param.Page, param.PageSize)
+	//if err != nil {
+	//	result = vo.ResultVO{
+	//		Page:     param.Page,
+	//		PageSize: param.PageSize,
+	//		Total:    total,
+	//		Data:     reInvoiceRecords,
+	//	}
+	//	return result, err
+	//}
 	for _, invoiceRecord := range invoiceRecords {
 		var creatorName string
 		if invoiceRecord.SubAccountId == 0 {
@@ -162,6 +168,7 @@ func (s InvoiceService) GetBillList(param *vo.InvoiceBillListParam) (vo.ResultVO
 			InvoiceType:   invoiceRecord.InvoiceType,
 			Status:        invoiceRecord.Status,
 			TaskNumber:    int64(taskNumber),
+			InvoiceUrl:    invoiceRecord.InvoiceUrl,
 		}
 		if param.BillStatus == 2 {
 			reInvoiceRecord.BillingAt = invoiceRecord.BillingAt.Format("2006-01-02 15:04:05")

+ 1 - 0
app/vo/re_invoice_record.go

@@ -10,4 +10,5 @@ type ReInvoiceRecord struct {
 	InvoiceType   int64   `json:"invoiceType"`
 	Status        int64   `json:"status"`
 	TaskNumber    int64   `json:"taskNumber"`
+	InvoiceUrl    string  `json:"invoiceUrl"`
 }

+ 11 - 0
app/vo/re_supplier_confirming_info.go

@@ -0,0 +1,11 @@
+package vo
+
+type ReSupplierConfirmingInfo struct {
+	SupplierPreview    *ReSupplierPreview `json:"supplierPreview"`
+	PhoneNumber        string             `json:"phoneNumber"`        // 手机号
+	WechatId           string             `json:"wechatId"`           // 微信号
+	WechatUrl          string             `json:"wechatUrl"`          // 微信二维码
+	CreateTime         string             `json:"agreeTime"`          // 邀请时间
+	EnterpriseOperator string             `json:"enterpriseOperator"` // 邀请操作人
+	Status             int64              `json:"status"`             // 状态
+}

+ 13 - 0
app/vo/re_supplier_pool_info.go

@@ -0,0 +1,13 @@
+package vo
+
+type ReSupplierPoolInfo struct {
+	SupplierPreview    *ReSupplierPreview `json:"supplierPreview"`
+	PhoneNumber        string             `json:"phoneNumber"`        // 手机号
+	WechatId           string             `json:"wechatId"`           // 微信号
+	WechatUrl          string             `json:"wechatUrl"`          // 微信二维码
+	CooperateNum       int64              `json:"cooperateNum"`       // 受邀合作次数
+	UploadTalentNum    int64              `json:"uploadTalentNum"`    // 提报达人数
+	CooperateTalentNum int64              `json:"cooperateTalentNum"` // 合作达人数
+	AgreeTime          string             `json:"agreeTime"`          // 入库时间
+	EnterpriseOperator string             `json:"enterpriseOperator"` // 邀请操作人
+}

+ 12 - 0
app/vo/re_supplier_preview.go

@@ -0,0 +1,12 @@
+package vo
+
+type ReSupplierPreview struct {
+	SupplierId   int64  `json:"supplierId"`
+	HeadUrl      string `json:"headUrl"`
+	SupplierName string `json:"supplierName"` // 服务商名称
+	SupplierType int64  `json:"supplierType"` // 服务商类型,1为个人PR,2为机构
+	CompanyName  string `json:"companyName"`  // 公司名称
+	Name         string `json:"name"`         // 个人姓名
+
+	Existence bool `json:"existence"` // 已在库
+}

+ 25 - 0
app/vo/supplier_search_param.go

@@ -0,0 +1,25 @@
+package vo
+
+type SupplierSearchParam struct {
+	FieldName    string `json:"field_name"`
+	EnterpriseId string `json:"enterprise_id"`
+	SubAccountId int64  `json:"sub_account_id"`
+}
+
+type SupplierInviteParam struct {
+	SupplierIds  []int64 `json:"supplier_ids"`
+	EnterpriseId string  `json:"enterprise_id"`
+	SubAccountId int64   `json:"sub_account_id"`
+}
+
+type SupplierSearchInPoolParam struct {
+	EnterpriseId string `json:"enterprise_id"`
+	Page         int    `json:"page"`
+	PageSize     int    `json:"page_size"`
+}
+
+type SupplierConfirmingParam struct {
+	EnterpriseId string `json:"enterprise_id"`
+	Page         int    `json:"page"`
+	PageSize     int    `json:"page_size"`
+}

+ 10 - 0
route/init.go

@@ -243,5 +243,15 @@ func InitRoute(r *gin.Engine) {
 		finance.POST("/invoice/list/bill", controller.FinanceController{}.GetBillList)               // 开票记录
 		finance.POST("/invoice/list/billable", controller.FinanceController{}.GetBillableList)       // 可开票账单
 	}
+	// 推广合作-服务商相关接口
+	cooperation := r.Group("/youngee/b/cooperation/supplier")
+	{
+		cooperation.Use(middleware.LoginAuthMiddleware)
+		cooperation.POST("/link", controller.CooperationController{}.GetSupplierLink)                 // 服务商端链接
+		cooperation.POST("/search", controller.CooperationController{}.SearchSupplier)                // 服务商搜索
+		cooperation.POST("/invite", controller.CooperationController{}.InviteSupplier)                // 服务商入库批量邀请
+		cooperation.POST("/inPool", controller.CooperationController{}.GetEnterprisePoolList)         // 在库服务商列表
+		cooperation.POST("/confirming", controller.CooperationController{}.GetSupplierConfirmingList) // 邀请待确认服务商列表
+	}
 
 }