|
@@ -0,0 +1,173 @@
|
|
|
+package service
|
|
|
+
|
|
|
+import (
|
|
|
+ "youngee_b_api/app/dao"
|
|
|
+ "youngee_b_api/app/vo"
|
|
|
+)
|
|
|
+
|
|
|
+type DefaultService struct{}
|
|
|
+
|
|
|
+// 违约管理——违约公开任务列表
|
|
|
+func (s DefaultService) GetPublicDefaultList(param *vo.DefaultSearchParam) (vo.ResultVO, error) {
|
|
|
+ if param.Page == 0 {
|
|
|
+ param.Page = 1
|
|
|
+ }
|
|
|
+ if param.PageSize == 0 {
|
|
|
+ param.PageSize = 10
|
|
|
+ }
|
|
|
+ var result vo.ResultVO
|
|
|
+ // 以下代码只考虑了种草
|
|
|
+ reTaskDefaultPublics, total, err := (&dao.ProjectDAO{}).GetProjectPublicList(param)
|
|
|
+ if err != nil {
|
|
|
+ return result, err
|
|
|
+ }
|
|
|
+ for i := range reTaskDefaultPublics {
|
|
|
+ // 获取商品详情字段
|
|
|
+ var creatorName string
|
|
|
+ var productName string
|
|
|
+ var productPrice float64
|
|
|
+ var mainImage string
|
|
|
+ if reTaskDefaultPublics[i].SubAccountId == 0 {
|
|
|
+ enterprise, err := dao.EnterpriseDao{}.GetEnterprise(reTaskDefaultPublics[i].EnterpriseId)
|
|
|
+ if err == nil && enterprise != nil {
|
|
|
+ creatorName = enterprise.BusinessName
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ subAccount, err := dao.SubAccountDao{}.GetSubAccount(reTaskDefaultPublics[i].SubAccountId)
|
|
|
+ if err == nil && subAccount != nil {
|
|
|
+ creatorName = subAccount.SubAccountName
|
|
|
+ }
|
|
|
+ }
|
|
|
+ product, err := dao.ProductDAO{}.GetProductByID(reTaskDefaultPublics[i].ProductId)
|
|
|
+ if err == nil && product != nil {
|
|
|
+ productName = product.ProductName
|
|
|
+ productPrice = product.ProductPrice
|
|
|
+ }
|
|
|
+ mainImage, err = dao.ProductPhotoDAO{}.GetMainPhotoByProductID(reTaskDefaultPublics[i].ProductId)
|
|
|
+ reTaskDefaultPublics[i].CreatorName = creatorName
|
|
|
+ reTaskDefaultPublics[i].ProductName = productName
|
|
|
+ reTaskDefaultPublics[i].ProductPrice = productPrice
|
|
|
+ reTaskDefaultPublics[i].MainImage = mainImage
|
|
|
+ // 获取未传数量字段 0-10分别表示未违约、脚本超时违约、脚本未上传违约、初稿超时违约、初稿未上传违约、链接超时违约、链接未上传违约、数据超时违约、数据未上传违约、解约待处理、解约
|
|
|
+ projectId := reTaskDefaultPublics[i].TaskId
|
|
|
+ noSketchNum := dao.ProjectTaskInfoDao{}.CountByDefaultType(projectId, 4)
|
|
|
+ noLinkNum := dao.ProjectTaskInfoDao{}.CountByDefaultType(projectId, 6)
|
|
|
+ noDataNum := dao.ProjectTaskInfoDao{}.CountByDefaultType(projectId, 8)
|
|
|
+ // 终止合作还是解约字段待确认
|
|
|
+ endCooperationNum := dao.ProjectTaskInfoDao{}.CountByTaskStage(projectId, 17)
|
|
|
+ reTaskDefaultPublics[i].NoSketchNum = noSketchNum
|
|
|
+ reTaskDefaultPublics[i].NoLinkNum = noLinkNum
|
|
|
+ reTaskDefaultPublics[i].NoDataNum = noDataNum
|
|
|
+ reTaskDefaultPublics[i].EndCooperationNum = endCooperationNum
|
|
|
+ }
|
|
|
+ result = vo.ResultVO{
|
|
|
+ Page: param.Page,
|
|
|
+ PageSize: param.PageSize,
|
|
|
+ Total: total,
|
|
|
+ Data: reTaskDefaultPublics,
|
|
|
+ }
|
|
|
+ return result, nil
|
|
|
+}
|
|
|
+
|
|
|
+// 违约管理——违约定向任务列表
|
|
|
+func (s DefaultService) GetTargetDefaultList(param *vo.DefaultSearchParam) (vo.ResultVO, error) {
|
|
|
+ if param.Page == 0 {
|
|
|
+ param.Page = 1
|
|
|
+ }
|
|
|
+ if param.PageSize == 0 {
|
|
|
+ param.PageSize = 10
|
|
|
+ }
|
|
|
+ var result vo.ResultVO
|
|
|
+ // 以下代码只考虑了种草
|
|
|
+ reTaskDefaultTargets, total, err := (&dao.ProjectDAO{}).GetProjectTargetList(param)
|
|
|
+ if err != nil {
|
|
|
+ return result, err
|
|
|
+ }
|
|
|
+ for i := range reTaskDefaultTargets {
|
|
|
+ // 获取商品详情字段
|
|
|
+ var creatorName string
|
|
|
+ var productName string
|
|
|
+ var productPrice float64
|
|
|
+ var mainImage string
|
|
|
+ if reTaskDefaultTargets[i].SubAccountId == 0 {
|
|
|
+ enterprise, err := dao.EnterpriseDao{}.GetEnterprise(reTaskDefaultTargets[i].EnterpriseId)
|
|
|
+ if err == nil && enterprise != nil {
|
|
|
+ creatorName = enterprise.BusinessName
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ subAccount, err := dao.SubAccountDao{}.GetSubAccount(reTaskDefaultTargets[i].SubAccountId)
|
|
|
+ if err == nil && subAccount != nil {
|
|
|
+ creatorName = subAccount.SubAccountName
|
|
|
+ }
|
|
|
+ }
|
|
|
+ product, err := dao.ProductDAO{}.GetProductByID(reTaskDefaultTargets[i].ProductId)
|
|
|
+ if err == nil && product != nil {
|
|
|
+ productName = product.ProductName
|
|
|
+ productPrice = product.ProductPrice
|
|
|
+ }
|
|
|
+ mainImage, err = dao.ProductPhotoDAO{}.GetMainPhotoByProductID(reTaskDefaultTargets[i].ProductId)
|
|
|
+ reTaskDefaultTargets[i].CreatorName = creatorName
|
|
|
+ reTaskDefaultTargets[i].ProductName = productName
|
|
|
+ reTaskDefaultTargets[i].ProductPrice = productPrice
|
|
|
+ reTaskDefaultTargets[i].MainImage = mainImage
|
|
|
+ // 终止合作还是解约字段待确认
|
|
|
+ endCooperationNum := dao.ProjectTaskInfoDao{}.CountByTaskStage(reTaskDefaultTargets[i].TaskId, 17)
|
|
|
+ reTaskDefaultTargets[i].EndCooperationNum = endCooperationNum
|
|
|
+ }
|
|
|
+ result = vo.ResultVO{
|
|
|
+ Page: param.Page,
|
|
|
+ PageSize: param.PageSize,
|
|
|
+ Total: total,
|
|
|
+ Data: reTaskDefaultTargets,
|
|
|
+ }
|
|
|
+ return result, nil
|
|
|
+}
|
|
|
+
|
|
|
+// 违约管理——未传初稿公开任务列表
|
|
|
+func (s DefaultService) GetPublicDefaultTalentList(param *vo.DefaultSearchParam) (vo.ResultVO, error) {
|
|
|
+ if param.Page == 0 {
|
|
|
+ param.Page = 1
|
|
|
+ }
|
|
|
+ if param.PageSize == 0 {
|
|
|
+ param.PageSize = 10
|
|
|
+ }
|
|
|
+ var result vo.ResultVO
|
|
|
+ var reTalentDefaults []*vo.ReTalentDefault
|
|
|
+ // 以下代码只考虑了种草
|
|
|
+ if param.DefaultType == 1 {
|
|
|
+ projectTaskInfos, total, err := (&dao.ProjectTaskInfoDao{}).GetListBySketchDefault(param)
|
|
|
+ } else if param.DefaultType == 2 {
|
|
|
+
|
|
|
+ } else if param.DefaultType == 3 {
|
|
|
+
|
|
|
+ } else if param.DefaultType == 4 {
|
|
|
+
|
|
|
+ }
|
|
|
+ projectTaskInfos, total, err := (&dao.ProjectTaskInfoDao{}).GetListByDefaultType(param)
|
|
|
+ if err != nil {
|
|
|
+ return result, err
|
|
|
+ }
|
|
|
+ for _, projectTaskInfo := range projectTaskInfos {
|
|
|
+ talentId := projectTaskInfo.TalentID
|
|
|
+ reTalentDefault := &vo.ReTalentDefault{
|
|
|
+ TalentId: talentId,
|
|
|
+ DraftFee: projectTaskInfo.DraftFee,
|
|
|
+ SettleAmount: projectTaskInfo.SettleAmount,
|
|
|
+ DefaultTime: projectTaskInfo.SketchMissingTime,
|
|
|
+ }
|
|
|
+ talentInfo, _ := dao.TalentInfoDao{}.SelectTalentInfo(talentId)
|
|
|
+ userInfo, _ := dao.PlatformKuaishouUserInfoDao{}.SelectUserInfo(talentId)
|
|
|
+ reTalentDefault.TalentPhone = talentInfo.TalentPhoneNumber
|
|
|
+ reTalentDefault.OpenId = userInfo.OpenId
|
|
|
+ reTalentDefault.NickName = userInfo.NickName
|
|
|
+ reTalentDefault.HeadUri = userInfo.HeadUri
|
|
|
+ reTalentDefaults = append(reTalentDefaults, reTalentDefault)
|
|
|
+ }
|
|
|
+ result = vo.ResultVO{
|
|
|
+ Page: param.Page,
|
|
|
+ PageSize: param.PageSize,
|
|
|
+ Total: total,
|
|
|
+ Data: reTalentDefaults,
|
|
|
+ }
|
|
|
+ return result, nil
|
|
|
+}
|