Compare commits
2 Commits
main
...
feat-cjy-g
| Author | SHA1 | Date | |
|---|---|---|---|
| 0397027f49 | |||
| e54f538c92 |
@ -134,10 +134,3 @@ func (b *BundleProvider) SoftDeleteUnfinishedInfo(_ context.Context, req *bundle
|
|||||||
func (b *BundleProvider) ReSignTheContract(_ context.Context, req *bundle.ReSignTheContractRequest) (res *bundle.CommonResponse, err error) {
|
func (b *BundleProvider) ReSignTheContract(_ context.Context, req *bundle.ReSignTheContractRequest) (res *bundle.CommonResponse, err error) {
|
||||||
return logic.ReSignTheContract(req)
|
return logic.ReSignTheContract(req)
|
||||||
}
|
}
|
||||||
func (b *BundleProvider) OrderListByOrderUuid(_ context.Context, req *bundle.OrderInfoByOrderUuidRequest) (res *bundle.OrderInfoByOrderNoResp, err error) {
|
|
||||||
return logic.OrderListByOrderUuid(req)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (b *BundleProvider) UpdateOrderRecordByOrderUuid(_ context.Context, req *bundle.OrderRecord) (res *bundle.CommonResponse, err error) {
|
|
||||||
return logic.UpdateOrderRecordByOrderUuid(req)
|
|
||||||
}
|
|
||||||
|
|||||||
@ -1,34 +0,0 @@
|
|||||||
package controller
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"micro-bundle/internal/logic"
|
|
||||||
"micro-bundle/pb/bundle"
|
|
||||||
)
|
|
||||||
|
|
||||||
// 合同管理相关接口
|
|
||||||
|
|
||||||
// UpdateContract 合同更新接口(根据action判断新增/更新/删除)
|
|
||||||
func (b *BundleProvider) UpdateContract(_ context.Context, req *bundle.ContractUpdateRequest) (res *bundle.ComResponse, err error) {
|
|
||||||
return logic.UpdateContract(req)
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetContractList 查询合同列表
|
|
||||||
func (b *BundleProvider) GetContractList(_ context.Context, req *bundle.ContractListRequest) (res *bundle.ContractListResponse, err error) {
|
|
||||||
return logic.GetContractList(req)
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetContractDetail 根据合同UUID查询详情
|
|
||||||
func (b *BundleProvider) GetContractDetail(_ context.Context, req *bundle.ContractDetailRequest) (res *bundle.ContractDetailResponse, err error) {
|
|
||||||
return logic.GetContractDetail(req)
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetDevelopmentCyclesByContractUUID 根据合同UUID查询开发周期
|
|
||||||
func (b *BundleProvider) GetDevelopmentCyclesByContractUUID(_ context.Context, req *bundle.GetDevelopmentCyclesByContractUUIDRequest) (res *bundle.GetDevelopmentCyclesByContractUUIDResponse, err error) {
|
|
||||||
return logic.GetDevelopmentCyclesByContractUUID(req)
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetPaymentCyclesByContractUUID 根据合同UUID查询支付周期
|
|
||||||
func (b *BundleProvider) GetPaymentCyclesByContractUUID(_ context.Context, req *bundle.GetPaymentCyclesByContractUUIDRequest) (res *bundle.GetPaymentCyclesByContractUUIDResponse, err error) {
|
|
||||||
return logic.GetPaymentCyclesByContractUUID(req)
|
|
||||||
}
|
|
||||||
@ -1,34 +0,0 @@
|
|||||||
package controller
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"micro-bundle/internal/logic"
|
|
||||||
"micro-bundle/pb/bundle"
|
|
||||||
)
|
|
||||||
|
|
||||||
// 客户管理相关接口
|
|
||||||
|
|
||||||
// GetCustomerList 多条件查询客户列表
|
|
||||||
func (b *BundleProvider) GetCustomerList(_ context.Context, req *bundle.CustomerListRequest) (res *bundle.CustomerListResponse, err error) {
|
|
||||||
return logic.GetCustomerList(req)
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetCustomerDetail 根据客户ID查询客户详情
|
|
||||||
func (b *BundleProvider) GetCustomerDetail(_ context.Context, req *bundle.CustomerDetailRequest) (res *bundle.CustomerDetailResponse, err error) {
|
|
||||||
return logic.GetCustomerDetail(req)
|
|
||||||
}
|
|
||||||
|
|
||||||
// UpdateCustomer 更新客户接口(根据action判断新增/更新/删除)
|
|
||||||
func (b *BundleProvider) UpdateCustomer(_ context.Context, req *bundle.CustomerUpdateRequest) (res *bundle.ComResponse, err error) {
|
|
||||||
// 调用logic层,logic层返回CommonResponse,需要转换为ComResponse
|
|
||||||
commonRes, err := logic.UpdateCustomer(req)
|
|
||||||
if err != nil {
|
|
||||||
return &bundle.ComResponse{Msg: err.Error()}, err
|
|
||||||
}
|
|
||||||
return &bundle.ComResponse{Msg: commonRes.Msg}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetReferralPersonList 查询所有不重复的推荐人列表
|
|
||||||
func (b *BundleProvider) GetReferralPersonList(_ context.Context, req *bundle.ReferralPersonListRequest) (res *bundle.ReferralPersonListResponse, err error) {
|
|
||||||
return logic.GetReferralPersonList(req)
|
|
||||||
}
|
|
||||||
@ -1,88 +0,0 @@
|
|||||||
package controller
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"micro-bundle/internal/logic"
|
|
||||||
"micro-bundle/pb/bundle"
|
|
||||||
)
|
|
||||||
|
|
||||||
// 创建电子发票
|
|
||||||
func (b *BundleProvider) CreateInvoice(_ context.Context, req *bundle.CreateInvoiceReq) (*bundle.CreateInvoiceResp, error) {
|
|
||||||
res, err := logic.CreateInvoice(req)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return res, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// 创建纸质发票地址
|
|
||||||
func (b *BundleProvider) CreatePaperInvoiceAddress(_ context.Context, req *bundle.CreatePaperInvoiceAddressReq) (*bundle.CreatePaperInvoiceAddressResp, error) {
|
|
||||||
res, err := logic.CreatePaperInvoiceAddress(req)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return res, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取发票列表
|
|
||||||
func (b *BundleProvider) GetInvoiceList(_ context.Context, req *bundle.GetInvoiceListReq) (*bundle.GetInvoiceListResp, error) {
|
|
||||||
res, err := logic.GetInvoiceList(req)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return res, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// 更新发票快递信息
|
|
||||||
func (b *BundleProvider) UpdateInvoiceExpressInfo(_ context.Context, req *bundle.UpdateInvoiceExpressInfoReq) (*bundle.UpdateInvoiceExpressInfoResp, error) {
|
|
||||||
res, err := logic.UpdateInvoiceExpressInfo(req)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return res, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// 查看快递信息
|
|
||||||
func (b *BundleProvider) GetInvoiceExpressInfo(_ context.Context, req *bundle.GetInvoiceExpressInfoReq) (*bundle.GetInvoiceExpressInfoResp, error) {
|
|
||||||
res, err := logic.GetInvoiceExpressInfo(req)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return res, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取订单信息
|
|
||||||
func (b *BundleProvider) GetOrderInfoByOrderNo(_ context.Context, req *bundle.GetOrderInfoByOrderNoReq) (*bundle.GetOrderInfoByOrderNoResp, error) {
|
|
||||||
res, err := logic.GetOrderInfoByOrderNo(req)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return res, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取对应用户发票列表
|
|
||||||
func (b *BundleProvider) GetInvoiceInfoByOrderNo(_ context.Context, req *bundle.GetInvoiceInfoByOrderNoReq) (*bundle.GetInvoiceInfoByOrderNoResp, error) {
|
|
||||||
res, err := logic.GetInvoiceInfoByOrderNo(req)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return res, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取最后一张发票编号
|
|
||||||
func (b *BundleProvider) GetLastInvoiceNo(_ context.Context, req *bundle.GetLastInvoiceNoReq) (*bundle.GetLastInvoiceNoResp, error) {
|
|
||||||
res, err := logic.GetLastInvoiceNo(req)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return res, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// 更新发票url
|
|
||||||
func (b *BundleProvider) UpdataInvoiceInfo(_ context.Context, req *bundle.UpdataInvoiceInfoReq) (*bundle.UpdataInvoiceInfoResp, error) {
|
|
||||||
res, err := logic.UpdataInvoiceInfo(req)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return res, nil
|
|
||||||
}
|
|
||||||
@ -1,23 +0,0 @@
|
|||||||
package controller
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"micro-bundle/internal/logic"
|
|
||||||
"micro-bundle/pb/bundle"
|
|
||||||
)
|
|
||||||
|
|
||||||
func (b *BundleProvider) SendQuestionnaireSurvey(_ context.Context, req *bundle.SendQuestionnaireSurveyRequest) (*bundle.SendQuestionnaireSurveyResponse, error) {
|
|
||||||
return logic.SendQuestionnaireSurvey(req)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (b *BundleProvider) GetQuestionnaireSurveyInfo(_ context.Context, req *bundle.GetQuestionnaireSurveyInfoRequest) (*bundle.GetQuestionnaireSurveyInfoResponse, error) {
|
|
||||||
return logic.GetQuestionnaireSurveyInfo(req)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (b *BundleProvider) CreateQuestionnaireSurveyAnswer(_ context.Context, req *bundle.CreateQuestionnaireSurveyAnswerRequest) (*bundle.CreateQuestionnaireSurveyAnswerResponse, error) {
|
|
||||||
return logic.CreateQuestionnaireSurveyAnswer(req)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (b *BundleProvider) GetQuestionnaireSurveyList(_ context.Context, req *bundle.GetQuestionnaireSurveyListRequest) (*bundle.GetQuestionnaireSurveyListResponse, error) {
|
|
||||||
return logic.GetQuestionnaireSurveyList(req)
|
|
||||||
}
|
|
||||||
@ -28,8 +28,6 @@ func (b *BundleProvider) AssignTask(_ context.Context, req *bundle.TaskAssignReq
|
|||||||
AssignPostCount: int(req.AssignPostCount),
|
AssignPostCount: int(req.AssignPostCount),
|
||||||
AssignDataCount: int(req.AssignDataCount),
|
AssignDataCount: int(req.AssignDataCount),
|
||||||
AssignVideoScriptCount: int(req.AssignVideoScriptCount),
|
AssignVideoScriptCount: int(req.AssignVideoScriptCount),
|
||||||
AssignReportCount: int(req.AssignReportCount),
|
|
||||||
UserID: int(req.UserID),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
err := logic.AssignTask(daoReq)
|
err := logic.AssignTask(daoReq)
|
||||||
@ -262,8 +260,6 @@ func convertToTaskAssignRecordInfo(record *dto.TaskAssignRecordsResponse) *bundl
|
|||||||
CompleteVideoCount: int32(record.CompleteVideoCount),
|
CompleteVideoCount: int32(record.CompleteVideoCount),
|
||||||
CompletePostCount: int32(record.CompletePostCount),
|
CompletePostCount: int32(record.CompletePostCount),
|
||||||
CompleteDataCount: int32(record.CompleteDataCount),
|
CompleteDataCount: int32(record.CompleteDataCount),
|
||||||
PendingReportCount: int32(record.PendingReportCount),
|
|
||||||
CompleteReportCount: int32(record.CompleteReportCount),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -277,12 +273,10 @@ func convertToTaskAssignRecordsSummary(s *dto.TaskAssignRecordsSummary) *bundle.
|
|||||||
TotalPendingVideoCount: int32(s.TotalPendingVideoCount),
|
TotalPendingVideoCount: int32(s.TotalPendingVideoCount),
|
||||||
TotalPendingPostCount: int32(s.TotalPendingPostCount),
|
TotalPendingPostCount: int32(s.TotalPendingPostCount),
|
||||||
TotalPendingDataCount: int32(s.TotalPendingDataCount),
|
TotalPendingDataCount: int32(s.TotalPendingDataCount),
|
||||||
TotalPendingReportCount: int32(s.TotalPendingReportCount),
|
|
||||||
TotalCompleteVideoScriptCount: int32(s.TotalCompleteVideoScriptCount),
|
TotalCompleteVideoScriptCount: int32(s.TotalCompleteVideoScriptCount),
|
||||||
TotalCompleteVideoCount: int32(s.TotalCompleteVideoCount),
|
TotalCompleteVideoCount: int32(s.TotalCompleteVideoCount),
|
||||||
TotalCompletePostCount: int32(s.TotalCompletePostCount),
|
TotalCompletePostCount: int32(s.TotalCompletePostCount),
|
||||||
TotalCompleteDataCount: int32(s.TotalCompleteDataCount),
|
TotalCompleteDataCount: int32(s.TotalCompleteDataCount),
|
||||||
TotalCompleteReportCount: int32(s.TotalCompleteReportCount),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -311,9 +305,7 @@ func (b *BundleProvider) BatchAssignTask(_ context.Context, req *bundle.BatchAss
|
|||||||
AssignPostCount: int(it.AssignPostCount),
|
AssignPostCount: int(it.AssignPostCount),
|
||||||
AssignDataCount: int(it.AssignDataCount),
|
AssignDataCount: int(it.AssignDataCount),
|
||||||
AssignVideoScriptCount: int(it.AssignVideoScriptCount),
|
AssignVideoScriptCount: int(it.AssignVideoScriptCount),
|
||||||
AssignReportCount: int(it.AssignReportCount),
|
|
||||||
TaskBatch: it.TaskBatch,
|
TaskBatch: it.TaskBatch,
|
||||||
UserID: int(it.UserID),
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -381,11 +373,6 @@ func (b *BundleProvider) GetArtistUploadStatsList(_ context.Context, req *bundle
|
|||||||
IncreaseDataAnalysisTotal: int32(it.IncreaseDataAnalysisTotal),
|
IncreaseDataAnalysisTotal: int32(it.IncreaseDataAnalysisTotal),
|
||||||
ReleasedDataAnalysisTotal: int32(it.ReleasedDataAnalysisTotal),
|
ReleasedDataAnalysisTotal: int32(it.ReleasedDataAnalysisTotal),
|
||||||
PendingDataAnalysisCount: int32(it.PendingDataAnalysisCount),
|
PendingDataAnalysisCount: int32(it.PendingDataAnalysisCount),
|
||||||
UploadedReportCount: int32(it.UploadedReportCount),
|
|
||||||
BundleReportTotal: int32(it.BundleReportTotal),
|
|
||||||
IncreaseReportTotal: int32(it.IncreaseReportTotal),
|
|
||||||
ReleasedReportTotal: int32(it.ReleasedReportTotal),
|
|
||||||
PendingReportCount: int32(it.PendingReportCount),
|
|
||||||
LastTaskAssignee: it.LastTaskAssignee,
|
LastTaskAssignee: it.LastTaskAssignee,
|
||||||
TaskAssigneeNum: it.TaskAssigneeNum,
|
TaskAssigneeNum: it.TaskAssigneeNum,
|
||||||
ProgressTaskCount: int32(it.ProgressTaskCount),
|
ProgressTaskCount: int32(it.ProgressTaskCount),
|
||||||
@ -396,7 +383,6 @@ func (b *BundleProvider) GetArtistUploadStatsList(_ context.Context, req *bundle
|
|||||||
AllowVideoCount: int32(it.AllowVideoCount),
|
AllowVideoCount: int32(it.AllowVideoCount),
|
||||||
AllowPostCount: int32(it.AllowPostCount),
|
AllowPostCount: int32(it.AllowPostCount),
|
||||||
AllowDataCount: int32(it.AllowDataCount),
|
AllowDataCount: int32(it.AllowDataCount),
|
||||||
AllowReportCount: int32(it.AllowReportCount),
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -424,7 +410,6 @@ func (b *BundleProvider) GetPendingAssign(_ context.Context, req *bundle.Pending
|
|||||||
AllowVideoCount: int32(it.AllowVideoCount),
|
AllowVideoCount: int32(it.AllowVideoCount),
|
||||||
AllowPostCount: int32(it.AllowPostCount),
|
AllowPostCount: int32(it.AllowPostCount),
|
||||||
AllowDataCount: int32(it.AllowDataCount),
|
AllowDataCount: int32(it.AllowDataCount),
|
||||||
AllowReportCount: int32(it.AllowReportCount),
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return &bundle.PendingAssignResponse{Items: respItems, Total: total, Page: req.Page, PageSize: req.PageSize}, nil
|
return &bundle.PendingAssignResponse{Items: respItems, Total: total, Page: req.Page, PageSize: req.PageSize}, nil
|
||||||
@ -452,54 +437,6 @@ func (b *BundleProvider) AddHiddenTaskAssignee(_ context.Context, req *bundle.Ad
|
|||||||
return &bundle.ComResponse{Msg: "删除该指派人成功"}, nil
|
return &bundle.ComResponse{Msg: "删除该指派人成功"}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *BundleProvider) GetTaskWorkLogList(_ context.Context, req *bundle.TaskWorkLogQueryRequest) (*bundle.TaskWorkLogQueryResponse, error) {
|
|
||||||
daoReq := &dto.TaskWorkLogQueryRequest{
|
|
||||||
AssignRecordsUUID: req.AssignRecordsUUID,
|
|
||||||
OperationType: int(req.OperationType),
|
|
||||||
TaskType: int(req.TaskType),
|
|
||||||
ArtistUUID: req.ArtistUUID,
|
|
||||||
SubNum: req.SubNum,
|
|
||||||
ArtistName: req.ArtistName,
|
|
||||||
Page: int(req.Page),
|
|
||||||
PageSize: int(req.PageSize),
|
|
||||||
}
|
|
||||||
|
|
||||||
records, total, err := logic.GetTaskWorkLogList(daoReq)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
respItems := make([]*bundle.TaskWorkLogInfo, 0, len(records))
|
|
||||||
for _, record := range records {
|
|
||||||
respItems = append(respItems, &bundle.TaskWorkLogInfo{
|
|
||||||
WorkLogUUID: record.WorkLogUUID,
|
|
||||||
AssignRecordsUUID: record.AssignRecordsUUID,
|
|
||||||
WorkUUID: record.WorkUUID,
|
|
||||||
Title: record.Title,
|
|
||||||
ArtistUUID: record.ArtistUUID,
|
|
||||||
SubNum: record.SubNum,
|
|
||||||
TelNum: record.TelNum,
|
|
||||||
ArtistName: record.ArtistName,
|
|
||||||
OperationType: int32(record.OperationType),
|
|
||||||
TaskType: int32(record.TaskType),
|
|
||||||
TaskCount: int32(record.TaskCount),
|
|
||||||
Remark: record.Remark,
|
|
||||||
OperatorName: record.OperatorName,
|
|
||||||
OperatorNum: record.OperatorNum,
|
|
||||||
OperationTime: int64(record.OperationTime),
|
|
||||||
CreatedAt: int64(record.CreatedAt),
|
|
||||||
UpdatedAt: int64(record.UpdatedAt),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
return &bundle.TaskWorkLogQueryResponse{
|
|
||||||
Records: respItems,
|
|
||||||
Total: total,
|
|
||||||
Page: req.Page,
|
|
||||||
PageSize: req.PageSize,
|
|
||||||
}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreateTaskWorkLog 创建任务日志记录
|
// CreateTaskWorkLog 创建任务日志记录
|
||||||
func (b *BundleProvider) CreateTaskWorkLog(_ context.Context, req *bundle.CreateTaskWorkLogRequest) (*bundle.CommonResponse, error) {
|
func (b *BundleProvider) CreateTaskWorkLog(_ context.Context, req *bundle.CreateTaskWorkLogRequest) (*bundle.CommonResponse, error) {
|
||||||
// 转换请求参数
|
// 转换请求参数
|
||||||
|
|||||||
@ -96,7 +96,7 @@ func GetBundleBalanceList(req *bundle.GetBundleBalanceListReq) (data []model.Bun
|
|||||||
if utils.IsPhoneNumber(req.UserName) {
|
if utils.IsPhoneNumber(req.UserName) {
|
||||||
session = session.Where("u.tel_num = ?", req.UserName)
|
session = session.Where("u.tel_num = ?", req.UserName)
|
||||||
} else {
|
} else {
|
||||||
session = session.Where("rn.name LIKE ? OR bor.customer_num LIKE ?", "%"+req.UserName+"%", "%"+req.UserName+"%")
|
session = session.Where("rn.name like ?", "%"+req.UserName+"%")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if req.BundleName != "" {
|
if req.BundleName != "" {
|
||||||
@ -120,18 +120,17 @@ func GetBundleBalanceList(req *bundle.GetBundleBalanceListReq) (data []model.Bun
|
|||||||
if req.Bought == 1 {
|
if req.Bought == 1 {
|
||||||
session = session.Where("bb.user_id IS NULL")
|
session = session.Where("bb.user_id IS NULL")
|
||||||
}
|
}
|
||||||
t := time.Now()
|
|
||||||
if req.StatusType != 0 {
|
if req.StatusType != 0 {
|
||||||
if req.ExpiredTimeStart > time.Now().UnixMilli() {
|
if req.ExpiredTimeStart > time.Now().UnixMilli() {
|
||||||
if req.StatusType == 1 {
|
if req.StatusType == 1 {
|
||||||
session = session.Where("bb.expired_at <= ?", t.Format("2006-01-02 15:04:05"))
|
session = session.Where("bb.expired_at <= ?", time.Now().UnixMilli())
|
||||||
} else {
|
} else {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if req.StatusType == 1 {
|
if req.StatusType == 1 {
|
||||||
session = session.Where("bb.expired_at <= ?", t.Format("2006-01-02 15:04:05"))
|
session = session.Where("bb.expired_at <= ?", time.Now().UnixMilli())
|
||||||
} else {
|
} else {
|
||||||
session = session.Where("bb.expired_at >= ?", t.Format("2006-01-02 15:04:05"))
|
session = session.Where("bb.expired_at >= ?", time.Now().UnixMilli())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -199,11 +199,10 @@ func MetricsBusiness(req *bundle.MetricsBusinessReq) (result *bundle.MetricsBusi
|
|||||||
Joins("left join cast_cost_log ccl on ccl.work_uuid = cast_work.uuid").
|
Joins("left join cast_cost_log ccl on ccl.work_uuid = cast_work.uuid").
|
||||||
Joins("INNER JOIN cast_work_log cwl on cwl.work_uuid = cast_work.uuid and cwl.work_status = 9").
|
Joins("INNER JOIN cast_work_log cwl on cwl.work_uuid = cast_work.uuid and cwl.work_status = 9").
|
||||||
Where("cwe.cost_type = 1").
|
Where("cwe.cost_type = 1").
|
||||||
Where("cast_work.work_category = 2").
|
|
||||||
Where("cwl.update_time >= ?", req.Start+" 00:00:00").
|
Where("cwl.update_time >= ?", req.Start+" 00:00:00").
|
||||||
Where("cwl.update_time <= ?", req.End+" 23:59:59").
|
Where("cwl.update_time <= ?", req.End+" 23:59:59").
|
||||||
Where("cast_work.origin_uuid = ''").
|
Where("cast_work.origin_uuid = ''").
|
||||||
Where("cast_work.deleted_at = 0 and ccl.deleted_at = 0 and cwe.deleted_at = 0 and cwl.deleted_at = 0")
|
Where("cast_work.deleted_at = 0 and ccl.deleted_at = 0 and cwe.deleted_at = 0")
|
||||||
if req.BundleUuid != "" {
|
if req.BundleUuid != "" {
|
||||||
query = query.Where("ccl.bundle_uuid = ?", req.BundleUuid)
|
query = query.Where("ccl.bundle_uuid = ?", req.BundleUuid)
|
||||||
}
|
}
|
||||||
@ -219,11 +218,10 @@ func MetricsBusiness(req *bundle.MetricsBusinessReq) (result *bundle.MetricsBusi
|
|||||||
Joins("left join cast_cost_log ccl on ccl.work_uuid = cast_work.uuid").
|
Joins("left join cast_cost_log ccl on ccl.work_uuid = cast_work.uuid").
|
||||||
Joins("INNER JOIN cast_work_log cwl on cwl.work_uuid = cast_work.uuid and cwl.work_status = 9").
|
Joins("INNER JOIN cast_work_log cwl on cwl.work_uuid = cast_work.uuid and cwl.work_status = 9").
|
||||||
Where("cwe.cost_type != 1").
|
Where("cwe.cost_type != 1").
|
||||||
Where("cast_work.work_category = 2").
|
|
||||||
Where("cwl.update_time >= ?", req.Start+" 00:00:00").
|
Where("cwl.update_time >= ?", req.Start+" 00:00:00").
|
||||||
Where("cwl.update_time <= ?", req.End+" 23:59:59").
|
Where("cwl.update_time <= ?", req.End+" 23:59:59").
|
||||||
Where("cast_work.origin_uuid = ''").
|
Where("cast_work.origin_uuid = ''").
|
||||||
Where("cast_work.deleted_at = 0 and ccl.deleted_at = 0 and cwe.deleted_at = 0 and cwl.deleted_at = 0")
|
Where("cast_work.deleted_at = 0 and ccl.deleted_at = 0 and cwe.deleted_at = 0")
|
||||||
if req.BundleUuid != "" {
|
if req.BundleUuid != "" {
|
||||||
query = query.Where("ccl.bundle_uuid = ?", req.BundleUuid)
|
query = query.Where("ccl.bundle_uuid = ?", req.BundleUuid)
|
||||||
}
|
}
|
||||||
@ -334,13 +332,13 @@ func MetricsBusiness(req *bundle.MetricsBusinessReq) (result *bundle.MetricsBusi
|
|||||||
newVideoUsed = videoCountInfo.VideoUsed + videoCountInfo.UnUsedVideo
|
newVideoUsed = videoCountInfo.VideoUsed + videoCountInfo.UnUsedVideo
|
||||||
} else {
|
} else {
|
||||||
query = app.ModuleClients.BundleDB.Model(&model.CastWork{}).
|
query = app.ModuleClients.BundleDB.Model(&model.CastWork{}).
|
||||||
Joins("LEFT JOIN cast_work_extra cwe ON cwe.work_uuid = cast_work.uuid").
|
Joins("left join bundle_balance bb ON CAST(bb.user_id AS CHAR) COLLATE utf8mb4_general_ci = cast_work.artist_uuid COLLATE utf8mb4_general_ci AND cast_work.submit_time >= bb.start_at AND cast_work.submit_time <= bb.expired_at and bb.month = DATE_FORMAT(cast_work.submit_time, '%Y-%m')").
|
||||||
Joins("left join bundle_order_records bor ON bor.uuid COLLATE utf8mb4_general_ci = cwe.bundle_order_uuid COLLATE utf8mb4_general_ci").
|
Joins("left join bundle_order_records bor ON bor.uuid = bb.order_uuid").
|
||||||
Where("cast_work.work_category = 2").
|
Where("cast_work.work_category = 2").
|
||||||
Where("cast_work.submit_time >= ?", req.Start+" 00:00:00").
|
Where("cast_work.submit_time >= ?", req.Start+" 00:00:00").
|
||||||
Where("cast_work.submit_time <= ?", req.End+" 23:59:59").
|
Where("cast_work.submit_time <= ?", req.End+" 23:59:59").
|
||||||
Where("cast_work.origin_uuid = ''").
|
Where("cast_work.origin_uuid = ''").
|
||||||
Where("cast_work.deleted_at = 0 and bor.deleted_at IS NULL and cwe.deleted_at = 0").
|
Where("cast_work.deleted_at = 0 and bor.deleted_at IS NULL and bb.deleted_at IS NULL").
|
||||||
Where("bor.bundle_uuid = ?", req.BundleUuid)
|
Where("bor.bundle_uuid = ?", req.BundleUuid)
|
||||||
err = query.Count(&newVideoUsed).Error
|
err = query.Count(&newVideoUsed).Error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -473,13 +471,13 @@ func MetricsBusiness(req *bundle.MetricsBusinessReq) (result *bundle.MetricsBusi
|
|||||||
newImageUsed = imageCountInfo.ImageUsed + imageCountInfo.UnUsedImage
|
newImageUsed = imageCountInfo.ImageUsed + imageCountInfo.UnUsedImage
|
||||||
} else {
|
} else {
|
||||||
query = app.ModuleClients.BundleDB.Model(&model.CastWork{}).
|
query = app.ModuleClients.BundleDB.Model(&model.CastWork{}).
|
||||||
Joins("LEFT JOIN cast_work_extra cwe ON cwe.work_uuid = cast_work.uuid ").
|
Joins("left join bundle_balance bb ON CAST(bb.user_id AS CHAR) COLLATE utf8mb4_general_ci = cast_work.artist_uuid COLLATE utf8mb4_general_ci AND cast_work.submit_time >= bb.start_at AND cast_work.submit_time <= bb.expired_at and bb.month = DATE_FORMAT(cast_work.submit_time, '%Y-%m')").
|
||||||
Joins("left join bundle_order_records bor ON bor.uuid COLLATE utf8mb4_general_ci = cwe.bundle_order_uuid COLLATE utf8mb4_general_ci").
|
Joins("left join bundle_order_records bor ON bor.uuid = bb.order_uuid").
|
||||||
Where("cast_work.work_category = 1").
|
Where("cast_work.work_category = 1").
|
||||||
Where("cast_work.submit_time >= ?", req.Start+" 00:00:00").
|
Where("cast_work.submit_time >= ?", req.Start+" 00:00:00").
|
||||||
Where("cast_work.submit_time <= ?", req.End+" 23:59:59").
|
Where("cast_work.submit_time <= ?", req.End+" 23:59:59").
|
||||||
Where("cast_work.origin_uuid = ''").
|
Where("cast_work.origin_uuid = ''").
|
||||||
Where("cast_work.deleted_at = 0 and bor.deleted_at IS NULL and cwe.deleted_at = 0").
|
Where("cast_work.deleted_at = 0 and bor.deleted_at IS NULL and bb.deleted_at IS NULL").
|
||||||
Where("bor.bundle_uuid = ?", req.BundleUuid)
|
Where("bor.bundle_uuid = ?", req.BundleUuid)
|
||||||
err = query.Count(&newImageUsed).Error
|
err = query.Count(&newImageUsed).Error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -551,11 +549,11 @@ func MetricsBusiness(req *bundle.MetricsBusinessReq) (result *bundle.MetricsBusi
|
|||||||
newDataAnalysisUsed = dataAnalysisCountInfo.DataAnalysisUsed + dataAnalysisCountInfo.UnUsedDataAnalysis
|
newDataAnalysisUsed = dataAnalysisCountInfo.DataAnalysisUsed + dataAnalysisCountInfo.UnUsedDataAnalysis
|
||||||
} else {
|
} else {
|
||||||
query = app.ModuleClients.BundleDB.Table("cast_work_analysis as cwa").
|
query = app.ModuleClients.BundleDB.Table("cast_work_analysis as cwa").
|
||||||
Joins("LEFT JOIN cast_work_analysis_extra cwae ON cwae.analysis_uuid = cwa.uuid").
|
Joins("left join bundle_balance bb ON CAST(bb.user_id AS CHAR) COLLATE utf8mb4_general_ci = cwa.artist_id COLLATE utf8mb4_general_ci AND cwa.submit_time >= bb.start_at AND cwa.submit_time <= bb.expired_at and bb.month = DATE_FORMAT(cwa.submit_time, '%Y-%m')").
|
||||||
Joins("left join bundle_order_records bor ON bor.uuid COLLATE utf8mb4_general_ci = cwae.bundle_order_uuid COLLATE utf8mb4_general_ci").
|
Joins("left join bundle_order_records bor ON bor.uuid = bb.order_uuid").
|
||||||
Where("cwa.submit_time >= ?", req.Start+" 00:00:00").
|
Where("cwa.submit_time >= ?", req.Start+" 00:00:00").
|
||||||
Where("cwa.submit_time <= ?", req.End+" 23:59:59").
|
Where("cwa.submit_time <= ?", req.End+" 23:59:59").
|
||||||
Where("cwa.deleted_at = 0 and bor.deleted_at IS NULL and cwae.deleted_at = 0").
|
Where("cwa.deleted_at = 0 and bor.deleted_at IS NULL and bb.deleted_at IS NULL").
|
||||||
Where("bor.bundle_uuid = ?", req.BundleUuid)
|
Where("bor.bundle_uuid = ?", req.BundleUuid)
|
||||||
err = query.Count(&newDataAnalysisUsed).Error
|
err = query.Count(&newDataAnalysisUsed).Error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -621,11 +619,11 @@ func MetricsBusiness(req *bundle.MetricsBusinessReq) (result *bundle.MetricsBusi
|
|||||||
newConpetitiveUsed = conpetitiveCountInfo.ConpetitiveUsed + conpetitiveCountInfo.UnUsedConpetitive
|
newConpetitiveUsed = conpetitiveCountInfo.ConpetitiveUsed + conpetitiveCountInfo.UnUsedConpetitive
|
||||||
} else {
|
} else {
|
||||||
query = app.ModuleClients.BundleDB.Table("cast_competitive_report as ccr").
|
query = app.ModuleClients.BundleDB.Table("cast_competitive_report as ccr").
|
||||||
Joins("LEFT JOIN cast_competitive_report_extra ccrpe ON ccrpe.report_uuid = ccr.uuid").
|
Joins("left join bundle_balance bb ON CAST(bb.user_id AS CHAR) COLLATE utf8mb4_general_ci = ccr.artist_id COLLATE utf8mb4_general_ci AND ccr.submit_time >= bb.start_at AND ccr.submit_time <= bb.expired_at and bb.month = DATE_FORMAT(ccr.submit_time, '%Y-%m')").
|
||||||
Joins("left join bundle_order_records bor ON bor.uuid COLLATE utf8mb4_general_ci = ccrpe.bundle_order_uuid COLLATE utf8mb4_general_ci").
|
Joins("left join bundle_order_records bor ON bor.uuid = bb.order_uuid").
|
||||||
Where("ccr.submit_time >= ?", req.Start+" 00:00:00").
|
Where("ccr.submit_time >= ?", req.Start+" 00:00:00").
|
||||||
Where("ccr.submit_time <= ?", req.End+" 23:59:59").
|
Where("ccr.submit_time <= ?", req.End+" 23:59:59").
|
||||||
Where("ccr.deleted_at = 0 and bor.deleted_at IS NULL and ccrpe.deleted_at = 0").
|
Where("ccr.deleted_at = 0 and bor.deleted_at IS NULL and bb.deleted_at IS NULL").
|
||||||
Where("bor.bundle_uuid = ?", req.BundleUuid)
|
Where("bor.bundle_uuid = ?", req.BundleUuid)
|
||||||
err = query.Count(&newConpetitiveUsed).Error
|
err = query.Count(&newConpetitiveUsed).Error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@ -1,288 +0,0 @@
|
|||||||
package dao
|
|
||||||
|
|
||||||
import (
|
|
||||||
"errors"
|
|
||||||
"micro-bundle/internal/model"
|
|
||||||
"micro-bundle/pkg/app"
|
|
||||||
commonErr "micro-bundle/pkg/err"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/google/uuid"
|
|
||||||
"gorm.io/gorm"
|
|
||||||
)
|
|
||||||
|
|
||||||
// ContractQueryRequest 合同查询请求参数
|
|
||||||
type ContractQueryRequest struct {
|
|
||||||
ContractName string `json:"contractName"` // 合同名称(模糊查询)
|
|
||||||
ProjectName string `json:"projectName"` // 项目名称(模糊查询)
|
|
||||||
CustomerName string `json:"customerName"` // 客户名称(模糊查询)
|
|
||||||
Page int `json:"page"` // 页码
|
|
||||||
PageSize int `json:"pageSize"` // 每页数量
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreateContract 创建合同(包括支付周期和开发周期子表)
|
|
||||||
func CreateContract(contract *model.Contract) error {
|
|
||||||
// 如果未提供 ContractUUID,则生成 UUID
|
|
||||||
if contract.ContractUUID == "" {
|
|
||||||
contract.ContractUUID = uuid.New().String()
|
|
||||||
}
|
|
||||||
|
|
||||||
// 设置创建时间和更新时间
|
|
||||||
now := time.Now()
|
|
||||||
contract.CreatedAt = now
|
|
||||||
contract.UpdatedAt = now
|
|
||||||
|
|
||||||
contract.OperatorTime = now
|
|
||||||
|
|
||||||
// 使用事务创建合同及其子表
|
|
||||||
err := app.ModuleClients.BundleDB.Transaction(func(tx *gorm.DB) error {
|
|
||||||
// 创建主表(Omit 跳过关联,避免 GORM 自动创建子表导致与后面显式 Create 重复插入)
|
|
||||||
if err := tx.Model(&model.Contract{}).Omit("PaymentCycles", "DevelopmentCycles").Create(contract).Error; err != nil {
|
|
||||||
return commonErr.ReturnError(err, "创建合同失败", "创建合同失败: ")
|
|
||||||
}
|
|
||||||
|
|
||||||
// 创建支付周期子表
|
|
||||||
if len(contract.PaymentCycles) > 0 {
|
|
||||||
if len(contract.PaymentCycles) > 10 {
|
|
||||||
return commonErr.ReturnError(errors.New("支付周期不能超过10期"), "创建支付周期失败", "创建支付周期失败:")
|
|
||||||
}
|
|
||||||
for i := range contract.PaymentCycles {
|
|
||||||
if contract.PaymentCycles[i].ContractPaymentCycleUUID == "" {
|
|
||||||
contract.PaymentCycles[i].ContractPaymentCycleUUID = uuid.New().String()
|
|
||||||
}
|
|
||||||
contract.PaymentCycles[i].ContractUUID = contract.ContractUUID
|
|
||||||
contract.PaymentCycles[i].PaymentCyclePeriod = contract.PaymentCycles[i].PaymentCyclePeriod
|
|
||||||
contract.PaymentCycles[i].CreatedAt = now
|
|
||||||
contract.PaymentCycles[i].UpdatedAt = now
|
|
||||||
}
|
|
||||||
if err := tx.Model(&model.ContractPaymentCycle{}).Create(&contract.PaymentCycles).Error; err != nil {
|
|
||||||
return commonErr.ReturnError(err, "创建支付周期失败", "创建支付周期失败: ")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 创建开发周期子表
|
|
||||||
if len(contract.DevelopmentCycles) > 0 {
|
|
||||||
if len(contract.DevelopmentCycles) > 10 {
|
|
||||||
return commonErr.ReturnError(errors.New("开发周期不能超过10期"), "创建开发周期失败", "创建开发周期失败:")
|
|
||||||
}
|
|
||||||
for i := range contract.DevelopmentCycles {
|
|
||||||
if contract.DevelopmentCycles[i].DevelopmentCycleUUID == "" {
|
|
||||||
contract.DevelopmentCycles[i].DevelopmentCycleUUID = uuid.New().String()
|
|
||||||
}
|
|
||||||
contract.DevelopmentCycles[i].ContractUUID = contract.ContractUUID
|
|
||||||
contract.DevelopmentCycles[i].DevelopmentPeriod = contract.DevelopmentCycles[i].DevelopmentPeriod
|
|
||||||
contract.DevelopmentCycles[i].CreatedAt = now
|
|
||||||
contract.DevelopmentCycles[i].UpdatedAt = now
|
|
||||||
}
|
|
||||||
if err := tx.Model(&model.DevelopmentCycle{}).Create(&contract.DevelopmentCycles).Error; err != nil {
|
|
||||||
return commonErr.ReturnError(err, "创建开发周期失败", "创建开发周期失败: ")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
})
|
|
||||||
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// UpdateContract 更新合同信息(包括支付周期和开发周期子表)
|
|
||||||
func UpdateContract(contractUUID string, contract *model.Contract) error {
|
|
||||||
// 设置更新时间
|
|
||||||
now := time.Now()
|
|
||||||
contract.UpdatedAt = now
|
|
||||||
|
|
||||||
contract.OperatorTime = now
|
|
||||||
|
|
||||||
// 使用事务更新合同及其子表
|
|
||||||
err := app.ModuleClients.BundleDB.Transaction(func(tx *gorm.DB) error {
|
|
||||||
// 更新主表(Omit 跳过关联,子表由下面先删后建单独处理)
|
|
||||||
if err := tx.Model(&model.Contract{}).
|
|
||||||
Where("contract_uuid = ?", contractUUID).
|
|
||||||
Omit("PaymentCycles", "DevelopmentCycles").
|
|
||||||
Updates(contract).Error; err != nil {
|
|
||||||
return commonErr.ReturnError(err, "更新合同失败", "更新合同失败: ")
|
|
||||||
}
|
|
||||||
|
|
||||||
// 删除旧的支付周期子表数据(软删除)
|
|
||||||
if err := tx.Where("contract_uuid = ?", contractUUID).
|
|
||||||
Delete(&model.ContractPaymentCycle{}).Error; err != nil {
|
|
||||||
return commonErr.ReturnError(err, "删除支付周期失败", "删除支付周期失败: ")
|
|
||||||
}
|
|
||||||
|
|
||||||
// 创建新的支付周期子表数据
|
|
||||||
if len(contract.PaymentCycles) > 0 {
|
|
||||||
now := time.Now()
|
|
||||||
for i := range contract.PaymentCycles {
|
|
||||||
if contract.PaymentCycles[i].ContractPaymentCycleUUID == "" {
|
|
||||||
contract.PaymentCycles[i].ContractPaymentCycleUUID = uuid.New().String()
|
|
||||||
}
|
|
||||||
contract.PaymentCycles[i].ContractUUID = contractUUID
|
|
||||||
contract.PaymentCycles[i].PaymentCyclePeriod = contract.PaymentCycles[i].PaymentCyclePeriod
|
|
||||||
contract.PaymentCycles[i].CreatedAt = now
|
|
||||||
contract.PaymentCycles[i].UpdatedAt = now
|
|
||||||
}
|
|
||||||
if err := tx.Model(&model.ContractPaymentCycle{}).Create(&contract.PaymentCycles).Error; err != nil {
|
|
||||||
return commonErr.ReturnError(err, "创建支付周期失败", "创建支付周期失败: ")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 删除旧的开发周期子表数据(软删除)
|
|
||||||
if err := tx.Where("contract_uuid = ?", contractUUID).
|
|
||||||
Delete(&model.DevelopmentCycle{}).Error; err != nil {
|
|
||||||
return commonErr.ReturnError(err, "删除开发周期失败", "删除开发周期失败: ")
|
|
||||||
}
|
|
||||||
|
|
||||||
// 创建新的开发周期子表数据
|
|
||||||
if len(contract.DevelopmentCycles) > 0 {
|
|
||||||
now := time.Now()
|
|
||||||
for i := range contract.DevelopmentCycles {
|
|
||||||
if contract.DevelopmentCycles[i].DevelopmentCycleUUID == "" {
|
|
||||||
contract.DevelopmentCycles[i].DevelopmentCycleUUID = uuid.New().String()
|
|
||||||
}
|
|
||||||
contract.DevelopmentCycles[i].ContractUUID = contractUUID
|
|
||||||
contract.DevelopmentCycles[i].DevelopmentPeriod = contract.DevelopmentCycles[i].DevelopmentPeriod
|
|
||||||
contract.DevelopmentCycles[i].CreatedAt = now
|
|
||||||
contract.DevelopmentCycles[i].UpdatedAt = now
|
|
||||||
}
|
|
||||||
if err := tx.Model(&model.DevelopmentCycle{}).Create(&contract.DevelopmentCycles).Error; err != nil {
|
|
||||||
return commonErr.ReturnError(err, "创建开发周期失败", "创建开发周期失败: ")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
})
|
|
||||||
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeleteContract 删除合同(软删除,包括子表)
|
|
||||||
func DeleteContract(contractUUID string) error {
|
|
||||||
// 使用事务删除合同及其子表
|
|
||||||
err := app.ModuleClients.BundleDB.Transaction(func(tx *gorm.DB) error {
|
|
||||||
// 删除主表
|
|
||||||
if err := tx.Where("contract_uuid = ?", contractUUID).
|
|
||||||
Delete(&model.Contract{}).Error; err != nil {
|
|
||||||
return commonErr.ReturnError(err, "删除合同失败", "删除合同失败: ")
|
|
||||||
}
|
|
||||||
|
|
||||||
// 删除支付周期子表
|
|
||||||
if err := tx.Where("contract_uuid = ?", contractUUID).
|
|
||||||
Delete(&model.ContractPaymentCycle{}).Error; err != nil {
|
|
||||||
return commonErr.ReturnError(err, "删除支付周期失败", "删除支付周期失败: ")
|
|
||||||
}
|
|
||||||
|
|
||||||
// 删除开发周期子表
|
|
||||||
if err := tx.Where("contract_uuid = ?", contractUUID).
|
|
||||||
Delete(&model.DevelopmentCycle{}).Error; err != nil {
|
|
||||||
return commonErr.ReturnError(err, "删除开发周期失败", "删除开发周期失败: ")
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
})
|
|
||||||
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetContractList 多条件分页查询合同列表
|
|
||||||
func GetContractList(req *ContractQueryRequest) ([]*model.Contract, int64, error) {
|
|
||||||
var contracts []*model.Contract
|
|
||||||
var total int64
|
|
||||||
|
|
||||||
// 构建查询条件
|
|
||||||
query := app.ModuleClients.BundleDB.Model(&model.Contract{}).
|
|
||||||
Where("deleted_at = 0")
|
|
||||||
|
|
||||||
// 合同名称模糊查询
|
|
||||||
if req.ContractName != "" {
|
|
||||||
query = query.Where("contract_name LIKE ?", "%"+req.ContractName+"%")
|
|
||||||
}
|
|
||||||
|
|
||||||
// 项目名称模糊查询
|
|
||||||
if req.ProjectName != "" {
|
|
||||||
query = query.Where("project_name LIKE ?", "%"+req.ProjectName+"%")
|
|
||||||
}
|
|
||||||
|
|
||||||
// 客户名称模糊查询
|
|
||||||
if req.CustomerName != "" {
|
|
||||||
query = query.Where("customer_name LIKE ?", "%"+req.CustomerName+"%")
|
|
||||||
}
|
|
||||||
|
|
||||||
// 计算总数
|
|
||||||
err := query.Count(&total).Error
|
|
||||||
if err != nil {
|
|
||||||
return nil, 0, commonErr.ReturnError(err, "查询合同总数失败", "查询合同总数失败: ")
|
|
||||||
}
|
|
||||||
|
|
||||||
// 分页查询
|
|
||||||
if req.PageSize > 0 && req.Page > 0 {
|
|
||||||
offset := (req.Page - 1) * req.PageSize
|
|
||||||
query = query.Limit(req.PageSize).Offset(offset)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 按创建时间倒序排列
|
|
||||||
err = query.Order("created_at DESC").Find(&contracts).Error
|
|
||||||
if err != nil {
|
|
||||||
if err == gorm.ErrRecordNotFound {
|
|
||||||
return []*model.Contract{}, 0, nil
|
|
||||||
}
|
|
||||||
return nil, 0, commonErr.ReturnError(err, "查询合同列表失败", "查询合同列表失败: ")
|
|
||||||
}
|
|
||||||
|
|
||||||
return contracts, total, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetContractByUUID 根据合同UUID查询合同信息(包括子表)
|
|
||||||
func GetContractByUUID(contractUUID string) (*model.Contract, error) {
|
|
||||||
var contract model.Contract
|
|
||||||
err := app.ModuleClients.BundleDB.
|
|
||||||
Where("contract_uuid = ?", contractUUID).
|
|
||||||
Where("deleted_at = 0").
|
|
||||||
Preload("PaymentCycles", func(db *gorm.DB) *gorm.DB {
|
|
||||||
return db.Where("deleted_at = 0").Order("payment_cycle_period ASC")
|
|
||||||
}).
|
|
||||||
Preload("DevelopmentCycles", func(db *gorm.DB) *gorm.DB {
|
|
||||||
return db.Where("deleted_at = 0").Order("development_period ASC")
|
|
||||||
}).
|
|
||||||
First(&contract).Error
|
|
||||||
if err != nil {
|
|
||||||
if err == gorm.ErrRecordNotFound {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
return nil, commonErr.ReturnError(err, "查询失败", "查询失败: ")
|
|
||||||
}
|
|
||||||
return &contract, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetPaymentCyclesByContractUUID 根据合同UUID查询支付周期列表
|
|
||||||
func GetPaymentCyclesByContractUUID(contractUUID string) ([]*model.ContractPaymentCycle, error) {
|
|
||||||
var paymentCycles []*model.ContractPaymentCycle
|
|
||||||
err := app.ModuleClients.BundleDB.Model(&model.ContractPaymentCycle{}).
|
|
||||||
Where("contract_uuid = ?", contractUUID).
|
|
||||||
Where("deleted_at = 0").
|
|
||||||
Order("payment_cycle_period ASC").
|
|
||||||
Find(&paymentCycles).Error
|
|
||||||
if err != nil {
|
|
||||||
if err == gorm.ErrRecordNotFound {
|
|
||||||
return []*model.ContractPaymentCycle{}, nil
|
|
||||||
}
|
|
||||||
return nil, commonErr.ReturnError(err, "查询支付周期失败", "查询支付周期失败: ")
|
|
||||||
}
|
|
||||||
return paymentCycles, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetDevelopmentCyclesByContractUUID 根据合同UUID查询开发周期列表
|
|
||||||
func GetDevelopmentCyclesByContractUUID(contractUUID string) ([]*model.DevelopmentCycle, error) {
|
|
||||||
var developmentCycles []*model.DevelopmentCycle
|
|
||||||
err := app.ModuleClients.BundleDB.Model(&model.DevelopmentCycle{}).
|
|
||||||
Where("contract_uuid = ?", contractUUID).
|
|
||||||
Where("deleted_at = 0").
|
|
||||||
Order("development_period ASC").
|
|
||||||
Find(&developmentCycles).Error
|
|
||||||
if err != nil {
|
|
||||||
if err == gorm.ErrRecordNotFound {
|
|
||||||
return []*model.DevelopmentCycle{}, nil
|
|
||||||
}
|
|
||||||
return nil, commonErr.ReturnError(err, "查询开发周期失败", "查询开发周期失败: ")
|
|
||||||
}
|
|
||||||
return developmentCycles, nil
|
|
||||||
}
|
|
||||||
@ -1,167 +0,0 @@
|
|||||||
package dao
|
|
||||||
|
|
||||||
import (
|
|
||||||
"micro-bundle/internal/model"
|
|
||||||
"micro-bundle/pkg/app"
|
|
||||||
commonErr "micro-bundle/pkg/err"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/google/uuid"
|
|
||||||
"gorm.io/gorm"
|
|
||||||
)
|
|
||||||
|
|
||||||
// CustomerQueryRequest 客户查询请求参数
|
|
||||||
type CustomerQueryRequest struct {
|
|
||||||
CustomerName string `json:"customerName"` // 客户名称(模糊查询)
|
|
||||||
ReferralPerson string `json:"referralPerson"` // 推荐人(模糊查询)
|
|
||||||
Page int `json:"page"` // 页码
|
|
||||||
PageSize int `json:"pageSize"` // 每页数量
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreateCustomer 创建客户
|
|
||||||
func CreateCustomer(customer *model.Customer) error {
|
|
||||||
// 如果未提供 CustomerID,则生成 UUID
|
|
||||||
if customer.CustomerID == "" {
|
|
||||||
customer.CustomerID = uuid.New().String()
|
|
||||||
}
|
|
||||||
|
|
||||||
// 设置创建时间和更新时间
|
|
||||||
now := time.Now()
|
|
||||||
customer.CreatedAt = now
|
|
||||||
customer.UpdatedAt = now
|
|
||||||
|
|
||||||
err := app.ModuleClients.BundleDB.Model(&model.Customer{}).Create(customer).Error
|
|
||||||
if err != nil {
|
|
||||||
return commonErr.ReturnError(err, "创建失败", "创建失败: ")
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// UpdateCustomer 更新客户信息
|
|
||||||
func UpdateCustomer(customerID string, customer *model.Customer) error {
|
|
||||||
err := app.ModuleClients.BundleDB.Model(&model.Customer{}).
|
|
||||||
Where("customer_id = ?", customerID).
|
|
||||||
Updates(customer).Error
|
|
||||||
if err != nil {
|
|
||||||
return commonErr.ReturnError(err, "更新失败", "更新失败: ")
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeleteCustomer 删除客户(软删除)
|
|
||||||
func DeleteCustomer(customerID string) error {
|
|
||||||
err := app.ModuleClients.BundleDB.
|
|
||||||
Where("customer_id = ?", customerID).
|
|
||||||
Delete(&model.Customer{}).Error
|
|
||||||
if err != nil {
|
|
||||||
return commonErr.ReturnError(err, "删除失败", "删除失败: ")
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetCustomerList 多条件分页查询客户列表
|
|
||||||
func GetCustomerList(req *CustomerQueryRequest) ([]*model.Customer, int64, error) {
|
|
||||||
var customers []*model.Customer
|
|
||||||
var total int64
|
|
||||||
|
|
||||||
// 构建查询条件
|
|
||||||
query := app.ModuleClients.BundleDB.Model(&model.Customer{})
|
|
||||||
|
|
||||||
// 客户名称模糊查询
|
|
||||||
if req.CustomerName != "" {
|
|
||||||
query = query.Where("customer_name LIKE ?", "%"+req.CustomerName+"%")
|
|
||||||
}
|
|
||||||
|
|
||||||
// 推荐人模糊查询
|
|
||||||
if req.ReferralPerson != "" {
|
|
||||||
query = query.Where("referral_person LIKE ?", "%"+req.ReferralPerson+"%")
|
|
||||||
}
|
|
||||||
|
|
||||||
// 计算总数
|
|
||||||
err := query.Count(&total).Error
|
|
||||||
if err != nil {
|
|
||||||
return nil, 0, commonErr.ReturnError(err, "查询客户总数失败", "查询客户总数失败: ")
|
|
||||||
}
|
|
||||||
|
|
||||||
// 分页查询
|
|
||||||
if req.PageSize > 0 && req.Page > 0 {
|
|
||||||
offset := (req.Page - 1) * req.PageSize
|
|
||||||
query = query.Limit(req.PageSize).Offset(offset)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 按创建时间倒序排列
|
|
||||||
err = query.Order("created_at DESC").Find(&customers).Error
|
|
||||||
if err != nil {
|
|
||||||
if err == gorm.ErrRecordNotFound {
|
|
||||||
return []*model.Customer{}, 0, nil
|
|
||||||
}
|
|
||||||
return nil, 0, commonErr.ReturnError(err, "查询客户列表失败", "查询客户列表失败: ")
|
|
||||||
}
|
|
||||||
|
|
||||||
return customers, total, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetCustomerByID 根据客户ID查询客户信息
|
|
||||||
func GetCustomerByID(customerID string) (*model.Customer, error) {
|
|
||||||
var customer model.Customer
|
|
||||||
err := app.ModuleClients.BundleDB.
|
|
||||||
Where("customer_id = ?", customerID).
|
|
||||||
Where("deleted_at = 0").
|
|
||||||
First(&customer).Error
|
|
||||||
if err != nil {
|
|
||||||
if err == gorm.ErrRecordNotFound {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
return nil, commonErr.ReturnError(err, "查询客户信息失败", "查询客户信息失败: ")
|
|
||||||
}
|
|
||||||
return &customer, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func CheckCustomerNameExists(customerName string, excludeCustomerID string) (bool, error) {
|
|
||||||
if customerName == "" {
|
|
||||||
return false, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
var count int64
|
|
||||||
query := app.ModuleClients.BundleDB.Model(&model.Customer{}).
|
|
||||||
Where("customer_name = ?", customerName).
|
|
||||||
Where("deleted_at = 0")
|
|
||||||
|
|
||||||
if excludeCustomerID != "" {
|
|
||||||
query = query.Where("customer_id != ?", excludeCustomerID)
|
|
||||||
}
|
|
||||||
|
|
||||||
err := query.Count(&count).Error
|
|
||||||
if err != nil {
|
|
||||||
return false, commonErr.ReturnError(err, "查询客户名称失败", "查询客户名称失败: ")
|
|
||||||
}
|
|
||||||
|
|
||||||
return count > 0, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetDistinctReferralPersons 查询所有不重复的推荐人
|
|
||||||
// keyword: 推荐人关键字,支持模糊查询,为空则查询所有
|
|
||||||
func GetDistinctReferralPersons(keyword string) ([]string, error) {
|
|
||||||
var referralPersons []string
|
|
||||||
|
|
||||||
// 构建查询条件
|
|
||||||
query := app.ModuleClients.BundleDB.Model(&model.Customer{}).
|
|
||||||
Where("deleted_at = 0").
|
|
||||||
Where("referral_person != ''").
|
|
||||||
Where("referral_person IS NOT NULL")
|
|
||||||
|
|
||||||
// 如果提供了关键字,进行模糊查询
|
|
||||||
if keyword != "" {
|
|
||||||
query = query.Where("referral_person LIKE ?", "%"+keyword+"%")
|
|
||||||
}
|
|
||||||
|
|
||||||
// 查询所有不重复的推荐人
|
|
||||||
err := query.Distinct("referral_person").
|
|
||||||
Pluck("referral_person", &referralPersons).Error
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return nil, commonErr.ReturnError(err, "查询推荐人列表失败", "查询推荐人列表失败: ")
|
|
||||||
}
|
|
||||||
|
|
||||||
return referralPersons, nil
|
|
||||||
}
|
|
||||||
@ -1,275 +0,0 @@
|
|||||||
package dao
|
|
||||||
|
|
||||||
import (
|
|
||||||
"errors"
|
|
||||||
"fmt"
|
|
||||||
"micro-bundle/internal/model"
|
|
||||||
"micro-bundle/pb/bundle"
|
|
||||||
"micro-bundle/pkg/app"
|
|
||||||
"strconv"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"gorm.io/gorm"
|
|
||||||
)
|
|
||||||
|
|
||||||
func CreateInvoice(req *bundle.CreateInvoiceReq) (res *bundle.CreateInvoiceResp, err error) {
|
|
||||||
res = new(bundle.CreateInvoiceResp)
|
|
||||||
userId, err := strconv.Atoi(req.UserId)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
fmt.Println("创建发票信息:applyTime=", req.ApplyTime)
|
|
||||||
loc, _ := time.LoadLocation("Asia/Shanghai")
|
|
||||||
applyTime, err := time.ParseInLocation("20060102 15:04:05", req.ApplyTime, loc)
|
|
||||||
if err != nil {
|
|
||||||
applyTime, err = time.ParseInLocation(time.DateTime, req.ApplyTime, loc)
|
|
||||||
if err != nil {
|
|
||||||
fmt.Println("创建发票信息失败:", err)
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
inv := &model.Invoice{
|
|
||||||
UserId: userId,
|
|
||||||
UserNum: req.UserNum,
|
|
||||||
UserName: req.UserName,
|
|
||||||
OrderNo: req.OrderNo,
|
|
||||||
ApplyTime: applyTime,
|
|
||||||
InvoiceType: int(req.InvoiceType),
|
|
||||||
InvoiceNo: req.InvoiceNo,
|
|
||||||
InvoiceUrl: req.InvoiceUrl,
|
|
||||||
PaperInvocieStatus: int(req.PaperInvocieStatus),
|
|
||||||
Remark: req.Remark,
|
|
||||||
}
|
|
||||||
//打印信息
|
|
||||||
fmt.Println("创建发票信息:userId=", inv.UserId, "userNum=", inv.UserNum, "userName=", inv.UserName, "orderNo=", inv.OrderNo, "applyTime=", inv.ApplyTime, "invoiceType=", inv.InvoiceType, "invoiceNo=", inv.InvoiceNo, "invoiceUrl=", inv.InvoiceUrl, "paperInvocieStatus=", inv.PaperInvocieStatus, "remark=", inv.Remark)
|
|
||||||
err = app.ModuleClients.BundleDB.Model(&model.Invoice{}).Create(inv).Error
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
fmt.Println("创建发票信息成功")
|
|
||||||
return res, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func CreatePaperInvoiceAddress(req *bundle.CreatePaperInvoiceAddressReq) (res *bundle.CreatePaperInvoiceAddressResp, err error) {
|
|
||||||
res = new(bundle.CreatePaperInvoiceAddressResp)
|
|
||||||
userId, err := strconv.Atoi(req.UserId)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
loc, _ := time.LoadLocation("Asia/Shanghai")
|
|
||||||
applyTime, err := time.ParseInLocation("20060102 15:04:05", req.ApplyTime, loc)
|
|
||||||
if err != nil {
|
|
||||||
applyTime, err = time.ParseInLocation(time.DateTime, req.ApplyTime, loc)
|
|
||||||
if err != nil {
|
|
||||||
fmt.Println("创建发票信息失败:", err)
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pia := &model.PaperInvoiceAddress{
|
|
||||||
UserId: userId,
|
|
||||||
ApplyTime: applyTime,
|
|
||||||
OrderNo: req.OrderNo,
|
|
||||||
InvoiceNo: req.InvoiceNo,
|
|
||||||
Name: req.Name,
|
|
||||||
TelAreaCode: req.TelAreaCode,
|
|
||||||
Phone: req.Phone,
|
|
||||||
PostalCode: req.PostalCode,
|
|
||||||
Country: req.Country,
|
|
||||||
Address: req.Address,
|
|
||||||
Remark: req.Remark,
|
|
||||||
}
|
|
||||||
err = app.ModuleClients.BundleDB.Model(&model.PaperInvoiceAddress{}).Create(pia).Error
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
//更新主表状态
|
|
||||||
err = app.ModuleClients.BundleDB.Model(&model.Invoice{}).Where("order_no = ?", req.OrderNo).Updates(
|
|
||||||
&map[string]interface{}{
|
|
||||||
"paper_invocie_status": 2,
|
|
||||||
}).Error
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return res, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func GetInvoiceList(req *bundle.GetInvoiceListReq) (data []*model.InvoiceInfo, total int64, err error) {
|
|
||||||
data = make([]*model.InvoiceInfo, 0)
|
|
||||||
query := app.ModuleClients.BundleDB.Model(&model.Invoice{}).
|
|
||||||
Select(`
|
|
||||||
COALESCE(pia.name, rn.name) AS name,
|
|
||||||
COALESCE(pia.tel_area_code, user.tel_area_code) AS tel_area_code,
|
|
||||||
COALESCE(pia.phone, user.tel_num) AS phone,
|
|
||||||
COALESCE(pia.country, rn.nationality) AS country,
|
|
||||||
COALESCE(pia.address, rn.place_of_residence) AS address,
|
|
||||||
pia.apply_time AS apply_time,
|
|
||||||
invoice.user_name AS user_name,
|
|
||||||
invoice.user_num AS user_num,
|
|
||||||
invoice.order_no AS order_no,
|
|
||||||
invoice.invoice_no AS invoice_no,
|
|
||||||
invoice.invoice_url AS invoice_url,
|
|
||||||
invoice.paper_invocie_status AS paper_invocie_status
|
|
||||||
`).
|
|
||||||
Joins("LEFT JOIN paper_invoice_address as pia ON invoice.order_no = pia.order_no and pia.deleted_at = 0").
|
|
||||||
Joins("LEFT JOIN `micro-account`.`user` AS user ON invoice.user_id = user.id and user.deleted_at = 0").
|
|
||||||
Joins("LEFT JOIN `micro-account`.real_name AS rn ON user.real_name_id = rn.id and rn.deleted_at = 0")
|
|
||||||
|
|
||||||
if req.IsExpress != 0 {
|
|
||||||
if req.IsExpress == 2 && req.IsApplyInvocice == 1 {
|
|
||||||
query = query.Where("invoice.paper_invocie_status = ?", req.IsApplyInvocice)
|
|
||||||
} else {
|
|
||||||
query = query.Where("invoice.paper_invocie_status = ?", req.IsExpress)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if req.IsApplyInvocice == 2 {
|
|
||||||
query = query.Where("invoice.paper_invocie_status >= ?", req.IsApplyInvocice)
|
|
||||||
} else if req.IsApplyInvocice == 1 {
|
|
||||||
query = query.Where("invoice.paper_invocie_status = ?", req.IsApplyInvocice)
|
|
||||||
} else {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if req.ApplyTimeStart != "" {
|
|
||||||
// 使用 COALESCE 后的 apply_time 进行筛选
|
|
||||||
query = query.Where("pia.apply_time >= ?", req.ApplyTimeStart)
|
|
||||||
}
|
|
||||||
if req.ApplyTimeEnd != "" {
|
|
||||||
query = query.Where("pia.apply_time <= ?", req.ApplyTimeEnd)
|
|
||||||
}
|
|
||||||
if req.Name != "" {
|
|
||||||
// 使用 COALESCE 后的 name 进行模糊筛选,统一 collation 避免 Illegal mix of collations
|
|
||||||
query = query.Where("COALESCE(pia.name, rn.name) COLLATE utf8mb4_general_ci LIKE ?", "%"+req.Name+"%")
|
|
||||||
}
|
|
||||||
if req.Phone != "" {
|
|
||||||
query = query.Where("COALESCE(pia.phone, user.tel_num) COLLATE utf8mb4_general_ci LIKE ?", "%"+req.Phone+"%")
|
|
||||||
}
|
|
||||||
if req.Country != "" {
|
|
||||||
query = query.Where("COALESCE(pia.country, rn.nationality) COLLATE utf8mb4_general_ci LIKE ?", "%"+req.Country+"%")
|
|
||||||
}
|
|
||||||
if req.UserName != "" {
|
|
||||||
query = query.Where("invoice.user_name LIKE ?", "%"+req.UserName+"%")
|
|
||||||
}
|
|
||||||
query.Order("pia.apply_time DESC")
|
|
||||||
query = query.Count(&total)
|
|
||||||
err = query.Offset(int(req.Page-1) * int(req.Size)).Limit(int(req.Size)).Find(&data).Error
|
|
||||||
if err != nil {
|
|
||||||
return nil, 0, err
|
|
||||||
}
|
|
||||||
return data, total, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func UpdateInvoiceExpressInfo(req *bundle.UpdateInvoiceExpressInfoReq) (res *bundle.UpdateInvoiceExpressInfoResp, err error) {
|
|
||||||
res = new(bundle.UpdateInvoiceExpressInfoResp)
|
|
||||||
err = app.ModuleClients.BundleDB.Model(&model.PaperInvoiceAddress{}).Where("order_no = ?", req.OrderNo).Updates(
|
|
||||||
&map[string]interface{}{
|
|
||||||
"express_company": req.ExpressCompany,
|
|
||||||
"express_no": req.ExpressNo,
|
|
||||||
"remark": req.Remark,
|
|
||||||
}).Error
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
//更新主表状态
|
|
||||||
err = app.ModuleClients.BundleDB.Model(&model.Invoice{}).Where("order_no = ?", req.OrderNo).Updates(
|
|
||||||
&map[string]interface{}{
|
|
||||||
"paper_invocie_status": 3,
|
|
||||||
}).Error
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return res, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func GetInvoiceExpressInfo(req *bundle.GetInvoiceExpressInfoReq) (res *bundle.GetInvoiceExpressInfoResp, err error) {
|
|
||||||
res = new(bundle.GetInvoiceExpressInfoResp)
|
|
||||||
err = app.ModuleClients.BundleDB.Model(&model.PaperInvoiceAddress{}).Where("order_no = ?", req.OrderNo).First(&res).Error
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return res, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func GetOrderInfoByOrderNo(req *bundle.GetOrderInfoByOrderNoReq) (orderRecord *model.InvoiceOrderInfo, err error) {
|
|
||||||
orderRecord = new(model.InvoiceOrderInfo)
|
|
||||||
query := app.ModuleClients.BundleDB.Model(&model.BundleOrderRecords{}).
|
|
||||||
Select(`
|
|
||||||
bundle_order_records.customer_name AS user_name,
|
|
||||||
user.id AS user_id,
|
|
||||||
bundle_order_records.order_no AS order_no,
|
|
||||||
bundle_order_records.customer_num AS user_num,
|
|
||||||
bundle_order_records.amount_type AS amount_type,
|
|
||||||
ROUND(bundle_order_records.total_amount, 2) AS total_amount,
|
|
||||||
bundle_order_records.bundle_name AS bundle_name,
|
|
||||||
rn.place_of_residence AS address,
|
|
||||||
user.tel_num AS phone,
|
|
||||||
bundle_order_records.pay_time AS pay_time
|
|
||||||
`).
|
|
||||||
Joins("left join `micro-account`.`user` as user on user.id = bundle_order_records.customer_id and user.deleted_at = 0").
|
|
||||||
Joins("left join `micro-account`.`real_name` as rn on rn.id = user.real_name_id and rn.deleted_at = 0").
|
|
||||||
Where("bundle_order_records.deleted_at is null")
|
|
||||||
if req.Uuid != "" {
|
|
||||||
query = query.Where("bundle_order_records.uuid = ?", req.Uuid)
|
|
||||||
}
|
|
||||||
if req.OrderNo != "" {
|
|
||||||
query = query.Where("bundle_order_records.order_no = ?", req.OrderNo)
|
|
||||||
}
|
|
||||||
query = query.Order("bundle_order_records.created_at DESC")
|
|
||||||
err = query.First(&orderRecord).Error
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return orderRecord, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func GetInvoiceInfoByOrderNo(req *bundle.GetInvoiceInfoByOrderNoReq) (data []*model.InvoiceInfoByOrderNo, err error) {
|
|
||||||
data = make([]*model.InvoiceInfoByOrderNo, 0)
|
|
||||||
query := app.ModuleClients.BundleDB.Model(&model.Invoice{}).
|
|
||||||
Select(`
|
|
||||||
invoice.order_no AS order_no,
|
|
||||||
invoice.invoice_no AS invoice_no,
|
|
||||||
invoice.invoice_url AS invoice_url,
|
|
||||||
bor.bundle_name AS bundle_name,
|
|
||||||
bor.amount_type AS amount_type,
|
|
||||||
bor.total_amount AS total_amount,
|
|
||||||
bor.pay_time AS pay_time,
|
|
||||||
invoice.paper_invocie_status AS paper_invocie_status
|
|
||||||
`).
|
|
||||||
Joins("left join bundle_order_records bor on invoice.order_no COLLATE utf8mb4_general_ci = bor.order_no COLLATE utf8mb4_general_ci and bor.deleted_at is null").
|
|
||||||
Where("invoice.user_id = ?", req.UserId)
|
|
||||||
if req.OrderNo != "" {
|
|
||||||
query = query.Where("invoice.order_no COLLATE utf8mb4_general_ci = ?", req.OrderNo)
|
|
||||||
}
|
|
||||||
query = query.Order("bor.pay_time DESC")
|
|
||||||
err = query.Find(&data).Error
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return data, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func GetLastInvoiceNo() (lastNo model.Invoice, err error) {
|
|
||||||
err = app.ModuleClients.BundleDB.Model(&model.Invoice{}).
|
|
||||||
Order("id DESC").
|
|
||||||
Where("deleted_at = 0").
|
|
||||||
Limit(1).
|
|
||||||
First(&lastNo).Error
|
|
||||||
if err != nil {
|
|
||||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
|
||||||
// 没有记录时返回空值,不返回错误
|
|
||||||
return model.Invoice{}, nil
|
|
||||||
}
|
|
||||||
return model.Invoice{}, err
|
|
||||||
}
|
|
||||||
return lastNo, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func UpdataInvoiceInfo(req *bundle.UpdataInvoiceInfoReq) (res *bundle.UpdataInvoiceInfoResp, err error) {
|
|
||||||
res = new(bundle.UpdataInvoiceInfoResp)
|
|
||||||
err = app.ModuleClients.BundleDB.Model(&model.Invoice{}).Where("order_no = ?", req.OrderNo).Updates(
|
|
||||||
&map[string]interface{}{
|
|
||||||
"invoice_url": req.Url,
|
|
||||||
}).Error
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return res, nil
|
|
||||||
}
|
|
||||||
@ -838,17 +838,7 @@ func DeleteValueAddService(req *bundle.DeleteValueAddServiceRequest) (res *bundl
|
|||||||
|
|
||||||
func UpdateReconciliationStatusBySerialNumber(req *bundle.UpdateStatusAndPayTimeBySerialNumber) (res *bundle.CommonResponse, err error) {
|
func UpdateReconciliationStatusBySerialNumber(req *bundle.UpdateStatusAndPayTimeBySerialNumber) (res *bundle.CommonResponse, err error) {
|
||||||
var existing model.Reconciliation
|
var existing model.Reconciliation
|
||||||
|
if err := app.ModuleClients.BundleDB.Where("serial_number = ?", req.SerialNumber).First(&existing).Error; err != nil {
|
||||||
//req.SerialNumber现在是orderuuid
|
|
||||||
var order model.BundleOrderRecords
|
|
||||||
if err := app.ModuleClients.BundleDB.Where("uuid = ?", req.SerialNumber).First(&order).Error; err != nil {
|
|
||||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
|
||||||
return nil, errors.New("订单记录不存在")
|
|
||||||
}
|
|
||||||
return nil, fmt.Errorf("查询订单失败: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := app.ModuleClients.BundleDB.Where("bundle_order_on = ?", order.OrderNo).First(&existing).Error; err != nil {
|
|
||||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||||
return nil, errors.New("对账单记录不存在")
|
return nil, errors.New("对账单记录不存在")
|
||||||
}
|
}
|
||||||
@ -857,7 +847,7 @@ func UpdateReconciliationStatusBySerialNumber(req *bundle.UpdateStatusAndPayTime
|
|||||||
updates := model.Reconciliation{
|
updates := model.Reconciliation{
|
||||||
PayTime: req.PayTime,
|
PayTime: req.PayTime,
|
||||||
PayStatus: int(req.PaymentStatus),
|
PayStatus: int(req.PaymentStatus),
|
||||||
SerialNumber: order.OrderNo,
|
SerialNumber: req.SerialNumber,
|
||||||
}
|
}
|
||||||
|
|
||||||
if req.PaymentStatus == 2 && existing.CurrencyType == 2 && existing.PayAmount > 0 {
|
if req.PaymentStatus == 2 && existing.CurrencyType == 2 && existing.PayAmount > 0 {
|
||||||
@ -1010,111 +1000,6 @@ func ReSignTheContract(req *bundle.ReSignTheContractRequest) (*bundle.CommonResp
|
|||||||
return res, nil
|
return res, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func UpdateOrderRecordByOrderUuid(orderRecord *model.BundleOrderRecords) (res *bundle.CommonResponse, err error) {
|
|
||||||
res = new(bundle.CommonResponse)
|
|
||||||
// Step 1: 先更新子订单(增值服务)的支付状态
|
|
||||||
valueAdd := &model.BundleOrderValueAdd{
|
|
||||||
PaymentStatus: int(orderRecord.Status),
|
|
||||||
PaymentTime: orderRecord.PayTime,
|
|
||||||
}
|
|
||||||
if orderRecord.CheckoutSessionId != "" {
|
|
||||||
valueAdd.CheckoutSessionId = orderRecord.CheckoutSessionId
|
|
||||||
valueAdd.CheckoutSessionUrl = orderRecord.CheckoutSessionUrl
|
|
||||||
}
|
|
||||||
|
|
||||||
if orderRecord.Status == 2 {
|
|
||||||
tempValues := make([]*model.BundleOrderValueAdd, 0)
|
|
||||||
err = app.ModuleClients.BundleDB.Model(&model.BundleOrderValueAdd{}).
|
|
||||||
Where("order_uuid = ?", orderRecord.UUID).
|
|
||||||
Find(&tempValues).Error
|
|
||||||
if len(tempValues) > 0 {
|
|
||||||
for _, value := range tempValues {
|
|
||||||
if value.PaymentStatus == 2 {
|
|
||||||
fmt.Println("====================已经付过了")
|
|
||||||
return nil, errors.New("已付款了")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
tempRecord := new(model.BundleOrderRecords)
|
|
||||||
if err := app.ModuleClients.BundleDB.Where("deleted_at is null and uuid = ?", orderRecord.UUID).First(&tempRecord).Error; err != nil {
|
|
||||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
|
||||||
return nil, errors.New("订单记录不存在")
|
|
||||||
}
|
|
||||||
return nil, fmt.Errorf("查询订单失败: %v", err)
|
|
||||||
}
|
|
||||||
if orderRecord.Status == 2 && tempRecord.AmountType == 2 && tempRecord.TotalAmount > 0 {
|
|
||||||
// 当回调支付成功,币种是美元,且订单金额大于0,计算美元手续费:订单金额*0.019(四舍五入保留两位小数字)+0.1
|
|
||||||
amount := decimal.NewFromFloat32(tempRecord.TotalAmount)
|
|
||||||
rate, _ := decimal.NewFromString("0.019")
|
|
||||||
fee := amount.Mul(rate)
|
|
||||||
// 4. 四舍五入保留两位小数
|
|
||||||
feeRounded := fee.Round(2)
|
|
||||||
addition, _ := decimal.NewFromString("0.1")
|
|
||||||
result := feeRounded.Add(addition)
|
|
||||||
valueAdd.HandlingFee = result.String()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
err = app.ModuleClients.BundleDB.Model(&model.BundleOrderValueAdd{}).
|
|
||||||
Where("order_uuid = ?", orderRecord.UUID).
|
|
||||||
Updates(valueAdd).Error
|
|
||||||
if err != nil {
|
|
||||||
res.Msg = msg.ErrorUpdateOrderInfo
|
|
||||||
return res, commonErr.ReturnError(err, msg.ErrorUpdateOrderInfo, "更新增值服务支付状态失败: ")
|
|
||||||
}
|
|
||||||
// Step 2: 再更新主订单信息(如果存在)
|
|
||||||
err = app.ModuleClients.BundleDB.Model(&model.BundleOrderRecords{}).
|
|
||||||
Where("uuid = ?", orderRecord.UUID).
|
|
||||||
Updates(orderRecord).Error
|
|
||||||
// Step 3: 返回结果(即使主订单更新失败,也视为成功)
|
|
||||||
res.Uuid = orderRecord.UUID
|
|
||||||
res.Msg = msg.SuccessUpdateOrderInfo
|
|
||||||
return res, nil
|
|
||||||
}
|
|
||||||
func OrderListByOrderUuid(req *bundle.OrderInfoByOrderUuidRequest) (*bundle.OrderInfoByOrderNoResp, error) {
|
|
||||||
if req == nil || req.OrderUuid == "" {
|
|
||||||
return nil, errors.New("invalid request")
|
|
||||||
}
|
|
||||||
var addOrder []*model.BundleOrderValueAdd
|
|
||||||
if err := app.ModuleClients.BundleDB.Model(&model.BundleOrderValueAdd{}).
|
|
||||||
Where("order_uuid = ?", req.OrderUuid).
|
|
||||||
Find(&addOrder).Error; err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if len(addOrder) == 0 {
|
|
||||||
return &bundle.OrderInfoByOrderNoResp{}, nil
|
|
||||||
}
|
|
||||||
//订单类型 1:套餐 2:单独购买
|
|
||||||
userID, err := strconv.ParseInt(addOrder[0].CustomerID, 10, 64)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
res := &bundle.OrderInfoByOrderNoResp{
|
|
||||||
Type: int32(addOrder[0].Source),
|
|
||||||
UserId: uint64(userID),
|
|
||||||
OrderUUID: addOrder[0].OrderUUID,
|
|
||||||
UserName: addOrder[0].CustomerName,
|
|
||||||
}
|
|
||||||
for _, item := range addOrder {
|
|
||||||
switch item.ServiceType {
|
|
||||||
case 1:
|
|
||||||
res.VideoNumber += item.Num // 使用 += 而不是直接赋值
|
|
||||||
case 2:
|
|
||||||
res.ImageNumber += item.Num
|
|
||||||
case 3:
|
|
||||||
res.DataNumber += item.Num
|
|
||||||
case 4:
|
|
||||||
res.AccountNumber += item.Num
|
|
||||||
case 5:
|
|
||||||
res.Duration += item.Num
|
|
||||||
res.Unit = item.Unit // 如果有多个duration记录,最后一个unit会覆盖前面的
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return res, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetOriginalOrderUUID 传入订单UUID,追溯续费链,返回最初非续费的订单UUID
|
// GetOriginalOrderUUID 传入订单UUID,追溯续费链,返回最初非续费的订单UUID
|
||||||
func GetOriginalOrderUUID(orderUUID string) (string, error) {
|
func GetOriginalOrderUUID(orderUUID string) (string, error) {
|
||||||
if orderUUID == "" {
|
if orderUUID == "" {
|
||||||
|
|||||||
@ -1,228 +0,0 @@
|
|||||||
package dao
|
|
||||||
|
|
||||||
import (
|
|
||||||
"encoding/json"
|
|
||||||
"errors"
|
|
||||||
"micro-bundle/internal/model"
|
|
||||||
"micro-bundle/pb/bundle"
|
|
||||||
"micro-bundle/pkg/app"
|
|
||||||
"micro-bundle/pkg/msg"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/google/uuid"
|
|
||||||
"github.com/samber/lo"
|
|
||||||
"gorm.io/gorm"
|
|
||||||
)
|
|
||||||
|
|
||||||
// 电话号码映射表:原始号码 -> 目标号码
|
|
||||||
var phoneMapping = map[string]string{
|
|
||||||
"15863272183": "15624971336", //毕德瑞
|
|
||||||
"15039229900": "18803928946", //陈春芳
|
|
||||||
"13832480736": "17746107444", //程宝江
|
|
||||||
"19290778586": "13196080727", //董跃亭
|
|
||||||
"18710227028": "13954838868", //方民
|
|
||||||
"17801586080": "15233398990", //韩玉玲
|
|
||||||
}
|
|
||||||
|
|
||||||
// 使用示例:仅当号码在白名单中时才返回映射结果,否则返回原号码
|
|
||||||
func MapPhoneIfInList(phone string) string {
|
|
||||||
if phoneMapping[phone] != "" {
|
|
||||||
return phoneMapping[phone]
|
|
||||||
}
|
|
||||||
return phone
|
|
||||||
}
|
|
||||||
|
|
||||||
func SendQuestionnaireSurvey(req *bundle.SendQuestionnaireSurveyRequest) (resp *bundle.SendQuestionnaireSurveyResponse, err error) {
|
|
||||||
resp = new(bundle.SendQuestionnaireSurveyResponse)
|
|
||||||
phone := MapPhoneIfInList(req.UserTel)
|
|
||||||
userInfo := &model.UserInfo{}
|
|
||||||
err = app.ModuleClients.BundleDB.Raw(`
|
|
||||||
SELECT
|
|
||||||
mau.id as user_id,
|
|
||||||
mau.sub_num as user_num,
|
|
||||||
mau.tel_num as user_tel,
|
|
||||||
marn.name as user_name
|
|
||||||
from `+"`micro-account`.`user`"+` as mau
|
|
||||||
left join `+"`micro-account`.`real_name`"+` as marn on marn.id = mau.real_name_id and marn.deleted_at = 0
|
|
||||||
where mau.deleted_at = 0 and mau.tel_num = ?
|
|
||||||
`, phone).Scan(&userInfo).Error
|
|
||||||
if err != nil {
|
|
||||||
return resp, err
|
|
||||||
}
|
|
||||||
if userInfo.UserId == 0 {
|
|
||||||
resp.Status = 1
|
|
||||||
return resp, nil
|
|
||||||
}
|
|
||||||
//判断是否在指定id列表中
|
|
||||||
userIds := []int{76, 77, 80, 82, 83, 98, 110, 119, 121, 137, 138, 140, 149, 152, 155, 156, 157, 163, 171, 178, 179, 183, 184, 187, 189, 195, 210, 212, 221, 223, 224, 225, 227, 229, 232, 233, 249, 279, 311, 274, 268, 314, 327, 291, 326, 320, 273, 319, 278, 264, 313, 296, 393, 395, 387, 371, 391, 366, 398, 400, 410, 411, 412, 419, 421, 430, 432, 540, 592, 630, 1015}
|
|
||||||
if lo.Contains(userIds, userInfo.UserId) {
|
|
||||||
resp.Status = 0
|
|
||||||
} else {
|
|
||||||
resp.Status = 1
|
|
||||||
return resp, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
questionnaireInfo := &model.QuestionnaireSurvey{}
|
|
||||||
err = app.ModuleClients.BundleDB.Model(&model.QuestionnaireSurvey{}).
|
|
||||||
Where("user_tel = ? and deleted_at is null", phone).
|
|
||||||
Order("created_at desc").
|
|
||||||
First(&questionnaireInfo).Error
|
|
||||||
if err != nil {
|
|
||||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
|
||||||
resp.Status = 0
|
|
||||||
} else {
|
|
||||||
return resp, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if questionnaireInfo.UserId != 0 {
|
|
||||||
if questionnaireInfo.SurveyStatus == msg.QuestionnaireSent {
|
|
||||||
resp.Status = 0
|
|
||||||
return resp, nil
|
|
||||||
}
|
|
||||||
resp.Status = 2
|
|
||||||
return resp, nil
|
|
||||||
}
|
|
||||||
orderRecord := &model.BundleOrderRecords{}
|
|
||||||
err = app.ModuleClients.BundleDB.Model(&model.BundleOrderRecords{}).
|
|
||||||
Where("customer_num = ? and deleted_at is null", userInfo.UserNum).
|
|
||||||
Order("created_at desc").
|
|
||||||
First(&orderRecord).Error
|
|
||||||
if err != nil {
|
|
||||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
|
||||||
resp.Status = 1
|
|
||||||
return resp, nil
|
|
||||||
}
|
|
||||||
return resp, err
|
|
||||||
}
|
|
||||||
|
|
||||||
bundleBalance := &model.BundleBalance{}
|
|
||||||
month := timeParse(req.EndTime + " 23:59:59").Format("2006-01")
|
|
||||||
err = app.ModuleClients.BundleDB.Model(&model.BundleBalance{}).
|
|
||||||
Where("order_uuid = ? and deleted_at is null", orderRecord.UUID).
|
|
||||||
Where("month = ?", month).
|
|
||||||
First(&bundleBalance).Error
|
|
||||||
if err != nil {
|
|
||||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
|
||||||
resp.Status = 1
|
|
||||||
return resp, nil
|
|
||||||
}
|
|
||||||
return resp, err
|
|
||||||
}
|
|
||||||
|
|
||||||
if bundleBalance.ID == 0 {
|
|
||||||
resp.Status = 1
|
|
||||||
return resp, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
bundleInfo := &model.BundleInfo{
|
|
||||||
BundleName: orderRecord.BundleName,
|
|
||||||
StartAt: bundleBalance.StartAt,
|
|
||||||
ExpiredAt: bundleBalance.ExpiredAt,
|
|
||||||
BundleAccountNumber: 3,
|
|
||||||
BundleVideoNumber: bundleBalance.BundleLimitVideoConsumptionNumber,
|
|
||||||
IncreaseVideoNumber: bundleBalance.IncreaseVideoConsumptionNumber,
|
|
||||||
BundleImageNumber: bundleBalance.BundleLimitImageConsumptionNumber,
|
|
||||||
BundleDataNumber: bundleBalance.BundleLimitDataAnalysisConsumptionNumber,
|
|
||||||
BundleCompetitiveNumber: bundleBalance.BundleLimitCompetitiveConsumptionNumber,
|
|
||||||
}
|
|
||||||
bundleInfoJSON, err := json.Marshal(bundleInfo)
|
|
||||||
if err != nil {
|
|
||||||
return resp, err
|
|
||||||
}
|
|
||||||
data := &model.QuestionnaireSurvey{
|
|
||||||
SurveyUUID: uuid.New().String(),
|
|
||||||
UserId: userInfo.UserId,
|
|
||||||
UserNum: userInfo.UserNum,
|
|
||||||
UserName: userInfo.UserName,
|
|
||||||
UserTel: userInfo.UserTel,
|
|
||||||
OrderUUID: orderRecord.UUID,
|
|
||||||
SendTime: timeParse(time.Now().Format("2006-01-02 15:04:05")),
|
|
||||||
SubmitTime: timeParse(time.Now().Format("2006-01-02 15:04:05")),
|
|
||||||
SurveyStatus: msg.QuestionnaireSent,
|
|
||||||
BundleInfo: string(bundleInfoJSON),
|
|
||||||
SurveyTitle: req.SurveyTitle,
|
|
||||||
}
|
|
||||||
err = app.ModuleClients.BundleDB.Model(&model.QuestionnaireSurvey{}).Create(data).Error
|
|
||||||
if err != nil {
|
|
||||||
return resp, err
|
|
||||||
}
|
|
||||||
resp.Status = 0
|
|
||||||
return resp, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func GetQuestionnaireSurveyInfo(req *bundle.GetQuestionnaireSurveyInfoRequest) (data *model.QuestionnaireSurvey, err error) {
|
|
||||||
data = &model.QuestionnaireSurvey{}
|
|
||||||
phone := MapPhoneIfInList(req.UserTel)
|
|
||||||
err = app.ModuleClients.BundleDB.Model(&model.QuestionnaireSurvey{}).
|
|
||||||
Where("user_tel = ? and deleted_at is null", phone).
|
|
||||||
Order("created_at desc").
|
|
||||||
First(&data).Error
|
|
||||||
if err != nil {
|
|
||||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
|
||||||
return nil, errors.New("问卷信息不存在")
|
|
||||||
}
|
|
||||||
return data, err
|
|
||||||
}
|
|
||||||
return data, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func CreateQuestionnaireSurveyAnswer(req *bundle.CreateQuestionnaireSurveyAnswerRequest) (err error) {
|
|
||||||
phone := MapPhoneIfInList(req.UserTel)
|
|
||||||
surveyAnswer := &model.SurveyAnswer{
|
|
||||||
BundleAccountScore: req.SurveyAnswer.BundleAccountScore,
|
|
||||||
BundleVideoScore: req.SurveyAnswer.BundleVideoScore,
|
|
||||||
IncreaseVideoScore: req.SurveyAnswer.IncreaseVideoScore,
|
|
||||||
BundleImageScore: req.SurveyAnswer.BundleImageScore,
|
|
||||||
BundleDataScore: req.SurveyAnswer.BundleDataScore,
|
|
||||||
BundleCompetitiveScore: req.SurveyAnswer.BundleCompetitiveScore,
|
|
||||||
ServiceResponseSpeed: req.SurveyAnswer.ServiceResponseSpeed,
|
|
||||||
ServiceStaffProfessionalism: req.SurveyAnswer.ServiceStaffProfessionalism,
|
|
||||||
}
|
|
||||||
surveyAnswerJSON, err := json.Marshal(surveyAnswer)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
err = app.ModuleClients.BundleDB.Model(&model.QuestionnaireSurvey{}).
|
|
||||||
Where("user_tel = ? and deleted_at is null", phone).
|
|
||||||
Updates(map[string]interface{}{
|
|
||||||
"survey_answer": string(surveyAnswerJSON),
|
|
||||||
"merits_review": req.SurveyFeedback.MeritsReview,
|
|
||||||
"suggestionsor_improvements": req.SurveyFeedback.SuggestionsorImprovements,
|
|
||||||
"additional_comments": req.SurveyFeedback.AdditionalComments,
|
|
||||||
"submit_time": timeParse(time.Now().Format("2006-01-02 15:04:05")),
|
|
||||||
"survey_status": msg.QuestionnaireSubmitted,
|
|
||||||
"survey_url": req.SurveyUrl,
|
|
||||||
"submit_by": req.SubmitBy,
|
|
||||||
}).Error
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func GetQuestionnaireSurveyList(req *bundle.GetQuestionnaireSurveyListRequest) (data []*model.QuestionnaireSurvey, total int64, err error) {
|
|
||||||
if req.Page == 0 {
|
|
||||||
req.Page = 1
|
|
||||||
}
|
|
||||||
if req.PageSize == 0 {
|
|
||||||
req.PageSize = 10
|
|
||||||
}
|
|
||||||
query := app.ModuleClients.BundleDB.Model(&model.QuestionnaireSurvey{})
|
|
||||||
if req.UserName != "" {
|
|
||||||
query = query.Where("user_name = ?", req.UserName)
|
|
||||||
}
|
|
||||||
if req.SurveyTitle != "" {
|
|
||||||
query = query.Where("survey_title = ?", req.SurveyTitle)
|
|
||||||
}
|
|
||||||
if req.SurveyStatus != 0 {
|
|
||||||
query = query.Where("survey_status = ?", req.SurveyStatus)
|
|
||||||
}
|
|
||||||
query = query.Order("created_at desc")
|
|
||||||
query.Count(&total)
|
|
||||||
query = query.Limit(int(req.PageSize)).Offset(int(req.Page-1) * int(req.PageSize))
|
|
||||||
err = query.Find(&data).Error
|
|
||||||
if err != nil {
|
|
||||||
return data, total, err
|
|
||||||
}
|
|
||||||
return data, total, nil
|
|
||||||
}
|
|
||||||
@ -7,6 +7,7 @@ import (
|
|||||||
"micro-bundle/internal/model"
|
"micro-bundle/internal/model"
|
||||||
"micro-bundle/pkg/app"
|
"micro-bundle/pkg/app"
|
||||||
commonErr "micro-bundle/pkg/err"
|
commonErr "micro-bundle/pkg/err"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -103,9 +104,6 @@ active_windows AS (
|
|||||||
bb.bundle_data_analysis_number, bb.bundle_limit_data_analysis_number, bb.bundle_limit_data_analysis_expired_number,
|
bb.bundle_data_analysis_number, bb.bundle_limit_data_analysis_number, bb.bundle_limit_data_analysis_expired_number,
|
||||||
bb.increase_data_analysis_number, bb.increase_limit_data_analysis_number, bb.increase_limit_data_analysis_expired_number,
|
bb.increase_data_analysis_number, bb.increase_limit_data_analysis_number, bb.increase_limit_data_analysis_expired_number,
|
||||||
bb.manual_data_analysis_number, bb.manual_data_analysis_consumption_number,
|
bb.manual_data_analysis_number, bb.manual_data_analysis_consumption_number,
|
||||||
bb.bundle_competitive_number, bb.bundle_limit_competitive_number, bb.bundle_limit_competitive_expired_number,
|
|
||||||
bb.increase_competitive_number, bb.increase_limit_competitive_number, bb.increase_limit_competitive_expired_number,
|
|
||||||
bb.manual_competitive_number, bb.manual_competitive_consumption_number,
|
|
||||||
rn.name AS user_name
|
rn.name AS user_name
|
||||||
FROM ` + "`micro-account`.`user`" + ` u
|
FROM ` + "`micro-account`.`user`" + ` u
|
||||||
INNER JOIN ` + "`micro-account`.real_name" + ` rn ON rn.id = u.real_name_id AND rn.name IS NOT NULL AND rn.deleted_at = 0
|
INNER JOIN ` + "`micro-account`.real_name" + ` rn ON rn.id = u.real_name_id AND rn.name IS NOT NULL AND rn.deleted_at = 0
|
||||||
@ -158,15 +156,7 @@ balance_sum AS (
|
|||||||
+ bb2.monthly_increase_limit_expired_data_analysis_number + bb2.invalid_increase_data_analysis_number
|
+ bb2.monthly_increase_limit_expired_data_analysis_number + bb2.invalid_increase_data_analysis_number
|
||||||
+ bb2.increase_limit_data_analysis_consumption_number + bb2.increase_limit_data_analysis_expired_consumption_number
|
+ bb2.increase_limit_data_analysis_consumption_number + bb2.increase_limit_data_analysis_expired_consumption_number
|
||||||
- bb2.monthly_increase_limit_expired_data_analysis_consumption_number
|
- bb2.monthly_increase_limit_expired_data_analysis_consumption_number
|
||||||
- bb2.monthly_increase_limit_data_analysis_consumption_number) AS increase_data_sum,
|
- bb2.monthly_increase_limit_data_analysis_consumption_number) AS increase_data_sum
|
||||||
SUM(bb2.bundle_competitive_number + bb2.monthly_bundle_limit_competitive_number + bb2.monthly_bundle_limit_expired_competitive_number
|
|
||||||
+ bb2.invalid_bundle_competitive_number + bb2.bundle_limit_competitive_consumption_number
|
|
||||||
+ bb2.bundle_limit_competitive_expired_consumption_number - bb2.monthly_bundle_limit_expired_competitive_consumption_number
|
|
||||||
- bb2.monthly_bundle_limit_competitive_consumption_number) AS competitive_sum,
|
|
||||||
SUM(bb2.increase_competitive_number + bb2.monthly_increase_limit_competitive_number + bb2.monthly_increase_limit_expired_competitive_number
|
|
||||||
+ bb2.invalid_increase_competitive_number + bb2.increase_limit_competitive_consumption_number
|
|
||||||
+ bb2.increase_limit_competitive_expired_consumption_number - bb2.monthly_increase_limit_expired_competitive_consumption_number
|
|
||||||
- bb2.monthly_increase_limit_competitive_consumption_number) AS increase_competitive_sum
|
|
||||||
FROM bundle_balance bb2
|
FROM bundle_balance bb2
|
||||||
INNER JOIN latest_per_order lpo ON bb2.user_id = lpo.user_id
|
INNER JOIN latest_per_order lpo ON bb2.user_id = lpo.user_id
|
||||||
AND bb2.order_uuid = lpo.order_uuid
|
AND bb2.order_uuid = lpo.order_uuid
|
||||||
@ -203,18 +193,7 @@ cwa_agg AS (
|
|||||||
GROUP BY aw.user_id
|
GROUP BY aw.user_id
|
||||||
),
|
),
|
||||||
|
|
||||||
-- 8. 竞品报告统计
|
-- 8. 视频脚本统计
|
||||||
ccr_agg AS (
|
|
||||||
SELECT
|
|
||||||
aw.user_id,
|
|
||||||
COUNT(CASE WHEN ccr.deleted_at = 0 AND ccr.submit_time BETWEEN aw.start_at AND aw.expired_at THEN 1 END) AS uploaded_report_count,
|
|
||||||
COUNT(CASE WHEN ccr.cost = 1 AND ccr.deleted_at = 0 AND ccr.submit_time BETWEEN aw.start_at AND aw.expired_at THEN 1 END) AS released_report_consumed
|
|
||||||
FROM active_windows aw
|
|
||||||
LEFT JOIN cast_competitive_report ccr ON ccr.artist_phone COLLATE utf8mb4_general_ci = aw.phone COLLATE utf8mb4_general_ci
|
|
||||||
GROUP BY aw.user_id
|
|
||||||
),
|
|
||||||
|
|
||||||
-- 9. 视频脚本统计
|
|
||||||
cvs_agg AS (
|
cvs_agg AS (
|
||||||
SELECT
|
SELECT
|
||||||
aw.user_id,
|
aw.user_id,
|
||||||
@ -265,13 +244,7 @@ assigned_pending_agg AS (
|
|||||||
WHEN tar.actual_status = 1 THEN tar.pending_data_count
|
WHEN tar.actual_status = 1 THEN tar.pending_data_count
|
||||||
ELSE 0
|
ELSE 0
|
||||||
END
|
END
|
||||||
), 0) AS assigned_data_count,
|
), 0) AS assigned_data_count
|
||||||
COALESCE(SUM(
|
|
||||||
CASE
|
|
||||||
WHEN tar.actual_status = 1 THEN tar.pending_report_count
|
|
||||||
ELSE 0
|
|
||||||
END
|
|
||||||
), 0) AS assigned_report_count
|
|
||||||
FROM active_windows aw
|
FROM active_windows aw
|
||||||
LEFT JOIN ` + "`" + taskSchema + "`" + `.task_assign_records tar ON tar.sub_num COLLATE utf8mb4_general_ci = aw.customer_num COLLATE utf8mb4_general_ci
|
LEFT JOIN ` + "`" + taskSchema + "`" + `.task_assign_records tar ON tar.sub_num COLLATE utf8mb4_general_ci = aw.customer_num COLLATE utf8mb4_general_ci
|
||||||
AND tar.actual_status IN (1, 3)
|
AND tar.actual_status IN (1, 3)
|
||||||
@ -298,7 +271,6 @@ LEFT JOIN balance_sum bs ON bs.user_id = aw.user_id
|
|||||||
LEFT JOIN task_mgmt tm ON tm.user_id = aw.user_id
|
LEFT JOIN task_mgmt tm ON tm.user_id = aw.user_id
|
||||||
LEFT JOIN cw_agg cw ON cw.user_id = aw.user_id
|
LEFT JOIN cw_agg cw ON cw.user_id = aw.user_id
|
||||||
LEFT JOIN cwa_agg cwa ON cwa.user_id = aw.user_id
|
LEFT JOIN cwa_agg cwa ON cwa.user_id = aw.user_id
|
||||||
LEFT JOIN ccr_agg ccr ON ccr.user_id = aw.user_id
|
|
||||||
LEFT JOIN cvs_agg cvs ON cvs.user_id = aw.user_id
|
LEFT JOIN cvs_agg cvs ON cvs.user_id = aw.user_id
|
||||||
LEFT JOIN tar_agg ta ON ta.user_id = aw.user_id
|
LEFT JOIN tar_agg ta ON ta.user_id = aw.user_id
|
||||||
LEFT JOIN assigned_pending_agg apa ON apa.user_id = aw.user_id`
|
LEFT JOIN assigned_pending_agg apa ON apa.user_id = aw.user_id`
|
||||||
@ -366,12 +338,6 @@ LEFT JOIN assigned_pending_agg apa ON apa.user_id = aw.user_id`
|
|||||||
"allow_video_count": true,
|
"allow_video_count": true,
|
||||||
"allow_post_count": true,
|
"allow_post_count": true,
|
||||||
"allow_data_count": true,
|
"allow_data_count": true,
|
||||||
"uploaded_report_count": true,
|
|
||||||
"bundle_report_total": true,
|
|
||||||
"increase_report_total": true,
|
|
||||||
"released_report_total": true,
|
|
||||||
"pending_report_count": true,
|
|
||||||
"allow_report_count": true,
|
|
||||||
}
|
}
|
||||||
if allowed[req.SortBy] {
|
if allowed[req.SortBy] {
|
||||||
orderClause = fmt.Sprintf("%s %s", req.SortBy, sortType)
|
orderClause = fmt.Sprintf("%s %s", req.SortBy, sortType)
|
||||||
@ -401,11 +367,6 @@ LEFT JOIN assigned_pending_agg apa ON apa.user_id = aw.user_id`
|
|||||||
(aw.increase_data_analysis_number + aw.increase_limit_data_analysis_number + aw.increase_limit_data_analysis_expired_number + aw.manual_data_analysis_number) AS increase_data_total,
|
(aw.increase_data_analysis_number + aw.increase_limit_data_analysis_number + aw.increase_limit_data_analysis_expired_number + aw.manual_data_analysis_number) AS increase_data_total,
|
||||||
GREATEST(COALESCE(bs.data_sum, 0) + COALESCE(bs.increase_data_sum, 0) + aw.manual_data_analysis_number - aw.manual_data_analysis_consumption_number, 0) AS released_data_total,
|
GREATEST(COALESCE(bs.data_sum, 0) + COALESCE(bs.increase_data_sum, 0) + aw.manual_data_analysis_number - aw.manual_data_analysis_consumption_number, 0) AS released_data_total,
|
||||||
GREATEST(COALESCE(bs.data_sum, 0) + COALESCE(bs.increase_data_sum, 0) + aw.manual_data_analysis_number - aw.manual_data_analysis_consumption_number, 0) - COALESCE(cwa.uploaded_data_count, 0) AS pending_data_count,
|
GREATEST(COALESCE(bs.data_sum, 0) + COALESCE(bs.increase_data_sum, 0) + aw.manual_data_analysis_number - aw.manual_data_analysis_consumption_number, 0) - COALESCE(cwa.uploaded_data_count, 0) AS pending_data_count,
|
||||||
COALESCE(ccr.uploaded_report_count, 0) AS uploaded_report_count,
|
|
||||||
(aw.bundle_competitive_number + aw.bundle_limit_competitive_number + aw.bundle_limit_competitive_expired_number) AS bundle_report_total,
|
|
||||||
(aw.increase_competitive_number + aw.increase_limit_competitive_number + aw.increase_limit_competitive_expired_number + aw.manual_competitive_number) AS increase_report_total,
|
|
||||||
GREATEST(COALESCE(bs.competitive_sum, 0) + COALESCE(bs.increase_competitive_sum, 0) + aw.manual_competitive_number - aw.manual_competitive_consumption_number, 0) AS released_report_total,
|
|
||||||
GREATEST(COALESCE(bs.competitive_sum, 0) + COALESCE(bs.increase_competitive_sum, 0) + aw.manual_competitive_number - aw.manual_competitive_consumption_number, 0) - COALESCE(ccr.uploaded_report_count, 0) AS pending_report_count,
|
|
||||||
tm.last_task_assignee,
|
tm.last_task_assignee,
|
||||||
tm.task_assignee_num,
|
tm.task_assignee_num,
|
||||||
COALESCE(ta.progress_task_count, 0) AS progress_task_count,
|
COALESCE(ta.progress_task_count, 0) AS progress_task_count,
|
||||||
@ -413,8 +374,7 @@ LEFT JOIN assigned_pending_agg apa ON apa.user_id = aw.user_id`
|
|||||||
(GREATEST(COALESCE(bs.video_sum, 0) + COALESCE(bs.increase_video_sum, 0) + aw.manual_video_number - aw.manual_video_consumption_number, 0) - COALESCE(cvs.uploaded_video_script_count, 0)) - COALESCE(apa.assigned_video_script_count, 0) AS allow_video_script_count,
|
(GREATEST(COALESCE(bs.video_sum, 0) + COALESCE(bs.increase_video_sum, 0) + aw.manual_video_number - aw.manual_video_consumption_number, 0) - COALESCE(cvs.uploaded_video_script_count, 0)) - COALESCE(apa.assigned_video_script_count, 0) AS allow_video_script_count,
|
||||||
(GREATEST(COALESCE(bs.video_sum, 0) + COALESCE(bs.increase_video_sum, 0) + aw.manual_video_number - aw.manual_video_consumption_number, 0) - COALESCE(cw.uploaded_video_count, 0)) - COALESCE(apa.assigned_video_count, 0) AS allow_video_count,
|
(GREATEST(COALESCE(bs.video_sum, 0) + COALESCE(bs.increase_video_sum, 0) + aw.manual_video_number - aw.manual_video_consumption_number, 0) - COALESCE(cw.uploaded_video_count, 0)) - COALESCE(apa.assigned_video_count, 0) AS allow_video_count,
|
||||||
(GREATEST(COALESCE(bs.post_sum, 0) + COALESCE(bs.increase_post_sum, 0) + aw.manual_image_number - aw.manual_image_consumption_number, 0) - COALESCE(cw.uploaded_post_count, 0)) - COALESCE(apa.assigned_post_count, 0) AS allow_post_count,
|
(GREATEST(COALESCE(bs.post_sum, 0) + COALESCE(bs.increase_post_sum, 0) + aw.manual_image_number - aw.manual_image_consumption_number, 0) - COALESCE(cw.uploaded_post_count, 0)) - COALESCE(apa.assigned_post_count, 0) AS allow_post_count,
|
||||||
(GREATEST(COALESCE(bs.data_sum, 0) + COALESCE(bs.increase_data_sum, 0) + aw.manual_data_analysis_number - aw.manual_data_analysis_consumption_number, 0) - COALESCE(cwa.uploaded_data_count, 0)) - COALESCE(apa.assigned_data_count, 0) AS allow_data_count,
|
(GREATEST(COALESCE(bs.data_sum, 0) + COALESCE(bs.increase_data_sum, 0) + aw.manual_data_analysis_number - aw.manual_data_analysis_consumption_number, 0) - COALESCE(cwa.uploaded_data_count, 0)) - COALESCE(apa.assigned_data_count, 0) AS allow_data_count
|
||||||
(GREATEST(COALESCE(bs.competitive_sum, 0) + COALESCE(bs.increase_competitive_sum, 0) + aw.manual_competitive_number - aw.manual_competitive_consumption_number, 0) - COALESCE(ccr.uploaded_report_count, 0)) - COALESCE(apa.assigned_report_count, 0) AS allow_report_count
|
|
||||||
` + fromClause + whereClause + " ORDER BY " + orderClause
|
` + fromClause + whereClause + " ORDER BY " + orderClause
|
||||||
|
|
||||||
listArgs := make([]interface{}, 0, len(args)+2)
|
listArgs := make([]interface{}, 0, len(args)+2)
|
||||||
@ -482,7 +442,6 @@ active_windows AS (
|
|||||||
bb.manual_video_number, bb.manual_video_consumption_number,
|
bb.manual_video_number, bb.manual_video_consumption_number,
|
||||||
bb.manual_image_number, bb.manual_image_consumption_number,
|
bb.manual_image_number, bb.manual_image_consumption_number,
|
||||||
bb.manual_data_analysis_number, bb.manual_data_analysis_consumption_number,
|
bb.manual_data_analysis_number, bb.manual_data_analysis_consumption_number,
|
||||||
bb.manual_competitive_number, bb.manual_competitive_consumption_number,
|
|
||||||
rn.name AS user_name
|
rn.name AS user_name
|
||||||
FROM ` + "`micro-account`.`user`" + ` u
|
FROM ` + "`micro-account`.`user`" + ` u
|
||||||
INNER JOIN ` + "`micro-account`.real_name" + ` rn ON rn.id = u.real_name_id AND rn.name IS NOT NULL
|
INNER JOIN ` + "`micro-account`.real_name" + ` rn ON rn.id = u.real_name_id AND rn.name IS NOT NULL
|
||||||
@ -535,15 +494,7 @@ balance_sum AS (
|
|||||||
+ bb2.monthly_increase_limit_expired_data_analysis_number + bb2.invalid_increase_data_analysis_number
|
+ bb2.monthly_increase_limit_expired_data_analysis_number + bb2.invalid_increase_data_analysis_number
|
||||||
+ bb2.increase_limit_data_analysis_consumption_number + bb2.increase_limit_data_analysis_expired_consumption_number
|
+ bb2.increase_limit_data_analysis_consumption_number + bb2.increase_limit_data_analysis_expired_consumption_number
|
||||||
- bb2.monthly_increase_limit_expired_data_analysis_consumption_number
|
- bb2.monthly_increase_limit_expired_data_analysis_consumption_number
|
||||||
- bb2.monthly_increase_limit_data_analysis_consumption_number) AS increase_data_sum,
|
- bb2.monthly_increase_limit_data_analysis_consumption_number) AS increase_data_sum
|
||||||
SUM(bb2.bundle_competitive_number + bb2.monthly_bundle_limit_competitive_number + bb2.monthly_bundle_limit_expired_competitive_number
|
|
||||||
+ bb2.invalid_bundle_competitive_number + bb2.bundle_limit_competitive_consumption_number
|
|
||||||
+ bb2.bundle_limit_competitive_expired_consumption_number - bb2.monthly_bundle_limit_expired_competitive_consumption_number
|
|
||||||
- bb2.monthly_bundle_limit_competitive_consumption_number) AS competitive_sum,
|
|
||||||
SUM(bb2.increase_competitive_number + bb2.monthly_increase_limit_competitive_number + bb2.monthly_increase_limit_expired_competitive_number
|
|
||||||
+ bb2.invalid_increase_competitive_number + bb2.increase_limit_competitive_consumption_number
|
|
||||||
+ bb2.increase_limit_competitive_expired_consumption_number - bb2.monthly_increase_limit_expired_competitive_consumption_number
|
|
||||||
- bb2.monthly_increase_limit_competitive_consumption_number) AS increase_competitive_sum
|
|
||||||
FROM bundle_balance bb2
|
FROM bundle_balance bb2
|
||||||
INNER JOIN latest_per_order lpo ON bb2.user_id = lpo.user_id
|
INNER JOIN latest_per_order lpo ON bb2.user_id = lpo.user_id
|
||||||
AND bb2.order_uuid = lpo.order_uuid
|
AND bb2.order_uuid = lpo.order_uuid
|
||||||
@ -567,27 +518,17 @@ cw_agg AS (
|
|||||||
GROUP BY aw.user_id
|
GROUP BY aw.user_id
|
||||||
),
|
),
|
||||||
|
|
||||||
-- 7. 数据分析作品统计(排除 work_analysis_status = 1 的数据分析)
|
-- 7. 数据分析作品统计
|
||||||
cwa_agg AS (
|
cwa_agg AS (
|
||||||
SELECT
|
SELECT
|
||||||
aw.user_id,
|
aw.user_id,
|
||||||
COUNT(CASE WHEN cwa.deleted_at = 0 AND (cwa.work_analysis_status IS NULL OR cwa.work_analysis_status != 1) AND cwa.submit_time BETWEEN UNIX_TIMESTAMP(aw.start_at) AND UNIX_TIMESTAMP(aw.expired_at) THEN 1 END) AS uploaded_data_count
|
COUNT(CASE WHEN cwa.deleted_at = 0 AND cwa.submit_time BETWEEN UNIX_TIMESTAMP(aw.start_at) AND UNIX_TIMESTAMP(aw.expired_at) THEN 1 END) AS uploaded_data_count
|
||||||
FROM active_windows aw
|
FROM active_windows aw
|
||||||
LEFT JOIN cast_work_analysis cwa ON cwa.artist_phone COLLATE utf8mb4_general_ci = aw.phone COLLATE utf8mb4_general_ci
|
LEFT JOIN cast_work_analysis cwa ON cwa.artist_phone COLLATE utf8mb4_general_ci = aw.phone COLLATE utf8mb4_general_ci
|
||||||
GROUP BY aw.user_id
|
GROUP BY aw.user_id
|
||||||
),
|
),
|
||||||
|
|
||||||
-- 8. 竞品报告统计
|
-- 8. 视频脚本统计
|
||||||
ccr_agg AS (
|
|
||||||
SELECT
|
|
||||||
aw.user_id,
|
|
||||||
COUNT(CASE WHEN ccr.deleted_at = 0 AND ccr.submit_time BETWEEN aw.start_at AND aw.expired_at THEN 1 END) AS uploaded_report_count
|
|
||||||
FROM active_windows aw
|
|
||||||
LEFT JOIN cast_competitive_report ccr ON ccr.artist_phone COLLATE utf8mb4_general_ci = aw.phone COLLATE utf8mb4_general_ci
|
|
||||||
GROUP BY aw.user_id
|
|
||||||
),
|
|
||||||
|
|
||||||
-- 9. 视频脚本统计
|
|
||||||
cvs_agg AS (
|
cvs_agg AS (
|
||||||
SELECT
|
SELECT
|
||||||
aw.user_id,
|
aw.user_id,
|
||||||
@ -627,13 +568,7 @@ assigned_pending_agg AS (
|
|||||||
WHEN tar.actual_status = 1 THEN tar.pending_data_count
|
WHEN tar.actual_status = 1 THEN tar.pending_data_count
|
||||||
ELSE 0
|
ELSE 0
|
||||||
END
|
END
|
||||||
), 0) AS assigned_data_count,
|
), 0) AS assigned_data_count
|
||||||
COALESCE(SUM(
|
|
||||||
CASE
|
|
||||||
WHEN tar.actual_status = 1 THEN tar.pending_report_count
|
|
||||||
ELSE 0
|
|
||||||
END
|
|
||||||
), 0) AS assigned_report_count
|
|
||||||
FROM active_windows aw
|
FROM active_windows aw
|
||||||
LEFT JOIN ` + "`" + taskSchema + "`" + `.task_assign_records tar ON tar.sub_num COLLATE utf8mb4_general_ci = aw.customer_num COLLATE utf8mb4_general_ci
|
LEFT JOIN ` + "`" + taskSchema + "`" + `.task_assign_records tar ON tar.sub_num COLLATE utf8mb4_general_ci = aw.customer_num COLLATE utf8mb4_general_ci
|
||||||
AND tar.actual_status IN (1, 3)
|
AND tar.actual_status IN (1, 3)
|
||||||
@ -646,7 +581,6 @@ assigned_pending_agg AS (
|
|||||||
LEFT JOIN balance_sum bs ON bs.user_id = aw.user_id
|
LEFT JOIN balance_sum bs ON bs.user_id = aw.user_id
|
||||||
LEFT JOIN cw_agg cw ON cw.user_id = aw.user_id
|
LEFT JOIN cw_agg cw ON cw.user_id = aw.user_id
|
||||||
LEFT JOIN cwa_agg cwa ON cwa.user_id = aw.user_id
|
LEFT JOIN cwa_agg cwa ON cwa.user_id = aw.user_id
|
||||||
LEFT JOIN ccr_agg ccr ON ccr.user_id = aw.user_id
|
|
||||||
LEFT JOIN cvs_agg cvs ON cvs.user_id = aw.user_id
|
LEFT JOIN cvs_agg cvs ON cvs.user_id = aw.user_id
|
||||||
LEFT JOIN assigned_pending_agg apa ON apa.user_id = aw.user_id`
|
LEFT JOIN assigned_pending_agg apa ON apa.user_id = aw.user_id`
|
||||||
|
|
||||||
@ -667,8 +601,7 @@ LEFT JOIN assigned_pending_agg apa ON apa.user_id = aw.user_id`
|
|||||||
(GREATEST(COALESCE(bs.video_sum, 0) + COALESCE(bs.increase_video_sum, 0) + aw.manual_video_number - aw.manual_video_consumption_number, 0) - COALESCE(cvs.uploaded_video_script_count, 0)) - COALESCE(apa.assigned_video_script_count, 0) AS allow_video_script_count,
|
(GREATEST(COALESCE(bs.video_sum, 0) + COALESCE(bs.increase_video_sum, 0) + aw.manual_video_number - aw.manual_video_consumption_number, 0) - COALESCE(cvs.uploaded_video_script_count, 0)) - COALESCE(apa.assigned_video_script_count, 0) AS allow_video_script_count,
|
||||||
(GREATEST(COALESCE(bs.video_sum, 0) + COALESCE(bs.increase_video_sum, 0) + aw.manual_video_number - aw.manual_video_consumption_number, 0) - COALESCE(cw.uploaded_video_count, 0)) - COALESCE(apa.assigned_video_count, 0) AS allow_video_count,
|
(GREATEST(COALESCE(bs.video_sum, 0) + COALESCE(bs.increase_video_sum, 0) + aw.manual_video_number - aw.manual_video_consumption_number, 0) - COALESCE(cw.uploaded_video_count, 0)) - COALESCE(apa.assigned_video_count, 0) AS allow_video_count,
|
||||||
(GREATEST(COALESCE(bs.post_sum, 0) + COALESCE(bs.increase_post_sum, 0) + aw.manual_image_number - aw.manual_image_consumption_number, 0) - COALESCE(cw.uploaded_post_count, 0)) - COALESCE(apa.assigned_post_count, 0) AS allow_post_count,
|
(GREATEST(COALESCE(bs.post_sum, 0) + COALESCE(bs.increase_post_sum, 0) + aw.manual_image_number - aw.manual_image_consumption_number, 0) - COALESCE(cw.uploaded_post_count, 0)) - COALESCE(apa.assigned_post_count, 0) AS allow_post_count,
|
||||||
(GREATEST(COALESCE(bs.data_sum, 0) + COALESCE(bs.increase_data_sum, 0) + aw.manual_data_analysis_number - aw.manual_data_analysis_consumption_number, 0) - COALESCE(cwa.uploaded_data_count, 0)) - COALESCE(apa.assigned_data_count, 0) AS allow_data_count,
|
(GREATEST(COALESCE(bs.data_sum, 0) + COALESCE(bs.increase_data_sum, 0) + aw.manual_data_analysis_number - aw.manual_data_analysis_consumption_number, 0) - COALESCE(cwa.uploaded_data_count, 0)) - COALESCE(apa.assigned_data_count, 0) AS allow_data_count
|
||||||
(GREATEST(COALESCE(bs.competitive_sum, 0) + COALESCE(bs.increase_competitive_sum, 0) + aw.manual_competitive_number - aw.manual_competitive_consumption_number, 0) - COALESCE(ccr.uploaded_report_count, 0)) - COALESCE(apa.assigned_report_count, 0) AS allow_report_count
|
|
||||||
` + fromClause + " ORDER BY aw.user_id"
|
` + fromClause + " ORDER BY aw.user_id"
|
||||||
|
|
||||||
listArgs := make([]interface{}, 0, len(args)+2)
|
listArgs := make([]interface{}, 0, len(args)+2)
|
||||||
@ -703,11 +636,41 @@ func AssignTask(req *dto.TaskAssignRequest, progressTaskCount int, completeTaskC
|
|||||||
|
|
||||||
// 1. 查询当前艺人的任务记录
|
// 1. 查询当前艺人的任务记录
|
||||||
var taskManagement model.TaskManagement
|
var taskManagement model.TaskManagement
|
||||||
err := tx.Where("user_id = ? AND deleted_at = 0", req.UserID).First(&taskManagement).Error
|
err := tx.Where("sub_num = ? AND tel_num = ?", req.SubNum, req.TelNum).First(&taskManagement).Error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err == gorm.ErrRecordNotFound {
|
if err == gorm.ErrRecordNotFound {
|
||||||
|
var userID int
|
||||||
|
if req.SubNum != "" {
|
||||||
|
var row struct{ ID int }
|
||||||
|
_ = tx.Table("`micro-account`.`user`").Unscoped().Select("id").Where("sub_num COLLATE utf8mb4_general_ci = ? COLLATE utf8mb4_general_ci AND deleted_at = 0", req.SubNum).Limit(1).Scan(&row).Error
|
||||||
|
if row.ID > 0 {
|
||||||
|
userID = row.ID
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if userID == 0 && req.SubNum != "" {
|
||||||
|
// 使用子查询获取每个 customer_id 最新订单记录的 customer_id
|
||||||
|
// 逻辑:找到 customer_num 匹配且 created_at 为该 customer_id 最大值的记录
|
||||||
|
var o struct{ CustomerID string }
|
||||||
|
subQuery := app.ModuleClients.BundleDB.Table("bundle_order_records").
|
||||||
|
Select("customer_id, MAX(created_at) AS max_created_time").
|
||||||
|
Where("deleted_at IS NULL AND status = 2").
|
||||||
|
Group("customer_id")
|
||||||
|
|
||||||
|
_ = app.ModuleClients.BundleDB.Table("bundle_order_records bor1").
|
||||||
|
Select("bor1.customer_id").
|
||||||
|
Joins("INNER JOIN (?) bor2 ON bor1.customer_id = bor2.customer_id AND bor1.created_at = bor2.max_created_time", subQuery).
|
||||||
|
Where("bor1.deleted_at IS NULL AND bor1.status = 2").
|
||||||
|
Where("bor1.customer_num COLLATE utf8mb4_general_ci = ? COLLATE utf8mb4_general_ci", req.SubNum).
|
||||||
|
Limit(1).
|
||||||
|
Scan(&o).Error
|
||||||
|
if o.CustomerID != "" {
|
||||||
|
if id64, _ := strconv.ParseInt(o.CustomerID, 10, 64); id64 > 0 {
|
||||||
|
userID = int(id64)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
taskManagement = model.TaskManagement{
|
taskManagement = model.TaskManagement{
|
||||||
UserId: req.UserID,
|
UserId: userID,
|
||||||
SubNum: req.SubNum,
|
SubNum: req.SubNum,
|
||||||
TelNum: req.TelNum,
|
TelNum: req.TelNum,
|
||||||
ArtistName: req.ArtistName,
|
ArtistName: req.ArtistName,
|
||||||
@ -768,17 +731,14 @@ func AssignTask(req *dto.TaskAssignRequest, progressTaskCount int, completeTaskC
|
|||||||
PendingVideoCount: req.AssignVideoCount,
|
PendingVideoCount: req.AssignVideoCount,
|
||||||
PendingPostCount: req.AssignPostCount,
|
PendingPostCount: req.AssignPostCount,
|
||||||
PendingDataCount: req.AssignDataCount,
|
PendingDataCount: req.AssignDataCount,
|
||||||
PendingReportCount: req.AssignReportCount,
|
|
||||||
AssignVideoScriptCount: req.AssignVideoScriptCount,
|
AssignVideoScriptCount: req.AssignVideoScriptCount,
|
||||||
AssignVideoCount: req.AssignVideoCount,
|
AssignVideoCount: req.AssignVideoCount,
|
||||||
AssignPostCount: req.AssignPostCount,
|
AssignPostCount: req.AssignPostCount,
|
||||||
AssignDataCount: req.AssignDataCount,
|
AssignDataCount: req.AssignDataCount,
|
||||||
AssignReportCount: req.AssignReportCount,
|
|
||||||
CompleteVideoScriptCount: 0,
|
CompleteVideoScriptCount: 0,
|
||||||
CompleteVideoCount: 0,
|
CompleteVideoCount: 0,
|
||||||
CompletePostCount: 0,
|
CompletePostCount: 0,
|
||||||
CompleteDataCount: 0,
|
CompleteDataCount: 0,
|
||||||
CompleteReportCount: 0,
|
|
||||||
CreatedAt: time.Now(),
|
CreatedAt: time.Now(),
|
||||||
UpdatedAt: time.Now(),
|
UpdatedAt: time.Now(),
|
||||||
}
|
}
|
||||||
@ -861,13 +821,6 @@ func RevertTaskCompletionByUUIDItem(uuid string) error {
|
|||||||
cs = 0
|
cs = 0
|
||||||
}
|
}
|
||||||
updateData["complete_video_script_count"] = cs
|
updateData["complete_video_script_count"] = cs
|
||||||
case 5:
|
|
||||||
updateData["pending_report_count"] = assignRecord.PendingReportCount + 1
|
|
||||||
cr := assignRecord.CompleteReportCount - 1
|
|
||||||
if cr < 0 {
|
|
||||||
cr = 0
|
|
||||||
}
|
|
||||||
updateData["complete_report_count"] = cr
|
|
||||||
}
|
}
|
||||||
if err := tx.Model(&assignRecord).Updates(updateData).Error; err != nil {
|
if err := tx.Model(&assignRecord).Updates(updateData).Error; err != nil {
|
||||||
tx.Rollback()
|
tx.Rollback()
|
||||||
@ -888,15 +841,14 @@ func BatchAssignTasks(items []*dto.BatchAssignItem) error {
|
|||||||
now := time.Now()
|
now := time.Now()
|
||||||
|
|
||||||
subNumSet := make(map[string]struct{})
|
subNumSet := make(map[string]struct{})
|
||||||
userIDSet := make(map[int]struct{})
|
|
||||||
subTelKeys := make(map[string]*dto.BatchAssignItem) // key: sub_num|tel_num
|
subTelKeys := make(map[string]*dto.BatchAssignItem) // key: sub_num|tel_num
|
||||||
for _, it := range items {
|
for _, it := range items {
|
||||||
if it == nil {
|
if it == nil {
|
||||||
return commonErr.ReturnError(nil, "参数错误", "存在空的指派项")
|
return commonErr.ReturnError(nil, "参数错误", "存在空的指派项")
|
||||||
}
|
}
|
||||||
// 校验:数量不可为负,且不可全部为0
|
// 校验:数量不可为负,且不可全部为0
|
||||||
if it.AssignVideoCount < 0 || it.AssignPostCount < 0 || it.AssignDataCount < 0 || it.AssignVideoScriptCount < 0 || it.AssignReportCount < 0 ||
|
if it.AssignVideoCount < 0 || it.AssignPostCount < 0 || it.AssignDataCount < 0 || it.AssignVideoScriptCount < 0 ||
|
||||||
(it.AssignVideoCount == 0 && it.AssignPostCount == 0 && it.AssignDataCount == 0 && it.AssignVideoScriptCount == 0 && it.AssignReportCount == 0) {
|
(it.AssignVideoCount == 0 && it.AssignPostCount == 0 && it.AssignDataCount == 0 && it.AssignVideoScriptCount == 0) {
|
||||||
errMsg := fmt.Sprintf("\"%s\"老师任务不可全部为0", it.ArtistName)
|
errMsg := fmt.Sprintf("\"%s\"老师任务不可全部为0", it.ArtistName)
|
||||||
return commonErr.ReturnError(nil, errMsg, "批量指派校验失败: ")
|
return commonErr.ReturnError(nil, errMsg, "批量指派校验失败: ")
|
||||||
}
|
}
|
||||||
@ -906,9 +858,6 @@ func BatchAssignTasks(items []*dto.BatchAssignItem) error {
|
|||||||
if it.SubNum != "" {
|
if it.SubNum != "" {
|
||||||
subNumSet[it.SubNum] = struct{}{}
|
subNumSet[it.SubNum] = struct{}{}
|
||||||
}
|
}
|
||||||
if it.UserID > 0 {
|
|
||||||
userIDSet[it.UserID] = struct{}{}
|
|
||||||
}
|
|
||||||
key := it.SubNum + "|" + it.TelNum
|
key := it.SubNum + "|" + it.TelNum
|
||||||
subTelKeys[key] = it
|
subTelKeys[key] = it
|
||||||
}
|
}
|
||||||
@ -920,13 +869,18 @@ func BatchAssignTasks(items []*dto.BatchAssignItem) error {
|
|||||||
}
|
}
|
||||||
// 2.1 批量查询已存在的 task_management 记录
|
// 2.1 批量查询已存在的 task_management 记录
|
||||||
existingTMMap := make(map[string]*model.TaskManagement) // key: sub_num|tel_num
|
existingTMMap := make(map[string]*model.TaskManagement) // key: sub_num|tel_num
|
||||||
if len(userIDSet) > 0 {
|
if len(subTelKeys) > 0 {
|
||||||
userIDs := make([]int, 0, len(userIDSet))
|
|
||||||
for id := range userIDSet {
|
|
||||||
userIDs = append(userIDs, id)
|
|
||||||
}
|
|
||||||
var existingTMs []model.TaskManagement
|
var existingTMs []model.TaskManagement
|
||||||
if err := app.ModuleClients.TaskBenchDB.Where("user_id IN ? AND deleted_at = 0", userIDs).Find(&existingTMs).Error; err != nil {
|
// 构建 OR 条件查询
|
||||||
|
var conditions []string
|
||||||
|
var args []interface{}
|
||||||
|
for key := range subTelKeys {
|
||||||
|
parts := strings.SplitN(key, "|", 2)
|
||||||
|
conditions = append(conditions, "(sub_num = ? AND tel_num = ?)")
|
||||||
|
args = append(args, parts[0], parts[1])
|
||||||
|
}
|
||||||
|
query := strings.Join(conditions, " OR ")
|
||||||
|
if err := app.ModuleClients.TaskBenchDB.Where(query, args...).Find(&existingTMs).Error; err != nil {
|
||||||
return commonErr.ReturnError(err, "批量查询任务记录失败", "批量查询任务记录失败: ")
|
return commonErr.ReturnError(err, "批量查询任务记录失败", "批量查询任务记录失败: ")
|
||||||
}
|
}
|
||||||
for i := range existingTMs {
|
for i := range existingTMs {
|
||||||
@ -936,7 +890,63 @@ func BatchAssignTasks(items []*dto.BatchAssignItem) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2.2 批量统计每个 sub_num 的进行中与已完成任务数量
|
// 2.2 批量查询 user_id(从 micro-account.user 表)
|
||||||
|
userIDMap := make(map[string]int) // key: sub_num
|
||||||
|
if len(subNums) > 0 {
|
||||||
|
var userRows []struct {
|
||||||
|
SubNum string `gorm:"column:sub_num"`
|
||||||
|
ID int `gorm:"column:id"`
|
||||||
|
}
|
||||||
|
_ = app.ModuleClients.TaskBenchDB.Table("`micro-account`.`user`").Unscoped().
|
||||||
|
Select("sub_num, id").
|
||||||
|
Where("sub_num COLLATE utf8mb4_general_ci IN ? AND deleted_at = 0", subNums).
|
||||||
|
Scan(&userRows).Error
|
||||||
|
for _, row := range userRows {
|
||||||
|
if row.ID > 0 {
|
||||||
|
userIDMap[row.SubNum] = row.ID
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2.3 批量查询 customer_id(从 bundle_order_records 表,针对未找到 user_id 的 sub_num)
|
||||||
|
missingSubNums := make([]string, 0)
|
||||||
|
for _, sn := range subNums {
|
||||||
|
if _, found := userIDMap[sn]; !found {
|
||||||
|
missingSubNums = append(missingSubNums, sn)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if len(missingSubNums) > 0 {
|
||||||
|
var orderRows []struct {
|
||||||
|
CustomerNum string `gorm:"column:customer_num"`
|
||||||
|
CustomerID string `gorm:"column:customer_id"`
|
||||||
|
}
|
||||||
|
// 使用子查询获取每个 customer_num 对应的最新订单的 customer_id
|
||||||
|
subQuery := app.ModuleClients.BundleDB.Table("bundle_order_records").
|
||||||
|
Select("customer_id, customer_num, MAX(created_at) AS max_created_time").
|
||||||
|
Where("deleted_at IS NULL AND status = 2").
|
||||||
|
Where("customer_num COLLATE utf8mb4_general_ci IN ?", missingSubNums).
|
||||||
|
Group("customer_id, customer_num")
|
||||||
|
|
||||||
|
_ = app.ModuleClients.BundleDB.Table("bundle_order_records bor1").
|
||||||
|
Select("bor1.customer_num, bor1.customer_id").
|
||||||
|
Joins("INNER JOIN (?) bor2 ON bor1.customer_id = bor2.customer_id AND bor1.created_at = bor2.max_created_time", subQuery).
|
||||||
|
Where("bor1.deleted_at IS NULL AND bor1.status = 2").
|
||||||
|
Where("bor1.customer_num COLLATE utf8mb4_general_ci IN ?", missingSubNums).
|
||||||
|
Scan(&orderRows).Error
|
||||||
|
|
||||||
|
for _, row := range orderRows {
|
||||||
|
if row.CustomerID != "" {
|
||||||
|
if id64, _ := strconv.ParseInt(row.CustomerID, 10, 64); id64 > 0 {
|
||||||
|
// 只有当 userIDMap 中没有时才设置
|
||||||
|
if _, found := userIDMap[row.CustomerNum]; !found {
|
||||||
|
userIDMap[row.CustomerNum] = int(id64)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2.4 批量统计每个 sub_num 的进行中与已完成任务数量
|
||||||
statsMap := make(map[string]struct {
|
statsMap := make(map[string]struct {
|
||||||
ProgressTaskCount int
|
ProgressTaskCount int
|
||||||
CompleteTaskCount int
|
CompleteTaskCount int
|
||||||
@ -980,8 +990,9 @@ func BatchAssignTasks(items []*dto.BatchAssignItem) error {
|
|||||||
if _, exists := existingTMMap[key]; !exists {
|
if _, exists := existingTMMap[key]; !exists {
|
||||||
// 检查是否已经在 newTMs 中(同一批次可能有重复的 sub_num|tel_num)
|
// 检查是否已经在 newTMs 中(同一批次可能有重复的 sub_num|tel_num)
|
||||||
if _, inNew := newTMMap[key]; !inNew {
|
if _, inNew := newTMMap[key]; !inNew {
|
||||||
|
userID := userIDMap[it.SubNum]
|
||||||
tm := model.TaskManagement{
|
tm := model.TaskManagement{
|
||||||
UserId: it.UserID,
|
UserId: userID,
|
||||||
SubNum: it.SubNum,
|
SubNum: it.SubNum,
|
||||||
TelNum: it.TelNum,
|
TelNum: it.TelNum,
|
||||||
ArtistName: it.ArtistName,
|
ArtistName: it.ArtistName,
|
||||||
@ -1037,17 +1048,14 @@ func BatchAssignTasks(items []*dto.BatchAssignItem) error {
|
|||||||
PendingVideoCount: it.AssignVideoCount,
|
PendingVideoCount: it.AssignVideoCount,
|
||||||
PendingPostCount: it.AssignPostCount,
|
PendingPostCount: it.AssignPostCount,
|
||||||
PendingDataCount: it.AssignDataCount,
|
PendingDataCount: it.AssignDataCount,
|
||||||
PendingReportCount: it.AssignReportCount,
|
|
||||||
AssignVideoScriptCount: it.AssignVideoScriptCount,
|
AssignVideoScriptCount: it.AssignVideoScriptCount,
|
||||||
AssignVideoCount: it.AssignVideoCount,
|
AssignVideoCount: it.AssignVideoCount,
|
||||||
AssignPostCount: it.AssignPostCount,
|
AssignPostCount: it.AssignPostCount,
|
||||||
AssignDataCount: it.AssignDataCount,
|
AssignDataCount: it.AssignDataCount,
|
||||||
AssignReportCount: it.AssignReportCount,
|
|
||||||
CompleteVideoScriptCount: 0,
|
CompleteVideoScriptCount: 0,
|
||||||
CompleteVideoCount: 0,
|
CompleteVideoCount: 0,
|
||||||
CompletePostCount: 0,
|
CompletePostCount: 0,
|
||||||
CompleteDataCount: 0,
|
CompleteDataCount: 0,
|
||||||
CompleteReportCount: 0,
|
|
||||||
CreatedAt: now,
|
CreatedAt: now,
|
||||||
UpdatedAt: now,
|
UpdatedAt: now,
|
||||||
}
|
}
|
||||||
@ -1156,12 +1164,15 @@ func GetEmployeeAssignedTasks(req *dto.EmployeeTaskQueryRequest) ([]*model.TaskA
|
|||||||
|
|
||||||
// 构建查询条件
|
// 构建查询条件
|
||||||
query := app.ModuleClients.TaskBenchDB.Model(&model.TaskAssignRecords{}).
|
query := app.ModuleClients.TaskBenchDB.Model(&model.TaskAssignRecords{}).
|
||||||
Select("task_assign_records.id, task_assign_records.assign_records_uuid, task_assign_records.sub_num, task_assign_records.tel_num, task_assign_records.task_batch, task_assign_records.status, task_assign_records.actual_status, task_assign_records.complete_time, task_assign_records.operator_type, task_assign_records.operator, task_assign_records.operator_id, task_assign_records.operator_num, task_assign_records.operator_time, task_assign_records.task_assignee, task_assign_records.task_assignee_num, task_assign_records.pending_video_script_count, task_assign_records.pending_video_count, task_assign_records.pending_post_count, task_assign_records.pending_data_count, task_assign_records.pending_report_count, task_assign_records.assign_video_script_count, task_assign_records.assign_video_count, task_assign_records.assign_post_count, task_assign_records.assign_data_count, task_assign_records.assign_report_count, task_assign_records.complete_video_script_count, task_assign_records.complete_video_count, task_assign_records.complete_post_count, task_assign_records.complete_data_count, task_assign_records.complete_report_count, task_assign_records.created_at, task_assign_records.updated_at, task_assign_records.deleted_at, task_assign_records.artist_name AS artist_name").
|
Select("task_assign_records.id, task_assign_records.assign_records_uuid, task_assign_records.sub_num, task_assign_records.tel_num, task_assign_records.task_batch, task_assign_records.status, task_assign_records.actual_status, task_assign_records.complete_time, task_assign_records.operator_type, task_assign_records.operator, task_assign_records.operator_id, task_assign_records.operator_num, task_assign_records.operator_time, task_assign_records.task_assignee, task_assign_records.task_assignee_num, task_assign_records.pending_video_script_count, task_assign_records.pending_video_count, task_assign_records.pending_post_count, task_assign_records.pending_data_count, task_assign_records.assign_video_script_count, task_assign_records.assign_video_count, task_assign_records.assign_post_count, task_assign_records.assign_data_count, task_assign_records.complete_video_script_count, task_assign_records.complete_video_count, task_assign_records.complete_post_count, task_assign_records.complete_data_count, task_assign_records.created_at, task_assign_records.updated_at, task_assign_records.deleted_at, rn.name AS artist_name").
|
||||||
|
Joins("LEFT JOIN `micro-account`.`user` u ON u.sub_num COLLATE utf8mb4_general_ci = task_assign_records.sub_num COLLATE utf8mb4_general_ci").
|
||||||
|
Joins("LEFT JOIN `micro-account`.real_name rn ON u.real_name_id = rn.id").
|
||||||
|
Where("u.deleted_at = 0").
|
||||||
Where("task_assign_records.task_assignee_num = ?", req.TaskAssigneeNum)
|
Where("task_assign_records.task_assignee_num = ?", req.TaskAssigneeNum)
|
||||||
|
|
||||||
// 关键词搜索(艺人姓名、编号、手机号)
|
// 关键词搜索(艺人姓名、编号、手机号)
|
||||||
if req.Keyword != "" {
|
if req.Keyword != "" {
|
||||||
query = query.Where("task_assign_records.sub_num LIKE ? OR task_assign_records.tel_num LIKE ? OR task_assign_records.artist_name LIKE ?",
|
query = query.Where("task_assign_records.sub_num LIKE ? OR task_assign_records.tel_num LIKE ? OR rn.name LIKE ?",
|
||||||
"%"+req.Keyword+"%", "%"+req.Keyword+"%", "%"+req.Keyword+"%")
|
"%"+req.Keyword+"%", "%"+req.Keyword+"%", "%"+req.Keyword+"%")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1201,7 +1212,7 @@ func GetEmployeeAssignedTasks(req *dto.EmployeeTaskQueryRequest) ([]*model.TaskA
|
|||||||
// 根据排序字段倒序
|
// 根据排序字段倒序
|
||||||
if req.SortBy != "" {
|
if req.SortBy != "" {
|
||||||
if strings.EqualFold(req.SortBy, "artist_name") {
|
if strings.EqualFold(req.SortBy, "artist_name") {
|
||||||
query = query.Order("task_assign_records.artist_name DESC")
|
query = query.Order("rn.name DESC")
|
||||||
} else {
|
} else {
|
||||||
query = query.Order("task_assign_records." + req.SortBy + " DESC")
|
query = query.Order("task_assign_records." + req.SortBy + " DESC")
|
||||||
}
|
}
|
||||||
@ -1217,7 +1228,7 @@ func GetEmployeeAssignedTasks(req *dto.EmployeeTaskQueryRequest) ([]*model.TaskA
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 按操作时间倒序
|
// 按操作时间倒序
|
||||||
err := query.Order("task_assign_records.operator_time DESC, task_assign_records.id DESC").Find(&records).Error
|
err := query.Order("task_assign_records.operator_time DESC").Find(&records).Error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, 0, commonErr.ReturnError(err, "查询员工指派任务失败", "查询员工指派任务失败: ")
|
return nil, 0, commonErr.ReturnError(err, "查询员工指派任务失败", "查询员工指派任务失败: ")
|
||||||
}
|
}
|
||||||
@ -1401,11 +1412,9 @@ func UpdateTaskProgress(req *dto.CompleteTaskRequest) error {
|
|||||||
query = query.Where("pending_data_count > 0 AND complete_data_count < assign_data_count")
|
query = query.Where("pending_data_count > 0 AND complete_data_count < assign_data_count")
|
||||||
case "script":
|
case "script":
|
||||||
query = query.Where("pending_video_script_count > 0 AND complete_video_script_count < assign_video_script_count")
|
query = query.Where("pending_video_script_count > 0 AND complete_video_script_count < assign_video_script_count")
|
||||||
case "report":
|
|
||||||
query = query.Where("pending_report_count > 0 AND complete_report_count < assign_report_count")
|
|
||||||
default:
|
default:
|
||||||
tx.Rollback()
|
tx.Rollback()
|
||||||
return commonErr.ReturnError(nil, "无效的任务类型", "任务类型必须是视频、图文、数据、脚本或竞品报告")
|
return commonErr.ReturnError(nil, "无效的任务类型", "任务类型必须是视频、图文、数据或脚本")
|
||||||
}
|
}
|
||||||
|
|
||||||
err = query.
|
err = query.
|
||||||
@ -1597,49 +1606,9 @@ func UpdateTaskProgress(req *dto.CompleteTaskRequest) error {
|
|||||||
}
|
}
|
||||||
updateData["complete_video_script_count"] = newCompleteCount
|
updateData["complete_video_script_count"] = newCompleteCount
|
||||||
updateData["pending_video_script_count"] = newPending
|
updateData["pending_video_script_count"] = newPending
|
||||||
case "report":
|
|
||||||
newCompleteCount := assignRecord.CompleteReportCount + req.CompleteCount
|
|
||||||
if newCompleteCount > assignRecord.AssignReportCount {
|
|
||||||
if req.AssignRecordsUUID != "false" {
|
|
||||||
app.ModuleClients.Lg.Info("竞品报告完成数量超出限制,跳过更新",
|
|
||||||
zap.String("assignRecordsUUID", assignRecord.AssignRecordsUUID),
|
|
||||||
zap.String("employeeName", req.EmployeeName),
|
|
||||||
zap.String("employeeNum", req.EmployeeNum),
|
|
||||||
zap.Int("currentCompleteCount", assignRecord.CompleteReportCount),
|
|
||||||
zap.Int("requestCompleteCount", req.CompleteCount),
|
|
||||||
zap.Int("newCompleteCount", newCompleteCount),
|
|
||||||
zap.Int("assignReportCount", assignRecord.AssignReportCount),
|
|
||||||
)
|
|
||||||
tx.Rollback()
|
|
||||||
return nil
|
|
||||||
} else {
|
|
||||||
tx.Rollback()
|
|
||||||
return commonErr.ReturnError(nil, "完成数量超出指派数量", "竞品报告完成数量不能超过已指派数量")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
newPending := assignRecord.PendingReportCount - req.CompleteCount
|
|
||||||
if newPending < 0 {
|
|
||||||
if req.AssignRecordsUUID != "false" {
|
|
||||||
app.ModuleClients.Lg.Info("待发竞品报告数不足,跳过更新",
|
|
||||||
zap.String("assignRecordsUUID", assignRecord.AssignRecordsUUID),
|
|
||||||
zap.String("employeeName", req.EmployeeName),
|
|
||||||
zap.String("employeeNum", req.EmployeeNum),
|
|
||||||
zap.Int("currentPendingCount", assignRecord.PendingReportCount),
|
|
||||||
zap.Int("requestCompleteCount", req.CompleteCount),
|
|
||||||
zap.Int("newPendingCount", newPending),
|
|
||||||
)
|
|
||||||
tx.Rollback()
|
|
||||||
return nil
|
|
||||||
} else {
|
|
||||||
tx.Rollback()
|
|
||||||
return commonErr.ReturnError(nil, "待发竞品报告数不足", "待发竞品报告数不能小于0")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
updateData["complete_report_count"] = newCompleteCount
|
|
||||||
updateData["pending_report_count"] = newPending
|
|
||||||
default:
|
default:
|
||||||
tx.Rollback()
|
tx.Rollback()
|
||||||
return commonErr.ReturnError(nil, "无效的任务类型", "任务类型必须是视频、图文、数据、脚本或竞品报告")
|
return commonErr.ReturnError(nil, "无效的任务类型", "任务类型必须是视频、图文、数据或脚本")
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. 更新指派记录
|
// 3. 更新指派记录
|
||||||
@ -1657,9 +1626,7 @@ func UpdateTaskProgress(req *dto.CompleteTaskRequest) error {
|
|||||||
// 5. 检查是否所有任务都已完成
|
// 5. 检查是否所有任务都已完成
|
||||||
if assignRecord.CompleteVideoCount == assignRecord.AssignVideoCount &&
|
if assignRecord.CompleteVideoCount == assignRecord.AssignVideoCount &&
|
||||||
assignRecord.CompletePostCount == assignRecord.AssignPostCount &&
|
assignRecord.CompletePostCount == assignRecord.AssignPostCount &&
|
||||||
assignRecord.CompleteDataCount == assignRecord.AssignDataCount &&
|
assignRecord.CompleteDataCount == assignRecord.AssignDataCount {
|
||||||
assignRecord.CompleteVideoScriptCount == assignRecord.AssignVideoScriptCount &&
|
|
||||||
assignRecord.CompleteReportCount == assignRecord.AssignReportCount {
|
|
||||||
// 更新实际完成状态
|
// 更新实际完成状态
|
||||||
if err = tx.Model(&assignRecord).Update("actual_status", 2).Error; err != nil {
|
if err = tx.Model(&assignRecord).Update("actual_status", 2).Error; err != nil {
|
||||||
tx.Rollback()
|
tx.Rollback()
|
||||||
@ -1678,8 +1645,6 @@ func UpdateTaskProgress(req *dto.CompleteTaskRequest) error {
|
|||||||
typeCode = 3
|
typeCode = 3
|
||||||
case "script":
|
case "script":
|
||||||
typeCode = 4
|
typeCode = 4
|
||||||
case "report":
|
|
||||||
typeCode = 5
|
|
||||||
}
|
}
|
||||||
if req.UUID != "" {
|
if req.UUID != "" {
|
||||||
uuidItem := &model.TaskAssignUUIDItems{
|
uuidItem := &model.TaskAssignUUIDItems{
|
||||||
@ -1721,11 +1686,15 @@ func GetTaskAssignRecordsList(req *dto.TaskAssignRecordsQueryRequest) ([]*model.
|
|||||||
var summary dto.TaskAssignRecordsSummary
|
var summary dto.TaskAssignRecordsSummary
|
||||||
|
|
||||||
// 构建查询条件
|
// 构建查询条件
|
||||||
query := app.ModuleClients.TaskBenchDB.Model(&model.TaskAssignRecords{})
|
query := app.ModuleClients.TaskBenchDB.Model(&model.TaskAssignRecords{}).
|
||||||
|
Select("task_assign_records.*, rn.name AS artist_name").
|
||||||
|
Joins("LEFT JOIN `micro-account`.`user` u ON u.sub_num COLLATE utf8mb4_general_ci = task_assign_records.sub_num COLLATE utf8mb4_general_ci").
|
||||||
|
Joins("LEFT JOIN `micro-account`.real_name rn ON u.real_name_id = rn.id").
|
||||||
|
Where("u.deleted_at = 0")
|
||||||
|
|
||||||
// 关键词搜索(艺人姓名、编号、手机号)
|
// 关键词搜索(艺人姓名、编号、手机号)
|
||||||
if req.Keyword != "" {
|
if req.Keyword != "" {
|
||||||
query = query.Where("task_assign_records.sub_num LIKE ? OR task_assign_records.tel_num LIKE ? OR task_assign_records.artist_name LIKE ?",
|
query = query.Where("task_assign_records.sub_num LIKE ? OR task_assign_records.tel_num LIKE ? OR rn.name LIKE ?",
|
||||||
"%"+req.Keyword+"%", "%"+req.Keyword+"%", "%"+req.Keyword+"%")
|
"%"+req.Keyword+"%", "%"+req.Keyword+"%", "%"+req.Keyword+"%")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1771,12 +1740,15 @@ func GetTaskAssignRecordsList(req *dto.TaskAssignRecordsQueryRequest) ([]*model.
|
|||||||
// 计算总数
|
// 计算总数
|
||||||
query.Count(&total)
|
query.Count(&total)
|
||||||
|
|
||||||
// 汇总:根据筛选条件分页前的所有艺人待发与已完成数量(同筛选条件)
|
// 汇总:根据筛选条件分页前的所有艺人待发与已完成数量(同筛选条件,关联用户与实名表以支持按实名筛选)
|
||||||
sumQuery := app.ModuleClients.TaskBenchDB.Model(&model.TaskAssignRecords{})
|
sumQuery := app.ModuleClients.TaskBenchDB.Model(&model.TaskAssignRecords{}).
|
||||||
|
Joins("LEFT JOIN `micro-account`.`user` u ON u.sub_num COLLATE utf8mb4_general_ci = task_assign_records.sub_num COLLATE utf8mb4_general_ci").
|
||||||
|
Joins("LEFT JOIN `micro-account`.real_name rn ON u.real_name_id = rn.id").
|
||||||
|
Where("u.deleted_at = 0")
|
||||||
|
|
||||||
if req.Keyword != "" {
|
if req.Keyword != "" {
|
||||||
// 与列表查询保持一致:按艺人编号、手机号、艺人名称进行模糊匹配
|
// 与列表查询保持一致:按艺人编号、手机号、实名表姓名进行模糊匹配
|
||||||
sumQuery = sumQuery.Where("task_assign_records.sub_num LIKE ? OR task_assign_records.tel_num LIKE ? OR task_assign_records.artist_name LIKE ?",
|
sumQuery = sumQuery.Where("task_assign_records.sub_num LIKE ? OR task_assign_records.tel_num LIKE ? OR rn.name LIKE ?",
|
||||||
"%"+req.Keyword+"%", "%"+req.Keyword+"%", "%"+req.Keyword+"%")
|
"%"+req.Keyword+"%", "%"+req.Keyword+"%", "%"+req.Keyword+"%")
|
||||||
}
|
}
|
||||||
if req.TaskAssignee != "" {
|
if req.TaskAssignee != "" {
|
||||||
@ -1806,7 +1778,7 @@ func GetTaskAssignRecordsList(req *dto.TaskAssignRecordsQueryRequest) ([]*model.
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 执行汇总查询(不分页)
|
// 执行汇总查询(不分页)
|
||||||
errSum := sumQuery.Select("\n SUM(task_assign_records.assign_video_script_count) AS total_pending_video_script_count,\n SUM(task_assign_records.assign_video_count) AS total_pending_video_count,\n SUM(task_assign_records.assign_post_count) AS total_pending_post_count,\n SUM(task_assign_records.assign_data_count) AS total_pending_data_count,\n SUM(task_assign_records.assign_report_count) AS total_pending_report_count,\n SUM(task_assign_records.complete_video_script_count) AS total_complete_video_script_count,\n SUM(task_assign_records.complete_video_count) AS total_complete_video_count,\n SUM(task_assign_records.complete_post_count) AS total_complete_post_count,\n SUM(task_assign_records.complete_data_count) AS total_complete_data_count,\n SUM(task_assign_records.complete_report_count) AS total_complete_report_count\n ").Scan(&summary).Error
|
errSum := sumQuery.Select("\n SUM(task_assign_records.assign_video_script_count) AS total_pending_video_script_count,\n SUM(task_assign_records.assign_video_count) AS total_pending_video_count,\n SUM(task_assign_records.assign_post_count) AS total_pending_post_count,\n SUM(task_assign_records.assign_data_count) AS total_pending_data_count,\n SUM(task_assign_records.complete_video_script_count) AS total_complete_video_script_count,\n SUM(task_assign_records.complete_video_count) AS total_complete_video_count,\n SUM(task_assign_records.complete_post_count) AS total_complete_post_count,\n SUM(task_assign_records.complete_data_count) AS total_complete_data_count\n ").Scan(&summary).Error
|
||||||
if errSum != nil {
|
if errSum != nil {
|
||||||
return nil, 0, nil, commonErr.ReturnError(errSum, "查询操作记录汇总失败", "查询操作记录汇总失败: ")
|
return nil, 0, nil, commonErr.ReturnError(errSum, "查询操作记录汇总失败", "查询操作记录汇总失败: ")
|
||||||
}
|
}
|
||||||
@ -1837,17 +1809,14 @@ func GetTaskAssignRecordsList(req *dto.TaskAssignRecordsQueryRequest) ([]*model.
|
|||||||
"pending_post_count": true,
|
"pending_post_count": true,
|
||||||
"pending_data_count": true,
|
"pending_data_count": true,
|
||||||
"pending_video_script_count": true,
|
"pending_video_script_count": true,
|
||||||
"pending_report_count": true,
|
|
||||||
"assign_video_count": true,
|
"assign_video_count": true,
|
||||||
"assign_post_count": true,
|
"assign_post_count": true,
|
||||||
"assign_data_count": true,
|
"assign_data_count": true,
|
||||||
"assign_video_script_count": true,
|
"assign_video_script_count": true,
|
||||||
"assign_report_count": true,
|
|
||||||
"complete_video_count": true,
|
"complete_video_count": true,
|
||||||
"complete_post_count": true,
|
"complete_post_count": true,
|
||||||
"complete_data_count": true,
|
"complete_data_count": true,
|
||||||
"complete_video_script_count": true,
|
"complete_video_script_count": true,
|
||||||
"complete_report_count": true,
|
|
||||||
"created_at": true,
|
"created_at": true,
|
||||||
"assign_records_uuid": true,
|
"assign_records_uuid": true,
|
||||||
}
|
}
|
||||||
@ -1976,47 +1945,3 @@ func CreateTaskWorkLog(req *dto.CreateTaskWorkLogRequest) error {
|
|||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetTaskWorkLogList(req *dto.TaskWorkLogQueryRequest) ([]*model.TaskWorkLog, int64, error) {
|
|
||||||
if req == nil {
|
|
||||||
return nil, 0, commonErr.ReturnError(nil, "参数错误", "请求参数不能为空")
|
|
||||||
}
|
|
||||||
|
|
||||||
var records []*model.TaskWorkLog
|
|
||||||
var total int64
|
|
||||||
|
|
||||||
query := app.ModuleClients.TaskBenchDB.Model(&model.TaskWorkLog{})
|
|
||||||
|
|
||||||
if req.AssignRecordsUUID != "" {
|
|
||||||
query = query.Where("assign_records_uuid = ?", req.AssignRecordsUUID)
|
|
||||||
}
|
|
||||||
if req.OperationType != 0 {
|
|
||||||
query = query.Where("operation_type = ?", req.OperationType)
|
|
||||||
}
|
|
||||||
if req.TaskType != 0 {
|
|
||||||
query = query.Where("task_type = ?", req.TaskType)
|
|
||||||
}
|
|
||||||
if req.ArtistUUID != "" {
|
|
||||||
query = query.Where("artist_uuid = ?", req.ArtistUUID)
|
|
||||||
}
|
|
||||||
if req.SubNum != "" {
|
|
||||||
query = query.Where("sub_num = ?", req.SubNum)
|
|
||||||
}
|
|
||||||
if req.ArtistName != "" {
|
|
||||||
query = query.Where("artist_name LIKE ?", "%"+req.ArtistName+"%")
|
|
||||||
}
|
|
||||||
|
|
||||||
query.Count(&total)
|
|
||||||
|
|
||||||
if req.PageSize > 0 && req.Page > 0 {
|
|
||||||
offset := (req.Page - 1) * req.PageSize
|
|
||||||
query = query.Limit(req.PageSize).Offset(offset)
|
|
||||||
}
|
|
||||||
|
|
||||||
err := query.Order("operation_time DESC").Find(&records).Error
|
|
||||||
if err != nil {
|
|
||||||
return nil, 0, commonErr.ReturnError(err, "查询任务日志失败", "查询任务日志失败: ")
|
|
||||||
}
|
|
||||||
|
|
||||||
return records, total, nil
|
|
||||||
}
|
|
||||||
|
|||||||
@ -26,9 +26,7 @@ type TaskAssignRequest struct {
|
|||||||
AssignPostCount int `json:"assignPostCount"` // 指派图文数
|
AssignPostCount int `json:"assignPostCount"` // 指派图文数
|
||||||
AssignDataCount int `json:"assignDataCount"` // 指派数据数
|
AssignDataCount int `json:"assignDataCount"` // 指派数据数
|
||||||
AssignVideoScriptCount int `json:"assignVideoScriptCount"` // 指派视频脚本数
|
AssignVideoScriptCount int `json:"assignVideoScriptCount"` // 指派视频脚本数
|
||||||
AssignReportCount int `json:"assignReportCount"` // 指派竞品报告数
|
|
||||||
TaskBatch string `json:"taskBatch"` // 任务批次
|
TaskBatch string `json:"taskBatch"` // 任务批次
|
||||||
UserID int `json:"userID"` // 用户ID
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// BatchAssignItem 批量指派项(仅写入指派记录,不更新任务管理表)
|
// BatchAssignItem 批量指派项(仅写入指派记录,不更新任务管理表)
|
||||||
@ -44,9 +42,7 @@ type BatchAssignItem struct {
|
|||||||
AssignPostCount int `json:"assignPostCount"` // 指派图文数
|
AssignPostCount int `json:"assignPostCount"` // 指派图文数
|
||||||
AssignDataCount int `json:"assignDataCount"` // 指派数据数
|
AssignDataCount int `json:"assignDataCount"` // 指派数据数
|
||||||
AssignVideoScriptCount int `json:"assignVideoScriptCount"` // 指派视频脚本数
|
AssignVideoScriptCount int `json:"assignVideoScriptCount"` // 指派视频脚本数
|
||||||
AssignReportCount int `json:"assignReportCount"` // 指派竞品报告数
|
|
||||||
TaskBatch string `json:"taskBatch"` // 任务批次
|
TaskBatch string `json:"taskBatch"` // 任务批次
|
||||||
UserID int `json:"userID"` // 用户ID
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// EmployeeTaskQueryRequest 员工任务查询请求参数
|
// EmployeeTaskQueryRequest 员工任务查询请求参数
|
||||||
@ -71,7 +67,7 @@ type CompleteTaskRequest struct {
|
|||||||
AssignRecordsUUID string `json:"assignRecordsUUID,omitempty"` // 指派记录UUID(可选)
|
AssignRecordsUUID string `json:"assignRecordsUUID,omitempty"` // 指派记录UUID(可选)
|
||||||
EmployeeName string `json:"employeeName"` // 员工姓名(必要)
|
EmployeeName string `json:"employeeName"` // 员工姓名(必要)
|
||||||
EmployeeNum string `json:"employeeNum"` // 员工工号(必要)
|
EmployeeNum string `json:"employeeNum"` // 员工工号(必要)
|
||||||
TaskType string `json:"taskType"` // 任务类型: video/post/data/script/report
|
TaskType string `json:"taskType"` // 任务类型: video/post/data/script
|
||||||
UUID string `json:"uuid"` // 任务UUID
|
UUID string `json:"uuid"` // 任务UUID
|
||||||
CompleteCount int `json:"completeCount"` // 完成数量
|
CompleteCount int `json:"completeCount"` // 完成数量
|
||||||
}
|
}
|
||||||
@ -113,13 +109,11 @@ type TaskAssignRecordsResponse struct {
|
|||||||
PendingPostCount int `gorm:"column:pending_post_count;comment:待发图文数量" json:"pendingPostCount"`
|
PendingPostCount int `gorm:"column:pending_post_count;comment:待发图文数量" json:"pendingPostCount"`
|
||||||
PendingDataCount int `gorm:"column:pending_data_count;comment:待发数据数量" json:"pendingDataCount"`
|
PendingDataCount int `gorm:"column:pending_data_count;comment:待发数据数量" json:"pendingDataCount"`
|
||||||
PendingVideoScriptCount int `gorm:"column:pending_video_script_count;comment:待发视频脚本数量" json:"pendingVideoScriptCount"`
|
PendingVideoScriptCount int `gorm:"column:pending_video_script_count;comment:待发视频脚本数量" json:"pendingVideoScriptCount"`
|
||||||
PendingReportCount int `gorm:"column:pending_report_count;comment:待发竞品报告数量" json:"pendingReportCount"`
|
|
||||||
// 已完成统计
|
// 已完成统计
|
||||||
CompleteVideoScriptCount int `gorm:"column:complete_video_script_count;comment:已完成视频脚本数" json:"completeVideoScriptCount"`
|
CompleteVideoScriptCount int `gorm:"column:complete_video_script_count;comment:已完成视频脚本数" json:"completeVideoScriptCount"`
|
||||||
CompleteVideoCount int `gorm:"column:complete_video_count;comment:已完成视频数" json:"completeVideoCount"`
|
CompleteVideoCount int `gorm:"column:complete_video_count;comment:已完成视频数" json:"completeVideoCount"`
|
||||||
CompletePostCount int `gorm:"column:complete_post_count;comment:已完成图文数" json:"completePostCount"`
|
CompletePostCount int `gorm:"column:complete_post_count;comment:已完成图文数" json:"completePostCount"`
|
||||||
CompleteDataCount int `gorm:"column:complete_data_count;comment:已完成数据数" json:"completeDataCount"`
|
CompleteDataCount int `gorm:"column:complete_data_count;comment:已完成数据数" json:"completeDataCount"`
|
||||||
CompleteReportCount int `gorm:"column:complete_report_count;comment:已完成竞品报告数" json:"completeReportCount"`
|
|
||||||
UpdatedAt time.Time `gorm:"column:updated_at;comment:更新时间" json:"updatedAt"`
|
UpdatedAt time.Time `gorm:"column:updated_at;comment:更新时间" json:"updatedAt"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,12 +123,10 @@ type TaskAssignRecordsSummary struct {
|
|||||||
TotalPendingVideoCount int `json:"totalPendingVideoCount"`
|
TotalPendingVideoCount int `json:"totalPendingVideoCount"`
|
||||||
TotalPendingPostCount int `json:"totalPendingPostCount"`
|
TotalPendingPostCount int `json:"totalPendingPostCount"`
|
||||||
TotalPendingDataCount int `json:"totalPendingDataCount"`
|
TotalPendingDataCount int `json:"totalPendingDataCount"`
|
||||||
TotalPendingReportCount int `json:"totalPendingReportCount"`
|
|
||||||
TotalCompleteVideoScriptCount int `json:"totalCompleteVideoScriptCount"`
|
TotalCompleteVideoScriptCount int `json:"totalCompleteVideoScriptCount"`
|
||||||
TotalCompleteVideoCount int `json:"totalCompleteVideoCount"`
|
TotalCompleteVideoCount int `json:"totalCompleteVideoCount"`
|
||||||
TotalCompletePostCount int `json:"totalCompletePostCount"`
|
TotalCompletePostCount int `json:"totalCompletePostCount"`
|
||||||
TotalCompleteDataCount int `json:"totalCompleteDataCount"`
|
TotalCompleteDataCount int `json:"totalCompleteDataCount"`
|
||||||
TotalCompleteReportCount int `json:"totalCompleteReportCount"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ValidArtistInfo 有效艺人信息结构体
|
// ValidArtistInfo 有效艺人信息结构体
|
||||||
@ -188,13 +180,6 @@ type ArtistUploadStatsItem struct {
|
|||||||
ReleasedDataAnalysisTotal int `json:"releasedDataAnalysisTotal" gorm:"column:released_data_total"`
|
ReleasedDataAnalysisTotal int `json:"releasedDataAnalysisTotal" gorm:"column:released_data_total"`
|
||||||
PendingDataAnalysisCount int `json:"pendingDataAnalysisCount" gorm:"column:pending_data_count"`
|
PendingDataAnalysisCount int `json:"pendingDataAnalysisCount" gorm:"column:pending_data_count"`
|
||||||
|
|
||||||
// 竞品报告
|
|
||||||
UploadedReportCount int `json:"uploadedReportCount" gorm:"column:uploaded_report_count"`
|
|
||||||
BundleReportTotal int `json:"bundleReportTotal" gorm:"column:bundle_report_total"`
|
|
||||||
IncreaseReportTotal int `json:"increaseReportTotal" gorm:"column:increase_report_total"`
|
|
||||||
ReleasedReportTotal int `json:"releasedReportTotal" gorm:"column:released_report_total"`
|
|
||||||
PendingReportCount int `json:"pendingReportCount" gorm:"column:pending_report_count"`
|
|
||||||
|
|
||||||
// 任务管理
|
// 任务管理
|
||||||
LastTaskAssignee string `json:"lastTaskAssignee" gorm:"column:last_task_assignee"`
|
LastTaskAssignee string `json:"lastTaskAssignee" gorm:"column:last_task_assignee"`
|
||||||
TaskAssigneeNum string `json:"taskAssigneeNum" gorm:"column:task_assignee_num"`
|
TaskAssigneeNum string `json:"taskAssigneeNum" gorm:"column:task_assignee_num"`
|
||||||
@ -210,7 +195,6 @@ type ArtistUploadStatsItem struct {
|
|||||||
AllowVideoCount int `json:"allowVideoCount" gorm:"column:allow_video_count"`
|
AllowVideoCount int `json:"allowVideoCount" gorm:"column:allow_video_count"`
|
||||||
AllowPostCount int `json:"allowPostCount" gorm:"column:allow_post_count"`
|
AllowPostCount int `json:"allowPostCount" gorm:"column:allow_post_count"`
|
||||||
AllowDataCount int `json:"allowDataCount" gorm:"column:allow_data_count"`
|
AllowDataCount int `json:"allowDataCount" gorm:"column:allow_data_count"`
|
||||||
AllowReportCount int `json:"allowReportCount" gorm:"column:allow_report_count"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ArtistPendingAssignItem 艺人可指派数量(可上传数 - 已指派且未完成的数量)
|
// ArtistPendingAssignItem 艺人可指派数量(可上传数 - 已指派且未完成的数量)
|
||||||
@ -222,7 +206,6 @@ type ArtistPendingAssignItem struct {
|
|||||||
AllowVideoCount int `json:"allowVideoCount" gorm:"column:allow_video_count"`
|
AllowVideoCount int `json:"allowVideoCount" gorm:"column:allow_video_count"`
|
||||||
AllowPostCount int `json:"allowPostCount" gorm:"column:allow_post_count"`
|
AllowPostCount int `json:"allowPostCount" gorm:"column:allow_post_count"`
|
||||||
AllowDataCount int `json:"allowDataCount" gorm:"column:allow_data_count"`
|
AllowDataCount int `json:"allowDataCount" gorm:"column:allow_data_count"`
|
||||||
AllowReportCount int `json:"allowReportCount" gorm:"column:allow_report_count"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateTaskWorkLogRequest 创建任务日志请求参数
|
// CreateTaskWorkLogRequest 创建任务日志请求参数
|
||||||
@ -238,7 +221,7 @@ type CreateTaskWorkLogRequest struct {
|
|||||||
|
|
||||||
// 操作信息
|
// 操作信息
|
||||||
OperationType int `json:"operationType"` // 任务操作类型 1:加任务 2:消耗任务 3:完成任务 4:任务过期(必填)
|
OperationType int `json:"operationType"` // 任务操作类型 1:加任务 2:消耗任务 3:完成任务 4:任务过期(必填)
|
||||||
TaskType int `json:"taskType"` // 任务类型 1:视频 2:图片 3:数据分析 4: 视频脚本 5: 竞品报告
|
TaskType int `json:"taskType"` // 任务类型 1:视频 2:图片 3:数据分析(必填)
|
||||||
TaskCount int `json:"taskCount"` // 任务数量(必填)
|
TaskCount int `json:"taskCount"` // 任务数量(必填)
|
||||||
Remark string `json:"remark"` // 任务备注
|
Remark string `json:"remark"` // 任务备注
|
||||||
|
|
||||||
@ -246,14 +229,3 @@ type CreateTaskWorkLogRequest struct {
|
|||||||
OperatorName string `json:"operatorName"` // 任务操作人姓名
|
OperatorName string `json:"operatorName"` // 任务操作人姓名
|
||||||
OperatorNum string `json:"operatorNum"` // 任务操作人账号
|
OperatorNum string `json:"operatorNum"` // 任务操作人账号
|
||||||
}
|
}
|
||||||
|
|
||||||
type TaskWorkLogQueryRequest struct {
|
|
||||||
AssignRecordsUUID string `json:"assignRecordsUUID"`
|
|
||||||
OperationType int `json:"operationType"`
|
|
||||||
TaskType int `json:"taskType"`
|
|
||||||
ArtistUUID string `json:"artistUUID"`
|
|
||||||
SubNum string `json:"subNum"`
|
|
||||||
ArtistName string `json:"artistName"`
|
|
||||||
Page int `json:"page"`
|
|
||||||
PageSize int `json:"pageSize"`
|
|
||||||
}
|
|
||||||
|
|||||||
@ -156,8 +156,8 @@ func GetBundleBalanceList(req *bundle.GetBundleBalanceListReq) (*bundle.GetBundl
|
|||||||
IncreaseCompetitiveConsumptionNumber: int32(m.IncreaseCompetitiveConsumptionNumber) + int32(m.IncreaseLimitCompetitiveConsumptionNumber) + int32(m.IncreaseLimitCompetitiveExpiredConsumptionNumber),
|
IncreaseCompetitiveConsumptionNumber: int32(m.IncreaseCompetitiveConsumptionNumber) + int32(m.IncreaseLimitCompetitiveConsumptionNumber) + int32(m.IncreaseLimitCompetitiveExpiredConsumptionNumber),
|
||||||
InvalidBundleCompetitiveNumber: int32(m.InvalidBundleCompetitiveNumber),
|
InvalidBundleCompetitiveNumber: int32(m.InvalidBundleCompetitiveNumber),
|
||||||
InvalidIncreaseCompetitiveNumber: int32(m.InvalidIncreaseCompetitiveNumber),
|
InvalidIncreaseCompetitiveNumber: int32(m.InvalidIncreaseCompetitiveNumber),
|
||||||
MonthlyNewBundleCompetitiveNumber: int32(qua(m.BundleBalance, m.BundleLimitCompetitiveNumber, m.MonthlyLimitCompetitiveQuotaNumber, date) + cal(m.BundleBalance, m.BundleLimitCompetitiveExpiredNumber, m.MonthlyLimitCompetitiveQuotaNumber, date)),
|
MonthlyNewBundleCompetitiveNumber: int32(cal(m.BundleBalance, m.BundleLimitCompetitiveNumber, m.MonthlyLimitCompetitiveQuotaNumber, date) + cal(m.BundleBalance, m.BundleLimitCompetitiveExpiredNumber, m.MonthlyLimitCompetitiveQuotaNumber, date)),
|
||||||
MonthlyNewIncreaseCompetitiveNumber: int32(qua(m.BundleBalance, m.IncreaseLimitCompetitiveNumber, m.MonthlyLimitCompetitiveQuotaNumber, date) + cal(m.BundleBalance, m.IncreaseLimitCompetitiveExpiredNumber, m.MonthlyLimitCompetitiveQuotaNumber, date)),
|
MonthlyNewIncreaseCompetitiveNumber: int32(cal(m.BundleBalance, m.IncreaseLimitCompetitiveNumber, m.MonthlyLimitCompetitiveQuotaNumber, date) + cal(m.BundleBalance, m.IncreaseLimitCompetitiveExpiredNumber, m.MonthlyLimitCompetitiveQuotaNumber, date)),
|
||||||
MonthBundleCompetitiveConsumptionNumber: int32(m.MonthlyBundleCompetitiveConsumptionNumber) + int32(m.MonthlyBundleLimitCompetitiveConsumptionNumber) + int32(m.MonthlyBundleLimitExpiredCompetitiveConsumptionNumber),
|
MonthBundleCompetitiveConsumptionNumber: int32(m.MonthlyBundleCompetitiveConsumptionNumber) + int32(m.MonthlyBundleLimitCompetitiveConsumptionNumber) + int32(m.MonthlyBundleLimitExpiredCompetitiveConsumptionNumber),
|
||||||
MonthIncreaseCompetitiveConsumptionNumber: int32(m.MonthlyIncreaseCompetitiveConsumptionNumber) + int32(m.MonthlyIncreaseLimitCompetitiveConsumptionNumber) + int32(m.MonthlyIncreaseLimitExpiredCompetitiveConsumptionNumber),
|
MonthIncreaseCompetitiveConsumptionNumber: int32(m.MonthlyIncreaseCompetitiveConsumptionNumber) + int32(m.MonthlyIncreaseLimitCompetitiveConsumptionNumber) + int32(m.MonthlyIncreaseLimitExpiredCompetitiveConsumptionNumber),
|
||||||
MonthlyBundleCompetitiveNumber: int32(m.BundleCompetitiveNumber) - int32(m.BundleCompetitiveConsumptionNumber) + int32(m.MonthlyBundleLimitCompetitiveNumber) + int32(m.MonthlyBundleLimitExpiredCompetitiveNumber) - int32(m.MonthlyBundleLimitCompetitiveConsumptionNumber),
|
MonthlyBundleCompetitiveNumber: int32(m.BundleCompetitiveNumber) - int32(m.BundleCompetitiveConsumptionNumber) + int32(m.MonthlyBundleLimitCompetitiveNumber) + int32(m.MonthlyBundleLimitExpiredCompetitiveNumber) - int32(m.MonthlyBundleLimitCompetitiveConsumptionNumber),
|
||||||
@ -325,26 +325,6 @@ func cal(data model.BundleBalance, total, limit int, date time.Time) int {
|
|||||||
return min(limit, remaining)
|
return min(limit, remaining)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 计算每个季度发放的数目
|
|
||||||
func qua(data model.BundleBalance, total, limit int, date time.Time) int {
|
|
||||||
var released int // 已释放的次数
|
|
||||||
if data.StartAt.Month() == date.Month() && data.StartAt.Year() == date.Year() {
|
|
||||||
} else {
|
|
||||||
released += limit
|
|
||||||
}
|
|
||||||
interval := max((date.Year()*12+int(date.Month())-(data.StartAt.Year()*12+int(data.StartAt.Month())))/3, 1) // 释放了多少个季度
|
|
||||||
released += max(interval-1, 0) * limit // 已经释放的数量
|
|
||||||
remaining := max(total-released, 0) // 还剩余多少次没有发放
|
|
||||||
if data.StartAt.Month() == date.Month() && data.StartAt.Year() == date.Year() { // 本月为第一个月购买
|
|
||||||
return min(limit, remaining)
|
|
||||||
}
|
|
||||||
monthDiff := date.Year()*12 + int(date.Month()) - (data.StartAt.Year()*12 + int(data.StartAt.Month()))
|
|
||||||
if monthDiff%3 == 0 && data.ExpiredAt.Month() != date.Month() {
|
|
||||||
return min(limit, remaining)
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func CreateBundleBalance(req *bundle.CreateBundleBalanceReq) (*bundle.CreateBundleBalanceResp, error) {
|
func CreateBundleBalance(req *bundle.CreateBundleBalanceReq) (*bundle.CreateBundleBalanceResp, error) {
|
||||||
var data model.BundleBalance
|
var data model.BundleBalance
|
||||||
orderReq := &bundle.OrderRecordsDetailRequest{}
|
orderReq := &bundle.OrderRecordsDetailRequest{}
|
||||||
@ -775,8 +755,6 @@ func buildDefaultBalanceLayout() string {
|
|||||||
{"增值数据总数", "increaseDataAnalysisNumber", 2},
|
{"增值数据总数", "increaseDataAnalysisNumber", 2},
|
||||||
{"当前已用套餐数据数", "bundleDataAnalysisConsumptionNumber", 2},
|
{"当前已用套餐数据数", "bundleDataAnalysisConsumptionNumber", 2},
|
||||||
{"当前已用增值数据数", "increaseDataAnalysisConsumptionNumber", 2},
|
{"当前已用增值数据数", "increaseDataAnalysisConsumptionNumber", 2},
|
||||||
{"当前可用套餐数据数", "monthlyBundleDataAnalysisNumber", 2},
|
|
||||||
{"当前可用增值数据数", "monthlyIncreaseDataAnalysisNumber", 2},
|
|
||||||
{"当前作废套餐数据数", "invalidBundleDataAnalysisNumber", 2},
|
{"当前作废套餐数据数", "invalidBundleDataAnalysisNumber", 2},
|
||||||
{"当前作废增值数据数", "invalidIncreaseDataAnalysisNumber", 2},
|
{"当前作废增值数据数", "invalidIncreaseDataAnalysisNumber", 2},
|
||||||
{"当月新增套餐数据数", "monthlyNewBundleDataAnalysisNumber", 2},
|
{"当月新增套餐数据数", "monthlyNewBundleDataAnalysisNumber", 2},
|
||||||
@ -791,8 +769,6 @@ func buildDefaultBalanceLayout() string {
|
|||||||
{"增值竞品总数", "increaseCompetitiveNumber", 2},
|
{"增值竞品总数", "increaseCompetitiveNumber", 2},
|
||||||
{"当前已用套餐竞品数", "bundleCompetitiveConsumptionNumber", 2},
|
{"当前已用套餐竞品数", "bundleCompetitiveConsumptionNumber", 2},
|
||||||
{"当前已用增值竞品数", "increaseCompetitiveConsumptionNumber", 2},
|
{"当前已用增值竞品数", "increaseCompetitiveConsumptionNumber", 2},
|
||||||
{"当前可用套餐竞品数", "monthlyBundleCompetitiveNumber", 2},
|
|
||||||
{"当前可用增值竞品数", "monthlyIncreaseCompetitiveNumber", 2},
|
|
||||||
{"当前作废套餐竞品数", "invalidBundleCompetitiveNumber", 2},
|
{"当前作废套餐竞品数", "invalidBundleCompetitiveNumber", 2},
|
||||||
{"当前作废增值竞品数", "invalidIncreaseCompetitiveNumber", 2},
|
{"当前作废增值竞品数", "invalidIncreaseCompetitiveNumber", 2},
|
||||||
{"当月新增套餐竞品数", "monthlyNewBundleCompetitiveNumber", 2},
|
{"当月新增套餐竞品数", "monthlyNewBundleCompetitiveNumber", 2},
|
||||||
|
|||||||
@ -1,617 +0,0 @@
|
|||||||
package logic
|
|
||||||
|
|
||||||
import (
|
|
||||||
"encoding/json"
|
|
||||||
"errors"
|
|
||||||
"micro-bundle/internal/dao"
|
|
||||||
"micro-bundle/internal/model"
|
|
||||||
"micro-bundle/pb/bundle"
|
|
||||||
"time"
|
|
||||||
"unicode/utf8"
|
|
||||||
|
|
||||||
"github.com/google/uuid"
|
|
||||||
)
|
|
||||||
|
|
||||||
// attachmentsToJSON 将附件列表(url+fileName)序列化为 JSON 字符串存入 DB
|
|
||||||
func attachmentsToJSON(items []*bundle.AttachmentItem) string {
|
|
||||||
if len(items) == 0 {
|
|
||||||
return "[]"
|
|
||||||
}
|
|
||||||
list := make([]model.AttachmentItem, 0, len(items))
|
|
||||||
for _, it := range items {
|
|
||||||
list = append(list, model.AttachmentItem{URL: it.GetUrl(), FileName: it.GetFileName()})
|
|
||||||
}
|
|
||||||
b, _ := json.Marshal(list)
|
|
||||||
return string(b)
|
|
||||||
}
|
|
||||||
|
|
||||||
// jsonToAttachments 将 DB 中的 JSON 反序列化为附件列表(格式:[{"url":"","fileName":""},...])
|
|
||||||
func jsonToAttachments(s string) []*bundle.AttachmentItem {
|
|
||||||
if s == "" || s == "[]" {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
var list []model.AttachmentItem
|
|
||||||
_ = json.Unmarshal([]byte(s), &list)
|
|
||||||
out := make([]*bundle.AttachmentItem, 0, len(list))
|
|
||||||
for i := range list {
|
|
||||||
out = append(out, &bundle.AttachmentItem{Url: list[i].URL, FileName: list[i].FileName})
|
|
||||||
}
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// validateContractBody 校验合同主体字段(create/update 共用)
|
|
||||||
func validateContractBody(c *bundle.Contract) (string, error) {
|
|
||||||
// 1. 合同名称:必填;最多50个字
|
|
||||||
if c.ContractName == "" {
|
|
||||||
return "合同名称不能为空", errors.New("合同名称不能为空")
|
|
||||||
}
|
|
||||||
if utf8.RuneCountInString(c.ContractName) > 50 {
|
|
||||||
return "合同名称最多50个字", errors.New("合同名称最多50个字")
|
|
||||||
}
|
|
||||||
// 2. 项目名称:必填;最多50个字
|
|
||||||
if c.ProjectName == "" {
|
|
||||||
return "项目名称不能为空", errors.New("项目名称不能为空")
|
|
||||||
}
|
|
||||||
if utf8.RuneCountInString(c.ProjectName) > 50 {
|
|
||||||
return "项目名称最多50个字", errors.New("项目名称最多50个字")
|
|
||||||
}
|
|
||||||
if c.CustomerName == "" {
|
|
||||||
return "客户名称不能为空", errors.New("客户名称不能为空")
|
|
||||||
}
|
|
||||||
if c.ContractorName == "" {
|
|
||||||
return "承办商名称不能为空", errors.New("承办商名称不能为空")
|
|
||||||
}
|
|
||||||
if c.SigningDate == "" {
|
|
||||||
return "签署日期不能为空", errors.New("签署日期不能为空")
|
|
||||||
}
|
|
||||||
if c.EffectiveDate == "" {
|
|
||||||
return "生效日期不能为空", errors.New("生效日期不能为空")
|
|
||||||
}
|
|
||||||
if c.ContractAmount <= 0 {
|
|
||||||
return "合同金额不能为空", errors.New("合同金额不能为空")
|
|
||||||
}
|
|
||||||
if c.ContractCurrencyType == 0 {
|
|
||||||
return "合同货币类型不能为空", errors.New("合同货币类型不能为空")
|
|
||||||
}
|
|
||||||
if c.ContractPaymentCycle == "" {
|
|
||||||
return "支付周期不能为空", errors.New("支付周期不能为空")
|
|
||||||
}
|
|
||||||
if c.DevelopmentCycle == "" {
|
|
||||||
return "开发周期不能为空", errors.New("开发周期不能为空")
|
|
||||||
}
|
|
||||||
if c.MaintenanceCycleType == 0 {
|
|
||||||
return "维护周期类型不能为空", errors.New("维护周期类型不能为空")
|
|
||||||
}
|
|
||||||
if c.MaintenanceFee <= 0 {
|
|
||||||
return "维护费用不能为空", errors.New("维护费用不能为空")
|
|
||||||
}
|
|
||||||
if c.MaintenanceCurrencyType == 0 {
|
|
||||||
return "维护货币类型不能为空", errors.New("维护货币类型不能为空")
|
|
||||||
}
|
|
||||||
if c.QualityAssuranceFee <= 0 {
|
|
||||||
return "质量保证金额不能为空", errors.New("质量保证金额不能为空")
|
|
||||||
}
|
|
||||||
if c.QualityAssuranceCurrencyType == 0 {
|
|
||||||
return "质量保证金货币类型不能为空", errors.New("质量保证金货币类型不能为空")
|
|
||||||
}
|
|
||||||
if len(c.ContractAttachments) > 5 {
|
|
||||||
return "合同附件不能超过5个", errors.New("合同附件不能超过5个")
|
|
||||||
}
|
|
||||||
if len(c.OtherAttachments) > 5 {
|
|
||||||
return "其他附件不能超过5个", errors.New("其他附件不能超过5个")
|
|
||||||
}
|
|
||||||
return "", nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// validateCyclePeriods 验证周期期数是否从1开始连续递增
|
|
||||||
func validateCyclePeriods(periods []int32, cycleName string) (string, error) {
|
|
||||||
if len(periods) > 10 {
|
|
||||||
msg := cycleName + "不能超过10期"
|
|
||||||
return msg, errors.New(msg)
|
|
||||||
}
|
|
||||||
if len(periods) == 0 {
|
|
||||||
msg := cycleName + "至少有1期"
|
|
||||||
return msg, errors.New(msg)
|
|
||||||
}
|
|
||||||
periodSet := make(map[int32]bool)
|
|
||||||
for _, p := range periods {
|
|
||||||
periodSet[p] = true
|
|
||||||
}
|
|
||||||
count := int32(len(periods))
|
|
||||||
for i := int32(1); i <= count; i++ {
|
|
||||||
if !periodSet[i] {
|
|
||||||
msg := cycleName + "不是递增"
|
|
||||||
return msg, errors.New(msg)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return "", nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// convertPaymentCycles 转换支付周期子表
|
|
||||||
// isUpdate: true 时保留前端传入的 UUID,false 时生成新 UUID
|
|
||||||
func convertPaymentCycles(cycles []*bundle.ContractPaymentCycle, contractUUID string, isUpdate bool) ([]model.ContractPaymentCycle, string, error) {
|
|
||||||
if len(cycles) == 0 {
|
|
||||||
return nil, "", nil
|
|
||||||
}
|
|
||||||
result := make([]model.ContractPaymentCycle, 0, len(cycles))
|
|
||||||
for _, pc := range cycles {
|
|
||||||
// 交付时间点:最多200个字
|
|
||||||
if utf8.RuneCountInString(pc.DeliveryTime) > 200 {
|
|
||||||
return nil, "交付时间点最多200个字", errors.New("交付时间点最多200个字")
|
|
||||||
}
|
|
||||||
cycleUUID := uuid.New().String()
|
|
||||||
if isUpdate && pc.ContractPaymentCycleUUID != "" {
|
|
||||||
cycleUUID = pc.ContractPaymentCycleUUID
|
|
||||||
}
|
|
||||||
result = append(result, model.ContractPaymentCycle{
|
|
||||||
ContractPaymentCycleUUID: cycleUUID,
|
|
||||||
ContractUUID: contractUUID,
|
|
||||||
PaymentCyclePeriod: int(pc.PaymentCyclePeriod),
|
|
||||||
DeliveryTime: pc.DeliveryTime,
|
|
||||||
ContractPaymentCycleAmount: pc.ContractPaymentCycleAmount,
|
|
||||||
PaymentCycleCurrencyType: int(pc.PaymentCycleCurrencyType),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
return result, "", nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// convertDevelopmentCycles 转换开发周期子表
|
|
||||||
// isUpdate: true 时保留前端传入的 UUID,false 时生成新 UUID
|
|
||||||
func convertDevelopmentCycles(cycles []*bundle.DevelopmentCycle, contractUUID string, isUpdate bool) ([]model.DevelopmentCycle, string, error) {
|
|
||||||
if len(cycles) == 0 {
|
|
||||||
return nil, "", nil
|
|
||||||
}
|
|
||||||
result := make([]model.DevelopmentCycle, 0, len(cycles))
|
|
||||||
for _, dc := range cycles {
|
|
||||||
if len(dc.Attachments) > 5 {
|
|
||||||
return nil, "附件URLs不能超过5个", errors.New("附件URLs不能超过5个")
|
|
||||||
}
|
|
||||||
// 开发时间:最多50个字
|
|
||||||
if utf8.RuneCountInString(dc.DevelopmentTime) > 50 {
|
|
||||||
return nil, "开发时间最多50个字", errors.New("开发时间最多50个字")
|
|
||||||
}
|
|
||||||
// 交付内容:最多200个字
|
|
||||||
if utf8.RuneCountInString(dc.DeliveryContent) > 200 {
|
|
||||||
return nil, "交付内容最多200个字", errors.New("交付内容最多200个字")
|
|
||||||
}
|
|
||||||
cycleUUID := uuid.New().String()
|
|
||||||
if isUpdate && dc.DevelopmentCycleUUID != "" {
|
|
||||||
cycleUUID = dc.DevelopmentCycleUUID
|
|
||||||
}
|
|
||||||
result = append(result, model.DevelopmentCycle{
|
|
||||||
DevelopmentCycleUUID: cycleUUID,
|
|
||||||
ContractUUID: contractUUID,
|
|
||||||
DevelopmentPeriod: int(dc.DevelopmentPeriod),
|
|
||||||
DevelopmentTime: dc.DevelopmentTime,
|
|
||||||
AttachmentURLs: attachmentsToJSON(dc.Attachments),
|
|
||||||
DeliveryContent: dc.DeliveryContent,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
return result, "", nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// UpdateContract 合同更新接口(根据action判断新增/更新/删除)
|
|
||||||
func UpdateContract(req *bundle.ContractUpdateRequest) (res *bundle.ComResponse, err error) {
|
|
||||||
res = new(bundle.ComResponse)
|
|
||||||
|
|
||||||
if req.Contract == nil {
|
|
||||||
res.Msg = "合同信息不能为空"
|
|
||||||
return res, errors.New("合同信息不能为空")
|
|
||||||
}
|
|
||||||
|
|
||||||
switch req.Action {
|
|
||||||
case "create": // 新增
|
|
||||||
if msg, e := validateContractBody(req.Contract); e != nil {
|
|
||||||
res.Msg = msg
|
|
||||||
return res, e
|
|
||||||
}
|
|
||||||
|
|
||||||
// 构建model对象
|
|
||||||
contract := &model.Contract{
|
|
||||||
ContractUUID: req.Contract.ContractUUID,
|
|
||||||
ContractName: req.Contract.ContractName,
|
|
||||||
ProjectName: req.Contract.ProjectName,
|
|
||||||
CustomerName: req.Contract.CustomerName,
|
|
||||||
ContractorName: req.Contract.ContractorName,
|
|
||||||
SigningDate: req.Contract.SigningDate,
|
|
||||||
EffectiveDate: req.Contract.EffectiveDate,
|
|
||||||
ContractAmount: req.Contract.ContractAmount,
|
|
||||||
ContractCurrencyType: int(req.Contract.ContractCurrencyType),
|
|
||||||
ContractPaymentCycle: req.Contract.ContractPaymentCycle,
|
|
||||||
DevelopmentCycle: req.Contract.DevelopmentCycle,
|
|
||||||
MaintenanceCycleType: int(req.Contract.MaintenanceCycleType),
|
|
||||||
MaintenanceFee: req.Contract.MaintenanceFee,
|
|
||||||
MaintenanceCurrencyType: int(req.Contract.MaintenanceCurrencyType),
|
|
||||||
QualityAssuranceFee: req.Contract.QualityAssuranceFee,
|
|
||||||
QualityAssuranceCurrencyType: int(req.Contract.QualityAssuranceCurrencyType),
|
|
||||||
ContractAttachmentURLs: attachmentsToJSON(req.Contract.ContractAttachments),
|
|
||||||
OtherAttachmentURLs: attachmentsToJSON(req.Contract.OtherAttachments),
|
|
||||||
Operator: req.Contract.Operator,
|
|
||||||
OperatorID: req.Contract.OperatorID,
|
|
||||||
OperatorNum: req.Contract.OperatorNum,
|
|
||||||
}
|
|
||||||
contract.OperatorTime = time.Now()
|
|
||||||
|
|
||||||
// 支付周期:前端传 -1 表示不保存该条,过滤掉
|
|
||||||
paymentCyclesFiltered := make([]*bundle.ContractPaymentCycle, 0, len(req.Contract.PaymentCycles))
|
|
||||||
for _, pc := range req.Contract.PaymentCycles {
|
|
||||||
if pc.PaymentCyclePeriod != -1 {
|
|
||||||
paymentCyclesFiltered = append(paymentCyclesFiltered, pc)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 验证并转换支付周期子表
|
|
||||||
paymentPeriods := make([]int32, 0, len(paymentCyclesFiltered))
|
|
||||||
for _, pc := range paymentCyclesFiltered {
|
|
||||||
paymentPeriods = append(paymentPeriods, pc.PaymentCyclePeriod)
|
|
||||||
}
|
|
||||||
if msg, e := validateCyclePeriods(paymentPeriods, "支付周期"); e != nil {
|
|
||||||
res.Msg = msg
|
|
||||||
return res, e
|
|
||||||
}
|
|
||||||
paymentCycles, msg, e := convertPaymentCycles(paymentCyclesFiltered, contract.ContractUUID, false)
|
|
||||||
if e != nil {
|
|
||||||
res.Msg = msg
|
|
||||||
return res, e
|
|
||||||
}
|
|
||||||
contract.PaymentCycles = paymentCycles
|
|
||||||
|
|
||||||
// 开发周期:前端传 -1 表示不保存该条,过滤掉
|
|
||||||
devCyclesFiltered := make([]*bundle.DevelopmentCycle, 0, len(req.Contract.DevelopmentCycles))
|
|
||||||
for _, dc := range req.Contract.DevelopmentCycles {
|
|
||||||
if dc.DevelopmentPeriod != -1 {
|
|
||||||
devCyclesFiltered = append(devCyclesFiltered, dc)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 验证并转换开发周期子表
|
|
||||||
devPeriods := make([]int32, 0, len(devCyclesFiltered))
|
|
||||||
for _, dc := range devCyclesFiltered {
|
|
||||||
devPeriods = append(devPeriods, dc.DevelopmentPeriod)
|
|
||||||
}
|
|
||||||
if msg, e := validateCyclePeriods(devPeriods, "开发周期"); e != nil {
|
|
||||||
res.Msg = msg
|
|
||||||
return res, e
|
|
||||||
}
|
|
||||||
devCycles, msg, e := convertDevelopmentCycles(devCyclesFiltered, contract.ContractUUID, false)
|
|
||||||
if e != nil {
|
|
||||||
res.Msg = msg
|
|
||||||
return res, e
|
|
||||||
}
|
|
||||||
contract.DevelopmentCycles = devCycles
|
|
||||||
|
|
||||||
// 调用dao层创建
|
|
||||||
err = dao.CreateContract(contract)
|
|
||||||
if err != nil {
|
|
||||||
res.Msg = "创建失败"
|
|
||||||
return res, err
|
|
||||||
}
|
|
||||||
res.Msg = "创建成功"
|
|
||||||
|
|
||||||
case "update": // 更新
|
|
||||||
// 参数校验
|
|
||||||
if req.Contract.ContractUUID == "" {
|
|
||||||
res.Msg = "合同UUID不能为空"
|
|
||||||
return res, errors.New("合同UUID不能为空")
|
|
||||||
}
|
|
||||||
if msg, e := validateContractBody(req.Contract); e != nil {
|
|
||||||
res.Msg = msg
|
|
||||||
return res, e
|
|
||||||
}
|
|
||||||
|
|
||||||
// 构建model对象
|
|
||||||
contract := &model.Contract{
|
|
||||||
ContractName: req.Contract.ContractName,
|
|
||||||
ProjectName: req.Contract.ProjectName,
|
|
||||||
CustomerName: req.Contract.CustomerName,
|
|
||||||
ContractorName: req.Contract.ContractorName,
|
|
||||||
SigningDate: req.Contract.SigningDate,
|
|
||||||
EffectiveDate: req.Contract.EffectiveDate,
|
|
||||||
ContractAmount: req.Contract.ContractAmount,
|
|
||||||
ContractCurrencyType: int(req.Contract.ContractCurrencyType),
|
|
||||||
ContractPaymentCycle: req.Contract.ContractPaymentCycle,
|
|
||||||
DevelopmentCycle: req.Contract.DevelopmentCycle,
|
|
||||||
MaintenanceCycleType: int(req.Contract.MaintenanceCycleType),
|
|
||||||
MaintenanceFee: req.Contract.MaintenanceFee,
|
|
||||||
MaintenanceCurrencyType: int(req.Contract.MaintenanceCurrencyType),
|
|
||||||
QualityAssuranceFee: req.Contract.QualityAssuranceFee,
|
|
||||||
QualityAssuranceCurrencyType: int(req.Contract.QualityAssuranceCurrencyType),
|
|
||||||
ContractAttachmentURLs: attachmentsToJSON(req.Contract.ContractAttachments),
|
|
||||||
OtherAttachmentURLs: attachmentsToJSON(req.Contract.OtherAttachments),
|
|
||||||
Operator: req.Contract.Operator,
|
|
||||||
OperatorID: req.Contract.OperatorID,
|
|
||||||
OperatorNum: req.Contract.OperatorNum,
|
|
||||||
}
|
|
||||||
contract.OperatorTime = time.Now()
|
|
||||||
|
|
||||||
// 支付周期:前端传 -1 表示不保存该条,过滤掉
|
|
||||||
paymentCyclesFiltered := make([]*bundle.ContractPaymentCycle, 0, len(req.Contract.PaymentCycles))
|
|
||||||
for _, pc := range req.Contract.PaymentCycles {
|
|
||||||
if pc.PaymentCyclePeriod != -1 {
|
|
||||||
paymentCyclesFiltered = append(paymentCyclesFiltered, pc)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 验证并转换支付周期子表
|
|
||||||
paymentPeriods := make([]int32, 0, len(paymentCyclesFiltered))
|
|
||||||
for _, pc := range paymentCyclesFiltered {
|
|
||||||
paymentPeriods = append(paymentPeriods, pc.PaymentCyclePeriod)
|
|
||||||
}
|
|
||||||
if msg, e := validateCyclePeriods(paymentPeriods, "支付周期"); e != nil {
|
|
||||||
res.Msg = msg
|
|
||||||
return res, e
|
|
||||||
}
|
|
||||||
paymentCycles, msg, e := convertPaymentCycles(paymentCyclesFiltered, req.Contract.ContractUUID, true)
|
|
||||||
if e != nil {
|
|
||||||
res.Msg = msg
|
|
||||||
return res, e
|
|
||||||
}
|
|
||||||
contract.PaymentCycles = paymentCycles
|
|
||||||
|
|
||||||
// 开发周期:前端传 -1 表示不保存该条,过滤掉
|
|
||||||
devCyclesFiltered := make([]*bundle.DevelopmentCycle, 0, len(req.Contract.DevelopmentCycles))
|
|
||||||
for _, dc := range req.Contract.DevelopmentCycles {
|
|
||||||
if dc.DevelopmentPeriod != -1 {
|
|
||||||
devCyclesFiltered = append(devCyclesFiltered, dc)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 验证并转换开发周期子表
|
|
||||||
devPeriods := make([]int32, 0, len(devCyclesFiltered))
|
|
||||||
for _, dc := range devCyclesFiltered {
|
|
||||||
devPeriods = append(devPeriods, dc.DevelopmentPeriod)
|
|
||||||
}
|
|
||||||
if msg, e := validateCyclePeriods(devPeriods, "开发周期"); e != nil {
|
|
||||||
res.Msg = msg
|
|
||||||
return res, e
|
|
||||||
}
|
|
||||||
devCycles, msg, e := convertDevelopmentCycles(devCyclesFiltered, req.Contract.ContractUUID, true)
|
|
||||||
if e != nil {
|
|
||||||
res.Msg = msg
|
|
||||||
return res, e
|
|
||||||
}
|
|
||||||
contract.DevelopmentCycles = devCycles
|
|
||||||
|
|
||||||
// 调用dao层更新
|
|
||||||
err = dao.UpdateContract(req.Contract.ContractUUID, contract)
|
|
||||||
if err != nil {
|
|
||||||
res.Msg = "更新失败"
|
|
||||||
return res, err
|
|
||||||
}
|
|
||||||
res.Msg = "更新成功"
|
|
||||||
|
|
||||||
case "delete": // 删除
|
|
||||||
// 参数校验
|
|
||||||
if req.Contract.ContractUUID == "" {
|
|
||||||
res.Msg = "合同UUID不能为空"
|
|
||||||
return res, errors.New("合同UUID不能为空")
|
|
||||||
}
|
|
||||||
|
|
||||||
// 调用dao层删除
|
|
||||||
err = dao.DeleteContract(req.Contract.ContractUUID)
|
|
||||||
if err != nil {
|
|
||||||
res.Msg = "删除失败"
|
|
||||||
return res, err
|
|
||||||
}
|
|
||||||
res.Msg = "删除成功"
|
|
||||||
|
|
||||||
default:
|
|
||||||
res.Msg = "未知操作"
|
|
||||||
return res, errors.New("未知操作")
|
|
||||||
}
|
|
||||||
|
|
||||||
return res, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetContractList 查询合同列表
|
|
||||||
func GetContractList(req *bundle.ContractListRequest) (res *bundle.ContractListResponse, err error) {
|
|
||||||
res = new(bundle.ContractListResponse)
|
|
||||||
|
|
||||||
// 构建dao层查询请求
|
|
||||||
daoReq := &dao.ContractQueryRequest{
|
|
||||||
ContractName: req.ContractName,
|
|
||||||
ProjectName: req.ProjectName,
|
|
||||||
CustomerName: req.CustomerName,
|
|
||||||
Page: int(req.Page),
|
|
||||||
PageSize: int(req.PageSize),
|
|
||||||
}
|
|
||||||
|
|
||||||
// 调用dao层查询
|
|
||||||
contracts, total, err := dao.GetContractList(daoReq)
|
|
||||||
if err != nil {
|
|
||||||
return res, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// 转换model到proto响应
|
|
||||||
contractInfoList := make([]*bundle.ContractInfo, 0, len(contracts))
|
|
||||||
for _, contract := range contracts {
|
|
||||||
contractInfo := &bundle.ContractInfo{
|
|
||||||
ContractUUID: contract.ContractUUID,
|
|
||||||
ContractName: contract.ContractName,
|
|
||||||
ProjectName: contract.ProjectName,
|
|
||||||
CustomerName: contract.CustomerName,
|
|
||||||
ContractorName: contract.ContractorName,
|
|
||||||
SigningDate: contract.SigningDate,
|
|
||||||
EffectiveDate: contract.EffectiveDate,
|
|
||||||
ContractAmount: contract.ContractAmount,
|
|
||||||
ContractCurrencyType: int32(contract.ContractCurrencyType),
|
|
||||||
ContractPaymentCycle: contract.ContractPaymentCycle,
|
|
||||||
DevelopmentCycle: contract.DevelopmentCycle,
|
|
||||||
QualityAssuranceFee: contract.QualityAssuranceFee,
|
|
||||||
QualityAssuranceCurrencyType: int32(contract.QualityAssuranceCurrencyType),
|
|
||||||
MaintenanceCycleType: int32(contract.MaintenanceCycleType),
|
|
||||||
MaintenanceFee: contract.MaintenanceFee,
|
|
||||||
MaintenanceCurrencyType: int32(contract.MaintenanceCurrencyType),
|
|
||||||
ContractAttachments: jsonToAttachments(contract.ContractAttachmentURLs),
|
|
||||||
OtherAttachments: jsonToAttachments(contract.OtherAttachmentURLs),
|
|
||||||
Operator: contract.Operator,
|
|
||||||
}
|
|
||||||
// 格式化操作时间
|
|
||||||
if !contract.OperatorTime.IsZero() {
|
|
||||||
contractInfo.OperatorTime = contract.OperatorTime.Format("2006-01-02 15:04")
|
|
||||||
}
|
|
||||||
contractInfoList = append(contractInfoList, contractInfo)
|
|
||||||
}
|
|
||||||
|
|
||||||
res.List = contractInfoList
|
|
||||||
res.Total = total
|
|
||||||
res.Page = req.Page
|
|
||||||
res.PageSize = req.PageSize
|
|
||||||
|
|
||||||
return res, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetContractDetail 根据合同UUID查询详情
|
|
||||||
func GetContractDetail(req *bundle.ContractDetailRequest) (res *bundle.ContractDetailResponse, err error) {
|
|
||||||
res = new(bundle.ContractDetailResponse)
|
|
||||||
|
|
||||||
// 参数校验
|
|
||||||
if req.ContractUUID == "" {
|
|
||||||
res.Msg = "合同UUID不能为空"
|
|
||||||
return res, errors.New("合同UUID不能为空")
|
|
||||||
}
|
|
||||||
|
|
||||||
// 调用dao层查询
|
|
||||||
contract, err := dao.GetContractByUUID(req.ContractUUID)
|
|
||||||
if err != nil {
|
|
||||||
res.Msg = "查询合同信息失败"
|
|
||||||
return res, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// 如果合同不存在
|
|
||||||
if contract == nil {
|
|
||||||
res.Msg = "合同不存在"
|
|
||||||
return res, errors.New("合同不存在")
|
|
||||||
}
|
|
||||||
|
|
||||||
// 转换model到proto响应
|
|
||||||
contractProto := &bundle.Contract{
|
|
||||||
ContractUUID: contract.ContractUUID,
|
|
||||||
ContractName: contract.ContractName,
|
|
||||||
ProjectName: contract.ProjectName,
|
|
||||||
CustomerName: contract.CustomerName,
|
|
||||||
ContractorName: contract.ContractorName,
|
|
||||||
SigningDate: contract.SigningDate,
|
|
||||||
EffectiveDate: contract.EffectiveDate,
|
|
||||||
ContractAmount: contract.ContractAmount,
|
|
||||||
ContractCurrencyType: int32(contract.ContractCurrencyType),
|
|
||||||
ContractPaymentCycle: contract.ContractPaymentCycle,
|
|
||||||
DevelopmentCycle: contract.DevelopmentCycle,
|
|
||||||
MaintenanceCycleType: int64(contract.MaintenanceCycleType),
|
|
||||||
MaintenanceFee: contract.MaintenanceFee,
|
|
||||||
MaintenanceCurrencyType: int32(contract.MaintenanceCurrencyType),
|
|
||||||
QualityAssuranceFee: contract.QualityAssuranceFee,
|
|
||||||
QualityAssuranceCurrencyType: int32(contract.QualityAssuranceCurrencyType),
|
|
||||||
ContractAttachments: jsonToAttachments(contract.ContractAttachmentURLs),
|
|
||||||
OtherAttachments: jsonToAttachments(contract.OtherAttachmentURLs),
|
|
||||||
Operator: contract.Operator,
|
|
||||||
}
|
|
||||||
|
|
||||||
// 格式化操作时间
|
|
||||||
if !contract.OperatorTime.IsZero() {
|
|
||||||
contractProto.OperatorTime = contract.OperatorTime.Format("2006-01-02 15:04")
|
|
||||||
}
|
|
||||||
|
|
||||||
// 转换支付周期子表
|
|
||||||
if len(contract.PaymentCycles) > 0 {
|
|
||||||
contractProto.PaymentCycles = make([]*bundle.ContractPaymentCycle, 0, len(contract.PaymentCycles))
|
|
||||||
for _, pc := range contract.PaymentCycles {
|
|
||||||
contractProto.PaymentCycles = append(contractProto.PaymentCycles, &bundle.ContractPaymentCycle{
|
|
||||||
ContractPaymentCycleUUID: pc.ContractPaymentCycleUUID,
|
|
||||||
ContractUUID: pc.ContractUUID,
|
|
||||||
PaymentCyclePeriod: int32(pc.PaymentCyclePeriod),
|
|
||||||
DeliveryTime: pc.DeliveryTime,
|
|
||||||
ContractPaymentCycleAmount: pc.ContractPaymentCycleAmount,
|
|
||||||
PaymentCycleCurrencyType: int32(pc.PaymentCycleCurrencyType),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 转换开发周期子表
|
|
||||||
if len(contract.DevelopmentCycles) > 0 {
|
|
||||||
contractProto.DevelopmentCycles = make([]*bundle.DevelopmentCycle, 0, len(contract.DevelopmentCycles))
|
|
||||||
for _, dc := range contract.DevelopmentCycles {
|
|
||||||
contractProto.DevelopmentCycles = append(contractProto.DevelopmentCycles, &bundle.DevelopmentCycle{
|
|
||||||
DevelopmentCycleUUID: dc.DevelopmentCycleUUID,
|
|
||||||
ContractUUID: dc.ContractUUID,
|
|
||||||
DevelopmentPeriod: int32(dc.DevelopmentPeriod),
|
|
||||||
DevelopmentTime: dc.DevelopmentTime,
|
|
||||||
Attachments: jsonToAttachments(dc.AttachmentURLs),
|
|
||||||
DeliveryContent: dc.DeliveryContent,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
res.Contract = contractProto
|
|
||||||
res.Msg = "查询成功"
|
|
||||||
|
|
||||||
return res, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetDevelopmentCyclesByContractUUID 根据合同UUID查询开发周期
|
|
||||||
func GetDevelopmentCyclesByContractUUID(req *bundle.GetDevelopmentCyclesByContractUUIDRequest) (res *bundle.GetDevelopmentCyclesByContractUUIDResponse, err error) {
|
|
||||||
res = new(bundle.GetDevelopmentCyclesByContractUUIDResponse)
|
|
||||||
|
|
||||||
// 参数校验
|
|
||||||
if req.ContractUUID == "" {
|
|
||||||
res.Msg = "合同UUID不能为空"
|
|
||||||
return res, errors.New("合同UUID不能为空")
|
|
||||||
}
|
|
||||||
|
|
||||||
// 调用dao层查询
|
|
||||||
developmentCycles, err := dao.GetDevelopmentCyclesByContractUUID(req.ContractUUID)
|
|
||||||
if err != nil {
|
|
||||||
res.Msg = "查询开发周期失败"
|
|
||||||
return res, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// 转换model到proto响应
|
|
||||||
developmentCycleList := make([]*bundle.DevelopmentCycle, 0, len(developmentCycles))
|
|
||||||
for _, dc := range developmentCycles {
|
|
||||||
developmentCycleList = append(developmentCycleList, &bundle.DevelopmentCycle{
|
|
||||||
DevelopmentCycleUUID: dc.DevelopmentCycleUUID,
|
|
||||||
ContractUUID: dc.ContractUUID,
|
|
||||||
DevelopmentPeriod: int32(dc.DevelopmentPeriod),
|
|
||||||
DevelopmentTime: dc.DevelopmentTime,
|
|
||||||
Attachments: jsonToAttachments(dc.AttachmentURLs),
|
|
||||||
DeliveryContent: dc.DeliveryContent,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
res.List = developmentCycleList
|
|
||||||
res.Msg = "查询成功"
|
|
||||||
|
|
||||||
return res, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetPaymentCyclesByContractUUID 根据合同UUID查询支付周期
|
|
||||||
func GetPaymentCyclesByContractUUID(req *bundle.GetPaymentCyclesByContractUUIDRequest) (res *bundle.GetPaymentCyclesByContractUUIDResponse, err error) {
|
|
||||||
res = new(bundle.GetPaymentCyclesByContractUUIDResponse)
|
|
||||||
|
|
||||||
// 参数校验
|
|
||||||
if req.ContractUUID == "" {
|
|
||||||
res.Msg = "合同UUID不能为空"
|
|
||||||
return res, errors.New("合同UUID不能为空")
|
|
||||||
}
|
|
||||||
|
|
||||||
// 调用dao层查询
|
|
||||||
paymentCycles, err := dao.GetPaymentCyclesByContractUUID(req.ContractUUID)
|
|
||||||
if err != nil {
|
|
||||||
res.Msg = "查询支付周期失败"
|
|
||||||
return res, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// 转换model到proto响应
|
|
||||||
paymentCycleList := make([]*bundle.ContractPaymentCycle, 0, len(paymentCycles))
|
|
||||||
for _, pc := range paymentCycles {
|
|
||||||
paymentCycleList = append(paymentCycleList, &bundle.ContractPaymentCycle{
|
|
||||||
ContractPaymentCycleUUID: pc.ContractPaymentCycleUUID,
|
|
||||||
ContractUUID: pc.ContractUUID,
|
|
||||||
PaymentCyclePeriod: int32(pc.PaymentCyclePeriod),
|
|
||||||
DeliveryTime: pc.DeliveryTime,
|
|
||||||
ContractPaymentCycleAmount: pc.ContractPaymentCycleAmount,
|
|
||||||
PaymentCycleCurrencyType: int32(pc.PaymentCycleCurrencyType),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
res.List = paymentCycleList
|
|
||||||
res.Msg = "查询成功"
|
|
||||||
|
|
||||||
return res, nil
|
|
||||||
}
|
|
||||||
@ -1,273 +0,0 @@
|
|||||||
package logic
|
|
||||||
|
|
||||||
import (
|
|
||||||
"errors"
|
|
||||||
"micro-bundle/internal/dao"
|
|
||||||
"micro-bundle/internal/model"
|
|
||||||
"micro-bundle/pb/bundle"
|
|
||||||
"time"
|
|
||||||
"unicode/utf8"
|
|
||||||
)
|
|
||||||
|
|
||||||
// validateCustomerFields 校验客户字段
|
|
||||||
func validateCustomerFields(customer *bundle.Customer) error {
|
|
||||||
// 1. 客户名称:必填;最多50个字
|
|
||||||
if customer.CustomerName == "" {
|
|
||||||
return errors.New("客户名称不能为空")
|
|
||||||
}
|
|
||||||
if utf8.RuneCountInString(customer.CustomerName) > 50 {
|
|
||||||
return errors.New("客户名称最多50个字")
|
|
||||||
}
|
|
||||||
|
|
||||||
// 2. 授权代表:必填;最多50个字
|
|
||||||
if customer.AuthorizedRepresentative == "" {
|
|
||||||
return errors.New("授权代表不能为空")
|
|
||||||
}
|
|
||||||
if utf8.RuneCountInString(customer.AuthorizedRepresentative) > 50 {
|
|
||||||
return errors.New("授权代表最多50个字")
|
|
||||||
}
|
|
||||||
|
|
||||||
// 3. 注册地址:必填;最多200字
|
|
||||||
if customer.RegistrationAddress == "" {
|
|
||||||
return errors.New("注册地址不能为空")
|
|
||||||
}
|
|
||||||
if utf8.RuneCountInString(customer.RegistrationAddress) > 200 {
|
|
||||||
return errors.New("注册地址最多200个字")
|
|
||||||
}
|
|
||||||
|
|
||||||
// 4. 推荐人:非必填;最多50个字
|
|
||||||
if customer.ReferralPerson != "" && utf8.RuneCountInString(customer.ReferralPerson) > 50 {
|
|
||||||
return errors.New("推荐人最多50个字")
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetCustomerList 多条件查询客户列表
|
|
||||||
func GetCustomerList(req *bundle.CustomerListRequest) (res *bundle.CustomerListResponse, err error) {
|
|
||||||
res = new(bundle.CustomerListResponse)
|
|
||||||
|
|
||||||
// 构建dao层查询请求
|
|
||||||
daoReq := &dao.CustomerQueryRequest{
|
|
||||||
CustomerName: req.CustomerName,
|
|
||||||
ReferralPerson: req.ReferralPerson,
|
|
||||||
Page: int(req.Page),
|
|
||||||
PageSize: int(req.PageSize),
|
|
||||||
}
|
|
||||||
|
|
||||||
// 调用dao层查询
|
|
||||||
customers, total, err := dao.GetCustomerList(daoReq)
|
|
||||||
if err != nil {
|
|
||||||
return res, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// 转换model到proto响应
|
|
||||||
customerInfoList := make([]*bundle.CustomerInfo, 0, len(customers))
|
|
||||||
for _, customer := range customers {
|
|
||||||
customerInfo := &bundle.CustomerInfo{
|
|
||||||
CustomerID: customer.CustomerID,
|
|
||||||
CustomerName: customer.CustomerName,
|
|
||||||
AuthorizedRepresentative: customer.AuthorizedRepresentative,
|
|
||||||
RegistrationAddress: customer.RegistrationAddress,
|
|
||||||
ReferralPerson: customer.ReferralPerson,
|
|
||||||
Operator: customer.Operator,
|
|
||||||
}
|
|
||||||
// 格式化操作时间
|
|
||||||
if !customer.OperatorTime.IsZero() {
|
|
||||||
customerInfo.OperatorTime = customer.OperatorTime.Format("2006-01-02 15:04")
|
|
||||||
}
|
|
||||||
customerInfoList = append(customerInfoList, customerInfo)
|
|
||||||
}
|
|
||||||
|
|
||||||
res.List = customerInfoList
|
|
||||||
res.Total = total
|
|
||||||
res.Page = req.Page
|
|
||||||
res.PageSize = req.PageSize
|
|
||||||
|
|
||||||
return res, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetCustomerDetail 根据客户ID查询客户详情
|
|
||||||
func GetCustomerDetail(req *bundle.CustomerDetailRequest) (res *bundle.CustomerDetailResponse, err error) {
|
|
||||||
res = new(bundle.CustomerDetailResponse)
|
|
||||||
|
|
||||||
// 参数校验
|
|
||||||
if req.CustomerID == "" {
|
|
||||||
res.Msg = "客户ID不能为空"
|
|
||||||
return res, errors.New("客户ID不能为空")
|
|
||||||
}
|
|
||||||
|
|
||||||
// 调用dao层查询
|
|
||||||
customer, err := dao.GetCustomerByID(req.CustomerID)
|
|
||||||
if err != nil {
|
|
||||||
res.Msg = "查询客户信息失败"
|
|
||||||
return res, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// 如果客户不存在
|
|
||||||
if customer == nil {
|
|
||||||
res.Msg = "客户不存在"
|
|
||||||
return res, errors.New("客户不存在")
|
|
||||||
}
|
|
||||||
|
|
||||||
// 转换model到proto响应
|
|
||||||
customerProto := &bundle.Customer{
|
|
||||||
CustomerID: customer.CustomerID,
|
|
||||||
CustomerName: customer.CustomerName,
|
|
||||||
AuthorizedRepresentative: customer.AuthorizedRepresentative,
|
|
||||||
RegistrationAddress: customer.RegistrationAddress,
|
|
||||||
ReferralPerson: customer.ReferralPerson,
|
|
||||||
Operator: customer.Operator,
|
|
||||||
OperatorID: customer.OperatorID,
|
|
||||||
OperatorNum: customer.OperatorNum,
|
|
||||||
}
|
|
||||||
|
|
||||||
// 格式化时间字段
|
|
||||||
if !customer.OperatorTime.IsZero() {
|
|
||||||
customerProto.OperatorTime = customer.OperatorTime.Format("2006-01-02 15:04")
|
|
||||||
}
|
|
||||||
if !customer.CreatedAt.IsZero() {
|
|
||||||
customerProto.CreatedAt = customer.CreatedAt.Format("2006-01-02 15:04:05")
|
|
||||||
}
|
|
||||||
if !customer.UpdatedAt.IsZero() {
|
|
||||||
customerProto.UpdatedAt = customer.UpdatedAt.Format("2006-01-02 15:04:05")
|
|
||||||
}
|
|
||||||
|
|
||||||
res.Customer = customerProto
|
|
||||||
res.Msg = "查询成功"
|
|
||||||
|
|
||||||
return res, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// UpdateCustomer 更新客户接口(根据action判断新增/更新/删除)
|
|
||||||
func UpdateCustomer(req *bundle.CustomerUpdateRequest) (res *bundle.CommonResponse, err error) {
|
|
||||||
res = new(bundle.CommonResponse)
|
|
||||||
|
|
||||||
// 参数校验
|
|
||||||
if req.Customer == nil {
|
|
||||||
res.Msg = "客户信息不能为空"
|
|
||||||
return res, errors.New("客户信息不能为空")
|
|
||||||
}
|
|
||||||
|
|
||||||
// 根据action执行不同操作
|
|
||||||
switch req.Action {
|
|
||||||
case "create": // 新增
|
|
||||||
// 字段校验
|
|
||||||
if err := validateCustomerFields(req.Customer); err != nil {
|
|
||||||
res.Msg = err.Error()
|
|
||||||
return res, err
|
|
||||||
}
|
|
||||||
// 检查客户名称是否已存在
|
|
||||||
exists, err := dao.CheckCustomerNameExists(req.Customer.CustomerName, "")
|
|
||||||
if err != nil {
|
|
||||||
res.Msg = "检查客户名称重复失败"
|
|
||||||
return res, err
|
|
||||||
}
|
|
||||||
if exists {
|
|
||||||
res.Msg = "客户名称重复"
|
|
||||||
return res, errors.New("客户名称重复")
|
|
||||||
}
|
|
||||||
|
|
||||||
// 构建model对象
|
|
||||||
customer := &model.Customer{
|
|
||||||
CustomerName: req.Customer.CustomerName,
|
|
||||||
AuthorizedRepresentative: req.Customer.AuthorizedRepresentative,
|
|
||||||
RegistrationAddress: req.Customer.RegistrationAddress,
|
|
||||||
ReferralPerson: req.Customer.ReferralPerson,
|
|
||||||
Operator: req.Customer.Operator,
|
|
||||||
OperatorID: req.Customer.OperatorID,
|
|
||||||
OperatorNum: req.Customer.OperatorNum,
|
|
||||||
}
|
|
||||||
customer.OperatorTime = time.Now()
|
|
||||||
|
|
||||||
// 调用dao层创建
|
|
||||||
err = dao.CreateCustomer(customer)
|
|
||||||
if err != nil {
|
|
||||||
res.Msg = "创建失败"
|
|
||||||
return res, err
|
|
||||||
}
|
|
||||||
res.Msg = "创建成功"
|
|
||||||
|
|
||||||
case "update": // 更新
|
|
||||||
// 参数校验
|
|
||||||
if req.Customer.CustomerID == "" {
|
|
||||||
res.Msg = "ID不能为空"
|
|
||||||
return res, errors.New("ID不能为空")
|
|
||||||
}
|
|
||||||
|
|
||||||
// 字段校验
|
|
||||||
if err := validateCustomerFields(req.Customer); err != nil {
|
|
||||||
res.Msg = err.Error()
|
|
||||||
return res, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// 检查客户名称是否重复
|
|
||||||
exists, err := dao.CheckCustomerNameExists(req.Customer.CustomerName, req.Customer.CustomerID)
|
|
||||||
if err != nil {
|
|
||||||
res.Msg = "检查客户名称重复失败"
|
|
||||||
return res, err
|
|
||||||
}
|
|
||||||
if exists {
|
|
||||||
res.Msg = "客户名称重复"
|
|
||||||
return res, errors.New("客户名称重复")
|
|
||||||
}
|
|
||||||
|
|
||||||
// 构建model对象
|
|
||||||
customer := &model.Customer{
|
|
||||||
CustomerName: req.Customer.CustomerName,
|
|
||||||
AuthorizedRepresentative: req.Customer.AuthorizedRepresentative,
|
|
||||||
RegistrationAddress: req.Customer.RegistrationAddress,
|
|
||||||
ReferralPerson: req.Customer.ReferralPerson,
|
|
||||||
Operator: req.Customer.Operator,
|
|
||||||
OperatorID: req.Customer.OperatorID,
|
|
||||||
OperatorNum: req.Customer.OperatorNum,
|
|
||||||
}
|
|
||||||
customer.OperatorTime = time.Now()
|
|
||||||
customer.UpdatedAt = time.Now()
|
|
||||||
// 调用dao层更新
|
|
||||||
err = dao.UpdateCustomer(req.Customer.CustomerID, customer)
|
|
||||||
if err != nil {
|
|
||||||
res.Msg = "更新失败"
|
|
||||||
return res, err
|
|
||||||
}
|
|
||||||
res.Msg = "更新成功"
|
|
||||||
|
|
||||||
case "delete": // 删除
|
|
||||||
// 参数校验
|
|
||||||
if req.Customer.CustomerID == "" {
|
|
||||||
res.Msg = "客户ID不能为空"
|
|
||||||
return res, errors.New("客户ID不能为空")
|
|
||||||
}
|
|
||||||
|
|
||||||
// 调用dao层删除
|
|
||||||
err = dao.DeleteCustomer(req.Customer.CustomerID)
|
|
||||||
if err != nil {
|
|
||||||
res.Msg = "删除失败"
|
|
||||||
return res, err
|
|
||||||
}
|
|
||||||
res.Msg = "删除成功"
|
|
||||||
|
|
||||||
default:
|
|
||||||
res.Msg = "未知操作"
|
|
||||||
return res, errors.New("未知操作")
|
|
||||||
}
|
|
||||||
|
|
||||||
return res, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetReferralPersonList 查询所有不重复的推荐人列表
|
|
||||||
func GetReferralPersonList(req *bundle.ReferralPersonListRequest) (res *bundle.ReferralPersonListResponse, err error) {
|
|
||||||
res = new(bundle.ReferralPersonListResponse)
|
|
||||||
|
|
||||||
// 调用dao层查询不重复的推荐人
|
|
||||||
referralPersons, err := dao.GetDistinctReferralPersons(req.Keyword)
|
|
||||||
if err != nil {
|
|
||||||
res.Msg = "查询失败"
|
|
||||||
return res, err
|
|
||||||
}
|
|
||||||
|
|
||||||
res.List = referralPersons
|
|
||||||
res.Msg = "查询成功"
|
|
||||||
|
|
||||||
return res, nil
|
|
||||||
}
|
|
||||||
@ -1,129 +0,0 @@
|
|||||||
package logic
|
|
||||||
|
|
||||||
import (
|
|
||||||
"micro-bundle/internal/dao"
|
|
||||||
"micro-bundle/internal/model"
|
|
||||||
"micro-bundle/pb/bundle"
|
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"github.com/samber/lo"
|
|
||||||
)
|
|
||||||
|
|
||||||
func CreateInvoice(req *bundle.CreateInvoiceReq) (*bundle.CreateInvoiceResp, error) {
|
|
||||||
res, err := dao.CreateInvoice(req)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return res, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func CreatePaperInvoiceAddress(req *bundle.CreatePaperInvoiceAddressReq) (*bundle.CreatePaperInvoiceAddressResp, error) {
|
|
||||||
res, err := dao.CreatePaperInvoiceAddress(req)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return res, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func GetInvoiceList(req *bundle.GetInvoiceListReq) (*bundle.GetInvoiceListResp, error) {
|
|
||||||
res := new(bundle.GetInvoiceListResp)
|
|
||||||
data, total, err := dao.GetInvoiceList(req)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
res.Total = total
|
|
||||||
res.Size = req.Size
|
|
||||||
res.Page = req.Page
|
|
||||||
res.Data = lo.Map(data, func(m *model.InvoiceInfo, _ int) *bundle.InvoiceInfo {
|
|
||||||
return &bundle.InvoiceInfo{
|
|
||||||
Name: m.Name,
|
|
||||||
Phone: m.TelAreaCode + m.Phone,
|
|
||||||
Country: m.Country,
|
|
||||||
Address: m.Address,
|
|
||||||
ApplyTime: m.ApplyTime,
|
|
||||||
UserName: m.UserName,
|
|
||||||
UserNum: m.UserNum,
|
|
||||||
OrderNo: m.OrderNo,
|
|
||||||
InvoiceNo: m.InvoiceNo,
|
|
||||||
InvoiceUrl: m.InvoiceUrl,
|
|
||||||
PaperInvocieStatus: m.PaperInvocieStatus,
|
|
||||||
}
|
|
||||||
})
|
|
||||||
return res, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func UpdateInvoiceExpressInfo(req *bundle.UpdateInvoiceExpressInfoReq) (*bundle.UpdateInvoiceExpressInfoResp, error) {
|
|
||||||
res, err := dao.UpdateInvoiceExpressInfo(req)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return res, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func GetInvoiceExpressInfo(req *bundle.GetInvoiceExpressInfoReq) (*bundle.GetInvoiceExpressInfoResp, error) {
|
|
||||||
res, err := dao.GetInvoiceExpressInfo(req)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return res, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func GetOrderInfoByOrderNo(req *bundle.GetOrderInfoByOrderNoReq) (*bundle.GetOrderInfoByOrderNoResp, error) {
|
|
||||||
res := new(bundle.GetOrderInfoByOrderNoResp)
|
|
||||||
orderRecord, err := dao.GetOrderInfoByOrderNo(req)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
res = &bundle.GetOrderInfoByOrderNoResp{
|
|
||||||
UserName: orderRecord.UserName,
|
|
||||||
UserId: strconv.FormatInt(orderRecord.UserId, 10),
|
|
||||||
UserNum: orderRecord.UserNum,
|
|
||||||
OrderNo: orderRecord.OrderNo,
|
|
||||||
TotalAmount: strconv.FormatFloat(float64(orderRecord.TotalAmount), 'f', 2, 64),
|
|
||||||
BundleName: orderRecord.BundleName,
|
|
||||||
AmountType: orderRecord.AmountType,
|
|
||||||
Address: orderRecord.Address,
|
|
||||||
Phone: orderRecord.Phone,
|
|
||||||
PayTime: orderRecord.PayTime,
|
|
||||||
}
|
|
||||||
return res, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func GetInvoiceInfoByOrderNo(req *bundle.GetInvoiceInfoByOrderNoReq) (*bundle.GetInvoiceInfoByOrderNoResp, error) {
|
|
||||||
res := new(bundle.GetInvoiceInfoByOrderNoResp)
|
|
||||||
data, err := dao.GetInvoiceInfoByOrderNo(req)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
res.Data = lo.Map(data, func(m *model.InvoiceInfoByOrderNo, _ int) *bundle.InvoiceInfoByOrderNo {
|
|
||||||
return &bundle.InvoiceInfoByOrderNo{
|
|
||||||
OrderNo: m.OrderNo,
|
|
||||||
InvoiceNo: m.InvoiceNo,
|
|
||||||
InvoiceUrl: m.InvoiceUrl,
|
|
||||||
BundleName: m.BundleName,
|
|
||||||
AmountType: m.AmountType,
|
|
||||||
TotalAmount: strconv.FormatFloat(float64(m.TotalAmount), 'f', -1, 64),
|
|
||||||
PayTime: m.PayTime,
|
|
||||||
PaperInvocieStatus: m.PaperInvocieStatus,
|
|
||||||
}
|
|
||||||
})
|
|
||||||
return res, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func GetLastInvoiceNo(req *bundle.GetLastInvoiceNoReq) (*bundle.GetLastInvoiceNoResp, error) {
|
|
||||||
res := new(bundle.GetLastInvoiceNoResp)
|
|
||||||
lastNo, err := dao.GetLastInvoiceNo()
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
res.LastNo = lastNo.InvoiceNo
|
|
||||||
return res, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func UpdataInvoiceInfo(req *bundle.UpdataInvoiceInfoReq) (*bundle.UpdataInvoiceInfoResp, error) {
|
|
||||||
res, err := dao.UpdataInvoiceInfo(req)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return res, nil
|
|
||||||
}
|
|
||||||
@ -2,8 +2,6 @@ package logic
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
|
||||||
uuid "github.com/satori/go.uuid"
|
|
||||||
"micro-bundle/internal/dao"
|
"micro-bundle/internal/dao"
|
||||||
"micro-bundle/internal/model"
|
"micro-bundle/internal/model"
|
||||||
"micro-bundle/pb/bundle"
|
"micro-bundle/pb/bundle"
|
||||||
@ -16,13 +14,7 @@ import (
|
|||||||
|
|
||||||
func CreateOrderRecord(req *bundle.OrderCreateRecord) (res *bundle.CommonResponse, err error) {
|
func CreateOrderRecord(req *bundle.OrderCreateRecord) (res *bundle.CommonResponse, err error) {
|
||||||
res = new(bundle.CommonResponse)
|
res = new(bundle.CommonResponse)
|
||||||
//orderUUID := app.ModuleClients.SfNode.Generate().Base64()
|
orderUUID := app.ModuleClients.SfNode.Generate().Base64()
|
||||||
uuidV4, err := uuid.NewV4()
|
|
||||||
if err != nil {
|
|
||||||
fmt.Println("生成错误", err)
|
|
||||||
return nil, errors.New("生成uuid失败")
|
|
||||||
}
|
|
||||||
orderUUID := uuidV4.String()
|
|
||||||
orderNo := utils.GetOrderNo()
|
orderNo := utils.GetOrderNo()
|
||||||
if req.OrderNo != "" {
|
if req.OrderNo != "" {
|
||||||
orderNo = req.OrderNo
|
orderNo = req.OrderNo
|
||||||
@ -103,8 +95,6 @@ func UpdateOrderRecordByOrderNo(req *bundle.OrderRecord) (res *bundle.CommonResp
|
|||||||
_ = copier.CopyWithOption(&orderRecord, req, copier.Option{DeepCopy: true})
|
_ = copier.CopyWithOption(&orderRecord, req, copier.Option{DeepCopy: true})
|
||||||
orderRecord.UUID = req.Uuid
|
orderRecord.UUID = req.Uuid
|
||||||
orderRecord.BundleUUID = req.BundleUuid
|
orderRecord.BundleUUID = req.BundleUuid
|
||||||
orderRecord.Status = req.Status
|
|
||||||
fmt.Println("UpdateOrderRecordByOrderNo Status:", req.Status)
|
|
||||||
res, err = dao.UpdateOrderRecordByOrderNO(orderRecord)
|
res, err = dao.UpdateOrderRecordByOrderNO(orderRecord)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -215,20 +205,3 @@ func ReSignTheContract(req *bundle.ReSignTheContractRequest) (res *bundle.Common
|
|||||||
res, err = dao.ReSignTheContract(req)
|
res, err = dao.ReSignTheContract(req)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func UpdateOrderRecordByOrderUuid(req *bundle.OrderRecord) (res *bundle.CommonResponse, err error) {
|
|
||||||
res = new(bundle.CommonResponse)
|
|
||||||
orderRecord := new(model.BundleOrderRecords)
|
|
||||||
_ = copier.CopyWithOption(&orderRecord, req, copier.Option{DeepCopy: true})
|
|
||||||
orderRecord.UUID = req.Uuid
|
|
||||||
orderRecord.BundleUUID = req.BundleUuid
|
|
||||||
orderRecord.Status = req.Status
|
|
||||||
fmt.Println("UpdateOrderRecordByOrderUuid Status:", req.Status)
|
|
||||||
res, err = dao.UpdateOrderRecordByOrderUuid(orderRecord)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
func OrderListByOrderUuid(req *bundle.OrderInfoByOrderUuidRequest) (res *bundle.OrderInfoByOrderNoResp, err error) {
|
|
||||||
res = new(bundle.OrderInfoByOrderNoResp)
|
|
||||||
res, err = dao.OrderListByOrderUuid(req)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|||||||
@ -1,77 +0,0 @@
|
|||||||
package logic
|
|
||||||
|
|
||||||
import (
|
|
||||||
"encoding/json"
|
|
||||||
"errors"
|
|
||||||
"fmt"
|
|
||||||
"micro-bundle/internal/dao"
|
|
||||||
"micro-bundle/internal/model"
|
|
||||||
"micro-bundle/pb/bundle"
|
|
||||||
|
|
||||||
"github.com/samber/lo"
|
|
||||||
)
|
|
||||||
|
|
||||||
func SendQuestionnaireSurvey(req *bundle.SendQuestionnaireSurveyRequest) (*bundle.SendQuestionnaireSurveyResponse, error) {
|
|
||||||
resp, err := dao.SendQuestionnaireSurvey(req)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return resp, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func GetQuestionnaireSurveyInfo(req *bundle.GetQuestionnaireSurveyInfoRequest) (*bundle.GetQuestionnaireSurveyInfoResponse, error) {
|
|
||||||
resp := new(bundle.GetQuestionnaireSurveyInfoResponse)
|
|
||||||
data, err := dao.GetQuestionnaireSurveyInfo(req)
|
|
||||||
if err != nil {
|
|
||||||
return nil, errors.New("获取问卷信息失败")
|
|
||||||
}
|
|
||||||
bundleInfo := &model.BundleInfo{}
|
|
||||||
err = json.Unmarshal([]byte(data.BundleInfo), bundleInfo)
|
|
||||||
if err != nil {
|
|
||||||
return nil, errors.New("反序列化失败")
|
|
||||||
}
|
|
||||||
fmt.Println("获取套餐名称:", bundleInfo.BundleName)
|
|
||||||
resp.UserName = data.UserName
|
|
||||||
resp.BundleInfo = &bundle.SurveyBundleInfo{}
|
|
||||||
resp.BundleInfo.BundleName = bundleInfo.BundleName
|
|
||||||
resp.BundleInfo.StartAt = bundleInfo.StartAt.Format("2006-01-02 15:04:05")
|
|
||||||
resp.BundleInfo.ExpiredAt = bundleInfo.ExpiredAt.Format("2006-01-02 15:04:05")
|
|
||||||
resp.BundleInfo.BundleAccountNumber = int32(bundleInfo.BundleAccountNumber)
|
|
||||||
resp.BundleInfo.BundleVideoNumber = int32(bundleInfo.BundleVideoNumber)
|
|
||||||
resp.BundleInfo.IncreaseVideoNumber = int32(bundleInfo.IncreaseVideoNumber)
|
|
||||||
resp.BundleInfo.BundleImageNumber = int32(bundleInfo.BundleImageNumber)
|
|
||||||
resp.BundleInfo.BundleDataNumber = int32(bundleInfo.BundleDataNumber)
|
|
||||||
resp.BundleInfo.BundleCompetitiveNumber = int32(bundleInfo.BundleCompetitiveNumber)
|
|
||||||
return resp, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func CreateQuestionnaireSurveyAnswer(req *bundle.CreateQuestionnaireSurveyAnswerRequest) (*bundle.CreateQuestionnaireSurveyAnswerResponse, error) {
|
|
||||||
resp := new(bundle.CreateQuestionnaireSurveyAnswerResponse)
|
|
||||||
err := dao.CreateQuestionnaireSurveyAnswer(req)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return resp, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func GetQuestionnaireSurveyList(req *bundle.GetQuestionnaireSurveyListRequest) (resp *bundle.GetQuestionnaireSurveyListResponse, err error) {
|
|
||||||
resp = &bundle.GetQuestionnaireSurveyListResponse{}
|
|
||||||
data, total, err := dao.GetQuestionnaireSurveyList(req)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
resp.Total = int32(total)
|
|
||||||
resp.Page = req.Page
|
|
||||||
resp.Size = req.PageSize
|
|
||||||
resp.SurveyList = lo.Map(data, func(m *model.QuestionnaireSurvey, _ int) *bundle.SurveyListInfo {
|
|
||||||
return &bundle.SurveyListInfo{
|
|
||||||
UserName: m.UserName,
|
|
||||||
UserTel: m.UserTel,
|
|
||||||
UserNum: m.UserNum,
|
|
||||||
SurveyTitle: m.SurveyTitle,
|
|
||||||
SurveyStatus: int32(m.SurveyStatus),
|
|
||||||
SurveyUrl: m.SurveyUrl,
|
|
||||||
}
|
|
||||||
})
|
|
||||||
return resp, nil
|
|
||||||
}
|
|
||||||
@ -4,7 +4,6 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"micro-bundle/internal/dao"
|
"micro-bundle/internal/dao"
|
||||||
"micro-bundle/internal/dto"
|
"micro-bundle/internal/dto"
|
||||||
"micro-bundle/internal/model"
|
|
||||||
"micro-bundle/pb/bundle"
|
"micro-bundle/pb/bundle"
|
||||||
commonErr "micro-bundle/pkg/err"
|
commonErr "micro-bundle/pkg/err"
|
||||||
"strings"
|
"strings"
|
||||||
@ -81,10 +80,10 @@ func AssignTask(req *dto.TaskAssignRequest) error {
|
|||||||
if !isValid {
|
if !isValid {
|
||||||
return commonErr.ReturnError(nil, "员工不能被指派任务", "该员工不在可指派任务的员工列表中")
|
return commonErr.ReturnError(nil, "员工不能被指派任务", "该员工不在可指派任务的员工列表中")
|
||||||
}
|
}
|
||||||
if req.AssignVideoCount < 0 || req.AssignPostCount < 0 || req.AssignDataCount < 0 || req.AssignVideoScriptCount < 0 || req.AssignReportCount < 0 {
|
if req.AssignVideoCount < 0 || req.AssignPostCount < 0 || req.AssignDataCount < 0 || req.AssignVideoScriptCount < 0 {
|
||||||
return commonErr.ReturnError(nil, "指派数量不能小于0", "任一指派数量不得小于0")
|
return commonErr.ReturnError(nil, "指派数量不能小于0", "任一指派数量不得小于0")
|
||||||
}
|
}
|
||||||
if req.AssignVideoCount == 0 && req.AssignPostCount == 0 && req.AssignDataCount == 0 && req.AssignVideoScriptCount == 0 && req.AssignReportCount == 0 {
|
if req.AssignVideoCount == 0 && req.AssignPostCount == 0 && req.AssignDataCount == 0 && req.AssignVideoScriptCount == 0 {
|
||||||
return commonErr.ReturnError(nil, "指派数量不能全部为0", "至少有一个指派数量需大于0")
|
return commonErr.ReturnError(nil, "指派数量不能全部为0", "至少有一个指派数量需大于0")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,13 +117,13 @@ func BatchAssignTask(items []*dto.BatchAssignItem) error {
|
|||||||
if !isValid {
|
if !isValid {
|
||||||
return commonErr.ReturnError(nil, "员工不能被指派任务", "该员工不在可指派任务的员工列表中")
|
return commonErr.ReturnError(nil, "员工不能被指派任务", "该员工不在可指派任务的员工列表中")
|
||||||
}
|
}
|
||||||
if it.AssignVideoCount < 0 || it.AssignPostCount < 0 || it.AssignDataCount < 0 || it.AssignVideoScriptCount < 0 || it.AssignReportCount < 0 {
|
if it.AssignVideoCount < 0 || it.AssignPostCount < 0 || it.AssignDataCount < 0 || it.AssignVideoScriptCount < 0 {
|
||||||
return commonErr.ReturnError(nil, "指派数量不能小于0", "任一指派数量不得小于0")
|
return commonErr.ReturnError(nil, "指派数量不能小于0", "任一指派数量不得小于0")
|
||||||
}
|
}
|
||||||
if it.AssignVideoCount == 0 && it.AssignPostCount == 0 && it.AssignDataCount == 0 && it.AssignVideoScriptCount == 0 && it.AssignReportCount == 0 {
|
if it.AssignVideoCount == 0 && it.AssignPostCount == 0 && it.AssignDataCount == 0 && it.AssignVideoScriptCount == 0 {
|
||||||
return commonErr.ReturnError(nil, "指派数量不能全部为0", "至少有一个指派数量需大于0")
|
return commonErr.ReturnError(nil, "指派数量不能全部为0", "至少有一个指派数量需大于0")
|
||||||
}
|
}
|
||||||
if it.AssignVideoCount > 0 || it.AssignPostCount > 0 || it.AssignDataCount > 0 || it.AssignVideoScriptCount > 0 || it.AssignReportCount > 0 {
|
if it.AssignVideoCount > 0 || it.AssignPostCount > 0 || it.AssignDataCount > 0 || it.AssignVideoScriptCount > 0 {
|
||||||
hasPositive = true
|
hasPositive = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -166,31 +165,25 @@ func GetEmployeeAssignedTasks(req *dto.EmployeeTaskQueryRequest) ([]*dto.TaskAss
|
|||||||
var recordResponse []*dto.TaskAssignRecordsResponse
|
var recordResponse []*dto.TaskAssignRecordsResponse
|
||||||
for _, record := range record {
|
for _, record := range record {
|
||||||
recordResponse = append(recordResponse, &dto.TaskAssignRecordsResponse{
|
recordResponse = append(recordResponse, &dto.TaskAssignRecordsResponse{
|
||||||
AssignRecordsUUID: record.AssignRecordsUUID,
|
AssignRecordsUUID: record.AssignRecordsUUID,
|
||||||
SubNum: record.SubNum,
|
SubNum: record.SubNum,
|
||||||
TelNum: record.TelNum,
|
TelNum: record.TelNum,
|
||||||
ArtistName: record.ArtistName,
|
ArtistName: record.ArtistName,
|
||||||
Status: record.Status,
|
Status: record.Status,
|
||||||
ActualStatus: record.ActualStatus,
|
ActualStatus: record.ActualStatus,
|
||||||
CompleteTime: record.CompleteTime,
|
CompleteTime: record.CompleteTime,
|
||||||
OperatorType: record.OperatorType,
|
OperatorType: record.OperatorType,
|
||||||
Operator: record.Operator,
|
Operator: record.Operator,
|
||||||
OperatorNum: record.OperatorNum,
|
OperatorNum: record.OperatorNum,
|
||||||
OperatorTime: record.OperatorTime,
|
OperatorTime: record.OperatorTime,
|
||||||
TaskAssignee: record.TaskAssignee,
|
TaskAssignee: record.TaskAssignee,
|
||||||
TaskAssigneeNum: record.TaskAssigneeNum,
|
TaskAssigneeNum: record.TaskAssigneeNum,
|
||||||
PendingVideoCount: record.AssignVideoCount,
|
PendingVideoCount: record.AssignVideoCount,
|
||||||
PendingPostCount: record.AssignPostCount,
|
PendingPostCount: record.AssignPostCount,
|
||||||
PendingDataCount: record.AssignDataCount,
|
PendingDataCount: record.AssignDataCount,
|
||||||
PendingVideoScriptCount: record.AssignVideoScriptCount,
|
PendingVideoScriptCount: record.AssignVideoScriptCount,
|
||||||
PendingReportCount: record.AssignReportCount,
|
TaskBatch: record.TaskBatch,
|
||||||
CompleteVideoScriptCount: record.CompleteVideoScriptCount,
|
UpdatedAt: record.UpdatedAt,
|
||||||
CompleteVideoCount: record.CompleteVideoCount,
|
|
||||||
CompletePostCount: record.CompletePostCount,
|
|
||||||
CompleteDataCount: record.CompleteDataCount,
|
|
||||||
CompleteReportCount: record.CompleteReportCount,
|
|
||||||
TaskBatch: record.TaskBatch,
|
|
||||||
UpdatedAt: record.UpdatedAt,
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -218,7 +211,6 @@ func GetEmployeeAssignedTasks(req *dto.EmployeeTaskQueryRequest) ([]*dto.TaskAss
|
|||||||
PendingPostCount: record.PendingPostCount,
|
PendingPostCount: record.PendingPostCount,
|
||||||
PendingDataCount: record.PendingDataCount,
|
PendingDataCount: record.PendingDataCount,
|
||||||
PendingVideoScriptCount: record.PendingVideoScriptCount,
|
PendingVideoScriptCount: record.PendingVideoScriptCount,
|
||||||
PendingReportCount: record.PendingReportCount,
|
|
||||||
TaskBatch: record.TaskBatch,
|
TaskBatch: record.TaskBatch,
|
||||||
UpdatedAt: record.UpdatedAt,
|
UpdatedAt: record.UpdatedAt,
|
||||||
})
|
})
|
||||||
@ -339,12 +331,10 @@ func GetTaskAssignRecordsList(req *dto.TaskAssignRecordsQueryRequest) ([]*dto.Ta
|
|||||||
PendingPostCount: record.AssignPostCount,
|
PendingPostCount: record.AssignPostCount,
|
||||||
PendingDataCount: record.AssignDataCount,
|
PendingDataCount: record.AssignDataCount,
|
||||||
PendingVideoScriptCount: record.AssignVideoScriptCount,
|
PendingVideoScriptCount: record.AssignVideoScriptCount,
|
||||||
PendingReportCount: record.AssignReportCount,
|
|
||||||
CompleteVideoScriptCount: record.CompleteVideoScriptCount,
|
CompleteVideoScriptCount: record.CompleteVideoScriptCount,
|
||||||
CompleteVideoCount: record.CompleteVideoCount,
|
CompleteVideoCount: record.CompleteVideoCount,
|
||||||
CompletePostCount: record.CompletePostCount,
|
CompletePostCount: record.CompletePostCount,
|
||||||
CompleteDataCount: record.CompleteDataCount,
|
CompleteDataCount: record.CompleteDataCount,
|
||||||
CompleteReportCount: record.CompleteReportCount,
|
|
||||||
UpdatedAt: record.UpdatedAt,
|
UpdatedAt: record.UpdatedAt,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -411,12 +401,6 @@ func buildDefaultPendingLayout() string {
|
|||||||
{"已释放数据额度", "releasedDataAnalysisTotal", 1},
|
{"已释放数据额度", "releasedDataAnalysisTotal", 1},
|
||||||
{"套餐数据总数", "bundleDataAnalysisTotal", 1},
|
{"套餐数据总数", "bundleDataAnalysisTotal", 1},
|
||||||
{"增值数据总数", "increaseDataAnalysisTotal", 1},
|
{"增值数据总数", "increaseDataAnalysisTotal", 1},
|
||||||
{"可指派竞品报告数", "allowReportCount", 1},
|
|
||||||
{"可上传竞品报告数", "pendingReportCount", 1},
|
|
||||||
{"已上传竞品报告数", "uploadedReportCount", 1},
|
|
||||||
{"已释放竞品报告额度", "releasedReportTotal", 1},
|
|
||||||
{"套餐竞品报告总数", "bundleReportTotal", 1},
|
|
||||||
{"增值竞品报告总数", "increaseReportTotal", 1},
|
|
||||||
{"进行中任务数", "progressTaskCount", 1},
|
{"进行中任务数", "progressTaskCount", 1},
|
||||||
{"已完成任务数", "completeTaskCount", 1},
|
{"已完成任务数", "completeTaskCount", 1},
|
||||||
}
|
}
|
||||||
@ -442,17 +426,13 @@ func AddHiddenTaskAssignee(taskAssignee string, taskAssigneeNum string) error {
|
|||||||
return dao.AddHiddenTaskAssignee(taskAssignee, taskAssigneeNum)
|
return dao.AddHiddenTaskAssignee(taskAssignee, taskAssigneeNum)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetTaskWorkLogList(req *dto.TaskWorkLogQueryRequest) ([]*model.TaskWorkLog, int64, error) {
|
|
||||||
return dao.GetTaskWorkLogList(req)
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreateTaskWorkLog 创建任务日志记录
|
// CreateTaskWorkLog 创建任务日志记录
|
||||||
func CreateTaskWorkLog(req *dto.CreateTaskWorkLogRequest) error {
|
func CreateTaskWorkLog(req *dto.CreateTaskWorkLogRequest) error {
|
||||||
if req.OperationType < 1 || req.OperationType > 4 {
|
if req.OperationType < 1 || req.OperationType > 4 {
|
||||||
return commonErr.ReturnError(nil, "参数错误", "操作类型必须在1-4之间")
|
return commonErr.ReturnError(nil, "参数错误", "操作类型必须在1-4之间")
|
||||||
}
|
}
|
||||||
if req.TaskType < 1 || req.TaskType > 6 {
|
if req.TaskType < 1 || req.TaskType > 3 {
|
||||||
return commonErr.ReturnError(nil, "参数错误", "任务类型必须在1-6之间")
|
return commonErr.ReturnError(nil, "参数错误", "任务类型必须在1-3之间")
|
||||||
}
|
}
|
||||||
if req.TaskCount < 0 {
|
if req.TaskCount < 0 {
|
||||||
return commonErr.ReturnError(nil, "参数错误", "任务数量不能为负数")
|
return commonErr.ReturnError(nil, "参数错误", "任务数量不能为负数")
|
||||||
|
|||||||
@ -239,68 +239,3 @@ type VideoScript struct {
|
|||||||
func (VideoScript) TableName() string {
|
func (VideoScript) TableName() string {
|
||||||
return "cast_video_script"
|
return "cast_video_script"
|
||||||
}
|
}
|
||||||
|
|
||||||
// 竞品报告表
|
|
||||||
type CastCompetitiveReport struct {
|
|
||||||
Uuid string `gorm:"column:uuid;type:varchar(50);NOT NULL;primary_key;" json:"id"`
|
|
||||||
SubNum string `gorm:"column:subNum;type:varchar(50);NOT NULL;default:'';comment:'艺人编号'" json:"subNum"`
|
|
||||||
ArtistName string `gorm:"column:artist_name;type:varchar(50);NOT NULL;default:'';comment:'艺人名字'" json:"artistName"`
|
|
||||||
ArtistID string `gorm:"column:artist_id;type:varchar(50);NOT NULL;default:'';comment:'艺人ID';" json:"artistID"`
|
|
||||||
ArtistPhone string `gorm:"column:artist_phone;type:varchar(50);NOT NULL;default:'';comment:'艺人手机号'" json:"artistPhone"`
|
|
||||||
|
|
||||||
ReportContent string `gorm:"column:report_content;type:text;NOT NULL;comment:报告内容" json:"reportContent"`
|
|
||||||
ImageUrl string `gorm:"column:image_url;type:varchar(255);NOT NULL;default:'';comment:图片url" json:"imageUrl"`
|
|
||||||
Title string `gorm:"column:title;type:varchar(50);NOT NULL;" json:"title"`
|
|
||||||
OperatorID string `gorm:"column:operator_id;type:varchar(50);NOT NULL;default:'';comment:操作人ID" json:"operatorID"`
|
|
||||||
OperatorName string `gorm:"column:operator_name;type:varchar(50);NOT NULL;default:'';comment:操作人名称" json:"operatorName"`
|
|
||||||
WorkReportStatus uint8 `gorm:"column:work_report_status;type:tinyint(1);NOT NULL;default:1;comment: 1 待提交 2 审批中 3 审批驳回 4 待艺人验收 5 验收失败 6 待阅读 7 已阅读" json:"workReportStatus"`
|
|
||||||
Reason string `gorm:"column:reason;type:varchar(255);NOT NULL;default:'';comment:原因" json:"reason"`
|
|
||||||
ComfirmType int `gorm:"column:comfirm_type;type:tinyint(1);NOT NULL;default:0;comment:'确认类型 1 艺人确认 2 系统确认'" json:"comfirmType"`
|
|
||||||
Cost uint8 `gorm:"column:cost;type:tinyint(1);NOT NULL;default:0;comment: 1 消耗 2 未消耗" json:"cost"`
|
|
||||||
SubmitTime string `gorm:"column:submit_time;type:varchar(50);NOT NULL;default:'';comment:'提交时间'" json:"submitTime"`
|
|
||||||
StatusUpdateTime string `gorm:"column:status_update_time;type:varchar(50);NOT NULL;default:'';comment:状态更新时间" json:"statusUpdateTime"`
|
|
||||||
ApprovalID string `gorm:"column:approval_id;type:varchar(50);NOT NULL;default:'';comment:审批ID" json:"approvalID"`
|
|
||||||
ConfirmRemark string `gorm:"column:confirm_remark;type:varchar(300);NOT NULL;default:'';comment:艺人确认备注" json:"confirmRemark"`
|
|
||||||
|
|
||||||
// pdf 的 url 链接
|
|
||||||
PdfUrl string `gorm:"column:pdf_url;type:varchar(255);NOT NULL;default:'';comment:'pdf 的 url 链接'" json:"pdfUrl"`
|
|
||||||
Source uint8 `gorm:"column:source;type:tinyint(1);NOT NULL;default:1;comment: 1 系统 2 导入" json:"source"`
|
|
||||||
|
|
||||||
Extra *CastCompetitiveReportExtra `gorm:"foreignKey:ReportUuid;references:Uuid" json:"extra,omitempty"`
|
|
||||||
WorkItems []CastCompetitiveReportWorkItem `gorm:"foreignKey:ReportUuid;references:Uuid" json:"workItems,omitempty"`
|
|
||||||
|
|
||||||
CreatedAt int `gorm:"column:created_at;type:int(11);autoCreateTime" json:"createdAt"`
|
|
||||||
UpdatedAt int `gorm:"column:updated_at;type:int(11);autoUpdateTime" json:"updatedAt"`
|
|
||||||
DeletedAt soft_delete.DeletedAt
|
|
||||||
}
|
|
||||||
|
|
||||||
func (CastCompetitiveReport) TableName() string {
|
|
||||||
return "cast_competitive_report"
|
|
||||||
}
|
|
||||||
|
|
||||||
type CastCompetitiveReportExtra struct {
|
|
||||||
ReportUuid string `gorm:"column:report_uuid;type:varchar(50);NOT NULL;index:idx_report_uuid;default:'';comment:竞品报告uuid;primary_key" json:"reportUuid"`
|
|
||||||
ArtistConfirmedTime int64 `gorm:"column:artist_confirmed_time;type:bigint(20);NOT NULL;default:0;comment:艺人确认时间" json:"artistConfirmedTime"`
|
|
||||||
CostType uint32 `gorm:"column:cost_type;type:tinyint(3);NOT NULL;default:1;comment:计费类型 1 套餐 2 增值" json:"costType"`
|
|
||||||
CreatedAt int `gorm:"column:created_at;type:int(11);autoCreateTime" json:"createdAt"`
|
|
||||||
UpdatedAt int `gorm:"column:updated_at;type:int(11);autoUpdateTime" json:"updatedAt"`
|
|
||||||
DeletedAt soft_delete.DeletedAt
|
|
||||||
}
|
|
||||||
|
|
||||||
func (CastCompetitiveReportExtra) TableName() string {
|
|
||||||
return "cast_competitive_report_extra"
|
|
||||||
}
|
|
||||||
|
|
||||||
// 竞品报告作品关联表 - 存储竞品报告关联的作品uuid(最多5个)
|
|
||||||
type CastCompetitiveReportWorkItem struct {
|
|
||||||
// 使用联合主键 (report_uuid, work_uuid) 防止同一报告重复关联同一作品
|
|
||||||
ReportUuid string `gorm:"column:report_uuid;type:varchar(50);NOT NULL;primaryKey;index:idx_report_uuid;default:'';comment:竞品报告uuid" json:"reportUuid"`
|
|
||||||
WorkUuid string `gorm:"column:work_uuid;type:varchar(50);NOT NULL;primaryKey;index:idx_work_uuid;default:'';comment:作品uuid" json:"workUuid"`
|
|
||||||
CreatedAt int `gorm:"column:created_at;type:int(11);autoCreateTime" json:"createdAt"`
|
|
||||||
UpdatedAt int `gorm:"column:updated_at;type:int(11);autoUpdateTime" json:"updatedAt"`
|
|
||||||
DeletedAt soft_delete.DeletedAt
|
|
||||||
}
|
|
||||||
|
|
||||||
func (CastCompetitiveReportWorkItem) TableName() string {
|
|
||||||
return "cast_competitive_report_work_item"
|
|
||||||
}
|
|
||||||
|
|||||||
@ -1,110 +0,0 @@
|
|||||||
package model
|
|
||||||
|
|
||||||
import (
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"gorm.io/plugin/soft_delete"
|
|
||||||
)
|
|
||||||
|
|
||||||
// 定义常量
|
|
||||||
const (
|
|
||||||
CurrencyTypeRMB = 1 // 人民币
|
|
||||||
CurrencyTypeUSD = 2 // 美元
|
|
||||||
CurrencyTypeJPY = 3 // 日元
|
|
||||||
)
|
|
||||||
|
|
||||||
// 维护周期
|
|
||||||
const (
|
|
||||||
MaintenanceCycleTypeYear = 1 // 年
|
|
||||||
MaintenanceCycleTypeHalfYear = 2 // 半年
|
|
||||||
MaintenanceCycleTypeQuarter = 3 // 季度
|
|
||||||
MaintenanceCycleTypeMonth = 4 // 月
|
|
||||||
)
|
|
||||||
|
|
||||||
// AttachmentItem 单个附件:DB 中附件字段存的是该结构体数组的 JSON
|
|
||||||
type AttachmentItem struct {
|
|
||||||
URL string `json:"url"`
|
|
||||||
FileName string `json:"fileName"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// 合同表
|
|
||||||
type Contract struct {
|
|
||||||
ContractUUID string `gorm:"column:contract_uuid;comment:合同UUID" json:"contractUUID"`
|
|
||||||
ContractName string `gorm:"column:contract_name;comment:合同名称" json:"contractName"`
|
|
||||||
ProjectName string `gorm:"column:project_name;comment:项目名称" json:"projectName"`
|
|
||||||
CustomerName string `gorm:"column:customer_name;comment:客户名称" json:"customerName"`
|
|
||||||
ContractorName string `gorm:"column:contractor_name;comment:承办商名称" json:"contractorName"`
|
|
||||||
SigningDate string `gorm:"column:signing_date;comment:签署日期" json:"signingDate"`
|
|
||||||
EffectiveDate string `gorm:"column:effective_date;comment:生效日期" json:"effectiveDate"`
|
|
||||||
|
|
||||||
// 合同总金额
|
|
||||||
ContractAmount float64 `json:"contractAmount" gorm:"column:contract_amount;type:decimal(18,4);comment:合同金额"`
|
|
||||||
ContractCurrencyType int `json:"contractCurrencyType" gorm:"column:contract_currency_type;type:int;comment:合同货币类型"`
|
|
||||||
|
|
||||||
ContractPaymentCycle string `gorm:"column:contract_payment_cycle;type:text;comment:支付周期" json:"contractPaymentCycle"` // 单独一个字段,用来存
|
|
||||||
DevelopmentCycle string `gorm:"column:development_cycle;type:text;comment:开发周期" json:"developmentCycle"` // 单独一个字段,用来存开发周期
|
|
||||||
|
|
||||||
// 维护费用
|
|
||||||
MaintenanceCycleType int `json:"maintenanceCycleType" gorm:"column:maintenance_cycle_type;type:int;comment:维护周期类型"`
|
|
||||||
MaintenanceFee float64 `json:"maintenanceFee" gorm:"column:maintenance_fee;type:decimal(18,4);comment:维护费用"`
|
|
||||||
MaintenanceCurrencyType int `json:"maintenanceCurrencyType" gorm:"column:maintenance_currency_type;type:int;comment:维护货币类型"`
|
|
||||||
|
|
||||||
// 质量保证金
|
|
||||||
QualityAssuranceFee float64 `json:"qualityAssuranceFee" gorm:"column:quality_assurance_fee;type:decimal(18,4);comment:质量保证金额"`
|
|
||||||
QualityAssuranceCurrencyType int `json:"qualityAssuranceCurrencyType" gorm:"column:quality_assurance_currency_type;type:int;comment:质量保证金货币类型"`
|
|
||||||
|
|
||||||
// 附件:JSON 数组,每项为 {"url":"","fileName":""}
|
|
||||||
ContractAttachmentURLs string `gorm:"column:contract_attachment_urls;type:json;comment:合同附件(含url+fileName)" json:"contractAttachmentURLs"`
|
|
||||||
OtherAttachmentURLs string `gorm:"column:other_attachment_urls;type:json;comment:其他附件(含url+fileName)" json:"otherAttachmentURLs"`
|
|
||||||
|
|
||||||
Operator string `gorm:"column:operator;comment:操作人;index:idx_operator" json:"operator"`
|
|
||||||
OperatorID string `gorm:"column:operator_id;type:varchar(50);NOT NULL;default:'';comment:操作人ID" json:"operatorID"`
|
|
||||||
OperatorNum string `gorm:"column:operator_num;comment:操作人账号;index:idx_operator_num" json:"operatorNum"`
|
|
||||||
OperatorTime time.Time `gorm:"column:operator_time;comment:操作时间;index:idx_operator_time;" json:"operatorTime"`
|
|
||||||
|
|
||||||
PaymentCycles []ContractPaymentCycle `gorm:"foreignKey:ContractUUID;references:ContractUUID" json:"paymentCycles"`
|
|
||||||
DevelopmentCycles []DevelopmentCycle `gorm:"foreignKey:ContractUUID;references:ContractUUID" json:"developmentCycles"`
|
|
||||||
|
|
||||||
CreatedAt time.Time `gorm:"column:created_at;comment:创建时间" json:"createdAt"`
|
|
||||||
UpdatedAt time.Time `gorm:"column:updated_at;comment:更新时间" json:"updatedAt"`
|
|
||||||
DeletedAt soft_delete.DeletedAt `gorm:"column:deleted_at;type:int(11);index:idx_deleted_at" json:"deletedAt"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Contract) TableName() string {
|
|
||||||
return "contract"
|
|
||||||
}
|
|
||||||
|
|
||||||
// 支付周期子表
|
|
||||||
type ContractPaymentCycle struct {
|
|
||||||
ContractPaymentCycleUUID string `gorm:"column:contract_payment_cycle_uuid;comment:合同支付周期UUID" json:"contractPaymentCycleUUID"`
|
|
||||||
ContractUUID string `gorm:"column:contract_uuid;comment:合同UUID" json:"contractUUID"`
|
|
||||||
PaymentCyclePeriod int `json:"paymentCyclePeriod" gorm:"column:payment_cycle_period;type:int;comment:支付周期第几期"`
|
|
||||||
DeliveryTime string `gorm:"column:delivery_time;type:text;comment:交付时间点" json:"deliveryTime"`
|
|
||||||
ContractPaymentCycleAmount float64 `json:"contractPaymentCycleAmount" gorm:"column:contract_payment_cycle_amount;type:decimal(18,4);comment:合同支付周期金额"`
|
|
||||||
PaymentCycleCurrencyType int `json:"paymentCycleCurrencyType" gorm:"column:payment_cycle_currency_type;type:int;comment:支付周期货币类型"`
|
|
||||||
CreatedAt time.Time `gorm:"column:created_at;comment:创建时间" json:"createdAt"`
|
|
||||||
UpdatedAt time.Time `gorm:"column:updated_at;comment:更新时间" json:"updatedAt"`
|
|
||||||
DeletedAt soft_delete.DeletedAt `gorm:"column:deleted_at;type:int(11);index:idx_deleted_at" json:"deletedAt"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *ContractPaymentCycle) TableName() string {
|
|
||||||
return "contract_payment_cycle"
|
|
||||||
}
|
|
||||||
|
|
||||||
// 开发周期子表
|
|
||||||
type DevelopmentCycle struct {
|
|
||||||
DevelopmentCycleUUID string `gorm:"column:development_cycle_uuid;comment:开发周期UUID" json:"developmentCycleUUID"`
|
|
||||||
ContractUUID string `gorm:"column:contract_uuid;comment:合同UUID" json:"contractUUID"`
|
|
||||||
DevelopmentPeriod int `json:"developmentPeriod" gorm:"column:development_period;type:int;comment:开发第几期"`
|
|
||||||
DevelopmentTime string `gorm:"column:development_time;type:text;comment:开发时间" json:"developmentTime"`
|
|
||||||
// 附件:JSON 数组,每项为 {"url":"","fileName":""}
|
|
||||||
AttachmentURLs string `gorm:"column:attachment_urls;type:json;comment:附件(含url+fileName)" json:"attachmentURLs"`
|
|
||||||
DeliveryContent string `gorm:"column:delivery_content;type:text;comment:交付内容" json:"deliveryContent"`
|
|
||||||
CreatedAt time.Time `gorm:"column:created_at;comment:创建时间" json:"createdAt"`
|
|
||||||
UpdatedAt time.Time `gorm:"column:updated_at;comment:更新时间" json:"updatedAt"`
|
|
||||||
DeletedAt soft_delete.DeletedAt `gorm:"column:deleted_at;type:int(11);index:idx_deleted_at" json:"deletedAt"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (d *DevelopmentCycle) TableName() string {
|
|
||||||
return "contract_development_cycle"
|
|
||||||
}
|
|
||||||
@ -1,27 +0,0 @@
|
|||||||
package model
|
|
||||||
|
|
||||||
import (
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"gorm.io/plugin/soft_delete"
|
|
||||||
)
|
|
||||||
|
|
||||||
// 客户表
|
|
||||||
type Customer struct {
|
|
||||||
CustomerID string `gorm:"column:customer_id;type:varchar(50);NOT NULL;primarykey;comment:客户ID" json:"customerID"`
|
|
||||||
CustomerName string `gorm:"column:customer_name;comment:客户名称;uniqueIndex:idx_customer_name_deleted,priority:1" json:"customerName"`
|
|
||||||
AuthorizedRepresentative string `gorm:"column:authorized_representative;comment:授权代表" json:"authorizedRepresentative"`
|
|
||||||
RegistrationAddress string `gorm:"column:registration_address;comment:注册地址" json:"registrationAddress"`
|
|
||||||
ReferralPerson string `gorm:"column:referral_person;comment:推荐人;index:idx_referral_person" json:"referralPerson"` // 增加索引
|
|
||||||
Operator string `gorm:"column:operator;comment:操作人;index:idx_operator" json:"operator"`
|
|
||||||
OperatorID string `gorm:"column:operator_id;type:varchar(50);NOT NULL;default:'';comment:操作人ID" json:"operatorID"`
|
|
||||||
OperatorNum string `gorm:"column:operator_num;comment:操作人账号;index:idx_operator_num" json:"operatorNum"`
|
|
||||||
OperatorTime time.Time `gorm:"column:operator_time;comment:操作时间;index:idx_operator_time;" json:"operatorTime"`
|
|
||||||
CreatedAt time.Time `gorm:"column:created_at;comment:创建时间" json:"createdAt"`
|
|
||||||
UpdatedAt time.Time `gorm:"column:updated_at;comment:更新时间" json:"updatedAt"`
|
|
||||||
DeletedAt soft_delete.DeletedAt `gorm:"column:deleted_at;type:int(11);index:idx_deleted_at;uniqueIndex:idx_customer_name_deleted,priority:2" json:"deletedAt"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Customer) TableName() string {
|
|
||||||
return "customer"
|
|
||||||
}
|
|
||||||
@ -1,93 +0,0 @@
|
|||||||
package model
|
|
||||||
|
|
||||||
import (
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"gorm.io/plugin/soft_delete"
|
|
||||||
)
|
|
||||||
|
|
||||||
// 发票主表
|
|
||||||
type Invoice struct {
|
|
||||||
ID int64 `gorm:"primarykey"`
|
|
||||||
CreatedAt time.Time `gorm:"column:created_at;comment:创建时间" json:"createdAt"`
|
|
||||||
UpdatedAt time.Time `gorm:"column:updated_at;comment:更新时间" json:"updatedAt"`
|
|
||||||
DeletedAt soft_delete.DeletedAt `gorm:"column:deleted_at;type:int(11)" json:"deletedAt"`
|
|
||||||
UserId int `gorm:"column:user_id;comment:用户ID"`
|
|
||||||
UserNum string `gorm:"column:user_num;comment:用户编号"`
|
|
||||||
UserName string `gorm:"column:user_name;comment:用户名称"`
|
|
||||||
OrderNo string `gorm:"column:order_no;comment:订单编号"`
|
|
||||||
ApplyTime time.Time `gorm:"column:apply_time;comment:申请时间"`
|
|
||||||
InvoiceType int `gorm:"column:invoice_type;comment:发票类型 1基础类型"`
|
|
||||||
InvoiceNo string `gorm:"column:invoice_no;comment:发票编号"`
|
|
||||||
InvoiceUrl string `gorm:"column:invoice_url;comment:发票URL"`
|
|
||||||
PaperInvocieStatus int `gorm:"column:paper_invocie_status;default:1;comment:纸质发票状态1未申请 2已申请 3已邮寄"`
|
|
||||||
Remark string `gorm:"column:remark;comment:备注"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (i *Invoice) TableName() string {
|
|
||||||
return "invoice"
|
|
||||||
}
|
|
||||||
|
|
||||||
// 纸质发票地址
|
|
||||||
type PaperInvoiceAddress struct {
|
|
||||||
ID int64 `gorm:"primarykey"`
|
|
||||||
CreatedAt time.Time `gorm:"column:created_at;comment:创建时间" json:"createdAt"`
|
|
||||||
UpdatedAt time.Time `gorm:"column:updated_at;comment:更新时间" json:"updatedAt"`
|
|
||||||
DeletedAt soft_delete.DeletedAt `gorm:"column:deleted_at;type:int(11)" json:"deletedAt"`
|
|
||||||
UserId int `gorm:"column:user_id;comment:用户ID"`
|
|
||||||
ApplyTime time.Time `gorm:"column:apply_time;comment:申请时间"`
|
|
||||||
OrderNo string `gorm:"column:order_no;comment:订单编号"`
|
|
||||||
InvoiceNo string `gorm:"column:invoice_no;comment:发票编号"`
|
|
||||||
Name string `gorm:"column:name;comment:申请纸质发票姓名"`
|
|
||||||
TelAreaCode string `gorm:"column:tel_area_code;comment:申请纸质发票电话区号"`
|
|
||||||
Phone string `gorm:"column:phone;comment:申请纸质发票电话"`
|
|
||||||
PostalCode string `gorm:"column:postal_code;type:varchar(20);comment:申请纸质发票邮政编码"`
|
|
||||||
Country string `gorm:"column:country;comment:申请纸质发票国家"`
|
|
||||||
Address string `gorm:"column:address;comment:详细地址"`
|
|
||||||
ExpressCompany string `gorm:"column:express_company;comment:快递公司"`
|
|
||||||
ExpressNo string `gorm:"column:express_no;comment:快递单号"`
|
|
||||||
Remark string `gorm:"column:remark;comment:备注"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *PaperInvoiceAddress) TableName() string {
|
|
||||||
return "paper_invoice_address"
|
|
||||||
}
|
|
||||||
|
|
||||||
type InvoiceInfo struct {
|
|
||||||
Name string `gorm:"column:name;comment:姓名"`
|
|
||||||
TelAreaCode string `gorm:"column:tel_area_code;comment:电话区号"`
|
|
||||||
Phone string `gorm:"column:phone;comment:电话"`
|
|
||||||
Country string `gorm:"column:country;comment:国家"`
|
|
||||||
Address string `gorm:"column:address;comment:地址"`
|
|
||||||
ApplyTime string `gorm:"column:apply_time;comment:申请时间"`
|
|
||||||
UserName string `gorm:"column:user_name;comment:用户名称"`
|
|
||||||
UserNum string `gorm:"column:user_num;comment:用户编号"`
|
|
||||||
OrderNo string `gorm:"column:order_no;comment:订单编号"`
|
|
||||||
InvoiceNo string `gorm:"column:invoice_no;comment:发票编号"`
|
|
||||||
InvoiceUrl string `gorm:"column:invoice_url;comment:发票URL"`
|
|
||||||
PaperInvocieStatus int64 `gorm:"column:paper_invocie_status;comment:纸质发票状态"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type InvoiceOrderInfo struct {
|
|
||||||
UserName string `gorm:"column:user_name;comment:用户名称"`
|
|
||||||
UserId int64 `gorm:"column:user_id;comment:用户ID"`
|
|
||||||
UserNum string `gorm:"column:user_num;comment:用户编号"`
|
|
||||||
OrderNo string `gorm:"column:order_no;comment:订单编号"`
|
|
||||||
AmountType int64 `gorm:"column:amount_type;comment:金额类型 1:人民币 2:美元"`
|
|
||||||
TotalAmount float32 `gorm:"column:total_amount;comment:总金额"`
|
|
||||||
BundleName string `gorm:"column:bundle_name;comment:套餐名称"`
|
|
||||||
Address string `gorm:"column:address;comment:地址"`
|
|
||||||
Phone string `gorm:"column:phone;comment:电话"`
|
|
||||||
PayTime string `gorm:"column:pay_time;comment:支付时间"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type InvoiceInfoByOrderNo struct {
|
|
||||||
OrderNo string `gorm:"column:order_no;comment:订单编号"`
|
|
||||||
InvoiceNo string `gorm:"column:invoice_no;comment:发票编号"`
|
|
||||||
InvoiceUrl string `gorm:"column:invoice_url;comment:发票URL"`
|
|
||||||
BundleName string `gorm:"column:bundle_name;comment:套餐名称"`
|
|
||||||
AmountType int64 `gorm:"column:amount_type;comment:金额类型 1:人民币 2:美元"`
|
|
||||||
TotalAmount float32 `gorm:"column:total_amount;comment:总金额"`
|
|
||||||
PayTime string `gorm:"column:pay_time;comment:支付时间"`
|
|
||||||
PaperInvocieStatus int64 `gorm:"column:paper_invocie_status;comment:纸质发票状态 1:未申请 2:已申请 3:已邮寄"`
|
|
||||||
}
|
|
||||||
@ -1,75 +0,0 @@
|
|||||||
package model
|
|
||||||
|
|
||||||
import (
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"gorm.io/gorm"
|
|
||||||
)
|
|
||||||
|
|
||||||
type QuestionnaireSurvey struct {
|
|
||||||
gorm.Model
|
|
||||||
SurveyUUID string `gorm:"column:survey_uuid;comment:问卷UUID" json:"survey_uuid"`
|
|
||||||
UserId int `gorm:"column:user_id;comment:用户ID" json:"user_id"`
|
|
||||||
UserNum string `gorm:"column:user_num;comment:用户编号" json:"user_num"`
|
|
||||||
UserName string `gorm:"column:user_name;comment:用户姓名" json:"user_name"`
|
|
||||||
UserTel string `gorm:"column:user_tel;comment:用户电话" json:"user_tel"`
|
|
||||||
OrderUUID string `gorm:"column:order_uuid;comment:订单UUID" json:"order_uuid"`
|
|
||||||
SendTime time.Time `gorm:"column:send_time;comment:发送时间" json:"send_time"`
|
|
||||||
SubmitTime time.Time `gorm:"column:submit_time;comment:提交时间" json:"submit_time"`
|
|
||||||
SurveyTitle string `gorm:"column:survey_title;comment:问卷标题" json:"survey_title"`
|
|
||||||
SurveyStatus int `gorm:"column:survey_status;comment:问卷状态 1:已发送 2:已提交" json:"survey_status"`
|
|
||||||
BundleInfo string `gorm:"column:bundle_info;type:varchar(1024);comment:套餐信息" json:"bundle_info"`
|
|
||||||
SurveyAnswer string `gorm:"column:survey_answer;type:varchar(512);comment:问卷答案" json:"survey_answer"`
|
|
||||||
MeritsReview string `gorm:"column:merits_review;type:varchar(512);comment:优点评价" json:"merits_review"`
|
|
||||||
SuggestionsorImprovements string `gorm:"column:suggestionsor_improvements;type:varchar(512);comment:改进建议" json:"suggestionsor_improvements"`
|
|
||||||
AdditionalComments string `gorm:"column:additional_comments;type:varchar(512);comment:补充意见" json:"additional_comments"`
|
|
||||||
SurveyUrl string `gorm:"column:survey_url;comment:问卷URL" json:"survey_url"`
|
|
||||||
SubmitBy string `gorm:"column:submit_by;comment:提交人" json:"submit_by"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (QuestionnaireSurvey) TableName() string {
|
|
||||||
return "questionnaire_survey"
|
|
||||||
}
|
|
||||||
|
|
||||||
type BundleInfo struct {
|
|
||||||
BundleName string `gorm:"column:bundle_name;not null;comment:套餐名称" json:"bundle_name"`
|
|
||||||
StartAt time.Time `gorm:"column:start_at;type:datetime;comment:套餐开始时间"`
|
|
||||||
ExpiredAt time.Time `gorm:"column:expired_at;type:datetime;comment:套餐过期时间"`
|
|
||||||
BundleAccountNumber int `gorm:"column:bundle_account_number;not null;comment:套餐账号数量" json:"bundle_account_number"`
|
|
||||||
BundleVideoNumber int `gorm:"column:bundle_video_number;not null;comment:套餐视频数量" json:"bundle_video_number"`
|
|
||||||
IncreaseVideoNumber int `gorm:"column:increase_video_number;not null;comment:增值视频数量" json:"increase_video_number"`
|
|
||||||
BundleImageNumber int `gorm:"column:bundle_image_number;not null;comment:套餐图片数量" json:"bundle_image_number"`
|
|
||||||
BundleDataNumber int `gorm:"column:bundle_data_number;not null;comment:套餐数据数量" json:"bundle_data_number"`
|
|
||||||
BundleCompetitiveNumber int `gorm:"column:bundle_competitive_number;not null;comment:套餐竞品数量" json:"bundle_competitive_number"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type SurveyAnswer struct {
|
|
||||||
BundleAccountScore int32 `gorm:"column:bundle_account_score;not null;comment:套餐账号评分" json:"bundle_account_score"`
|
|
||||||
BundleVideoScore int32 `gorm:"column:bundle_video_score;not null;comment:套餐视频评分" json:"bundle_video_score"`
|
|
||||||
IncreaseVideoScore int32 `gorm:"column:increase_video_score;not null;comment:增值视频评分" json:"increase_video_score"`
|
|
||||||
BundleImageScore int32 `gorm:"column:bundle_image_score;not null;comment:套餐图片评分" json:"bundle_image_score"`
|
|
||||||
BundleDataScore int32 `gorm:"column:bundle_data_score;not null;comment:套餐数据评分" json:"bundle_data_score"`
|
|
||||||
BundleCompetitiveScore int32 `gorm:"column:bundle_competitive_score;not null;comment:套餐竞品评分" json:"bundle_competitive_score"`
|
|
||||||
ServiceResponseSpeed int32 `gorm:"column:service_response_speed;not null;comment:服务响应速度评分" json:"service_response_speed"`
|
|
||||||
ServiceStaffProfessionalism int32 `gorm:"column:service_staff_professionalism;not null;comment:服务人员专业性评分" json:"service_staff_professionalism"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type UserInfo struct {
|
|
||||||
UserId int `gorm:"column:user_id;not null;comment:用户ID" json:"user_id"`
|
|
||||||
UserNum string `gorm:"column:user_num;not null;comment:用户编号" json:"user_num"`
|
|
||||||
UserName string `gorm:"column:user_name;not null;comment:用户姓名" json:"user_name"`
|
|
||||||
UserTel string `gorm:"column:user_tel;not null;comment:用户电话" json:"user_tel"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type DbBundleInfo struct {
|
|
||||||
UserName string `json:"user_name"`
|
|
||||||
BundleName string `json:"bundle_name"`
|
|
||||||
StartAt time.Time `json:"start_at"`
|
|
||||||
ExpiredAt time.Time `json:"expired_at"`
|
|
||||||
BundleAccountNumber int32 `json:"bundle_account_number"`
|
|
||||||
BundleVideoNumber int32 `json:"bundle_video_number"`
|
|
||||||
IncreaseVideoNumber int32 `json:"increase_video_number"`
|
|
||||||
BundleImageNumber int32 `json:"bundle_image_number"`
|
|
||||||
BundleDataNumber int32 `json:"bundle_data_number"`
|
|
||||||
BundleCompetitiveNumber int32 `json:"bundle_competitive_number"`
|
|
||||||
}
|
|
||||||
@ -20,7 +20,6 @@ var OrderByPending = map[string]string{
|
|||||||
"pending_post_count": "assign_post_count",
|
"pending_post_count": "assign_post_count",
|
||||||
"pending_data_count": "assign_data_count",
|
"pending_data_count": "assign_data_count",
|
||||||
"pending_video_script_count": "assign_video_script_count",
|
"pending_video_script_count": "assign_video_script_count",
|
||||||
"pending_report_count": "assign_report_count",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type TaskManagement struct {
|
type TaskManagement struct {
|
||||||
@ -66,19 +65,16 @@ type TaskAssignRecords struct {
|
|||||||
PendingVideoCount int `gorm:"column:pending_video_count;comment:待发视频数量" json:"pendingVideoCount"`
|
PendingVideoCount int `gorm:"column:pending_video_count;comment:待发视频数量" json:"pendingVideoCount"`
|
||||||
PendingPostCount int `gorm:"column:pending_post_count;comment:待发图文数量" json:"pendingPostCount"`
|
PendingPostCount int `gorm:"column:pending_post_count;comment:待发图文数量" json:"pendingPostCount"`
|
||||||
PendingDataCount int `gorm:"column:pending_data_count;comment:待发数据数量" json:"pendingDataCount"`
|
PendingDataCount int `gorm:"column:pending_data_count;comment:待发数据数量" json:"pendingDataCount"`
|
||||||
PendingReportCount int `gorm:"column:pending_report_count;comment:待发竞品报告数量" json:"pendingReportCount"`
|
|
||||||
// 指派视频脚本数
|
// 指派视频脚本数
|
||||||
AssignVideoScriptCount int `gorm:"column:assign_video_script_count;comment:指派待发视频脚本数" json:"assignVideoScriptCount"`
|
AssignVideoScriptCount int `gorm:"column:assign_video_script_count;comment:指派待发视频脚本数" json:"assignVideoScriptCount"`
|
||||||
AssignVideoCount int `gorm:"column:assign_video_count;comment:指派待发视频数" json:"assignVideoCount"`
|
AssignVideoCount int `gorm:"column:assign_video_count;comment:指派待发视频数" json:"assignVideoCount"`
|
||||||
AssignPostCount int `gorm:"column:assign_post_count;comment:指派待发图文数" json:"assignPostCount"`
|
AssignPostCount int `gorm:"column:assign_post_count;comment:指派待发图文数" json:"assignPostCount"`
|
||||||
AssignDataCount int `gorm:"column:assign_data_count;comment:指派待发数据数" json:"assignDataCount"`
|
AssignDataCount int `gorm:"column:assign_data_count;comment:指派待发数据数" json:"assignDataCount"`
|
||||||
AssignReportCount int `gorm:"column:assign_report_count;comment:指派待发竞品报告数" json:"assignReportCount"`
|
|
||||||
// 已完成视频脚本数
|
// 已完成视频脚本数
|
||||||
CompleteVideoScriptCount int `gorm:"column:complete_video_script_count;comment:已完成视频脚本数" json:"completeVideoScriptCount"`
|
CompleteVideoScriptCount int `gorm:"column:complete_video_script_count;comment:已完成视频脚本数" json:"completeVideoScriptCount"`
|
||||||
CompleteVideoCount int `gorm:"column:complete_video_count;comment:已完成视频数" json:"completeVideoCount"`
|
CompleteVideoCount int `gorm:"column:complete_video_count;comment:已完成视频数" json:"completeVideoCount"`
|
||||||
CompletePostCount int `gorm:"column:complete_post_count;comment:已完成图文数" json:"completePostCount"`
|
CompletePostCount int `gorm:"column:complete_post_count;comment:已完成图文数" json:"completePostCount"`
|
||||||
CompleteDataCount int `gorm:"column:complete_data_count;comment:已完成数据数" json:"completeDataCount"`
|
CompleteDataCount int `gorm:"column:complete_data_count;comment:已完成数据数" json:"completeDataCount"`
|
||||||
CompleteReportCount int `gorm:"column:complete_report_count;comment:已完成竞品报告数" json:"completeReportCount"`
|
|
||||||
CreatedAt time.Time `gorm:"column:created_at;comment:创建时间" json:"createdAt"`
|
CreatedAt time.Time `gorm:"column:created_at;comment:创建时间" json:"createdAt"`
|
||||||
UpdatedAt time.Time `gorm:"column:updated_at;comment:更新时间;index:idx_updated_at" json:"updatedAt"`
|
UpdatedAt time.Time `gorm:"column:updated_at;comment:更新时间;index:idx_updated_at" json:"updatedAt"`
|
||||||
DeletedAt soft_delete.DeletedAt `gorm:"column:deleted_at;type:int(11);index:idx_assign_deleted_at" json:"deletedAt"`
|
DeletedAt soft_delete.DeletedAt `gorm:"column:deleted_at;type:int(11);index:idx_assign_deleted_at" json:"deletedAt"`
|
||||||
@ -88,12 +84,10 @@ func (t *TaskAssignRecords) TableName() string {
|
|||||||
return "task_assign_records"
|
return "task_assign_records"
|
||||||
}
|
}
|
||||||
|
|
||||||
// 指派记录的完成明细表
|
|
||||||
// 用于记录每次完成的具体 UUID,保障可追溯与可回滚,避免仅靠汇总计数导致不可逆的统计偏差。
|
|
||||||
type TaskAssignUUIDItems struct {
|
type TaskAssignUUIDItems struct {
|
||||||
ID int64 `gorm:"primarykey;autoIncrement"`
|
ID int64 `gorm:"primarykey;autoIncrement"`
|
||||||
AssignRecordsUUID string `gorm:"column:assign_records_uuid;comment:指派记录UUID;index:idx_assign_records_uuid;index:idx_assign_records_uuid_type,priority:1" json:"assignRecordsUUID"`
|
AssignRecordsUUID string `gorm:"column:assign_records_uuid;comment:指派记录UUID;index:idx_assign_records_uuid;index:idx_assign_records_uuid_type,priority:1" json:"assignRecordsUUID"`
|
||||||
Type int `gorm:"column:type;comment:指派类型 1:视频 2:图文 3:数据 4:视频脚本 5:竞品报告;index:idx_assign_records_uuid_type,priority:2" json:"type"`
|
Type int `gorm:"column:type;comment:指派类型 1:视频 2:图文 3:数据 4:视频脚本;index:idx_assign_records_uuid_type,priority:2" json:"type"`
|
||||||
UUID string `gorm:"column:uuid;comment:任务UUID;index:idx_uuid" json:"uuid"`
|
UUID string `gorm:"column:uuid;comment:任务UUID;index:idx_uuid" json:"uuid"`
|
||||||
|
|
||||||
CreatedAt time.Time `gorm:"column:created_at;comment:创建时间" json:"createdAt"`
|
CreatedAt time.Time `gorm:"column:created_at;comment:创建时间" json:"createdAt"`
|
||||||
@ -114,6 +108,140 @@ func (TaskPendingLayout) TableName() string {
|
|||||||
return "task_pending_layout"
|
return "task_pending_layout"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 任务余额表
|
||||||
|
type TaskBalance struct {
|
||||||
|
ID int64 `gorm:"primarykey"`
|
||||||
|
SubNum string `gorm:"column:sub_num;comment:用户编号;index:idx_task_sub_num;not null" json:"subNum"`
|
||||||
|
TelNum string `gorm:"column:tel_num;comment:手机号;index:idx_task_tel_num;not null" json:"telNum"`
|
||||||
|
Month string `gorm:"column:month;type:varchar(32);comment:月份;index:idx_task_month;not null" json:"month"`
|
||||||
|
ExpiredAt time.Time `gorm:"column:expired_at;type:datetime;comment:任务过期时间" json:"expiredAt"`
|
||||||
|
StartAt time.Time `gorm:"column:start_at;type:datetime;comment:任务开始时间" json:"startAt"`
|
||||||
|
|
||||||
|
// ===== 视频类 =====
|
||||||
|
BundleVideoNumber int `gorm:"column:bundle_video_number;not null;comment:非限制类型套餐权益视频总数"`
|
||||||
|
IncreaseVideoNumber int `gorm:"column:increase_video_number;not null;comment:非限制类型增值权益视频总数"`
|
||||||
|
BundleLimitVideoNumber int `gorm:"column:bundle_limit_video_number;not null;comment:套餐权益限制类型非过期总数"`
|
||||||
|
IncreaseLimitVideoNumber int `gorm:"column:increase_limit_video_number;not null;comment:增值权益限制类型非过期总数"`
|
||||||
|
BundleLimitVideoExpiredNumber int `gorm:"column:bundle_limit_video_expired_number;not null;comment:套餐权益限制类型会过期总数"`
|
||||||
|
IncreaseLimitVideoExpiredNumber int `gorm:"column:increase_limit_video_expired_number;not null;comment:增值权益限制类型会过期总数"`
|
||||||
|
MonthlyInvalidBundleVideoNumber int `gorm:"column:monthly_invalid_bundle_video_number;not null;comment:当月失效的套餐权益视频总数"`
|
||||||
|
InvalidBundleVideoNumber int `gorm:"column:invalid_bundle_video_number;not null;comment:历史失效的套餐权益视频总数"`
|
||||||
|
MonthlyInvalidIncreaseVideoNumber int `gorm:"column:monthly_invalid_increase_video_number;not null;comment:当月失效的增值权益视频总数"`
|
||||||
|
InvalidIncreaseVideoNumber int `gorm:"column:invalid_increase_video_number;not null;comment:历史失效的增值权益视频总数"`
|
||||||
|
BundleVideoConsumptionNumber int `gorm:"column:bundle_video_consumption_number;not null;comment:非限制类型套餐权益视频使用数"`
|
||||||
|
IncreaseVideoConsumptionNumber int `gorm:"column:increase_video_consumption_number;not null;comment:非限制类型增值权益视频使用数"`
|
||||||
|
BundleLimitVideoConsumptionNumber int `gorm:"column:bundle_limit_video_consumption_number;not null;comment:套餐权益限制类型非过期使用数"`
|
||||||
|
IncreaseLimitVideoConsumptionNumber int `gorm:"column:increase_limit_video_consumption_number;not null;comment:增值权益限制类型非过期使用数"`
|
||||||
|
BundleLimitVideoExpiredConsumptionNumber int `gorm:"column:bundle_limit_video_expired_consumption_number;not null;comment:套餐权益限制类型会过期使用数"`
|
||||||
|
IncreaseLimitVideoExpiredConsumptionNumber int `gorm:"column:increase_limit_video_expired_consumption_number;not null;comment:增值权益限制类型会过期使用数"`
|
||||||
|
MonthlyBundleVideoConsumptionNumber int `gorm:"column:monthly_bundle_video_consumption_number;not null;comment:当月套餐类型视频已使用额度"`
|
||||||
|
MonthlyIncreaseVideoConsumptionNumber int `gorm:"column:monthly_increase_video_consumption_number;not null;comment:当月增值类型视频已使用额度"`
|
||||||
|
MonthlyBundleLimitVideoNumber int `gorm:"column:monthly_bundle_limit_video_number;not null;comment:当月套餐限制类型视频可使用额度"`
|
||||||
|
MonthlyIncreaseLimitVideoNumber int `gorm:"column:monthly_increase_limit_video_number;not null;comment:当月增值限制类型视频可使用额度"`
|
||||||
|
MonthlyBundleLimitVideoConsumptionNumber int `gorm:"column:monthly_bundle_limit_video_consumption_number;not null;comment:当月套餐限制类型视频已使用额度"`
|
||||||
|
MonthlyIncreaseLimitVideoConsumptionNumber int `gorm:"column:monthly_increase_limit_video_consumption_number;not null;comment:当月增值限制类型视频已使用额度"`
|
||||||
|
MonthlyBundleLimitExpiredVideoNumber int `gorm:"column:monthly_bundle_limit_expired_video_number;not null;comment:当月套餐限制类会过期型视频可使用额度"`
|
||||||
|
MonthlyIncreaseLimitExpiredVideoNumber int `gorm:"column:monthly_increase_limit_expired_video_number;not null;comment:当月增值限制类会过期型视频可使用额度"`
|
||||||
|
MonthlyBundleLimitExpiredVideoConsumptionNumber int `gorm:"column:monthly_bundle_limit_expired_video_consumption_number;not null;comment:当月套餐限制类型会过期视频已使用额度"`
|
||||||
|
MonthlyIncreaseLimitExpiredVideoConsumptionNumber int `gorm:"column:monthly_increase_limit_expired_video_consumption_number;not null;comment:当月增值限制类会过期型视频已使用额度"`
|
||||||
|
MonthlyLimitVideoQuotaNumber int `gorm:"column:monthly_limit_video_quota_number;not null;comment:当月限制类型视频额度"`
|
||||||
|
ManualVideoNumber int `gorm:"column:manual_video_number;comment:手动扩展视频总数"`
|
||||||
|
ManualVideoConsumptionNumber int `gorm:"column:manual_video_consumption_number;comment:手动扩展视频使用数"`
|
||||||
|
MonthlyNewManualVideoNumber int `gorm:"column:monthly_new_manual_video_number;comment:当月手动扩展视频新增数"`
|
||||||
|
MonthlyManualVideoConsumptionNumber int `gorm:"column:monthly_manual_video_consumption_number;comment:当月手动扩展视频使用数"`
|
||||||
|
|
||||||
|
// ===== 图片类 =====
|
||||||
|
BundleImageNumber int `gorm:"column:bundle_image_number;not null;comment:非限制类型套餐权益图片总数"`
|
||||||
|
IncreaseImageNumber int `gorm:"column:increase_image_number;not null;comment:非限制类型增值权益图片总数"`
|
||||||
|
BundleLimitImageNumber int `gorm:"column:bundle_limit_image_number;not null;comment:套餐权益限制类型非过期总数"`
|
||||||
|
IncreaseLimitImageNumber int `gorm:"column:increase_limit_image_number;not null;comment:增值权益限制类型非过期总数"`
|
||||||
|
BundleLimitImageExpiredNumber int `gorm:"column:bundle_limit_image_expired_number;not null;comment:套餐权益限制类型会过期总数"`
|
||||||
|
IncreaseLimitImageExpiredNumber int `gorm:"column:increase_limit_image_expired_number;not null;comment:增值权益限制类型会过期总数"`
|
||||||
|
MonthlyInvalidBundleImageNumber int `gorm:"column:monthly_invalid_bundle_image_number;not null;comment:当月失效的套餐权益图片总数"`
|
||||||
|
InvalidBundleImageNumber int `gorm:"column:invalid_bundle_image_number;not null;comment:历史失效的套餐权益图片总数"`
|
||||||
|
MonthlyInvalidIncreaseImageNumber int `gorm:"column:monthly_invalid_increase_image_number;not null;comment:当月失效的增值权益图片总数"`
|
||||||
|
InvalidIncreaseImageNumber int `gorm:"column:invalid_increase_image_number;not null;comment:历史失效的增值权益图片总数"`
|
||||||
|
BundleImageConsumptionNumber int `gorm:"column:bundle_image_consumption_number;not null;comment:非限制类型套餐权益图片使用数"`
|
||||||
|
IncreaseImageConsumptionNumber int `gorm:"column:increase_image_consumption_number;not null;comment:非限制类型增值权益图片使用数"`
|
||||||
|
BundleLimitImageConsumptionNumber int `gorm:"column:bundle_limit_image_consumption_number;not null;comment:套餐权益限制类型非过期使用数"`
|
||||||
|
IncreaseLimitImageConsumptionNumber int `gorm:"column:increase_limit_image_consumption_number;not null;comment:增值权益限制类型非过期使用数"`
|
||||||
|
BundleLimitImageExpiredConsumptionNumber int `gorm:"column:bundle_limit_image_expired_consumption_number;not null;comment:套餐权益限制类型会过期使用数"`
|
||||||
|
IncreaseLimitImageExpiredConsumptionNumber int `gorm:"column:increase_limit_image_expired_consumption_number;not null;comment:增值权益限制类型会过期使用数"`
|
||||||
|
MonthlyBundleImageConsumptionNumber int `gorm:"column:monthly_bundle_image_consumption_number;not null;comment:当月套餐类型图片已使用额度"`
|
||||||
|
MonthlyIncreaseImageConsumptionNumber int `gorm:"column:monthly_increase_image_consumption_number;not null;comment:当月增值类型图片已使用额度"`
|
||||||
|
MonthlyBundleLimitImageNumber int `gorm:"column:monthly_bundle_limit_image_number;not null;comment:当月套餐限制类型图片可使用额度"`
|
||||||
|
MonthlyIncreaseLimitImageNumber int `gorm:"column:monthly_increase_limit_image_number;not null;comment:当月增值限制类型图片可使用额度"`
|
||||||
|
MonthlyBundleLimitImageConsumptionNumber int `gorm:"column:monthly_bundle_limit_image_consumption_number;not null;comment:当月套餐限制类型图片已使用额度"`
|
||||||
|
MonthlyIncreaseLimitImageConsumptionNumber int `gorm:"column:monthly_increase_limit_image_consumption_number;not null;comment:当月增值限制类型图片已使用额度"`
|
||||||
|
MonthlyBundleLimitExpiredImageNumber int `gorm:"column:monthly_bundle_limit_expired_image_number;not null;comment:当月套餐限制类会过期型图片可使用额度"`
|
||||||
|
MonthlyIncreaseLimitExpiredImageNumber int `gorm:"column:monthly_increase_limit_expired_image_number;not null;comment:当月增值限制类会过期型图片可使用额度"`
|
||||||
|
MonthlyBundleLimitExpiredImageConsumptionNumber int `gorm:"column:monthly_bundle_limit_expired_image_consumption_number;not null;comment:当月套餐限制类型会过期图片已使用额度"`
|
||||||
|
MonthlyIncreaseLimitExpiredImageConsumptionNumber int `gorm:"column:monthly_increase_limit_expired_image_consumption_number;not null;comment:当月增值限制类会过期型图片已使用额度"`
|
||||||
|
MonthlyLimitImageQuotaNumber int `gorm:"column:monthly_limit_image_quota_number;not null;comment:当月限制类型图片额度"`
|
||||||
|
ManualImageNumber int `gorm:"column:manual_image_number;comment:手动扩展图片总数"`
|
||||||
|
ManualImageConsumptionNumber int `gorm:"column:manual_image_consumption_number;comment:手动扩展图片使用数"`
|
||||||
|
MonthlyNewManualImageNumber int `gorm:"column:monthly_new_manual_image_number;comment:当月手动扩展图片新增数"`
|
||||||
|
MonthlyManualImageConsumptionNumber int `gorm:"column:monthly_manual_image_consumption_number;comment:当月手动扩展图片使用数"`
|
||||||
|
|
||||||
|
// ===== 数据分析类 =====
|
||||||
|
BundleDataAnalysisNumber int `gorm:"column:bundle_data_analysis_number;not null;comment:非限制类型套餐权益数据分析总数"`
|
||||||
|
IncreaseDataAnalysisNumber int `gorm:"column:increase_data_analysis_number;not null;comment:非限制类型增值权益数据分析总数"`
|
||||||
|
BundleLimitDataAnalysisNumber int `gorm:"column:bundle_limit_data_analysis_number;not null;comment:套餐权益限制类型非过期总数"`
|
||||||
|
IncreaseLimitDataAnalysisNumber int `gorm:"column:increase_limit_data_analysis_number;not null;comment:增值权益限制类型非过期总数"`
|
||||||
|
BundleLimitDataAnalysisExpiredNumber int `gorm:"column:bundle_limit_data_analysis_expired_number;not null;comment:套餐权益限制类型会过期总数"`
|
||||||
|
IncreaseLimitDataAnalysisExpiredNumber int `gorm:"column:increase_limit_data_analysis_expired_number;not null;comment:增值权益限制类型会过期总数"`
|
||||||
|
MonthlyInvalidBundleDataAnalysisNumber int `gorm:"column:monthly_invalid_bundle_data_analysis_number;not null;comment:当月失效的套餐权益数据分析总数"`
|
||||||
|
InvalidBundleDataAnalysisNumber int `gorm:"column:invalid_bundle_data_analysis_number;not null;comment:历史失效的套餐权益数据分析总数"`
|
||||||
|
MonthlyInvalidIncreaseDataAnalysisNumber int `gorm:"column:monthly_invalid_increase_data_analysis_number;not null;comment:当月失效的增值权益数据分析总数"`
|
||||||
|
InvalidIncreaseDataAnalysisNumber int `gorm:"column:invalid_increase_data_analysis_number;not null;comment:历史失效的增值权益数据分析总数"`
|
||||||
|
BundleDataAnalysisConsumptionNumber int `gorm:"column:bundle_data_analysis_consumption_number;not null;comment:非限制类型套餐权益数据分析使用数"`
|
||||||
|
IncreaseDataAnalysisConsumptionNumber int `gorm:"column:increase_data_analysis_consumption_number;not null;comment:非限制类型增值权益数据分析使用数"`
|
||||||
|
BundleLimitDataAnalysisConsumptionNumber int `gorm:"column:bundle_limit_data_analysis_consumption_number;not null;comment:套餐权益限制类型非过期使用数"`
|
||||||
|
IncreaseLimitDataAnalysisConsumptionNumber int `gorm:"column:increase_limit_data_analysis_consumption_number;not null;comment:增值权益限制类型非过期使用数"`
|
||||||
|
BundleLimitDataAnalysisExpiredConsumptionNumber int `gorm:"column:bundle_limit_data_analysis_expired_consumption_number;not null;comment:套餐权益限制类型会过期使用数"`
|
||||||
|
IncreaseLimitDataAnalysisExpiredConsumptionNumber int `gorm:"column:increase_limit_data_analysis_expired_consumption_number;not null;comment:增值权益限制类型会过期使用数"`
|
||||||
|
MonthlyBundleDataAnalysisConsumptionNumber int `gorm:"column:monthly_bundle_data_analysis_consumption_number;not null;comment:当月套餐类型数据分析已使用额度"`
|
||||||
|
MonthlyIncreaseDataAnalysisConsumptionNumber int `gorm:"column:monthly_increase_data_analysis_consumption_number;not null;comment:当月增值类型数据分析已使用额度"`
|
||||||
|
MonthlyBundleLimitDataAnalysisNumber int `gorm:"column:monthly_bundle_limit_data_analysis_number;not null;comment:当月套餐限制类型数据分析可使用额度"`
|
||||||
|
MonthlyIncreaseLimitDataAnalysisNumber int `gorm:"column:monthly_increase_limit_data_analysis_number;not null;comment:当月增值限制类型数据分析可使用额度"`
|
||||||
|
MonthlyBundleLimitDataAnalysisConsumptionNumber int `gorm:"column:monthly_bundle_limit_data_analysis_consumption_number;not null;comment:当月套餐限制类型数据分析已使用额度"`
|
||||||
|
MonthlyIncreaseLimitDataAnalysisConsumptionNumber int `gorm:"column:monthly_increase_limit_data_analysis_consumption_number;not null;comment:当月增值限制类型数据分析已使用额度"`
|
||||||
|
MonthlyBundleLimitExpiredDataAnalysisNumber int `gorm:"column:monthly_bundle_limit_expired_data_analysis_number;not null;comment:当月套餐限制类会过期型数据分析可使用额度"`
|
||||||
|
MonthlyIncreaseLimitExpiredDataAnalysisNumber int `gorm:"column:monthly_increase_limit_expired_data_analysis_number;not null;comment:当月增值限制类会过期型数据分析可使用额度"`
|
||||||
|
MonthlyBundleLimitExpiredDataAnalysisConsumptionNumber int `gorm:"column:monthly_bundle_limit_expired_data_analysis_consumption_number;not null;comment:当月套餐限制类型会过期数据分析已使用额度"`
|
||||||
|
MonthlyIncreaseLimitExpiredDataAnalysisConsumptionNumber int `gorm:"column:monthly_increase_limit_expired_data_analysis_consumption_number;not null;comment:当月增值限制类会过期型数据分析已使用额度"`
|
||||||
|
MonthlyLimitDataAnalysisQuotaNumber int `gorm:"column:monthly_limit_data_analysis_quota_number;not null;comment:当月限制类型数据分析额度"`
|
||||||
|
ManualDataAnalysisNumber int `gorm:"column:manual_data_analysis_number;comment:手动扩展数据分析总数"`
|
||||||
|
ManualDataAnalysisConsumptionNumber int `gorm:"column:manual_data_analysis_consumption_number;comment:手动扩展数据分析使用数"`
|
||||||
|
MonthlyNewManualDataAnalysisNumber int `gorm:"column:monthly_new_manual_data_analysis_number;comment:当月手动扩展数据分析新增数"`
|
||||||
|
MonthlyManualDataAnalysisConsumptionNumber int `gorm:"column:monthly_manual_data_analysis_consumption_number;comment:当月手动扩展数据分析使用数"`
|
||||||
|
|
||||||
|
MonthlyNewDurationNumber int `gorm:"column:monthly_new_duration_number;comment:当月新增手动扩展时长(天)"`
|
||||||
|
ExpansionPacksNumber int `gorm:"column:expansion_packs_number;not null;comment:扩展包数量"`
|
||||||
|
|
||||||
|
CreatedAt time.Time `gorm:"column:created_at;comment:创建时间" json:"createdAt"`
|
||||||
|
UpdatedAt time.Time `gorm:"column:updated_at;comment:更新时间" json:"updatedAt"`
|
||||||
|
DeletedAt soft_delete.DeletedAt `gorm:"column:deleted_at;type:int(11);index:idx_task_balance_deleted_at" json:"deletedAt"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t *TaskBalance) TableName() string {
|
||||||
|
return "task_balance_new"
|
||||||
|
}
|
||||||
|
|
||||||
|
// TaskSyncStatus 用于标记一次性任务余额同步是否已经执行
|
||||||
|
// 记录键唯一,避免重复执行
|
||||||
|
type TaskSyncStatus struct {
|
||||||
|
ID int64 `gorm:"primarykey"`
|
||||||
|
SyncKey string `gorm:"column:sync_key;type:varchar(100);uniqueIndex;not null"`
|
||||||
|
ExecutedAt time.Time `gorm:"column:executed_at;type:datetime;not null"`
|
||||||
|
Remark string `gorm:"column:remark;type:varchar(255)"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (TaskSyncStatus) TableName() string { return "task_sync_status" }
|
||||||
|
|
||||||
|
// InitialSyncKey 一次性同步的唯一标识键
|
||||||
|
const InitialSyncKey = "bundle_to_task_balance_initial_sync"
|
||||||
|
|
||||||
// 隐藏指派人表
|
// 隐藏指派人表
|
||||||
type TaskAssigneeHidden struct {
|
type TaskAssigneeHidden struct {
|
||||||
// 让id自增
|
// 让id自增
|
||||||
@ -144,7 +272,7 @@ type TaskWorkLog struct {
|
|||||||
|
|
||||||
// ===== 操作信息 =====
|
// ===== 操作信息 =====
|
||||||
OperationType int `gorm:"column:operation_type;type:int(11);comment:任务操作类型 1:加任务 2:消耗任务 3:完成任务;4:任务过期;index:idx_operation_type;not null" default:"0" json:"operationType"`
|
OperationType int `gorm:"column:operation_type;type:int(11);comment:任务操作类型 1:加任务 2:消耗任务 3:完成任务;4:任务过期;index:idx_operation_type;not null" default:"0" json:"operationType"`
|
||||||
TaskType int `gorm:"column:task_type;type:int(11);comment:任务类型 1:视频 2:图片 3:数据分析 4:视频脚本 5:竞品报告;index:idx_task_type;not null" default:"0" json:"taskType"`
|
TaskType int `gorm:"column:task_type;type:int(11);comment:任务类型 1:视频 2:图片 3:数据分析;index:idx_task_type;not null" default:"0" json:"taskType"`
|
||||||
TaskCount int `gorm:"column:task_count;type:int(11);comment:任务数量;not null" default:"0" json:"taskCount"`
|
TaskCount int `gorm:"column:task_count;type:int(11);comment:任务数量;not null" default:"0" json:"taskCount"`
|
||||||
Remark string `gorm:"column:remark;type:varchar(500);comment:任务备注" default:"" json:"remark"`
|
Remark string `gorm:"column:remark;type:varchar(500);comment:任务备注" default:"" json:"remark"`
|
||||||
|
|
||||||
|
|||||||
528
pb/bundle.proto
528
pb/bundle.proto
@ -104,7 +104,6 @@ service Bundle {
|
|||||||
rpc GetPendingAssign(PendingAssignRequest) returns (PendingAssignResponse) {} // 查询艺人可指派数量
|
rpc GetPendingAssign(PendingAssignRequest) returns (PendingAssignResponse) {} // 查询艺人可指派数量
|
||||||
rpc RevertTaskCompletionByUUIDItem(RevertTaskCompletionByUUIDItemRequest) returns (ComResponse) {}
|
rpc RevertTaskCompletionByUUIDItem(RevertTaskCompletionByUUIDItemRequest) returns (ComResponse) {}
|
||||||
rpc AddHiddenTaskAssignee(AddHiddenTaskAssigneeRequest) returns (ComResponse) {}
|
rpc AddHiddenTaskAssignee(AddHiddenTaskAssigneeRequest) returns (ComResponse) {}
|
||||||
rpc GetTaskWorkLogList(TaskWorkLogQueryRequest) returns (TaskWorkLogQueryResponse) {}
|
|
||||||
rpc CreateTaskWorkLog(CreateTaskWorkLogRequest) returns (CommonResponse) {} // 创建任务日志记录
|
rpc CreateTaskWorkLog(CreateTaskWorkLogRequest) returns (CommonResponse) {} // 创建任务日志记录
|
||||||
|
|
||||||
//数据指标
|
//数据指标
|
||||||
@ -116,43 +115,8 @@ service Bundle {
|
|||||||
rpc MetricsVideoSubmitExport(MetricsVideoSubmitExportReq) returns (MetricsVideoSubmitExportResp) {}
|
rpc MetricsVideoSubmitExport(MetricsVideoSubmitExportReq) returns (MetricsVideoSubmitExportResp) {}
|
||||||
rpc QueryTheOrderSnapshotInformation(QueryTheOrderSnapshotInformationReq) returns (QueryTheOrderSnapshotInformationResp) {}
|
rpc QueryTheOrderSnapshotInformation(QueryTheOrderSnapshotInformationReq) returns (QueryTheOrderSnapshotInformationResp) {}
|
||||||
|
|
||||||
//发票管理
|
|
||||||
rpc CreateInvoice(CreateInvoiceReq) returns (CreateInvoiceResp) {}//创建发票信息
|
|
||||||
rpc CreatePaperInvoiceAddress(CreatePaperInvoiceAddressReq) returns (CreatePaperInvoiceAddressResp) {}//创建纸质发票地址
|
|
||||||
rpc GetInvoiceList(GetInvoiceListReq) returns (GetInvoiceListResp) {}//获取发票列表
|
|
||||||
rpc UpdateInvoiceExpressInfo(UpdateInvoiceExpressInfoReq) returns (UpdateInvoiceExpressInfoResp) {}//更新发票快递信息
|
|
||||||
rpc GetInvoiceExpressInfo(GetInvoiceExpressInfoReq) returns (GetInvoiceExpressInfoResp) {}//获取发票快递信息
|
|
||||||
rpc GetOrderInfoByOrderNo(GetOrderInfoByOrderNoReq) returns (GetOrderInfoByOrderNoResp) {}//获取订单信息
|
|
||||||
rpc GetInvoiceInfoByOrderNo(GetInvoiceInfoByOrderNoReq) returns (GetInvoiceInfoByOrderNoResp) {}//获取发票信息
|
|
||||||
rpc GetLastInvoiceNo(GetLastInvoiceNoReq) returns (GetLastInvoiceNoResp) {}//获取最后一张发票编号
|
|
||||||
rpc UpdataInvoiceInfo(UpdataInvoiceInfoReq) returns (UpdataInvoiceInfoResp) {}//更新发票信息
|
|
||||||
|
|
||||||
//临时接口
|
//临时接口
|
||||||
rpc ExportWorkCastInfo(ExportWorkCastInfoReq) returns (ExportWorkCastInfoResp) {}
|
rpc ExportWorkCastInfo(ExportWorkCastInfoReq) returns (ExportWorkCastInfoResp) {}
|
||||||
|
|
||||||
// 客户管理
|
|
||||||
rpc GetCustomerList(CustomerListRequest) returns (CustomerListResponse) {} // 多条件查询客户列表
|
|
||||||
rpc GetCustomerDetail(CustomerDetailRequest) returns (CustomerDetailResponse) {} // 根据客户ID查询客户详情
|
|
||||||
rpc UpdateCustomer(CustomerUpdateRequest) returns (ComResponse) {} // 更新客户接口(根据action判断新增/更新/删除)
|
|
||||||
rpc GetReferralPersonList(ReferralPersonListRequest) returns (ReferralPersonListResponse) {} // 查询所有不重复的推荐人列表
|
|
||||||
|
|
||||||
// 合同管理
|
|
||||||
rpc UpdateContract(ContractUpdateRequest) returns (ComResponse) {} // 合同更新接口(根据action判断新增/更新/删除)
|
|
||||||
rpc GetContractList(ContractListRequest) returns (ContractListResponse) {} // 查询合同列表
|
|
||||||
rpc GetContractDetail(ContractDetailRequest) returns (ContractDetailResponse) {} // 根据合同UUID查询详情
|
|
||||||
rpc GetDevelopmentCyclesByContractUUID(GetDevelopmentCyclesByContractUUIDRequest) returns (GetDevelopmentCyclesByContractUUIDResponse) {} // 根据合同UUID查询开发周期
|
|
||||||
rpc GetPaymentCyclesByContractUUID(GetPaymentCyclesByContractUUIDRequest) returns (GetPaymentCyclesByContractUUIDResponse) {} // 根据合同UUID查询支付周期
|
|
||||||
|
|
||||||
|
|
||||||
rpc UpdateOrderRecordByOrderUuid(OrderRecord) returns (CommonResponse) {}
|
|
||||||
rpc OrderListByOrderUuid(OrderInfoByOrderUuidRequest) returns (OrderInfoByOrderNoResp) {}
|
|
||||||
|
|
||||||
// 问卷调查
|
|
||||||
rpc SendQuestionnaireSurvey(SendQuestionnaireSurveyRequest) returns (SendQuestionnaireSurveyResponse) {}
|
|
||||||
rpc GetQuestionnaireSurveyInfo(GetQuestionnaireSurveyInfoRequest) returns (GetQuestionnaireSurveyInfoResponse) {}
|
|
||||||
rpc CreateQuestionnaireSurveyAnswer(CreateQuestionnaireSurveyAnswerRequest) returns (CreateQuestionnaireSurveyAnswerResponse) {}
|
|
||||||
rpc GetQuestionnaireSurveyList(GetQuestionnaireSurveyListRequest) returns (GetQuestionnaireSurveyListResponse) {}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
message GetInEffectOrderRecordRequest{
|
message GetInEffectOrderRecordRequest{
|
||||||
uint64 userID = 1;
|
uint64 userID = 1;
|
||||||
@ -1348,8 +1312,6 @@ message TaskAssignRequest {
|
|||||||
int32 assignDataCount = 10 [json_name = "assignDataCount"]; // 指派数据数
|
int32 assignDataCount = 10 [json_name = "assignDataCount"]; // 指派数据数
|
||||||
string taskBatch = 11 [json_name = "taskBatch"]; // 任务批次
|
string taskBatch = 11 [json_name = "taskBatch"]; // 任务批次
|
||||||
int32 assignVideoScriptCount = 12 [json_name = "assignVideoScriptCount"]; // 指派视频脚本数
|
int32 assignVideoScriptCount = 12 [json_name = "assignVideoScriptCount"]; // 指派视频脚本数
|
||||||
int32 assignReportCount = 13 [json_name = "assignReportCount"]; // 指派竞品报告数
|
|
||||||
int32 userID = 14 [json_name = "userID"]; // 用户ID
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 修改待发数量
|
// 修改待发数量
|
||||||
@ -1433,8 +1395,6 @@ message TaskAssignRecordInfo {
|
|||||||
int32 completeVideoCount = 21 [json_name = "completeVideoCount"]; // 已完成视频数
|
int32 completeVideoCount = 21 [json_name = "completeVideoCount"]; // 已完成视频数
|
||||||
int32 completePostCount = 22 [json_name = "completePostCount"]; // 已完成图文数
|
int32 completePostCount = 22 [json_name = "completePostCount"]; // 已完成图文数
|
||||||
int32 completeDataCount = 23 [json_name = "completeDataCount"]; // 已完成数据数
|
int32 completeDataCount = 23 [json_name = "completeDataCount"]; // 已完成数据数
|
||||||
int32 pendingReportCount = 24 [json_name = "pendingReportCount"]; // 待发竞品报告数量
|
|
||||||
int32 completeReportCount = 25 [json_name = "completeReportCount"]; // 已完成竞品报告数
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 批量指派任务(仅写入操作记录)
|
// 批量指派任务(仅写入操作记录)
|
||||||
@ -1451,8 +1411,6 @@ message BatchAssignTaskItem {
|
|||||||
int32 assignDataCount = 10 [json_name = "assignDataCount"]; // 指派数据数
|
int32 assignDataCount = 10 [json_name = "assignDataCount"]; // 指派数据数
|
||||||
string taskBatch = 11 [json_name = "taskBatch"]; // 任务批次
|
string taskBatch = 11 [json_name = "taskBatch"]; // 任务批次
|
||||||
int32 assignVideoScriptCount = 12 [json_name = "assignVideoScriptCount"]; // 指派视频脚本数
|
int32 assignVideoScriptCount = 12 [json_name = "assignVideoScriptCount"]; // 指派视频脚本数
|
||||||
int32 assignReportCount = 13 [json_name = "assignReportCount"]; // 指派竞品报告数
|
|
||||||
int32 userID = 14 [json_name = "userID"]; // 用户ID
|
|
||||||
}
|
}
|
||||||
|
|
||||||
message BatchAssignTaskRequest {
|
message BatchAssignTaskRequest {
|
||||||
@ -1492,7 +1450,7 @@ message UpdateTaskProgressRequest {
|
|||||||
string assignRecordsUUID = 1 [json_name = "assignRecordsUUID"]; // 指派记录UUID(可选)
|
string assignRecordsUUID = 1 [json_name = "assignRecordsUUID"]; // 指派记录UUID(可选)
|
||||||
string employeeName = 2 [json_name = "employeeName"]; // 员工姓名(必要)
|
string employeeName = 2 [json_name = "employeeName"]; // 员工姓名(必要)
|
||||||
string employeeNum = 3 [json_name = "employeeNum"]; // 员工工号(必要)
|
string employeeNum = 3 [json_name = "employeeNum"]; // 员工工号(必要)
|
||||||
string taskType = 4 [json_name = "taskType"]; // 任务类型: video/post/data/script/report
|
string taskType = 4 [json_name = "taskType"]; // 任务类型: video/post/data/script
|
||||||
int32 completeCount = 5 [json_name = "completeCount"]; // 完成数量
|
int32 completeCount = 5 [json_name = "completeCount"]; // 完成数量
|
||||||
string uuid = 6 [json_name = "uuid"]; // cast_work 的 UUID(必要)
|
string uuid = 6 [json_name = "uuid"]; // cast_work 的 UUID(必要)
|
||||||
}
|
}
|
||||||
@ -1533,14 +1491,12 @@ message TaskAssignRecordsSummary {
|
|||||||
int32 totalPendingVideoCount = 2 [json_name = "totalPendingVideoCount"];
|
int32 totalPendingVideoCount = 2 [json_name = "totalPendingVideoCount"];
|
||||||
int32 totalPendingPostCount = 3 [json_name = "totalPendingPostCount"];
|
int32 totalPendingPostCount = 3 [json_name = "totalPendingPostCount"];
|
||||||
int32 totalPendingDataCount = 4 [json_name = "totalPendingDataCount"];
|
int32 totalPendingDataCount = 4 [json_name = "totalPendingDataCount"];
|
||||||
int32 totalPendingReportCount = 9 [json_name = "totalPendingReportCount"];
|
|
||||||
|
|
||||||
// 已完成汇总
|
// 已完成汇总
|
||||||
int32 totalCompleteVideoScriptCount = 5 [json_name = "totalCompleteVideoScriptCount"];
|
int32 totalCompleteVideoScriptCount = 5 [json_name = "totalCompleteVideoScriptCount"];
|
||||||
int32 totalCompleteVideoCount = 6 [json_name = "totalCompleteVideoCount"];
|
int32 totalCompleteVideoCount = 6 [json_name = "totalCompleteVideoCount"];
|
||||||
int32 totalCompletePostCount = 7 [json_name = "totalCompletePostCount"];
|
int32 totalCompletePostCount = 7 [json_name = "totalCompletePostCount"];
|
||||||
int32 totalCompleteDataCount = 8 [json_name = "totalCompleteDataCount"];
|
int32 totalCompleteDataCount = 8 [json_name = "totalCompleteDataCount"];
|
||||||
int32 totalCompleteReportCount = 10 [json_name = "totalCompleteReportCount"];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 艺人上传与额度统计项
|
// 艺人上传与额度统计项
|
||||||
@ -1589,15 +1545,6 @@ message ArtistUploadStatsItem {
|
|||||||
int32 allowPostCount = 28 [json_name = "allowPostCount"];
|
int32 allowPostCount = 28 [json_name = "allowPostCount"];
|
||||||
int32 allowDataCount = 29 [json_name = "allowDataCount"];
|
int32 allowDataCount = 29 [json_name = "allowDataCount"];
|
||||||
int32 allowVideoScriptCount = 30 [json_name = "allowVideoScriptCount"];
|
int32 allowVideoScriptCount = 30 [json_name = "allowVideoScriptCount"];
|
||||||
|
|
||||||
// 竞品报告统计
|
|
||||||
int32 uploadedReportCount = 31 [json_name = "uploadedReportCount"];
|
|
||||||
int32 bundleReportTotal = 32 [json_name = "bundleReportTotal"];
|
|
||||||
int32 increaseReportTotal = 33 [json_name = "increaseReportTotal"];
|
|
||||||
int32 releasedReportTotal = 34 [json_name = "releasedReportTotal"];
|
|
||||||
int32 pendingReportCount = 35 [json_name = "pendingReportCount"];
|
|
||||||
|
|
||||||
int32 allowReportCount = 36 [json_name = "allowReportCount"];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 艺人上传与额度统计响应
|
// 艺人上传与额度统计响应
|
||||||
@ -1650,7 +1597,6 @@ message PendingAssignItem {
|
|||||||
int32 allowVideoCount = 5 [json_name = "allowVideoCount"];
|
int32 allowVideoCount = 5 [json_name = "allowVideoCount"];
|
||||||
int32 allowPostCount = 6 [json_name = "allowPostCount"];
|
int32 allowPostCount = 6 [json_name = "allowPostCount"];
|
||||||
int32 allowDataCount = 7 [json_name = "allowDataCount"];
|
int32 allowDataCount = 7 [json_name = "allowDataCount"];
|
||||||
int32 allowReportCount = 8 [json_name = "allowReportCount"];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询艺人可指派数量响应
|
// 查询艺人可指派数量响应
|
||||||
@ -1715,44 +1661,6 @@ message GetPendingTaskLayoutResp{ string data = 1; }
|
|||||||
message SetPendingTaskLayoutReq{ string data = 1; }
|
message SetPendingTaskLayoutReq{ string data = 1; }
|
||||||
message SetPendingTaskLayoutResp{}
|
message SetPendingTaskLayoutResp{}
|
||||||
|
|
||||||
message TaskWorkLogQueryRequest {
|
|
||||||
string assignRecordsUUID = 1 [json_name = "assignRecordsUUID"];
|
|
||||||
int32 operationType = 2 [json_name = "operationType"];
|
|
||||||
int32 taskType = 3 [json_name = "taskType"];
|
|
||||||
string artistUUID = 4 [json_name = "artistUUID"];
|
|
||||||
string subNum = 5 [json_name = "subNum"];
|
|
||||||
string artistName = 6 [json_name = "artistName"];
|
|
||||||
int32 page = 7 [json_name = "page"];
|
|
||||||
int32 pageSize = 8 [json_name = "pageSize"];
|
|
||||||
}
|
|
||||||
|
|
||||||
message TaskWorkLogInfo {
|
|
||||||
string workLogUUID = 1 [json_name = "taskWorkLogUUID"];
|
|
||||||
string assignRecordsUUID = 2 [json_name = "assignRecordsUUID"];
|
|
||||||
string workUUID = 3 [json_name = "workUUID"];
|
|
||||||
string title = 4 [json_name = "title"];
|
|
||||||
string artistUUID = 5 [json_name = "artistUUID"];
|
|
||||||
string subNum = 6 [json_name = "subNum"];
|
|
||||||
string telNum = 7 [json_name = "telNum"];
|
|
||||||
string artistName = 8 [json_name = "artistName"];
|
|
||||||
int32 operationType = 9 [json_name = "operationType"];
|
|
||||||
int32 taskType = 10 [json_name = "taskType"];
|
|
||||||
int32 taskCount = 11 [json_name = "taskCount"];
|
|
||||||
string remark = 12 [json_name = "remark"];
|
|
||||||
string operatorName = 13 [json_name = "taskOperatorName"];
|
|
||||||
string operatorNum = 14 [json_name = "taskOperatorNum"];
|
|
||||||
int64 operationTime = 15 [json_name = "taskOperationTime"];
|
|
||||||
int64 createdAt = 16 [json_name = "taskCreatedAt"];
|
|
||||||
int64 updatedAt = 17 [json_name = "taskUpdatedAt"];
|
|
||||||
}
|
|
||||||
|
|
||||||
message TaskWorkLogQueryResponse {
|
|
||||||
repeated TaskWorkLogInfo records = 1 [json_name = "records"];
|
|
||||||
int64 total = 2 [json_name = "total"];
|
|
||||||
int32 page = 3 [json_name = "page"];
|
|
||||||
int32 pageSize = 4 [json_name = "pageSize"];
|
|
||||||
}
|
|
||||||
|
|
||||||
// 创建任务日志请求
|
// 创建任务日志请求
|
||||||
message CreateTaskWorkLogRequest {
|
message CreateTaskWorkLogRequest {
|
||||||
string assignRecordsUUID = 1 [json_name = "assignRecordsUUID"]; // 任务指派记录UUID(必填)
|
string assignRecordsUUID = 1 [json_name = "assignRecordsUUID"]; // 任务指派记录UUID(必填)
|
||||||
@ -2011,316 +1919,6 @@ message MetricsBalanceDetailExportReq{
|
|||||||
string month = 1;
|
string month = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 客户管理相关消息定义
|
|
||||||
// 客户列表查询请求
|
|
||||||
message CustomerListRequest {
|
|
||||||
string customerName = 1 [json_name = "customerName"]; // 客户名称(模糊查询)
|
|
||||||
string referralPerson = 2 [json_name = "referralPerson"]; // 推荐人(模糊查询)
|
|
||||||
int32 page = 3 [json_name = "page"]; // 页码
|
|
||||||
int32 pageSize = 4 [json_name = "pageSize"]; // 每页数量
|
|
||||||
}
|
|
||||||
|
|
||||||
// 客户列表查询响应
|
|
||||||
message CustomerListResponse {
|
|
||||||
repeated CustomerInfo list = 1 [json_name = "list"]; // 客户列表
|
|
||||||
int64 total = 2 [json_name = "total"]; // 总数
|
|
||||||
int32 page = 3 [json_name = "page"]; // 当前页码
|
|
||||||
int32 pageSize = 4 [json_name = "pageSize"]; // 每页数量
|
|
||||||
}
|
|
||||||
|
|
||||||
// 客户详情查询请求
|
|
||||||
message CustomerDetailRequest {
|
|
||||||
string customerID = 1 [json_name = "customerID"]; // 客户ID
|
|
||||||
}
|
|
||||||
|
|
||||||
// 客户详情查询响应
|
|
||||||
message CustomerDetailResponse {
|
|
||||||
Customer customer = 1 [json_name = "customer"]; // 客户信息
|
|
||||||
string msg = 2 [json_name = "msg"]; // 消息
|
|
||||||
}
|
|
||||||
|
|
||||||
// 更新客户请求(根据action判断新增/更新/删除)
|
|
||||||
message CustomerUpdateRequest {
|
|
||||||
string action = 1 [json_name = "action"]; // 操作类型:create=新增,update=更新,delete=删除
|
|
||||||
Customer Customer = 2 [json_name = "customer"]; // 客户信息(删除时只需要customerID)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 客户信息
|
|
||||||
message CustomerInfo {
|
|
||||||
string customerID = 1 [json_name = "customerID"]; // 客户ID
|
|
||||||
string customerName = 2 [json_name = "customerName"]; // 客户名称
|
|
||||||
string authorizedRepresentative = 3 [json_name = "authorizedRepresentative"]; // 授权代表
|
|
||||||
string registrationAddress = 4 [json_name = "registrationAddress"]; // 注册地址
|
|
||||||
string referralPerson = 6 [json_name = "referralPerson"]; // 推荐人
|
|
||||||
string operator = 7 [json_name = "operator"]; // 操作人
|
|
||||||
string operatorTime = 10 [json_name = "operatorTime"]; // 操作时间
|
|
||||||
}
|
|
||||||
|
|
||||||
message Customer {
|
|
||||||
string customerID = 1 [json_name = "customerID"]; // 客户ID
|
|
||||||
string customerName = 2 [json_name = "customerName"]; // 客户名称
|
|
||||||
string authorizedRepresentative = 3 [json_name = "authorizedRepresentative"]; // 授权代表
|
|
||||||
string registrationAddress = 4 [json_name = "registrationAddress"]; // 注册地址
|
|
||||||
string referralPerson = 6 [json_name = "referralPerson"]; // 推荐人
|
|
||||||
string operator = 7 [json_name = "operator"]; // 操作人
|
|
||||||
string operatorID = 8 [json_name = "operatorID"]; // 操作人ID
|
|
||||||
string operatorNum = 9 [json_name = "operatorNum"]; // 操作人账号
|
|
||||||
string operatorTime = 10 [json_name = "operatorTime"]; // 操作时间
|
|
||||||
string createdAt = 11 [json_name = "createdAt"]; // 创建时间
|
|
||||||
string updatedAt = 12 [json_name = "updatedAt"]; // 更新时间
|
|
||||||
}
|
|
||||||
|
|
||||||
// 推荐人列表查询请求
|
|
||||||
message ReferralPersonListRequest {
|
|
||||||
string keyword = 1 [json_name = "keyword"]; // 推荐人关键字,支持模糊查询,为空则查询所有
|
|
||||||
}
|
|
||||||
|
|
||||||
// 推荐人列表查询响应
|
|
||||||
message ReferralPersonListResponse {
|
|
||||||
repeated string list = 1 [json_name = "list"]; // 推荐人列表
|
|
||||||
string msg = 2 [json_name = "msg"]; // 消息
|
|
||||||
}
|
|
||||||
|
|
||||||
// 合同管理相关消息定义
|
|
||||||
message ContractUpdateRequest {
|
|
||||||
string action = 1 [json_name = "action"]; // 操作类型:create=新增,update=更新,delete=删除
|
|
||||||
Contract contract = 2 [json_name = "contract"]; // 合同信息(删除时只需要contractUUID)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 合同列表查询请求
|
|
||||||
message ContractListRequest {
|
|
||||||
string contractName = 1 [json_name = "contractName"]; // 合同名称(模糊查询)
|
|
||||||
string projectName = 2 [json_name = "projectName"]; // 项目名称(模糊查询)
|
|
||||||
string customerName = 3 [json_name = "customerName"]; // 客户名称(模糊查询)
|
|
||||||
int32 page = 4 [json_name = "page"]; // 页码
|
|
||||||
int32 pageSize = 5 [json_name = "pageSize"]; // 每页数量
|
|
||||||
}
|
|
||||||
|
|
||||||
// 合同列表查询响应
|
|
||||||
message ContractListResponse {
|
|
||||||
repeated ContractInfo list = 1 [json_name = "list"]; // 合同列表
|
|
||||||
int64 total = 2 [json_name = "total"]; // 总数
|
|
||||||
int32 page = 3 [json_name = "page"]; // 当前页码
|
|
||||||
int32 pageSize = 4 [json_name = "pageSize"]; // 每页数量
|
|
||||||
}
|
|
||||||
|
|
||||||
// 合同详情查询请求
|
|
||||||
message ContractDetailRequest {
|
|
||||||
string contractUUID = 1 [json_name = "contractUUID"]; // 合同UUID
|
|
||||||
}
|
|
||||||
|
|
||||||
// 合同详情查询响应
|
|
||||||
message ContractDetailResponse {
|
|
||||||
Contract contract = 1 [json_name = "contract"]; // 合同信息
|
|
||||||
string msg = 2 [json_name = "msg"]; // 消息
|
|
||||||
}
|
|
||||||
|
|
||||||
// 根据合同UUID查询开发周期请求
|
|
||||||
message GetDevelopmentCyclesByContractUUIDRequest {
|
|
||||||
string contractUUID = 1 [json_name = "contractUUID"]; // 合同UUID
|
|
||||||
}
|
|
||||||
|
|
||||||
// 根据合同UUID查询开发周期响应
|
|
||||||
message GetDevelopmentCyclesByContractUUIDResponse {
|
|
||||||
repeated DevelopmentCycle list = 1 [json_name = "list"]; // 开发周期列表
|
|
||||||
string msg = 2 [json_name = "msg"]; // 消息
|
|
||||||
}
|
|
||||||
|
|
||||||
// 根据合同UUID查询支付周期请求
|
|
||||||
message GetPaymentCyclesByContractUUIDRequest {
|
|
||||||
string contractUUID = 1 [json_name = "contractUUID"]; // 合同UUID
|
|
||||||
}
|
|
||||||
|
|
||||||
// 根据合同UUID查询支付周期响应
|
|
||||||
message GetPaymentCyclesByContractUUIDResponse {
|
|
||||||
repeated ContractPaymentCycle list = 1 [json_name = "list"]; // 支付周期列表
|
|
||||||
string msg = 2 [json_name = "msg"]; // 消息
|
|
||||||
}
|
|
||||||
|
|
||||||
// 附件项:每个附件包含 URL 与展示用的文件名
|
|
||||||
message AttachmentItem {
|
|
||||||
string url = 1 [json_name = "url"]; // 附件地址
|
|
||||||
string fileName = 2 [json_name = "fileName"]; // 文件名称(展示用)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 合同信息(列表用)
|
|
||||||
message ContractInfo {
|
|
||||||
string contractUUID = 1 [json_name = "contractUUID"]; // 合同UUID
|
|
||||||
string contractName = 2 [json_name = "contractName"]; // 合同名称
|
|
||||||
string projectName = 3 [json_name = "projectName"]; // 项目名称
|
|
||||||
string customerName = 4 [json_name = "customerName"]; // 客户名称
|
|
||||||
string contractorName = 5 [json_name = "contractorName"]; // 承办商名称
|
|
||||||
string signingDate = 6 [json_name = "signingDate"]; // 签署日期
|
|
||||||
string effectiveDate = 7 [json_name = "effectiveDate"]; // 生效日期
|
|
||||||
double contractAmount = 8 [json_name = "contractAmount"]; // 合同金额
|
|
||||||
int32 contractCurrencyType = 9 [json_name = "contractCurrencyType"]; // 合同货币类型
|
|
||||||
string contractPaymentCycle = 10 [json_name = "contractPaymentCycle"]; // 支付周期
|
|
||||||
string developmentCycle = 11 [json_name = "developmentCycle"]; // 开发周期
|
|
||||||
double qualityAssuranceFee = 12 [json_name = "qualityAssuranceFee"]; // 质量保证金额
|
|
||||||
int32 qualityAssuranceCurrencyType = 13 [json_name = "qualityAssuranceCurrencyType"]; // 质量保证金货币类型
|
|
||||||
int32 maintenanceCycleType = 14 [json_name = "maintenanceCycleType"]; // 维护周期类型
|
|
||||||
double maintenanceFee = 15 [json_name = "maintenanceFee"]; // 维护费用
|
|
||||||
int32 maintenanceCurrencyType = 16 [json_name = "maintenanceCurrencyType"]; // 维护货币类型
|
|
||||||
repeated AttachmentItem contractAttachments = 17 [json_name = "contractAttachments"]; // 合同附件(含url+fileName)
|
|
||||||
repeated AttachmentItem otherAttachments = 18 [json_name = "otherAttachments"]; // 其他附件(含url+fileName)
|
|
||||||
string operator = 19 [json_name = "operator"]; // 操作人
|
|
||||||
string operatorTime = 22 [json_name = "operatorTime"]; // 操作时间
|
|
||||||
}
|
|
||||||
|
|
||||||
// 合同信息(详情用)
|
|
||||||
message Contract {
|
|
||||||
string contractUUID = 1 [json_name = "contractUUID"]; // 合同UUID
|
|
||||||
string contractName = 2 [json_name = "contractName"]; // 合同名称
|
|
||||||
string projectName = 3 [json_name = "projectName"]; // 项目名称
|
|
||||||
string customerName = 4 [json_name = "customerName"]; // 客户名称
|
|
||||||
string contractorName = 5 [json_name = "contractorName"]; // 承办商名称
|
|
||||||
string signingDate = 6 [json_name = "signingDate"]; // 签署日期
|
|
||||||
string effectiveDate = 7 [json_name = "effectiveDate"]; // 生效日期
|
|
||||||
double contractAmount = 8 [json_name = "contractAmount"]; // 合同金额
|
|
||||||
int32 contractCurrencyType = 9 [json_name = "contractCurrencyType"]; // 合同货币类型
|
|
||||||
string contractPaymentCycle = 10 [json_name = "contractPaymentCycle"]; // 支付周期
|
|
||||||
string developmentCycle = 11 [json_name = "developmentCycle"]; // 开发周期
|
|
||||||
int64 maintenanceCycleType = 12 [json_name = "maintenanceCycleType"]; // 维护周期类型
|
|
||||||
double maintenanceFee = 13 [json_name = "maintenanceFee"]; // 维护费用
|
|
||||||
int32 maintenanceCurrencyType = 14 [json_name = "maintenanceCurrencyType"]; // 维护货币类型
|
|
||||||
double qualityAssuranceFee = 15 [json_name = "qualityAssuranceFee"]; // 质量保证金额
|
|
||||||
int32 qualityAssuranceCurrencyType = 16 [json_name = "qualityAssuranceCurrencyType"]; // 质量保证金货币类型
|
|
||||||
repeated AttachmentItem contractAttachments = 17 [json_name = "contractAttachments"]; // 合同附件(含url+fileName)
|
|
||||||
repeated AttachmentItem otherAttachments = 18 [json_name = "otherAttachments"]; // 其他附件(含url+fileName)
|
|
||||||
string operator = 19 [json_name = "operator"]; // 操作人
|
|
||||||
string operatorID = 20 [json_name = "operatorID"]; // 操作人ID
|
|
||||||
string operatorNum = 21 [json_name = "operatorNum"]; // 操作人账号
|
|
||||||
string operatorTime = 23 [json_name = "operatorTime"]; // 操作时间
|
|
||||||
repeated ContractPaymentCycle paymentCycles = 24 [json_name = "paymentCycles"]; // 支付周期子表数组
|
|
||||||
repeated DevelopmentCycle developmentCycles = 25 [json_name = "developmentCycles"]; // 开发周期子表数组
|
|
||||||
}
|
|
||||||
|
|
||||||
// 支付周期子表
|
|
||||||
message ContractPaymentCycle {
|
|
||||||
string contractPaymentCycleUUID = 1 [json_name = "contractPaymentCycleUUID"]; // 合同支付周期UUID
|
|
||||||
string contractUUID = 2 [json_name = "contractUUID"]; // 合同UUID
|
|
||||||
int32 paymentCyclePeriod = 3 [json_name = "paymentCyclePeriod"]; // 支付周期第几期
|
|
||||||
string deliveryTime = 4 [json_name = "deliveryTime"]; // 交付时间点
|
|
||||||
double contractPaymentCycleAmount = 5 [json_name = "contractPaymentCycleAmount"]; // 合同支付周期金额
|
|
||||||
int32 paymentCycleCurrencyType = 6 [json_name = "paymentCycleCurrencyType"]; // 支付周期货币类型
|
|
||||||
}
|
|
||||||
|
|
||||||
// 开发周期子表
|
|
||||||
message DevelopmentCycle {
|
|
||||||
string developmentCycleUUID = 1 [json_name = "developmentCycleUUID"]; // 开发周期UUID
|
|
||||||
string contractUUID = 2 [json_name = "contractUUID"]; // 合同UUID
|
|
||||||
int32 developmentPeriod = 3 [json_name = "developmentPeriod"]; // 开发第几期
|
|
||||||
string developmentTime = 4 [json_name = "developmentTime"]; // 开发时间
|
|
||||||
repeated AttachmentItem attachments = 5 [json_name = "attachments"]; // 附件(含url+fileName)
|
|
||||||
string deliveryContent = 6 [json_name = "deliveryContent"]; // 交付内容
|
|
||||||
}
|
|
||||||
|
|
||||||
message CreateInvoiceReq{
|
|
||||||
string userId = 1;
|
|
||||||
string userNum = 2;
|
|
||||||
string userName = 3;
|
|
||||||
string orderNo = 4;
|
|
||||||
string applyTime = 5;
|
|
||||||
int32 invoiceType = 6;
|
|
||||||
string invoiceNo = 7;
|
|
||||||
string invoiceUrl = 8;
|
|
||||||
int64 paperInvocieStatus = 9;
|
|
||||||
string remark = 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
message CreateInvoiceResp{
|
|
||||||
}
|
|
||||||
|
|
||||||
message CreatePaperInvoiceAddressReq{
|
|
||||||
string userId = 1;
|
|
||||||
string orderNo = 2;
|
|
||||||
string invoiceNo = 3;
|
|
||||||
string applyTime = 4;
|
|
||||||
string name = 5;
|
|
||||||
string telAreaCode = 6;
|
|
||||||
string phone = 7;
|
|
||||||
string postalCode = 8;
|
|
||||||
string country = 9;
|
|
||||||
string address = 10;
|
|
||||||
string remark = 11;
|
|
||||||
}
|
|
||||||
|
|
||||||
message CreatePaperInvoiceAddressResp{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
message InvoiceInfo{
|
|
||||||
string name = 1;
|
|
||||||
string phone = 2;
|
|
||||||
string country = 3;
|
|
||||||
string address = 4;
|
|
||||||
string applyTime = 5;
|
|
||||||
string userName = 6;
|
|
||||||
string userNum = 7;
|
|
||||||
string orderNo = 8;
|
|
||||||
string invoiceNo = 9;
|
|
||||||
string invoiceUrl = 10;
|
|
||||||
int64 paperInvocieStatus = 11;
|
|
||||||
}
|
|
||||||
|
|
||||||
message GetInvoiceListReq{
|
|
||||||
int64 size = 1;
|
|
||||||
int64 page = 2;
|
|
||||||
int64 isApplyInvocice = 3;
|
|
||||||
int64 isExpress = 4;
|
|
||||||
string applyTimeStart = 5;
|
|
||||||
string applyTimeEnd = 6;
|
|
||||||
string name = 7;
|
|
||||||
string phone = 8;
|
|
||||||
string country = 9;
|
|
||||||
string userName = 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
message GetInvoiceListResp{
|
|
||||||
repeated InvoiceInfo data = 1;
|
|
||||||
int64 total = 2;
|
|
||||||
int64 page = 3;
|
|
||||||
int64 size = 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
message UpdateInvoiceExpressInfoReq{
|
|
||||||
string orderNo = 1;
|
|
||||||
string expressCompany = 2;
|
|
||||||
string expressNo = 3;
|
|
||||||
string remark = 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
message UpdateInvoiceExpressInfoResp{
|
|
||||||
}
|
|
||||||
|
|
||||||
message GetInvoiceExpressInfoReq{
|
|
||||||
string orderNo = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
message GetInvoiceExpressInfoResp{
|
|
||||||
string expressCompany = 1;
|
|
||||||
string expressNo = 2;
|
|
||||||
string remark = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
message GetOrderInfoByOrderNoReq{
|
|
||||||
string uuid = 1;
|
|
||||||
string orderNo = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
message GetOrderInfoByOrderNoResp{
|
|
||||||
string userName = 1;
|
|
||||||
string userId = 2;
|
|
||||||
string userNum = 3;
|
|
||||||
string totalAmount = 4;
|
|
||||||
string bundleName = 5;
|
|
||||||
int64 AmountType = 6;
|
|
||||||
string address = 7;
|
|
||||||
string phone = 8;
|
|
||||||
string orderNo = 9;
|
|
||||||
string payTime = 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
message WorkCastInfo{
|
message WorkCastInfo{
|
||||||
string customerName = 1;
|
string customerName = 1;
|
||||||
string customerNum = 2;
|
string customerNum = 2;
|
||||||
@ -2343,127 +1941,3 @@ message ExportWorkCastInfoReq{
|
|||||||
message ExportWorkCastInfoResp{
|
message ExportWorkCastInfoResp{
|
||||||
repeated WorkCastInfo data = 1;
|
repeated WorkCastInfo data = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
message OrderInfoByOrderUuidRequest{
|
|
||||||
string orderUuid = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
message GetInvoiceInfoByOrderNoReq{
|
|
||||||
string userId = 1;
|
|
||||||
string orderNo = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
message InvoiceInfoByOrderNo{
|
|
||||||
string orderNo = 1;
|
|
||||||
string invoiceNo = 2;
|
|
||||||
string invoiceUrl = 3;
|
|
||||||
string bundleName = 4;
|
|
||||||
int64 amountType = 5;
|
|
||||||
string totalAmount = 6;
|
|
||||||
string payTime = 7;
|
|
||||||
int64 paperInvocieStatus = 8;
|
|
||||||
}
|
|
||||||
|
|
||||||
message GetInvoiceInfoByOrderNoResp{
|
|
||||||
repeated InvoiceInfoByOrderNo data = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
message GetLastInvoiceNoReq{
|
|
||||||
}
|
|
||||||
|
|
||||||
message GetLastInvoiceNoResp{
|
|
||||||
string lastNo = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
message UpdataInvoiceInfoReq{
|
|
||||||
string orderNo = 1;
|
|
||||||
string url = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
message UpdataInvoiceInfoResp{
|
|
||||||
}
|
|
||||||
|
|
||||||
message SendQuestionnaireSurveyRequest{
|
|
||||||
string endTime = 1;
|
|
||||||
string userTel = 2;
|
|
||||||
string surveyTitle = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
message SendQuestionnaireSurveyResponse{
|
|
||||||
int32 status = 1;//0 查询到用户信息 1 未查询到对应用户 2该用户已发送过问卷
|
|
||||||
}
|
|
||||||
|
|
||||||
message GetQuestionnaireSurveyInfoRequest{
|
|
||||||
string userTel = 1;
|
|
||||||
}
|
|
||||||
message SurveyBundleInfo{
|
|
||||||
string bundleName = 1;
|
|
||||||
string startAt = 2;
|
|
||||||
string expiredAt = 3;
|
|
||||||
int32 bundleAccountNumber = 4;
|
|
||||||
int32 bundleVideoNumber = 5;
|
|
||||||
int32 increaseVideoNumber = 6;
|
|
||||||
int32 bundleImageNumber = 7;
|
|
||||||
int32 bundleDataNumber = 8;
|
|
||||||
int32 bundleCompetitiveNumber = 9;
|
|
||||||
}
|
|
||||||
|
|
||||||
message GetQuestionnaireSurveyInfoResponse{
|
|
||||||
string userName = 1;
|
|
||||||
SurveyBundleInfo bundleInfo = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
message SurveyAnswer {
|
|
||||||
int32 BundleAccountScore = 1;
|
|
||||||
int32 BundleVideoScore = 2;
|
|
||||||
int32 IncreaseVideoScore = 3;
|
|
||||||
int32 BundleImageScore = 4;
|
|
||||||
int32 BundleDataScore = 5;
|
|
||||||
int32 BundleCompetitiveScore = 6;
|
|
||||||
int32 ServiceResponseSpeed = 7;
|
|
||||||
int32 ServiceStaffProfessionalism = 8;
|
|
||||||
}
|
|
||||||
|
|
||||||
message SurveyFeedback {
|
|
||||||
string MeritsReview = 1;
|
|
||||||
string SuggestionsorImprovements = 2;
|
|
||||||
string AdditionalComments = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
message CreateQuestionnaireSurveyAnswerRequest{
|
|
||||||
string userTel = 1;
|
|
||||||
SurveyAnswer surveyAnswer = 2;
|
|
||||||
SurveyFeedback surveyFeedback = 3;
|
|
||||||
string surveyUrl = 4;
|
|
||||||
string submitTime = 5;
|
|
||||||
string submitBy = 6;
|
|
||||||
string longitude = 7;
|
|
||||||
string latitude = 8;
|
|
||||||
}
|
|
||||||
|
|
||||||
message CreateQuestionnaireSurveyAnswerResponse{
|
|
||||||
}
|
|
||||||
|
|
||||||
message GetQuestionnaireSurveyListRequest{
|
|
||||||
int32 page = 1;
|
|
||||||
int32 pageSize = 2;
|
|
||||||
string userName = 3;
|
|
||||||
string surveyTitle = 4;
|
|
||||||
int32 surveyStatus = 5;
|
|
||||||
}
|
|
||||||
|
|
||||||
message SurveyListInfo{
|
|
||||||
string userName = 1;
|
|
||||||
string userTel = 2;
|
|
||||||
string userNum = 3;
|
|
||||||
string surveyTitle = 4;
|
|
||||||
int32 surveyStatus = 5;
|
|
||||||
string surveyUrl = 6;
|
|
||||||
}
|
|
||||||
|
|
||||||
message GetQuestionnaireSurveyListResponse{
|
|
||||||
repeated SurveyListInfo surveyList = 1;
|
|
||||||
int32 total = 2;
|
|
||||||
int32 page = 3;
|
|
||||||
int32 size = 4;
|
|
||||||
}
|
|
||||||
10270
pb/bundle/bundle.pb.go
10270
pb/bundle/bundle.pb.go
File diff suppressed because it is too large
Load Diff
@ -7,8 +7,8 @@ import (
|
|||||||
fmt "fmt"
|
fmt "fmt"
|
||||||
math "math"
|
math "math"
|
||||||
proto "github.com/golang/protobuf/proto"
|
proto "github.com/golang/protobuf/proto"
|
||||||
_ "google.golang.org/protobuf/types/descriptorpb"
|
|
||||||
_ "github.com/mwitkow/go-proto-validators"
|
_ "github.com/mwitkow/go-proto-validators"
|
||||||
|
_ "google.golang.org/protobuf/types/descriptorpb"
|
||||||
github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators"
|
github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -749,22 +749,6 @@ func (this *SetPendingTaskLayoutReq) Validate() error {
|
|||||||
func (this *SetPendingTaskLayoutResp) Validate() error {
|
func (this *SetPendingTaskLayoutResp) Validate() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
func (this *TaskWorkLogQueryRequest) Validate() error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (this *TaskWorkLogInfo) Validate() error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (this *TaskWorkLogQueryResponse) Validate() error {
|
|
||||||
for _, item := range this.Records {
|
|
||||||
if item != nil {
|
|
||||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
|
||||||
return github_com_mwitkow_go_proto_validators.FieldError("Records", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (this *CreateTaskWorkLogRequest) Validate() error {
|
func (this *CreateTaskWorkLogRequest) Validate() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -837,218 +821,6 @@ func (this *MetricsVideoSubmitExportItem) Validate() error {
|
|||||||
func (this *MetricsBalanceDetailExportReq) Validate() error {
|
func (this *MetricsBalanceDetailExportReq) Validate() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
func (this *CustomerListRequest) Validate() error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (this *CustomerListResponse) Validate() error {
|
|
||||||
for _, item := range this.List {
|
|
||||||
if item != nil {
|
|
||||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
|
||||||
return github_com_mwitkow_go_proto_validators.FieldError("List", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (this *CustomerDetailRequest) Validate() error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (this *CustomerDetailResponse) Validate() error {
|
|
||||||
if this.Customer != nil {
|
|
||||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Customer); err != nil {
|
|
||||||
return github_com_mwitkow_go_proto_validators.FieldError("Customer", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (this *CustomerUpdateRequest) Validate() error {
|
|
||||||
if this.Customer != nil {
|
|
||||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Customer); err != nil {
|
|
||||||
return github_com_mwitkow_go_proto_validators.FieldError("Customer", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (this *CustomerInfo) Validate() error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (this *Customer) Validate() error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (this *ReferralPersonListRequest) Validate() error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (this *ReferralPersonListResponse) Validate() error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (this *ContractUpdateRequest) Validate() error {
|
|
||||||
if this.Contract != nil {
|
|
||||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Contract); err != nil {
|
|
||||||
return github_com_mwitkow_go_proto_validators.FieldError("Contract", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (this *ContractListRequest) Validate() error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (this *ContractListResponse) Validate() error {
|
|
||||||
for _, item := range this.List {
|
|
||||||
if item != nil {
|
|
||||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
|
||||||
return github_com_mwitkow_go_proto_validators.FieldError("List", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (this *ContractDetailRequest) Validate() error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (this *ContractDetailResponse) Validate() error {
|
|
||||||
if this.Contract != nil {
|
|
||||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Contract); err != nil {
|
|
||||||
return github_com_mwitkow_go_proto_validators.FieldError("Contract", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (this *GetDevelopmentCyclesByContractUUIDRequest) Validate() error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (this *GetDevelopmentCyclesByContractUUIDResponse) Validate() error {
|
|
||||||
for _, item := range this.List {
|
|
||||||
if item != nil {
|
|
||||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
|
||||||
return github_com_mwitkow_go_proto_validators.FieldError("List", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (this *GetPaymentCyclesByContractUUIDRequest) Validate() error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (this *GetPaymentCyclesByContractUUIDResponse) Validate() error {
|
|
||||||
for _, item := range this.List {
|
|
||||||
if item != nil {
|
|
||||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
|
||||||
return github_com_mwitkow_go_proto_validators.FieldError("List", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (this *AttachmentItem) Validate() error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (this *ContractInfo) Validate() error {
|
|
||||||
for _, item := range this.ContractAttachments {
|
|
||||||
if item != nil {
|
|
||||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
|
||||||
return github_com_mwitkow_go_proto_validators.FieldError("ContractAttachments", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for _, item := range this.OtherAttachments {
|
|
||||||
if item != nil {
|
|
||||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
|
||||||
return github_com_mwitkow_go_proto_validators.FieldError("OtherAttachments", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (this *Contract) Validate() error {
|
|
||||||
for _, item := range this.ContractAttachments {
|
|
||||||
if item != nil {
|
|
||||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
|
||||||
return github_com_mwitkow_go_proto_validators.FieldError("ContractAttachments", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for _, item := range this.OtherAttachments {
|
|
||||||
if item != nil {
|
|
||||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
|
||||||
return github_com_mwitkow_go_proto_validators.FieldError("OtherAttachments", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for _, item := range this.PaymentCycles {
|
|
||||||
if item != nil {
|
|
||||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
|
||||||
return github_com_mwitkow_go_proto_validators.FieldError("PaymentCycles", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for _, item := range this.DevelopmentCycles {
|
|
||||||
if item != nil {
|
|
||||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
|
||||||
return github_com_mwitkow_go_proto_validators.FieldError("DevelopmentCycles", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (this *ContractPaymentCycle) Validate() error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (this *DevelopmentCycle) Validate() error {
|
|
||||||
for _, item := range this.Attachments {
|
|
||||||
if item != nil {
|
|
||||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
|
||||||
return github_com_mwitkow_go_proto_validators.FieldError("Attachments", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (this *CreateInvoiceReq) Validate() error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (this *CreateInvoiceResp) Validate() error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (this *CreatePaperInvoiceAddressReq) Validate() error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (this *CreatePaperInvoiceAddressResp) Validate() error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (this *InvoiceInfo) Validate() error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (this *GetInvoiceListReq) Validate() error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (this *GetInvoiceListResp) Validate() error {
|
|
||||||
for _, item := range this.Data {
|
|
||||||
if item != nil {
|
|
||||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
|
||||||
return github_com_mwitkow_go_proto_validators.FieldError("Data", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (this *UpdateInvoiceExpressInfoReq) Validate() error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (this *UpdateInvoiceExpressInfoResp) Validate() error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (this *GetInvoiceExpressInfoReq) Validate() error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (this *GetInvoiceExpressInfoResp) Validate() error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (this *GetOrderInfoByOrderNoReq) Validate() error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (this *GetOrderInfoByOrderNoResp) Validate() error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (this *WorkCastInfo) Validate() error {
|
func (this *WorkCastInfo) Validate() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -1065,92 +837,3 @@ func (this *ExportWorkCastInfoResp) Validate() error {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
func (this *OrderInfoByOrderUuidRequest) Validate() error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (this *GetInvoiceInfoByOrderNoReq) Validate() error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (this *InvoiceInfoByOrderNo) Validate() error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (this *GetInvoiceInfoByOrderNoResp) Validate() error {
|
|
||||||
for _, item := range this.Data {
|
|
||||||
if item != nil {
|
|
||||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
|
||||||
return github_com_mwitkow_go_proto_validators.FieldError("Data", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (this *GetLastInvoiceNoReq) Validate() error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (this *GetLastInvoiceNoResp) Validate() error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (this *UpdataInvoiceInfoReq) Validate() error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (this *UpdataInvoiceInfoResp) Validate() error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (this *SendQuestionnaireSurveyRequest) Validate() error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (this *SendQuestionnaireSurveyResponse) Validate() error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (this *GetQuestionnaireSurveyInfoRequest) Validate() error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (this *SurveyBundleInfo) Validate() error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (this *GetQuestionnaireSurveyInfoResponse) Validate() error {
|
|
||||||
if this.BundleInfo != nil {
|
|
||||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.BundleInfo); err != nil {
|
|
||||||
return github_com_mwitkow_go_proto_validators.FieldError("BundleInfo", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (this *SurveyAnswer) Validate() error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (this *SurveyFeedback) Validate() error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (this *CreateQuestionnaireSurveyAnswerRequest) Validate() error {
|
|
||||||
if this.SurveyAnswer != nil {
|
|
||||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.SurveyAnswer); err != nil {
|
|
||||||
return github_com_mwitkow_go_proto_validators.FieldError("SurveyAnswer", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if this.SurveyFeedback != nil {
|
|
||||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.SurveyFeedback); err != nil {
|
|
||||||
return github_com_mwitkow_go_proto_validators.FieldError("SurveyFeedback", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (this *CreateQuestionnaireSurveyAnswerResponse) Validate() error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (this *GetQuestionnaireSurveyListRequest) Validate() error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (this *SurveyListInfo) Validate() error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (this *GetQuestionnaireSurveyListResponse) Validate() error {
|
|
||||||
for _, item := range this.SurveyList {
|
|
||||||
if item != nil {
|
|
||||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
|
||||||
return github_com_mwitkow_go_proto_validators.FieldError("SurveyList", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -62,13 +62,6 @@ func loadMysqlConn(conn string) *gorm.DB {
|
|||||||
// &model.Reconciliation{},
|
// &model.Reconciliation{},
|
||||||
&model.BundleActivate{},
|
&model.BundleActivate{},
|
||||||
&model.BundleBalanceLayout{},
|
&model.BundleBalanceLayout{},
|
||||||
&model.Contract{},
|
|
||||||
&model.ContractPaymentCycle{},
|
|
||||||
&model.DevelopmentCycle{},
|
|
||||||
&model.Customer{},
|
|
||||||
&model.Invoice{},
|
|
||||||
&model.PaperInvoiceAddress{},
|
|
||||||
&model.QuestionnaireSurvey{},
|
|
||||||
)
|
)
|
||||||
if db.Migrator().HasColumn(&model.BundleOrderRecords{}, "platform_ids") == false {
|
if db.Migrator().HasColumn(&model.BundleOrderRecords{}, "platform_ids") == false {
|
||||||
if err := db.Migrator().AddColumn(&model.BundleOrderRecords{}, "platform_ids"); err != nil {
|
if err := db.Migrator().AddColumn(&model.BundleOrderRecords{}, "platform_ids"); err != nil {
|
||||||
@ -132,6 +125,7 @@ func loadTaskBenchMysqlConn(conn string) *gorm.DB {
|
|||||||
&model.TaskManagement{},
|
&model.TaskManagement{},
|
||||||
&model.TaskAssignRecords{},
|
&model.TaskAssignRecords{},
|
||||||
// &model.TaskBalance{},
|
// &model.TaskBalance{},
|
||||||
|
&model.TaskSyncStatus{},
|
||||||
&model.TaskPendingLayout{},
|
&model.TaskPendingLayout{},
|
||||||
&model.TaskAssignUUIDItems{},
|
&model.TaskAssignUUIDItems{},
|
||||||
// 隐藏人员人记录表
|
// 隐藏人员人记录表
|
||||||
|
|||||||
@ -126,11 +126,3 @@ const (
|
|||||||
IsExpired = 1 //已过期
|
IsExpired = 1 //已过期
|
||||||
NotExpired = 0 //未过期
|
NotExpired = 0 //未过期
|
||||||
)
|
)
|
||||||
|
|
||||||
// 问卷状态
|
|
||||||
const (
|
|
||||||
//已发送
|
|
||||||
QuestionnaireSent = 1
|
|
||||||
//已提交
|
|
||||||
QuestionnaireSubmitted = 2
|
|
||||||
)
|
|
||||||
|
|||||||
@ -9,7 +9,7 @@ const source = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
|||||||
|
|
||||||
// 生成订单号 模版 BD20250220104501+6位随机数 避免 订单号重复
|
// 生成订单号 模版 BD20250220104501+6位随机数 避免 订单号重复
|
||||||
func GetOrderNo() string {
|
func GetOrderNo() string {
|
||||||
return "BD" + GetRandomString(20)
|
return "BD" + time.Now().Format("20060102150405") + GetRandomString(6)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 生成随机字符串
|
// 生成随机字符串
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user