|
@@ -1,7 +1,10 @@
|
|
|
package service
|
|
|
|
|
|
import (
|
|
|
+ "strconv"
|
|
|
+ "time"
|
|
|
"youngee_b_api/app/dao"
|
|
|
+ "youngee_b_api/app/entity"
|
|
|
"youngee_b_api/app/vo"
|
|
|
)
|
|
|
|
|
@@ -123,7 +126,7 @@ func (s DefaultService) GetTargetDefaultList(param *vo.DefaultSearchParam) (vo.R
|
|
|
return result, nil
|
|
|
}
|
|
|
|
|
|
-// 违约管理——未传初稿公开任务列表
|
|
|
+// 违约管理——公开任务-违约达人列表
|
|
|
func (s DefaultService) GetPublicDefaultTalentList(param *vo.DefaultSearchParam) (vo.ResultVO, error) {
|
|
|
if param.Page == 0 {
|
|
|
param.Page = 1
|
|
@@ -134,33 +137,171 @@ func (s DefaultService) GetPublicDefaultTalentList(param *vo.DefaultSearchParam)
|
|
|
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 {
|
|
|
+ var projectTaskInfos []entity.ProjectTaskInfo
|
|
|
+ var total int64
|
|
|
+ var err error
|
|
|
+ var cutRate int64
|
|
|
+ defaultType := param.DefaultType
|
|
|
+ if defaultType == 1 { // 未传初稿
|
|
|
+ projectTaskInfos, total, err = dao.ProjectTaskInfoDao{}.GetListBySketchDefault(param)
|
|
|
+ autoDefaultId, _ := dao.ProjectDAO{}.GetAutoDefaultId(param.TaskId)
|
|
|
+ cutRate = dao.InfoAutoDefaultDao{}.GetValueByIdFieldName(*autoDefaultId, "sketch_replace_not_upload")
|
|
|
+ } else if defaultType == 2 { // 未发作品
|
|
|
+ projectTaskInfos, total, err = dao.ProjectTaskInfoDao{}.GetListByLinkDefault(param)
|
|
|
+ autoDefaultId, _ := dao.ProjectDAO{}.GetAutoDefaultId(param.TaskId)
|
|
|
+ cutRate = dao.InfoAutoDefaultDao{}.GetValueByIdFieldName(*autoDefaultId, "link_replace_not_upload")
|
|
|
+ } else if defaultType == 3 { // 未传数据
|
|
|
+ projectTaskInfos, total, err = dao.ProjectTaskInfoDao{}.GetListByDataDefault(param)
|
|
|
+ autoDefaultId, _ := dao.ProjectDAO{}.GetAutoDefaultId(param.TaskId)
|
|
|
+ cutRate = dao.InfoAutoDefaultDao{}.GetValueByIdFieldName(*autoDefaultId, "data_replace_not_upload")
|
|
|
+ } else if defaultType == 4 { // 终止合作
|
|
|
+ projectTaskInfos, total, err = dao.ProjectTaskInfoDao{}.GetListByTerminateDefault(param)
|
|
|
+ } else if defaultType == 5 { // 已解约
|
|
|
+ projectTaskInfos, total, err = dao.ProjectTaskInfoDao{}.GetListByCancelDefault(param)
|
|
|
+ }
|
|
|
+ if err != nil {
|
|
|
+ return result, err
|
|
|
+ }
|
|
|
+ for _, projectTaskInfo := range projectTaskInfos {
|
|
|
+ talentId := projectTaskInfo.TalentID
|
|
|
+ talentPhone, _ := dao.TalentInfoDao{}.SelectTalentPhone(talentId)
|
|
|
+ platformKuaishouUserInfo, _ := dao.PlatformKuaishouUserInfoDao{}.SelectUserInfo(talentId)
|
|
|
+ reTalentDefault := &vo.ReTalentDefault{
|
|
|
+ TalentId: talentId,
|
|
|
+ TalentPhone: *talentPhone,
|
|
|
+ TaskId: projectTaskInfo.TaskID,
|
|
|
+ DraftFee: projectTaskInfo.DraftFee,
|
|
|
+ OpenId: platformKuaishouUserInfo.OpenId,
|
|
|
+ NickName: platformKuaishouUserInfo.NickName,
|
|
|
+ HeadUri: platformKuaishouUserInfo.HeadUri,
|
|
|
+ City: "-",
|
|
|
+ }
|
|
|
+ if defaultType == 1 {
|
|
|
+ reTalentDefault.DefaultTime = projectTaskInfo.SketchMissingTime.Format("2006-01-02 15:04:05")
|
|
|
+ reTalentDefault.SettleAmount = projectTaskInfo.SettleAmount
|
|
|
+ } else if defaultType == 2 {
|
|
|
+ reTalentDefault.DefaultTime = projectTaskInfo.LinkMissingTime.Format("2006-01-02 15:04:05")
|
|
|
+ reTalentDefault.SettleAmount = projectTaskInfo.SettleAmount
|
|
|
+ } else if defaultType == 3 {
|
|
|
+ reTalentDefault.DefaultTime = projectTaskInfo.DataMissingTime.Format("2006-01-02 15:04:05")
|
|
|
+ reTalentDefault.SettleAmount = projectTaskInfo.SettleAmount
|
|
|
+ } else if defaultType == 4 {
|
|
|
+ reTalentDefault.DefaultTime = projectTaskInfo.TerminateTime.Format("2006-01-02 15:04:05")
|
|
|
+ reTalentDefault.Reason = projectTaskInfo.TerminateReason
|
|
|
+ terminateOperatorType := projectTaskInfo.TerminateOperatorType
|
|
|
+ if terminateOperatorType == 1 {
|
|
|
+ enterprise, _ := dao.EnterpriseDao{}.GetEnterprise(projectTaskInfo.TerminateOperator)
|
|
|
+ reTalentDefault.OperatorName = enterprise.BusinessName
|
|
|
+ } else if terminateOperatorType == 2 {
|
|
|
+ operatorId, _ := strconv.ParseInt(projectTaskInfo.TerminateOperator, 10, 64)
|
|
|
+ subAccount, _ := dao.SubAccountDao{}.GetSubAccount(operatorId)
|
|
|
+ reTalentDefault.OperatorName = subAccount.SubAccountName
|
|
|
+ } else if terminateOperatorType == 3 {
|
|
|
+ operatorId, _ := strconv.ParseInt(projectTaskInfo.TerminateOperator, 10, 64)
|
|
|
+ userName, _ := dao.UserDao{}.GetNameByUserId(operatorId)
|
|
|
+ reTalentDefault.OperatorName = userName
|
|
|
+ }
|
|
|
+ } else if defaultType == 5 {
|
|
|
+ reTalentDefault.DefaultTime = projectTaskInfo.CancelTime.Format("2006-01-02 15:04:05")
|
|
|
+ reTalentDefault.SettleAmount = projectTaskInfo.SettleAmount
|
|
|
+ reTalentDefault.Reason = projectTaskInfo.CancelReason
|
|
|
+ cancelOperatorType := projectTaskInfo.CancelOperatorType
|
|
|
+ if cancelOperatorType == 1 {
|
|
|
+ enterprise, _ := dao.EnterpriseDao{}.GetEnterprise(projectTaskInfo.CancelOperator)
|
|
|
+ reTalentDefault.OperatorName = enterprise.BusinessName
|
|
|
+ } else if cancelOperatorType == 2 {
|
|
|
+ operatorId, _ := strconv.ParseInt(projectTaskInfo.CancelOperator, 10, 64)
|
|
|
+ subAccount, _ := dao.SubAccountDao{}.GetSubAccount(operatorId)
|
|
|
+ reTalentDefault.OperatorName = subAccount.SubAccountName
|
|
|
+ } else if cancelOperatorType == 3 {
|
|
|
+ operatorId, _ := strconv.ParseInt(projectTaskInfo.CancelOperator, 10, 64)
|
|
|
+ userName, _ := dao.UserDao{}.GetNameByUserId(operatorId)
|
|
|
+ reTalentDefault.OperatorName = userName
|
|
|
+ }
|
|
|
+ }
|
|
|
+ reTalentDefaults = append(reTalentDefaults, reTalentDefault)
|
|
|
+ }
|
|
|
+ resultMap := make(map[string]interface{})
|
|
|
+ resultMap["cutRate"] = cutRate
|
|
|
+ resultMap["reTalentDefaults"] = reTalentDefaults
|
|
|
+ result = vo.ResultVO{
|
|
|
+ Page: param.Page,
|
|
|
+ PageSize: param.PageSize,
|
|
|
+ Total: total,
|
|
|
+ Data: resultMap,
|
|
|
+ }
|
|
|
+ return result, nil
|
|
|
+}
|
|
|
|
|
|
+// 违约管理——定向任务-违约达人列表
|
|
|
+func (s DefaultService) GetTargetDefaultTalentList(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
|
|
|
+ // 以下代码只考虑了种草
|
|
|
+ var projectTaskInfos []entity.ProjectTaskInfo
|
|
|
+ var total int64
|
|
|
+ var err error
|
|
|
+ defaultType := param.DefaultType
|
|
|
+ if defaultType == 4 { // 终止合作
|
|
|
+ projectTaskInfos, total, err = (&dao.ProjectTaskInfoDao{}).GetListByTerminateDefault(param)
|
|
|
+ } else if defaultType == 5 { // 已解约
|
|
|
+ projectTaskInfos, total, err = (&dao.ProjectTaskInfoDao{}).GetListByCancelDefault(param)
|
|
|
}
|
|
|
- projectTaskInfos, total, err := (&dao.ProjectTaskInfoDao{}).GetListByDefaultType(param)
|
|
|
if err != nil {
|
|
|
return result, err
|
|
|
}
|
|
|
for _, projectTaskInfo := range projectTaskInfos {
|
|
|
talentId := projectTaskInfo.TalentID
|
|
|
+ talentPhone, _ := dao.TalentInfoDao{}.SelectTalentPhone(talentId)
|
|
|
+ platformKuaishouUserInfo, _ := dao.PlatformKuaishouUserInfoDao{}.SelectUserInfo(talentId)
|
|
|
reTalentDefault := &vo.ReTalentDefault{
|
|
|
- TalentId: talentId,
|
|
|
- DraftFee: projectTaskInfo.DraftFee,
|
|
|
- SettleAmount: projectTaskInfo.SettleAmount,
|
|
|
- DefaultTime: projectTaskInfo.SketchMissingTime,
|
|
|
+ TalentId: talentId,
|
|
|
+ TalentPhone: *talentPhone,
|
|
|
+ DraftFee: projectTaskInfo.DraftFee,
|
|
|
+ OpenId: platformKuaishouUserInfo.OpenId,
|
|
|
+ NickName: platformKuaishouUserInfo.NickName,
|
|
|
+ HeadUri: platformKuaishouUserInfo.HeadUri,
|
|
|
+ City: "-",
|
|
|
+ }
|
|
|
+ if defaultType == 4 {
|
|
|
+ reTalentDefault.DefaultTime = projectTaskInfo.TerminateTime.Format("2006-01-02 15:04:05")
|
|
|
+ reTalentDefault.Reason = projectTaskInfo.TerminateReason
|
|
|
+ terminateOperatorType := projectTaskInfo.TerminateOperatorType
|
|
|
+ if terminateOperatorType == 1 {
|
|
|
+ enterprise, _ := dao.EnterpriseDao{}.GetEnterprise(projectTaskInfo.TerminateOperator)
|
|
|
+ reTalentDefault.OperatorName = enterprise.BusinessName
|
|
|
+ } else if terminateOperatorType == 2 {
|
|
|
+ operatorId, _ := strconv.ParseInt(projectTaskInfo.TerminateOperator, 10, 64)
|
|
|
+ subAccount, _ := dao.SubAccountDao{}.GetSubAccount(operatorId)
|
|
|
+ reTalentDefault.OperatorName = subAccount.SubAccountName
|
|
|
+ } else if terminateOperatorType == 3 {
|
|
|
+ operatorId, _ := strconv.ParseInt(projectTaskInfo.TerminateOperator, 10, 64)
|
|
|
+ userName, _ := dao.UserDao{}.GetNameByUserId(operatorId)
|
|
|
+ reTalentDefault.OperatorName = userName
|
|
|
+ }
|
|
|
+ } else if defaultType == 5 {
|
|
|
+ reTalentDefault.DefaultTime = projectTaskInfo.CancelTime.Format("2006-01-02 15:04:05")
|
|
|
+ reTalentDefault.SettleAmount = projectTaskInfo.SettleAmount
|
|
|
+ cancelOperatorType := projectTaskInfo.CancelOperatorType
|
|
|
+ if cancelOperatorType == 1 {
|
|
|
+ enterprise, _ := dao.EnterpriseDao{}.GetEnterprise(projectTaskInfo.CancelOperator)
|
|
|
+ reTalentDefault.OperatorName = enterprise.BusinessName
|
|
|
+ } else if cancelOperatorType == 2 {
|
|
|
+ operatorId, _ := strconv.ParseInt(projectTaskInfo.CancelOperator, 10, 64)
|
|
|
+ subAccount, _ := dao.SubAccountDao{}.GetSubAccount(operatorId)
|
|
|
+ reTalentDefault.OperatorName = subAccount.SubAccountName
|
|
|
+ } else if cancelOperatorType == 3 {
|
|
|
+ operatorId, _ := strconv.ParseInt(projectTaskInfo.CancelOperator, 10, 64)
|
|
|
+ userName, _ := dao.UserDao{}.GetNameByUserId(operatorId)
|
|
|
+ reTalentDefault.OperatorName = userName
|
|
|
+ }
|
|
|
}
|
|
|
- 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{
|
|
@@ -171,3 +312,35 @@ func (s DefaultService) GetPublicDefaultTalentList(param *vo.DefaultSearchParam)
|
|
|
}
|
|
|
return result, nil
|
|
|
}
|
|
|
+
|
|
|
+// 违约管理——达人解约
|
|
|
+func (s DefaultService) CancelTalent(param *vo.TalentCancelParam) error {
|
|
|
+ updateData := map[string]interface{}{
|
|
|
+ "task_stage": 16,
|
|
|
+ "settle_amount": param.RealPayment,
|
|
|
+ "real_payment": param.RealPayment,
|
|
|
+ "cancel_reason": param.CancelReason,
|
|
|
+ "cancel_time": time.Now(),
|
|
|
+ }
|
|
|
+ err := dao.ProjectTaskInfoDao{}.UpdateField(param.TaskId, updateData)
|
|
|
+ if err != nil {
|
|
|
+ return err
|
|
|
+ }
|
|
|
+ return nil
|
|
|
+}
|
|
|
+
|
|
|
+// 违约管理——达人批量解约
|
|
|
+func (s DefaultService) CancelTalentList(param *vo.TalentCancelParam) error {
|
|
|
+ updateData := map[string]interface{}{
|
|
|
+ "task_stage": 16,
|
|
|
+ "settle_amount": param.RealPayment,
|
|
|
+ "real_payment": param.RealPayment,
|
|
|
+ "cancel_reason": param.CancelReason,
|
|
|
+ "cancel_time": time.Now(),
|
|
|
+ }
|
|
|
+ err := dao.ProjectTaskInfoDao{}.UpdateFieldBatch(param.TaskIds, updateData)
|
|
|
+ if err != nil {
|
|
|
+ return err
|
|
|
+ }
|
|
|
+ return nil
|
|
|
+}
|