...
|
...
|
@@ -395,9 +395,7 @@ func (productGroupService *ProductGroupService) SearchProductGroupEmployees(oper |
|
|
transactionContext.RollbackTransaction()
|
|
|
}()
|
|
|
|
|
|
//workshops, _ := factory.FastPgWorkshops(transactionContext, operateInfo.CompanyId)
|
|
|
queryOptions := utils.ObjectToMap(cmd)
|
|
|
//queryOptions = workshops.FindByNameWithQuery(queryOptions, cmd.WorkshopName, cmd.LineName, "")
|
|
|
|
|
|
var productGroupRepository domain.ProductGroupRepository
|
|
|
productGroupRepository, _, _ = factory.FastPgProductGroup(transactionContext, 0)
|
...
|
...
|
@@ -422,6 +420,41 @@ func (productGroupService *ProductGroupService) SearchProductGroupEmployees(oper |
|
|
}, nil
|
|
|
}
|
|
|
|
|
|
// 返回在当前工段上打卡的所有用户
|
|
|
func (productGroupService *ProductGroupService) SearchProductGroupEmployeesV2(operateInfo *domain.OperateInfo, cmd *query.SearchProductGroupEmployeesQuery) (int64, interface{}, error) {
|
|
|
if err := cmd.ValidateQuery(); err != nil {
|
|
|
return 0, nil, application.ThrowError(application.ARG_ERROR, err.Error())
|
|
|
}
|
|
|
transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
if err != nil {
|
|
|
return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
if err := transactionContext.StartTransaction(); err != nil {
|
|
|
return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
defer func() {
|
|
|
transactionContext.RollbackTransaction()
|
|
|
}()
|
|
|
|
|
|
queryOptions := utils.ObjectToMap(cmd)
|
|
|
queryOptions["signBeginTime"] = utils.GetZeroTime(time.Now())
|
|
|
var attendanceRecordRepository domain.ProductAttendanceRecordRepository
|
|
|
attendanceRecordRepository, _, _ = factory.FastPgAttendance(transactionContext, 0)
|
|
|
_, productGroups, err := attendanceRecordRepository.Find(queryOptions)
|
|
|
if err != nil {
|
|
|
return 0, nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
var results = dto.NewProductGroupEmployeesDtos()
|
|
|
results.LoadDtoV2(productGroups...)
|
|
|
sort.Stable(results)
|
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
return int64(len(results.Result)), map[string]interface{}{
|
|
|
"employees": results.Result,
|
|
|
}, nil
|
|
|
}
|
|
|
|
|
|
// 返回生产班组服务列表
|
|
|
func (productGroupService *ProductGroupService) GetSignEmployee(cmd *query.GetSignInEmployeeQuery) (interface{}, error) {
|
|
|
if err := cmd.ValidateQuery(); err != nil {
|
...
|
...
|
|