正在显示
10 个修改的文件
包含
269 行增加
和
87 行删除
1 | package service | 1 | package service |
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | - "time" | ||
5 | - | ||
6 | "github.com/linmadan/egglib-go/core/application" | 4 | "github.com/linmadan/egglib-go/core/application" |
7 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/factory" | 5 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/factory" |
8 | - "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/staff_assess/adapter" | ||
9 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/staff_assess/command" | 6 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/staff_assess/command" |
10 | - "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain" | ||
11 | ) | 7 | ) |
12 | 8 | ||
13 | //调试用,手动调用CreateStaffAssessTask | 9 | //调试用,手动调用CreateStaffAssessTask |
@@ -32,79 +28,3 @@ func (srv StaffAssessServeice) InvokCreateStaffAssessTask(param *command.CreateS | @@ -32,79 +28,3 @@ func (srv StaffAssessServeice) InvokCreateStaffAssessTask(param *command.CreateS | ||
32 | } | 28 | } |
33 | return data, nil | 29 | return data, nil |
34 | } | 30 | } |
35 | - | ||
36 | -//保存员工绩效评估填写过程中即写即存的内容 | ||
37 | -func (srv StaffAssessServeice) SaveAssessContentTemp(param *command.SaveAssessInfoCommand) (map[string]interface{}, error) { | ||
38 | - | ||
39 | - transactionContext, err := factory.CreateTransactionContext(nil) | ||
40 | - if err != nil { | ||
41 | - return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
42 | - } | ||
43 | - if err := transactionContext.StartTransaction(); err != nil { | ||
44 | - return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
45 | - } | ||
46 | - defer func() { | ||
47 | - _ = transactionContext.RollbackTransaction() | ||
48 | - }() | ||
49 | - //获取旧的临时数据内容 | ||
50 | - contentTempRepo := factory.CreateStaffAssessContentTempRepository(map[string]interface{}{ | ||
51 | - "transactionContext": transactionContext, | ||
52 | - }) | ||
53 | - //获取评估填写的内容 | ||
54 | - // assessContentRepo := factory.CreateStaffAssessContentRepository(map[string]interface{}{ | ||
55 | - // "transactionContext": transactionContext, | ||
56 | - // }) | ||
57 | - assessRepo := factory.CreateStaffAssessRepository(map[string]interface{}{ | ||
58 | - "transactionContext": transactionContext, | ||
59 | - }) | ||
60 | - assessData, err := assessRepo.FindOne(map[string]interface{}{ | ||
61 | - "id": param.AssessId, | ||
62 | - }) | ||
63 | - if err != nil { | ||
64 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取评估任务"+err.Error()) | ||
65 | - } | ||
66 | - | ||
67 | - // staffAssessId | ||
68 | - _, contentTempList, err := contentTempRepo.Find(map[string]interface{}{ | ||
69 | - "staffAssessId": param.AssessId, | ||
70 | - }) | ||
71 | - if err != nil { | ||
72 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取临时保存的内容"+err.Error()) | ||
73 | - } | ||
74 | - nowTime := time.Now() | ||
75 | - if len(contentTempList) == 0 { | ||
76 | - //获取评估模板 | ||
77 | - assessContentList, err := srv.getAssessSelfInfoUncompleted(transactionContext, assessData) | ||
78 | - if err != nil { | ||
79 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取评估模板,"+err.Error()) | ||
80 | - } | ||
81 | - //转填入临时的数据 | ||
82 | - for _, v := range assessContentList { | ||
83 | - item := &domain.StaffAssessContentTemp{ | ||
84 | - Id: 0, | ||
85 | - StaffAssessId: v.StaffAssessId, | ||
86 | - SortBy: v.SortBy, | ||
87 | - Category: v.Category, | ||
88 | - Name: v.Name, | ||
89 | - Remark: v.Remark, | ||
90 | - Value: "", | ||
91 | - CreatedAt: nowTime, | ||
92 | - UpdatedAt: nowTime, | ||
93 | - } | ||
94 | - contentTempList = append(contentTempList, item) | ||
95 | - } | ||
96 | - } | ||
97 | - //更新assessContentTemp | ||
98 | - if err := transactionContext.CommitTransaction(); err != nil { | ||
99 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
100 | - } | ||
101 | - return nil, nil | ||
102 | -} | ||
103 | - | ||
104 | -//获取员工绩效评估填写内容 | ||
105 | -//临时数据存在时就获取临时数据 | ||
106 | -//不存在就获取实际保存的数据 | ||
107 | -func (srv StaffAssessServeice) GetAssessContentTemp(param *command.SaveAssessInfoCommand) (*adapter.AssessInfoResp, error) { | ||
108 | - //将临时保存的数据填入模板中 | ||
109 | - return nil, nil | ||
110 | -} |
1 | +package service | ||
2 | + | ||
3 | +import ( | ||
4 | + "fmt" | ||
5 | + | ||
6 | + "github.com/linmadan/egglib-go/core/application" | ||
7 | + "github.com/linmadan/egglib-go/utils/tool_funs" | ||
8 | + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/factory" | ||
9 | + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/staff_assess/adapter" | ||
10 | + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/staff_assess/query" | ||
11 | + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain" | ||
12 | + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/infrastructure/dao" | ||
13 | +) | ||
14 | + | ||
15 | +//获取我的项目周期 | ||
16 | +func (srv StaffAssessServeice) SearchAssessCycelMe(param *query.SearchAssessMeQuery) (map[string]interface{}, error) { | ||
17 | + transactionContext, err := factory.CreateTransactionContext(nil) | ||
18 | + if err != nil { | ||
19 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
20 | + } | ||
21 | + if err := transactionContext.StartTransaction(); err != nil { | ||
22 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
23 | + } | ||
24 | + defer func() { | ||
25 | + _ = transactionContext.RollbackTransaction() | ||
26 | + }() | ||
27 | + | ||
28 | + staffAssessTaskRepo := dao.NewStaffAssessDao(map[string]interface{}{ | ||
29 | + "transactionContext": transactionContext, | ||
30 | + }) | ||
31 | + var limit int = 200 | ||
32 | + var offset int = 0 | ||
33 | + if param.PageSize > 0 { | ||
34 | + limit = param.PageSize | ||
35 | + } | ||
36 | + offset = (param.PageNumber - 1) * param.PageSize | ||
37 | + assessCycleList, err := staffAssessTaskRepo.SearchAssessCycleMe(param.UserId, param.CompanyId, limit, offset) | ||
38 | + if err != nil { | ||
39 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "查询评估周期"+err.Error()) | ||
40 | + } | ||
41 | + cnt, err := staffAssessTaskRepo.CountAssessTaskMe(param.UserId, param.CompanyId) | ||
42 | + if err != nil { | ||
43 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "查询评估周期"+err.Error()) | ||
44 | + } | ||
45 | + | ||
46 | + if err := transactionContext.CommitTransaction(); err != nil { | ||
47 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
48 | + } | ||
49 | + listData := make([]adapter.AssessCycleDayResp, 0, len(assessCycleList)) | ||
50 | + var temp adapter.AssessCycleDayResp | ||
51 | + for _, v := range assessCycleList { | ||
52 | + temp = adapter.AssessCycleDayResp{ | ||
53 | + CycleId: v.CycleId, | ||
54 | + CycleName: v.CycleName, | ||
55 | + BeginDay: v.BeginDay, | ||
56 | + } | ||
57 | + listData = append(listData, temp) | ||
58 | + } | ||
59 | + return tool_funs.SimpleWrapGridMap(int64(cnt), listData), nil | ||
60 | +} | ||
61 | + | ||
62 | +//获取我的项目周期进度描述 | ||
63 | +func (srv StaffAssessServeice) AssessCycleMeDesc(param *query.AssessCycleDescQuery) (*adapter.AssessTaskDescResp, error) { | ||
64 | + transactionContext, err := factory.CreateTransactionContext(nil) | ||
65 | + if err != nil { | ||
66 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
67 | + } | ||
68 | + if err := transactionContext.StartTransaction(); err != nil { | ||
69 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
70 | + } | ||
71 | + defer func() { | ||
72 | + _ = transactionContext.RollbackTransaction() | ||
73 | + }() | ||
74 | + // 获取评估任务 | ||
75 | + staffAssessTaskRepo := factory.CreateStaffAssessTaskRepository(map[string]interface{}{ | ||
76 | + "transactionContext": transactionContext, | ||
77 | + }) | ||
78 | + //获取个人参与的评估流程 | ||
79 | + staffAssessRepo := factory.CreateStaffAssessRepository(map[string]interface{}{ | ||
80 | + "transactionContext": transactionContext, | ||
81 | + }) | ||
82 | + assessTaskData, err := staffAssessTaskRepo.FindOne(map[string]interface{}{ | ||
83 | + // "id": param.AssessTaskId, | ||
84 | + }) | ||
85 | + if err != nil { | ||
86 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, "评估任务不存在,"+err.Error()) | ||
87 | + } | ||
88 | + //返回的数据结果 | ||
89 | + result := adapter.AssessTaskDescResp{ | ||
90 | + AssessTaskId: assessTaskData.Id, | ||
91 | + EvaluationProjectId: assessTaskData.EvaluationProjectId, | ||
92 | + EvaluationProjectName: assessTaskData.EvaluationProjectName, | ||
93 | + CycleName: assessTaskData.CycleName, | ||
94 | + BeginTime: assessTaskData.BeginTime.Local().Format("2006-01-02 15:04-05"), | ||
95 | + EndTime: assessTaskData.EndTime.Local().Format("2006-01-02 15:04-05"), | ||
96 | + StepList: []adapter.AssessTaskStep{}, | ||
97 | + } | ||
98 | + | ||
99 | + for _, v := range assessTaskData.StepList { | ||
100 | + stepItem := adapter.AssessTaskStep{ | ||
101 | + SortBy: v.SortBy, | ||
102 | + LinkNodeName: v.LinkNodeName, | ||
103 | + LinkNodeId: v.LinkNodeId, | ||
104 | + BeginTime: v.BeginTime.Local().Format("2006-01-02 15:04:05"), | ||
105 | + EndTime: v.EndTime.Local().Format("2006-01-02 15:04:05"), | ||
106 | + LinkNodeType: v.LinkNodeType, | ||
107 | + Desc: fmt.Sprintf("截止日期:%s", v.EndTime.Local().Format("2006-01-02 15:04:05")), | ||
108 | + Status: "", | ||
109 | + } | ||
110 | + switch v.LinkNodeType { | ||
111 | + case domain.LinkNodeSelfAssessment: | ||
112 | + //个人自评完成情况 | ||
113 | + _, assessSelfData, err := staffAssessRepo.Find(map[string]interface{}{ | ||
114 | + "staffAssessTaskId": assessTaskData.Id, | ||
115 | + "executorId": param.UserId, | ||
116 | + "typesList": []string{string(domain.AssessSelf)}, | ||
117 | + }) | ||
118 | + if err != nil { | ||
119 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取个人的评估环节"+err.Error()) | ||
120 | + } | ||
121 | + if len(assessSelfData) > 0 { | ||
122 | + stepItem.Status = string(assessSelfData[0].Status) | ||
123 | + } | ||
124 | + stepItem.Desc = fmt.Sprintf("截止日期:%s", stepItem.EndTime) | ||
125 | + case domain.LinkNodeAllInvite: | ||
126 | + //邀请别人评估自己 | ||
127 | + _, assessInviteData, err := staffAssessRepo.Find(map[string]interface{}{ | ||
128 | + "staffAssessTaskId": assessTaskData.Id, | ||
129 | + "targetUserId": param.UserId, | ||
130 | + "typesList": []string{string(domain.AssessInviteDiffSuper), string(domain.AssessInviteSameSuper)}, | ||
131 | + "limit": 5, | ||
132 | + }) | ||
133 | + if err != nil { | ||
134 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取个人的评估环节"+err.Error()) | ||
135 | + } | ||
136 | + if len(assessInviteData) > 0 { | ||
137 | + stepItem.Status = string(domain.StaffAssessCompleted) | ||
138 | + } else { | ||
139 | + stepItem.Status = string(domain.StaffAssessUncompleted) | ||
140 | + } | ||
141 | + //待邀请人数,为5人减去已邀请的人数。若邀请人数已等于或大于5人,则只显示截止日期即可 | ||
142 | + if len(assessInviteData) > 5 { | ||
143 | + stepItem.Desc = fmt.Sprintf("截止日期:%s", stepItem.EndTime) | ||
144 | + } else { | ||
145 | + stepItem.Desc = fmt.Sprintf("截止日期:%s 待邀请%d人", stepItem.EndTime, 5-len(assessInviteData)) | ||
146 | + } | ||
147 | + case domain.LinkNodeAllAssessment: | ||
148 | + //我评估别人,被邀请评估 | ||
149 | + _, assessInviteList, err := staffAssessRepo.Find(map[string]interface{}{ | ||
150 | + "staffAssessTaskId": assessTaskData.Id, | ||
151 | + "executorId": param.UserId, | ||
152 | + "typesList": []string{string(domain.AssessInviteDiffSuper), string(domain.AssessInviteSameSuper)}, | ||
153 | + }) | ||
154 | + if err != nil { | ||
155 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取个人的评估环节"+err.Error()) | ||
156 | + } | ||
157 | + | ||
158 | + if len(assessInviteList) > 0 { | ||
159 | + stepItem.Status = string(domain.StaffAssessCompleted) | ||
160 | + stepItem.Desc = fmt.Sprintf("截止日期:%s", stepItem.EndTime) | ||
161 | + for _, v := range assessInviteList { | ||
162 | + if v.Status == domain.StaffAssessUncompleted { | ||
163 | + stepItem.Status = string(domain.StaffAssessUncompleted) | ||
164 | + break | ||
165 | + } | ||
166 | + } | ||
167 | + } | ||
168 | + case domain.LinkNodeSuperiorAssessment: | ||
169 | + //我评估别人,上级评估 | ||
170 | + _, assessSupperList, err := staffAssessRepo.Find(map[string]interface{}{ | ||
171 | + "staffAssessTaskId": assessTaskData.Id, | ||
172 | + "executorId": param.UserId, | ||
173 | + "typesList": []string{string(domain.AssessSuper)}, | ||
174 | + }) | ||
175 | + if err != nil { | ||
176 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取个人的评估环节"+err.Error()) | ||
177 | + } | ||
178 | + if len(assessSupperList) > 0 { | ||
179 | + stepItem.Status = string(domain.StaffAssessCompleted) | ||
180 | + stepItem.Desc = fmt.Sprintf("截止日期:%s", stepItem.EndTime) | ||
181 | + uncompletedNum := 0 | ||
182 | + for _, v := range assessSupperList { | ||
183 | + if v.Status == domain.StaffAssessUncompleted { | ||
184 | + uncompletedNum += 1 | ||
185 | + } | ||
186 | + } | ||
187 | + if uncompletedNum > 0 { | ||
188 | + stepItem.Status = string(domain.StaffAssessUncompleted) | ||
189 | + stepItem.Desc = fmt.Sprintf("截止日期:%s 待评估%d人", stepItem.EndTime, uncompletedNum) | ||
190 | + } | ||
191 | + } | ||
192 | + } | ||
193 | + result.StepList = append(result.StepList, stepItem) | ||
194 | + } | ||
195 | + if err := transactionContext.CommitTransaction(); err != nil { | ||
196 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
197 | + } | ||
198 | + return &result, nil | ||
199 | +} |
@@ -31,7 +31,7 @@ type NodeContent struct { | @@ -31,7 +31,7 @@ type NodeContent struct { | ||
31 | Name string `json:"name" comment:"名称"` | 31 | Name string `json:"name" comment:"名称"` |
32 | RuleId int64 `json:"ruleId,string" comment:"评估规则ID"` | 32 | RuleId int64 `json:"ruleId,string" comment:"评估规则ID"` |
33 | Rule *EvaluationRule `json:"rule" comment:"评估规则对象"` | 33 | Rule *EvaluationRule `json:"rule" comment:"评估规则对象"` |
34 | - Weight int `json:"weight" comment:"权重"` | 34 | + Weight float64 `json:"weight" comment:"权重"` |
35 | PromptTitle string `json:"promptTitle" comment:"提示项标题"` | 35 | PromptTitle string `json:"promptTitle" comment:"提示项标题"` |
36 | PromptText string `json:"promptText" comment:"提示项正文"` | 36 | PromptText string `json:"promptText" comment:"提示项正文"` |
37 | EntryItems []*EntryItem `json:"entryItems" comment:"填写项"` | 37 | EntryItems []*EntryItem `json:"entryItems" comment:"填写项"` |
@@ -22,7 +22,7 @@ type StaffAssessContent struct { | @@ -22,7 +22,7 @@ type StaffAssessContent struct { | ||
22 | LevelValue string `json:"levelValue"` // 填写值按规则Rule转换为相应的等级值 | 22 | LevelValue string `json:"levelValue"` // 填写值按规则Rule转换为相应的等级值 |
23 | ReteResult string `json:"reteResult"` //评估的结果 | 23 | ReteResult string `json:"reteResult"` //评估的结果 |
24 | Rule EvaluationRule `json:"rule"` //评估的选项规则 | 24 | Rule EvaluationRule `json:"rule"` //评估的选项规则 |
25 | - Weight int `json:"weight" ` //"权重" | 25 | + Weight float64 `json:"weight" ` //"权重" |
26 | CreatedAt time.Time `json:"createdAt"` //数据创建时间 | 26 | CreatedAt time.Time `json:"createdAt"` //数据创建时间 |
27 | UpdatedAt time.Time `json:"updatedAt"` //数据更新时间 | 27 | UpdatedAt time.Time `json:"updatedAt"` //数据更新时间 |
28 | DeletedAt *time.Time `json:"deletedAt"` | 28 | DeletedAt *time.Time `json:"deletedAt"` |
@@ -131,7 +131,8 @@ func (d *StaffAssessDao) AllAssessCycleList(companyId int) ([]AssessCycle, error | @@ -131,7 +131,8 @@ func (d *StaffAssessDao) AllAssessCycleList(companyId int) ([]AssessCycle, error | ||
131 | //获取评估周期中的绩效考核日期 | 131 | //获取评估周期中的绩效考核日期 |
132 | type AssessCycleDay struct { | 132 | type AssessCycleDay struct { |
133 | BeginDay string `json:"beginDay"` | 133 | BeginDay string `json:"beginDay"` |
134 | - CycleId string `json:"cycleId"` | 134 | + CycleId int `json:"cycleId"` |
135 | + CycleName string `json:"cycleName"` | ||
135 | CompanyId string `json:"companyId"` | 136 | CompanyId string `json:"companyId"` |
136 | } | 137 | } |
137 | 138 | ||
@@ -139,6 +140,7 @@ type AssessCycleDay struct { | @@ -139,6 +140,7 @@ type AssessCycleDay struct { | ||
139 | func (d *StaffAssessDao) AllAssessCycleDayList(companyId int, cycleId int) ([]AssessCycleDay, error) { | 140 | func (d *StaffAssessDao) AllAssessCycleDayList(companyId int, cycleId int) ([]AssessCycleDay, error) { |
140 | sqlStr := `select distinct staff_assess_task.begin_day , | 141 | sqlStr := `select distinct staff_assess_task.begin_day , |
141 | staff_assess_task.cycle_id , | 142 | staff_assess_task.cycle_id , |
143 | + staff_assess_task.cycle_name | ||
142 | staff_assess_task.company_id | 144 | staff_assess_task.company_id |
143 | from staff_assess_task | 145 | from staff_assess_task |
144 | where staff_assess_task.cycle_id = ? | 146 | where staff_assess_task.cycle_id = ? |
@@ -378,3 +380,48 @@ func (d *StaffAssessDao) ExportDataUserAssess(param SearchConditin1) ([]ExportDa | @@ -378,3 +380,48 @@ func (d *StaffAssessDao) ExportDataUserAssess(param SearchConditin1) ([]ExportDa | ||
378 | _, err := tx.Query(&result, sqlStr, condition...) | 380 | _, err := tx.Query(&result, sqlStr, condition...) |
379 | return result, err | 381 | return result, err |
380 | } | 382 | } |
383 | + | ||
384 | +// 根据评估的人执行人id,搜索 executorId参与的评估周期 | ||
385 | +func (d *StaffAssessDao) SearchAssessCycleMe(executorId int, companyId int, limit int, offset int) ([]AssessCycleDay, error) { | ||
386 | + if limit < 0 { | ||
387 | + limit = 20 | ||
388 | + } | ||
389 | + if offset < 0 { | ||
390 | + offset = 0 | ||
391 | + } | ||
392 | + sqlStr := ` | ||
393 | + SELECT DISTINCT staff_assess_task.cycle_id ,staff_assess_task.cycle_name ,staff_assess_task.begin_day | ||
394 | + FROM staff_assess_task | ||
395 | + JOIN staff_assess ON staff_assess_task."id" = staff_assess."staff_assess_task_id" | ||
396 | + WHERE staff_assess.company_id=? | ||
397 | + and staff_assess_task.deleted_at isnull | ||
398 | + and staff_assess.executor->>'userId'='?' | ||
399 | + order by staff_assess_task.begin_day desc | ||
400 | + ` | ||
401 | + tx := d.transactionContext.PgTx | ||
402 | + condition := []interface{}{ | ||
403 | + companyId, executorId, limit, offset, | ||
404 | + } | ||
405 | + result := []AssessCycleDay{} | ||
406 | + _, err := tx.Query(&result, sqlStr, condition...) | ||
407 | + return result, err | ||
408 | +} | ||
409 | + | ||
410 | +// 根据评估的人执行人id,统计executorId参与的评估周期 | ||
411 | +func (d *StaffAssessDao) CountAssessCycleMe(executorId int, companyId int) (int, error) { | ||
412 | + sqlStr := ` | ||
413 | + select count(DISTINCT (staff_assess_task.cycle_id ,staff_assess_task.cycle_name ,staff_assess_task.begin_day )) as cnt | ||
414 | + FROM staff_assess_task | ||
415 | + JOIN staff_assess ON staff_assess_task."id" = staff_assess."staff_assess_task_id" | ||
416 | + WHERE staff_assess.company_id=? | ||
417 | + and staff_assess_task.deleted_at isnull | ||
418 | + and staff_assess.executor->>'userId'='?' | ||
419 | + ` | ||
420 | + tx := d.transactionContext.PgTx | ||
421 | + condition := []interface{}{ | ||
422 | + companyId, executorId, | ||
423 | + } | ||
424 | + var result int | ||
425 | + _, err := tx.QueryOne(pg.Scan(&result), sqlStr, condition...) | ||
426 | + return result, err | ||
427 | +} |
@@ -22,7 +22,7 @@ type StaffAssessContent struct { | @@ -22,7 +22,7 @@ type StaffAssessContent struct { | ||
22 | ReteResult string //评估的结果 | 22 | ReteResult string //评估的结果 |
23 | Rule domain.EvaluationRule | 23 | Rule domain.EvaluationRule |
24 | Remark []domain.AssessContemtRemark | 24 | Remark []domain.AssessContemtRemark |
25 | - Weight int `pg:",use_zero"` //权重 | 25 | + Weight float64 `pg:",use_zero"` //权重 |
26 | CreatedAt time.Time //数据创建时间 | 26 | CreatedAt time.Time //数据创建时间 |
27 | UpdatedAt time.Time //数据更新时间 | 27 | UpdatedAt time.Time //数据更新时间 |
28 | DeletedAt *time.Time | 28 | DeletedAt *time.Time |
1 | package controllers | 1 | package controllers |
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | + "strconv" | ||
5 | + "strings" | ||
6 | + | ||
4 | "github.com/linmadan/egglib-go/core/application" | 7 | "github.com/linmadan/egglib-go/core/application" |
5 | "github.com/linmadan/egglib-go/utils/tool_funs" | 8 | "github.com/linmadan/egglib-go/utils/tool_funs" |
6 | "github.com/linmadan/egglib-go/web/beego" | 9 | "github.com/linmadan/egglib-go/web/beego" |
@@ -8,8 +11,6 @@ import ( | @@ -8,8 +11,6 @@ import ( | ||
8 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/factory" | 11 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/factory" |
9 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain" | 12 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain" |
10 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/port/beego/middlewares" | 13 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/port/beego/middlewares" |
11 | - "strconv" | ||
12 | - "strings" | ||
13 | ) | 14 | ) |
14 | 15 | ||
15 | type ImportController struct { | 16 | type ImportController struct { |
@@ -95,7 +96,7 @@ func (controller *ImportController) parseTemplateNodeContent(data []*domain.Perf | @@ -95,7 +96,7 @@ func (controller *ImportController) parseTemplateNodeContent(data []*domain.Perf | ||
95 | nc.RuleId = ruleId // 规则ID | 96 | nc.RuleId = ruleId // 规则ID |
96 | sIndex := strings.Index(module.Weight, "%") // 权重 | 97 | sIndex := strings.Index(module.Weight, "%") // 权重 |
97 | if sIndex != -1 { | 98 | if sIndex != -1 { |
98 | - iWeight, _ := strconv.Atoi(module.Weight[:sIndex]) | 99 | + iWeight, _ := strconv.ParseFloat(module.Weight[:sIndex], 64) |
99 | nc.Weight = iWeight | 100 | nc.Weight = iWeight |
100 | } else { | 101 | } else { |
101 | nc.Weight = 0 | 102 | nc.Weight = 0 |
sql/2022-12-1.sql
0 → 100644
1 | +ALTER TABLE public.staff_assess_content ALTER COLUMN weight TYPE float8 USING weight::float8; |
-
请 注册 或 登录 后发表评论