作者 Your Name

更新

  1 +package command
  2 +
  3 +type QueryAssessRemark struct {
  4 + ProjectId int `json:"projectId"`
  5 + LevelValue string `json:"levelValue"`
  6 + Category string `json:"category"`
  7 + Name string `json:"name"`
  8 + TargetUserId int `json:"targetUserId"`
  9 +}
@@ -2017,3 +2017,44 @@ func (srv *SummaryEvaluationService) ListExecutorNowEvaluationSelf(param *comman @@ -2017,3 +2017,44 @@ func (srv *SummaryEvaluationService) ListExecutorNowEvaluationSelf(param *comman
2017 result := tool_funs.SimpleWrapGridMap(int64(cnt), listResult) 2017 result := tool_funs.SimpleWrapGridMap(int64(cnt), listResult)
2018 return result, nil 2018 return result, nil
2019 } 2019 }
  2020 +
  2021 +// SearchAssessRemark
  2022 +func (srv *SummaryEvaluationService) SearchAssessRemark(param *command.QueryAssessRemark) (map[string][]map[string]string, error) {
  2023 + transactionContext, err := factory.CreateTransactionContext(nil)
  2024 + if err != nil {
  2025 + return nil, err
  2026 + }
  2027 + if err := transactionContext.StartTransaction(); err != nil {
  2028 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  2029 + }
  2030 + defer func() {
  2031 + _ = transactionContext.RollbackTransaction()
  2032 + }()
  2033 + assessDao := dao.NewStaffAssessDao(map[string]interface{}{"transactionContext": transactionContext})
  2034 +
  2035 + data, err := assessDao.SearchAssessSelfContentRemark(param.ProjectId, param.TargetUserId, param.Category, param.Name, param.LevelValue)
  2036 + if err != nil {
  2037 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取用户的角色信息列表"+err.Error())
  2038 + }
  2039 + if err := transactionContext.CommitTransaction(); err != nil {
  2040 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  2041 + }
  2042 + listData := []map[string]string{}
  2043 + for _, val := range data {
  2044 + remark := ""
  2045 + for _, val2 := range val.Remark {
  2046 + remark = remark + val2.RemarkText + "\n"
  2047 + }
  2048 + d := map[string]string{
  2049 + "beginDay": val.BeginDay,
  2050 + "category": val.Category,
  2051 + "name": val.Name,
  2052 + "remark": remark,
  2053 + }
  2054 + listData = append(listData, d)
  2055 + }
  2056 + result := map[string][]map[string]string{
  2057 + "list": listData,
  2058 + }
  2059 + return result, nil
  2060 +}
@@ -1375,3 +1375,38 @@ func (d *StaffAssessDao) SearchExecutorAssessAfterNow(executorId int, companyId @@ -1375,3 +1375,38 @@ func (d *StaffAssessDao) SearchExecutorAssessAfterNow(executorId int, companyId
1375 _, err := tx.Query(&result, sqlStr, condition1...) 1375 _, err := tx.Query(&result, sqlStr, condition1...)
1376 return result, err 1376 return result, err
1377 } 1377 }
  1378 +
  1379 +type AssessSelfContentRemark struct {
  1380 + Category string `pg:"category"` //评估的分类
  1381 + Name string `pg:"name"` //名称
  1382 + Remark []domain.AssessContemtRemark `pg:"remark"`
  1383 + BeginDay string `pg:"begin_day"` //开始的天数
  1384 + LevelValue string `pg:"level_value"`
  1385 +}
  1386 +
  1387 +func (d *StaffAssessDao) SearchAssessSelfContentRemark(projectId int, targetUserId int, category string, name string, levalvalue string) ([]AssessSelfContentRemark, error) {
  1388 + sqlStr := ` select
  1389 + staff_assess_content.level_value ,
  1390 + staff_assess_content.category ,
  1391 + staff_assess_content."name" ,
  1392 + staff_assess_content.remark ,
  1393 + to_char(staff_assess.begin_time at time zone 'PRC', 'YYYY-MM-DD') as begin_day
  1394 + from staff_assess_content
  1395 + join staff_assess on staff_assess_content.staff_assess_id = staff_assess.id
  1396 + where 1=1
  1397 + and staff_assess.deleted_at isnull
  1398 + and staff_assess_content.category =?
  1399 + and staff_assess_content."name" = ?
  1400 + and staff_assess_content.level_value =?
  1401 + and staff_assess.evaluation_project_id=?
  1402 + and target_user ->>'userId'='?'
  1403 + ORDER BY staff_assess.begin_time `
  1404 +
  1405 + var result []AssessSelfContentRemark
  1406 + condition := []interface{}{
  1407 + category, name, levalvalue, projectId, targetUserId,
  1408 + }
  1409 + tx := d.transactionContext.PgTx
  1410 + _, err := tx.Query(&result, sqlStr, condition...)
  1411 + return result, err
  1412 +}
@@ -370,3 +370,17 @@ func (c *SummaryEvaluationController) ListExecutorEvaluationSelf() { @@ -370,3 +370,17 @@ func (c *SummaryEvaluationController) ListExecutorEvaluationSelf() {
370 data, err := srv.ListExecutorNowEvaluationSelf(param) 370 data, err := srv.ListExecutorNowEvaluationSelf(param)
371 c.Response(data, err) 371 c.Response(data, err)
372 } 372 }
  373 +
  374 +// 获取现在待执行的综合自评
  375 +func (c *SummaryEvaluationController) SearchAssessRemark() {
  376 + srv := service.NewSummaryEvaluationService()
  377 + param := &command.QueryAssessRemark{}
  378 + err := c.BindJSON(param)
  379 + if err != nil {
  380 + e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
  381 + c.Response(nil, e)
  382 + return
  383 + }
  384 + data, err := srv.SearchAssessRemark(param)
  385 + c.Response(data, err)
  386 +}
@@ -36,6 +36,7 @@ func init() { @@ -36,6 +36,7 @@ func init() {
36 web.NSCtrlPost("/evaluation-finish/all/export", (*controllers.SummaryEvaluationController).ExportAllEvaluationFinish), 36 web.NSCtrlPost("/evaluation-finish/all/export", (*controllers.SummaryEvaluationController).ExportAllEvaluationFinish),
37 web.NSCtrlGet("/evaluation-self/now", (*controllers.SummaryEvaluationController).ListExecutorEvaluationSelf), 37 web.NSCtrlGet("/evaluation-self/now", (*controllers.SummaryEvaluationController).ListExecutorEvaluationSelf),
38 // 38 //
  39 + web.NSCtrlPost("/staff_assess/self/remark", (*controllers.SummaryEvaluationController).SearchAssessRemark),
39 ) 40 )
40 web.AddNamespace(summaryNS) 41 web.AddNamespace(summaryNS)
41 } 42 }