updates
This commit is contained in:
parent
c195147a6e
commit
0d390100b4
|
|
@ -14,6 +14,7 @@ import (
|
||||||
"server/modules/yx/entity"
|
"server/modules/yx/entity"
|
||||||
"server/modules/yx/mapper"
|
"server/modules/yx/mapper"
|
||||||
"server/modules/yx/service"
|
"server/modules/yx/service"
|
||||||
|
"server/types"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
|
@ -207,7 +208,7 @@ func (s *UserScoreService) GetVolunteerDetail(userID string) (*vo.VolunteerDetai
|
||||||
EnrollProbability: r.EnrollProbability,
|
EnrollProbability: r.EnrollProbability,
|
||||||
StudentConvertedScore: r.StudentConvertedScore,
|
StudentConvertedScore: r.StudentConvertedScore,
|
||||||
CreateBy: r.CreateBy,
|
CreateBy: r.CreateBy,
|
||||||
CreateTime: r.CreateTime,
|
CreateTime: types.NewDateTime(r.CreateTime),
|
||||||
CalculationMajorID: r.CalculationMajorID,
|
CalculationMajorID: r.CalculationMajorID,
|
||||||
}
|
}
|
||||||
key := r.SchoolCode + "_" + r.MajorCode + "_" + r.EnrollmentCode
|
key := r.SchoolCode + "_" + r.MajorCode + "_" + r.EnrollmentCode
|
||||||
|
|
@ -249,9 +250,9 @@ func (s *UserScoreService) GetVolunteerDetail(userID string) (*vo.VolunteerDetai
|
||||||
CreateType: volunteer.CreateType,
|
CreateType: volunteer.CreateType,
|
||||||
State: volunteer.State,
|
State: volunteer.State,
|
||||||
CreateBy: volunteer.CreateBy,
|
CreateBy: volunteer.CreateBy,
|
||||||
CreateTime: volunteer.CreateTime,
|
CreateTime: types.NewDateTime(volunteer.CreateTime),
|
||||||
UpdateBy: volunteer.UpdateBy,
|
UpdateBy: volunteer.UpdateBy,
|
||||||
UpdateTime: volunteer.UpdateTime,
|
UpdateTime: types.NewDateTime(volunteer.UpdateTime),
|
||||||
}
|
}
|
||||||
itemMap := make(map[string][]vo.VolunteerDetailVO)
|
itemMap := make(map[string][]vo.VolunteerDetailVO)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,21 @@
|
||||||
package vo
|
package vo
|
||||||
|
|
||||||
import "time"
|
import "server/types"
|
||||||
|
|
||||||
// VolunteerDetailVO 志愿详情视图对象
|
// VolunteerDetailVO 志愿详情视图对象
|
||||||
type VolunteerDetailVO struct {
|
type VolunteerDetailVO struct {
|
||||||
ID string `json:"id"` // 志愿记录ID
|
ID string `json:"id"` // 志愿记录ID
|
||||||
VolunteerID string `json:"volunteerId"` // 志愿单ID
|
VolunteerID string `json:"volunteerId"` // 志愿单ID
|
||||||
SchoolCode string `json:"schoolCode"` // 院校代码
|
SchoolCode string `json:"schoolCode"` // 院校代码
|
||||||
MajorCode string `json:"majorCode"` // 专业代码
|
MajorCode string `json:"majorCode"` // 专业代码
|
||||||
EnrollmentCode string `json:"enrollmentCode"` // 招生代码
|
EnrollmentCode string `json:"enrollmentCode"` // 招生代码
|
||||||
Indexs int `json:"indexs"` // 志愿序号
|
Indexs int `json:"indexs"` // 志愿序号
|
||||||
Batch string `json:"batch"` // 批次
|
Batch string `json:"batch"` // 批次
|
||||||
EnrollProbability float64 `json:"enrollProbability"` // 录取概率
|
EnrollProbability float64 `json:"enrollProbability"` // 录取概率
|
||||||
StudentConvertedScore float64 `json:"studentConvertedScore"` // 学生折合分
|
StudentConvertedScore float64 `json:"studentConvertedScore"` // 学生折合分
|
||||||
CreateBy string `json:"createBy"` // 创建人
|
CreateBy string `json:"createBy"` // 创建人
|
||||||
CreateTime time.Time `json:"createTime"` // 创建时间
|
CreateTime types.DateTime `json:"createTime"` // 创建时间
|
||||||
CalculationMajorID string `json:"calculationMajorId"` // 计算专业ID
|
CalculationMajorID string `json:"calculationMajorId"` // 计算专业ID
|
||||||
// 扩展字段(来自 SchoolMajorDTO)
|
// 扩展字段(来自 SchoolMajorDTO)
|
||||||
SchoolName string `json:"schoolName"` // 院校名称
|
SchoolName string `json:"schoolName"` // 院校名称
|
||||||
MajorName string `json:"majorName"` // 专业名称
|
MajorName string `json:"majorName"` // 专业名称
|
||||||
|
|
@ -36,15 +36,15 @@ type VolunteerDetailResponse struct {
|
||||||
|
|
||||||
// VolunteerInfoVO 志愿单信息视图对象
|
// VolunteerInfoVO 志愿单信息视图对象
|
||||||
type VolunteerInfoVO struct {
|
type VolunteerInfoVO struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
VolunteerName string `json:"volunteerName"`
|
VolunteerName string `json:"volunteerName"`
|
||||||
ScoreId string `json:"scoreId"`
|
ScoreId string `json:"scoreId"`
|
||||||
CreateType string `json:"createType"`
|
CreateType string `json:"createType"`
|
||||||
State string `json:"state"`
|
State string `json:"state"`
|
||||||
CreateBy string `json:"createBy"`
|
CreateBy string `json:"createBy"`
|
||||||
CreateTime time.Time `json:"createTime"`
|
CreateTime types.DateTime `json:"createTime"`
|
||||||
UpdateBy string `json:"updateBy"`
|
UpdateBy string `json:"updateBy"`
|
||||||
UpdateTime time.Time `json:"updateTime"`
|
UpdateTime types.DateTime `json:"updateTime"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// VolunteerItemsVO 志愿明细列表视图对象
|
// VolunteerItemsVO 志愿明细列表视图对象
|
||||||
|
|
|
||||||
|
|
@ -74,14 +74,14 @@ type SchoolMajorDTO struct {
|
||||||
HistoryMajorEnrollMap map[string]YxHistoryMajorEnrollDTO `json:"historyMajorEnrollMap"`
|
HistoryMajorEnrollMap map[string]YxHistoryMajorEnrollDTO `json:"historyMajorEnrollMap"`
|
||||||
// 计算相关字段 (非数据库直接映射)
|
// 计算相关字段 (非数据库直接映射)
|
||||||
HistoryMajorEnrollList []vo.YxHistoryMajorEnrollVO `json:"historyMajorEnrollList"`
|
HistoryMajorEnrollList []vo.YxHistoryMajorEnrollVO `json:"historyMajorEnrollList"`
|
||||||
EnrollProbability float64 `json:"enrollProbability"` // 录取率
|
EnrollProbability float64 `json:"enrollProbability"` // 录取率
|
||||||
StudentScore float64 `json:"studentScore"` // 学生折合分
|
StudentScore float64 `json:"studentScore"` // 学生折合分
|
||||||
PrivateStudentScore float64 `json:"privateStudentScore"` // 学生折合分(私有)
|
PrivateStudentScore float64 `json:"privateStudentScore"` // 学生折合分(私有)
|
||||||
StudentConvertedScore float64 `json:"studentConvertedScore"` // 学生折合分(转换后)
|
StudentConvertedScore float64 `json:"studentConvertedScore"` // 学生折合分(转换后)
|
||||||
FirstLevelDiscipline string `json:"firstLevelDiscipline"` // 一级学科 (需确认来源)
|
FirstLevelDiscipline string `json:"firstLevelDiscipline"` // 一级学科 (需确认来源)
|
||||||
Province string `json:"province"` // 省份
|
Province string `json:"province"` // 省份
|
||||||
SchoolNature string `json:"schoolNature" gorm:"column:schoolNature"` // 院校性质
|
SchoolNature string `json:"schoolNature" gorm:"column:schoolNature"` // 院校性质
|
||||||
InstitutionType string `json:"institutionType" gorm:"column:institutionType"` // 院校类型
|
InstitutionType string `json:"institutionType" gorm:"column:institutionType"` // 院校类型
|
||||||
}
|
}
|
||||||
|
|
||||||
type YxHistoryMajorEnrollDTO struct {
|
type YxHistoryMajorEnrollDTO struct {
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,19 @@
|
||||||
package vo
|
package vo
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"server/modules/yx/entity"
|
"server/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
// UserVolunteerVO 志愿单视图对象,关联成绩信息
|
// UserVolunteerVO 志愿单视图对象,关联成绩信息
|
||||||
type UserVolunteerVO struct {
|
type UserVolunteerVO struct {
|
||||||
entity.YxVolunteer
|
ID string `gorm:"column:id;primaryKey" json:"id"`
|
||||||
ProfessionalCategory string `json:"professionalCategory"` // 专业类别
|
VolunteerName string `gorm:"column:volunteer_name" json:"volunteerName"` // 志愿单名称
|
||||||
Province string `json:"province"` // 省份
|
ScoreId string `gorm:"column:score_id" json:"scoreId"` // 使用成绩id
|
||||||
CulturalScore float64 `json:"culturalScore"` // 文化分
|
CreateType string `gorm:"column:create_type;default:1" json:"createType"` // 生成类型(1.手动生成,2.智能生成)
|
||||||
ProfessionalScore float64 `json:"professionalScore"` // 专业成绩分
|
State string `gorm:"column:state;default:0" json:"state"` // 志愿单状态(0-否,1.正在使用,2-历史)
|
||||||
}
|
UpdateTime types.DateTime `gorm:"column:update_time" json:"updateTime"` // 更新日期
|
||||||
|
ProfessionalCategory string `json:"professionalCategory"` // 专业类别
|
||||||
|
Province string `json:"province"` // 省份
|
||||||
|
CulturalScore float64 `json:"culturalScore"` // 文化分
|
||||||
|
ProfessionalScore float64 `json:"professionalScore"` // 专业成绩分
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,71 @@
|
||||||
|
package types
|
||||||
|
|
||||||
|
import (
|
||||||
|
"database/sql/driver"
|
||||||
|
"encoding/json"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
// DateTime 自定义时间类型,JSON序列化格式为 '2006-01-02 15:04:05'
|
||||||
|
type DateTime time.Time
|
||||||
|
|
||||||
|
// MarshalJSON 实现 json.Marshaler 接口,将时间序列化为 '2006-01-02 15:04:05' 格式
|
||||||
|
func (dt DateTime) MarshalJSON() ([]byte, error) {
|
||||||
|
t := time.Time(dt)
|
||||||
|
if t.IsZero() {
|
||||||
|
return []byte("null"), nil
|
||||||
|
}
|
||||||
|
formatted := t.Format("2006-01-02 15:04:05")
|
||||||
|
return json.Marshal(formatted)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalJSON 实现 json.Unmarshaler 接口,解析 '2006-01-02 15:04:05' 格式的时间
|
||||||
|
func (dt *DateTime) UnmarshalJSON(data []byte) error {
|
||||||
|
if string(data) == "null" {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
var str string
|
||||||
|
if err := json.Unmarshal(data, &str); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
t, err := time.Parse("2006-01-02 15:04:05", str)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
*dt = DateTime(t)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Value 实现 driver.Valuer 接口,用于数据库存储
|
||||||
|
func (dt DateTime) Value() (driver.Value, error) {
|
||||||
|
t := time.Time(dt)
|
||||||
|
return t, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Scan 实现 sql.Scanner 接口,用于数据库读取
|
||||||
|
func (dt *DateTime) Scan(value interface{}) error {
|
||||||
|
if value == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
t, ok := value.(time.Time)
|
||||||
|
if !ok {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
*dt = DateTime(t)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Time 转换为标准 time.Time 类型
|
||||||
|
func (dt DateTime) Time() time.Time {
|
||||||
|
return time.Time(dt)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewDateTime 从 time.Time 创建 DateTime
|
||||||
|
func NewDateTime(t time.Time) DateTime {
|
||||||
|
return DateTime(t)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Now 创建当前时间的 DateTime
|
||||||
|
func Now() DateTime {
|
||||||
|
return DateTime(time.Now())
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue