From 8cb0f0a47c00d4549b5e81c477d68d6044216617 Mon Sep 17 00:00:00 2001 From: hreenshan112 Date: Mon, 20 Jan 2025 09:44:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=92=E7=8F=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/version1/dataCenter/databastHanld.go | 5 + api/version1/menus/menus.go | 891 +++++++++++++++++++++++ api/version1/menus/type.go | 81 +++ apirouter/v1/dataCenterRouter/router.go | 1 + apirouter/v1/menusRouters/pc.go | 6 + apirouter/v1/menusRouters/type.go | 7 + config/configApp/appConfig.yaml | 47 ++ config/configApp/server.go | 1 + config/configDatabase/database.go | 1 + config/configDatabase/database.yaml | 379 ++++++++++ config/configNosql/redis.yaml | 49 ++ go.mod | 7 +- go.sum | 40 +- initialization/databaseinit/mysql.go | 8 + models/modelshr/genesis.go | 62 ++ models/modelshr/man_cont.go | 114 +-- models/modelshr/polling_rules.go | 62 ++ models/modelshr/work_time_type.go | 59 ++ models/modelshr/working_time_period.go | 63 ++ models/teamlog/teamslog.go | 70 ++ .gitignore => overall/.gitignore | 0 overall/appConfig.go | 1 + overall/publicmethod/technique.go | 45 ++ overall/publicmethod/type.go | 19 +- 24 files changed, 1919 insertions(+), 99 deletions(-) create mode 100644 config/configApp/appConfig.yaml create mode 100644 config/configDatabase/database.yaml create mode 100644 config/configNosql/redis.yaml create mode 100644 models/modelshr/genesis.go create mode 100644 models/modelshr/polling_rules.go create mode 100644 models/modelshr/work_time_type.go create mode 100644 models/modelshr/working_time_period.go create mode 100644 models/teamlog/teamslog.go rename .gitignore => overall/.gitignore (100%) diff --git a/api/version1/dataCenter/databastHanld.go b/api/version1/dataCenter/databastHanld.go index e3fb801..0a2e49a 100644 --- a/api/version1/dataCenter/databastHanld.go +++ b/api/version1/dataCenter/databastHanld.go @@ -1,6 +1,7 @@ package datacenter import ( + "appPlatform/overall" "appPlatform/overall/publicmethod" "encoding/json" "errors" @@ -184,6 +185,10 @@ func (c *DatabaseConfig) ConnectToTiDb() (*gorm.DB, error) { func (d *DataBastType) StartDataBast() (openDb *gorm.DB, err error) { var configInfo DatabaseConfig + if d.Ip == overall.CONSTANT_CONFIG.Appsetup.DefaultIP { + d.Ip = "127.0.0.1" + } + configInfo.Name = d.DataBaseName configInfo.Host = d.Ip configInfo.Port = d.Port diff --git a/api/version1/menus/menus.go b/api/version1/menus/menus.go index e602f1e..0edff4e 100644 --- a/api/version1/menus/menus.go +++ b/api/version1/menus/menus.go @@ -1,16 +1,27 @@ package menus import ( + "appPlatform/middleware/grocerystore" "appPlatform/models/modelAppPlatform" + "appPlatform/models/modelshr" + "appPlatform/models/modelssystempermission" + "appPlatform/models/teamlog" "appPlatform/overall" "appPlatform/overall/publicmethod" + "encoding/json" + "errors" "fmt" "sort" + "strconv" + "strings" "time" "github.com/gin-gonic/gin" ) +// 全局变量 +var allRulesLog teamlog.TeamsLog + /* * @ 作者: 秦东 @@ -412,3 +423,883 @@ func (g *GetSunMenus) GetSunMenusList(superior int) { } } } + +/* +* +@ 作者: 秦东 +@ 时间: 2025-01-15 14:33:47 +@ 功能: 根据角色获取行政组织 +@ 参数 + + # + +@ 返回值 + + # + +@ 方法原型 + + # +*/ +func (a *ApiMethod) AccordRoleGiveOrg(c *gin.Context) { + context, _ := c.Get(overall.MyContJwt) + var userMyCont modelshr.ManCont + userMyCont.GetLoginCont(context) //当前操作人 + var userCont MyLookOrg + userCont.myInfo = userMyCont + fmt.Printf("起始入口===>%v\n", userMyCont) + syncSeting.Add(1) + go userCont.RoleLookOrg() //角色 + syncSeting.Add(1) + go userCont.PostLookOrg() //职位岗位 + syncSeting.Add(1) + go userCont.PeopleIsCharge() //是不是部门负责人,获取其负责范围 + syncSeting.Wait() + maxLevel := 1 + for _, v := range userCont.Level { + if v >= maxLevel { + maxLevel = v + } + } + powerOrgId := publicmethod.RemoveDuplicate[int64](userCont.OrdId) + var orgTree []RolePostIsChnature + sendData := publicmethod.MapOut[string]() + if len(powerOrgId) > 0 { + var orgList []modelshr.AdministrativeOrganization + overall.CONSTANT_DB_HR.Model(&modelshr.AdministrativeOrganization{}).Where("`state` = 1 AND `id` IN ?", powerOrgId).Find(&orgList) + switch maxLevel { + case 2: + orgTree = GovOrgTree(userMyCont.MainDeparment, orgList) + case 3: + orgTree = GovOrgTree(userMyCont.Company, orgList) + case 4: + orgTree = GovOrgTree(313, orgList) + case 5: + orgTree = GovOrgTree(313, orgList) + default: + orgTree = GovOrgTree(userMyCont.AdminOrg, orgList) + } + sendData["companyName"] = gainOrgName(userMyCont.Company, orgList) + sendData["maindeparmentName"] = gainOrgName(userMyCont.MainDeparment, orgList) + sendData["orgName"] = gainOrgName(userMyCont.AdminOrg, orgList) + } + + sendData["orgTree"] = orgTree + sendData["company"] = userMyCont.Company + + sendData["maindeparment"] = userMyCont.MainDeparment + + sendData["orgId"] = userMyCont.AdminOrg + + publicmethod.Result(0, sendData, c) +} + +/* +* +@ 作者: 秦东 +@ 时间: 2025-01-16 10:22:46 +@ 功能: 获取行政组织名称 +*/ +func gainOrgName(orgId int64, orgAry []modelshr.AdministrativeOrganization) (orgName string) { + for _, v := range orgAry { + if v.Id == orgId { + orgName = v.Name + return + } + } + return +} + +/* +* +@ 作者: 秦东 +@ 时间: 2025-01-16 08:57:31 +@ 功能: 生成行政组织树 +*/ +func GovOrgTree(parentId int64, govList []modelshr.AdministrativeOrganization) (govMap []RolePostIsChnature) { + for i := 0; i < len(govList); i++ { + if govList[i].Superior == parentId { + var govCont RolePostIsChnature + govCont.Id = govList[i].Id + govCont.Number = govList[i].Number //行政编码"` + govCont.Name = govList[i].Name //组织名称"` + govCont.Superior = govList[i].Superior //上级ID"` + govCont.OrganizationType = govList[i].OrganizationType //行政组织类型"` + govCont.Abbreviation = govList[i].Abbreviation //行政组织简称"` + govCont.Time = govList[i].Time //创建时间"` + govCont.State = govList[i].State //状态(1:启用;2:禁用;3:删除)"` + govCont.WechatOrganizationId = govList[i].WechatOrganizationId //微信组织架构对照码"` + govCont.SuperiorSun = govList[i].SuperiorSun //级联ID"` + govCont.Schoole = govList[i].Schoole //原知行学院对照码"` + govCont.KingdeeId = govList[i].KingdeeId //金蝶对照ID"` + govCont.IsPower = govList[i].IsPower //是否为实权部门"` + govCont.Sort = govList[i].Sort //是否为实权部门"` + govCont.Child = GovOrgTree(govList[i].Id, govList) + govMap = append(govMap, govCont) + } + } + return +} + +/* +* +@ 作者: 秦东 +@ 时间: 2025-01-16 08:17:34 +@ 功能: 判断是不是部门负责人,获取其负责范围 +*/ +func (m *MyLookOrg) PeopleIsCharge() { + defer syncSeting.Done() + if m.myInfo.PersonInCharge == 1 { + if m.myInfo.ResponsibleDepartment != "" { + resDepAry := strings.Split(m.myInfo.ResponsibleDepartment, ",") + if len(resDepAry) > 0 { + for _, v := range resDepAry { + vInt, _ := strconv.ParseInt(v, 10, 64) + m.OrdId = append(m.OrdId, vInt) + } + } + } + } +} + +/* +* +@ 作者: 秦东 +@ 时间: 2025-01-15 16:55:29 +@ 功能: 根据岗位 +*/ +func (m *MyLookOrg) PostLookOrg() { + defer syncSeting.Done() + if m.myInfo.Position != 0 { + var postEmpower modelssystempermission.Empower + overall.CONSTANT_DB_System_Permission.Where("`state` = 1 AND `system` = ? AND `post_id` = ?", "appsystem", m.myInfo.Position).First(&postEmpower) + var managementScope []string //管理范围 + if postEmpower.Organization != "" { + orgAry := strings.Split(postEmpower.Organization, ",") + if len(orgAry) > 0 { + for _, ov := range orgAry { + managementScope = append(managementScope, ov) + } + } + } + if len(managementScope) > 0 { + for _, v := range managementScope { + vInt, _ := strconv.ParseInt(v, 10, 64) + m.OrdId = append(m.OrdId, vInt) + } + + } + m.Level = append(m.Level, postEmpower.Level) + + } +} + +/* +* +@ 作者: 秦东 +@ 时间: 2025-01-15 15:46:45 +@ 功能: 根据角色权限获取可见行政组织 +*/ +func (m *MyLookOrg) RoleLookOrg() { + defer syncSeting.Done() + + if m.myInfo.Role != "" { + roleAry := strings.Split(m.myInfo.Role, ",") + if len(roleAry) > 0 { + var managementScope []string //管理范围 + var maxLevel int //最大授权等级 + var roleEmpower []modelssystempermission.RoleEmpower + overall.CONSTANT_DB_System_Permission.Model(&modelssystempermission.RoleEmpower{}).Where("`state` = 1 AND `system` = ? AND `role_id` IN ?", "appsystem", roleAry).First(&roleEmpower) + for _, v := range roleEmpower { + if v.Level >= maxLevel { + maxLevel = v.Level + } + if v.Organization != "" { + orgAry := strings.Split(v.Organization, ",") + if len(orgAry) > 0 { + for _, ov := range orgAry { + managementScope = append(managementScope, ov) + } + } + } + + } + m.Level = append(m.Level, maxLevel) + switch maxLevel { + case 2: //本部门及下级单位 + if m.myInfo.MainDeparment != 0 { + var sunOrg publicmethod.GetOrgAllParent + sunOrg.GetOrgSun(m.myInfo.MainDeparment) + sunOrg.Id = append(sunOrg.Id, m.myInfo.MainDeparment) + for _, v := range sunOrg.Id { + if v != 0 { + m.OrdId = append(m.OrdId, v) + } + + } + } + case 3: //本分部及其下级 + if m.myInfo.Company != 0 { + var sunOrg publicmethod.GetOrgAllParent + sunOrg.GetOrgSun(m.myInfo.Company) + sunOrg.Id = append(sunOrg.Id, m.myInfo.Company) + for _, v := range sunOrg.Id { + if v != 0 { + m.OrdId = append(m.OrdId, v) + } + } + } + case 4: //指定行政组织 + for _, v := range managementScope { + vInt, _ := strconv.ParseInt(v, 10, 64) + if vInt != 0 { + m.OrdId = append(m.OrdId, vInt) + } + } + case 5: //所有 + var ordidList []int64 + overall.CONSTANT_DB_HR.Model(&modelshr.AdministrativeOrganization{}).Select("`id`").Where("`state` = 1").Find(&ordidList) + if len(ordidList) > 0 { + for _, v := range ordidList { + if v != 0 { + m.OrdId = append(m.OrdId, v) + } + } + } + default: //本岗位及下级 + if m.myInfo.AdminOrg != 0 { + var sunOrg publicmethod.GetOrgAllParent + sunOrg.GetOrgSun(m.myInfo.AdminOrg) + sunOrg.Id = append(sunOrg.Id, m.myInfo.AdminOrg) + for _, v := range sunOrg.Id { + if v != 0 { + m.OrdId = append(m.OrdId, v) + } + + } + } + } + } + } +} + +/* +* +@ 作者: 秦东 +@ 时间: 2025-01-16 15:37:43 +@ 功能: 获取排班制度及周期源点 +@ 参数 + + # + +@ 返回值 + + # + +@ 方法原型 + + # +*/ +func (a *ApiMethod) GainShiftRules(c *gin.Context) { + var requestData publicmethod.PublicId + err := c.ShouldBindJSON(&requestData) + if err != nil { + publicmethod.Result(100, err, c) + return + } + if requestData.Id == "" { + publicmethod.Result(1, requestData, c, "未知菜单!") + return + } + // var menuCont GenesInfo + // err = menuCont.GetCont(map[string]interface{}{"`orgId`": requestData.Id}) + orgId, _ := strconv.ParseInt(requestData.Id, 10, 64) + menuCont, _, err := CureeRunRules(orgId) + if err != nil { + publicmethod.Result(200, err, c) + return + } + menuCont.TypeIdStr = strconv.FormatInt(menuCont.TypeId, 10) + // menuCont.StartTimeStr + menuCont.BegainTime = publicmethod.UnixTimeToDay(menuCont.StartTime, 14) + //获取倒班规则 + var paiBanType modelshr.WorkTimeType + paiBanType.GetCont(map[string]interface{}{"`id`": menuCont.TypeId}, " `name`") + menuCont.TypeName = paiBanType.Name + //获取源点起始工作时间段 + var startWorkTime modelshr.WorkingTimePeriod + startWorkTime.GetCont(map[string]interface{}{"`id`": menuCont.PeriodId}, " `name`") + menuCont.PeriodName = startWorkTime.Name + //获取起始源点起始班组 + var starTeam modelshr.PollingRules + starTeam.GetCont(map[string]interface{}{"`id`": menuCont.Rules}, " `teamname`", " `sort`") + menuCont.RulesTime = fmt.Sprintf("%v(%v)", starTeam.TeamName, starTeam.Sort) + + publicmethod.Result(0, menuCont, c) +} + +/* +* +@ 作者: 秦东 +@ 时间: 2025-01-16 16:26:39 +@ 功能: 确定当前行政组织用哪一个轮询规则 +*/ +func CureeRunRules(orgId int64) (rules GenesInfo, cureeOrgId int64, err error) { + + if orgId != 0 { + err = rules.GetCont(map[string]interface{}{"`orgId`": orgId}) + if err != nil || rules.TypeId == 0 { + var supaerOrgId modelshr.AdministrativeOrganization + supaerOrgId.GetCont(map[string]interface{}{"`id`": orgId}, "`superior`") + if supaerOrgId.Superior != 0 { + return CureeRunRules(supaerOrgId.Superior) + } + } else { + cureeOrgId = orgId + } + } else { + err = errors.New("没有相关设定") + } + return +} + +/* +* +@ 作者: 秦东 +@ 时间: 2025-01-17 10:12:34 +@ 功能: 获取排班类别及轮询制度 +@ 参数 + + # + +@ 返回值 + + # + +@ 方法原型 + + # +*/ +func (a *ApiMethod) GainTemsTypeAndRuler(c *gin.Context) { + var workTypeList []modelshr.WorkTimeType + overall.CONSTANT_DB_HR.Model(&modelshr.WorkTimeType{}).Where("`state` = 1").Find(&workTypeList) + var sendList []SendTemsTypeAndRuler + for _, v := range workTypeList { + var sendInfo SendTemsTypeAndRuler + sendInfo.Id = strconv.FormatInt(v.Id, 10) + sendInfo.Name = v.Name + sendInfo.WorkingTimePeriod = GainWorkTimePer(v.Id) + sendInfo.PollingRules = GainPolingRules(v.Id) + sendList = append(sendList, sendInfo) + } + publicmethod.Result(0, sendList, c) +} + +/* +* +@ 作者: 秦东 +@ 时间: 2025-01-17 10:31:52 +@ 功能: 获取工作时段 +*/ +func GainPolingRules(id int64) (timeRulesList []RulerPublicInfo) { + var timeRules []modelshr.PollingRules + overall.CONSTANT_DB_HR.Model(&modelshr.PollingRules{}).Where("`state` = 1 AND `type_id` = ?", id).Order("sort ASC").Find(&timeRules) + for _, v := range timeRules { + var timeRulesInfo RulerPublicInfo + timeRulesInfo.Id = strconv.FormatInt(v.Id, 10) + timeRulesInfo.Name = v.TeamName + timeRulesInfo.Sort = v.Sort + timeRulesList = append(timeRulesList, timeRulesInfo) + } + return +} + +/* +* +@ 作者: 秦东 +@ 时间: 2025-01-17 10:31:52 +@ 功能: 获取工作时段 +*/ +func GainWorkTimePer(id int64) (timePeriodList []RulerPublicInfo) { + var timePeriod []modelshr.WorkingTimePeriod + overall.CONSTANT_DB_HR.Model(&modelshr.WorkingTimePeriod{}).Where("`state` = 1 AND `type_id` = ?", id).Order("sort ASC").Find(&timePeriod) + for _, v := range timePeriod { + var timePerInfo RulerPublicInfo + timePerInfo.Id = strconv.FormatInt(v.Id, 10) + timePerInfo.Name = v.Name + timePerInfo.Sort = v.Sort + timePerInfo.StartTime = v.StartTime + timePerInfo.EndTime = v.EndTime + timePeriodList = append(timePeriodList, timePerInfo) + } + return +} + +/* +* +@ 作者: 秦东 +@ 时间: 2025-01-17 18:10:05 +@ 功能: 解析日历生成排班顺序 +@ 参数 + + # + +@ 返回值 + + # + +@ 方法原型 + + # +*/ +func (a *ApiMethod) AnalysisMonthRulers(c *gin.Context) { + var requestData AnYuePaiBan + c.ShouldBindJSON(&requestData) + // err := c.ShouldBindJSON(&requestData) + // if err != nil { + // publicmethod.Result(100, requestData, c) + // return + // } + if requestData.OrgId == "" { + publicmethod.Result(1, requestData, c, "未知行政单位") + return + } + var sendMonthList []interface{} + + orgIdInt, _ := strconv.ParseInt(requestData.OrgId, 10, 64) + menuCont, cureeOrgId, err := CureeRunRules(orgIdInt) + if err != nil { + // for _, v := range requestData.MonthAllDay { + // var listSynv CalendarList + // sendMonthList = append(sendMonthList, TimeHaveAry(v, listSynv.List)) + // } + publicmethod.Result(200, sendMonthList, c) + return + } + + isRedisTrue := true + //Step 1:查看当前提交时间Redis中是否已经排班 + for _, v := range requestData.MonthAllDay { + weekIsRedisTrue := false + var vDay []CalendarStructure + for _, wv := range v { + var wvTimeAll publicmethod.DateTimeTotimes + wvTimeAll.BaisStrToTime(wv.Date) + dayRedisKey := fmt.Sprintf("SchedulingTeam:Org_%v_%v_%v_%v", cureeOrgId, wvTimeAll.Years, wvTimeAll.Months, wvTimeAll.Days) + redisClient := grocerystore.RunRedis(overall.CONSTANT_REDIS2) + isOk, dayRedisVal := redisClient.Get(dayRedisKey) + if isOk { + var vDayInfo CalendarStructure + redisJsonErr := json.Unmarshal([]byte(dayRedisVal), &vDayInfo) + if redisJsonErr == nil { + vDay = append(vDay, vDayInfo) + } + weekIsRedisTrue = true + } + } + isRedisTrue = weekIsRedisTrue + if weekIsRedisTrue { + sendMonthList = append(sendMonthList, vDay) + } + // + } + if isRedisTrue { + publicmethod.Result(0, sendMonthList, c) + return + } + //Step 2:若redis中没有响应数据,那么进行数据查询 + // isDatabaseTrue := true + // for _, v := range requestData.MonthAllDay { + // weekIsDatabaseTrue := false + // var vDay []CalendarStructure + // for _, wv := range v { + // var wvTimeAll publicmethod.DateTimeTotimes + // wvTimeAll.BaisStrToTime(wv.Date) + // var teamLogList teamlog.TeamsLog + // teamLogList.GetCont(map[string]interface{}{"`orgId`": cureeOrgId, "`years`": wvTimeAll.Years, "`months`": wvTimeAll.Months, "`days`": wvTimeAll.Days, "`ismId`": menuCont.TypeId, "`rulesId`": menuCont.Rules}) + // if teamLogList.Id != 0 { + // weekIsDatabaseTrue = true + // var vDayInfo CalendarStructure + // vDayInfo.List = teamLogList + // vDay = append(vDay, vDayInfo) + // jsonVal, _ := json.Marshal(vDayInfo) + // dayRedisKey := fmt.Sprintf("SchedulingTeam:Org_%v_%v_%v_%v", cureeOrgId, wvTimeAll.Years, wvTimeAll.Months, wvTimeAll.Days) + // redisClient := grocerystore.RunRedis(overall.CONSTANT_REDIS2) + // redisClient.SetRedisTime(5256000) + // redisClient.Set(dayRedisKey, string(jsonVal)) + // } + // } + // isDatabaseTrue = weekIsDatabaseTrue + // if weekIsDatabaseTrue { + // sendMonthList = append(sendMonthList, vDay) + // } + + // } + // if isDatabaseTrue { + // publicmethod.Result(0, sendMonthList, c) + // return + // } + //Step 3:若redis和数据库中都没有相应数据,那么根据数据源点进行计算 + //获取源点起始工作时间段 + menuCont.BegainTime = publicmethod.UnixTimeToDay(menuCont.StartTime, 14) + menuCont.TypeIdStr = strconv.FormatInt(menuCont.TypeId, 10) + //获取倒班规则 + var paiBanType modelshr.WorkTimeType + paiBanType.GetCont(map[string]interface{}{"`id`": menuCont.TypeId}, " `name`") + menuCont.TypeName = paiBanType.Name + var starTeam modelshr.PollingRules + starTeam.GetCont(map[string]interface{}{"`id`": menuCont.Rules}, " `teamname`", " `sort`") + menuCont.RulesName = starTeam.TeamName + menuCont.RulesSort = starTeam.Sort + var wtpInfo modelshr.WorkingTimePeriod + wtpInfo.GetCont(map[string]interface{}{"`id`": menuCont.PeriodId}, " `name`", " `sort`", "`start_time` ", "`end_time`") + menuCont.PeriodName = fmt.Sprintf("%v(%v - %v)", wtpInfo.Name, wtpInfo.StartTime, wtpInfo.EndTime) + //作息时间 + var zuoXiTime []modelshr.WorkingTimePeriod + overall.CONSTANT_DB_HR.Model(&modelshr.WorkingTimePeriod{}).Where("`state` = 1 AND `type_id` = ?", menuCont.TypeId).Order("`sort` ASC").Find(&zuoXiTime) + //轮询时序 + var lunXunShiXu []modelshr.PollingRules + overall.CONSTANT_DB_HR.Model(&modelshr.PollingRules{}).Where("`state` = 1 AND `type_id` = ?", menuCont.TypeId).Order("`sort` ASC").Find(&lunXunShiXu) + if len(zuoXiTime) < 1 || len(lunXunShiXu) < 1 { + for _, v := range requestData.MonthAllDay { + var listSynv CalendarList + sendMonthList = append(sendMonthList, TimeHaveAry(v, listSynv.List)) + } + publicmethod.Result(200, sendMonthList, c) + return + } + //Step 4: 计算当前时间段与原点关系 + lastDayNumber := 0 + var starTemasTime publicmethod.DateTimeTotimes + starTemasTime.BaisStrToTime(menuCont.BegainTime) + for _, v := range requestData.MonthAllDay { + var listSynv CalendarList + for _, wv := range v { + var wvTimeAll publicmethod.DateTimeTotimes + wvTimeAll.BaisStrToTime(wv.Date) + sjc := wvTimeAll.AllTime - starTemasTime.AllTime + fmt.Printf("%v - %v - %v 时间差:%v\n", wv.Date, wvTimeAll.AllTime, starTemasTime.AllTime, sjc) + if sjc >= 0 { + if sjc == 0 { + + listAry := menuCont.TeamsYuanDianRun(wv, wvTimeAll, zuoXiTime, lunXunShiXu) + inDate := publicmethod.MapOut[string]() + inDate[wv.Date] = listAry + listSynv.List = append(listSynv.List, inDate) + + } else { + listAry := menuCont.TeamsRun(wv, wvTimeAll, zuoXiTime, lunXunShiXu) + + inDate := publicmethod.MapOut[string]() + inDate[wv.Date] = listAry + listSynv.List = append(listSynv.List, inDate) + + } + } else { + lastDayNumber++ + } + } + sendMonthList = append(sendMonthList, TimeHaveAry(v, listSynv.List)) + } + + // cureeTime := publicmethod.UnixTimeToDay(time.Now().Unix(), 14) + // if requestData.MonthAllDay[0][0].Date != "" { + // cureeTime = requestData.MonthAllDay[0][0].Date + // } + // var creTimeAll publicmethod.DateTimeTotimes + // creTimeAll.BaisStrToTime(cureeTime) + + //获取上个月最后一天 + // lastMonthStart, lastMonthEnd := publicmethod.GetLastMonthStartEnd(creTimeAll.AllTimeString) + + publicmethod.Result(0, sendMonthList, c) +} + +/* +* +@ 作者: 秦东 +@ 时间: 2025-01-18 09:26:03 +@ 功能: 解析排班规则(当天是原点) +@ 参数 + + #dataInfo 当前日期属性 + #timeVal 当前时间 + #zuoXiTime 作息时间段 + #lunXunShiXu 轮询规则 +*/ +func (g *GenesInfo) TeamsYuanDianRun(dataInfo CalendarStructure, timeVal publicmethod.DateTimeTotimes, zuoXiTime []modelshr.WorkingTimePeriod, lunXunShiXu []modelshr.PollingRules) (logMap []map[string]interface{}) { + // var logList []teamlog.TeamsLog + dayRedisKey := fmt.Sprintf("SchedulingTeam:StartingPoint_%v_%v_%v_%v", g.OrgId, g.TypeId, g.PeriodId, g.Rules) + redisClient := grocerystore.RunRedis(overall.CONSTANT_REDIS2) + isTrue, logContent := redisClient.Get(dayRedisKey) + var logInfo teamlog.TeamsLog + if isTrue { + json.Unmarshal([]byte(logContent), &logInfo) + valMap := publicmethod.MapOut[string]() + json.Unmarshal([]byte(logContent), &valMap) + // valueOfExample := reflect.ValueOf(logInfo) + // if valueOfExample.Kind() == reflect.Struct { + // for i := 0; i < valueOfExample.NumField(); i++ { + // valMap[valueOfExample.Type().Field(i).Name] = valueOfExample.Field(i).Interface() + // } + // } + // logList = append(logList, logInfo) + logMap = append(logMap, valMap) + allRulesLog = logInfo + } else { + logInfo.OrgId = g.OrgId //班组ID"` + logInfo.TeamsTime = timeVal.AllTime //日期"` + logInfo.IsmId = g.TypeId //制度ID"` + logInfo.RankId = g.PeriodId //班次"` + logInfo.RulesId = g.Rules //轮询规则Id"` + logInfo.Days, _ = strconv.Atoi(timeVal.Years) //日"` + logInfo.Months, _ = strconv.Atoi(timeVal.Months) //月"` + logInfo.Years, _ = strconv.Atoi(timeVal.Days) //年"` + logInfo.Time = time.Now().Unix() //编辑时间"` + logInfo.IsmName = g.TypeName + logInfo.RankName = g.PeriodName + logInfo.RulesName = g.RulesTime + logInfo.Sort = g.RulesSort + logInfo.TeamsId = g.Rules + overall.CONSTANT_DB_TeamsLog.Create(&logInfo) + // logList = append(logList, logInfo) + allRulesLog = logInfo + redisClient.SetRedisTime(5256000) + jsonVal, _ := json.Marshal(logInfo) + redisClient.Set(dayRedisKey, string(jsonVal)) + valMap := publicmethod.MapOut[string]() + json.Unmarshal(jsonVal, &valMap) + logMap = append(logMap, valMap) + } + + return +} + +/* +* +@ 作者: 秦东 +@ 时间: 2025-01-18 09:26:03 +@ 功能: 解析排班规则 +@ 参数 + + #dataInfo 当前日期属性 + #timeVal 当前时间 + #zuoXiTime 作息时间段 + #lunXunShiXu 轮询规则 +*/ +func (g *GenesInfo) TeamsRun(dataInfo CalendarStructure, timeVal publicmethod.DateTimeTotimes, zuoXiTime []modelshr.WorkingTimePeriod, lunXunShiXu []modelshr.PollingRules) (logMap []map[string]interface{}) { + + // var logList []teamlog.TeamsLog + if len(zuoXiTime) < 1 && len(lunXunShiXu) < 1 { + return + } else if len(zuoXiTime) == 1 && len(lunXunShiXu) == 1 { + if dataInfo.IsWorks { + for _, v := range zuoXiTime { + var logInfo teamlog.TeamsLog + logInfo.OrgId = g.OrgId //班组ID"` + logInfo.TeamsTime = timeVal.AllTime //日期"` + logInfo.IsmId = g.TypeId //制度ID"` + logInfo.RankId = v.Id //班次"` + logInfo.RulesId = 0 //轮询规则Id"` + logInfo.Days, _ = strconv.Atoi(timeVal.Years) //日"` + logInfo.Months, _ = strconv.Atoi(timeVal.Months) //月"` + logInfo.Years, _ = strconv.Atoi(timeVal.Days) //年"` + logInfo.Time = time.Now().Unix() //编辑时间"` + logInfo.IsmName = g.TypeName + logInfo.RankName = fmt.Sprintf("%v(%v - %v)", v.Name, v.StartTime, v.EndTime) //v.Name + logInfo.RulesName = "休" + logInfo.TeamsId = 0 + logInfo.Sort = 0 + // logList = append(logList, logInfo) + jsonVal, _ := json.Marshal(logInfo) + valMap := publicmethod.MapOut[string]() + json.Unmarshal(jsonVal, &valMap) + logMap = append(logMap, valMap) + } + + } else { + for _, v := range zuoXiTime { + var logInfo teamlog.TeamsLog + logInfo.OrgId = g.OrgId //班组ID"` + logInfo.TeamsTime = timeVal.AllTime //日期"` + logInfo.IsmId = g.TypeId //制度ID"` + logInfo.RankId = v.Id //班次"` + logInfo.RulesId = zuoXiTime[0].Id //轮询规则Id"` + logInfo.Days, _ = strconv.Atoi(timeVal.Years) //日"` + logInfo.Months, _ = strconv.Atoi(timeVal.Months) //月"` + logInfo.Years, _ = strconv.Atoi(timeVal.Days) //年"` + logInfo.Time = time.Now().Unix() //编辑时间"` + logInfo.IsmName = g.TypeName + logInfo.RankName = fmt.Sprintf("%v(%v - %v)", v.Name, v.StartTime, v.EndTime) //v.Name + logInfo.RulesName = lunXunShiXu[0].TeamName + logInfo.TeamsId = lunXunShiXu[0].Teamid + logInfo.Sort = lunXunShiXu[0].Sort + // logList = append(logList, logInfo) + jsonVal, _ := json.Marshal(logInfo) + valMap := publicmethod.MapOut[string]() + json.Unmarshal(jsonVal, &valMap) + logMap = append(logMap, valMap) + } + } + } else { + //判断轮询规制(是两天一换还是一天一换) + var lunXunChuchong []int64 + maxSort := 0 //最大排序 + for _, v := range lunXunShiXu { + if !publicmethod.IsInTrue[int64](v.Teamid, lunXunChuchong) { + lunXunChuchong = append(lunXunChuchong, v.Teamid) + } + if maxSort <= v.Sort { + maxSort = v.Sort + } + } + //基于上个日期班组定位顺序 + lastStep := 0 + startStep := 0 //起始步伐 + workTimeNum := len(zuoXiTime) //一天拍几个班 + for _, v := range zuoXiTime { + if allRulesLog.RankId == v.Id { + lastStep = len(zuoXiTime) - v.Sort + startStep = v.Sort + } + } + if startStep <= 0 { + startStep = 1 + } + beiChuShu := 1 + if len(lunXunChuchong) > 0 { + beiChuShu = len(lunXunChuchong) + } + yuanDianDay := fmt.Sprintf("%v-%v-%v", allRulesLog.Years, allRulesLog.Months, allRulesLog.Days) + xiangChaJitian, err := publicmethod.DayBetweenDate(dataInfo.Date, yuanDianDay) //与上一个排班相差几天 + if err != nil { + xiangChaJitian = 1 + } + + switch len(lunXunShiXu) / beiChuShu { + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + default: + dayRedisKey := fmt.Sprintf("SchedulingTeam:StartingPoint_%v_%v_%v_%v", g.OrgId, g.TypeId, g.PeriodId, g.Rules) + redisClient := grocerystore.RunRedis(overall.CONSTANT_REDIS2) + + stepAll := xiangChaJitian*workTimeNum + lastStep //一共要走的步数 + for i := 1; i <= stepAll; i++ { + startStep++ + if startStep > workTimeNum { + startStep = 1 + } + // for _, zv := range zuoXiTime { + if i > lastStep { + for _, v := range lunXunShiXu { + if v.Sort == startStep { + fmt.Printf("") + + workInfoDuan := PaiBanSunXu(startStep, zuoXiTime) + var logInfo teamlog.TeamsLog + logInfo.GetCont(map[string]interface{}{"`orgId`": g.OrgId, "`years`": timeVal.Years, "`months`": timeVal.Months, "`days`": timeVal.Days, "`ismId`": g.TypeId, "`rulesId`": g.PeriodId, "`teamsId`": v.Teamid}) + if logInfo.Id != 0 { + editInfo := publicmethod.MapOut[string]() + editInfo["rulesName"] = v.TeamName + editInfo["time"] = time.Now().Unix() + logInfo.EiteCont(map[string]interface{}{"`id`": logInfo.Id}, editInfo) + // logList = append(logList, logInfo) + jsonVal, _ := json.Marshal(logInfo) + valMap := publicmethod.MapOut[string]() + json.Unmarshal(jsonVal, &valMap) + logMap = append(logMap, valMap) + redisClient.SetRedisTime(5256000) + // jsonVal, _ := json.Marshal(logInfo) + redisClient.Set(dayRedisKey, string(jsonVal)) + } else { + logInfo.OrgId = g.OrgId //班组ID"` + logInfo.TeamsTime = timeVal.AllTime //日期"` + logInfo.IsmId = g.TypeId //制度ID"` + logInfo.RankId = workInfoDuan.Id //g.PeriodId //班次"` + logInfo.RulesId = g.Rules //轮询规则Id"` + logInfo.Days, _ = strconv.Atoi(timeVal.Days) //日"` + logInfo.Months, _ = strconv.Atoi(timeVal.Months) //月"` + logInfo.Years, _ = strconv.Atoi(timeVal.Years) //年"` + logInfo.Time = time.Now().Unix() //编辑时间"` + logInfo.IsmName = g.TypeName + logInfo.RankName = fmt.Sprintf("%v(%v - %v)", workInfoDuan.Name, workInfoDuan.StartTime, workInfoDuan.EndTime) //workInfoDuan.Name //g.PeriodName + logInfo.RulesName = v.TeamName + logInfo.TeamsId = v.Teamid + logInfo.Sort = g.RulesSort + overall.CONSTANT_DB_TeamsLog.Create(&logInfo) + // logList = append(logList, logInfo) + jsonVal, _ := json.Marshal(logInfo) + valMap := publicmethod.MapOut[string]() + json.Unmarshal(jsonVal, &valMap) + logMap = append(logMap, valMap) + redisClient.SetRedisTime(5256000) + // jsonVal, _ := json.Marshal(logInfo) + redisClient.Set(dayRedisKey, string(jsonVal)) + + } + + } + + } + } + // } + + } + } + } + return +} + +// 获取排班顺序 +func PaiBanSunXu(step int, zuoXiTime []modelshr.WorkingTimePeriod) (zxsj modelshr.WorkingTimePeriod) { + for _, v := range zuoXiTime { + if v.Sort == step { + zxsj = v + return + } + } + return +} + +/** +@ 作者: 秦东 +@ 时间: 2025-01-17 19:42:50 +@ 功能: 获取上个月最后一天 +*/ + +/* +* +@ 作者: 秦东 +@ 时间: 2024-07-17 08:55:56 +@ 功能: 结果与日期合并 +@ 参数 + + # + +@ 返回值 + + # + +@ 方法原型 + + # +*/ +func TimeHaveAry(dateList []CalendarStructure, listDate []map[string]interface{}) []CalendarStructure { + for ti, tv := range dateList { + // fmt.Printf("测试类型--->%v=============>%v\n", ti, tv) + for _, v := range listDate { + for mi, mv := range v { + // fmt.Printf("测试类型--2->%v=============>%v\n", tv.Date, mi) + if tv.Date == mi { + // fmt.Printf("测试类型--1->%v=============>%v\n", tv.Date, mi) + dateList[ti].List = mv + } + } + } + } + return dateList +} diff --git a/api/version1/menus/type.go b/api/version1/menus/type.go index 112750c..4ee674d 100644 --- a/api/version1/menus/type.go +++ b/api/version1/menus/type.go @@ -2,6 +2,7 @@ package menus import ( "appPlatform/models/modelAppPlatform" + "appPlatform/models/modelshr" "appPlatform/overall/publicmethod" "sync" @@ -71,3 +72,83 @@ type SendMenusThrees struct { modelAppPlatform.Menus PermCode string `json:"permcode"` } + +type MyLookOrg struct { + myInfo modelshr.ManCont + Level []int + OrdId []int64 +} + +// 根据权限角色、岗位、负责范围获取行政组织 +type RolePostIsChnature struct { + modelshr.AdministrativeOrganization + Child []RolePostIsChnature `json:"child"` +} + +// 输出排班周期及源点 +type GenesInfo struct { + modelshr.Genesis + TypeIdStr string `json:"typeIdStr" gorm:"-"` //排班类型 + TypeName string `json:"typeName" gorm:"-"` //排班类型 + PeriodName string `json:"periodName" gorm:"-"` //工作时段 + RulesTime string `json:"rulesTime" gorm:"-"` //轮询起点 + RulesName string `json:"rulesName" gorm:"-"` //轮询起点名称 + RulesSort int `json:"rulesSort" gorm:"-"` //轮询起点排序 + BegainTime string `json:"begainTime" gorm:"-"` //源点时间 +} + +// 输出排班类别及轮询制度 +type SendTemsTypeAndRuler struct { + RulerPublicInfo + WorkingTimePeriod []RulerPublicInfo `json:"workingTimePeriod"` //工作时间段 + PollingRules []RulerPublicInfo `json:"pollingRules"` //轮询规则 +} +type RulerPublicInfo struct { + Id string `json:"id"` //ID + Name string `json:"name"` //名称 + Sort int `json:"sort"` // + StartTime string `json:"startTime"` //名称 + EndTime string `json:"endTime"` //名称 +} + +// 日历结构体 +type CalendarStructure struct { + Title int `json:"title"` //"日期值(公历)":13, + IsCurrent bool `json:"isCurrent"` //"当前":true, + IsHolidays bool `json:"isHolidays"` //"是否为假期":false, + IsWorks bool `json:"isWork"` //"是工作日":false, + Date string `json:"date"` //"当前日期":"2025-01-13", + Lunars string `json:"lunars"` //"阴历日期":"2024-12-14", + LunarsChinese string `json:"lunarsChinese"` //"中国阴历日期":"腊月十四", + LunarsChina string `json:"lunarsChina"` //"简要中国阴历日期":"十四", + IsNow bool `json:"isNow"` //"是现在吗":false, + SolarDay bool `json:"solarDay"` //"太阳历":false, + LunarDay bool `json:"lunarDay"` //"太阴历":false, + Animal string `json:"animal"` //"属相":"龙", + Astro string `json:"astro"` //"星座":"魔羯座", + Term bool `json:"term"` //"周期":false + List interface{} `json:"list"` +} + +// 按月排班 +type AnYuePaiBan struct { + OrgId string `json:"orgId"` //" + MonthAllDay [][]CalendarStructure `json:"monthAllDay"` +} + +// 按周排班 +type AnZhouPaiBan struct { + OrgId string `json:"orgId"` //" + WeekAllDay []CalendarStructure `json:"weekAllDay"` +} + +// 按天排班 +type AnDayPaiBan struct { + OrgId string `json:"orgId"` //" + DayAllDay CalendarStructure `json:"dayAllDay"` +} + +// 输出格式 +type CalendarList struct { + List []map[string]interface{} +} diff --git a/apirouter/v1/dataCenterRouter/router.go b/apirouter/v1/dataCenterRouter/router.go index 58782a8..09b31bb 100644 --- a/apirouter/v1/dataCenterRouter/router.go +++ b/apirouter/v1/dataCenterRouter/router.go @@ -19,5 +19,6 @@ func (a *ApiRouter) RouterGroupPc(router *gin.RouterGroup) { apiRouter.POST("postSaveData", dataApi.PostSaveData) //数据中台POST提交数据 apiRouter.POST("gainDataTable", dataApi.GainDataTable) //获取数据表 + } } diff --git a/apirouter/v1/menusRouters/pc.go b/apirouter/v1/menusRouters/pc.go index 77606de..ffc145b 100644 --- a/apirouter/v1/menusRouters/pc.go +++ b/apirouter/v1/menusRouters/pc.go @@ -21,5 +21,11 @@ func (a *ApiRouter) RouterGroupPc(router *gin.RouterGroup) { apiRouter.POST("get_one_menu_cont", methodBinding.GetOneMenuCont) //获取单一菜单内容 apiRouter.POST("edit_menus_cont", methodBinding.EditMenusCont) //修改菜单 apiRouter.POST("delt_menus_cont", methodBinding.DeltMenusCont) //删除菜单 + + apiRouter.POST("accordRoleGiveOrg", methodBinding.AccordRoleGiveOrg) //根据角色获取行政组织 + apiRouter.POST("gainShiftRules", methodBinding.GainShiftRules) //获取排班制度及周期源点 + apiRouter.POST("gainTemsTypeAndRuler", methodBinding.GainTemsTypeAndRuler) //获取排班类别及轮询制度 + + apiRouter.POST("analysisMonthRulers", methodBinding.AnalysisMonthRulers) //解析日历生成排班顺序 } } diff --git a/apirouter/v1/menusRouters/type.go b/apirouter/v1/menusRouters/type.go index 91f7c53..f61970b 100644 --- a/apirouter/v1/menusRouters/type.go +++ b/apirouter/v1/menusRouters/type.go @@ -1,4 +1,11 @@ package menusrouters +import "appPlatform/models/modelshr" + //菜单路由 type ApiRouter struct{} + +type MyLookOrg struct { + myInfo modelshr.ManCont + OrdId []int64 +} diff --git a/config/configApp/appConfig.yaml b/config/configApp/appConfig.yaml new file mode 100644 index 0000000..6466b9e --- /dev/null +++ b/config/configApp/appConfig.yaml @@ -0,0 +1,47 @@ + +#App主配置 +appsetup: + port: 17777 #服务端口 + readtime: 3600 #请求的读取操作在超时前的最大持续时间 + writetime : 3600 #回复的写入操作在超时前的最大持续时间 + appkey: 'heng_xin_gao_ke_AppKey' #应用程序密钥 + password: '123456789' #系统默认密码 + prefix: 'HXJT' #系统字段前缀 + weburl: 'http://kpi.hxgk.group' #web访问地址 + pcurl: 'http://ginadmin.hxgk.group' #PC访问地址 + webKpiUrl: 'http://web.hxgk.group' #web访问地址 + defaultIP: '127.0.0.1' # +logconfig: + path: 'log' #日志保存地址 +#验证码相关设置 +captcha: + key-long: 6 + img-width: 240 + img-height: 80 + +#Redis前缀 +redisprefix: + prefix: "HXGK_GO_ZhixingCollege" + alias: "dev" + +#企业微信相关配置 +wechatcompany: + companyid: 'ww02f310301953277a' #企业ID +#知行学院 +wechatschool: + agentid: 1000008 + secret: 'YJOHrmHtvevAdctg-06TMLnPokIaLHdfrQMyQolZQC8' + token: 'kkUA3s2s3' #Token + encodingaeskey: 'ZI29of85mTgQPik8LLjDnYKlAECDbI23Pq886VJ9Azf' #EncodingAESKey +#绩效考核 +wechatkpi: + agentid: 1000036 + secret: 'J83SKVK9QCdQs_fTjPWUx3ouqucrHf_EwxtQUlY0fQk' + token: 'kkUA3s2s3' #Token + encodingaeskey: 'ZI29of85mTgQPik8LLjDnYKlAECDbI23Pq886VJ9Azf' #EncodingAESKey +#工业互联网平台 +szzlypt: + agentid: 1000108 + secret: 'YdBDEO9nawZaYuKcgS9jFme8x4eEbTPkIgBnlarG_GQ' + token: 'kkUA3s2s3' #Token + encodingaeskey: 'ZI29of85mTgQPik8LLjDnYKlAECDbI23Pq886VJ9Azf' #EncodingAESKey \ No newline at end of file diff --git a/config/configApp/server.go b/config/configApp/server.go index 99cd5df..d51c9ed 100644 --- a/config/configApp/server.go +++ b/config/configApp/server.go @@ -23,6 +23,7 @@ type appsetup struct { WebUrl string `mapstructure:"weburl" json:"weburl" yaml:"weburl"` PcbUrl string `mapstructure:"pcurl" json:"pcurl" yaml:"pcurl"` WebKpiUrl string `mapstructure:"webKpiUrl" json:"webKpiUrl" yaml:"webKpiUrl"` + DefaultIP string `mapstructure:"defaultIP" json:"defaultIP" yaml:"defaultIP"` } //日志配置 diff --git a/config/configDatabase/database.go b/config/configDatabase/database.go index fd04a71..d3fa734 100644 --- a/config/configDatabase/database.go +++ b/config/configDatabase/database.go @@ -35,6 +35,7 @@ type MysqlSetUp struct { ReviseFormData MasterMysqlSetUp `mapstructure:"reviseFormData" json:"reviseFormData" yaml:"reviseFormData"` PersonalityColor MasterMysqlSetUp `mapstructure:"charactercolor" json:"charactercolor" yaml:"charactercolor"` //性格色彩 HrDatabaseInside MasterMysqlSetUp `mapstructure:"hrdatabaseinside" json:"hrdatabaseinside" yaml:"hrdatabaseinside"` //内网Hr数据库 + JobScheduling MasterMysqlSetUp `mapstructure:"jobScheduling" json:"jobScheduling" yaml:"jobScheduling"` //生产排班记录 } type MasterMysqlSetUp struct { diff --git a/config/configDatabase/database.yaml b/config/configDatabase/database.yaml new file mode 100644 index 0000000..9ec4d36 --- /dev/null +++ b/config/configDatabase/database.yaml @@ -0,0 +1,379 @@ +#数据库配置 + +#主数据库 +master: + url_path: '127.0.0.1' #数据库地址 + port: 3306 #数据库端口 + charset: 'utf8mb4' #数据库编码方式 + parseTime: 'True' #是否自动转换时间 + loc: 'Local' #时区 + name: 'hengxingaoke_tes' #数据库名称 + username: 'root' #数据库用户民 + password: 'root' #数据库密码 + max_idle_conns: 100 #最大空闲数量 + max_open_conns: 1500 #最大打开数量 + gorm_log: true #是否开启gorm日志 +#微信数据库 +wechat: + url_path: '127.0.0.1' #数据库地址 + port: 3306 #数据库端口 + charset: 'utf8mb4' #数据库编码方式 + parseTime: 'True' #是否自动转换时间 + loc: 'Local' #时区 + name: 'wechatuser' #数据库名称 + username: 'root' #数据库用户民 + password: 'root' #数据库密码 + max_idle_conns: 100 #最大空闲数量 + max_open_conns: 1500 #最大打开数量 + gorm_log: true #是否开启gorm日志 +#HR数据库 +hrdatabase: + # url_path: '127.0.0.1' #数据库地址 + # port: 3306 #数据库端口 + # name: 'hr_new' #数据库名称 + # username: 'root' #数据库用户民 + # password: 'root' #数据库密码 + + url_path: '172.20.5.34' #数据库地址 + port: 4000 #数据库端口runtime error: invalid memory address or nil pointer dereference + name: 'hr_new' #数据库名称 + username: 'root' #数据库用户民 + password: '9z_Bu28r1*DZ3K6@+a' #数据库密码 + + charset: 'utf8mb4' #数据库编码方式 + parseTime: 'True' #是否自动转换时间 + loc: 'Local' #时区 + max_idle_conns: 100 #最大空闲数量 + max_open_conns: 1500 #最大打开数量 + gorm_log: true #是否开启gorm日志 +#文档属性数据库 +fileBookDate: + url_path: '127.0.0.1' #数据库地址 + port: 3306 #数据库端口 + charset: 'utf8mb4' #数据库编码方式 + parseTime: 'True' #是否自动转换时间 + loc: 'Local' #时区 + name: 'learn_message' #数据库名称 + username: 'root' #数据库用户民 + password: 'root' #数据库密码 + max_idle_conns: 100 #最大空闲数量 + max_open_conns: 1500 #最大打开数量 + gorm_log: true #是否开启gorm日志 +#错题库 +errorSubjectDate: + url_path: '127.0.0.1' #数据库地址 + port: 3306 #数据库端口 + charset: 'utf8mb4' #数据库编码方式 + parseTime: 'True' #是否自动转换时间 + loc: 'Local' #时区 + name: 'wrong_question_bank' #数据库名称 + username: 'root' #数据库用户民 + password: 'root' #数据库密码 + max_idle_conns: 100 #最大空闲数量 + max_open_conns: 1500 #最大打开数量 + gorm_log: true #是否开启gorm日志 +#自我测验 +myTestDate: + url_path: '127.0.0.1' #数据库地址 + port: 3306 #数据库端口 + charset: 'utf8mb4' #数据库编码方式 + parseTime: 'True' #是否自动转换时间 + loc: 'Local' #时区 + name: 'selftestdatabase' #数据库名称 + username: 'root' #数据库用户民 + password: 'root' #数据库密码 + max_idle_conns: 100 #最大空闲数量 + max_open_conns: 1500 #最大打开数量 + gorm_log: true #是否开启gorm日志 + +#图文信息数据库 +imageTextDate: + url_path: '127.0.0.1' #数据库地址 + port: 3306 #数据库端口 + charset: 'utf8mb4' #数据库编码方式 + parseTime: 'True' #是否自动转换时间 + loc: 'Local' #时区 + name: 'readdocument' #数据库名称 + username: 'root' #数据库用户民 + password: 'root' #数据库密码 + max_idle_conns: 100 #最大空闲数量 + max_open_conns: 1500 #最大打开数量 + gorm_log: true #是否开启gorm日志 + +#计分明细数据库 +scoringDetailsDate: + url_path: '127.0.0.1' #数据库地址 + port: 3306 #数据库端口 + charset: 'utf8mb4' #数据库编码方式 + parseTime: 'True' #是否自动转换时间 + loc: 'Local' #时区 + name: 'league_table_data' #数据库名称 + username: 'root' #数据库用户民 + password: 'root' #数据库密码 + max_idle_conns: 100 #最大空闲数量 + max_open_conns: 1500 #最大打开数量 + gorm_log: true #是否开启gorm日志 + +#趣味问答 +questionsAnswersDate: + url_path: '127.0.0.1' #数据库地址 + port: 3306 #数据库端口 + charset: 'utf8mb4' #数据库编码方式 + parseTime: 'True' #是否自动转换时间 + loc: 'Local' #时区 + name: 'ques_and_answers' #数据库名称 + username: 'root' #数据库用户民 + password: 'root' #数据库密码 + max_idle_conns: 100 #最大空闲数量 + max_open_conns: 1500 #最大打开数量 + gorm_log: true #是否开启gorm日志 + +#风云榜统计数据库 +billboardDate: + url_path: '127.0.0.1' #数据库地址 + port: 3306 #数据库端口 + charset: 'utf8mb4' #数据库编码方式 + parseTime: 'True' #是否自动转换时间 + loc: 'Local' #时区 + name: 'statisticsing' #数据库名称 + username: 'root' #数据库用户民 + password: 'root' #数据库密码 + max_idle_conns: 100 #最大空闲数量 + max_open_conns: 1500 #最大打开数量 + gorm_log: true #是否开启gorm日志 + +#健康上报数据库 +healthReportDate: + url_path: '127.0.0.1' #数据库地址 + port: 3306 #数据库端口 + charset: 'utf8mb4' #数据库编码方式 + parseTime: 'True' #是否自动转换时间 + loc: 'Local' #时区 + name: 'location' #数据库名称 + username: 'root' #数据库用户民 + password: 'root' #数据库密码 + max_idle_conns: 100 #最大空闲数量 + max_open_conns: 1500 #最大打开数量 + gorm_log: true #是否开启gorm日志 + +#绩效考核数据库 +kpiDate: + url_path: '127.0.0.1' #数据库地址 + port: 3306 #数据库端口 + charset: 'utf8mb4' #数据库编码方式 + parseTime: 'True' #是否自动转换时间 + loc: 'Local' #时区 +# name: 'perform' #数据库名称 + name: 'performing' #数据库名称 + username: 'root' #数据库用户民 + password: 'root' #数据库密码 + max_idle_conns: 100 #最大空闲数量 + max_open_conns: 1500 #最大打开数量 + gorm_log: true #是否开启gorm日志 + +#企业微信回调记录 +wechatCallBackLogDate: + url_path: '127.0.0.1' #数据库地址 + port: 3306 #数据库端口 + charset: 'utf8mb4' #数据库编码方式 + parseTime: 'True' #是否自动转换时间 + loc: 'Local' #时区 + name: 'wechatlog' #数据库名称 + username: 'root' #数据库用户民 + password: 'root' #数据库密码 + max_idle_conns: 100 #最大空闲数量 + max_open_conns: 1500 #最大打开数量 + gorm_log: true #是否开启gorm日志 + +#管理档案 +managearchives: + url_path: '127.0.0.1' #数据库地址 + port: 3306 #数据库端口 + charset: 'utf8mb4' #数据库编码方式 + parseTime: 'True' #是否自动转换时间 + loc: 'Local' #时区 + name: 'manage_archives' #数据库名称 + username: 'root' #数据库用户民 + password: 'root' #数据库密码 + max_idle_conns: 100 #最大空闲数量1 + max_open_conns: 1500 #最大打开数量 + gorm_log: true #是否开启gorm日志2 + +#系统权限配置数据库 +systemPermission: + url_path: '127.0.0.1' #数据库地址 + port: 3306 #数据库端口 + charset: 'utf8mb4' #数据库编码方式 + parseTime: 'True' #是否自动转换时间 + loc: 'Local' #时区 + name: 'system_empower' #数据库名称 + username: 'root' #数据库用户民 + password: 'root' #数据库密码 + max_idle_conns: 100 #最大空闲数量 + max_open_conns: 1500 #最大打开数量 + gorm_log: true #是否开启gorm日志 + +#应用平台数据库 +appPlatformDatabase: + url_path: '172.20.5.34' #数据库地址 + port: 4000 #数据库端口 + name: 'app_platform' #数据库名称 + username: 'root' #数据库用户民 + password: '9z_Bu28r1*DZ3K6@+a' #数据库密码 + + # url_path: '127.0.0.1' #数据库地址 + # port: 3306 #数据库端口 + # name: 'app_platform' #数据库名称 + # username: 'root' #数据库用户民 + # password: 'root' #数据库密码 + + + charset: 'utf8mb4' #数据库编码方式 + parseTime: 'True' #是否自动转换时间 + loc: 'Local' #时区 + max_idle_conns: 100 #最大空闲数量 + max_open_conns: 1500 #最大打开数量 + gorm_log: true #是否开启gorm日志 + + +#仓库系统 +storage: + url_path: '172.20.2.87' #数据库地址 + port: 3306 #数据库端口 + name: 'depository' #数据库名称 + username: 'depository' #数据库用户民 + password: 'NhE47edekBHxhjYk' #数据库密码 + + # url_path: '127.0.0.1' #数据库地址 + # port: 3306 #数据库端口 + # name: 'depository' #数据库名称 + # username: 'root' #数据库用户民 + # password: 'root' #数据库密码 + + + charset: 'utf8mb4' #数据库编码方式 + parseTime: 'True' #是否自动转换时间 + loc: 'Local' #时区 + max_idle_conns: 100 #最大空闲数量 + max_open_conns: 1500 #最大打开数量 + gorm_log: true #是否开启gorm日志 + +#应用平台数据库 +servermaster: + url_path: '36.133.126.182' #数据库地址 + port: 3306 #数据库端口 + charset: 'utf8mb4' #数据库编码方式 + parseTime: 'True' #是否自动转换时间 + loc: 'Local' #时区 + name: 'hengxingaoke_tes' #数据库名称 + username: 'hengxingaoke_tes' #数据库用户民 + password: 'JsTt6iTpkZ85wDnF' #数据库密码 + max_idle_conns: 100 #最大空闲数量 + max_open_conns: 1500 #最大打开数量 + gorm_log: true #是否开启gorm日志 + +tidbrmaster: + url_path: '172.20.5.33' #数据库地址 + port: 4000 #数据库端口 + charset: 'utf8mb4' #数据库编码方式 + parseTime: 'True' #是否自动转换时间 + loc: 'Local' #时区 + name: 'hengxingaoke_tes' #数据库名称 + username: 'root' #数据库用户民 + password: '9z_Bu28r1*DZ3K6@+a' #数据库密码 + max_idle_conns: 100 #最大空闲数量 + max_open_conns: 1500 #最大打开数量 + gorm_log: true #是否开启gorm日志 + +#自定义数据库 +customerFormDatabase: + url_path: '172.20.5.34' #数据库地址 + port: 4000 #数据库端口 + name: 'customer_form' #数据库名称 + username: 'root' #数据库用户民 + password: '9z_Bu28r1*DZ3K6@+a' #数据库密码 + + # url_path: '127.0.0.1' #数据库地址 + # port: 3306 #数据库端口 + # name: 'customer_form' #数据库名称 + # username: 'root' #数据库用户民 + # password: 'root' #数据库密码 + + charset: 'utf8mb4' #数据库编码方式 + parseTime: 'True' #是否自动转换时间 + loc: 'Local' #时区 + max_idle_conns: 100 #最大空闲数量 + max_open_conns: 1500 #最大打开数量 + gorm_log: true #是否开启gorm日志 + +#流程执行记录 +flowLogDatabase: + url_path: '127.0.0.1' #数据库地址 + port: 3306 #数据库端口 + charset: 'utf8mb4' #数据库编码方式 + parseTime: 'True' #是否自动转换时间 + loc: 'Local' #时区 + name: 'flow_log' #数据库名称 + username: 'root' #数据库用户民 + password: 'root' #数据库密码 + max_idle_conns: 100 #最大空闲数量 + max_open_conns: 1500 #最大打开数量 + gorm_log: true #是否开启gorm日志 +#自定义表单修改数据历史记录库 +reviseFormData: + # url_path: '127.0.0.1' #数据库地址 + # port: 3306 #数据库端口 + # username: 'root' #数据库用户民 + # password: 'root' #数据库密码 + + url_path: '172.20.5.33' #数据库地址 + port: 4000 #数据库端口 + username: 'root' #数据库用户民 + password: '9z_Bu28r1*DZ3K6@+a' #数据库密码 + + charset: 'utf8mb4' #数据库编码方式 + parseTime: 'True' #是否自动转换时间 + loc: 'Local' #时区 + name: 'reviseform' #数据库名称 + max_idle_conns: 100 #最大空闲数量 + max_open_conns: 1500 #最大打开数量 + gorm_log: true #是否开启gorm日志 +#性格色彩 +charactercolor: + url_path: '172.20.5.33' #数据库地址 + port: 4000 #数据库端口 + charset: 'utf8mb4' #数据库编码方式 + parseTime: 'True' #是否自动转换时间 + loc: 'Local' #时区 + name: 'charactercolor' #数据库名称 + username: 'root' #数据库用户民 + password: '9z_Bu28r1*DZ3K6@+a' #数据库密码 + max_idle_conns: 100 #最大空闲数量 + max_open_conns: 1500 #最大打开数量 + gorm_log: false #是否开启gorm日志 +#HR内网数据库 +hrdatabaseinside: + url_path: '120.224.6.6' #数据库地址 + port: 16666 #数据库端口 + name: 'hr_new' #数据库名称 + username: 'hr_new' #数据库用户民 + password: 'AnknKiXiXaxNrw78' #数据库密码 + charset: 'utf8mb4' #数据库编码方式 + parseTime: 'True' #是否自动转换时间 + loc: 'Local' #时区 + max_idle_conns: 100 #最大空闲数量 + max_open_conns: 1500 #最大打开数量 + gorm_log: true #是否开启gorm日志 +#生产排班记录 +jobScheduling: + url_path: '172.20.5.33' #数据库地址 + port: 4000 #数据库端口 + charset: 'utf8mb4' #数据库编码方式 + parseTime: 'True' #是否自动转换时间 + loc: 'Local' #时区 + name: 'jobScheduling' #数据库名称 + username: 'root' #数据库用户民 + password: '9z_Bu28r1*DZ3K6@+a' #数据库密码 + max_idle_conns: 100 #最大空闲数量 + max_open_conns: 1500 #最大打开数量 + gorm_log: true #是否开启gorm日志 \ No newline at end of file diff --git a/config/configNosql/redis.yaml b/config/configNosql/redis.yaml new file mode 100644 index 0000000..87c77b1 --- /dev/null +++ b/config/configNosql/redis.yaml @@ -0,0 +1,49 @@ +#Redis配置文件 +master: + url_path: '127.0.0.1' + port: 6379 #数据库端口 + password: "" + name: 0 + +#Redis配置文件 +master1: + url_path: '127.0.0.1' + port: 6379 #数据库端口 + password: "" + name: 1 + +#Redis配置文件 +master2: + url_path: '127.0.0.1' + port: 6379 #数据库端口 + password: "" + name: 2 + +#Redis配置文件 +master3: + url_path: '127.0.0.1' + port: 6379 #数据库端口 + password: "" + name: 3 + +#Redis配置文件 +master4: + url_path: '127.0.0.1' + port: 6379 #数据库端口 + password: "" + name: 4 + +#Redis配置文件 +master5: + url_path: '127.0.0.1' + port: 6379 #数据库端口11 + password: "" + name: 5 +#Redis配置文件 +redisCluster: + url_path: '120.224.6.6' + port: 6379 #数据库端口11 + password: "Redis+brngJ3U19@8_Z2^7a" + name: 0 + url_path_list: ['172.20.5.34:6379','172.20.5.30:6379','172.20.5.31:6379'] + # url_path_list: ['120.224.6.6:6379','120.224.6.6:6380','120.224.6.6:6381'] \ No newline at end of file diff --git a/go.mod b/go.mod index 5b2ffb4..6416c9c 100644 --- a/go.mod +++ b/go.mod @@ -35,14 +35,13 @@ require ( github.com/bytedance/sonic v1.9.1 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect - github.com/denisenkom/go-mssqldb v0.12.3 github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect github.com/gabriel-vasile/mimetype v1.4.2 // indirect github.com/gin-contrib/sse v0.1.0 // indirect github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect github.com/go-playground/validator/v10 v10.14.0 // indirect - github.com/go-sql-driver/mysql v1.7.1 + github.com/go-sql-driver/mysql v1.7.1 // indirect github.com/goccy/go-json v0.10.2 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/jinzhu/inflection v1.0.0 // indirect @@ -50,10 +49,9 @@ require ( github.com/json-iterator/go v1.1.12 // indirect github.com/klauspost/cpuid/v2 v2.2.4 // indirect github.com/leodido/go-urn v1.2.4 // indirect - github.com/lib/pq v1.10.9 github.com/magiconair/properties v1.8.7 // indirect github.com/mattn/go-isatty v0.0.19 // indirect - github.com/mattn/go-sqlite3 v1.14.24 + github.com/mattn/go-sqlite3 v1.14.24 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/pelletier/go-toml/v2 v2.1.0 // indirect @@ -70,7 +68,6 @@ require ( golang.org/x/sys v0.16.0 // indirect golang.org/x/text v0.14.0 // indirect google.golang.org/protobuf v1.31.0 // indirect - gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect gopkg.in/yaml.v3 v3.0.1 // indirect gorm.io/driver/postgres v1.5.11 gorm.io/driver/sqlite v1.5.7 diff --git a/go.sum b/go.sum index c811f87..21b0cd9 100644 --- a/go.sum +++ b/go.sum @@ -1,17 +1,20 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0/go.mod h1:h6H6c8enJmmocHUbLiiGY6sx7f9i+X3m1CHdd5c6Rdw= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.0/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.1/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.1 h1:lGlwhPtrX6EVml1hO0ivjkUxsSyl4dsiw9qcA1k/3IQ= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.1/go.mod h1:RKUqNu35KJYcVG/fqTRqmuXJZYNhYkBrnC/hX7yGbTA= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.11.0/go.mod h1:HcM1YX14R7CJcghJGOYCgdezslRSVzqwLf/q+4Y2r/0= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.1/go.mod h1:uE9zaUfEQT/nbQjVi2IblCG9iaLtZsuYZ8ne+PuQ02M= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.5.1 h1:sO0/P7g68FrryJzljemN+6GTssUXdANk6aJ7T1ZxnsQ= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.5.1/go.mod h1:h8hyGFDsU5HMivxiS2iYFZsgDbU9OnnJ163x5UGVKYo= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8= github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.1 h1:6oNBlSdi1QqM1PNW7FPA6xOGA5UNsXnkaYZz9vdPGhA= github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.1/go.mod h1:s4kgfzA0covAXNicZHDMN58jExvcng2mC/DepXiF1EI= +github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azkeys v1.0.1 h1:MyVTgWR8qd/Jw1Le0NZebGBUCLbtak3bJ3z1OlqZBpw= github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azkeys v1.0.1/go.mod h1:GpPjLhVR9dnUoJMyHWSPy71xY9/lcmpzIPZXmF0FCVY= +github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v1.0.0 h1:D3occbWoio4EBLkbkevetNMAVX197GkzbUMtqjGWn80= github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v1.0.0/go.mod h1:bTSOgj05NGRuHHhQwAdPnYr9TOdNmKlZTgGLL6nyAdI= github.com/AzureAD/microsoft-authentication-library-for-go v1.1.1/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= +github.com/AzureAD/microsoft-authentication-library-for-go v1.2.1 h1:DzHpqpoJVaCgOUdVHxE8QB52S6NiVdDQvGlny1qvPqA= github.com/AzureAD/microsoft-authentication-library-for-go v1.2.1/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs= @@ -32,8 +35,6 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dengsgo/math-engine v0.0.0-20230823154425-78f211b48149 h1:TkVfb0s14IUHDGvjQfq3f0PZnV1zh609did4DrnD4q4= github.com/dengsgo/math-engine v0.0.0-20230823154425-78f211b48149/go.mod h1:zkR27k4K0I8FS6rkEd8qBhPeS8i3X2FKfvSPdF64OpQ= -github.com/denisenkom/go-mssqldb v0.12.3 h1:pBSGx9Tq67pBOTLmxNuirNTeB8Vjmf886Kx+8Y+8shw= -github.com/denisenkom/go-mssqldb v0.12.3/go.mod h1:k0mtMFOnU+AihqFxPMiF05rtiDrorD1Vrm1KEz5hxDo= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= @@ -64,10 +65,9 @@ github.com/go-sql-driver/mysql v1.7.1 h1:lUIinVbN1DY0xBg0eMOzmmtGoHwWBbvnWubQUrt github.com/go-sql-driver/mysql v1.7.1/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI= github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= -github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= github.com/golang-jwt/jwt/v5 v5.0.0/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= +github.com/golang-jwt/jwt/v5 v5.2.0 h1:d/ix8ftRUorsN+5eMIlF4T6J8CAt9rch3My2winC1Jw= github.com/golang-jwt/jwt/v5 v5.2.0/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= -github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0= github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 h1:au07oEsX2xN0ktxqI+Sida1w446QrXBRJ0nee3SNZlA= github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0= github.com/golang-sql/sqlexp v0.1.0 h1:ZCD6MBpcuOVfGVqsEmY5/4FtYiKz6tSyUv9LPEDei6A= @@ -93,6 +93,7 @@ github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.5.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4= github.com/gorilla/sessions v1.2.1/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/zI+bUmuGM= @@ -125,16 +126,12 @@ github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHm github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.2.4 h1:acbojRNwl3o09bUq+yDCtZFc1aiwaAAxtcn8YkZXnvk= github.com/klauspost/cpuid/v2 v2.2.4/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q= github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4= -github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= -github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= @@ -156,8 +153,8 @@ github.com/mozillazg/go-pinyin v0.20.0 h1:BtR3DsxpApHfKReaPO1fCqF4pThRwH9uwvXzm+ github.com/mozillazg/go-pinyin v0.20.0/go.mod h1:iR4EnMMRXkfpFVV5FMi4FNB6wGq9NV6uDWbUuPhP4Yc= github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4= github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= -github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4/go.mod h1:4OwLy04Bl9Ef3GJJCoec+30X3LQs/0/m4HFRt/2LUSA= github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= +github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= @@ -207,16 +204,12 @@ golang.org/x/arch v0.3.0/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201012173705-84dcc777aaee/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio= golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= -golang.org/x/crypto v0.16.0 h1:mMMrFzRSCF0GvB7Ne27XVtVAaXLrPmgPC7/v0tkwHaY= golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= -golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k= golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc= golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg= @@ -235,8 +228,6 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= @@ -245,7 +236,6 @@ golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.13.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI= golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= -golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= @@ -262,7 +252,6 @@ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -276,7 +265,6 @@ golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= @@ -292,7 +280,6 @@ golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= golang.org/x/term v0.16.0/go.mod h1:yn7UURbUtPyrVJPGPq404EukNFxcm/foM+bV/bfcDsY= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= @@ -330,9 +317,7 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= @@ -340,7 +325,6 @@ gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gorm.io/driver/mysql v1.5.2 h1:QC2HRskSE75wBuOxe0+iCkyJZ+RqpudsQtqkp+IMuXs= @@ -352,8 +336,6 @@ gorm.io/driver/sqlite v1.5.7/go.mod h1:U+J8craQU6Fzkcvu8oLeAQmi50TkwPEhHDEjQZXDa gorm.io/driver/sqlserver v1.5.4 h1:xA+Y1KDNspv79q43bPyjDMUgHoYHLhXYmdFcYPobg8g= gorm.io/driver/sqlserver v1.5.4/go.mod h1:+frZ/qYmuna11zHPlh5oc2O6ZA/lS88Keb0XSH1Zh/g= gorm.io/gorm v1.25.2-0.20230530020048-26663ab9bf55/go.mod h1:L4uxeKpfBml98NYqVqwAdmV1a2nBtAec/cf3fpucW/k= -gorm.io/gorm v1.25.5 h1:zR9lOiiYf09VNh5Q1gphfyia1JpiClIWG9hQaxB/mls= -gorm.io/gorm v1.25.5/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8= gorm.io/gorm v1.25.7-0.20240204074919-46816ad31dde/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8= gorm.io/gorm v1.25.10 h1:dQpO+33KalOA+aFYGlK+EfxcI5MbO7EP2yYygwh9h+s= gorm.io/gorm v1.25.10/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8= diff --git a/initialization/databaseinit/mysql.go b/initialization/databaseinit/mysql.go index df78f65..c9de717 100644 --- a/initialization/databaseinit/mysql.go +++ b/initialization/databaseinit/mysql.go @@ -175,4 +175,12 @@ func LoadDatabase() { } else { fmt.Printf("%v:数据库开启成功!服务器\n", sqlConfig.HrDatabaseInside.Name) } + //生产排班记录 + overall.CONSTANT_DB_TeamsLog = sqlConfig.JobScheduling.OpenSql() + if overall.CONSTANT_DB_TeamsLog == nil { + fmt.Printf("%v:数据库开启失败!服务器\n", sqlConfig.JobScheduling.Name) + } else { + fmt.Printf("%v:数据库开启成功!服务器\n", sqlConfig.JobScheduling.Name) + } + } diff --git a/models/modelshr/genesis.go b/models/modelshr/genesis.go new file mode 100644 index 0000000..7909ee7 --- /dev/null +++ b/models/modelshr/genesis.go @@ -0,0 +1,62 @@ +package modelshr + +import ( + "appPlatform/overall" + "strings" +) + +// 轮询规则 +type Genesis struct { + Id int64 `gorm:"primaryKey;column:id" json:"id"` //type:int64 + TypeId int64 `gorm:"column:type_id" json:"typeid"` //type:int64 comment:类型 + PeriodId int64 `gorm:"column:period_id" json:"periodid"` //type:int64 comment:锚定工作段 + Rules int64 `gorm:"column:rules" json:"rules"` //type:int64 comment:锚定轮询规则起点 + StartTime int64 `gorm:"column:start_time" json:"starttime"` //type:int64 comment:锚定历史原点 + Time int64 `gorm:"column:time" json:"time"` //type:int64 + OrgId int64 `gorm:"column:orgId" json:"orgId"` //type:int64 行政组织Id +} + +func (Genesis *Genesis) TableName() string { + return "genesis" +} + +// 编辑内容 +func (cont *Genesis) EiteCont(whereMap interface{}, saveData interface{}) (err error) { + err = overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Updates(saveData).Error + return +} + +// 获取内容 +func (cont *Genesis) GetCont(whereMap interface{}, field ...string) (err error) { + gormDb := overall.CONSTANT_DB_HR.Model(&cont) + if len(field) > 0 { + fieldStr := strings.Join(field, ",") + gormDb = gormDb.Select(fieldStr) + } + gormDb = gormDb.Where(whereMap) + err = gormDb.First(&cont).Error + return +} + +// 根据条件获取总数 +func (cont *Genesis) CountCont(whereMap interface{}) (countId int64) { + overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Count(&countId) + return +} + +// 读取全部信息 +func (cont *Genesis) ContMap(whereMap interface{}, field ...string) (countAry []Genesis, err error) { + gormDb := overall.CONSTANT_DB_HR.Model(&cont) + if len(field) > 0 { + fieldStr := strings.Join(field, ",") + gormDb = gormDb.Select(fieldStr) + } + err = gormDb.Where(whereMap).Find(&countAry).Error + return +} + +// 删除内容 +func (cont *Genesis) DelCont(whereMap interface{}) (err error) { + err = overall.CONSTANT_DB_HR.Where(whereMap).Delete(&cont).Error + return +} diff --git a/models/modelshr/man_cont.go b/models/modelshr/man_cont.go index c2a700b..34e09c2 100644 --- a/models/modelshr/man_cont.go +++ b/models/modelshr/man_cont.go @@ -7,62 +7,64 @@ import ( ) type ManCont struct { - Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:ID"` - Number string `json:"number" gorm:"column:number;type:varchar(30) unsigned;not null;comment:员工工号"` - Name string `json:"name" gorm:"column:name;type:varchar(255) unsigned;default:'';not null;comment:姓名"` - Icon string `json:"icon" gorm:"column:icon;type:longtext;comment:头像"` - IconPhpto string `json:"iconphoto" gorm:"column:icon_photo;type:longtext;comment:头像"` - HireClass int `json:"hireclass" gorm:"column:hire_class;type:tinyint(1) unsigned;default:1;not null;comment:雇佣类型(1:雇佣入职;2:再入职;)"` - EmpType int `json:"emptype" gorm:"column:emp_type;type:tinyint(1) unsigned;default:1;not null;comment:用工关系(1:临时工 , 2:编外人员 ;3:实习&实习生;4:试用员工;5:待分配;6:待岗;7:临时调入;8:正式员工;9:长期病假;10:停薪留职;11:退休;12:辞职;13:辞退;14:离职)"` - Company int64 `json:"company" gorm:"column:company;type:bigint(20) unsigned;default:0;not null;comment:入职公司"` - MainDeparment int64 `json:"maindeparment" gorm:"column:maindeparment;type:bigint(20) unsigned;default:0;not null;comment:主部门"` - SunMainDeparment int64 `json:"sunmaindeparment" gorm:"column:sun_main_department;type:bigint(20) unsigned;default:0;not null;comment:二级主部门"` - Deparment string `json:"deparment" gorm:"column:deparment;type:text;comment:部门"` - AdminOrg int64 `json:"adminorg" gorm:"column:admin_org;type:bigint(20) unsigned;default:0;not null;comment:所属行政组织"` - TeamId int64 `json:"teamid" gorm:"column:teamid;type:bigint(20) unsigned;default:0;not null;comment:班组"` - Position int64 `json:"position" gorm:"column:position;type:bigint(20) unsigned;default:0;not null;comment:职位"` - JobClass int64 `json:"jobclass" gorm:"column:job_class;type:bigint(20) unsigned;default:2;not null;comment:职务分类"` - JobId int64 `json:"jobid" gorm:"column:job_id;type:bigint(20) unsigned;default:0;not null;comment:职务"` - JobLeve int64 `json:"jobleve" gorm:"column:job_leve;type:bigint(20) unsigned;default:0;not null;comment:职务等级"` - Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:写入时间"` - EiteTime int64 `json:"eitetime" gorm:"column:eite_time;type:bigint(20) unsigned;default:0;not null;comment:编辑时间"` - Wechat string `json:"wechat" gorm:"column:wechat;type:varchar(255) unsigned;default:'';not null;comment:微信UserId"` - WorkWechat string `json:"workwechat" gorm:"column:work_wechat;type:varchar(255) unsigned;default:'';not null;comment:企业微信UserId"` - State int `json:"state" gorm:"column:state;type:tinyint(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)` - Key int64 `json:"key" gorm:"column:key;type:bigint(50) unsigned;default:0;not null;comment:key"` - IsAdmin int `json:"isadmin" gorm:"column:is_admin;type:tinyint(1) unsigned;default:1;not null;comment:是否为管理员(1:不是;2:分公司;3:集团管理员;4:超级管` - Password string `json:"password" gorm:"column:password;type:varchar(255) unsigned;default:'';not null;comment:密码"` - Role string `json:"role" gorm:"column:role;type:longtext;comment:角色"` - Idcardno string `json:"idcardno" gorm:"column:idcardno;type:varchar(50) unsigned;default:'';not null;comment:身份证号"` - Passportno string `json:"passportno" gorm:"column:passportno;type:varchar(50) unsigned;default:'';not null;comment:护照号码"` - Globalroaming string `json:"globalroaming" gorm:"column:globalroaming;type:varchar(50) unsigned;default:'';not null;comment:国际区号"` - Mobilephone string `json:"mobilephone" gorm:"column:mobilephone;type:varchar(50) unsigned;default:'';not null;comment:手机号码"` - Email string `json:"email" gorm:"column:email;type:varchar(255) unsigned;default:'';not null;comment:电子邮件"` - Gender int `json:"gender" gorm:"column:gender;type:tinyint(1) unsigned;default:1;not null;comment:性别(1:男性;2:女性;3:中性)"` - Birthday int64 `json:"birthday" gorm:"column:birthday;type:bigint(20) unsigned;default:0;not null;comment:birthday"` - Myfolk string `json:"myfolk" gorm:"column:myfolk;type:varchar(50) unsigned;default:'';not null;comment:民族"` - Nativeplace string `json:"nativeplace" gorm:"column:nativeplace;type:varchar(255) unsigned;default:'';not null;comment:籍贯"` - Idcardstartdate int64 `json:"idcardstartdate" gorm:"column:idcardstartdate;type:bigint(20) unsigned;default:0;not null;comment:身份证有效期开始"` - Idcardenddate int64 `json:"idcardenddate" gorm:"column:idcardenddate;type:bigint(20) unsigned;default:0;not null;comment:身份证有效期结束"` - Idcardaddress string `json:"idcardaddress" gorm:"column:idcardaddress;type:varchar(255) unsigned;default:'';not null;comment:身份证地址"` - IdcardIssued string `json:"idcardIssued" gorm:"column:idcardIssued;type:varchar(255) unsigned;default:'';not null;comment:身份证签发机关"` - Health int `json:"health" gorm:"column:health;type:tinyint(1) unsigned;default:1;not null;comment:健康状况(1:良好;2:一般;3:较弱,4:有生理缺陷;5:残废)"` - Maritalstatus int `json:"maritalstatus" gorm:"column:maritalstatus;type:tinyint(1) unsigned;default:1;not null;comment:婚姻状况(1:未婚;2:已婚;3:丧偶;4:离异)"` - Internaltelephone string `json:"internaltelephone" gorm:"column:internaltelephone;type:varchar(255) unsigned;default:'';not null;comment:内线电话"` - Currentresidence string `json:"currentresidence" gorm:"column:currentresidence;type:varchar(255) unsigned;default:'';not null;comment:现居住地址"` - Constellation int `json:"constellationing" gorm:"column:constellationing;type:tinyint(3) unsigned;comment:星座(1:白羊座;2:金牛座;3:双子座;4:巨蟹座;5:狮子座;6:处女座;7:天枰座;8:天蝎座;9:射手座;10:摩羯座;11:水瓶座;12:双鱼座)"` - Isdoubleworker int `json:"isdoubleworker" gorm:"column:isdoubleworker;type:tinyint(1) unsigned;default:1;comment:是否双职工(1:是;2:否)"` - Isveterans int `json:"isveterans" gorm:"column:isveterans;type:tinyint(1) unsigned;default:1;comment:是否为退役军人(1:是;2:否)"` - Veteransnumber string `json:"veteransnumber" gorm:"column:veteransnumber;type:varchar(255) unsigned;default:'';comment:退役证编号"` - Jobstartdate int64 `json:"jobstartdate" gorm:"column:jobstartdate;type:bigint(20) unsigned;default:0;comment:参加工作日期"` - Entrydate int64 `json:"entrydate" gorm:"column:entrydate;type:bigint(20) unsigned;default:0;comment:入职日期"` - Probationperiod int `json:"probationperiod" gorm:"column:probationperiod;type:int(5) unsigned;default:0;comment:试用期"` - Planformaldate int64 `json:"planformaldate" gorm:"column:planformaldate;type:bigint(20) unsigned;default:0;comment:预计转正日期"` - PoliticalOutlook int `json:"politicaloutlook" gorm:"column:political_outlook;type:tinyint(3) unsigned;default:1;comment:政治面貌(1:群众;2:无党派;3:台盟会员;4:九三社员;5:致公党员;6:农工党员;7:民进会员;8:民建会员;9:民盟盟员;10:民革会员,11:共青团员;12:预备党员;13:中共党员)"` - CareerPlanning string `json:"career_planning" gorm:"column:career_planning;type:longtext;default:'';not null;comment:职业生涯规划"` - HelpObtained string `json:"help_obtained" gorm:"column:help_obtained;type:longtext;default:'';not null;comment:个人期望从组织获得的帮助"` - Hobby string `json:"hobby" gorm:"column:hobby;type:text;default:'';not null;comment:爱好"` - PersonInCharge int `json:"personInCharge" gorm:"column:person_in_charge;type:int(10) unsigned;default:1;comment:负责人(1:是;2:否)"` + Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:ID"` + Number string `json:"number" gorm:"column:number;type:varchar(30) unsigned;not null;comment:员工工号"` + Name string `json:"name" gorm:"column:name;type:varchar(255) unsigned;default:'';not null;comment:姓名"` + Icon string `json:"icon" gorm:"column:icon;type:longtext;comment:头像"` + IconPhpto string `json:"iconphoto" gorm:"column:icon_photo;type:longtext;comment:头像"` + HireClass int `json:"hireclass" gorm:"column:hire_class;type:tinyint(1) unsigned;default:1;not null;comment:雇佣类型(1:雇佣入职;2:再入职;)"` + EmpType int `json:"emptype" gorm:"column:emp_type;type:tinyint(1) unsigned;default:1;not null;comment:用工关系(1:临时工 , 2:编外人员 ;3:实习&实习生;4:试用员工;5:待分配;6:待岗;7:临时调入;8:正式员工;9:长期病假;10:停薪留职;11:退休;12:辞职;13:辞退;14:离职)"` + Company int64 `json:"company" gorm:"column:company;type:bigint(20) unsigned;default:0;not null;comment:入职公司"` + MainDeparment int64 `json:"maindeparment" gorm:"column:maindeparment;type:bigint(20) unsigned;default:0;not null;comment:主部门"` + SunMainDeparment int64 `json:"sunmaindeparment" gorm:"column:sun_main_department;type:bigint(20) unsigned;default:0;not null;comment:二级主部门"` + Deparment string `json:"deparment" gorm:"column:deparment;type:text;comment:部门"` + AdminOrg int64 `json:"adminorg" gorm:"column:admin_org;type:bigint(20) unsigned;default:0;not null;comment:所属行政组织"` + TeamId int64 `json:"teamid" gorm:"column:teamid;type:bigint(20) unsigned;default:0;not null;comment:班组"` + Position int64 `json:"position" gorm:"column:position;type:bigint(20) unsigned;default:0;not null;comment:职位"` + JobClass int64 `json:"jobclass" gorm:"column:job_class;type:bigint(20) unsigned;default:2;not null;comment:职务分类"` + JobId int64 `json:"jobid" gorm:"column:job_id;type:bigint(20) unsigned;default:0;not null;comment:职务"` + JobLeve int64 `json:"jobleve" gorm:"column:job_leve;type:bigint(20) unsigned;default:0;not null;comment:职务等级"` + Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:写入时间"` + EiteTime int64 `json:"eitetime" gorm:"column:eite_time;type:bigint(20) unsigned;default:0;not null;comment:编辑时间"` + Wechat string `json:"wechat" gorm:"column:wechat;type:varchar(255) unsigned;default:'';not null;comment:微信UserId"` + WorkWechat string `json:"workwechat" gorm:"column:work_wechat;type:varchar(255) unsigned;default:'';not null;comment:企业微信UserId"` + State int `json:"state" gorm:"column:state;type:tinyint(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)` + Key int64 `json:"key" gorm:"column:key;type:bigint(50) unsigned;default:0;not null;comment:key"` + IsAdmin int `json:"isadmin" gorm:"column:is_admin;type:tinyint(1) unsigned;default:1;not null;comment:是否为管理员(1:不是;2:分公司;3:集团管理员;4:超级管` + Password string `json:"password" gorm:"column:password;type:varchar(255) unsigned;default:'';not null;comment:密码"` + Role string `json:"role" gorm:"column:role;type:longtext;comment:角色"` + Idcardno string `json:"idcardno" gorm:"column:idcardno;type:varchar(50) unsigned;default:'';not null;comment:身份证号"` + Passportno string `json:"passportno" gorm:"column:passportno;type:varchar(50) unsigned;default:'';not null;comment:护照号码"` + Globalroaming string `json:"globalroaming" gorm:"column:globalroaming;type:varchar(50) unsigned;default:'';not null;comment:国际区号"` + Mobilephone string `json:"mobilephone" gorm:"column:mobilephone;type:varchar(50) unsigned;default:'';not null;comment:手机号码"` + Email string `json:"email" gorm:"column:email;type:varchar(255) unsigned;default:'';not null;comment:电子邮件"` + Gender int `json:"gender" gorm:"column:gender;type:tinyint(1) unsigned;default:1;not null;comment:性别(1:男性;2:女性;3:中性)"` + Birthday int64 `json:"birthday" gorm:"column:birthday;type:bigint(20) unsigned;default:0;not null;comment:birthday"` + Myfolk string `json:"myfolk" gorm:"column:myfolk;type:varchar(50) unsigned;default:'';not null;comment:民族"` + Nativeplace string `json:"nativeplace" gorm:"column:nativeplace;type:varchar(255) unsigned;default:'';not null;comment:籍贯"` + Idcardstartdate int64 `json:"idcardstartdate" gorm:"column:idcardstartdate;type:bigint(20) unsigned;default:0;not null;comment:身份证有效期开始"` + Idcardenddate int64 `json:"idcardenddate" gorm:"column:idcardenddate;type:bigint(20) unsigned;default:0;not null;comment:身份证有效期结束"` + Idcardaddress string `json:"idcardaddress" gorm:"column:idcardaddress;type:varchar(255) unsigned;default:'';not null;comment:身份证地址"` + IdcardIssued string `json:"idcardIssued" gorm:"column:idcardIssued;type:varchar(255) unsigned;default:'';not null;comment:身份证签发机关"` + Health int `json:"health" gorm:"column:health;type:tinyint(1) unsigned;default:1;not null;comment:健康状况(1:良好;2:一般;3:较弱,4:有生理缺陷;5:残废)"` + Maritalstatus int `json:"maritalstatus" gorm:"column:maritalstatus;type:tinyint(1) unsigned;default:1;not null;comment:婚姻状况(1:未婚;2:已婚;3:丧偶;4:离异)"` + Internaltelephone string `json:"internaltelephone" gorm:"column:internaltelephone;type:varchar(255) unsigned;default:'';not null;comment:内线电话"` + Currentresidence string `json:"currentresidence" gorm:"column:currentresidence;type:varchar(255) unsigned;default:'';not null;comment:现居住地址"` + Constellation int `json:"constellationing" gorm:"column:constellationing;type:tinyint(3) unsigned;comment:星座(1:白羊座;2:金牛座;3:双子座;4:巨蟹座;5:狮子座;6:处女座;7:天枰座;8:天蝎座;9:射手座;10:摩羯座;11:水瓶座;12:双鱼座)"` + Isdoubleworker int `json:"isdoubleworker" gorm:"column:isdoubleworker;type:tinyint(1) unsigned;default:1;comment:是否双职工(1:是;2:否)"` + Isveterans int `json:"isveterans" gorm:"column:isveterans;type:tinyint(1) unsigned;default:1;comment:是否为退役军人(1:是;2:否)"` + Veteransnumber string `json:"veteransnumber" gorm:"column:veteransnumber;type:varchar(255) unsigned;default:'';comment:退役证编号"` + Jobstartdate int64 `json:"jobstartdate" gorm:"column:jobstartdate;type:bigint(20) unsigned;default:0;comment:参加工作日期"` + Entrydate int64 `json:"entrydate" gorm:"column:entrydate;type:bigint(20) unsigned;default:0;comment:入职日期"` + Probationperiod int `json:"probationperiod" gorm:"column:probationperiod;type:int(5) unsigned;default:0;comment:试用期"` + Planformaldate int64 `json:"planformaldate" gorm:"column:planformaldate;type:bigint(20) unsigned;default:0;comment:预计转正日期"` + PoliticalOutlook int `json:"politicaloutlook" gorm:"column:political_outlook;type:tinyint(3) unsigned;default:1;comment:政治面貌(1:群众;2:无党派;3:台盟会员;4:九三社员;5:致公党员;6:农工党员;7:民进会员;8:民建会员;9:民盟盟员;10:民革会员,11:共青团员;12:预备党员;13:中共党员)"` + CareerPlanning string `json:"career_planning" gorm:"column:career_planning;type:longtext;default:'';not null;comment:职业生涯规划"` + HelpObtained string `json:"help_obtained" gorm:"column:help_obtained;type:longtext;default:'';not null;comment:个人期望从组织获得的帮助"` + Hobby string `json:"hobby" gorm:"column:hobby;type:text;default:'';not null;comment:爱好"` + PersonInCharge int `json:"personInCharge" gorm:"column:person_in_charge;type:int(10) unsigned;default:1;comment:负责人(1:是;2:否)"` + ResponsibleDepartment string `json:"responsibledepartment" gorm:"column:responsible_department;type:longtext;default:'';not null;comment:负责的行政组织"` + ResponsibleDepartmentJson string `json:"responsibledepartmentjson" gorm:"column:responsible_department_json;type:longtext;default:'';not null;comment:负责的行政组织json"` } func (ManCont *ManCont) TableName() string { diff --git a/models/modelshr/polling_rules.go b/models/modelshr/polling_rules.go new file mode 100644 index 0000000..10ab33e --- /dev/null +++ b/models/modelshr/polling_rules.go @@ -0,0 +1,62 @@ +package modelshr + +import ( + "appPlatform/overall" + "strings" +) + +// 轮询规则 +type PollingRules struct { + Id int64 `gorm:"primaryKey;column:id" json:"id"` //type:int64 comment: version:2022-11-16 09:16 + Teamid int64 `gorm:"column:teamid" json:"teamid"` //type:int64 comment:班组;规则 version:2022-11-16 09:16 + State int `gorm:"column:state" json:"state"` //type:*int comment:状态(1:启用;2:禁用;3:删除);状态(1:启用;2:禁用;3:删除) version:2022-11-16 09:16 + Time int64 `gorm:"column:time" json:"time"` //type:int64 comment:时间;时间 version:2022-11-16 09:16 + Sort int `gorm:"column:sort" json:"sort"` //type:*int comment:排序 version:2022-11-16 09:16 + TypeId int64 `gorm:"column:type_id" json:"typeid"` //type:int64 comment:类型 + TeamName string `gorm:"column:teamname" json:"teamname"` +} + +func (PollingRules *PollingRules) TableName() string { + return "polling_rules" +} + +// 编辑内容 +func (cont *PollingRules) EiteCont(whereMap interface{}, saveData interface{}) (err error) { + err = overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Updates(saveData).Error + return +} + +// 获取内容 +func (cont *PollingRules) GetCont(whereMap interface{}, field ...string) (err error) { + gormDb := overall.CONSTANT_DB_HR.Model(&cont) + if len(field) > 0 { + fieldStr := strings.Join(field, ",") + gormDb = gormDb.Select(fieldStr) + } + gormDb = gormDb.Where(whereMap) + err = gormDb.First(&cont).Error + return +} + +// 根据条件获取总数 +func (cont *PollingRules) CountCont(whereMap interface{}) (countId int64) { + overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Count(&countId) + return +} + +// 读取全部信息 +func (cont *PollingRules) ContMap(whereMap interface{}, field ...string) (countAry []PollingRules, err error) { + gormDb := overall.CONSTANT_DB_HR.Model(&cont) + if len(field) > 0 { + fieldStr := strings.Join(field, ",") + gormDb = gormDb.Select(fieldStr) + } + err = gormDb.Where(whereMap).Find(&countAry).Error + return +} + +// 删除内容 +func (cont *PollingRules) DelCont(whereMap interface{}) (err error) { + err = overall.CONSTANT_DB_HR.Where(whereMap).Delete(&cont).Error + return +} diff --git a/models/modelshr/work_time_type.go b/models/modelshr/work_time_type.go new file mode 100644 index 0000000..d08c8bb --- /dev/null +++ b/models/modelshr/work_time_type.go @@ -0,0 +1,59 @@ +package modelshr + +import ( + "appPlatform/overall" + "strings" +) + +type WorkTimeType struct { + Id int64 `gorm:"primaryKey;column:id" json:"id"` //type:int64 comment: version:2022-11-13 16:57 + Name string `gorm:"column:name" json:"name"` //type:string comment:类型名称 version:2022-11-13 16:57 + State int `gorm:"column:state" json:"state"` //type:*int comment:类型:(1:启用;2:禁用;3:删除) version:2022-11-13 16:57 + Time int64 `gorm:"column:time" json:"time"` //type:int64 comment: version:2022-11-13 16:57 + Rule string `gorm:"column:rule" json:"rule"` //type:string comment:规则 +} + +func (WorkTimeType *WorkTimeType) TableName() string { + return "work_time_type" +} + +// 编辑内容 +func (cont *WorkTimeType) EiteCont(whereMap interface{}, saveData interface{}) (err error) { + err = overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Updates(saveData).Error + return +} + +// 获取内容 +func (cont *WorkTimeType) GetCont(whereMap interface{}, field ...string) (err error) { + gormDb := overall.CONSTANT_DB_HR.Model(&cont) + if len(field) > 0 { + fieldStr := strings.Join(field, ",") + gormDb = gormDb.Select(fieldStr) + } + gormDb = gormDb.Where(whereMap) + err = gormDb.First(&cont).Error + return +} + +// 根据条件获取总数 +func (cont *WorkTimeType) CountCont(whereMap interface{}) (countId int64) { + overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Count(&countId) + return +} + +// 读取全部信息 +func (cont *WorkTimeType) ContMap(whereMap interface{}, field ...string) (countAry []WorkTimeType, err error) { + gormDb := overall.CONSTANT_DB_HR.Model(&cont) + if len(field) > 0 { + fieldStr := strings.Join(field, ",") + gormDb = gormDb.Select(fieldStr) + } + err = gormDb.Where(whereMap).Find(&countAry).Error + return +} + +// 删除内容 +func (cont *WorkTimeType) DelCont(whereMap interface{}) (err error) { + err = overall.CONSTANT_DB_HR.Where(whereMap).Delete(&cont).Error + return +} diff --git a/models/modelshr/working_time_period.go b/models/modelshr/working_time_period.go new file mode 100644 index 0000000..0ee2c3c --- /dev/null +++ b/models/modelshr/working_time_period.go @@ -0,0 +1,63 @@ +package modelshr + +import ( + "appPlatform/overall" + "strings" +) + +// 工作时间段 +type WorkingTimePeriod struct { + Id int64 `gorm:"primaryKey;column:id" json:"id"` //type:int64 comment: version:2022-11-13 16:59 + Name string `gorm:"column:name" json:"name"` //type:string comment:工作时间段名称 version:2022-11-13 16:59 + Time int64 `gorm:"column:time" json:"time"` //type:int64 comment:编辑时间;0 version:2022-11-13 16:59 + TypeId int64 `gorm:"column:type_id" json:"typeid"` //type:int64 comment:类型 version:2022-11-13 16:59 + StartTime string `gorm:"column:start_time" json:"starttime"` //type:string comment:开始时间 version:2022-11-13 16:59 + EndTime string `gorm:"column:end_time" json:"endtime"` //type:string comment:结束时间 version:2022-11-13 16:59 + State int `gorm:"column:state" json:"state"` + Sort int `gorm:"column:sort" json:"sort"` //type:*int comment:排序 +} + +func (WorkingTimePeriod *WorkingTimePeriod) TableName() string { + return "working_time_period" +} + +// 编辑内容 +func (cont *WorkingTimePeriod) EiteCont(whereMap interface{}, saveData interface{}) (err error) { + err = overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Updates(saveData).Error + return +} + +// 获取内容 +func (cont *WorkingTimePeriod) GetCont(whereMap interface{}, field ...string) (err error) { + gormDb := overall.CONSTANT_DB_HR.Model(&cont) + if len(field) > 0 { + fieldStr := strings.Join(field, ",") + gormDb = gormDb.Select(fieldStr) + } + gormDb = gormDb.Where(whereMap) + err = gormDb.First(&cont).Error + return +} + +// 根据条件获取总数 +func (cont *WorkingTimePeriod) CountCont(whereMap interface{}) (countId int64) { + overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Count(&countId) + return +} + +// 读取全部信息 +func (cont *WorkingTimePeriod) ContMap(whereMap interface{}, field ...string) (countAry []WorkingTimePeriod, err error) { + gormDb := overall.CONSTANT_DB_HR.Model(&cont) + if len(field) > 0 { + fieldStr := strings.Join(field, ",") + gormDb = gormDb.Select(fieldStr) + } + err = gormDb.Where(whereMap).Find(&countAry).Error + return +} + +// 删除内容 +func (cont *WorkingTimePeriod) DelCont(whereMap interface{}) (err error) { + err = overall.CONSTANT_DB_HR.Where(whereMap).Delete(&cont).Error + return +} diff --git a/models/teamlog/teamslog.go b/models/teamlog/teamslog.go new file mode 100644 index 0000000..24d29f1 --- /dev/null +++ b/models/teamlog/teamslog.go @@ -0,0 +1,70 @@ +package teamlog + +import ( + "appPlatform/overall" + "strings" +) + +// 排班记录 +type TeamsLog struct { + Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;index"` + OrgId int64 `json:"orgId" gorm:"column:orgId;type:bigint(20) unsigned;default:0;not null;comment:班组ID"` + TeamsTime int64 `json:"teamsTime" gorm:"column:teamsTime;type:bigint(20) unsigned;default:0;not null;comment:日期"` + IsmId int64 `json:"ismId" gorm:"column:ismId;type:bigint(20) unsigned;default:0;not null;comment:制度ID"` + RankId int64 `json:"rankId" gorm:"column:rankId;type:bigint(20) unsigned;default:0;not null;comment:班次"` + RulesId int64 `json:"rulesId" gorm:"column:rulesId;type:bigint(20) unsigned;default:0;not null;comment:轮询规则Id"` + TeamsId int64 `json:"teamsId" gorm:"column:teamsId;type:bigint(20) unsigned;default:0;not null;comment:班组id"` + Days int `json:"days" gorm:"column:days;type:int(4) unsigned;default:0;not null;comment:日"` + Months int `json:"months" gorm:"column:months;type:int(4) unsigned;default:0;not null;comment:月"` + Years int `json:"years" gorm:"column:years;type:int(6) unsigned;default:0;not null;comment:年"` + Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:编辑时间"` + IsmName string `json:"ismName" gorm:"column:ismName;type:varchar(255);comment:制度名称"` + RankName string `json:"rankName" gorm:"column:rankName;type:varchar(255);comment:班次名称"` + RulesName string `json:"rulesName" gorm:"column:rulesName;type:varchar(255);comment:轮询班组"` + Sort int `json:"sort" gorm:"column:sort;type:int(6) unsigned;default:0;not null;comment:轮询排序"` +} + +func (TeamsLog *TeamsLog) TableName() string { + return "teamsLog" +} + +// 编辑内容 +func (cont *TeamsLog) EiteCont(whereMap interface{}, saveData interface{}) (err error) { + err = overall.CONSTANT_DB_TeamsLog.Model(&cont).Where(whereMap).Updates(saveData).Error + return +} + +// 获取内容 +func (cont *TeamsLog) GetCont(whereMap interface{}, field ...string) (err error) { + gormDb := overall.CONSTANT_DB_TeamsLog.Model(&cont) + if len(field) > 0 { + fieldStr := strings.Join(field, ",") + gormDb = gormDb.Select(fieldStr) + } + gormDb = gormDb.Where(whereMap) + err = gormDb.First(&cont).Error + return +} + +// 根据条件获取总数 +func (cont *TeamsLog) CountCont(whereMap interface{}) (countId int64) { + overall.CONSTANT_DB_TeamsLog.Model(&cont).Where(whereMap).Count(&countId) + return +} + +// 读取全部信息 +func (cont *TeamsLog) ContMap(whereMap interface{}, field ...string) (countAry []TeamsLog, err error) { + gormDb := overall.CONSTANT_DB_TeamsLog.Model(&cont) + if len(field) > 0 { + fieldStr := strings.Join(field, ",") + gormDb = gormDb.Select(fieldStr) + } + err = gormDb.Where(whereMap).Find(&countAry).Error + return +} + +// 删除内容 +func (cont *TeamsLog) DelCont(whereMap interface{}) (err error) { + err = overall.CONSTANT_DB_TeamsLog.Where(whereMap).Delete(&cont).Error + return +} diff --git a/.gitignore b/overall/.gitignore similarity index 100% rename from .gitignore rename to overall/.gitignore diff --git a/overall/appConfig.go b/overall/appConfig.go index df25a3c..31a9e38 100644 --- a/overall/appConfig.go +++ b/overall/appConfig.go @@ -51,6 +51,7 @@ var ( CONSTANT_DB_Tidb *gorm.DB //私有云数据库 CONSTANT_DB_Color *gorm.DB //私有云数据库 CONSTANT_DB_HrInside *gorm.DB //内网HR + CONSTANT_DB_TeamsLog *gorm.DB //生产排班记录 //Redis CONSTANT_REDIS0 *redis.Client diff --git a/overall/publicmethod/technique.go b/overall/publicmethod/technique.go index f4b0c3d..fd50754 100644 --- a/overall/publicmethod/technique.go +++ b/overall/publicmethod/technique.go @@ -1964,10 +1964,12 @@ func (d *DateTimeTotimes) BaisStrToTime(dateTime string) { default: } + // fmt.Printf("dateTime:%v---1--->%v\n", dateTime, len(dateTime)) orgTime, orgTimeErr := DateToTimeStamp(fmt.Sprintf("%v-01-01 12:00:00", dateTime)) if orgTimeErr { d.AllTime = orgTime + d.AllTimeString = dateTime d.Years = strconv.FormatInt(ComputingTime(orgTime, 1), 10) d.Quarter = strconv.FormatInt(ComputingTime(orgTime, 2), 10) d.Months = strconv.FormatInt(ComputingTime(orgTime, 3), 10) @@ -2044,6 +2046,7 @@ func (d *DateTimeTotimes) BaisStrToTime(dateTime string) { } } } + d.AllTimeString = UnixTimeToDay(d.AllTime, 11) } } @@ -2962,3 +2965,45 @@ func DatabaseIntToString(typeId int64) string { } return "mysql" } + +/* +* +@ 作者: 秦东 +@ 时间: 2025-01-16 08:35:07 +@ 功能: 泛型去重 +*/ +func RemoveDuplicate[T GenericityVariable](ary []T) []T { + m := make(map[T]bool) + uniqueNumbers := []T{} + for _, v := range ary { + if !m[v] { + m[v] = true + uniqueNumbers = append(uniqueNumbers, v) + } + } + return uniqueNumbers +} + +// 获得月份最后一天,最后一秒 +func GetDaysInMonth(nextYear int, nextMonth int) DateTimeTotimes { + firstDayOfNextMonth := time.Date(nextYear, time.Month(nextMonth), 1, 0, 0, 0, 0, time.UTC) + lastDayOfThisMonth := firstDayOfNextMonth.Add(-1 * time.Second) + //fmt.Println("本月最后一天时间:", lastDayOfThisMonth) + dates := lastDayOfThisMonth.Format("2006-01-02 15:04:05") + var creTimeAll DateTimeTotimes + creTimeAll.BaisStrToTime(dates) + return creTimeAll +} + +// 获取指定时间的上个月的开始和结束时间 +func GetLastMonthStartEnd(dayTime string) (int64, int64) { + // dataTypeAll := "2006-01-02" + // dayTime = fmt.Sprintf("%v-%v", dayTime, "01") + now := StringToTimeIng("d", dayTime) + // now := time.Now() + lastMonthFirstDay := now.AddDate(0, -1, -now.Day()+1) + lastMonthStart := time.Date(lastMonthFirstDay.Year(), lastMonthFirstDay.Month(), lastMonthFirstDay.Day(), 0, 0, 0, 0, now.Location()).Unix() + lastMonthEndDay := lastMonthFirstDay.AddDate(0, 1, -1) + lastMonthEnd := time.Date(lastMonthEndDay.Year(), lastMonthEndDay.Month(), lastMonthEndDay.Day(), 23, 59, 59, 0, now.Location()).Unix() + return lastMonthStart, lastMonthEnd +} diff --git a/overall/publicmethod/type.go b/overall/publicmethod/type.go index 50fdef6..f61ca3e 100644 --- a/overall/publicmethod/type.go +++ b/overall/publicmethod/type.go @@ -273,15 +273,16 @@ type EvaluPross struct { // 时间转换 type DateTimeTotimes struct { - Years string `json:"years"` - Quarter string `json:"quarter"` - Months string `json:"months"` - Week string `json:"week"` - Days string `json:"days"` - Hours string `json:"hours"` - Minutes string `json:"minutes"` - Second string `json:"second"` - AllTime int64 `json:"alltime"` + Years string `json:"years"` + Quarter string `json:"quarter"` + Months string `json:"months"` + Week string `json:"week"` + Days string `json:"days"` + Hours string `json:"hours"` + Minutes string `json:"minutes"` + Second string `json:"second"` + AllTime int64 `json:"alltime"` + AllTimeString string `json:"alltimeStr"` } // 获取行政组织所有上级