|
@@ -72,7 +72,7 @@ func (s CooperationService) GetEnterprisePoolList(param *vo.SupplierSearchInPool
|
|
|
var result vo.ResultVO
|
|
|
var reSupplierPoolInfos []*vo.ReSupplierPoolInfo
|
|
|
var enterpriseOperator string
|
|
|
- enterpriseSupplierCooperates, total, _ := dao.EnterpriseSupplierCooperateDao{}.GetSuppliersByEnterprise(param.EnterpriseId, param.Page, param.PageSize)
|
|
|
+ enterpriseSupplierCooperates, total, _ := dao.EnterpriseSupplierCooperateDao{}.GetSupplierByEnterprise(param.EnterpriseId, param.Page, param.PageSize)
|
|
|
for _, enterpriseSupplierCooperate := range enterpriseSupplierCooperates {
|
|
|
// 获取商家操作人姓名
|
|
|
bOperator := enterpriseSupplierCooperate.BOperator
|
|
@@ -159,20 +159,22 @@ func (s CooperationService) GetSupplierConfirmingList(param *vo.SupplierConfirmi
|
|
|
}
|
|
|
}
|
|
|
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,
|
|
|
+ var supplierPreview *vo.ReSupplierPreview
|
|
|
+ var phoneNumber string
|
|
|
+ if err == nil {
|
|
|
+ supplierPreview = &vo.ReSupplierPreview{
|
|
|
+ SupplierId: supplier.SupplierID,
|
|
|
+ HeadUrl: "",
|
|
|
+ SupplierName: supplier.SupplierName,
|
|
|
+ SupplierType: supplier.SupplierType,
|
|
|
+ CompanyName: supplier.CompanyName,
|
|
|
+ Name: supplier.Name,
|
|
|
+ }
|
|
|
+ phoneNumber = supplier.PhoneNumber
|
|
|
}
|
|
|
reSupplierConfirmingInfo := &vo.ReSupplierConfirmingInfo{
|
|
|
SupplierPreview: supplierPreview,
|
|
|
- PhoneNumber: supplier.PhoneNumber,
|
|
|
+ PhoneNumber: phoneNumber,
|
|
|
WechatId: "",
|
|
|
WechatUrl: "",
|
|
|
CreateTime: enterpriseSupplierCooperate.CreateTime.Format("2006-01-02 15:04:05"),
|
|
@@ -189,3 +191,134 @@ func (s CooperationService) GetSupplierConfirmingList(param *vo.SupplierConfirmi
|
|
|
}
|
|
|
return result, nil
|
|
|
}
|
|
|
+
|
|
|
+// 服务商合作-服务商列表
|
|
|
+func (s CooperationService) GetSupplierInTargetTaskList(param *vo.SupplierSearchInTargetTaskParam) (vo.ResultVO, error) {
|
|
|
+ if param.Page <= 0 {
|
|
|
+ param.Page = 1
|
|
|
+ }
|
|
|
+ if param.PageSize <= 0 {
|
|
|
+ param.PageSize = 10
|
|
|
+ }
|
|
|
+ var reSupplierTargetTasks []*vo.ReSupplierTargetTask
|
|
|
+ var total int64
|
|
|
+ result := vo.ResultVO{
|
|
|
+ Page: param.Page,
|
|
|
+ PageSize: param.PageSize,
|
|
|
+ Total: total,
|
|
|
+ Data: reSupplierTargetTasks,
|
|
|
+ }
|
|
|
+ var enterpriseSupplierCooperates []*entity.EnterpriseSupplierCooperate
|
|
|
+ var sProjectInfos []*entity.SProjectInfo
|
|
|
+ var enterpriseOperator string
|
|
|
+ if param.Status == 1 { // 可邀约
|
|
|
+ enterpriseSupplierCooperates, total, _ = dao.EnterpriseSupplierCooperateDao{}.GetSupplierByEnterprise(param.EnterpriseId, param.Page, param.PageSize)
|
|
|
+ } else if param.Status == 2 { // 邀约中
|
|
|
+ if param.TaskType == 2 {
|
|
|
+ // 品牌种草
|
|
|
+ sProjectInfos, total, _ = dao.SProjectDao{}.GetSProjectByStatus(param.TaskId, 1, param.Page, param.PageSize)
|
|
|
+ } else if param.TaskType == 3 {
|
|
|
+ // 本地生活
|
|
|
+
|
|
|
+ }
|
|
|
+ } else if param.Status == 3 { // 合作中
|
|
|
+ if param.TaskType == 2 {
|
|
|
+ // 品牌种草
|
|
|
+ sProjectInfos, total, _ = dao.SProjectDao{}.GetSProjectByStatus(param.TaskId, 2, param.Page, param.PageSize)
|
|
|
+ } else if param.TaskType == 3 {
|
|
|
+ // 本地生活
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if enterpriseSupplierCooperates == nil {
|
|
|
+ if param.TaskType == 2 { // 种草
|
|
|
+ for _, sProjectInfo := range sProjectInfos {
|
|
|
+ supplierId := sProjectInfo.SupplierId
|
|
|
+ enterpriseSupplierCooperate, err1 := dao.EnterpriseSupplierCooperateDao{}.GetDataByEnterpriseAndSupplier(param.EnterpriseId, supplierId)
|
|
|
+ if err1 != nil {
|
|
|
+ return result, err1
|
|
|
+ }
|
|
|
+ enterpriseSupplierCooperates = append(enterpriseSupplierCooperates, enterpriseSupplierCooperate)
|
|
|
+ }
|
|
|
+ } else if param.TaskType == 3 {
|
|
|
+ // 本地生活
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ 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)
|
|
|
+ var supplierPreview *vo.ReSupplierPreview
|
|
|
+ var phoneNumber string
|
|
|
+ if err == nil {
|
|
|
+ supplierPreview = &vo.ReSupplierPreview{
|
|
|
+ SupplierId: supplier.SupplierID,
|
|
|
+ HeadUrl: "",
|
|
|
+ SupplierName: supplier.SupplierName,
|
|
|
+ SupplierType: supplier.SupplierType,
|
|
|
+ CompanyName: supplier.CompanyName,
|
|
|
+ Name: supplier.Name,
|
|
|
+ Existence: true,
|
|
|
+ }
|
|
|
+ phoneNumber = supplier.PhoneNumber
|
|
|
+ }
|
|
|
+ reSupplierTargetTask := &vo.ReSupplierTargetTask{
|
|
|
+ SupplierPreview: supplierPreview,
|
|
|
+ PhoneNumber: phoneNumber,
|
|
|
+ WechatId: "",
|
|
|
+ WechatUrl: "",
|
|
|
+ CooperateNum: enterpriseSupplierCooperate.CooperateNum,
|
|
|
+ UploadTalentNum: enterpriseSupplierCooperate.UploadTalentNum,
|
|
|
+ CooperateTalentNum: enterpriseSupplierCooperate.CooperateTalentNum,
|
|
|
+ EnterpriseOperator: enterpriseOperator,
|
|
|
+ Status: param.Status,
|
|
|
+ }
|
|
|
+ reSupplierTargetTasks = append(reSupplierTargetTasks, reSupplierTargetTask)
|
|
|
+ }
|
|
|
+ result = vo.ResultVO{
|
|
|
+ Page: param.Page,
|
|
|
+ PageSize: param.PageSize,
|
|
|
+ Total: total,
|
|
|
+ Data: reSupplierTargetTasks,
|
|
|
+ }
|
|
|
+ return result, nil
|
|
|
+}
|
|
|
+
|
|
|
+// 服务商合作-邀约合作
|
|
|
+func (s CooperationService) InviteSupplierInTargetTask(param *vo.SupplierInviteInTargetTaskParam) error {
|
|
|
+ var sProjectInfo entity.SProjectInfo
|
|
|
+ if param.TaskType == 2 {
|
|
|
+ sProjectInfo.ProjectId = param.TaskId
|
|
|
+ sProjectInfo.SupplierId = param.SupplierId
|
|
|
+ sProjectInfo.SProjectStatus = 1
|
|
|
+ sProjectInfo.CreateTime = time.Now()
|
|
|
+ if param.SubAccountId == 0 {
|
|
|
+ sProjectInfo.BOperator = param.EnterpriseId
|
|
|
+ sProjectInfo.BOperatorType = 1
|
|
|
+ } else {
|
|
|
+ sProjectInfo.BOperator = strconv.Itoa(int(param.SubAccountId))
|
|
|
+ sProjectInfo.BOperatorType = 2
|
|
|
+ }
|
|
|
+ } else if param.TaskType == 3 {
|
|
|
+ // 本地生活
|
|
|
+ }
|
|
|
+ err := dao.SProjectDao{}.Insert(&sProjectInfo)
|
|
|
+ return err
|
|
|
+}
|