作者 tangxvhui

Merge branch 'dev-tangxvhui' into test

  1 +package query
  2 +
  3 +type ListAssessContentCycleDay struct {
  4 + CompanyId int `json:"companyId"`
  5 + OperaterId int `json:"operaterId"`
  6 + CycleId int `json:"cycleId,string"`
  7 + BeginDay string `json:"beginDay"`
  8 + TargetUserName string `json:"targetUserName"`
  9 + PageNumber int `json:"pageNumber"`
  10 + PageSize int `json:"pageSize"`
  11 +}
  1 +package query
  2 +
  3 +type ListAssessCycleDay struct {
  4 + CompanyId int `json:"companyId"`
  5 + CycleId int `json:"cycleId,string"`
  6 +}
@@ -1726,12 +1726,11 @@ func (srv StaffAssessServeice) SaveAssessInfo(param *command.SaveAssessInfoComma @@ -1726,12 +1726,11 @@ func (srv StaffAssessServeice) SaveAssessInfo(param *command.SaveAssessInfoComma
1726 continue 1726 continue
1727 } 1727 }
1728 v.Value = item.Value 1728 v.Value = item.Value
1729 - //填入评估值描述  
1730 - reteResult, err := v.Rule.ScoreOrRating(&v.Value) 1729 + //转换填入的评估值
  1730 + err = v.TransformValue()
