作者 yangfu

feat: 批量添加用户修改

@@ -111,6 +111,8 @@ spec: @@ -111,6 +111,8 @@ spec:
111 value: "http://allied-creation-user-dev.fjmaimaimai.com" 111 value: "http://allied-creation-user-dev.fjmaimaimai.com"
112 - name: ALLIED_CREATION_COOPERATION_HOST 112 - name: ALLIED_CREATION_COOPERATION_HOST
113 value: "http://allied-creation-cooperation-dev.fjmaimaimai.com" 113 value: "http://allied-creation-cooperation-dev.fjmaimaimai.com"
  114 + - name: ALLIED_CREATION_MANUFACTURE_HOST
  115 + value: "http://allied-creation-manufacture-dev.fjmaimaimai.com"
114 - name: ALLIED_CREATION_BASIC_HOST 116 - name: ALLIED_CREATION_BASIC_HOST
115 value: "http://allied-creation-basic-dev.fjmaimaimai.com" 117 value: "http://allied-creation-basic-dev.fjmaimaimai.com"
116 - name: SMS_SERVE_HOST 118 - name: SMS_SERVE_HOST
@@ -115,6 +115,8 @@ spec: @@ -115,6 +115,8 @@ spec:
115 value: "https://allied-creation-user-prd.fjmaimaimai.com" 115 value: "https://allied-creation-user-prd.fjmaimaimai.com"
116 - name: ALLIED_CREATION_COOPERATION_HOST 116 - name: ALLIED_CREATION_COOPERATION_HOST
117 value: "https://allied-creation-cooperation-prd.fjmaimaimai.com" 117 value: "https://allied-creation-cooperation-prd.fjmaimaimai.com"
  118 + - name: ALLIED_CREATION_MANUFACTURE_HOST
  119 + value: "https://allied-creation-manufacture-prd.fjmaimaimai.com"
118 - name: ALLIED_CREATION_BASIC_HOST 120 - name: ALLIED_CREATION_BASIC_HOST
119 value: "https://allied-creation-basic-prd.fjmaimaimai.com" 121 value: "https://allied-creation-basic-prd.fjmaimaimai.com"
120 - name: SMS_SERVE_HOST 122 - name: SMS_SERVE_HOST
@@ -119,6 +119,8 @@ spec: @@ -119,6 +119,8 @@ spec:
119 value: "https://allied-creation-cooperation-test.fjmaimaimai.com" 119 value: "https://allied-creation-cooperation-test.fjmaimaimai.com"
120 - name: ALLIED_CREATION_BASIC_HOST 120 - name: ALLIED_CREATION_BASIC_HOST
121 value: "https://allied-creation-basic-test.fjmaimaimai.com" 121 value: "https://allied-creation-basic-test.fjmaimaimai.com"
  122 + - name: ALLIED_CREATION_MANUFACTURE_HOST
  123 + value: "http://allied-creation-manufacture-test.fjmaimaimai.com"
122 - name: SMS_SERVE_HOST 124 - name: SMS_SERVE_HOST
123 value: "https://sms.fjmaimaimai.com:9897" 125 value: "https://sms.fjmaimaimai.com:9897"
124 - name: SUPLUS_SALE_APP 126 - name: SUPLUS_SALE_APP
  1 +package query
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
  5 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_manufacture"
  6 +)
  7 +
  8 +type ManufactureExportEmployeeAttendanceStaticsQuery struct {
  9 + *allied_creation_manufacture.SearchEmployeeAttendanceStaticsRequest
  10 + //操作人
  11 + Operator domain.Operator `json:"-"`
  12 + SelectedField []string `json:"selectedField"`
  13 +}
  1 +package query
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
  5 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_manufacture"
  6 +)
  7 +
  8 +type ManufactureExportWorkshopAttendanceStaticsQuery struct {
  9 + *allied_creation_manufacture.SearchWorkshopWorkTimeStaticsRequest
  10 + //操作人
  11 + Operator domain.Operator `json:"-"`
  12 + SelectedField []string `json:"selectedField"`
  13 +}
@@ -66,6 +66,7 @@ func (srv ExcelDataService) ExportProducts(cmd *query.SearchProductQuery) (Expor @@ -66,6 +66,7 @@ func (srv ExcelDataService) ExportProducts(cmd *query.SearchProductQuery) (Expor
66 return ExportProductsData{SourceData: result.Grid.List, SelectedField: cmd.SelectedField}, nil 66 return ExportProductsData{SourceData: result.Grid.List, SelectedField: cmd.SelectedField}, nil
67 } 67 }
68 68
  69 +// ExportEmployeeProductive 导出员工产能
