作者 Your Name

更新

package command
type QueryAssessRemark struct {
ProjectId int `json:"projectId"`
LevelValue string `json:"levelValue"`
Category string `json:"category"`
Name string `json:"name"`
TargetUserId int `json:"targetUserId"`
}
... ...
... ... @@ -2017,3 +2017,44 @@ func (srv *SummaryEvaluationService) ListExecutorNowEvaluationSelf(param *comman
result := tool_funs.SimpleWrapGridMap(int64(cnt), listResult)
return result, nil
}
// SearchAssessRemark
func (srv *SummaryEvaluationService) SearchAssessRemark(param *command.QueryAssessRemark) (map[string][]map[string]string, error) {
transactionContext, err := factory.CreateTransactionContext(nil)
if err != nil {
return nil, err
}
if err := transactionContext.StartTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
defer func() {
_ = transactionContext.RollbackTransaction()
}()
assessDao := dao.NewStaffAssessDao(map[string]interface{}{"transactionContext": transactionContext})
data, err := assessDao.SearchAssessSelfContentRemark(param.ProjectId, param.TargetUserId, param.Category, param.Name, param.LevelValue)
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取用户的角色信息列表"+err.Error())
}
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
listData := []map[string]string{}
for _, val := range data {
remark := ""
for _, val2 := range val.Remark {
remark = remark + val2.RemarkText + "\n"
}
d := map[string]string{
"beginDay": val.BeginDay,
"category": val.Category,
"name": val.Name,
"remark": remark,
}
listData = append(listData, d)
}
result := map[string][]map[string]string{
"list": listData,
}
return result, nil
}
... ...
... ... @@ -1375,3 +1375,38 @@ func (d *StaffAssessDao) SearchExecutorAssessAfterNow(executorId int, companyId
_, err := tx.Query(&result, sqlStr, condition1...)
return result, err
}
type AssessSelfContentRemark struct {
Category string `pg:"category"` //评估的分类
Name string `pg:"name"` //名称
Remark []domain.AssessContemtRemark `pg:"remark"`
BeginDay string `pg:"begin_day"` //开始的天数
LevelValue string `pg:"level_value"`
}
func (d *StaffAssessDao) SearchAssessSelfContentRemark(projectId int, targetUserId int, category string, name string, levalvalue string) ([]AssessSelfContentRemark, error) {
sqlStr := ` select
staff_assess_content.level_value ,
staff_assess_content.category ,
staff_assess_content."name" ,
staff_assess_content.remark ,
to_char(staff_assess.begin_time at time zone 'PRC', 'YYYY-MM-DD') as begin_day
from staff_assess_content
join staff_assess on staff_assess_content.staff_assess_id = staff_assess.id
where 1=1
and staff_assess.deleted_at isnull
and staff_assess_content.category =?
and staff_assess_content."name" = ?
and staff_assess_content.level_value =?
and staff_assess.evaluation_project_id=?
and target_user ->>'userId'='?'
ORDER BY staff_assess.begin_time `
var result []AssessSelfContentRemark
condition := []interface{}{
category, name, levalvalue, projectId, targetUserId,
}
tx := d.transactionContext.PgTx
_, err := tx.Query(&result, sqlStr, condition...)
return result, err
}
... ...
... ... @@ -370,3 +370,17 @@ func (c *SummaryEvaluationController) ListExecutorEvaluationSelf() {
data, err := srv.ListExecutorNowEvaluationSelf(param)
c.Response(data, err)
}
// 获取现在待执行的综合自评
func (c *SummaryEvaluationController) SearchAssessRemark() {
srv := service.NewSummaryEvaluationService()
param := &command.QueryAssessRemark{}
err := c.BindJSON(param)
if err != nil {
e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
c.Response(nil, e)
return
}
data, err := srv.SearchAssessRemark(param)
c.Response(data, err)
}
... ...
... ... @@ -36,6 +36,7 @@ func init() {
web.NSCtrlPost("/evaluation-finish/all/export", (*controllers.SummaryEvaluationController).ExportAllEvaluationFinish),
web.NSCtrlGet("/evaluation-self/now", (*controllers.SummaryEvaluationController).ListExecutorEvaluationSelf),
//
web.NSCtrlPost("/staff_assess/self/remark", (*controllers.SummaryEvaluationController).SearchAssessRemark),
)
web.AddNamespace(summaryNS)
}
... ...