|
@@ -1,6 +1,7 @@
|
|
package service
|
|
package service
|
|
|
|
|
|
import (
|
|
import (
|
|
|
|
+ "encoding/json"
|
|
"errors"
|
|
"errors"
|
|
"fmt"
|
|
"fmt"
|
|
"gorm.io/gorm"
|
|
"gorm.io/gorm"
|
|
@@ -282,10 +283,63 @@ func (t CooperationService) GetSupplierPerform(param *vo.SupplierDataParam) (vo.
|
|
Data: supplierDataParams,
|
|
Data: supplierDataParams,
|
|
}
|
|
}
|
|
// 获取supplierId下的所有任务,再根据任务获取数据
|
|
// 获取supplierId下的所有任务,再根据任务获取数据
|
|
-
|
|
|
|
- supplierDataParams = append(supplierDataParams, &vo.SupplierPerformance{
|
|
|
|
- ProductName: "xxxxxx",
|
|
|
|
- })
|
|
|
|
|
|
+ if param.TaskType == 2 {
|
|
|
|
+ projectTaskLinkStatistics, total1, err1 := dao.ProjectTaskLinkStatisticDao{}.GetProjectList(param.SupplierId, param.Page, param.PageSize)
|
|
|
|
+ total = total1
|
|
|
|
+ if err1 != nil {
|
|
|
|
+ return result, err1
|
|
|
|
+ }
|
|
|
|
+ for _, projectTaskLinkStatistic := range projectTaskLinkStatistics {
|
|
|
|
+ var perform vo.SupplierPerformance
|
|
|
|
+ projectId := projectTaskLinkStatistic.ProjectID
|
|
|
|
+ project, err2 := dao.ProjectDAO{}.GetProjectById(projectId)
|
|
|
|
+ if err2 != nil {
|
|
|
|
+ return result, err2
|
|
|
|
+ }
|
|
|
|
+ var product entity.Product
|
|
|
|
+ var productMainPhoto entity.ProductPhoto
|
|
|
|
+ err11 := json.Unmarshal([]byte(project.ProductSnap), &product)
|
|
|
|
+ err12 := json.Unmarshal([]byte(project.ProductPhotoSnap), &productMainPhoto)
|
|
|
|
+ if err11 != nil && err12 != nil {
|
|
|
|
+ perform.MainImage = productMainPhoto.PhotoUrl
|
|
|
|
+ perform.ProductName = product.ProductName
|
|
|
|
+ perform.Price = product.ProductPrice
|
|
|
|
+ perform.ViewCount = projectTaskLinkStatistic.ViewCount
|
|
|
|
+ perform.VoteCount = projectTaskLinkStatistic.VoteCount
|
|
|
|
+ perform.CollectCount = projectTaskLinkStatistic.CollectionCount
|
|
|
|
+ perform.CommentCount = projectTaskLinkStatistic.CommitCount
|
|
|
|
+ }
|
|
|
|
+ supplierDataParams = append(supplierDataParams, &perform)
|
|
|
|
+ }
|
|
|
|
+ } else if param.TaskType == 3 {
|
|
|
|
+ localTaskLinkStatistics, total1, err1 := dao.LocalTaskLinkStatisticDao{}.GetLocalList(param.SupplierId, param.Page, param.PageSize)
|
|
|
|
+ total = total1
|
|
|
|
+ if err1 != nil {
|
|
|
|
+ return result, err1
|
|
|
|
+ }
|
|
|
|
+ for _, localTaskLinkStatistic := range localTaskLinkStatistics {
|
|
|
|
+ var perform vo.SupplierPerformance
|
|
|
|
+ localId := localTaskLinkStatistic.LocalID
|
|
|
|
+ local, err2 := dao.LocalLifeDao{}.GetLocalById(localId)
|
|
|
|
+ if err2 != nil {
|
|
|
|
+ return result, err2
|
|
|
|
+ }
|
|
|
|
+ store, err11 := dao.StoreDao{}.GetStoreByID(local.StoreID)
|
|
|
|
+ if err11 == nil && store != nil {
|
|
|
|
+ photoUrl, e := dao.ProductPhotoDAO{}.GetMainPhotoByStoreID(store.StoreID)
|
|
|
|
+ if e != nil {
|
|
|
|
+ photoUrl = ""
|
|
|
|
+ }
|
|
|
|
+ perform.MainImage = photoUrl
|
|
|
|
+ perform.StoreName = store.StoreName
|
|
|
|
+ perform.ViewCount = localTaskLinkStatistic.ViewCount
|
|
|
|
+ perform.VoteCount = localTaskLinkStatistic.VoteCount
|
|
|
|
+ perform.CollectCount = localTaskLinkStatistic.CollectionCount
|
|
|
|
+ perform.CommentCount = localTaskLinkStatistic.CommitCount
|
|
|
|
+ }
|
|
|
|
+ supplierDataParams = append(supplierDataParams, &perform)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
result = vo.ResultVO{
|
|
result = vo.ResultVO{
|
|
Page: param.Page,
|
|
Page: param.Page,
|