1731 if err != nil { 1731 if err != nil {
1732 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 1732 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
1733 } 1733 }
1734 - v.ReteResult = reteResult  
1735 for ii := range v.Remark { 1734 for ii := range v.Remark {
1736 for _, vvv := range item.Remark { 1735 for _, vvv := range item.Remark {
1737 if v.Remark[ii].Title == vvv.Title { 1736 if v.Remark[ii].Title == vvv.Title {
@@ -1740,7 +1739,6 @@ func (srv StaffAssessServeice) SaveAssessInfo(param *command.SaveAssessInfoComma @@ -1740,7 +1739,6 @@ func (srv StaffAssessServeice) SaveAssessInfo(param *command.SaveAssessInfoComma
1740 } 1739 }
1741 } 1740 }
1742 } 1741 }
1743 -  
1744 } 1742 }
1745 //保存信息 1743 //保存信息
1746 for i := range assessContentList { 1744 for i := range assessContentList {
1 package service 1 package service
2 2
  3 +import (
  4 + "github.com/linmadan/egglib-go/core/application"
  5 + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/factory"
  6 + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/staff_assess/query"
  7 + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/infrastructure/dao"
  8 +)
  9 +
3 //员工绩效-项目管理 10 //员工绩效-项目管理
4 11
5 //获取已被执行的周期列表 12 //获取已被执行的周期列表
6 -func (srv StaffAssessServeice) GetAllAssessCycleName() { 13 +func (srv StaffAssessServeice) ListAllAssessCycle(companyid int) (map[string]interface{}, error) {
  14 + transactionContext, err := factory.CreateTransactionContext(nil)
  15 + if err != nil {
  16 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  17 + }
  18 + if err := transactionContext.StartTransaction(); err != nil {
  19 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  20 + }
  21 + defer func() {
  22 + _ = transactionContext.RollbackTransaction()
  23 + }()
  24 + assessDao := dao.NewStaffAssessDao(map[string]interface{}{
  25 + "transactionContext": transactionContext,
  26 + })
  27 + cycleList, err := assessDao.AllAssessCycleList(companyid)
  28 + if err != nil {
  29 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取周期列表"+err.Error())
  30 + }
  31 + if err := transactionContext.CommitTransaction(); err != nil {
  32 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  33 + }
  34 + result := map[string]interface{}{
  35 + "list": cycleList,
  36 + }
  37 + return result, nil
7 38
8 } 39 }
9 40
10 //获取周期内的考核日期 41 //获取周期内的考核日期
  42 +func (srv StaffAssessServeice) ListAllAssessCycleDay(param *query.ListAssessCycleDay) (map[string]interface{}, error) {
  43 + transactionContext, err := factory.CreateTransactionContext(nil)
  44 + if err != nil {
  45 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  46 + }
  47 + if err := transactionContext.StartTransaction(); err != nil {
  48 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  49 + }
  50 + defer func() {
  51 + _ = transactionContext.RollbackTransaction()
  52 + }()
  53 + assessDao := dao.NewStaffAssessDao(map[string]interface{}{
  54 + "transactionContext": transactionContext,
  55 + })
  56 + cycleDayList, err := assessDao.AllAssessCycleDayList(param.CompanyId, param.CycleId)
  57 + if err != nil {
  58 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取周期列表"+err.Error())
  59 + }
  60 + if err := transactionContext.CommitTransaction(); err != nil {
  61 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  62 + }
  63 + result := map[string]interface{}{
  64 + "list": cycleDayList,
  65 + }
  66 + return result, nil
  67 +}
  68 +
  69 +//根据周期id和日期获取 员工填写评估内容
  70 +// 有过滤查看权限
  71 +func (srv StaffAssessServeice) ListAllAssessContentCycleDay(param *query.ListAssessContentCycleDay) (map[string]interface{}, error) {
  72 + transactionContext, err := factory.CreateTransactionContext(nil)
  73 + if err != nil {
  74 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  75 + }
  76 + if err := transactionContext.StartTransaction(); err != nil {
  77 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  78 + }
  79 + defer func() {
  80 + _ = transactionContext.RollbackTransaction()
  81 + }()
  82 + // assessDao := dao.NewStaffAssessDao(map[string]interface{}{
  83 + // "transactionContext": transactionContext,
  84 + // })
  85 + if err := transactionContext.CommitTransaction(); err != nil {
  86 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  87 + }
  88 + return nil, nil
  89 +}
1 package domain 1 package domain
2 2
3 import ( 3 import (
4 - "errors"  
5 - "fmt"  
6 - "strconv"  
7 "time" 4 "time"
8 ) 5 )
9 6
@@ -58,54 +55,54 @@ type EvaluationRule struct { @@ -58,54 +55,54 @@ type EvaluationRule struct {
58 DeletedAt *time.Time `json:"deletedAt" comment:"删除时间"` 55 DeletedAt *time.Time `json:"deletedAt" comment:"删除时间"`
59 } 56 }
60 57
61 -// 根据评估填写的值,得出等级名称  
62 -// 如果 评估方式是评分,对评估填写的值的小数点后的位数进行处理,  
63 -// value 根据评估填写的值  
64 -func (rule *EvaluationRule) ScoreOrRating(value *string) (string, error) {  
65 - switch rule.Type {  
66 - case EvaluationTypeRating:  
67 - return rule.RatingValue(value)  
68 - case EvaluationTypeScore:  
69 - return rule.ScoreValue(value)  
70 - }  
71 - return "", errors.New("rule.Type 错误")  
72 -}  
73 -  
74 -//根据评估填写的值,得出等级名称,  
75 -func (rule *EvaluationRule) ScoreValue(value *string) (string, error) {  
76 - valueFloat, err := strconv.ParseFloat(*value, 64)  
77 - if err != nil {  
78 - return "", errors.New("评分填写的值错误")  
79 - }  
80 - if valueFloat < rule.Score.Min || valueFloat > rule.Score.Max {  
81 - return "", fmt.Errorf("评分填写的值超出限制,>=%f且<=%f", rule.Score.Min, rule.Score.Max)  
82 - }  
83 - //保留小数处理  
84 - fStr := fmt.Sprintf("%%.%df", rule.Score.DecimalPlaces)  
85 - valueStr := fmt.Sprintf(fStr, valueFloat)  
86 - *value = valueStr  
87 - if rule.Score.IntervalState == 0 {  
88 - // 未开启按分数子区间匹配等级  
89 - return "", nil  
90 - }  
91 - valueDescrip := ""  
92 - for _, v := range rule.Score.Levels {  
93 - if valueFloat >= v.Start && valueFloat <= v.End {  
94 - valueDescrip = v.Name  
95 - }  
96 - }  
97 - return valueDescrip, nil  
98 -}  
99 -  
100 -//根据评估填写的值,得出等级名称,  
101 -func (rule *EvaluationRule) RatingValue(value *string) (string, error) {  
102 - for _, v := range rule.Rating.Levels {  
103 - if v.Code == *value {  
104 - return v.Name, nil  
105 - }  
106 - }  
107 - return "", errors.New("评估填写的值错误")  
108 -} 58 +// // 根据评估填写的值,得出等级名称和填写的值量化值
  59 +// // 如果 评估方式是评分,对评估填写的值的小数点后的位数进行处理,
  60 +// // value 根据评估填写的值
  61 +// func (rule *EvaluationRule) ScoreOrRating(value *string) (string, error) {
  62 +// switch rule.Type {
  63 +// case EvaluationTypeRating:
  64 +// return rule.RatingValue(value)
  65 +// case EvaluationTypeScore:
  66 +// return rule.ScoreValue(value)
  67 +// }
  68 +// return "", errors.New("rule.Type 错误")
  69 +// }
  70 +
  71 +// //根据评估填写的值,得出等级名称和填写的值量化值
  72 +// func (rule *EvaluationRule) ScoreValue(value *string) (string, error) {
  73 +// valueFloat, err := strconv.ParseFloat(*value, 64)
  74 +// if err != nil {
  75 +// return "", errors.New("评分填写的值错误")
  76 +// }
  77 +// if valueFloat < rule.Score.Min || valueFloat > rule.Score.Max {
  78 +// return "", fmt.Errorf("评分填写的值超出限制,>=%f且<=%f", rule.Score.Min, rule.Score.Max)
  79 +// }
  80 +// //保留小数处理
  81 +// fStr := fmt.Sprintf("%%.%df", rule.Score.DecimalPlaces)
  82 +// valueStr := fmt.Sprintf(fStr, valueFloat)
  83 +// *value = valueStr
  84 +// if rule.Score.IntervalState == 0 {
  85 +// // 未开启按分数子区间匹配等级
  86 +// return "", nil
  87 +// }
  88 +// valueDescrip := ""
  89 +// for _, v := range rule.Score.Levels {
  90 +// if valueFloat >= v.Start && valueFloat <= v.End {
  91 +// valueDescrip = v.Name
  92 +// }
  93 +// }
  94 +// return valueDescrip, nil
  95 +// }
  96 +
  97 +// //根据评估填写的值,得出等级名称,
  98 +// func (rule *EvaluationRule) RatingValue(value *string) (string, error) {
  99 +// for _, v := range rule.Rating.Levels {
  100 +// if v.Code == *value {
  101 +// return v.Name, nil
  102 +// }
  103 +// }
  104 +// return "", errors.New("评估填写的值错误")
  105 +// }
109 106
110 // GenerateSysRule 当前公司下的生成默认规则 107 // GenerateSysRule 当前公司下的生成默认规则
111 func GenerateSysRule(companyId int64) *EvaluationRule { 108 func GenerateSysRule(companyId int64) *EvaluationRule {
1 package domain 1 package domain
2 2
3 -import "time" 3 +import (
  4 + "errors"
  5 + "fmt"
  6 + "strconv"
  7 + "time"
  8 +)
4 9
5 //填写的评估内容 10 //填写的评估内容
6 type StaffAssessContent struct { 11 type StaffAssessContent struct {
@@ -13,6 +18,8 @@ type StaffAssessContent struct { @@ -13,6 +18,8 @@ type StaffAssessContent struct {
13 PromptText string `json:"promptText"` //提示项正文 18 PromptText string `json:"promptText"` //提示项正文
14 Remark []AssessContemtRemark `json:"remark"` //填写的反馈 19 Remark []AssessContemtRemark `json:"remark"` //填写的反馈
15 Value string `json:"value"` //评估填写的值 20 Value string `json:"value"` //评估填写的值
  21 + ScoreValue float64 `json:"scoreValue"` // 填写值按规则Rule转换为相应的量化值
  22 + LevelValue string `json:"levelValue"` // 填写值按规则Rule转换为相应的等级值
16 ReteResult string `json:"reteResult"` //评估的结果 23 ReteResult string `json:"reteResult"` //评估的结果
17 Rule EvaluationRule `json:"rule"` //评估的选项规则 24 Rule EvaluationRule `json:"rule"` //评估的选项规则
18 Weight int `json:"weight" ` //"权重" 25 Weight int `json:"weight" ` //"权重"
@@ -28,6 +35,63 @@ type AssessContemtRemark struct { @@ -28,6 +35,63 @@ type AssessContemtRemark struct {
28 RemarkText string `json:"remarkText"` // comment:"填写文本内容" 35 RemarkText string `json:"remarkText"` // comment:"填写文本内容"
29 } 36 }
30 37
  38 +//TransformValue
  39 +//根据规则 rule 转换评填写的值
  40 +func (content *StaffAssessContent) TransformValue() error {
  41 + switch content.Rule.Type {
  42 + case EvaluationTypeRating:
  43 + return content.ratingValue()
  44 + case EvaluationTypeScore:
  45 + return content.scoreValue()
  46 + }
  47 + return nil
  48 +}
  49 +
  50 +// 规则是评级方式
  51 +func (content *StaffAssessContent) ratingValue() error {
  52 + levels := content.Rule.Rating.Levels
  53 + for _, v := range levels {
  54 + if v.Code != content.Value {
  55 + continue
  56 + }
  57 + content.LevelValue = v.Code
  58 + content.ScoreValue = v.QuantizedValue
  59 + content.ReteResult = v.Name
  60 + return nil
  61 + }
  62 + return errors.New("评级填写的值错误")
  63 +}
  64 +
  65 +// 规则是评分方式
  66 +func (content *StaffAssessContent) scoreValue() error {
  67 + valueFloat, err := strconv.ParseFloat(content.Value, 64)
  68 + if err != nil {
  69 + return errors.New("评分填写的值错误")
  70 + }
  71 + rule := &content.Rule
  72 + if valueFloat < rule.Score.Min || valueFloat > rule.Score.Max {
  73 + return fmt.Errorf("评分填写的值超出限制,>=%f且<=%f", rule.Score.Min, rule.Score.Max)
  74 + }
  75 + //保留小数处理
  76 + fStr := fmt.Sprintf("%%.%df", rule.Score.DecimalPlaces)
  77 + valueStr := fmt.Sprintf(fStr, valueFloat)
  78 + content.Value = valueStr
  79 + if rule.Score.IntervalState == 0 {
  80 + // 未开启按分数子区间匹配等级
  81 + return nil
  82 + }
  83 + for _, v := range rule.Score.Levels {
  84 + if valueFloat < v.Start || valueFloat > v.End {
  85 + continue
  86 + }
  87 + content.LevelValue = v.Code
  88 + content.ScoreValue = valueFloat
  89 + content.ReteResult = v.Name
  90 + return nil
  91 + }
  92 + return errors.New("评分填写的值错误")
  93 +}
  94 +
31 type StaffAssessContentRepository interface { 95 type StaffAssessContentRepository interface {
32 Save(param *StaffAssessContent) (*StaffAssessContent, error) 96 Save(param *StaffAssessContent) (*StaffAssessContent, error)
33 Remove(id int) error 97 Remove(id int) error
1 package dao 1 package dao
2 2
3 import ( 3 import (
  4 + "fmt"
4 "strconv" 5 "strconv"
5 6
6 "github.com/go-pg/pg/v10" 7 "github.com/go-pg/pg/v10"
@@ -152,4 +153,173 @@ func (d *StaffAssessDao) AllAssessCycleDayList(companyId int, cycleId int) ([]As @@ -152,4 +153,173 @@ func (d *StaffAssessDao) AllAssessCycleDayList(companyId int, cycleId int) ([]As
152 return result, err 153 return result, err
153 } 154 }
154 155
  156 +//获取员工填写评估内容
  157 +type UserAssessContent struct {
  158 + TargetUserId string `json:"targetUserId"` //被评估人的id
  159 + TargetUserName string `json:"targetUserName"` //被评估人的名称
  160 + BeginDay string `json:"beginDay"` //评估的日期
  161 + EvaluationProjectId string `json:"evaluationProjectId"` //项目id
  162 + Value string `json:"value"` //评估填写的值
  163 + SortBy int `json:"sortBy"` //评估项顺序
  164 + Category string `json:"category"` //评估项分类
  165 + ContentName string `json:"contentName"` //评估项名称
  166 + Weight int `json:"weight"` //权重
  167 +}
  168 +
  169 +type SearchConditin1 struct {
  170 + CompanyId int //公司id
  171 + CycleId int //周期id
  172 + BeginDay string //评估的日期
  173 + TargetUserName string //被评估人的名称
  174 + Limit int //分页
  175 + Offset int //分页
  176 + OperaterId int //用户的id是谁在搜索数据
  177 + Hrbp int //
  178 +}
  179 +
155 //根据周期的id和日期获取员工填写的评估内容 180 //根据周期的id和日期获取员工填写的评估内容
  181 +//companyId int 公司id
  182 +//cycleId int, 评估周期id
  183 +//userId int, 用户id,谁要查看数据
  184 +//beginDay string, 周期中执行项目的时间
  185 +//hrbp 是否搜索HRBP角色的用户可以查看,1:是;-1:否
  186 +//limit int, 分页条数
  187 +//offset int 分页偏移
  188 +func (d *StaffAssessDao) SearchUserAssessContent(param SearchConditin1) ([]UserAssessContent, error) {
  189 + sqlStr := ` select
  190 + t_staff_assess_1.target_user_id,t_staff_assess_1.target_user_name,t_staff_assess_1.begin_day,
  191 + staff_assess_content.value ,staff_assess_content.sort_by ,
  192 + staff_assess_content.category ,staff_assess_content."name" as content_name ,
  193 + staff_assess_content.weight
  194 + from t_staff_assess_1
  195 + left join staff_assess_content on t_staff_assess_1.assess_id = staff_assess_content.staff_assess_id
  196 + `
  197 + condition := []interface{}{}
  198 + if len(param.TargetUserName) > 0 {
  199 + sqlStr += ` where t_staff_assess_1.target_user_name like ? `
  200 + condition = append(condition, param.TargetUserName)
  201 + }
  202 + //加入排序
  203 + sqlStr += ` order by convert_to(t_staff_assess_1.target_user_name,'GBK'),staff_assess_content.sort_by `
  204 + //获取前置sql语句
  205 + sqlStr0 := d.useTStaffAssess(param.CompanyId, param.CycleId, param.OperaterId, param.BeginDay, param.Hrbp, param.Limit, param.Offset)
  206 + sqlStr = sqlStr0 + sqlStr
  207 + tx := d.transactionContext.PgTx
  208 + var result []UserAssessContent
  209 + _, err := tx.QueryOne(&result, sqlStr, condition...)
  210 + return result, err
  211 +}
  212 +
  213 +//根据周期的id和日期获取员工填写的评估内容,数量统计
  214 +//companyId int 公司id
  215 +//cycleId int, 评估周期id
  216 +//userId int, 用户id,谁要查看数据
  217 +//beginDay string, 周期中执行项目的时间
  218 +//hrbp 是否搜索HRBP角色的用户可以查看,1:是;-1:否
  219 +//limit int, 分页条数
  220 +//offset int 分页偏移
  221 +func (d *StaffAssessDao) CountUserAssess(param SearchConditin1) ([]UserAssessContent, error) {
  222 + sqlStr := ` select
  223 + t_staff_assess_1.target_user_id,t_staff_assess_1.target_user_name,t_staff_assess_1.begin_day,
  224 + staff_assess_content.value ,staff_assess_content.sort_by ,
  225 + staff_assess_content.category ,staff_assess_content."name" as content_name ,
  226 + staff_assess_content.weight
  227 + from t_staff_assess_1
  228 + left join staff_assess_content on t_staff_assess_1.assess_id = staff_assess_content.staff_assess_id
  229 + `
  230 + condition := []interface{}{}
  231 + if len(param.TargetUserName) > 0 {
  232 + sqlStr += ` where t_staff_assess_1.target_user_name like ? `
  233 + condition = append(condition, param.TargetUserName)
  234 + }
  235 + //加入排序
  236 + sqlStr += ` order by convert_to(t_staff_assess_1.target_user_name,'GBK'),staff_assess_content.sort_by `
  237 + //获取前置sql语句
  238 + sqlStr0 := d.useTStaffAssess(param.CompanyId, param.CycleId, param.OperaterId, param.BeginDay, param.Hrbp, param.Limit, param.Offset)
  239 + sqlStr = sqlStr0 + sqlStr
  240 + tx := d.transactionContext.PgTx
  241 + var result []UserAssessContent
  242 + _, err := tx.QueryOne(&result, sqlStr, condition...)
  243 + return result, err
  244 +}
  245 +
  246 +//生成的sql 根据用户的查看权限 ,获取可查看的评估任务,
  247 +//companyId int 公司id
  248 +//cycleId int, 评估周期id
  249 +//userId int, 用户id,谁要查看数据
  250 +//beginDay string, 周期中执行项目的时间
  251 +//hrbp 是否搜索HRBP角色的用户可以查看,1:是;-1:否
  252 +//limit int, 分页条数
  253 +//offset int 分页偏移
  254 +func (d *StaffAssessDao) useTStaffAssess(companyId int, cycleId int, userId int, beginDay string, hrbp int, limit int, offset int) string {
  255 + sqlstr := `
  256 + with t_user_department as (
  257 + select "user".id as user_id ,jsonb_array_elements_text ("user".department_id) as depart_id from "user"
  258 + where "user".company_id= %d
  259 + ),
  260 + t_department as (
  261 + select department.id::text as depart_id from department where charge_user_ids @>'[%d]'
  262 + ),
  263 + -- 如果是部门管理员 获取用户列表
  264 + t_user_1 as (
  265 + select t_user_department.user_id::text from t_user_department
  266 + join t_department on t_user_department.depart_id = t_department.depart_id
  267 + ),
  268 + -- 如果是hrbp
  269 + t_project_1 as(
  270 + select evaluation_project.id as project_id
  271 + from evaluation_project
  272 + where evaluation_project.cycle_id =%d
  273 + and evaluation_project.hr_bp = %d
  274 + ),
  275 + -- 如果是项目管理员
  276 + t_project_2 as(
  277 + select evaluation_project.id as project_id
  278 + from evaluation_project
  279 + where evaluation_project.cycle_id =%d
  280 + and evaluation_project.pmp =1
  281 + and evaluation_project.pmp_ids @>'["%d"]'
  282 + ),
  283 + -- 合并数据
  284 + t_project_3 as (
  285 + select t_project_2.project_id from t_project_2
  286 + union
  287 + select t_project_1.project_id from t_project_1
  288 + ),
  289 + -- 初步过滤评估列表数据
  290 + t_staff_assess_0 as (
  291 + select staff_assess.id as assess_id,
  292 + staff_assess.target_user->>'userId' as target_user_id,
  293 + staff_assess.target_user->>'userName' as target_user_name,
  294 + to_char(staff_assess.begin_time,'YYYY-MM-DD') as begin_day,
  295 + staff_assess.evaluation_project_id
  296 + from staff_assess
  297 + where staff_assess.cycle_id = %d
  298 + and to_char(staff_assess.begin_time,'YYYY-MM-DD')='%s'
  299 + and staff_assess."types" ='self'
  300 + ),
  301 + -- 合并根据权限过滤后的数据
  302 + t_staff_assess_1 as (
  303 + (select t_staff_assess_0.assess_id,
  304 + t_staff_assess_0.target_user_id,
  305 + t_staff_assess_0.target_user_name,
  306 + t_staff_assess_0.begin_day
  307 + from t_staff_assess_0
  308 + join t_project_3 on t_staff_assess_0.evaluation_project_id = t_project_3.project_id
  309 + ) union (select t_staff_assess_0.assess_id,
  310 + t_staff_assess_0.target_user_id,
  311 + t_staff_assess_0.target_user_name,
  312 + t_staff_assess_0.begin_day
  313 + from t_staff_assess_0
  314 + join t_user_1 on t_staff_assess_0.target_user_id=t_user_1.user_id
  315 + )
  316 + limit %d offset %d
  317 + )
  318 + `
  319 + params := []interface{}{
  320 + companyId, userId, cycleId, hrbp, cycleId, userId, cycleId, beginDay, limit, offset,
  321 + }
  322 +
  323 + sqlstr = fmt.Sprintf(sqlstr, params...)
  324 + return sqlstr
  325 +}
@@ -14,6 +14,8 @@ type StaffAssessContent struct { @@ -14,6 +14,8 @@ type StaffAssessContent struct {
14 SortBy int //排序 14 SortBy int //排序
15 Category string //类别 15 Category string //类别
16 Name string //名称 16 Name string //名称
  17 + ScoreValue float64 // 填写值按规则Rule转换为相应的量化值
  18 + LevelValue string // 填写值按规则Rule转换为相应的等级值
17 PromptTitle string //问题标题 19 PromptTitle string //问题标题
18 PromptText string //提示项正文 20 PromptText string //提示项正文
19 Value string //评估填写的值 21 Value string //评估填写的值
@@ -32,6 +32,8 @@ func (repo *StaffAssessContentRepository) TransformToDomain(d *models.StaffAsses @@ -32,6 +32,8 @@ func (repo *StaffAssessContentRepository) TransformToDomain(d *models.StaffAsses
32 PromptText: d.PromptText, 32 PromptText: d.PromptText,
33 Remark: d.Remark, 33 Remark: d.Remark,
34 Value: d.Value, 34 Value: d.Value,
  35 + ScoreValue: d.ScoreValue,
  36 + LevelValue: d.LevelValue,
35 ReteResult: d.ReteResult, 37 ReteResult: d.ReteResult,
36 Rule: d.Rule, 38 Rule: d.Rule,
37 Weight: d.Weight, 39 Weight: d.Weight,
@@ -48,15 +50,17 @@ func (repo *StaffAssessContentRepository) Save(d *domain.StaffAssessContent) (*d @@ -48,15 +50,17 @@ func (repo *StaffAssessContentRepository) Save(d *domain.StaffAssessContent) (*d
48 SortBy: d.SortBy, 50 SortBy: d.SortBy,
49 Category: d.Category, 51 Category: d.Category,
50 Name: d.Name, 52 Name: d.Name,
  53 + ScoreValue: d.ScoreValue,
  54 + LevelValue: d.LevelValue,
51 PromptTitle: d.PromptTitle, 55 PromptTitle: d.PromptTitle,
52 PromptText: d.PromptText, 56 PromptText: d.PromptText,
53 - Remark: d.Remark,  
54 Value: d.Value, 57 Value: d.Value,
55 ReteResult: d.ReteResult, 58 ReteResult: d.ReteResult,
56 Rule: d.Rule, 59 Rule: d.Rule,
  60 + Remark: d.Remark,
  61 + Weight: d.Weight,
57 CreatedAt: d.CreatedAt, 62 CreatedAt: d.CreatedAt,
58 UpdatedAt: d.UpdatedAt, 63 UpdatedAt: d.UpdatedAt,
59 - Weight: d.Weight,  
60 DeletedAt: nil, 64 DeletedAt: nil,
61 } 65 }
62 tx := repo.transactionContext.PgTx 66 tx := repo.transactionContext.PgTx
@@ -279,3 +279,35 @@ func (c *StaffAssessController) ListTargetUserMeSupperAssess() { @@ -279,3 +279,35 @@ func (c *StaffAssessController) ListTargetUserMeSupperAssess() {
279 data, err := srv.ListTargetUserAssess(paramReq) 279 data, err := srv.ListTargetUserAssess(paramReq)
280 c.Response(data, err) 280 c.Response(data, err)
281 } 281 }
  282 +
  283 +//获取周期列表
  284 +func (c *StaffAssessController) ListAssessCycle() {
  285 + srv := service.NewStaffAssessServeice()
  286 + // paramReq := &query.ListTargetUserAssessQuery{}
  287 + // err := c.BindJSON(paramReq)
  288 + // if err != nil {
  289 + // e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
  290 + // c.Response(nil, e)
  291 + // return
  292 + // }
  293 + userReq := middlewares.GetUser(c.Ctx)
  294 +
  295 + data, err := srv.ListAllAssessCycle(int(userReq.CompanyId))
  296 + c.Response(data, err)
  297 +}
  298 +
  299 +//获取周期里的考核日期
  300 +func (c *StaffAssessController) ListAssessCycleDay() {
  301 + srv := service.NewStaffAssessServeice()
  302 + paramReq := &query.ListAssessCycleDay{}
  303 + err := c.BindJSON(paramReq)
  304 + if err != nil {
  305 + e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
  306 + c.Response(nil, e)
  307 + return
  308 + }
  309 + userReq := middlewares.GetUser(c.Ctx)
  310 + paramReq.CompanyId = int(userReq.CompanyId)
  311 + data, err := srv.ListAllAssessCycleDay(paramReq)
  312 + c.Response(data, err)
  313 +}
@@ -13,6 +13,8 @@ func init() { @@ -13,6 +13,8 @@ func init() {
13 web.NSCtrlPost("/search/me", (*controllers.StaffAssessController).SearchAssessTaskMe), //获取我参与过的评估项目列表 13 web.NSCtrlPost("/search/me", (*controllers.StaffAssessController).SearchAssessTaskMe), //获取我参与过的评估项目列表
14 web.NSCtrlPost("/desc/me", (*controllers.StaffAssessController).AssessTaskMeDesc), //获取我的项目评估进度描述 14 web.NSCtrlPost("/desc/me", (*controllers.StaffAssessController).AssessTaskMeDesc), //获取我的项目评估进度描述
15 web.NSCtrlPost("/", (*controllers.StaffAssessController).CreateStaffAssessTask), //创建员工的评估任务 15 web.NSCtrlPost("/", (*controllers.StaffAssessController).CreateStaffAssessTask), //创建员工的评估任务
  16 + web.NSCtrlGet("/cycle", (*controllers.StaffAssessController).ListAssessCycle), //获取周期列表
  17 + web.NSCtrlPost("/cycle/day", (*controllers.StaffAssessController).ListAssessCycleDay), //获取周期中的考核日期
16 ) 18 )
17 // /v1/staff-assess/self/me/list 19 // /v1/staff-assess/self/me/list
18 assessNS := web.NewNamespace("/v1/staff-assess", 20 assessNS := web.NewNamespace("/v1/staff-assess",