|
@@ -23,7 +23,7 @@ func (s CooperationService) SearchSupplier(param *vo.SupplierSearchParam) ([]*vo
|
|
|
exist, _ := dao.EnterpriseSupplierCooperateDao{}.EnterpriseDatabaseCheck(param.EnterpriseId, supplier.SupplierID)
|
|
|
reSupplierPreview := &vo.ReSupplierPreview{
|
|
|
SupplierId: supplier.SupplierID,
|
|
|
- HeadUrl: "",
|
|
|
+ HeadUrl: supplier.Avatar,
|
|
|
SupplierName: supplier.SupplierName,
|
|
|
SupplierType: supplier.SupplierType,
|
|
|
CompanyName: supplier.CompanyName,
|
|
@@ -98,7 +98,7 @@ func (s CooperationService) GetEnterprisePoolList(param *vo.SupplierSearchInPool
|
|
|
}
|
|
|
supplierPreview := &vo.ReSupplierPreview{
|
|
|
SupplierId: supplier.SupplierID,
|
|
|
- HeadUrl: "",
|
|
|
+ HeadUrl: supplier.Avatar,
|
|
|
SupplierName: supplier.SupplierName,
|
|
|
SupplierType: supplier.SupplierType,
|
|
|
CompanyName: supplier.CompanyName,
|
|
@@ -108,8 +108,8 @@ func (s CooperationService) GetEnterprisePoolList(param *vo.SupplierSearchInPool
|
|
|
reSupplierPoolInfo := &vo.ReSupplierPoolInfo{
|
|
|
SupplierPreview: supplierPreview,
|
|
|
PhoneNumber: supplier.PhoneNumber,
|
|
|
- WechatId: "",
|
|
|
- WechatUrl: "",
|
|
|
+ WechatId: supplier.WechatNumber,
|
|
|
+ WechatUrl: supplier.WechatQrcode,
|
|
|
CooperateNum: enterpriseSupplierCooperate.CooperateNum,
|
|
|
UploadTalentNum: enterpriseSupplierCooperate.UploadTalentNum,
|
|
|
CooperateTalentNum: enterpriseSupplierCooperate.CooperateTalentNum,
|
|
@@ -164,24 +164,25 @@ func (s CooperationService) GetSupplierConfirmingList(param *vo.SupplierConfirmi
|
|
|
if err == nil {
|
|
|
supplierPreview = &vo.ReSupplierPreview{
|
|
|
SupplierId: supplier.SupplierID,
|
|
|
- HeadUrl: "",
|
|
|
+ HeadUrl: supplier.Avatar,
|
|
|
SupplierName: supplier.SupplierName,
|
|
|
SupplierType: supplier.SupplierType,
|
|
|
CompanyName: supplier.CompanyName,
|
|
|
Name: supplier.Name,
|
|
|
}
|
|
|
phoneNumber = supplier.PhoneNumber
|
|
|
+ reSupplierConfirmingInfo := &vo.ReSupplierConfirmingInfo{
|
|
|
+ SupplierPreview: supplierPreview,
|
|
|
+ PhoneNumber: phoneNumber,
|
|
|
+ WechatId: supplier.WechatNumber,
|
|
|
+ WechatUrl: supplier.WechatQrcode,
|
|
|
+ CreateTime: enterpriseSupplierCooperate.CreateTime.Format("2006-01-02 15:04:05"),
|
|
|
+ Status: enterpriseSupplierCooperate.CooperateStatus,
|
|
|
+ EnterpriseOperator: enterpriseOperator,
|
|
|
+ }
|
|
|
+ reSupplierConfirmingInfos = append(reSupplierConfirmingInfos, reSupplierConfirmingInfo)
|
|
|
}
|
|
|
- reSupplierConfirmingInfo := &vo.ReSupplierConfirmingInfo{
|
|
|
- SupplierPreview: supplierPreview,
|
|
|
- PhoneNumber: 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,
|
|
@@ -227,6 +228,31 @@ func (s CooperationService) GetSupplierInTargetTaskList(param *vo.SupplierSearch
|
|
|
var enterpriseOperator string
|
|
|
if param.Status == 1 { // 可邀约
|
|
|
enterpriseSupplierCooperates, total, _ = dao.EnterpriseSupplierCooperateDao{}.GetSupplierByEnterprise(param.EnterpriseId, param.Page, param.PageSize)
|
|
|
+ if param.TaskType == 2 {
|
|
|
+ // 品牌种草
|
|
|
+ // 去除当前project_id、supplier_id已在 s_project_info中的数据
|
|
|
+ var resEnterpriseSuppliers []*entity.EnterpriseSupplierCooperate
|
|
|
+ for _, enterpriseSupplier := range enterpriseSupplierCooperates {
|
|
|
+ var sProject *entity.SProjectInfo
|
|
|
+ _ = dao.Db.Model(&entity.SProjectInfo{}).Where("project_id = ? and supplier_id = ?", param.TaskId, enterpriseSupplier.SupplierId).Find(&sProject).Error
|
|
|
+ if sProject == nil {
|
|
|
+ resEnterpriseSuppliers = append(resEnterpriseSuppliers, enterpriseSupplier)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ enterpriseSupplierCooperates = resEnterpriseSuppliers
|
|
|
+ } else if param.TaskType == 3 {
|
|
|
+ // 本地生活
|
|
|
+ // 去除当前 local_id、supplier_id 已在 s_local_info中的数据
|
|
|
+ var resEnterpriseSuppliers []*entity.EnterpriseSupplierCooperate
|
|
|
+ for _, enterpriseSupplier := range enterpriseSupplierCooperates {
|
|
|
+ var sLocalLifeInfo *entity.SLocalLifeInfo
|
|
|
+ _ = dao.Db.Model(&entity.SLocalLifeInfo{}).Where("local_id = ? and supplier_id = ?", param.TaskId, enterpriseSupplier.SupplierId).Find(&sLocalLifeInfo).Error
|
|
|
+ if sLocalLifeInfo == nil {
|
|
|
+ resEnterpriseSuppliers = append(resEnterpriseSuppliers, enterpriseSupplier)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ enterpriseSupplierCooperates = resEnterpriseSuppliers
|
|
|
+ }
|
|
|
} else if param.Status == 2 { // 邀约中
|
|
|
if param.TaskType == 2 {
|
|
|
// 品牌种草
|
|
@@ -244,6 +270,7 @@ func (s CooperationService) GetSupplierInTargetTaskList(param *vo.SupplierSearch
|
|
|
sLocalLifeInfos, total, _ = dao.SLocalLifeDao{}.GetSLocalLifeByStatus(param.TaskId, 2, param.Page, param.PageSize)
|
|
|
}
|
|
|
}
|
|
|
+ // 针对邀约中、合作中情形
|
|
|
if enterpriseSupplierCooperates == nil {
|
|
|
if param.TaskType == 2 { // 种草
|
|
|
for _, sProjectInfo := range sProjectInfos {
|
|
@@ -288,10 +315,10 @@ func (s CooperationService) GetSupplierInTargetTaskList(param *vo.SupplierSearch
|
|
|
supplier, err := dao.SupplierDao{}.GetSupplierInfoById(enterpriseSupplierCooperate.SupplierId)
|
|
|
var supplierPreview *vo.ReSupplierPreview
|
|
|
var phoneNumber string
|
|
|
- if err == nil {
|
|
|
+ if err == nil && supplier != nil {
|
|
|
supplierPreview = &vo.ReSupplierPreview{
|
|
|
SupplierId: supplier.SupplierID,
|
|
|
- HeadUrl: "",
|
|
|
+ HeadUrl: supplier.Avatar,
|
|
|
SupplierName: supplier.SupplierName,
|
|
|
SupplierType: supplier.SupplierType,
|
|
|
CompanyName: supplier.CompanyName,
|
|
@@ -299,19 +326,19 @@ func (s CooperationService) GetSupplierInTargetTaskList(param *vo.SupplierSearch
|
|
|
Existence: true,
|
|
|
}
|
|
|
phoneNumber = supplier.PhoneNumber
|
|
|
+ reSupplierTargetTask := &vo.ReSupplierTargetTask{
|
|
|
+ SupplierPreview: supplierPreview,
|
|
|
+ PhoneNumber: phoneNumber,
|
|
|
+ WechatId: supplier.WechatNumber,
|
|
|
+ WechatUrl: supplier.WechatQrcode,
|
|
|
+ CooperateNum: enterpriseSupplierCooperate.CooperateNum,
|
|
|
+ UploadTalentNum: enterpriseSupplierCooperate.UploadTalentNum,
|
|
|
+ CooperateTalentNum: enterpriseSupplierCooperate.CooperateTalentNum,
|
|
|
+ EnterpriseOperator: enterpriseOperator,
|
|
|
+ Status: param.Status,
|
|
|
+ }
|
|
|
+ reSupplierTargetTasks = append(reSupplierTargetTasks, reSupplierTargetTask)
|
|
|
}
|
|
|
- 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,
|
|
@@ -348,8 +375,9 @@ func (t CooperationService) GetSupplierInTargetCount(param *vo.SupplierSearchInT
|
|
|
|
|
|
// 服务商合作-邀约合作
|
|
|
func (s CooperationService) InviteSupplierInTargetTask(param *vo.SupplierInviteInTargetTaskParam) error {
|
|
|
- var sProjectInfo entity.SProjectInfo
|
|
|
+ var err error
|
|
|
if param.TaskType == 2 {
|
|
|
+ var sProjectInfo entity.SProjectInfo
|
|
|
sProjectInfo.ProjectID = param.TaskId
|
|
|
sProjectInfo.SupplierID = param.SupplierId
|
|
|
sProjectInfo.SProjectStatus = 1
|
|
@@ -379,9 +407,43 @@ func (s CooperationService) InviteSupplierInTargetTask(param *vo.SupplierInviteI
|
|
|
//sProjectInfo.ApplyNum = project.ApplyNum
|
|
|
//sProjectInfo.RecruitNum = project.RecruitNum
|
|
|
}
|
|
|
+ err = dao.SProjectDao{}.Insert(&sProjectInfo)
|
|
|
+
|
|
|
} else if param.TaskType == 3 {
|
|
|
// 本地生活
|
|
|
+ var sLocalLifeInfo entity.SLocalLifeInfo
|
|
|
+ sLocalLifeInfo.LocalID = param.TaskId
|
|
|
+ sLocalLifeInfo.SupplierID = param.SupplierId
|
|
|
+ sLocalLifeInfo.SLocalStatus = 1
|
|
|
+ t := time.Now()
|
|
|
+ sLocalLifeInfo.CreateTime = &t
|
|
|
+ if param.SubAccountId == 0 {
|
|
|
+ sLocalLifeInfo.BOperator = param.EnterpriseId
|
|
|
+ sLocalLifeInfo.BOperatorType = 1
|
|
|
+ } else {
|
|
|
+ sLocalLifeInfo.BOperator = strconv.Itoa(int(param.SubAccountId))
|
|
|
+ sLocalLifeInfo.BOperatorType = 2
|
|
|
+ }
|
|
|
+ // 查找该 localId 对应的信息
|
|
|
+ localLife, err1 := dao.LocalLifeDao{}.GetLocalById(param.TaskId)
|
|
|
+ if err1 != nil {
|
|
|
+ return err1
|
|
|
+ }
|
|
|
+ if localLife != nil {
|
|
|
+ sLocalLifeInfo.StoreID = localLife.StoreID
|
|
|
+ sLocalLifeInfo.TeamBuyingID = localLife.TeamBuyingId
|
|
|
+ sLocalLifeInfo.LocalName = localLife.LocalName
|
|
|
+ sLocalLifeInfo.TaskStatus = localLife.TaskStatus
|
|
|
+ sLocalLifeInfo.LocalType = localLife.LocalType
|
|
|
+ sLocalLifeInfo.LocalPlatform = localLife.LocalPlatform
|
|
|
+ sLocalLifeInfo.TaskForm = localLife.TaskForm
|
|
|
+ sLocalLifeInfo.ContentType = localLife.ContentType
|
|
|
+ sLocalLifeInfo.EnterpriseID = param.EnterpriseId
|
|
|
+ //sProjectInfo.ApplyNum = project.ApplyNum
|
|
|
+ //sProjectInfo.RecruitNum = project.RecruitNum
|
|
|
+ }
|
|
|
+ err = dao.SLocalLifeDao{}.Insert(&sLocalLifeInfo)
|
|
|
}
|
|
|
- err := dao.SProjectDao{}.Insert(&sProjectInfo)
|
|
|
+
|
|
|
return err
|
|
|
}
|