把所有请求参数放到dto文件
This commit is contained in:
parent
4d8203bf8c
commit
e1702d7b46
@ -3,7 +3,6 @@ package controller
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"micro-bundle/internal/dao"
|
||||
"micro-bundle/internal/dto"
|
||||
"micro-bundle/internal/logic"
|
||||
"micro-bundle/internal/model"
|
||||
@ -16,7 +15,7 @@ import (
|
||||
|
||||
// AssignTask 指派某位员工完成某个艺人的任务
|
||||
func (b *BundleProvider) AssignTask(_ context.Context, req *bundle.TaskAssignRequest) (*bundle.CommonResponse, error) {
|
||||
daoReq := &dao.TaskAssignRequest{
|
||||
daoReq := &dto.TaskAssignRequest{
|
||||
SubNum: req.SubNum,
|
||||
TelNum: req.TelNum,
|
||||
ArtistName: req.ArtistName,
|
||||
@ -68,7 +67,7 @@ func (b *BundleProvider) GetEmployeeAssignedTasks(_ context.Context, req *bundle
|
||||
if int(req.Status) == 2 {
|
||||
req.SortBy = "complete_time"
|
||||
}
|
||||
daoReq := &dao.EmployeeTaskQueryRequest{
|
||||
daoReq := &dto.EmployeeTaskQueryRequest{
|
||||
TaskAssigneeNum: req.TaskAssigneeNum,
|
||||
Keyword: req.Keyword,
|
||||
Operator: req.Operator,
|
||||
@ -118,7 +117,7 @@ func (b *BundleProvider) CompleteTaskManually(_ context.Context, req *bundle.Com
|
||||
|
||||
// UpdateTaskProgress 员工实际完成任务状态更新
|
||||
func (b *BundleProvider) UpdateTaskProgress(_ context.Context, req *bundle.UpdateTaskProgressRequest) (*bundle.CommonResponse, error) {
|
||||
daoReq := &dao.CompleteTaskRequest{
|
||||
daoReq := &dto.CompleteTaskRequest{
|
||||
AssignRecordsUUID: req.AssignRecordsUUID,
|
||||
EmployeeName: req.EmployeeName,
|
||||
EmployeeNum: req.EmployeeNum,
|
||||
@ -193,7 +192,7 @@ func (b *BundleProvider) GetTaskAssignRecordsList(_ context.Context, req *bundle
|
||||
if sortBy, ok := model.OrderByPending[req.SortBy]; ok {
|
||||
req.SortBy = sortBy
|
||||
}
|
||||
daoReq := &dao.TaskAssignRecordsQueryRequest{
|
||||
daoReq := &dto.TaskAssignRecordsQueryRequest{
|
||||
Keyword: req.Keyword,
|
||||
TaskAssignee: req.TaskAssignee,
|
||||
Operator: req.Operator,
|
||||
@ -231,7 +230,7 @@ func (b *BundleProvider) GetTaskAssignRecordsList(_ context.Context, req *bundle
|
||||
}
|
||||
|
||||
// convertToTaskAssignRecordInfo 转换TaskAssignRecords模型为proto消息
|
||||
func convertToTaskAssignRecordInfo(record *dao.TaskAssignRecordsResponse) *bundle.TaskAssignRecordInfo {
|
||||
func convertToTaskAssignRecordInfo(record *dto.TaskAssignRecordsResponse) *bundle.TaskAssignRecordInfo {
|
||||
var completeTime string
|
||||
if record.CompleteTime != nil {
|
||||
completeTime = record.CompleteTime.Format("2006-01-02 15:04:05")
|
||||
@ -265,7 +264,7 @@ func convertToTaskAssignRecordInfo(record *dao.TaskAssignRecordsResponse) *bundl
|
||||
}
|
||||
|
||||
// convertToTaskAssignRecordsSummary 转换汇总结构到proto
|
||||
func convertToTaskAssignRecordsSummary(s *dao.TaskAssignRecordsSummary) *bundle.TaskAssignRecordsSummary {
|
||||
func convertToTaskAssignRecordsSummary(s *dto.TaskAssignRecordsSummary) *bundle.TaskAssignRecordsSummary {
|
||||
if s == nil {
|
||||
return &bundle.TaskAssignRecordsSummary{}
|
||||
}
|
||||
@ -288,13 +287,13 @@ func (b *BundleProvider) BatchAssignTask(_ context.Context, req *bundle.BatchAss
|
||||
}
|
||||
|
||||
// 转换请求项为DAO层结构
|
||||
var items []*dao.BatchAssignItem
|
||||
items = make([]*dao.BatchAssignItem, 0, len(req.Items))
|
||||
var items []*dto.BatchAssignItem
|
||||
items = make([]*dto.BatchAssignItem, 0, len(req.Items))
|
||||
for _, it := range req.Items {
|
||||
if it == nil {
|
||||
return &bundle.ComResponse{Msg: "存在空的指派项"}, fmt.Errorf("存在空的指派项")
|
||||
}
|
||||
items = append(items, &dao.BatchAssignItem{
|
||||
items = append(items, &dto.BatchAssignItem{
|
||||
SubNum: it.SubNum,
|
||||
TelNum: it.TelNum,
|
||||
ArtistName: it.ArtistName,
|
||||
@ -441,7 +440,7 @@ func (b *BundleProvider) AddHiddenTaskAssignee(_ context.Context, req *bundle.Ad
|
||||
// CreateTaskWorkLog 创建任务日志记录
|
||||
func (b *BundleProvider) CreateTaskWorkLog(_ context.Context, req *bundle.CreateTaskWorkLogRequest) (*bundle.CommonResponse, error) {
|
||||
// 转换请求参数
|
||||
daoReq := &dao.CreateTaskWorkLogRequest{
|
||||
daoReq := &dto.CreateTaskWorkLogRequest{
|
||||
AssignRecordsUUID: req.AssignRecordsUUID,
|
||||
WorkUUID: req.WorkUUID,
|
||||
Title: req.Title,
|
||||
|
||||
@ -17,22 +17,6 @@ import (
|
||||
"gorm.io/gorm/clause"
|
||||
)
|
||||
|
||||
// TaskAssignRequest 指派任务请求参数
|
||||
type TaskAssignRequest struct {
|
||||
SubNum string `json:"subNum"` // 艺人编号
|
||||
TelNum string `json:"telNum"` // 艺人手机号
|
||||
ArtistName string `json:"artistName"` // 艺人姓名
|
||||
TaskAssignee string `json:"taskAssignee"` // 任务指派人
|
||||
TaskAssigneeNum string `json:"taskAssigneeNum"` // 任务指派人账号
|
||||
Operator string `json:"operator"` // 操作人
|
||||
OperatorNum string `json:"operatorNum"` // 操作人账号
|
||||
AssignVideoCount int `json:"assignVideoCount"` // 指派视频数
|
||||
AssignPostCount int `json:"assignPostCount"` // 指派图文数
|
||||
AssignDataCount int `json:"assignDataCount"` // 指派数据数
|
||||
AssignVideoScriptCount int `json:"assignVideoScriptCount"` // 指派视频脚本数
|
||||
TaskBatch string `json:"taskBatch"` // 任务批次
|
||||
}
|
||||
|
||||
func GetPendingTaskLayout() (string, error) {
|
||||
var rec model.TaskPendingLayout
|
||||
if err := app.ModuleClients.TaskBenchDB.Model(&model.TaskPendingLayout{}).Where("id = ?", 1).First(&rec).Error; err != nil {
|
||||
@ -74,187 +58,8 @@ func AddHiddenTaskAssignee(taskAssignee string, taskAssigneeNum string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// BatchAssignItem 批量指派项(仅写入指派记录,不更新任务管理表)
|
||||
type BatchAssignItem struct {
|
||||
SubNum string `json:"subNum"` // 艺人编号
|
||||
TelNum string `json:"telNum"` // 艺人手机号
|
||||
ArtistName string `json:"artistName"` // 艺人姓名
|
||||
TaskAssignee string `json:"taskAssignee"` // 任务指派人
|
||||
TaskAssigneeNum string `json:"taskAssigneeNum"` // 任务指派人账号
|
||||
Operator string `json:"operator"` // 操作人
|
||||
OperatorNum string `json:"operatorNum"` // 操作人账号
|
||||
AssignVideoCount int `json:"assignVideoCount"` // 指派视频数
|
||||
AssignPostCount int `json:"assignPostCount"` // 指派图文数
|
||||
AssignDataCount int `json:"assignDataCount"` // 指派数据数
|
||||
AssignVideoScriptCount int `json:"assignVideoScriptCount"` // 指派视频脚本数
|
||||
TaskBatch string `json:"taskBatch"` // 任务批次
|
||||
}
|
||||
|
||||
// EmployeeTaskQueryRequest 员工任务查询请求参数
|
||||
type EmployeeTaskQueryRequest struct {
|
||||
TaskAssigneeNum string `json:"taskAssigneeNum"` // 被指派人账号
|
||||
Keyword string `json:"keyword"` // 艺人姓名、编号、手机号搜索关键词
|
||||
Operator string `json:"operator"` // 操作人
|
||||
SortBy string `json:"sortBy"` // 排序字段
|
||||
StartTime string `json:"startTime"` // 指派开始时间
|
||||
EndTime string `json:"endTime"` // 指派结束时间
|
||||
StartCompleteTime string `json:"startCompleteTime"` // 开始完成时间
|
||||
EndCompleteTime string `json:"endCompleteTime"` // 结束完成时间
|
||||
Status int `json:"status"` // 反馈完成状态
|
||||
TaskBatch string `json:"taskBatch"` // 任务批次
|
||||
|
||||
Page int `json:"page"` // 页码
|
||||
PageSize int `json:"pageSize"` // 每页数量
|
||||
}
|
||||
|
||||
// CompleteTaskRequest 完成任务请求参数
|
||||
type CompleteTaskRequest struct {
|
||||
AssignRecordsUUID string `json:"assignRecordsUUID,omitempty"` // 指派记录UUID(可选)
|
||||
EmployeeName string `json:"employeeName"` // 员工姓名(必要)
|
||||
EmployeeNum string `json:"employeeNum"` // 员工工号(必要)
|
||||
TaskType string `json:"taskType"` // 任务类型: video/post/data/script
|
||||
UUID string `json:"uuid"` // 任务UUID
|
||||
CompleteCount int `json:"completeCount"` // 完成数量
|
||||
}
|
||||
|
||||
// TaskAssignRecordsQueryRequest 多条件查询操作记录表请求参数
|
||||
type TaskAssignRecordsQueryRequest struct {
|
||||
Keyword string `json:"keyword"` // 艺人姓名、编号、手机号搜索关键词
|
||||
TaskAssignee string `json:"taskAssignee"` // 指派人姓名
|
||||
Operator string `json:"operator"` // 操作人姓名
|
||||
OperatorNum string `json:"operatorNum"` // 操作人手机号
|
||||
StartTime string `json:"startTime"` // 操作开始时间
|
||||
EndTime string `json:"endTime"` // 操作结束时间
|
||||
Status int `json:"status"` // 反馈完成状态 0:全部 1:未完成 2:完成
|
||||
ActualStatus int `json:"actualStatus"` // 实际完成状态 0:全部 1:未完成 2:完成
|
||||
TaskBatch string `json:"taskBatch"` // 任务批次
|
||||
Page int `json:"page"` // 页码
|
||||
PageSize int `json:"pageSize"` // 每页数量
|
||||
SortBy string `json:"sortBy"` // 排序字段(白名单)
|
||||
SortType string `json:"sortType"` // 排序方式
|
||||
}
|
||||
|
||||
// 任务记录表返回结构体
|
||||
type TaskAssignRecordsResponse struct {
|
||||
AssignRecordsUUID string `gorm:"column:assign_records_uuid;comment:指派记录UUID" json:"assignRecordsUUID"`
|
||||
SubNum string `gorm:"column:sub_num;comment:艺人编号" json:"subNum"`
|
||||
TelNum string `gorm:"column:tel_num;comment:艺人手机号" json:"telNum"`
|
||||
ArtistName string `gorm:"column:artist_name;comment:艺人名称" json:"artistName"`
|
||||
Status int `gorm:"column:status;comment:反馈完成状态 1:未完成 2:完成" json:"status"`
|
||||
ActualStatus int `gorm:"column:actual_status;comment:实际完成状态 1:未完成 2:完成" json:"actualStatus"`
|
||||
CompleteTime *time.Time `gorm:"column:complete_time;comment:反馈完成时间" json:"completeTime"`
|
||||
OperatorType int `gorm:"column:operator_type;comment:操作类型 1:修改待发数量 2:指派" json:"operatorType"`
|
||||
Operator string `gorm:"column:operator;comment:操作人" json:"operator"`
|
||||
OperatorNum string `gorm:"column:operator_num;comment:操作人账号" json:"operatorNum"`
|
||||
OperatorTime time.Time `gorm:"column:operator_time;comment:操作时间" json:"operatorTime"`
|
||||
TaskAssignee string `gorm:"column:task_assignee;comment:任务指派人" json:"taskAssignee"`
|
||||
TaskAssigneeNum string `gorm:"column:task_assignee_num;comment:任务指派人账号" json:"taskAssigneeNum"`
|
||||
TaskBatch string `gorm:"column:task_batch;comment:任务批次" json:"taskBatch"`
|
||||
PendingVideoCount int `gorm:"column:pending_video_count;comment:待发视频数量" json:"pendingVideoCount"`
|
||||
PendingPostCount int `gorm:"column:pending_post_count;comment:待发图文数量" json:"pendingPostCount"`
|
||||
PendingDataCount int `gorm:"column:pending_data_count;comment:待发数据数量" json:"pendingDataCount"`
|
||||
PendingVideoScriptCount int `gorm:"column:pending_video_script_count;comment:待发视频脚本数量" json:"pendingVideoScriptCount"`
|
||||
// 已完成统计
|
||||
CompleteVideoScriptCount int `gorm:"column:complete_video_script_count;comment:已完成视频脚本数" json:"completeVideoScriptCount"`
|
||||
CompleteVideoCount int `gorm:"column:complete_video_count;comment:已完成视频数" json:"completeVideoCount"`
|
||||
CompletePostCount int `gorm:"column:complete_post_count;comment:已完成图文数" json:"completePostCount"`
|
||||
CompleteDataCount int `gorm:"column:complete_data_count;comment:已完成数据数" json:"completeDataCount"`
|
||||
UpdatedAt time.Time `gorm:"column:updated_at;comment:更新时间" json:"updatedAt"`
|
||||
}
|
||||
|
||||
// 多条件查询后分页前的艺人数量汇总
|
||||
type TaskAssignRecordsSummary struct {
|
||||
TotalPendingVideoScriptCount int `json:"totalPendingVideoScriptCount"`
|
||||
TotalPendingVideoCount int `json:"totalPendingVideoCount"`
|
||||
TotalPendingPostCount int `json:"totalPendingPostCount"`
|
||||
TotalPendingDataCount int `json:"totalPendingDataCount"`
|
||||
TotalCompleteVideoScriptCount int `json:"totalCompleteVideoScriptCount"`
|
||||
TotalCompleteVideoCount int `json:"totalCompleteVideoCount"`
|
||||
TotalCompletePostCount int `json:"totalCompletePostCount"`
|
||||
TotalCompleteDataCount int `json:"totalCompleteDataCount"`
|
||||
}
|
||||
|
||||
// ValidArtistInfo 有效艺人信息结构体
|
||||
type ValidArtistInfo struct {
|
||||
UserID int `json:"userId"` // 用户ID
|
||||
CustomerNum string `json:"customerNum"` // 艺人编号
|
||||
UserName string `json:"userName"` // 艺人姓名
|
||||
UserPhoneNumber string `json:"userPhoneNumber"` // 艺人手机号
|
||||
BundleName string `json:"bundleName"` // 套餐名称
|
||||
ExpirationTime string `json:"expirationTime"` // 过期时间
|
||||
Status int `json:"status"` // 套餐状态
|
||||
OrderUUID string `json:"orderUUID"` // 订单UUID
|
||||
AccountNumber int `json:"accountNumber"` // 账号数量
|
||||
AccountConsumptionNumber int `json:"accountConsumptionNumber"` // 账号消耗数量
|
||||
VideoNumber int `json:"videoNumber"` // 视频数量
|
||||
VideoConsumptionNumber int `json:"videoConsumptionNumber"` // 视频消耗数量
|
||||
ImageNumber int `json:"imageNumber"` // 图片数量
|
||||
ImageConsumptionNumber int `json:"imageConsumptionNumber"` // 图片消耗数量
|
||||
DataAnalysisNumber int `json:"dataAnalysisNumber"` // 数据分析数量
|
||||
DataAnalysisConsumptionNumber int `json:"dataAnalysisConsumptionNumber"` // 数据分析消耗数量
|
||||
ExpansionPacksNumber int `json:"expansionPacksNumber"` // 扩展套餐数量
|
||||
}
|
||||
|
||||
// ArtistUploadStatsItem 艺人上传与额度统计(视频/图文/数据分析)
|
||||
type ArtistUploadStatsItem struct {
|
||||
// 身份信息
|
||||
SubNum string `json:"subNum" gorm:"column:customer_num"`
|
||||
UserName string `json:"userName" gorm:"column:user_name"`
|
||||
UserPhoneNumber string `json:"userPhoneNumber" gorm:"column:user_phone_number"`
|
||||
StartAt string `json:"startAt" gorm:"column:start_at"`
|
||||
ExpiredAt string `json:"expiredAt" gorm:"column:expired_at"`
|
||||
|
||||
// 视频
|
||||
UploadedVideoCount int `json:"uploadedVideoCount" gorm:"column:uploaded_video_count"`
|
||||
BundleVideoTotal int `json:"bundleVideoTotal" gorm:"column:bundle_video_total"`
|
||||
IncreaseVideoTotal int `json:"increaseVideoTotal" gorm:"column:increase_video_total"`
|
||||
ReleasedVideoTotal int `json:"releasedVideoTotal" gorm:"column:released_video_total"`
|
||||
PendingVideoCount int `json:"pendingVideoCount" gorm:"column:pending_video_count"`
|
||||
|
||||
// 图文
|
||||
UploadedPostCount int `json:"uploadedPostCount" gorm:"column:uploaded_post_count"`
|
||||
BundlePostTotal int `json:"bundlePostTotal" gorm:"column:bundle_post_total"`
|
||||
IncreasePostTotal int `json:"increasePostTotal" gorm:"column:increase_post_total"`
|
||||
ReleasedPostTotal int `json:"releasedPostTotal" gorm:"column:released_post_total"`
|
||||
PendingPostCount int `json:"pendingPostCount" gorm:"column:pending_post_count"`
|
||||
|
||||
// 数据分析
|
||||
UploadedDataAnalysisCount int `json:"uploadedDataAnalysisCount" gorm:"column:uploaded_data_count"`
|
||||
BundleDataAnalysisTotal int `json:"bundleDataAnalysisTotal" gorm:"column:bundle_data_total"`
|
||||
IncreaseDataAnalysisTotal int `json:"increaseDataAnalysisTotal" gorm:"column:increase_data_total"`
|
||||
ReleasedDataAnalysisTotal int `json:"releasedDataAnalysisTotal" gorm:"column:released_data_total"`
|
||||
PendingDataAnalysisCount int `json:"pendingDataAnalysisCount" gorm:"column:pending_data_count"`
|
||||
|
||||
// 任务管理
|
||||
LastTaskAssignee string `json:"lastTaskAssignee" gorm:"column:last_task_assignee"`
|
||||
TaskAssigneeNum string `json:"taskAssigneeNum" gorm:"column:task_assignee_num"`
|
||||
ProgressTaskCount int `json:"progressTaskCount" gorm:"column:progress_task_count"`
|
||||
CompleteTaskCount int `json:"completeTaskCount" gorm:"column:complete_task_count"`
|
||||
|
||||
// 脚本
|
||||
UploadedVideoScriptCount int `json:"uploadedVideoScriptCount" gorm:"column:uploaded_video_script_count"`
|
||||
PendingVideoScriptCount int `json:"pendingVideoScriptCount" gorm:"column:pending_video_script_count"`
|
||||
|
||||
// 可指派数(可上传数 - 已指派且未完成的数量)
|
||||
AllowVideoScriptCount int `json:"allowVideoScriptCount" gorm:"column:allow_video_script_count"`
|
||||
AllowVideoCount int `json:"allowVideoCount" gorm:"column:allow_video_count"`
|
||||
AllowPostCount int `json:"allowPostCount" gorm:"column:allow_post_count"`
|
||||
AllowDataCount int `json:"allowDataCount" gorm:"column:allow_data_count"`
|
||||
}
|
||||
|
||||
// ArtistPendingAssignItem 艺人可指派数量(可上传数 - 已指派且未完成的数量)
|
||||
type ArtistPendingAssignItem struct {
|
||||
SubNum string `json:"subNum" gorm:"column:customer_num"`
|
||||
TelNum string `json:"telNum" gorm:"column:tel_num"`
|
||||
UserName string `json:"userName" gorm:"column:user_name"`
|
||||
AllowVideoScriptCount int `json:"allowVideoScriptCount" gorm:"column:allow_video_script_count"`
|
||||
AllowVideoCount int `json:"allowVideoCount" gorm:"column:allow_video_count"`
|
||||
AllowPostCount int `json:"allowPostCount" gorm:"column:allow_post_count"`
|
||||
AllowDataCount int `json:"allowDataCount" gorm:"column:allow_data_count"`
|
||||
}
|
||||
|
||||
// GetArtistUploadStatsList 查询所有艺人的上传统计与额度信息(通过 BundleBalance 关联 CastWork/CastWorkAnalysis,及 subNum 关联 TaskManagement)
|
||||
func GetArtistUploadStatsList(req *dto.TaskQueryRequest) ([]*ArtistUploadStatsItem, int64, error) {
|
||||
func GetArtistUploadStatsList(req *dto.TaskQueryRequest) ([]*dto.ArtistUploadStatsItem, int64, error) {
|
||||
taskSchema := bundleConfig.Data.TaskBenchDB.DbName
|
||||
nowMonth := time.Now().Format("2006-01")
|
||||
|
||||
@ -580,12 +385,12 @@ LEFT JOIN assigned_pending_agg apa ON apa.user_id = aw.user_id`
|
||||
listArgs = append(listArgs, req.PageSize, offset)
|
||||
}
|
||||
|
||||
items := make([]ArtistUploadStatsItem, 0)
|
||||
items := make([]dto.ArtistUploadStatsItem, 0)
|
||||
if err := app.ModuleClients.BundleDB.Raw(selectSQL, listArgs...).Scan(&items).Error; err != nil {
|
||||
return nil, 0, commonErr.ReturnError(err, "查询艺人余额与上传数据失败", "查询艺人余额与上传数据失败: ")
|
||||
}
|
||||
|
||||
resp := make([]*ArtistUploadStatsItem, 0, len(items))
|
||||
resp := make([]*dto.ArtistUploadStatsItem, 0, len(items))
|
||||
for i := range items {
|
||||
resp = append(resp, &items[i])
|
||||
}
|
||||
@ -593,9 +398,9 @@ LEFT JOIN assigned_pending_agg apa ON apa.user_id = aw.user_id`
|
||||
}
|
||||
|
||||
// GetPendingAssignBySubNums 查询指定艺人的可指派数量(可上传数 - 已指派且未完成的数量)
|
||||
func GetPendingAssignBySubNums(subNums []string, page int, pageSize int) ([]*ArtistPendingAssignItem, int64, error) {
|
||||
func GetPendingAssignBySubNums(subNums []string, page int, pageSize int) ([]*dto.ArtistPendingAssignItem, int64, error) {
|
||||
if len(subNums) == 0 {
|
||||
return []*ArtistPendingAssignItem{}, 0, nil
|
||||
return []*dto.ArtistPendingAssignItem{}, 0, nil
|
||||
}
|
||||
|
||||
taskSchema := bundleConfig.Data.TaskBenchDB.DbName
|
||||
@ -807,12 +612,12 @@ LEFT JOIN assigned_pending_agg apa ON apa.user_id = aw.user_id`
|
||||
listArgs = append(listArgs, pageSize, offset)
|
||||
}
|
||||
|
||||
items := make([]ArtistPendingAssignItem, 0)
|
||||
items := make([]dto.ArtistPendingAssignItem, 0)
|
||||
if err := app.ModuleClients.BundleDB.Raw(selectSQL, listArgs...).Scan(&items).Error; err != nil {
|
||||
return nil, 0, commonErr.ReturnError(err, "查询可指派数量失败", "查询可指派数量失败: ")
|
||||
}
|
||||
|
||||
resp := make([]*ArtistPendingAssignItem, 0, len(items))
|
||||
resp := make([]*dto.ArtistPendingAssignItem, 0, len(items))
|
||||
for i := range items {
|
||||
resp = append(resp, &items[i])
|
||||
}
|
||||
@ -820,7 +625,7 @@ LEFT JOIN assigned_pending_agg apa ON apa.user_id = aw.user_id`
|
||||
}
|
||||
|
||||
// AssignTask 指派某位员工完成某个艺人的任务
|
||||
func AssignTask(req *TaskAssignRequest, progressTaskCount int, completeTaskCount int) error {
|
||||
func AssignTask(req *dto.TaskAssignRequest, progressTaskCount int, completeTaskCount int) error {
|
||||
// 开启事务
|
||||
tx := app.ModuleClients.TaskBenchDB.Begin()
|
||||
defer func() {
|
||||
@ -1028,7 +833,7 @@ func RevertTaskCompletionByUUIDItem(uuid string) error {
|
||||
}
|
||||
|
||||
// BatchAssignTasks 批量指派
|
||||
func BatchAssignTasks(items []*BatchAssignItem) error {
|
||||
func BatchAssignTasks(items []*dto.BatchAssignItem) error {
|
||||
if len(items) == 0 {
|
||||
return commonErr.ReturnError(nil, "参数错误", "批量指派项不能为空")
|
||||
}
|
||||
@ -1036,7 +841,7 @@ func BatchAssignTasks(items []*BatchAssignItem) error {
|
||||
now := time.Now()
|
||||
|
||||
subNumSet := make(map[string]struct{})
|
||||
subTelKeys := make(map[string]*BatchAssignItem) // key: sub_num|tel_num
|
||||
subTelKeys := make(map[string]*dto.BatchAssignItem) // key: sub_num|tel_num
|
||||
for _, it := range items {
|
||||
if it == nil {
|
||||
return commonErr.ReturnError(nil, "参数错误", "存在空的指派项")
|
||||
@ -1282,7 +1087,7 @@ func BatchAssignTasks(items []*BatchAssignItem) error {
|
||||
}
|
||||
|
||||
// 3.5 批量更新 task_management 表
|
||||
updateGroups := make(map[string]*BatchAssignItem)
|
||||
updateGroups := make(map[string]*dto.BatchAssignItem)
|
||||
for _, it := range items {
|
||||
key := it.SubNum + "|" + it.TelNum
|
||||
updateGroups[key] = it
|
||||
@ -1353,7 +1158,7 @@ func GetRecentAssignRecords(limit int) ([]*model.TaskAssignRecords, error) {
|
||||
}
|
||||
|
||||
// GetEmployeeAssignedTasks 根据登录人信息查询被指派给该员工的艺人任务
|
||||
func GetEmployeeAssignedTasks(req *EmployeeTaskQueryRequest) ([]*model.TaskAssignRecords, int64, error) {
|
||||
func GetEmployeeAssignedTasks(req *dto.EmployeeTaskQueryRequest) ([]*model.TaskAssignRecords, int64, error) {
|
||||
var records []*model.TaskAssignRecords
|
||||
var total int64
|
||||
|
||||
@ -1566,7 +1371,7 @@ func UpdateTaskActualStatusByUUID(assignRecordsUUID string, actualStatus int) er
|
||||
|
||||
// UpdateTaskProgress 员工实际完成任务状态更新
|
||||
// 员工调用视频、图文、数据时,对应的待完成数据减一,已完成数据加一
|
||||
func UpdateTaskProgress(req *CompleteTaskRequest) error {
|
||||
func UpdateTaskProgress(req *dto.CompleteTaskRequest) error {
|
||||
// 开启事务
|
||||
tx := app.ModuleClients.TaskBenchDB.Begin()
|
||||
defer func() {
|
||||
@ -1916,10 +1721,10 @@ func GetAssignRecordByUUID(uuid string) (*model.TaskAssignRecords, error) {
|
||||
}
|
||||
|
||||
// GetTaskAssignRecordsList 多条件查询操作记录表
|
||||
func GetTaskAssignRecordsList(req *TaskAssignRecordsQueryRequest) ([]*model.TaskAssignRecords, int64, *TaskAssignRecordsSummary, error) {
|
||||
func GetTaskAssignRecordsList(req *dto.TaskAssignRecordsQueryRequest) ([]*model.TaskAssignRecords, int64, *dto.TaskAssignRecordsSummary, error) {
|
||||
var records []*model.TaskAssignRecords
|
||||
var total int64
|
||||
var summary TaskAssignRecordsSummary
|
||||
var summary dto.TaskAssignRecordsSummary
|
||||
|
||||
// 构建查询条件
|
||||
query := app.ModuleClients.TaskBenchDB.Model(&model.TaskAssignRecords{}).
|
||||
@ -2072,7 +1877,7 @@ func GetTaskAssignRecordsList(req *TaskAssignRecordsQueryRequest) ([]*model.Task
|
||||
}
|
||||
|
||||
// GetValidArtistList 查询套餐状态为有效中的艺人数据列表
|
||||
func GetValidArtistList() ([]ValidArtistInfo, error) {
|
||||
func GetValidArtistList() ([]dto.ValidArtistInfo, error) {
|
||||
// 构建子查询,获取每个用户的最新订单记录
|
||||
subQuery := app.ModuleClients.BundleDB.Table("bundle_order_records as bor1").
|
||||
Select("bor1.*").
|
||||
@ -2108,7 +1913,7 @@ func GetValidArtistList() ([]ValidArtistInfo, error) {
|
||||
Where("bb.month = ?", time.Now().Format("2006-01")).
|
||||
Order("bor.expiration_time desc")
|
||||
|
||||
var data []ValidArtistInfo
|
||||
var data []dto.ValidArtistInfo
|
||||
err := session.Find(&data).Error
|
||||
if err != nil {
|
||||
return nil, commonErr.ReturnError(err, "查询有效艺人失败", "查询有效艺人失败: ")
|
||||
@ -2152,30 +1957,8 @@ func UpdateTaskRecordsByAssigneeNum(taskAssigneeNum string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// CreateTaskWorkLogRequest 创建任务日志请求参数
|
||||
type CreateTaskWorkLogRequest struct {
|
||||
AssignRecordsUUID string `json:"assignRecordsUUID"` // 任务指派记录UUID(必填)
|
||||
WorkUUID string `json:"workUUID"` // 任务作品UUID(必填)
|
||||
Title string `json:"title"` // 任务作品标题
|
||||
|
||||
ArtistUUID string `json:"artistUUID"` // 任务艺人UUID
|
||||
SubNum string `json:"subNum"` // 任务用户编号(必填)
|
||||
TelNum string `json:"telNum"` // 任务用户手机号(必填)
|
||||
ArtistName string `json:"artistName"` // 任务艺人名称
|
||||
|
||||
// 操作信息
|
||||
OperationType int `json:"operationType"` // 任务操作类型 1:加任务 2:消耗任务 3:完成任务 4:任务过期(必填)
|
||||
TaskType int `json:"taskType"` // 任务类型 1:视频 2:图片 3:数据分析(必填)
|
||||
TaskCount int `json:"taskCount"` // 任务数量(必填)
|
||||
Remark string `json:"remark"` // 任务备注
|
||||
|
||||
// 操作人信息
|
||||
OperatorName string `json:"operatorName"` // 任务操作人姓名
|
||||
OperatorNum string `json:"operatorNum"` // 任务操作人账号
|
||||
}
|
||||
|
||||
// CreateTaskWorkLog 创建任务日志记录
|
||||
func CreateTaskWorkLog(req *CreateTaskWorkLogRequest) error {
|
||||
func CreateTaskWorkLog(req *dto.CreateTaskWorkLogRequest) error {
|
||||
// 参数校验
|
||||
if req == nil {
|
||||
return commonErr.ReturnError(nil, "参数错误", "请求参数不能为空")
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
package dto
|
||||
|
||||
import "time"
|
||||
|
||||
// TaskQueryRequest 查询待指派任务记录请求参数
|
||||
type TaskQueryRequest struct {
|
||||
Keyword string `json:"keyword"` // 艺人姓名、编号、手机号搜索关键词
|
||||
@ -10,3 +12,220 @@ type TaskQueryRequest struct {
|
||||
SortType string `json:"sortType"` // 排序类型 asc/desc
|
||||
SubNums []string `json:"subNums"` // 选中导出的艺人编号集合(可选)
|
||||
}
|
||||
|
||||
// TaskAssignRequest 指派任务请求参数
|
||||
type TaskAssignRequest struct {
|
||||
SubNum string `json:"subNum"` // 艺人编号
|
||||
TelNum string `json:"telNum"` // 艺人手机号
|
||||
ArtistName string `json:"artistName"` // 艺人姓名
|
||||
TaskAssignee string `json:"taskAssignee"` // 任务指派人
|
||||
TaskAssigneeNum string `json:"taskAssigneeNum"` // 任务指派人账号
|
||||
Operator string `json:"operator"` // 操作人
|
||||
OperatorNum string `json:"operatorNum"` // 操作人账号
|
||||
AssignVideoCount int `json:"assignVideoCount"` // 指派视频数
|
||||
AssignPostCount int `json:"assignPostCount"` // 指派图文数
|
||||
AssignDataCount int `json:"assignDataCount"` // 指派数据数
|
||||
AssignVideoScriptCount int `json:"assignVideoScriptCount"` // 指派视频脚本数
|
||||
TaskBatch string `json:"taskBatch"` // 任务批次
|
||||
}
|
||||
|
||||
// BatchAssignItem 批量指派项(仅写入指派记录,不更新任务管理表)
|
||||
type BatchAssignItem struct {
|
||||
SubNum string `json:"subNum"` // 艺人编号
|
||||
TelNum string `json:"telNum"` // 艺人手机号
|
||||
ArtistName string `json:"artistName"` // 艺人姓名
|
||||
TaskAssignee string `json:"taskAssignee"` // 任务指派人
|
||||
TaskAssigneeNum string `json:"taskAssigneeNum"` // 任务指派人账号
|
||||
Operator string `json:"operator"` // 操作人
|
||||
OperatorNum string `json:"operatorNum"` // 操作人账号
|
||||
AssignVideoCount int `json:"assignVideoCount"` // 指派视频数
|
||||
AssignPostCount int `json:"assignPostCount"` // 指派图文数
|
||||
AssignDataCount int `json:"assignDataCount"` // 指派数据数
|
||||
AssignVideoScriptCount int `json:"assignVideoScriptCount"` // 指派视频脚本数
|
||||
TaskBatch string `json:"taskBatch"` // 任务批次
|
||||
}
|
||||
|
||||
// EmployeeTaskQueryRequest 员工任务查询请求参数
|
||||
type EmployeeTaskQueryRequest struct {
|
||||
TaskAssigneeNum string `json:"taskAssigneeNum"` // 被指派人账号
|
||||
Keyword string `json:"keyword"` // 艺人姓名、编号、手机号搜索关键词
|
||||
Operator string `json:"operator"` // 操作人
|
||||
SortBy string `json:"sortBy"` // 排序字段
|
||||
StartTime string `json:"startTime"` // 指派开始时间
|
||||
EndTime string `json:"endTime"` // 指派结束时间
|
||||
StartCompleteTime string `json:"startCompleteTime"` // 开始完成时间
|
||||
EndCompleteTime string `json:"endCompleteTime"` // 结束完成时间
|
||||
Status int `json:"status"` // 反馈完成状态
|
||||
TaskBatch string `json:"taskBatch"` // 任务批次
|
||||
|
||||
Page int `json:"page"` // 页码
|
||||
PageSize int `json:"pageSize"` // 每页数量
|
||||
}
|
||||
|
||||
// CompleteTaskRequest 完成任务请求参数
|
||||
type CompleteTaskRequest struct {
|
||||
AssignRecordsUUID string `json:"assignRecordsUUID,omitempty"` // 指派记录UUID(可选)
|
||||
EmployeeName string `json:"employeeName"` // 员工姓名(必要)
|
||||
EmployeeNum string `json:"employeeNum"` // 员工工号(必要)
|
||||
TaskType string `json:"taskType"` // 任务类型: video/post/data/script
|
||||
UUID string `json:"uuid"` // 任务UUID
|
||||
CompleteCount int `json:"completeCount"` // 完成数量
|
||||
}
|
||||
|
||||
// TaskAssignRecordsQueryRequest 多条件查询操作记录表请求参数
|
||||
type TaskAssignRecordsQueryRequest struct {
|
||||
Keyword string `json:"keyword"` // 艺人姓名、编号、手机号搜索关键词
|
||||
TaskAssignee string `json:"taskAssignee"` // 指派人姓名
|
||||
Operator string `json:"operator"` // 操作人姓名
|
||||
OperatorNum string `json:"operatorNum"` // 操作人手机号
|
||||
StartTime string `json:"startTime"` // 操作开始时间
|
||||
EndTime string `json:"endTime"` // 操作结束时间
|
||||
Status int `json:"status"` // 反馈完成状态 0:全部 1:未完成 2:完成
|
||||
ActualStatus int `json:"actualStatus"` // 实际完成状态 0:全部 1:未完成 2:完成
|
||||
TaskBatch string `json:"taskBatch"` // 任务批次
|
||||
Page int `json:"page"` // 页码
|
||||
PageSize int `json:"pageSize"` // 每页数量
|
||||
SortBy string `json:"sortBy"` // 排序字段(白名单)
|
||||
SortType string `json:"sortType"` // 排序方式
|
||||
}
|
||||
|
||||
// 任务记录表返回结构体
|
||||
type TaskAssignRecordsResponse struct {
|
||||
AssignRecordsUUID string `gorm:"column:assign_records_uuid;comment:指派记录UUID" json:"assignRecordsUUID"`
|
||||
SubNum string `gorm:"column:sub_num;comment:艺人编号" json:"subNum"`
|
||||
TelNum string `gorm:"column:tel_num;comment:艺人手机号" json:"telNum"`
|
||||
ArtistName string `gorm:"column:artist_name;comment:艺人名称" json:"artistName"`
|
||||
Status int `gorm:"column:status;comment:反馈完成状态 1:未完成 2:完成" json:"status"`
|
||||
ActualStatus int `gorm:"column:actual_status;comment:实际完成状态 1:未完成 2:完成" json:"actualStatus"`
|
||||
CompleteTime *time.Time `gorm:"column:complete_time;comment:反馈完成时间" json:"completeTime"`
|
||||
OperatorType int `gorm:"column:operator_type;comment:操作类型 1:修改待发数量 2:指派" json:"operatorType"`
|
||||
Operator string `gorm:"column:operator;comment:操作人" json:"operator"`
|
||||
OperatorNum string `gorm:"column:operator_num;comment:操作人账号" json:"operatorNum"`
|
||||
OperatorTime time.Time `gorm:"column:operator_time;comment:操作时间" json:"operatorTime"`
|
||||
TaskAssignee string `gorm:"column:task_assignee;comment:任务指派人" json:"taskAssignee"`
|
||||
TaskAssigneeNum string `gorm:"column:task_assignee_num;comment:任务指派人账号" json:"taskAssigneeNum"`
|
||||
TaskBatch string `gorm:"column:task_batch;comment:任务批次" json:"taskBatch"`
|
||||
PendingVideoCount int `gorm:"column:pending_video_count;comment:待发视频数量" json:"pendingVideoCount"`
|
||||
PendingPostCount int `gorm:"column:pending_post_count;comment:待发图文数量" json:"pendingPostCount"`
|
||||
PendingDataCount int `gorm:"column:pending_data_count;comment:待发数据数量" json:"pendingDataCount"`
|
||||
PendingVideoScriptCount int `gorm:"column:pending_video_script_count;comment:待发视频脚本数量" json:"pendingVideoScriptCount"`
|
||||
// 已完成统计
|
||||
CompleteVideoScriptCount int `gorm:"column:complete_video_script_count;comment:已完成视频脚本数" json:"completeVideoScriptCount"`
|
||||
CompleteVideoCount int `gorm:"column:complete_video_count;comment:已完成视频数" json:"completeVideoCount"`
|
||||
CompletePostCount int `gorm:"column:complete_post_count;comment:已完成图文数" json:"completePostCount"`
|
||||
CompleteDataCount int `gorm:"column:complete_data_count;comment:已完成数据数" json:"completeDataCount"`
|
||||
UpdatedAt time.Time `gorm:"column:updated_at;comment:更新时间" json:"updatedAt"`
|
||||
}
|
||||
|
||||
// 多条件查询后分页前的艺人数量汇总
|
||||
type TaskAssignRecordsSummary struct {
|
||||
TotalPendingVideoScriptCount int `json:"totalPendingVideoScriptCount"`
|
||||
TotalPendingVideoCount int `json:"totalPendingVideoCount"`
|
||||
TotalPendingPostCount int `json:"totalPendingPostCount"`
|
||||
TotalPendingDataCount int `json:"totalPendingDataCount"`
|
||||
TotalCompleteVideoScriptCount int `json:"totalCompleteVideoScriptCount"`
|
||||
TotalCompleteVideoCount int `json:"totalCompleteVideoCount"`
|
||||
TotalCompletePostCount int `json:"totalCompletePostCount"`
|
||||
TotalCompleteDataCount int `json:"totalCompleteDataCount"`
|
||||
}
|
||||
|
||||
// ValidArtistInfo 有效艺人信息结构体
|
||||
type ValidArtistInfo struct {
|
||||
UserID int `json:"userId"` // 用户ID
|
||||
CustomerNum string `json:"customerNum"` // 艺人编号
|
||||
UserName string `json:"userName"` // 艺人姓名
|
||||
UserPhoneNumber string `json:"userPhoneNumber"` // 艺人手机号
|
||||
BundleName string `json:"bundleName"` // 套餐名称
|
||||
ExpirationTime string `json:"expirationTime"` // 过期时间
|
||||
Status int `json:"status"` // 套餐状态
|
||||
OrderUUID string `json:"orderUUID"` // 订单UUID
|
||||
AccountNumber int `json:"accountNumber"` // 账号数量
|
||||
AccountConsumptionNumber int `json:"accountConsumptionNumber"` // 账号消耗数量
|
||||
VideoNumber int `json:"videoNumber"` // 视频数量
|
||||
VideoConsumptionNumber int `json:"videoConsumptionNumber"` // 视频消耗数量
|
||||
ImageNumber int `json:"imageNumber"` // 图片数量
|
||||
ImageConsumptionNumber int `json:"imageConsumptionNumber"` // 图片消耗数量
|
||||
DataAnalysisNumber int `json:"dataAnalysisNumber"` // 数据分析数量
|
||||
DataAnalysisConsumptionNumber int `json:"dataAnalysisConsumptionNumber"` // 数据分析消耗数量
|
||||
ExpansionPacksNumber int `json:"expansionPacksNumber"` // 扩展套餐数量
|
||||
}
|
||||
|
||||
// ArtistUploadStatsItem 艺人上传与额度统计(视频/图文/数据分析)
|
||||
type ArtistUploadStatsItem struct {
|
||||
// 身份信息
|
||||
SubNum string `json:"subNum" gorm:"column:customer_num"`
|
||||
UserName string `json:"userName" gorm:"column:user_name"`
|
||||
UserPhoneNumber string `json:"userPhoneNumber" gorm:"column:user_phone_number"`
|
||||
StartAt string `json:"startAt" gorm:"column:start_at"`
|
||||
ExpiredAt string `json:"expiredAt" gorm:"column:expired_at"`
|
||||
|
||||
// 视频
|
||||
UploadedVideoCount int `json:"uploadedVideoCount" gorm:"column:uploaded_video_count"`
|
||||
BundleVideoTotal int `json:"bundleVideoTotal" gorm:"column:bundle_video_total"`
|
||||
IncreaseVideoTotal int `json:"increaseVideoTotal" gorm:"column:increase_video_total"`
|
||||
ReleasedVideoTotal int `json:"releasedVideoTotal" gorm:"column:released_video_total"`
|
||||
PendingVideoCount int `json:"pendingVideoCount" gorm:"column:pending_video_count"`
|
||||
|
||||
// 图文
|
||||
UploadedPostCount int `json:"uploadedPostCount" gorm:"column:uploaded_post_count"`
|
||||
BundlePostTotal int `json:"bundlePostTotal" gorm:"column:bundle_post_total"`
|
||||
IncreasePostTotal int `json:"increasePostTotal" gorm:"column:increase_post_total"`
|
||||
ReleasedPostTotal int `json:"releasedPostTotal" gorm:"column:released_post_total"`
|
||||
PendingPostCount int `json:"pendingPostCount" gorm:"column:pending_post_count"`
|
||||
|
||||
// 数据分析
|
||||
UploadedDataAnalysisCount int `json:"uploadedDataAnalysisCount" gorm:"column:uploaded_data_count"`
|
||||
BundleDataAnalysisTotal int `json:"bundleDataAnalysisTotal" gorm:"column:bundle_data_total"`
|
||||
IncreaseDataAnalysisTotal int `json:"increaseDataAnalysisTotal" gorm:"column:increase_data_total"`
|
||||
ReleasedDataAnalysisTotal int `json:"releasedDataAnalysisTotal" gorm:"column:released_data_total"`
|
||||
PendingDataAnalysisCount int `json:"pendingDataAnalysisCount" gorm:"column:pending_data_count"`
|
||||
|
||||
// 任务管理
|
||||
LastTaskAssignee string `json:"lastTaskAssignee" gorm:"column:last_task_assignee"`
|
||||
TaskAssigneeNum string `json:"taskAssigneeNum" gorm:"column:task_assignee_num"`
|
||||
ProgressTaskCount int `json:"progressTaskCount" gorm:"column:progress_task_count"`
|
||||
CompleteTaskCount int `json:"completeTaskCount" gorm:"column:complete_task_count"`
|
||||
|
||||
// 脚本
|
||||
UploadedVideoScriptCount int `json:"uploadedVideoScriptCount" gorm:"column:uploaded_video_script_count"`
|
||||
PendingVideoScriptCount int `json:"pendingVideoScriptCount" gorm:"column:pending_video_script_count"`
|
||||
|
||||
// 可指派数(可上传数 - 已指派且未完成的数量)
|
||||
AllowVideoScriptCount int `json:"allowVideoScriptCount" gorm:"column:allow_video_script_count"`
|
||||
AllowVideoCount int `json:"allowVideoCount" gorm:"column:allow_video_count"`
|
||||
AllowPostCount int `json:"allowPostCount" gorm:"column:allow_post_count"`
|
||||
AllowDataCount int `json:"allowDataCount" gorm:"column:allow_data_count"`
|
||||
}
|
||||
|
||||
// ArtistPendingAssignItem 艺人可指派数量(可上传数 - 已指派且未完成的数量)
|
||||
type ArtistPendingAssignItem struct {
|
||||
SubNum string `json:"subNum" gorm:"column:customer_num"`
|
||||
TelNum string `json:"telNum" gorm:"column:tel_num"`
|
||||
UserName string `json:"userName" gorm:"column:user_name"`
|
||||
AllowVideoScriptCount int `json:"allowVideoScriptCount" gorm:"column:allow_video_script_count"`
|
||||
AllowVideoCount int `json:"allowVideoCount" gorm:"column:allow_video_count"`
|
||||
AllowPostCount int `json:"allowPostCount" gorm:"column:allow_post_count"`
|
||||
AllowDataCount int `json:"allowDataCount" gorm:"column:allow_data_count"`
|
||||
}
|
||||
|
||||
// CreateTaskWorkLogRequest 创建任务日志请求参数
|
||||
type CreateTaskWorkLogRequest struct {
|
||||
AssignRecordsUUID string `json:"assignRecordsUUID"` // 任务指派记录UUID(必填)
|
||||
WorkUUID string `json:"workUUID"` // 任务作品UUID(必填)
|
||||
Title string `json:"title"` // 任务作品标题
|
||||
|
||||
ArtistUUID string `json:"artistUUID"` // 任务艺人UUID
|
||||
SubNum string `json:"subNum"` // 任务用户编号(必填)
|
||||
TelNum string `json:"telNum"` // 任务用户手机号(必填)
|
||||
ArtistName string `json:"artistName"` // 任务艺人名称
|
||||
|
||||
// 操作信息
|
||||
OperationType int `json:"operationType"` // 任务操作类型 1:加任务 2:消耗任务 3:完成任务 4:任务过期(必填)
|
||||
TaskType int `json:"taskType"` // 任务类型 1:视频 2:图片 3:数据分析(必填)
|
||||
TaskCount int `json:"taskCount"` // 任务数量(必填)
|
||||
Remark string `json:"remark"` // 任务备注
|
||||
|
||||
// 操作人信息
|
||||
OperatorName string `json:"operatorName"` // 任务操作人姓名
|
||||
OperatorNum string `json:"operatorNum"` // 任务操作人账号
|
||||
}
|
||||
|
||||
@ -10,7 +10,7 @@ import (
|
||||
)
|
||||
|
||||
// GetValidArtistList 查询套餐状态为有效中的艺人列表
|
||||
func GetValidArtistList() ([]dao.ValidArtistInfo, error) {
|
||||
func GetValidArtistList() ([]dto.ValidArtistInfo, error) {
|
||||
return dao.GetValidArtistList()
|
||||
}
|
||||
|
||||
@ -61,17 +61,17 @@ func ValidateEmployee(employeeNum string) (bool, error) {
|
||||
}
|
||||
|
||||
// GetArtistUploadStatsList 查询艺人上传与额度统计列表
|
||||
func GetArtistUploadStatsList(req *dto.TaskQueryRequest) ([]*dao.ArtistUploadStatsItem, int64, error) {
|
||||
func GetArtistUploadStatsList(req *dto.TaskQueryRequest) ([]*dto.ArtistUploadStatsItem, int64, error) {
|
||||
return dao.GetArtistUploadStatsList(req)
|
||||
}
|
||||
|
||||
// GetPendingAssignBySubNums 查询指定艺人的可指派数量
|
||||
func GetPendingAssignBySubNums(subNums []string, page int, pageSize int) ([]*dao.ArtistPendingAssignItem, int64, error) {
|
||||
func GetPendingAssignBySubNums(subNums []string, page int, pageSize int) ([]*dto.ArtistPendingAssignItem, int64, error) {
|
||||
return dao.GetPendingAssignBySubNums(subNums, page, pageSize)
|
||||
}
|
||||
|
||||
// AssignTask 指派某位员工完成某个艺人的任务
|
||||
func AssignTask(req *dao.TaskAssignRequest) error {
|
||||
func AssignTask(req *dto.TaskAssignRequest) error {
|
||||
// 1. 验证员工是否可以被指派任务
|
||||
isValid, err := ValidateEmployee(req.TaskAssigneeNum)
|
||||
if err != nil {
|
||||
@ -99,7 +99,7 @@ func AssignTask(req *dao.TaskAssignRequest) error {
|
||||
}
|
||||
|
||||
// BatchAssignTask 批量指派
|
||||
func BatchAssignTask(items []*dao.BatchAssignItem) error {
|
||||
func BatchAssignTask(items []*dto.BatchAssignItem) error {
|
||||
if len(items) == 0 {
|
||||
return commonErr.ReturnError(nil, "参数错误", "批量指派项不能为空")
|
||||
}
|
||||
@ -153,7 +153,7 @@ func GetRecentAssignRecords(limit int) ([]*bundle.RecentAssigneeItem, error) {
|
||||
}
|
||||
|
||||
// GetEmployeeAssignedTasks 根据登录人信息查询被指派给该员工的艺人任务
|
||||
func GetEmployeeAssignedTasks(req *dao.EmployeeTaskQueryRequest) ([]*dao.TaskAssignRecordsResponse, int64, error) {
|
||||
func GetEmployeeAssignedTasks(req *dto.EmployeeTaskQueryRequest) ([]*dto.TaskAssignRecordsResponse, int64, error) {
|
||||
// 1. 调用DAO层查询被指派给该员工的艺人任务
|
||||
record, total, err := dao.GetEmployeeAssignedTasks(req)
|
||||
if err != nil {
|
||||
@ -162,9 +162,9 @@ func GetEmployeeAssignedTasks(req *dao.EmployeeTaskQueryRequest) ([]*dao.TaskAss
|
||||
|
||||
// 如果查询的 status = 2 的话,待发数量就为指派时,指派的数量
|
||||
if req.Status == 2 {
|
||||
var recordResponse []*dao.TaskAssignRecordsResponse
|
||||
var recordResponse []*dto.TaskAssignRecordsResponse
|
||||
for _, record := range record {
|
||||
recordResponse = append(recordResponse, &dao.TaskAssignRecordsResponse{
|
||||
recordResponse = append(recordResponse, &dto.TaskAssignRecordsResponse{
|
||||
AssignRecordsUUID: record.AssignRecordsUUID,
|
||||
SubNum: record.SubNum,
|
||||
TelNum: record.TelNum,
|
||||
@ -191,9 +191,9 @@ func GetEmployeeAssignedTasks(req *dao.EmployeeTaskQueryRequest) ([]*dao.TaskAss
|
||||
}
|
||||
|
||||
// 2. 转换为响应结构体
|
||||
var recordResponse []*dao.TaskAssignRecordsResponse
|
||||
var recordResponse []*dto.TaskAssignRecordsResponse
|
||||
for _, record := range record {
|
||||
recordResponse = append(recordResponse, &dao.TaskAssignRecordsResponse{
|
||||
recordResponse = append(recordResponse, &dto.TaskAssignRecordsResponse{
|
||||
AssignRecordsUUID: record.AssignRecordsUUID,
|
||||
SubNum: record.SubNum,
|
||||
TelNum: record.TelNum,
|
||||
@ -295,7 +295,7 @@ func CompleteTaskManually(assignRecordsUUID string, taskAssigneeNum string) erro
|
||||
}
|
||||
|
||||
// UpdateTaskProgress 员工实际完成任务状态更新
|
||||
func UpdateTaskProgress(req *dao.CompleteTaskRequest) error {
|
||||
func UpdateTaskProgress(req *dto.CompleteTaskRequest) error {
|
||||
if req.UUID == "" {
|
||||
return commonErr.ReturnError(nil, "作品UUID不能为空", "UUID不能为空")
|
||||
}
|
||||
@ -303,16 +303,16 @@ func UpdateTaskProgress(req *dao.CompleteTaskRequest) error {
|
||||
}
|
||||
|
||||
// GetTaskAssignRecordsList 多条件查询操作记录表
|
||||
func GetTaskAssignRecordsList(req *dao.TaskAssignRecordsQueryRequest) ([]*dao.TaskAssignRecordsResponse, int64, *dao.TaskAssignRecordsSummary, error) {
|
||||
func GetTaskAssignRecordsList(req *dto.TaskAssignRecordsQueryRequest) ([]*dto.TaskAssignRecordsResponse, int64, *dto.TaskAssignRecordsSummary, error) {
|
||||
record, total, summary, err := dao.GetTaskAssignRecordsList(req)
|
||||
if err != nil {
|
||||
return nil, 0, nil, err
|
||||
}
|
||||
|
||||
// 2. 转换为响应结构体
|
||||
var recordResponse []*dao.TaskAssignRecordsResponse
|
||||
var recordResponse []*dto.TaskAssignRecordsResponse
|
||||
for _, record := range record {
|
||||
recordResponse = append(recordResponse, &dao.TaskAssignRecordsResponse{
|
||||
recordResponse = append(recordResponse, &dto.TaskAssignRecordsResponse{
|
||||
AssignRecordsUUID: record.AssignRecordsUUID,
|
||||
SubNum: record.SubNum,
|
||||
TelNum: record.TelNum,
|
||||
@ -427,7 +427,7 @@ func AddHiddenTaskAssignee(taskAssignee string, taskAssigneeNum string) error {
|
||||
}
|
||||
|
||||
// CreateTaskWorkLog 创建任务日志记录
|
||||
func CreateTaskWorkLog(req *dao.CreateTaskWorkLogRequest) error {
|
||||
func CreateTaskWorkLog(req *dto.CreateTaskWorkLogRequest) error {
|
||||
if req.OperationType < 1 || req.OperationType > 4 {
|
||||
return commonErr.ReturnError(nil, "参数错误", "操作类型必须在1-4之间")
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user