feat: add project work orders
This commit is contained in:
@@ -345,3 +345,87 @@ type AftersalesPublicView struct {
|
||||
ResponsibleSignature string `json:"responsibleSignature,omitempty"`
|
||||
SiteImages []string `json:"siteImages,omitempty"`
|
||||
}
|
||||
|
||||
// ProjectOrder 项目工单模型
|
||||
type ProjectOrder struct {
|
||||
ID uint `gorm:"primaryKey" json:"id"`
|
||||
SerialNumber string `gorm:"uniqueIndex;size:64" json:"serialNumber"`
|
||||
CompanyName string `gorm:"index;size:255" json:"companyName"`
|
||||
CompanyAddress string `gorm:"size:500" json:"companyAddress"`
|
||||
ContactName string `gorm:"size:100" json:"contactName"`
|
||||
ContactPhone string `gorm:"size:32" json:"contactPhone"`
|
||||
ProjectType string `gorm:"size:32" json:"projectType"`
|
||||
SiteDescription string `gorm:"type:text" json:"siteDescription"`
|
||||
CompletionNote string `gorm:"type:text" json:"completionNote"`
|
||||
WorkOrderStatus string `gorm:"size:32;default:'created'" json:"workOrderStatus"`
|
||||
|
||||
TechnicianID *uint `json:"technicianId"`
|
||||
CreatedBy *uint `json:"createdBy"`
|
||||
ScannedAt *time.Time `json:"scannedAt"`
|
||||
CompletedAt *time.Time `json:"completedAt"`
|
||||
EngineerSignature string `gorm:"type:text" json:"engineerSignature,omitempty"`
|
||||
SiteImagesJSON string `gorm:"type:text;column:site_images" json:"-"`
|
||||
SiteImages []string `gorm:"-" json:"siteImages,omitempty"`
|
||||
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
UpdatedAt time.Time `json:"updatedAt"`
|
||||
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
|
||||
|
||||
Technician *User `gorm:"foreignKey:TechnicianID" json:"technician,omitempty"`
|
||||
Creator *User `gorm:"foreignKey:CreatedBy" json:"creator,omitempty"`
|
||||
}
|
||||
|
||||
// CreateProjectOrderDTO 创建项目工单请求数据
|
||||
type CreateProjectOrderDTO struct {
|
||||
CompanyName string `json:"companyName" validate:"required"`
|
||||
CompanyAddress string `json:"companyAddress" validate:"required"`
|
||||
ContactName string `json:"contactName" validate:"required"`
|
||||
ContactPhone string `json:"contactPhone" validate:"required,len=11"`
|
||||
ProjectType string `json:"projectType" validate:"required,oneof=survey implementation maintenance other"`
|
||||
SiteDescription string `json:"siteDescription" validate:"required"`
|
||||
TechnicianID *uint `json:"technicianId,omitempty"`
|
||||
}
|
||||
|
||||
// UpdateProjectOrderDTO 更新项目工单请求数据
|
||||
type UpdateProjectOrderDTO struct {
|
||||
CompanyAddress string `json:"companyAddress,omitempty"`
|
||||
ContactName string `json:"contactName,omitempty"`
|
||||
ContactPhone string `json:"contactPhone,omitempty" validate:"omitempty,len=11"`
|
||||
ProjectType string `json:"projectType,omitempty" validate:"omitempty,oneof=survey implementation maintenance other"`
|
||||
SiteDescription string `json:"siteDescription,omitempty"`
|
||||
CompletionNote string `json:"completionNote,omitempty"`
|
||||
TechnicianID *uint `json:"technicianId,omitempty"`
|
||||
}
|
||||
|
||||
// SubmitProjectCompletionDTO 提交完成资料请求
|
||||
type SubmitProjectCompletionDTO struct {
|
||||
CompletionNote string `json:"completionNote" validate:"required"`
|
||||
}
|
||||
|
||||
// ProjectEngineerCompleteDTO 工程师完成确认请求
|
||||
type ProjectEngineerCompleteDTO struct {
|
||||
EngineerSignature string `json:"engineerSignature" validate:"required"`
|
||||
CompletionNote string `json:"completionNote,omitempty"`
|
||||
}
|
||||
|
||||
// ReassignProjectOrderDTO 重新分配工程师请求
|
||||
type ReassignProjectOrderDTO struct {
|
||||
TechnicianID uint `json:"technicianId" validate:"required"`
|
||||
}
|
||||
|
||||
// ProjectOrderPublicView 公开查询返回视图
|
||||
type ProjectOrderPublicView struct {
|
||||
SerialNumber string `json:"serialNumber"`
|
||||
CompanyName string `json:"companyName"`
|
||||
CompanyAddress string `json:"companyAddress"`
|
||||
ContactName string `json:"contactName"`
|
||||
ProjectType string `json:"projectType"`
|
||||
SiteDescription string `json:"siteDescription"`
|
||||
CompletionNote string `json:"completionNote"`
|
||||
WorkOrderStatus string `json:"workOrderStatus"`
|
||||
TechnicianName string `json:"technicianName"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
CompletedAt *time.Time `json:"completedAt"`
|
||||
EngineerSignature string `json:"engineerSignature,omitempty"`
|
||||
SiteImages []string `json:"siteImages,omitempty"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user