作者 陈志颖

fix:验收任务参与人和领取人是否离职校验

... ... @@ -75,11 +75,12 @@ func (service *AcceptanceTaskService) Acceptance(taskId int64, operatorUid int64
for _, participatorUid := range participators {
if participator, err := employeeRepository.FindOne(map[string]interface{}{
"uid": participatorUid,
"status": 1,
}); err != nil {
return nil, err
} else {
if participator == nil {
return nil, fmt.Errorf("无效的参与人")
return nil, fmt.Errorf("无效的参与人: " + participator.EmployeeInfo.EmployeeName)
}
participatorMap[participator.EmployeeInfo.Uid] = participator
participatorInfos = append(participatorInfos, participator.EmployeeInfo)
... ... @@ -104,12 +105,13 @@ func (service *AcceptanceTaskService) Acceptance(taskId int64, operatorUid int64
if taskPercentageItem.IsReceiver {
receiver, err := employeeRepository.FindOne(map[string]interface{}{
"uid": taskPercentageItem.Contributor.Uid,
"status": 1,
})
if err != nil {
return nil, err
}
if receiver == nil {
return nil, fmt.Errorf("无效的任务领取者")
return nil, fmt.Errorf("无效的任务领取者:" + receiver.EmployeeInfo.EmployeeName)
}
employee = receiver
} else {
... ...
... ... @@ -139,7 +139,9 @@ func (repository *EmployeeRepository) Find(queryOptions map[string]interface{})
query = query.Where("employee.company_id = ?", companyId)
}
}
//query = query.Where(`employee.status = ?`, 1)
if status, ok := queryOptions["status"]; ok {
query = query.Where(`employee.status = ?`, status)
}
if isPrincipal, ok := queryOptions["isPrincipal"]; ok && isPrincipal.(bool) != false {
query = query.Where("employee.is_principal = ? ", isPrincipal)
}
... ...