作者 Your Name

更新

1 package dto 1 package dto
2 2
3 import ( 3 import (
  4 + "time"
  5 +
4 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/domain" 6 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/domain"
5 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/utils" 7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/utils"
6 - "time"  
7 ) 8 )
8 9
9 type AttendanceRecordDto struct { 10 type AttendanceRecordDto struct {
@@ -63,7 +64,9 @@ func (d *AttendanceRecordDto) LoadDto(m *domain.ProductAttendanceRecord, orgId i @@ -63,7 +64,9 @@ func (d *AttendanceRecordDto) LoadDto(m *domain.ProductAttendanceRecord, orgId i
63 d.WorkTimeAfter = m.WorkTimeAfter 64 d.WorkTimeAfter = m.WorkTimeAfter
64 d.AttendanceStatus = m.AttendanceStatus 65 d.AttendanceStatus = m.AttendanceStatus
65 d.AuthFlag = domain.CheckOrgAuth(orgId, m.OrgId) 66 d.AuthFlag = domain.CheckOrgAuth(orgId, m.OrgId)
66 - d.OrgName = m.Ext.OrgName 67 + if m.Ext != nil {
  68 + d.OrgName = m.Ext.OrgName
  69 + }
67 d.ApproveUser = m.ApproveUser() 70 d.ApproveUser = m.ApproveUser()
68 d.GroupName = m.GroupName() 71 d.GroupName = m.GroupName()
69 if m.Ext != nil && m.Ext.AttendanceExt != nil { 72 if m.Ext != nil && m.Ext.AttendanceExt != nil {
@@ -11,6 +11,7 @@ import ( @@ -11,6 +11,7 @@ import (
11 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/ecelData/command" 11 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/ecelData/command"
12 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/factory" 12 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/factory"
13 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/domain" 13 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/domain"
  14 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/domainService"
14 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/utils/converter" 15 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/utils/converter"
15 ) 16 )
16 17
@@ -114,6 +115,19 @@ func (srv ExcelDataService) BatchAddAttendance(operate domain.OperateInfo, param @@ -114,6 +115,19 @@ func (srv ExcelDataService) BatchAddAttendance(operate domain.OperateInfo, param
114 defer func() { 115 defer func() {
115 transactionContext.RollbackTransaction() 116 transactionContext.RollbackTransaction()
116 }() 117 }()
  118 + //获取当前操作人
  119 + userSrv := domainService.NewUserService()
  120 + operateUser, err := userSrv.User(operate.UserId)
  121 + if err != nil {
  122 + return nil, application.ThrowError(application.TRANSACTION_ERROR, "查询操作人数据失败。"+err.Error())
  123 + }
  124 + //获取当前操作人的组织
  125 + var org *domain.Org
  126 + org, err = userSrv.Organization(operate.OrgId)
  127 + if err != nil {
  128 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  129 + }
  130 +
117 //车间数据 131 //车间数据
118 //生产班组 数据 132 //生产班组 数据
119 productGroupRepo, _ := factory.CreateProductGroupRepository(map[string]interface{}{ 133 productGroupRepo, _ := factory.CreateProductGroupRepository(map[string]interface{}{
@@ -267,6 +281,7 @@ func (srv ExcelDataService) BatchAddAttendance(operate domain.OperateInfo, param @@ -267,6 +281,7 @@ func (srv ExcelDataService) BatchAddAttendance(operate domain.OperateInfo, param
267 DeletedAt: time.Time{}, 281 DeletedAt: time.Time{},
268 ProductDate: productDate, 282 ProductDate: productDate,
269 Ext: &domain.Ext{ 283 Ext: &domain.Ext{
  284 + OrgName: org.OrgName,
270 DeviceExt: &domain.DeviceExt{}, 285 DeviceExt: &domain.DeviceExt{},
271 ProductPlanExt: &domain.ProductPlanExt{}, 286 ProductPlanExt: &domain.ProductPlanExt{},
272 AttendanceExt: &domain.ProductAttendanceRecordExt{}, 287 AttendanceExt: &domain.ProductAttendanceRecordExt{},