69 func (srv ExcelDataService) ExportEmployeeProductive(cmd *query.ManufactureEmployeeProductiveQuery) (ExportEmployeeProductiveData, error) { 70 func (srv ExcelDataService) ExportEmployeeProductive(cmd *query.ManufactureEmployeeProductiveQuery) (ExportEmployeeProductiveData, error) {
70 creationUserGateway := allied_creation_manufacture.NewHttpLibAlliedCreationManufacture(cmd.Operator) 71 creationUserGateway := allied_creation_manufacture.NewHttpLibAlliedCreationManufacture(cmd.Operator)
71 result, err := creationUserGateway.SearchEmployeeProductive(allied_creation_manufacture.SearchEmployeeProductiveRequest{ 72 result, err := creationUserGateway.SearchEmployeeProductive(allied_creation_manufacture.SearchEmployeeProductiveRequest{
@@ -83,6 +84,7 @@ func (srv ExcelDataService) ExportEmployeeProductive(cmd *query.ManufactureEmplo @@ -83,6 +84,7 @@ func (srv ExcelDataService) ExportEmployeeProductive(cmd *query.ManufactureEmplo
83 return ExportEmployeeProductiveData{SourceData: result.Grid.List, SelectedField: cmd.SelectedField}, nil 84 return ExportEmployeeProductiveData{SourceData: result.Grid.List, SelectedField: cmd.SelectedField}, nil
84 } 85 }
85 86
  87 +// ExportEmployeeProductive 导出车间产能
86 func (srv ExcelDataService) ExportWorkshopProductive(cmd *query.ManufactureWorkshopProductiveQuery) (ExportWorkshopProductiveData, error) { 88 func (srv ExcelDataService) ExportWorkshopProductive(cmd *query.ManufactureWorkshopProductiveQuery) (ExportWorkshopProductiveData, error) {
87 creationUserGateway := allied_creation_manufacture.NewHttpLibAlliedCreationManufacture(cmd.Operator) 89 creationUserGateway := allied_creation_manufacture.NewHttpLibAlliedCreationManufacture(cmd.Operator)
88 result, err := creationUserGateway.SearchWorkshopProductive(allied_creation_manufacture.SearchWorkshopProductiveRequest{ 90 result, err := creationUserGateway.SearchWorkshopProductive(allied_creation_manufacture.SearchWorkshopProductiveRequest{
@@ -96,3 +98,23 @@ func (srv ExcelDataService) ExportWorkshopProductive(cmd *query.ManufactureWorks @@ -96,3 +98,23 @@ func (srv ExcelDataService) ExportWorkshopProductive(cmd *query.ManufactureWorks
96 } 98 }
97 return ExportWorkshopProductiveData{SourceData: result.Grid.List, SelectedField: cmd.SelectedField}, nil 99 return ExportWorkshopProductiveData{SourceData: result.Grid.List, SelectedField: cmd.SelectedField}, nil
98 } 100 }
  101 +
  102 +// ExportEmployeeAttendanceStatics 导出员工工时
  103 +func (srv ExcelDataService) ExportEmployeeAttendanceStatics(cmd *query.ManufactureExportEmployeeAttendanceStaticsQuery) (ExportEmployeeAttendanceStaticsData, error) {
  104 + creationUserGateway := allied_creation_manufacture.NewHttpLibAlliedCreationManufacture(cmd.Operator)
  105 + result, err := creationUserGateway.SearchEmployeeAttendanceStatics(*cmd.SearchEmployeeAttendanceStaticsRequest)
  106 + if err != nil {
  107 + return ExportEmployeeAttendanceStaticsData{}, fmt.Errorf("获取员工工时数据失败:%w", err)
  108 + }
  109 + return ExportEmployeeAttendanceStaticsData{SourceData: result.Grid.List, SelectedField: cmd.SelectedField}, nil
  110 +}
  111 +
  112 +// ExportWorkshopAttendanceStatics 导出车间工时
  113 +func (srv ExcelDataService) ExportWorkshopAttendanceStatics(cmd *query.ManufactureExportWorkshopAttendanceStaticsQuery) (ExportWorkshopAttendanceStaticsData, error) {
  114 + creationUserGateway := allied_creation_manufacture.NewHttpLibAlliedCreationManufacture(cmd.Operator)
  115 + result, err := creationUserGateway.SearchWorkshopWorkTimeStatics(*cmd.SearchWorkshopWorkTimeStaticsRequest)
  116 + if err != nil {
  117 + return ExportWorkshopAttendanceStaticsData{}, fmt.Errorf("获取车间工时数据失败:%w", err)
  118 + }
  119 + return ExportWorkshopAttendanceStaticsData{SourceData: result.Grid.List, SelectedField: cmd.SelectedField}, nil
  120 +}
@@ -91,6 +91,8 @@ func (srv ExcelDataService) ImportCompanyUser(importDataCommand *command.ImportD @@ -91,6 +91,8 @@ func (srv ExcelDataService) ImportCompanyUser(importDataCommand *command.ImportD
91 {EnName: "department", CnName: "*所属部门"}, 91 {EnName: "department", CnName: "*所属部门"},
92 {EnName: "enableStatus", CnName: "*用户状态"}, 92 {EnName: "enableStatus", CnName: "*用户状态"},
93 {EnName: "phone", CnName: "*手机号"}, 93 {EnName: "phone", CnName: "*手机号"},
  94 + {EnName: "employeeType", CnName: "*员工类型"},
  95 + {EnName: "icCardNumber", CnName: "IC卡号"},
94 {EnName: "email", CnName: "邮箱"}, 96 {EnName: "email", CnName: "邮箱"},
95 } 97 }
96 excelData, err := excelImport.OpenExcelFromIoReader(importDataCommand.Reader) 98 excelData, err := excelImport.OpenExcelFromIoReader(importDataCommand.Reader)
@@ -112,6 +114,8 @@ func (srv ExcelDataService) ImportCompanyUser(importDataCommand *command.ImportD @@ -112,6 +114,8 @@ func (srv ExcelDataService) ImportCompanyUser(importDataCommand *command.ImportD
112 Phone: strings.TrimSpace(v["phone"]), 114 Phone: strings.TrimSpace(v["phone"]),
113 Email: strings.TrimSpace(v["email"]), 115 Email: strings.TrimSpace(v["email"]),
114 EnableStatus: strings.TrimSpace(v["enableStatus"]), 116 EnableStatus: strings.TrimSpace(v["enableStatus"]),
  117 + EmployeeType: strings.TrimSpace(v["employeeType"]),
  118 + IcCardNumber: strings.TrimSpace(v["icCardNumber"]),
115 } 119 }
116 users = append(users, item) 120 users = append(users, item)
117 } 121 }
@@ -408,3 +408,151 @@ func (data ExportWorkshopProductiveData) DataListLen() int { @@ -408,3 +408,151 @@ func (data ExportWorkshopProductiveData) DataListLen() int {
408 func (data ExportWorkshopProductiveData) TableTitle() []string { 408 func (data ExportWorkshopProductiveData) TableTitle() []string {
409 return nil 409 return nil
410 } 410 }
  411 +
  412 +//ExportEmployeeAttendanceStaticsData 导出员工产能数据
  413 +type ExportEmployeeAttendanceStaticsData struct {
  414 + SourceData []allied_creation_manufacture.SearchEmployeeAttendanceStaticsItem
  415 + SelectedField []string
  416 +}
  417 +
  418 +var _ excel.ExcelMaker = (*ExportEmployeeAttendanceStaticsData)(nil)
  419 +
  420 +func (data ExportEmployeeAttendanceStaticsData) AllFields() []DataFieldOptions {
  421 + return []DataFieldOptions{
  422 + {EnName: "signDate", CnName: "日期"},
  423 + {EnName: "workshopName", CnName: "车间名称"},
  424 + {EnName: "lineName", CnName: "线别"},
  425 + {EnName: "sectionName", CnName: "工段"},
  426 + {EnName: "userName", CnName: "姓名"},
  427 + {EnName: "employeeTypeDescription", CnName: "员工类型"},
  428 + {EnName: "attendanceTypeDescription", CnName: "类别"},
  429 + {EnName: "workTime", CnName: "工时"},
  430 + {EnName: "attendanceStatusDescription", CnName: "状态"},
  431 + {EnName: "orgName", CnName: "组织机构"},
  432 + }
  433 +}
  434 +
  435 +func (data ExportEmployeeAttendanceStaticsData) DataFieldList() []excel.DataField {
  436 + fields := []excel.DataField{}
  437 + allFields := data.AllFields()
  438 + for _, value2 := range allFields {
  439 + if len(data.SelectedField) == 0 || value2.IsDefault {
  440 + fields = append(fields, excel.DataField{EnName: value2.EnName, CnName: value2.CnName})
  441 + continue
  442 + }
  443 + for _, value3 := range data.SelectedField {
  444 + if value2.EnName == value3 {
  445 + fields = append(fields, excel.DataField{EnName: value2.EnName, CnName: value2.CnName})
  446 + }
  447 + }
  448 + }
  449 + return fields
  450 +}
  451 +
  452 +func (data ExportEmployeeAttendanceStaticsData) CellValue(index int, enName string) (value interface{}) {
  453 + if index > data.DataListLen() {
  454 + return ""
  455 + }
  456 + switch enName {
  457 + case "signDate":
  458 + return data.SourceData[index].SignDate
  459 + case "workshopName":
  460 + return data.SourceData[index].WorkshopName
  461 + case "lineName":
  462 + return data.SourceData[index].LineName
  463 + case "sectionName":
  464 + return data.SourceData[index].SectionName
  465 + case "userName":
  466 + return data.SourceData[index].ProductWorker.UserName
  467 + case "employeeTypeDescription":
  468 + return data.SourceData[index].EmployeeTypeDescription
  469 + case "attendanceTypeDescription":
  470 + return data.SourceData[index].AttendanceTypeDescription
  471 + case "workTime":
  472 + return fmt.Sprintf("%vh", data.SourceData[index].WorkTime)
  473 + case "attendanceStatusDescription":
  474 + return data.SourceData[index].AttendanceStatusDescription
  475 + case "orgName":
  476 + return data.SourceData[index].OrgName
  477 + }
  478 + return nil
  479 +}
  480 +
  481 +func (data ExportEmployeeAttendanceStaticsData) DataListLen() int {
  482 + return len(data.SourceData)
  483 +}
  484 +
  485 +func (data ExportEmployeeAttendanceStaticsData) TableTitle() []string {
  486 + return nil
  487 +}
  488 +
  489 +//ExportWorkshopAttendanceStaticsData 导出车间工时统计
  490 +type ExportWorkshopAttendanceStaticsData struct {
  491 + SourceData []allied_creation_manufacture.SearchWorkshopWorkTimeStaticsItem
  492 + SelectedField []string
  493 +}
  494 +
  495 +var _ excel.ExcelMaker = (*ExportWorkshopAttendanceStaticsData)(nil)
  496 +
  497 +func (data ExportWorkshopAttendanceStaticsData) AllFields() []DataFieldOptions {
  498 + return []DataFieldOptions{
  499 + {EnName: "recordDate", CnName: "日期"},
  500 + {EnName: "workshopName", CnName: "车间名称"},
  501 + {EnName: "lineName", CnName: "线别"},
  502 + {EnName: "sectionName", CnName: "工段"},
  503 + {EnName: "eftWorkTime", CnName: "固定工时"},
  504 + {EnName: "edWorkTime", CnName: "临时工时"},
  505 + {EnName: "epWorkTime", CnName: "派遣工时"},
  506 + {EnName: "orgName", CnName: "组织机构"},
  507 + }
  508 +}
  509 +
  510 +func (data ExportWorkshopAttendanceStaticsData) DataFieldList() []excel.DataField {
  511 + fields := []excel.DataField{}
  512 + allFields := data.AllFields()
  513 + for _, value2 := range allFields {
  514 + if len(data.SelectedField) == 0 || value2.IsDefault {
  515 + fields = append(fields, excel.DataField{EnName: value2.EnName, CnName: value2.CnName})
  516 + continue
  517 + }
  518 + for _, value3 := range data.SelectedField {
  519 + if value2.EnName == value3 {
  520 + fields = append(fields, excel.DataField{EnName: value2.EnName, CnName: value2.CnName})
  521 + }
  522 + }
  523 + }
  524 + return fields
  525 +}
  526 +
  527 +func (data ExportWorkshopAttendanceStaticsData) CellValue(index int, enName string) (value interface{}) {
  528 + if index > data.DataListLen() {
  529 + return ""
  530 + }
  531 + switch enName {
  532 + case "recordDate":
  533 + return data.SourceData[index].RecordDate
  534 + case "workshopName":
  535 + return data.SourceData[index].WorkshopName
  536 + case "lineName":
  537 + return data.SourceData[index].LineName
  538 + case "sectionName":
  539 + return data.SourceData[index].SectionName
  540 + case "eftWorkTime":
  541 + return data.SourceData[index].EftWorkTime
  542 + case "edWorkTime":
  543 + return data.SourceData[index].EdWorkTime
  544 + case "epWorkTime":
  545 + return data.SourceData[index].EptWorkTime
  546 + case "orgName":
  547 + return data.SourceData[index].OrgName
  548 + }
  549 + return nil
  550 +}
  551 +
  552 +func (data ExportWorkshopAttendanceStaticsData) DataListLen() int {
  553 + return len(data.SourceData)
  554 +}
  555 +
  556 +func (data ExportWorkshopAttendanceStaticsData) TableTitle() []string {
  557 + return nil
  558 +}
@@ -30,6 +30,10 @@ type CompanyUserAddCommand struct { @@ -30,6 +30,10 @@ type CompanyUserAddCommand struct {
30 UserRole []Role `json:"userRole,omitempty"` 30 UserRole []Role `json:"userRole,omitempty"`
31 // 头像 31 // 头像
32 Avatar string `json:"avatar" valid:"Required"` 32 Avatar string `json:"avatar" valid:"Required"`
  33 + // 员工类型 1:固定 2:派遣 3.临时
  34 + EmployeeType int `cname:"员工类型" json:"employeeType" valid:"Required"`
  35 + // IC卡号
  36 + IcCardNumber string `cname:"IC卡号" json:"icCardNumber,omitempty"`
33 } 37 }
34 38
35 func (companyUserAddCommand *CompanyUserAddCommand) Valid(validation *validation.Validation) { 39 func (companyUserAddCommand *CompanyUserAddCommand) Valid(validation *validation.Validation) {
@@ -25,6 +25,10 @@ type CompanyUserUpdateCommand struct { @@ -25,6 +25,10 @@ type CompanyUserUpdateCommand struct {
25 Phone string `json:"phone,omitempty"` 25 Phone string `json:"phone,omitempty"`
26 // 邮箱 26 // 邮箱
27 Email string `json:"email,omitempty"` 27 Email string `json:"email,omitempty"`
  28 + // 员工类型 1:固定 2:派遣 3.临时
  29 + EmployeeType int `cname:"员工类型" json:"employeeType" valid:"Required"`
  30 + // IC卡号
  31 + IcCardNumber string `cname:"IC卡号" json:"icCardNumber,omitempty"`
28 // 关联的组织机构 32 // 关联的组织机构
29 UserOrg []Org `json:"userOrg,omitempty"` 33 UserOrg []Org `json:"userOrg,omitempty"`
30 // 关联的组织结构 34 // 关联的组织结构
@@ -141,6 +141,8 @@ func (usersService *UsersService) CompanyUserAdd(companyUserAddCommand *command. @@ -141,6 +141,8 @@ func (usersService *UsersService) CompanyUserAdd(companyUserAddCommand *command.
141 Phone: companyUserAddCommand.Phone, 141 Phone: companyUserAddCommand.Phone,
142 Avatar: companyUserAddCommand.Avatar, 142 Avatar: companyUserAddCommand.Avatar,
143 Email: companyUserAddCommand.Email, 143 Email: companyUserAddCommand.Email,
  144 + IcCardNumber: companyUserAddCommand.IcCardNumber,
  145 + EmployeeType: companyUserAddCommand.EmployeeType,
144 Password: initPassword, 146 Password: initPassword,
145 }) 147 })
146 if err != nil { 148 if err != nil {
@@ -280,6 +282,8 @@ func (usersService *UsersService) CompanyUserUpdate(companyUserUpdateCommand *co @@ -280,6 +282,8 @@ func (usersService *UsersService) CompanyUserUpdate(companyUserUpdateCommand *co
280 Phone: companyUserUpdateCommand.Phone, 282 Phone: companyUserUpdateCommand.Phone,
281 Avatar: companyUserUpdateCommand.Avatar, 283 Avatar: companyUserUpdateCommand.Avatar,
282 Email: companyUserUpdateCommand.Email, 284 Email: companyUserUpdateCommand.Email,
  285 + EmployeeType: companyUserUpdateCommand.EmployeeType,
  286 + IcCardNumber: companyUserUpdateCommand.IcCardNumber,
283 }) 287 })
284 if err != nil { 288 if err != nil {
285 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 289 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
@@ -82,6 +82,11 @@ const ( @@ -82,6 +82,11 @@ const (
82 ExportManufactureEmployeeProductive = "ExportManufactureEmployeeProductive" 82 ExportManufactureEmployeeProductive = "ExportManufactureEmployeeProductive"
83 // 导出车间产能统计 83 // 导出车间产能统计
84 ExportManufactureWorkshopProductive = "ExportManufactureWorkshopProductive" 84 ExportManufactureWorkshopProductive = "ExportManufactureWorkshopProductive"
  85 +
  86 + // 员工工时
  87 + ExportManufactureEmployeeAttendanceStatics = "ExportManufactureEmployeeAttendanceStatics"
  88 + // 车间工时
  89 + ExportManufactureWorkshopAttendanceStatics = "ExportManufactureWorkshopAttendanceStatics"
85 ) 90 )
86 91
87 const ( 92 const (
@@ -22,6 +22,7 @@ func NewHttpLibAlliedCreationManufacture(operator domain.Operator) *HttpLibAllie @@ -22,6 +22,7 @@ func NewHttpLibAlliedCreationManufacture(operator domain.Operator) *HttpLibAllie
22 ReadWriteTimeout: 100 * time.Second, 22 ReadWriteTimeout: 100 * time.Second,
23 CompanyId: operator.CompanyId, 23 CompanyId: operator.CompanyId,
24 OrgId: operator.OrgId, 24 OrgId: operator.OrgId,
  25 + InOrgIds: operator.OrgIds,
25 UserId: operator.UserId, 26 UserId: operator.UserId,
26 UserBaseId: operator.UserBaseId, 27 UserBaseId: operator.UserBaseId,
27 }, 28 },
@@ -224,3 +225,108 @@ type ( @@ -224,3 +225,108 @@ type (
224 QualificationRate int `json:"qualificationRate"` 225 QualificationRate int `json:"qualificationRate"`
225 } 226 }
226 ) 227 )
  228 +
  229 +/*** 考勤记录 ***/
  230 +//SearchEmployeeAttendanceStatics 搜索员工工时统计
  231 +func (gateway HttpLibAlliedCreationManufacture) SearchEmployeeAttendanceStatics(param SearchEmployeeAttendanceStaticsRequest) (*SearchEmployeeAttendanceStaticsResponse, error) {
  232 + url := fmt.Sprintf("%s%s", gateway.BaseUrl(), "/attendances/employee-attendance-statics/search")
  233 + method := "post"
  234 + var data SearchEmployeeAttendanceStaticsResponse
  235 + err := gateway.FastDoRequest(url, method, param, &data)
  236 + return &data, err
  237 +}
  238 +
  239 +type (
  240 + SearchEmployeeAttendanceStaticsRequest struct {
  241 + // 车间名称
  242 + WorkshopName string `cname:"车间名称" json:"workshopName,omitempty"`
  243 + // 生产线名称
  244 + LineName string `cname:"生产线名称" json:"lineName,omitempty"`
  245 + // 工段名称
  246 + SectionName string `cname:"工段名称" json:"sectionName,omitempty"`
  247 + // 姓名
  248 + UserName string `cname:"姓名" json:"userName,omitempty"`
  249 + // 考勤状态 1.未审核 2:已审核 4.自动审核
  250 + AttendanceStatus int `cname:"考勤状态 1.未审核 2:已审核 4.自动审核" json:"attendanceStatus,omitempty"`
  251 + // 开始时间
  252 + BeginTime string `cname:"开始时间" json:"beginTime"`
  253 + // 结束时间
  254 + EndTime string `cname:"结束时间" json:"endTime"`
  255 + }
  256 + SearchEmployeeAttendanceStaticsResponse struct {
  257 + Grid struct {
  258 + List []SearchEmployeeAttendanceStaticsItem `json:"list"`
  259 + Total int `json:"total"`
  260 + } `json:"grid"`
  261 + }
  262 + SearchEmployeeAttendanceStaticsItem struct {
  263 + ProductAttendanceID int `json:"productAttendanceId"`
  264 + SignDate string `json:"signDate"`
  265 + WorkStationID string `json:"workStationId"`
  266 + WorkshopID int `json:"workshopId"`
  267 + WorkshopName string `json:"workshopName"`
  268 + LineID int `json:"lineId"`
  269 + LineName string `json:"lineName"`
  270 + SectionID int `json:"sectionId"`
  271 + SectionName string `json:"sectionName"`
  272 + ProductWorker struct {
  273 + UserID int `json:"userId"`
  274 + UserName string `json:"userName"`
  275 + EmployeeType int `json:"employeeType"`
  276 + Avatar string `json:"avatar"`
  277 + Phone string `json:"phone"`
  278 + } `json:"productWorker"`
  279 + AttendanceType int `json:"attendanceType"`
  280 + AttendanceStatus int `json:"attendanceStatus"`
  281 + AttendanceTypeDescription string `json:"attendanceTypeDescription"`
  282 + EmployeeTypeDescription string `json:"employeeTypeDescription"`
  283 + AttendanceStatusDescription string `json:"attendanceStatusDescription"`
  284 + WorkTime float64 `json:"workTime"`
  285 + OrgName string `json:"orgName"`
  286 + AuthFlag bool `json:"authFlag"`
  287 + }
  288 +)
  289 +
  290 +//SearchEmployeeAttendanceStatics 搜索员工工时统计
  291 +func (gateway HttpLibAlliedCreationManufacture) SearchWorkshopWorkTimeStatics(param SearchWorkshopWorkTimeStaticsRequest) (*SearchWorkshopWorkTimeStaticsResponse, error) {
  292 + url := fmt.Sprintf("%s%s", gateway.BaseUrl(), "/attendances/workshop-attendance-statics/search")
  293 + method := "post"
  294 + var data SearchWorkshopWorkTimeStaticsResponse
  295 + err := gateway.FastDoRequest(url, method, param, &data)
  296 + return &data, err
  297 +}
  298 +
  299 +type (
  300 + SearchWorkshopWorkTimeStaticsRequest struct {
  301 + // 车间名称
  302 + WorkshopName string `cname:"车间名称" json:"workshopName,omitempty"`
  303 + // 生产线名称
  304 + LineName string `cname:"生产线名称" json:"lineName,omitempty"`
  305 + // 开始时间
  306 + BeginTime string `cname:"开始时间" json:"beginTime"`
  307 + // 结束时间
  308 + EndTime string `cname:"结束时间" json:"endTime"`
  309 + }
  310 + SearchWorkshopWorkTimeStaticsResponse struct {
  311 + Grid struct {
  312 + List []SearchWorkshopWorkTimeStaticsItem `json:"list"`
  313 + Total int `json:"total"`
  314 + } `json:"grid"`
  315 + }
  316 + SearchWorkshopWorkTimeStaticsItem struct {
  317 + WorkshopWorkTimeRecordID int `json:"workshopWorkTimeRecordId"`
  318 + WorkStationID string `json:"workStationId"`
  319 + WorkshopID int `json:"workshopId"`
  320 + WorkshopName string `json:"workshopName"`
  321 + LineID int `json:"lineId"`
  322 + LineName string `json:"lineName"`
  323 + SectionID int `json:"sectionId"`
  324 + SectionName string `json:"sectionName"`
  325 + EftWorkTime float64 `json:"eftWorkTime"`
  326 + EdWorkTime int `json:"edWorkTime"`
  327 + EptWorkTime int `json:"eptWorkTime"`
  328 + RecordDate string `json:"recordDate"`
  329 + OrgName string `json:"orgName"`
  330 + AuthFlag bool `json:"authFlag"`
  331 + }
  332 +)
@@ -158,6 +158,10 @@ type ( @@ -158,6 +158,10 @@ type (
158 Avatar string `json:"avatar"` 158 Avatar string `json:"avatar"`
159 // 邮箱 159 // 邮箱
160 Email string `json:"email"` 160 Email string `json:"email"`
  161 + // 员工类型 1:固定 2:派遣 3.临时
  162 + EmployeeType int `cname:"员工类型" json:"employeeType" valid:"Required"`
  163 + // IC卡号
  164 + IcCardNumber string `cname:"IC卡号" json:"icCardNumber,omitempty"`
161 165
162 // 部门 166 // 部门
163 DepartmentName string `cname:"部门" json:"departmentName"` 167 DepartmentName string `cname:"部门" json:"departmentName"`
@@ -197,6 +201,10 @@ type ( @@ -197,6 +201,10 @@ type (
197 Avatar string `json:"avatar"` 201 Avatar string `json:"avatar"`
198 // 邮箱 202 // 邮箱
199 Email string `json:"email"` 203 Email string `json:"email"`
  204 + // 员工类型 1:固定 2:派遣 3.临时
  205 + EmployeeType int `cname:"员工类型" json:"employeeType" valid:"Required"`
  206 + // IC卡号
  207 + IcCardNumber string `cname:"IC卡号" json:"icCardNumber,omitempty"`
200 // 运营管理扩展 208 // 运营管理扩展
201 // 部门 209 // 部门
202 DepartmentName string `cname:"部门" json:"departmentName"` 210 DepartmentName string `cname:"部门" json:"departmentName"`
@@ -418,6 +426,10 @@ type ( @@ -418,6 +426,10 @@ type (
418 CooperationCompany string `json:"cooperationCompany"` 426 CooperationCompany string `json:"cooperationCompany"`
419 // 共创到期时间 (yyyy-MM-dd) cooperationDeadline 427 // 共创到期时间 (yyyy-MM-dd) cooperationDeadline
420 CooperationDeadline string `json:"cooperationDeadline"` 428 CooperationDeadline string `json:"cooperationDeadline"`
  429 + // 员工类型 1:固定 2:派遣 3.临时
  430 + EmployeeType string `json:"employeeType,omitempty"`
  431 + // IC卡号
  432 + IcCardNumber string `json:"icCardNumber,omitempty"`
421 // 失败理由 433 // 失败理由
422 FailReason string `json:"failReason"` 434 FailReason string `json:"failReason"`
423 } 435 }
@@ -5,6 +5,7 @@ import ( @@ -5,6 +5,7 @@ import (
5 "fmt" 5 "fmt"
6 "github.com/linmadan/egglib-go/utils/json" 6 "github.com/linmadan/egglib-go/utils/json"
7 "strconv" 7 "strconv"
  8 + "strings"
8 "time" 9 "time"
9 10
10 "github.com/beego/beego/v2/client/httplib" 11 "github.com/beego/beego/v2/client/httplib"
@@ -27,6 +28,7 @@ type BaseServiceGateway struct { @@ -27,6 +28,7 @@ type BaseServiceGateway struct {
27 ReadWriteTimeout time.Duration 28 ReadWriteTimeout time.Duration
28 CompanyId int64 29 CompanyId int64
29 OrgId int64 30 OrgId int64
  31 + InOrgIds []int64
30 UserId int64 32 UserId int64
31 UserBaseId int64 33 UserBaseId int64
32 } 34 }
@@ -81,6 +83,9 @@ func (gateway BaseServiceGateway) FastDoRequest(url, method string, param interf @@ -81,6 +83,9 @@ func (gateway BaseServiceGateway) FastDoRequest(url, method string, param interf
81 83
82 func (gateway BaseServiceGateway) DoRequest(requestParam Request, val interface{}) error { 84 func (gateway BaseServiceGateway) DoRequest(requestParam Request, val interface{}) error {
83 r := gateway.CreateRequest(requestParam.Url, requestParam.Method) 85 r := gateway.CreateRequest(requestParam.Url, requestParam.Method)
  86 + if len(gateway.InOrgIds) > 0 {
  87 + r.Header("orgIds", strings.Join(ToArrayString(gateway.InOrgIds), ","))
  88 + }
84 req, err := r.JSONBody(requestParam.Param) 89 req, err := r.JSONBody(requestParam.Param)
85 if err != nil { 90 if err != nil {
86 return err 91 return err
@@ -103,3 +108,11 @@ type Request struct { @@ -103,3 +108,11 @@ type Request struct {
103 Method string 108 Method string
104 Param interface{} 109 Param interface{}
105 } 110 }
  111 +
  112 +func ToArrayString(inputs []int64) []string {
  113 + result := make([]string, 0)
  114 + for i := range inputs {
  115 + result = append(result, strconv.Itoa(int(inputs[i])))
  116 + }
  117 + return result
  118 +}
@@ -2,6 +2,7 @@ package web_client @@ -2,6 +2,7 @@ package web_client
2 2
3 import ( 3 import (
4 "fmt" 4 "fmt"
  5 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/port/beego/controllers"
5 "io" 6 "io"
6 "strings" 7 "strings"
7 8
@@ -283,6 +284,18 @@ func fileExport(controller *ExcelDataController, code string) { @@ -283,6 +284,18 @@ func fileExport(controller *ExcelDataController, code string) {
283 companyUserListQuery.Operator = exportDataCommand.Operator 284 companyUserListQuery.Operator = exportDataCommand.Operator
284 data, err = excelService.ExportWorkshopProductive(companyUserListQuery) 285 data, err = excelService.ExportWorkshopProductive(companyUserListQuery)
285 filename = "导出车间产能汇总" 286 filename = "导出车间产能汇总"
  287 + case domain.ExportManufactureEmployeeAttendanceStatics:
  288 + companyUserListQuery := &query.ManufactureExportEmployeeAttendanceStaticsQuery{}
  289 + controllers.Must(exportDataCommand.UnmarshalQuery(companyUserListQuery))
  290 + companyUserListQuery.Operator = exportDataCommand.Operator
  291 + data, err = excelService.ExportEmployeeAttendanceStatics(companyUserListQuery)
  292 + filename = "导出员工工时统计"
  293 + case domain.ExportManufactureWorkshopAttendanceStatics:
  294 + companyUserListQuery := &query.ManufactureExportWorkshopAttendanceStaticsQuery{}
  295 + controllers.Must(exportDataCommand.UnmarshalQuery(companyUserListQuery))
  296 + companyUserListQuery.Operator = exportDataCommand.Operator
  297 + data, err = excelService.ExportWorkshopAttendanceStatics(companyUserListQuery)
  298 + filename = "导出车间工时汇总"
286 default: 299 default:
287 err = fmt.Errorf("export type :%v not exists", exportDataCommand.Code) 300 err = fmt.Errorf("export type :%v not exists", exportDataCommand.Code)
288 } 301 }
@@ -328,6 +341,16 @@ func (controller *ExcelDataController) ExportManufactureWorkshopProductive() { @@ -328,6 +341,16 @@ func (controller *ExcelDataController) ExportManufactureWorkshopProductive() {
328 fileExport(controller, domain.ExportManufactureWorkshopProductive) 341 fileExport(controller, domain.ExportManufactureWorkshopProductive)
329 } 342 }
330 343
  344 +// ExportManufactureEmployeeAttendanceStatics 导出生产制造-员工工时统计
  345 +func (controller *ExcelDataController) ExportManufactureEmployeeAttendanceStatics() {
  346 + fileExport(controller, domain.ExportManufactureEmployeeAttendanceStatics)
  347 +}
  348 +
  349 +// ExportManufactureWorkshopAttendanceStatics 导出生产制造-车间工时统计
  350 +func (controller *ExcelDataController) ExportManufactureWorkshopAttendanceStatics() {
  351 + fileExport(controller, domain.ExportManufactureWorkshopAttendanceStatics)
  352 +}
  353 +
331 //GetExcelDataFields 获取导出excel数据的可选字段 354 //GetExcelDataFields 获取导出excel数据的可选字段
332 func (controller *ExcelDataController) GetExcelDataFields() { 355 func (controller *ExcelDataController) GetExcelDataFields() {
333 356
@@ -12,6 +12,9 @@ func init() { @@ -12,6 +12,9 @@ func init() {
12 web.Router("/v1/web/excel/export/manufacture-employee-productive", &web_client.ExcelDataController{}, "Post:ExportManufactureEmployeeProductive") 12 web.Router("/v1/web/excel/export/manufacture-employee-productive", &web_client.ExcelDataController{}, "Post:ExportManufactureEmployeeProductive")
13 web.Router("/v1/web/excel/export/manufacture-workshop-productive", &web_client.ExcelDataController{}, "Post:ExportManufactureWorkshopProductive") 13 web.Router("/v1/web/excel/export/manufacture-workshop-productive", &web_client.ExcelDataController{}, "Post:ExportManufactureWorkshopProductive")
14 14
  15 + web.Router("/v1/web/excel/export/manufacture-employee-attendance-statics", &web_client.ExcelDataController{}, "Post:ExportManufactureEmployeeAttendanceStatics")
  16 + web.Router("/v1/web/excel/export/manufacture-workshop-attendance-statics", &web_client.ExcelDataController{}, "Post:ExportManufactureWorkshopAttendanceStatics")
  17 +
15 web.Router("/v1/web/excel/import/dividends-orders", &web_client.ExcelDataController{}, "Post:ImportDividendsOrder") 18 web.Router("/v1/web/excel/import/dividends-orders", &web_client.ExcelDataController{}, "Post:ImportDividendsOrder")
16 web.Router("/v1/web/excel/import/dividends-returned-orders", &web_client.ExcelDataController{}, "Post:ImportDividendsReturnedOrder") 19 web.Router("/v1/web/excel/import/dividends-returned-orders", &web_client.ExcelDataController{}, "Post:ImportDividendsReturnedOrder")
17 20