作者 yangfu

fix: 1.工厂日历更新修改 2.列表时间过滤修改

... ... @@ -53,18 +53,21 @@ func (cmd *SearchEmployeeAttendanceQuery) Valid(validation *validation.Validatio
cmd.Offset, cmd.Limit = domain.Pagination(cmd.PageNumber, cmd.PageSize)
var err error
if len(cmd.BeginTime) > 0 {
if cmd.SignBeginTime, err = time.Parse("2006-01-02 15:04:05", cmd.BeginTime); err != nil {
if cmd.SignBeginTime, err = time.ParseInLocation("2006-01-02 15:04:05", cmd.BeginTime, time.Local); err != nil {
log.Logger.Error(err.Error())
validation.Error("开始时间有误")
return
}
}
if len(cmd.EndTime) > 0 {
if cmd.SignEndTime, err = time.Parse("2006-01-02 15:04:05", cmd.EndTime); err != nil {
if cmd.SignEndTime, err = time.ParseInLocation("2006-01-02 15:04:05", cmd.EndTime, time.Local); err != nil {
log.Logger.Error(err.Error())
validation.Error("结束时间有误")
return
}
if cmd.SignBeginTime.Equal(cmd.SignEndTime) {
cmd.SignEndTime = cmd.SignEndTime.Add(time.Hour * 24)
}
}
cmd.AttendanceStatus = 6 // 审核 + 自动审核
}
... ...
... ... @@ -221,7 +221,7 @@ func FastPgProductCalendar(transactionContext application.TransactionContext, id
rep = value
}
if id > 0 {
if mod, err = rep.FindOne(map[string]interface{}{"productCalendar": id}); err != nil {
if mod, err = rep.FindOne(map[string]interface{}{"productCalendarId": id}); err != nil {
if err == domain.ErrorNotFound {
return nil, nil, application.ThrowError(application.RES_NO_FIND_ERROR, "该车间日历不存在")
}
... ...
... ... @@ -51,18 +51,21 @@ func (cmd *SearchEmployeeProductRecordQuery) Valid(validation *validation.Valida
cmd.Offset, cmd.Limit = domain.Pagination(cmd.PageNumber, cmd.PageSize)
var err error
if len(cmd.BeginTime) > 0 {
if cmd.ProductBeginTime, err = time.Parse("2006-01-02 15:04:05", cmd.BeginTime); err != nil {
if cmd.ProductBeginTime, err = time.ParseInLocation("2006-01-02 15:04:05", cmd.BeginTime, time.Local); err != nil {
log.Logger.Error(err.Error())
validation.Error("开始时间有误")
return
}
}
if len(cmd.EndTime) > 0 {
if cmd.ProductEndTime, err = time.Parse("2006-01-02 15:04:05", cmd.EndTime); err != nil {
if cmd.ProductEndTime, err = time.ParseInLocation("2006-01-02 15:04:05", cmd.EndTime, time.Local); err != nil {
log.Logger.Error(err.Error())
validation.Error("结束时间有误")
return
}
if cmd.ProductBeginTime.Equal(cmd.ProductEndTime) {
cmd.ProductEndTime = cmd.ProductEndTime.Add(time.Hour * 24)
}
}
}
... ...
... ... @@ -68,6 +68,9 @@ func (cmd *SearchProductRecordQuery) Valid(validation *validation.Validation) {
validation.Error("结束时间有误")
return
}
if cmd.ProductEndTime.Equal(cmd.ProductBeginTime) {
cmd.ProductEndTime = cmd.ProductEndTime.Add(time.Hour * 24)
}
}
}
... ...
... ... @@ -57,6 +57,9 @@ func (cmd *SearchWorkshopProductRecordQuery) Valid(validation *validation.Valida
validation.Error("结束时间有误")
return
}
if cmd.ProductBeginTime.Equal(cmd.ProductEndTime) {
cmd.ProductEndTime = cmd.ProductEndTime.Add(time.Hour * 24)
}
}
}
... ...