...
|
...
|
@@ -8,6 +8,7 @@ import ( |
|
|
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/factory"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
|
|
|
"strconv"
|
|
|
"time"
|
|
|
)
|
|
|
|
|
|
type EvaluationCycleService struct {
|
...
|
...
|
@@ -49,12 +50,21 @@ func (rs *EvaluationCycleService) Create(in *command.CreateCycleCommand) (interf |
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "模板不存在, 请重新选择")
|
|
|
}
|
|
|
|
|
|
start, err := time.ParseInLocation("2006-01-02 15:04:05", in.TimeStart, time.Local)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
end, err := time.ParseInLocation("2006-01-02 15:04:05", in.TimeEnd, time.Local)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
|
|
|
// 生成新周期数据
|
|
|
newCycle := &domain.EvaluationCycle{
|
|
|
Id: 0,
|
|
|
Name: in.Name,
|
|
|
TimeStart: in.TimeStart,
|
|
|
TimeEnd: in.TimeEnd,
|
|
|
TimeStart: &start,
|
|
|
TimeEnd: &end,
|
|
|
CompanyId: in.CompanyId,
|
|
|
CreatorId: in.CreatorId,
|
|
|
KpiCycle: in.KpiCycle,
|
...
|
...
|
@@ -210,9 +220,18 @@ func (rs *EvaluationCycleService) Update(in *command.UpdateCycleCommand) (interf |
|
|
}
|
|
|
}
|
|
|
|
|
|
start, err := time.ParseInLocation("2006-01-02 15:04:05", in.TimeStart, time.Local)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
end, err := time.ParseInLocation("2006-01-02 15:04:05", in.TimeEnd, time.Local)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
|
|
|
cycle.Name = in.Name
|
|
|
cycle.TimeStart = in.TimeStart
|
|
|
cycle.TimeEnd = in.TimeEnd
|
|
|
cycle.TimeStart = &start
|
|
|
cycle.TimeEnd = &end
|
|
|
cycle.KpiCycle = in.KpiCycle
|
|
|
cycle, err = cycleRepository.Insert(cycle)
|
|
|
if err != nil {
|
...
|
...
|
|