作者 tangxvhui

日常保存

... ... @@ -32,29 +32,29 @@ func (h *HeaderLevel) addChild(name string) (child *HeaderLevel) {
}
// 获取表头的所有列表名
func (h *HeaderLevel) collectAllColumn(all *[][]string) {
for _, v := range h.Child {
v.collectColumn(&v, all, nil)
}
}
func (h *HeaderLevel) collectColumn(child *HeaderLevel, columns *[][]string, column *[]string) {
if column == nil {
column = &[]string{}
}
*column = append(*column, h.Name)
for _, v := range child.Child {
if len(v.Child) > 0 {
v.collectColumn(&v, columns, column)
}
if len(v.Child) == 0 {
item := make([]string, len(*column))
copy(item, *column)
item = append(item, v.Name)
*columns = append(*columns, item)
}
}
}
// func (h *HeaderLevel) collectAllColumn(all *[][]string) {
// for _, v := range h.Child {
// v.collectColumn(&v, all, nil)
// }
// }
// func (h *HeaderLevel) collectColumn(child *HeaderLevel, columns *[][]string, column *[]string) {
// if column == nil {
// column = &[]string{}
// }
// *column = append(*column, h.Name)
// for _, v := range child.Child {
// if len(v.Child) > 0 {
// v.collectColumn(&v, columns, column)
// }
// if len(v.Child) == 0 {
// item := make([]string, len(*column))
// copy(item, *column)
// item = append(item, v.Name)
// *columns = append(*columns, item)
// }
// }
// }
type exportData struct {
userName []string //员工的名称列表 ,对应excel文件的多个sheet
... ... @@ -156,9 +156,9 @@ func (e *exportData) weightDesc(weight float64) string {
}
}
func (e *exportData) userDayKey(userName string) string {
return userName
}
// func (e *exportData) userDayKey(userName string) string {
// return userName
// }
type exportData2 struct {
tableHeader HeaderLevel //数据表格对应表头
... ...
... ... @@ -2,6 +2,9 @@ package service
import (
"fmt"
"strconv"
"strings"
"github.com/linmadan/egglib-go/core/application"
"github.com/linmadan/egglib-go/utils/tool_funs"
"github.com/xuri/excelize/v2"
... ... @@ -11,31 +14,29 @@ import (
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/staff_assess/query"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/infrastructure/dao"
"strconv"
"strings"
)
// 调试用,手动调用CreateStaffAssessTask
func (srv StaffAssessServeice) InvokCreateStaffAssessTask(param *command.CreateStaffAssessTask) (map[string]interface{}, error) {
transactionContext, err := factory.CreateTransactionContext(nil)
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
if err := transactionContext.StartTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
defer func() {
_ = transactionContext.RollbackTransaction()
}()
// transactionContext, err := factory.CreateTransactionContext(nil)
// if err != nil {
// return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
// }
// if err := transactionContext.StartTransaction(); err != nil {
// return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
// }
// defer func() {
// _ = transactionContext.RollbackTransaction()
// }()
data, err := srv.CreateStaffAssessTask(transactionContext, param)
if err != nil {
return nil, err
}
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
return data, nil
// data, err := srv.CreateStaffAssessTask(transactionContext, param)
// if err != nil {
// return nil, err
// }
// if err := transactionContext.CommitTransaction(); err != nil {
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
// }
return nil, nil
}
func (srv StaffAssessServeice) QuerySummary(in *query.SummaryCommand) (map[string]interface{}, error) {
... ... @@ -82,7 +83,7 @@ func (srv StaffAssessServeice) QuerySummary(in *query.SummaryCommand) (map[strin
if invite.EndTime == nil {
invite.EndTime = &d.EndTime
}
break
case domain.AssessSuper:
supper.Total++
if d.Status == domain.StaffAssessCompleted {
... ... @@ -91,7 +92,7 @@ func (srv StaffAssessServeice) QuerySummary(in *query.SummaryCommand) (map[strin
if supper.EndTime == nil {
supper.EndTime = &d.EndTime
}
break
case domain.AssessInviteDiffSuper, domain.AssessInviteSameSuper:
inviteAssess.Total++
if d.Status == domain.StaffAssessCompleted {
... ... @@ -102,7 +103,7 @@ func (srv StaffAssessServeice) QuerySummary(in *query.SummaryCommand) (map[strin
}
inviteTargetIdMap[d.TargetUserId] = 0 // 360评估类型都是被人邀请的评估,过滤相同的目标用户后,就是完成邀请的数量
break
}
}
invite.Completed = len(inviteTargetIdMap)
... ...
... ... @@ -329,4 +329,4 @@ func sendSmsEvalation(param []domain.SummaryEvaluation) error {
return nil
}
//
//周期自评 短信提醒
... ...