| | |
| | | util.ResponseFormatList(c, code.Success, manages, total) |
| | | } |
| | | |
| | | // UpdateAttendance |
| | | // |
| | | // @Tags 考勤管理 |
| | | // @Summary 更新考勤 |
| | | // @Produce application/json |
| | | // @Param object body request.UpdateAttendance true "参数" |
| | | // @Param Authorization header string true "token" |
| | | // @Success 200 {object} util.Response "成功" |
| | | // @Router /api-jl/v1/attendance/updateAttendance [post] |
| | | func (slf AttendanceController) UpdateAttendance(c *gin.Context) { |
| | | var params request.UpdateAttendance |
| | | err := c.BindJSON(¶ms) |
| | | if err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, "参数解析失败,数据类型错误") |
| | | return |
| | | } |
| | | if params.Date == "" || params.WorkerId == "" { |
| | | util.ResponseFormat(c, code.RequestParamError, "人员id和考勤日期不能为空") |
| | | return |
| | | } |
| | | m := make(map[string]interface{}) |
| | | m["status"] = params.Status |
| | | m["overTimeDuration"] = params.OverTimeDuration |
| | | err = models.NewAttendanceManageSearch().SetDate(params.Date).SetWorkerId(params.WorkerId).UpdateByMap(m) |
| | | if err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, "更新失败") |
| | | return |
| | | } |
| | | util.ResponseFormat(c, code.Success, "更新成功") |
| | | } |
| | | |
| | | // GetAttendanceStatistic |
| | | // |
| | | // @Tags 考勤管理 |
| | |
| | | package request |
| | | |
| | | import ( |
| | | "github.com/shopspring/decimal" |
| | | "silkserver/constvar" |
| | | ) |
| | | |
| | | type GetAttendanceList struct { |
| | | PageInfo |
| | | Keyword string `json:"keyword"` |
| | |
| | | type GetAttendanceStatistic struct { |
| | | Month string `json:"month"` //月份 |
| | | } |
| | | |
| | | type UpdateAttendance struct { |
| | | Date string `json:"date"` //日期 |
| | | WorkerId string `json:"workerId"` //人员id |
| | | Status constvar.AttendanceStatus `json:"status"` //状态 |
| | | OverTimeDuration decimal.Decimal `json:"overTimeDuration"` //加班时长 |
| | | } |
| | |
| | | } |
| | | } |
| | | }, |
| | | "/api-jl/v1/attendance/updateAttendance": { |
| | | "post": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "考勤管理" |
| | | ], |
| | | "summary": "更新考勤", |
| | | "parameters": [ |
| | | { |
| | | "description": "参数", |
| | | "name": "object", |
| | | "in": "body", |
| | | "required": true, |
| | | "schema": { |
| | | "$ref": "#/definitions/request.UpdateAttendance" |
| | | } |
| | | }, |
| | | { |
| | | "type": "string", |
| | | "description": "token", |
| | | "name": "Authorization", |
| | | "in": "header", |
| | | "required": true |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "成功", |
| | | "schema": { |
| | | "$ref": "#/definitions/util.Response" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api-jl/v1/fineness/changeYieldRegister": { |
| | | "post": { |
| | | "produces": [ |
| | |
| | | "id": { |
| | | "type": "integer" |
| | | }, |
| | | "name": { |
| | | "description": "车间", |
| | | "type": "string" |
| | | }, |
| | | "startDate": { |
| | | "description": "开始日期", |
| | | "type": "string" |
| | |
| | | "description": "工人ID", |
| | | "type": "string" |
| | | }, |
| | | "workshop": { |
| | | "description": "车间编号", |
| | | "type": "string" |
| | | }, |
| | | "workshopGroup": { |
| | | "description": "车组", |
| | | "type": "integer" |
| | | }, |
| | | "workshopName": { |
| | | "description": "车间名称", |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | |
| | | "startWorkerPosition", |
| | | "workerId", |
| | | "workshop", |
| | | "workshopGroup" |
| | | "workshopGroup", |
| | | "workshopName" |
| | | ], |
| | | "properties": { |
| | | "endDate": { |
| | |
| | | "type": "string" |
| | | }, |
| | | "workshop": { |
| | | "description": "车间", |
| | | "description": "车间编号", |
| | | "type": "string" |
| | | }, |
| | | "workshopGroup": { |
| | | "description": "车组", |
| | | "type": "integer" |
| | | }, |
| | | "workshopName": { |
| | | "description": "车间名称", |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | |
| | | } |
| | | } |
| | | }, |
| | | "request.UpdateAttendance": { |
| | | "type": "object", |
| | | "properties": { |
| | | "date": { |
| | | "description": "日期", |
| | | "type": "string" |
| | | }, |
| | | "overTimeDuration": { |
| | | "description": "加班时长", |
| | | "type": "number" |
| | | }, |
| | | "status": { |
| | | "description": "状态", |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/constvar.AttendanceStatus" |
| | | } |
| | | ] |
| | | }, |
| | | "workerId": { |
| | | "description": "人员id", |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | | "request.UpdateDict": { |
| | | "type": "object", |
| | | "properties": { |
| | |
| | | "startWorkerPosition", |
| | | "workerId", |
| | | "workshop", |
| | | "workshopGroup" |
| | | "workshopGroup", |
| | | "workshopName" |
| | | ], |
| | | "properties": { |
| | | "endDate": { |
| | |
| | | "type": "string" |
| | | }, |
| | | "workshop": { |
| | | "description": "车间", |
| | | "description": "车间编号", |
| | | "type": "string" |
| | | }, |
| | | "workshopGroup": { |
| | | "description": "车组", |
| | | "type": "integer" |
| | | }, |
| | | "workshopName": { |
| | | "description": "车间名称", |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | |
| | | } |
| | | } |
| | | }, |
| | | "/api-jl/v1/attendance/updateAttendance": { |
| | | "post": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "考勤管理" |
| | | ], |
| | | "summary": "更新考勤", |
| | | "parameters": [ |
| | | { |
| | | "description": "参数", |
| | | "name": "object", |
| | | "in": "body", |
| | | "required": true, |
| | | "schema": { |
| | | "$ref": "#/definitions/request.UpdateAttendance" |
| | | } |
| | | }, |
| | | { |
| | | "type": "string", |
| | | "description": "token", |
| | | "name": "Authorization", |
| | | "in": "header", |
| | | "required": true |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "成功", |
| | | "schema": { |
| | | "$ref": "#/definitions/util.Response" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api-jl/v1/fineness/changeYieldRegister": { |
| | | "post": { |
| | | "produces": [ |
| | |
| | | "id": { |
| | | "type": "integer" |
| | | }, |
| | | "name": { |
| | | "description": "车间", |
| | | "type": "string" |
| | | }, |
| | | "startDate": { |
| | | "description": "开始日期", |
| | | "type": "string" |
| | |
| | | "description": "工人ID", |
| | | "type": "string" |
| | | }, |
| | | "workshop": { |
| | | "description": "车间编号", |
| | | "type": "string" |
| | | }, |
| | | "workshopGroup": { |
| | | "description": "车组", |
| | | "type": "integer" |
| | | }, |
| | | "workshopName": { |
| | | "description": "车间名称", |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | |
| | | "startWorkerPosition", |
| | | "workerId", |
| | | "workshop", |
| | | "workshopGroup" |
| | | "workshopGroup", |
| | | "workshopName" |
| | | ], |
| | | "properties": { |
| | | "endDate": { |
| | |
| | | "type": "string" |
| | | }, |
| | | "workshop": { |
| | | "description": "车间", |
| | | "description": "车间编号", |
| | | "type": "string" |
| | | }, |
| | | "workshopGroup": { |
| | | "description": "车组", |
| | | "type": "integer" |
| | | }, |
| | | "workshopName": { |
| | | "description": "车间名称", |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | |
| | | } |
| | | } |
| | | }, |
| | | "request.UpdateAttendance": { |
| | | "type": "object", |
| | | "properties": { |
| | | "date": { |
| | | "description": "日期", |
| | | "type": "string" |
| | | }, |
| | | "overTimeDuration": { |
| | | "description": "加班时长", |
| | | "type": "number" |
| | | }, |
| | | "status": { |
| | | "description": "状态", |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/constvar.AttendanceStatus" |
| | | } |
| | | ] |
| | | }, |
| | | "workerId": { |
| | | "description": "人员id", |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | | "request.UpdateDict": { |
| | | "type": "object", |
| | | "properties": { |
| | |
| | | "startWorkerPosition", |
| | | "workerId", |
| | | "workshop", |
| | | "workshopGroup" |
| | | "workshopGroup", |
| | | "workshopName" |
| | | ], |
| | | "properties": { |
| | | "endDate": { |
| | |
| | | "type": "string" |
| | | }, |
| | | "workshop": { |
| | | "description": "车间", |
| | | "description": "车间编号", |
| | | "type": "string" |
| | | }, |
| | | "workshopGroup": { |
| | | "description": "车组", |
| | | "type": "integer" |
| | | }, |
| | | "workshopName": { |
| | | "description": "车间名称", |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | |
| | | type: integer |
| | | id: |
| | | type: integer |
| | | name: |
| | | description: 车间 |
| | | type: string |
| | | startDate: |
| | | description: 开始日期 |
| | | type: string |
| | |
| | | workerId: |
| | | description: 工人ID |
| | | type: string |
| | | workshop: |
| | | description: 车间编号 |
| | | type: string |
| | | workshopGroup: |
| | | description: 车组 |
| | | type: integer |
| | | workshopName: |
| | | description: 车间名称 |
| | | type: string |
| | | type: object |
| | | models.WorkshopManage: |
| | | properties: |
| | |
| | | description: 工人ID |
| | | type: string |
| | | workshop: |
| | | description: 车间 |
| | | description: 车间编号 |
| | | type: string |
| | | workshopGroup: |
| | | description: 车组 |
| | | type: integer |
| | | workshopName: |
| | | description: 车间名称 |
| | | type: string |
| | | required: |
| | | - endDate |
| | | - endWorkerPosition |
| | |
| | | - workerId |
| | | - workshop |
| | | - workshopGroup |
| | | - workshopName |
| | | type: object |
| | | request.ChangeYieldRegister: |
| | | properties: |
| | |
| | | $ref: '#/definitions/request.RankStandard' |
| | | type: array |
| | | type: object |
| | | request.UpdateAttendance: |
| | | properties: |
| | | date: |
| | | description: 日期 |
| | | type: string |
| | | overTimeDuration: |
| | | description: 加班时长 |
| | | type: number |
| | | status: |
| | | allOf: |
| | | - $ref: '#/definitions/constvar.AttendanceStatus' |
| | | description: 状态 |
| | | workerId: |
| | | description: 人员id |
| | | type: string |
| | | type: object |
| | | request.UpdateDict: |
| | | properties: |
| | | dictType: |
| | |
| | | description: 工人ID |
| | | type: string |
| | | workshop: |
| | | description: 车间 |
| | | description: 车间编号 |
| | | type: string |
| | | workshopGroup: |
| | | description: 车组 |
| | | type: integer |
| | | workshopName: |
| | | description: 车间名称 |
| | | type: string |
| | | required: |
| | | - endDate |
| | | - endWorkerPosition |
| | |
| | | - workerId |
| | | - workshop |
| | | - workshopGroup |
| | | - workshopName |
| | | type: object |
| | | request.YieldRegisterCircleInfo: |
| | | properties: |
| | |
| | | summary: 保存加班规则 |
| | | tags: |
| | | - 考勤管理 |
| | | /api-jl/v1/attendance/updateAttendance: |
| | | post: |
| | | parameters: |
| | | - description: 参数 |
| | | in: body |
| | | name: object |
| | | required: true |
| | | schema: |
| | | $ref: '#/definitions/request.UpdateAttendance' |
| | | - description: token |
| | | in: header |
| | | name: Authorization |
| | | required: true |
| | | type: string |
| | | produces: |
| | | - application/json |
| | | responses: |
| | | "200": |
| | | description: 成功 |
| | | schema: |
| | | $ref: '#/definitions/util.Response' |
| | | summary: 更新考勤 |
| | | tags: |
| | | - 考勤管理 |
| | | /api-jl/v1/fineness/changeYieldRegister: |
| | | post: |
| | | parameters: |
| | |
| | | return slf |
| | | } |
| | | |
| | | func (slf *AttendanceManageSearch) SetDate(date string) *AttendanceManageSearch { |
| | | slf.Date = date |
| | | return slf |
| | | } |
| | | |
| | | func (slf *AttendanceManageSearch) SetWorkerId(workerId string) *AttendanceManageSearch { |
| | | slf.WorkerId = workerId |
| | | return slf |
| | | } |
| | | |
| | | func (slf *AttendanceManageSearch) build() *gorm.DB { |
| | | var db = slf.Orm.Table(slf.TableName()) |
| | | |
| | |
| | | db = db.Where("date like ?", slf.Month+"%") |
| | | } |
| | | |
| | | if slf.Date != "" { |
| | | db = db.Where("date = ?", slf.Date) |
| | | } |
| | | |
| | | if slf.WorkerId != "" { |
| | | db = db.Where("worker_id = ?", slf.WorkerId) |
| | | } |
| | | |
| | | return db |
| | | } |
| | | |
| | |
| | | { |
| | | attendanceApi.POST("attendanceInput", attendanceController.AttendanceInput) //考勤导入 |
| | | attendanceApi.POST("getAttendanceList", attendanceController.GetAttendanceList) //获取考勤列表 |
| | | attendanceApi.POST("updateAttendance", attendanceController.UpdateAttendance) //更新考勤 |
| | | attendanceApi.POST("getAttendanceStatistic", attendanceController.GetAttendanceStatistic) //获取考勤统计 |
| | | attendanceApi.DELETE("deleteAttendanceInfo", attendanceController.DeleteAttendanceInfo) //删除考勤信息 |
| | | attendanceApi.GET("getAttendanceRule", attendanceController.GetAttendanceRule) //获取加班规则 |