diff --git a/api/version1/personnelapi/controll.go b/api/version1/personnelapi/controll.go index 0c5c21d..35bca08 100644 --- a/api/version1/personnelapi/controll.go +++ b/api/version1/personnelapi/controll.go @@ -356,6 +356,8 @@ func ducationToInt(emp string) int { return 6 case "专科": return 7 + case "大专": + return 7 case "大学专科": return 7 case "函授本科": @@ -447,17 +449,17 @@ func JoinJobChanel(hir string) int { // 学历类型 func EducationTypeStr(level string) int { switch level { - case "全日制统招": + case "全日制统招学历": return 1 - case "成人高考": + case "成人高考学历": return 2 - case "自学考试": + case "自学考试学历": return 3 - case "开放大学": + case "开放大学学历": return 4 - case "网络教育": + case "网络教育学历": return 5 - case "函授": + case "函授学历": return 6 default: return 0 @@ -529,3 +531,31 @@ func RewPunLevelClassStr(emp string) int { return 0 } } +func SchoolTypeStr(level string) int { + var typeName int + switch level { + case "私立中学": + typeName = 1 + case "公立中学": + typeName = 2 + case "高职院校": + typeName = 3 + case "民办专科院校": + typeName = 4 + case "公办专科院校": + typeName = 5 + case "民办本科院校": + typeName = 6 + case "公办本科院校": + typeName = 7 + case "”211“工程院校": + typeName = 8 + case "”985“工程院校": + typeName = 8 + case "双一流院校": + typeName = 10 + default: + typeName = 0 + } + return typeName +} diff --git a/api/version1/personnelapi/kingdeenew.go b/api/version1/personnelapi/kingdeenew.go index 05539fd..7bebf88 100644 --- a/api/version1/personnelapi/kingdeenew.go +++ b/api/version1/personnelapi/kingdeenew.go @@ -32,26 +32,33 @@ func (s *StaffApi) NewKingdee(c *gin.Context) { requesJson, _ := json.Marshal(requestData) saveKingDee.Cont = string(requesJson) saveKingDee.Time = time.Now().Unix() - overallhandle.WriteLog("i", "KingDee对接数据!", saveKingDee) + + saveKingDeeJson, jsonErr := json.Marshal(saveKingDee) + + overallhandle.WriteLog("i", "KingDee对接数据!", jsonErr, string(saveKingDeeJson)) // kingdeeErr := overall.CONSTANT_DB_HR.Create(&saveKingDee).Error // overallhandle.WriteLog("w", "KingDee写入数据库状态!", kingdeeErr) // if requestData.Number != "200019" && requestData.Number != "200008" { var manContent models.PersonArchives manErr := manContent.GetCont(map[string]interface{}{"`number`": requestData.Number}) + // manJson, _ := json.Marshal(manContent) + // fmt.Printf("编辑操作---》%v\n---》%v\n", requestData.Number, string(manJson)) if manErr == nil { + //已经存在!进行变动操作 manErr = eidtAddManContJinDie(manContent, requestData) - overallhandle.WriteLog("i", "已经存在!进行变动操作!", saveKingDee) + overallhandle.WriteLog("i", "已经存在!进行变动操作!", string(saveKingDeeJson)) } else { + // fmt.Printf("新增操作---》%v\n", manContent.IsShowTrue) //不存在!进行新增操作 var oldSchool models.WorkMan oldSchool.GetCont(map[string]interface{}{"wm_number": requestData.Number}) manErr = newAddManContJinDie(oldSchool, requestData) - overallhandle.WriteLog("i", "不存在!进行新增操作!", manErr, saveKingDee) + overallhandle.WriteLog("i", "不存在!进行新增操作!", manErr, string(saveKingDeeJson)) } if manErr != nil { overallhandle.Result(104, manErr, c) - overallhandle.WriteLog("e", "数据处理失败!", manErr, saveKingDee) + overallhandle.WriteLog("e", "数据处理失败!", manErr, string(saveKingDeeJson)) return } overallhandle.WriteLog("t", "执行行人员信息对接对照结束!") @@ -132,132 +139,135 @@ func eidtAddManContJinDie(perArcInfo models.PersonArchives, manCont addKingdeePe //人员变更记录 var manChangeRecord models.PersonnelChangeRecord changeRecordTrue := false - //公司 - if manCont.Company != "" { - var orgCompany models.AdministrativeOrganization - orgErr := orgCompany.GetCont(map[string]interface{}{"kingdeeid": manCont.Company}, "`id`") - if orgErr == nil { - if orgCompany.Id != perArcInfo.Company { - eidtManCont["`company`"] = orgCompany.Id - changeRecordTrue = true + if perArcInfo.IsShowTrue != 1 { + //公司 + if manCont.Company != "" { + var orgCompany models.AdministrativeOrganization + orgErr := orgCompany.GetCont(map[string]interface{}{"kingdeeid": manCont.Company}, "`id`") + if orgErr == nil { + if orgCompany.Id != perArcInfo.Company { + eidtManCont["`company`"] = orgCompany.Id + changeRecordTrue = true + } + manChangeRecord.Company = orgCompany.Id } - manChangeRecord.Company = orgCompany.Id } - } - //主部门 - if manCont.MainDepartment != "" { - var orgMainDepart models.AdministrativeOrganization - orgErr := orgMainDepart.GetCont(map[string]interface{}{"kingdeeid": manCont.MainDepartment}, "`id`") - if orgErr == nil { + //主部门 + if manCont.MainDepartment != "" { + var orgMainDepart models.AdministrativeOrganization + orgErr := orgMainDepart.GetCont(map[string]interface{}{"kingdeeid": manCont.MainDepartment}, "`id`") + if orgErr == nil { - _, companyId, departmentId, sunDepartId, _ := overallhandle.GetOrgStructure(orgMainDepart.Id) - // if manMainCont.Company == 0 { - // manMainCont.Company = companyId - // } + _, companyId, departmentId, sunDepartId, _ := overallhandle.GetOrgStructure(orgMainDepart.Id) + // if manMainCont.Company == 0 { + // manMainCont.Company = companyId + // } - // manMainCont.MainDeparment = departmentId - // manMainCont.SunMainDeparment = sunDepartId - // manMainCont.AdminOrg = orgMainDepart.Id + // manMainCont.MainDeparment = departmentId + // manMainCont.SunMainDeparment = sunDepartId + // manMainCont.AdminOrg = orgMainDepart.Id - if departmentId != perArcInfo.MainDeparment { - eidtManCont["`company`"] = companyId - eidtManCont["`maindeparment`"] = departmentId - eidtManCont["`sun_main_deparment`"] = sunDepartId - eidtManCont["`admin_org`"] = orgMainDepart.Id - changeRecordTrue = true + if departmentId != perArcInfo.MainDeparment { + eidtManCont["`company`"] = companyId + eidtManCont["`maindeparment`"] = departmentId + eidtManCont["`sun_main_deparment`"] = sunDepartId + eidtManCont["`admin_org`"] = orgMainDepart.Id + changeRecordTrue = true + } + manChangeRecord.Company = companyId + manChangeRecord.MainDepartment = departmentId + // manChangeRecord.SunMainDeparment = sunDepartId + manChangeRecord.Adminorg = orgMainDepart.Id } - manChangeRecord.Company = companyId - manChangeRecord.MainDepartment = departmentId - // manChangeRecord.SunMainDeparment = sunDepartId - manChangeRecord.Adminorg = orgMainDepart.Id } - } - //部门 - if len(manCont.Department) > 0 { - var departId []string + //部门 + if len(manCont.Department) > 0 { + var departId []string - if manCont.MainDepartment != "" { - if overallhandle.IsInTrue[string](manCont.MainDepartment, manCont.Department) == false { - manCont.Department = append(manCont.Department, manCont.MainDepartment) + if manCont.MainDepartment != "" { + if overallhandle.IsInTrue[string](manCont.MainDepartment, manCont.Department) == false { + manCont.Department = append(manCont.Department, manCont.MainDepartment) + } } - } - for _, dv := range manCont.Department { - var orgMainDepartAry models.AdministrativeOrganization - orgErr := orgMainDepartAry.GetCont(map[string]interface{}{"kingdeeid": dv}, "`id`") - if orgErr == nil { - orgIdStr := strconv.FormatInt(orgMainDepartAry.Id, 10) - if overallhandle.StringIsInMap(orgIdStr, departId) == false { - departId = append(departId, orgIdStr) + for _, dv := range manCont.Department { + var orgMainDepartAry models.AdministrativeOrganization + orgErr := orgMainDepartAry.GetCont(map[string]interface{}{"kingdeeid": dv}, "`id`") + if orgErr == nil { + orgIdStr := strconv.FormatInt(orgMainDepartAry.Id, 10) + if overallhandle.StringIsInMap(orgIdStr, departId) == false { + departId = append(departId, orgIdStr) + } } } - } - oldDepart := strings.Split(perArcInfo.Deparment, ",") - chaJiDepart := overallhandle.DifferenceSet[string](departId, oldDepart) - if len(chaJiDepart) > 0 { - departIdStr := strings.Join(departId, ",") - eidtManCont["`deparment`"] = departIdStr - manChangeRecord.Department = departIdStr - changeRecordTrue = true - } - - } - //行政组织 - // if manCont.AdminOrg != "" { - // var orgMainDepartAdmin models.AdministrativeOrganization - // orgErr := orgMainDepartAdmin.GetCont(map[string]interface{}{"kingdeeid": manCont.AdminOrg}, "`id`") - // if orgErr == nil { - // if orgMainDepartAdmin.Id != perArcInfo.AdminOrg { - // eidtManCont["`admin_org`"] = orgMainDepartAdmin.Id - // changeRecordTrue = true - // } - // manChangeRecord.Adminorg = orgMainDepartAdmin.Id - // } - // } - //职位 - if manCont.Position != "" { - var positionCont models.Position - positErr := positionCont.GetCont(map[string]interface{}{`kingdeeid`: manCont.Position}, "`id`") - if positErr == nil { - if positionCont.Id != perArcInfo.Position { - eidtManCont["`position`"] = positionCont.Id + oldDepart := strings.Split(perArcInfo.Deparment, ",") + chaJiDepart := overallhandle.DifferenceSet[string](departId, oldDepart) + if len(chaJiDepart) > 0 { + departIdStr := strings.Join(departId, ",") + eidtManCont["`deparment`"] = departIdStr + manChangeRecord.Department = departIdStr changeRecordTrue = true } - manChangeRecord.Position = positionCont.Id - } - } - //职务 - if manCont.JobName != "" { - var dutiesCont models.DutiesClassLeve - dutiesErr := dutiesCont.GetCont(map[string]interface{}{"`d_king`": manCont.JobName}, "d_id") - if dutiesErr == nil { - if dutiesCont.Id != perArcInfo.Position { - eidtManCont["`job_id`"] = dutiesCont.Id - changeRecordTrue = true + } + //行政组织 + // if manCont.AdminOrg != "" { + // var orgMainDepartAdmin models.AdministrativeOrganization + // orgErr := orgMainDepartAdmin.GetCont(map[string]interface{}{"kingdeeid": manCont.AdminOrg}, "`id`") + // if orgErr == nil { + // if orgMainDepartAdmin.Id != perArcInfo.AdminOrg { + // eidtManCont["`admin_org`"] = orgMainDepartAdmin.Id + // changeRecordTrue = true + // } + // manChangeRecord.Adminorg = orgMainDepartAdmin.Id + // } + // } + //职位 + if manCont.Position != "" { + var positionCont models.Position + positErr := positionCont.GetCont(map[string]interface{}{`kingdeeid`: manCont.Position}, "`id`") + if positErr == nil { + if positionCont.Id != perArcInfo.Position { + eidtManCont["`position`"] = positionCont.Id + changeRecordTrue = true + } + manChangeRecord.Position = positionCont.Id } + } + //职务 + if manCont.JobName != "" { + var dutiesCont models.DutiesClassLeve + dutiesErr := dutiesCont.GetCont(map[string]interface{}{"`d_king`": manCont.JobName}, "d_id") + if dutiesErr == nil { - if dutiesCont.ClassId != perArcInfo.JobClass { - eidtManCont["`job_class`"] = dutiesCont.ClassId - changeRecordTrue = true + if dutiesCont.Id != perArcInfo.Position { + eidtManCont["`job_id`"] = dutiesCont.Id + changeRecordTrue = true + } + + if dutiesCont.ClassId != perArcInfo.JobClass { + eidtManCont["`job_class`"] = dutiesCont.ClassId + changeRecordTrue = true + } + manChangeRecord.JobId = dutiesCont.Id + manChangeRecord.JobClass = dutiesCont.ClassId } - manChangeRecord.JobId = dutiesCont.Id - manChangeRecord.JobClass = dutiesCont.ClassId } - } - if manCont.PositionGrade != "" { - positionGrade, _ := overallhandle.StringToInt64(manCont.PositionGrade) - if positionGrade != perArcInfo.JobLeve { - eidtManCont["`job_leve`"] = positionGrade + if manCont.PositionGrade != "" { + positionGrade, _ := overallhandle.StringToInt64(manCont.PositionGrade) + if positionGrade != perArcInfo.JobLeve { + eidtManCont["`job_leve`"] = positionGrade + } + manChangeRecord.JobLevel = positionGrade + changeRecordTrue = true } - manChangeRecord.JobLevel = positionGrade - changeRecordTrue = true } - // fmt.Printf("第一学历--->%v--->%v\n", changeRecordTrue, manChangeRecord) if len(eidtManCont) > 0 { var manMainCont models.PersonArchives eidtErrMain := manMainCont.EiteCont(map[string]interface{}{"`id`": perArcInfo.Id}, eidtManCont) + eidtManContJson, jsonErr := json.Marshal(eidtManCont) + overallhandle.WriteLog("edit", "编辑员工主信息!", eidtErrMain, jsonErr, string(eidtManContJson)) if eidtErrMain != nil { return eidtErrMain } else { @@ -279,7 +289,8 @@ func eidtAddManContJinDie(perArcInfo models.PersonArchives, manCont addKingdeePe } } - if perArcInfo.IsLock != 1 { + // fmt.Printf("判断是否执行操作---》%v\n", perArcInfo.IsShowTrue) + if perArcInfo.IsShowTrue != 1 { //编辑人员附属信息 synPro.Add(1) go editManAuxiliaryDataNew(perArcInfo.Key, manCont) @@ -456,7 +467,9 @@ func newAddManContJinDie(oldSchool models.WorkMan, manCont addKingdeePersonneles manMainCont.WorkWechat = oldPersonArchives.WorkWechat } manMainCont.IsAdmin = oldPersonArchives.IsAdmin - manMainCont.Role = oldPersonArchives.Role + if oldPersonArchives.Role != "" { + manMainCont.Role = oldPersonArchives.Role + } if oldPersonArchives.Password != "" { manMainCont.Password = oldPersonArchives.Password } else { diff --git a/api/version1/personnelapi/staffarchives.go b/api/version1/personnelapi/staffarchives.go index 42a0140..bbd471f 100644 --- a/api/version1/personnelapi/staffarchives.go +++ b/api/version1/personnelapi/staffarchives.go @@ -1315,22 +1315,35 @@ func getGroupWorkHistoryList(key int64) (workHisList []insideHistory) { if workHisContListErr == nil { for _, v := range workHisContList { var workCont insideHistory - var groupInfo models.AdministrativeOrganization - groupInfo.GetCont(map[string]interface{}{"`id`": v.Group}, "`name`") - workCont.Group = groupInfo.Name //集团 - var companyInfo models.AdministrativeOrganization - companyInfo.GetCont(map[string]interface{}{"`id`": v.Company}, "`name`") - workCont.Company = companyInfo.Name //公司 - var deparment models.AdministrativeOrganization - deparment.GetCont(map[string]interface{}{"`id`": v.Department}, "`name`") - workCont.Department = deparment.Name //部门 - var workshop models.AdministrativeOrganization - workshop.GetCont(map[string]interface{}{"`id`": v.WorkShop}, "`name`") - workCont.Workshop = workshop.Name //二级部门或车间 - - var workshopsetdsas models.AdministrativeOrganization - workshopsetdsas.GetCont(map[string]interface{}{"`id`": v.WorkshopSection}, "`name`") - workCont.WorkshopSection = workshopsetdsas.Name //二级部门或车间 + if v.Group != 0 { + var groupInfo models.AdministrativeOrganization + groupInfo.GetCont(map[string]interface{}{"`id`": v.Group}, "`name`") + workCont.Group = groupInfo.Name //集团 + } + + if v.Company != 0 { + var companyInfo models.AdministrativeOrganization + companyInfo.GetCont(map[string]interface{}{"`id`": v.Company}, "`name`") + workCont.Company = companyInfo.Name //公司 + } + + if v.Department != 0 { + var deparment models.AdministrativeOrganization + deparment.GetCont(map[string]interface{}{"`id`": v.Department}, "`name`") + workCont.Department = deparment.Name //部门 + } + + if v.WorkShop != 0 { + var workshop models.AdministrativeOrganization + workshop.GetCont(map[string]interface{}{"`id`": v.WorkShop}, "`name`") + workCont.Workshop = workshop.Name //二级部门或车间 + } + + if v.WorkshopSection != 0 { + var workshopsetdsas models.AdministrativeOrganization + workshopsetdsas.GetCont(map[string]interface{}{"`id`": v.WorkshopSection}, "`name`") + workCont.WorkshopSection = workshopsetdsas.Name //二级部门或车间 + } var positCont models.Position if v.Position != 0 { @@ -1350,24 +1363,34 @@ func getGroupWorkHistoryList(key int64) (workHisList []insideHistory) { workCont.ChangeType = v.ChangeType // workCont.WorkCont = v.WorkCont - if positCont.Superior != 0 { - var positContSuper models.Position - positContSuper.GetCont(map[string]interface{}{"`id`": positCont.Superior}, "`name`") - workCont.SuperiorPosition = positContSuper.Name + if v.SuperiorPosition != "" { + workCont.SuperiorPosition = v.SuperiorPosition + } else { + if positCont.Superior != 0 { + var positContSuper models.Position + positContSuper.GetCont(map[string]interface{}{"`id`": positCont.Superior}, "`name`") + workCont.SuperiorPosition = positContSuper.Name + } } + //获取 - var mySunAllPost GainAllId - mySunAllPost.GetAllContId(v.Position) - if len(mySunAllPost.Id) > 0 { - var allPeople int64 - overall.CONSTANT_DB_HR.Model(&models.PersonArchives{}).Where("`position` IN ? AND emp_type < 11", mySunAllPost.Id).Count(&allPeople) - if allPeople == 0 { - workCont.MinionNumber = "" - } else { - workCont.MinionNumber = strconv.FormatInt(allPeople, 10) - } + if v.Subordinates == 0 { + var mySunAllPost GainAllId + mySunAllPost.GetAllContId(v.Position) + if len(mySunAllPost.Id) > 0 { + var allPeople int64 + overall.CONSTANT_DB_HR.Model(&models.PersonArchives{}).Where("`position` IN ? AND emp_type < 11", mySunAllPost.Id).Count(&allPeople) + if allPeople == 0 { + workCont.MinionNumber = "" + } else { + workCont.MinionNumber = strconv.FormatInt(allPeople, 10) + } + } + } else { + workCont.MinionNumber = strconv.Itoa(v.Subordinates) } + workHisList = append(workHisList, workCont) } } diff --git a/api/version1/personnelapi/type.go b/api/version1/personnelapi/type.go index 029f2c8..9ed8dce 100644 --- a/api/version1/personnelapi/type.go +++ b/api/version1/personnelapi/type.go @@ -650,4 +650,5 @@ type GroupParsingData struct { UserKey int64 `json:"userKey"` IsOk bool `json:"isOk"` Msg []string `json:"msg"` + MsgStr string `json:"msgstr"` } diff --git a/api/version1/personnelapi/types.go b/api/version1/personnelapi/types.go index f1e9d7d..f95e447 100644 --- a/api/version1/personnelapi/types.go +++ b/api/version1/personnelapi/types.go @@ -244,6 +244,10 @@ type judgeMainPost struct { //性格色彩试题格式 type TestPageColor struct { + TestNumber int `json:"testnumber"` //题号 + CheckedVal int `json:"checkedval"` //选项 +} +type TestPageColorStr struct { TestNumber string `json:"testnumber"` //题号 CheckedVal string `json:"checkedval"` //选项 } @@ -259,6 +263,7 @@ type TestPageColorVal struct { type TestPageColorResult struct { TestNumber []string `json:"testnumber"` //题号 CheckedVal []int `json:"checkedval"` //选项 + ColorMap []int `json:"colormap"` } type ExcelInfo struct { @@ -266,3 +271,11 @@ type ExcelInfo struct { ProductMasterTitle string `json:"ProductMasterTitle"` ProductSlaveTitle string `json:"ProductSlaveTitle"` } + +//解析上传到redis中的数据 +type AnaRedisKB struct { + Number int `json:"number"` + RedisListKey string `json:"redisListKey"` + MeritsYearIng map[string]int `json:"meritsYearIng"` + RewPunYearsIng map[string]int `json:"rewPunYearsIng"` +} diff --git a/api/version1/personnelapi/uploadFileredis.go b/api/version1/personnelapi/uploadFileredis.go new file mode 100644 index 0000000..6b82af3 --- /dev/null +++ b/api/version1/personnelapi/uploadFileredis.go @@ -0,0 +1,256 @@ +package personnelapi + +import ( + "fmt" + "hr_server/grocerystore" + "hr_server/models" + "hr_server/overall" + "hr_server/overall/overallhandle" + "path" + "strconv" + "strings" + "time" + + "encoding/json" + + "github.com/360EntSecGroup-Skylar/excelize" + "github.com/gin-gonic/gin" +) + +/* +* +@ 作者: 秦东 +@ 时间: 2024-02-03 15:38:58 +@ 功能: 解析上传列表 +@ 参数 + + # + +@ 返回值 + + # + +@ 方法原型 + + # +*/ +func (s *StaffApi) UploadUserFilesRedis(c *gin.Context) { + fileInfo, fileHeader, fileErr := c.Request.FormFile("file") + if fileErr != nil { + overallhandle.Result(1, fileErr, c) + return + } + tageExt := path.Ext(fileHeader.Filename) + fmt.Printf("tageExt:%v\n", tageExt) + fileType := overallhandle.JudgeUpFileType(tageExt) + if fileType != 5 { + overallhandle.Result(1, fileType, c, "您上传的不是电子表格!请上传正确的文件!") + return + } + + xlsx, err := excelize.OpenReader(fileInfo) + if err != nil { + overallhandle.Result(2, err, c) + return + } + redisListKey := fmt.Sprintf("ExcelImport:PeopleList:%v_%v", overall.CONSTANT_CONFIG.RedisPrefixStr.Alias, overallhandle.OnlyOneNumber(1)) + var userInfoData GroupParsingData + totalNum, meritsYearIng, rewPunYearsIng := userInfoData.ReadExcelRedis(xlsx, redisListKey) + sendData := overallhandle.MapOut() + sendData["redisListKey"] = redisListKey + sendData["totalNum"] = totalNum + sendData["meritsYearIng"] = meritsYearIng + sendData["rewPunYearsIng"] = rewPunYearsIng + overallhandle.Result(0, sendData, c) +} + +// ReadExcel .读取excel 转成切片 +func (g *GroupParsingData) ReadExcelRedis(xlsx *excelize.File, redisKey string) (totalNum int64, meritsYearIng, rewPunYearsIng map[int]int) { + rows := xlsx.GetRows(xlsx.GetSheetName(xlsx.GetActiveSheetIndex())) + isDateYear := time.Now().Year() + //获取绩效年度 + meritsYear := make(map[int]int) + if rows[1][289] != "" { + yearAry := strings.Split(rows[1][289], "年") + if len(yearAry) > 0 { + + yearVal, _ := strconv.Atoi(yearAry[0]) + meritsYear[0] = yearVal + } + } else { + meritsYear[0] = isDateYear - 3 + } + if rows[1][290] != "" { + yearAry := strings.Split(rows[1][290], "年") + if len(yearAry) > 0 { + yearVal, _ := strconv.Atoi(yearAry[0]) + meritsYear[1] = yearVal + } + } else { + meritsYear[1] = isDateYear - 2 + } + if rows[1][291] != "" { + yearAry := strings.Split(rows[1][291], "年") + if len(yearAry) > 0 { + yearVal, _ := strconv.Atoi(yearAry[0]) + meritsYear[2] = yearVal + } + } else { + meritsYear[2] = isDateYear - 1 + } + meritsYearIng = meritsYear + //获取奖惩年度 + rewPunYears := make(map[int]int) + if rows[2][299] != "" { + jcYearAry := strings.Split(rows[2][299], "奖惩") + if len(jcYearAry) > 0 { + + jcYearVal, _ := strconv.Atoi(jcYearAry[0]) + rewPunYears[0] = jcYearVal + } + } else { + rewPunYears[0] = isDateYear - 3 + } + if rows[2][304] != "" { + jcYearAry := strings.Split(rows[2][304], "奖惩") + if len(jcYearAry) > 0 { + + jcYearVal, _ := strconv.Atoi(jcYearAry[0]) + rewPunYears[1] = jcYearVal + } + } else { + rewPunYears[1] = isDateYear - 2 + } + if rows[2][309] != "" { + jcYearAry := strings.Split(rows[2][309], "奖惩") + if len(jcYearAry) > 0 { + + jcYearVal, _ := strconv.Atoi(jcYearAry[0]) + rewPunYears[2] = jcYearVal + } + } else { + rewPunYears[2] = isDateYear - 1 + } + rewPunYearsIng = rewPunYears + + redisClient := grocerystore.RunRedis(overall.CONSTANT_REDIS4) + redisClient.SetRedisTime(86400) + totalNum = 0 + for i, row := range rows { + if i < 4 { + continue + } + if row[1] != "" { + jsonStr, _ := json.Marshal(row) + // fmt.Printf("%v出生日期:%v\n", row[1], string(jsonStr)) + redisClient.Lpush(redisKey, jsonStr) + totalNum++ + } + } + // redisVal, err := redisClient.Lindex(redisKey, 9) + // fmt.Printf("row:%v,%v\n", redisVal, err) + return +} + +/* +* +@ 作者: 秦东 +@ 时间: 2024-02-03 16:22:38 +@ 功能: 解析Redis列表中的数据 +@ 参数 + + # + +@ 返回值 + + # + +@ 方法原型 + + # +*/ +func (s *StaffApi) AnalysisRedisExelect(c *gin.Context) { + var requestData AnaRedisKB + err := c.ShouldBindJSON(&requestData) + if err != nil { + overallhandle.Result(100, err, c) + return + } + redisClient := grocerystore.RunRedis(overall.CONSTANT_REDIS4) + redisListLenght, err := redisClient.Llen(requestData.RedisListKey) + if err != nil { + overallhandle.Result(1, err, c, "数据获取识别!没有找到数据!") + return + } + + redisVal, err := redisClient.Lindex(requestData.RedisListKey, int64(requestData.Number)) + if err != nil { + overallhandle.Result(1, err, c, "数据获取识别!没有找到数据!") + return + } + var jieguo []string + err = json.Unmarshal([]byte(redisVal), &jieguo) + if err != nil { + overallhandle.Result(1, err, c, "数据格式不正取!") + } + manCont := make(map[int]string) + for i, v := range jieguo { + manCont[i] = v + } + meritsYear := make(map[int]int) + for i, v := range requestData.MeritsYearIng { + iInt, _ := strconv.Atoi(i) + meritsYear[iInt] = v + } + rewPunYears := make(map[int]int) + for i, v := range requestData.RewPunYearsIng { + iInt, _ := strconv.Atoi(i) + rewPunYears[iInt] = v + } + var groupManCont GroupParsingData + groupManCont.GroupParsingDataInfoRedis(manCont, meritsYear, rewPunYears) + // fmt.Printf("执行完222毕删除列表键%v-%v-%v\n", redisListLenght, requestData.Number, redisListLenght-1 == int64(requestData.Number)) + if redisListLenght-1 == int64(requestData.Number) { + //执行完毕删除列表键 + redisClient.Lrange(requestData.RedisListKey, 0, -1) + redisClient.DelKey(requestData.RedisListKey) + // fmt.Printf("执行完毕删除列表键%v\n", requestData.RedisListKey) + } + overallhandle.Result(0, groupManCont, c) +} + +/* +* +@ 作者: 秦东 +@ 时间: 2024-01-30 08:10:16 +@ 功能: 分组数据解析 +@ 参数 + + #info //人员信息 + #meritsYear 绩效年度 + #rewPunYearsmap 奖惩年度 + +@ 返回值 + + # + +@ 方法原型 + + # +*/ +func (g *GroupParsingData) GroupParsingDataInfoRedis(list map[int]string, meritsYear, rewPunYearsmap map[int]int) { + g.IsOk = false + g.UserNum = list[1] + if list[1] != "" { + var myCont models.PersonArchives + err := myCont.GetCont(map[string]interface{}{"`number`": list[1]}, "`key`") + if err != nil { + g.IsOk = true + } else { + g.UserKey = myCont.Key + } + g.ProcessMainTable(list, meritsYear, rewPunYearsmap) + } else { + g.Msg = append(g.Msg, fmt.Sprintf("序号:%v--->%v:没有工号--->%v", list[0], list[2], time.Now().Unix())) + } +} diff --git a/api/version1/personnelapi/uploadfile.go b/api/version1/personnelapi/uploadfile.go index c7d2d2f..c704b15 100644 --- a/api/version1/personnelapi/uploadfile.go +++ b/api/version1/personnelapi/uploadfile.go @@ -255,7 +255,7 @@ func (g *GroupParsingData) GroupParsingDataInfo(list []interface{}, meritsYear, # */ func (g *GroupParsingData) ProcessMainTable(info map[int]string, meritsYear, rewPunYearsmap map[int]int) { - fmt.Printf("分成的段:%v\n%v\n%v\n", g.UserNum, g.UserKey, g.IsOk) + // fmt.Printf("分成的段:%v\n%v\n%v\n", g.UserNum, g.UserKey, g.IsOk) if g.UserKey == 0 { g.UserKey = overallhandle.OnlyOneNumber(2) } @@ -322,15 +322,17 @@ func (g *GroupParsingData) ProcessMainTable(info map[int]string, meritsYear, rew md5JiaMi.Md5EncryptionInit(overall.CONSTANT_CONFIG.Appsetup.DefaultPassword) md5Token := md5JiaMi.Md5EncryptionAlgorithm() userInfo.Password = md5Token //密码"` - userInfo.IsLock = 1 + userInfo.IsShowTrue = 1 if info[30] != "" { - userInfo.WorkWechat = info[30] + userInfo.Wechat = info[30] } err := overall.CONSTANT_DB_HR.Create(&userInfo).Error if err != nil { - g.Msg = append(g.Msg, fmt.Sprintf("%v[%v]处理失败!", info[2], info[1])) + g.Msg = append(g.Msg, fmt.Sprintf("%v[%v]处理失败!--- %v", info[2], info[1], overallhandle.UnixTimeToDay(curryTime, 11))) + g.MsgStr = fmt.Sprintf("%v[%v]处理失败!--- %v", info[2], info[1], overallhandle.UnixTimeToDay(curryTime, 11)) } else { - g.Msg = append(g.Msg, fmt.Sprintf("%v[%v]处理完成!", info[2], info[1])) + g.Msg = append(g.Msg, fmt.Sprintf("%v[%v]处理完成!--- %v", info[2], info[1], overallhandle.UnixTimeToDay(curryTime, 11))) + g.MsgStr = fmt.Sprintf("%v[%v]处理完成!--- %v", info[2], info[1], overallhandle.UnixTimeToDay(curryTime, 11)) } } else { editInfo := overallhandle.MapOut() @@ -366,7 +368,7 @@ func (g *GroupParsingData) ProcessMainTable(info map[int]string, meritsYear, rew } if info[6] != "" { postOrg := GetMyOrgSunId(info[6], allOrgId) - editInfo["`workSection`"] = postOrg //二级主部门"` + editInfo["`work_section`"] = postOrg //二级主部门"` if postOrg != 0 { adminOrg = postOrg } @@ -393,17 +395,19 @@ func (g *GroupParsingData) ProcessMainTable(info map[int]string, meritsYear, rew editInfo["`job_class`"] = jobInfo.Id //管理类别"` } editInfo["`eite_time`"] = curryTime - editInfo["`isLock`"] = 1 + editInfo["`is_show_true`"] = 1 if info[30] != "" { - editInfo["`work_wechat`"] = info[30] + editInfo["`wechat`"] = info[30] } var userInfo models.PersonArchives err := userInfo.EiteCont(map[string]interface{}{"`key`": g.UserKey}, editInfo) - fmt.Printf("编辑信息:%v\n", err) + // fmt.Printf("编辑信息:%v\n", err) if err != nil { - g.Msg = append(g.Msg, fmt.Sprintf("%v[%v]处理失败!", info[2], info[1])) + g.Msg = append(g.Msg, fmt.Sprintf("%v[%v]处理失败!--- %v", info[2], info[1], overallhandle.UnixTimeToDay(curryTime, 11))) + g.MsgStr = fmt.Sprintf("%v[%v]处理失败!--- %v", info[2], info[1], overallhandle.UnixTimeToDay(curryTime, 11)) } else { - g.Msg = append(g.Msg, fmt.Sprintf("%v[%v]处理完成!", info[2], info[1])) + g.Msg = append(g.Msg, fmt.Sprintf("%v[%v]处理完成!--- %v", info[2], info[1], overallhandle.UnixTimeToDay(curryTime, 11))) + g.MsgStr = fmt.Sprintf("%v[%v]处理完成!--- %v", info[2], info[1], overallhandle.UnixTimeToDay(curryTime, 11)) } // fmt.Printf("修改的数据:%v\n", editInfo) } @@ -428,6 +432,18 @@ func (g *GroupParsingData) ProcessMainTable(info map[int]string, meritsYear, rew synPros.Add(1) go g.EditCertificate(info) //编辑证书 synPros.Wait() + + // g.SecondaryTableUser(info) //人员信息副本 + // g.PoliticalOutlookEdit(info) //政治面貌 + // g.EditEducationInfo(info) //学历信息 + // g.FamilyMembers(info) //家庭成员 + // g.GrowthExperienceWithinTheGroup(info) //集团内成长经历 + // g.ExternalWorkExperienceOfTheGroup(info) //集团外部工作经历 + // g.EditExamineLevel(info, meritsYear) //绩效考核成绩 + // g.EditRewardsPunishments(info, rewPunYearsmap) //奖惩记录 + // g.EditAcademicTitle(info) //编辑职称 + // g.EditCertificate(info) //编辑证书 + synPros.Wait() } /* @@ -449,23 +465,51 @@ func (g *GroupParsingData) ProcessMainTable(info map[int]string, meritsYear, rew */ func (g *GroupParsingData) EditCertificate(info map[int]string) { defer synPros.Done() - if info[339] != "" { - g.EditCertificateCont(info[338], info[339], info[340], info[341], info[342], info[343], info[344]) - } - if info[346] != "" { - g.EditCertificateCont(info[345], info[346], info[347], info[348], info[349], info[350], info[351]) - } - if info[353] != "" { - g.EditCertificateCont(info[352], info[353], info[354], info[355], info[356], info[357], info[358]) - } - if info[360] != "" { - g.EditCertificateCont(info[359], info[360], info[361], info[362], info[363], info[364], info[365]) - } - if info[367] != "" { - g.EditCertificateCont(info[366], info[367], info[368], info[369], info[370], info[371], info[372]) - } - if info[374] != "" { - g.EditCertificateCont(info[373], info[374], info[375], info[376], info[377], info[378], info[379]) + + var cerHonList []models.CertificateHonors + err := overall.CONSTANT_DB_HR.Where("`userKey` = ?", g.UserKey).Find(&cerHonList).Error + if err != nil || len(cerHonList) < 1 { + if info[339] != "" { + g.EditCertificateCont(info[338], info[339], info[340], info[341], info[342], info[343], info[344]) + } + if info[346] != "" { + g.EditCertificateCont(info[345], info[346], info[347], info[348], info[349], info[350], info[351]) + } + if info[353] != "" { + g.EditCertificateCont(info[352], info[353], info[354], info[355], info[356], info[357], info[358]) + } + if info[360] != "" { + g.EditCertificateCont(info[359], info[360], info[361], info[362], info[363], info[364], info[365]) + } + if info[367] != "" { + g.EditCertificateCont(info[366], info[367], info[368], info[369], info[370], info[371], info[372]) + } + if info[374] != "" { + g.EditCertificateCont(info[373], info[374], info[375], info[376], info[377], info[378], info[379]) + } + } else { + jsonInfo, _ := json.Marshal(cerHonList) + overallhandle.WriteLog("del", "删除旧证书数据!", string(jsonInfo)) + var workGroupLogCont models.CertificateHonors + workGroupLogCont.DelCont(map[string]interface{}{"`userKey`": g.UserKey}) + if info[339] != "" { + g.EditCertificateCont(info[338], info[339], info[340], info[341], info[342], info[343], info[344]) + } + if info[346] != "" { + g.EditCertificateCont(info[345], info[346], info[347], info[348], info[349], info[350], info[351]) + } + if info[353] != "" { + g.EditCertificateCont(info[352], info[353], info[354], info[355], info[356], info[357], info[358]) + } + if info[360] != "" { + g.EditCertificateCont(info[359], info[360], info[361], info[362], info[363], info[364], info[365]) + } + if info[367] != "" { + g.EditCertificateCont(info[366], info[367], info[368], info[369], info[370], info[371], info[372]) + } + if info[374] != "" { + g.EditCertificateCont(info[373], info[374], info[375], info[376], info[377], info[378], info[379]) + } } } @@ -477,58 +521,58 @@ func (g *GroupParsingData) EditCertificate(info map[int]string) { */ func (g *GroupParsingData) EditCertificateCont(Title, Number, IssuingUnit, TimeData, EndTime, ValidPeriod, State string) { var cerInfo models.CertificateHonors - err := cerInfo.GetCont(map[string]interface{}{"`userKey`": g.UserKey, "`number`": Number, "`title`": Title}) + // err := cerInfo.GetCont(map[string]interface{}{"`userKey`": g.UserKey, "`number`": Number, "`title`": Title}) cureeTime := time.Now().Unix() if TimeData != "" { cureeTime = overallhandle.ExcelDateToDate(TimeData).Unix() } - if err != nil { - cerInfo.Title = Title //证书/荣誉名称"` - cerInfo.UserKey = g.UserKey //获得人员"` - cerInfo.Types = 4 //类型(1:职称证书;2:资格证书;3:荣誉;4:专业证书)` - if State == "是" { - cerInfo.State = 1 //状态(1:启用;2:禁用;3:删除)` - } else { - cerInfo.State = 2 //状态(1:启用;2:禁用;3:删除)` - } - - cerInfo.IssuingUnit = IssuingUnit //颁发单位"` - if TimeData != "" { - cerInfo.TimeData = cureeTime //获得时间"` - } - yearInt, _ := strconv.Atoi(overallhandle.UnixTimeToDay(cureeTime, 16)) - cerInfo.Years = yearInt //年"` - monthsInt, _ := strconv.Atoi(overallhandle.UnixTimeToDay(cureeTime, 17)) - cerInfo.Months = monthsInt //月"` - cerInfo.Number = Number //证书编号"` - if EndTime != "" { - cerInfo.EndTime = overallhandle.ExcelDateToDate(EndTime).Unix() //截止时间"` - } - cerInfo.ValidPeriod = ValidPeriod //有效期限"` - overall.CONSTANT_DB_HR.Create(&cerInfo) - } else { //编辑 - editCont := overallhandle.MapOut() - editCont["`title`"] = Title - editCont["`number`"] = Number - editCont["`issuing_unit`"] = IssuingUnit - editCont["`timedata`"] = cureeTime - if EndTime != "" { - editCont["`endTime`"] = overallhandle.ExcelDateToDate(EndTime).Unix() - } - editCont["`validPeriod`"] = ValidPeriod - if State == "是" { - editCont["`state`"] = 1 //状态(1:启用;2:禁用;3:删除)` - } else { - editCont["`state`"] = 2 //状态(1:启用;2:禁用;3:删除)` - } - yearInt, _ := strconv.Atoi(overallhandle.UnixTimeToDay(cureeTime, 16)) - editCont["`years`"] = yearInt - editCont["`types`"] = 4 - monthsInt, _ := strconv.Atoi(overallhandle.UnixTimeToDay(cureeTime, 17)) - editCont["`months`"] = monthsInt - var editInfoCont models.AcademicTitle - editInfoCont.EiteCont(map[string]interface{}{"`id`": cerInfo.Id}, editCont) + // if err != nil { + cerInfo.Title = Title //证书/荣誉名称"` + cerInfo.UserKey = g.UserKey //获得人员"` + cerInfo.Types = 4 //类型(1:职称证书;2:资格证书;3:荣誉;4:专业证书)` + if State == "是" { + cerInfo.State = 1 //状态(1:启用;2:禁用;3:删除)` + } else { + cerInfo.State = 2 //状态(1:启用;2:禁用;3:删除)` } + + cerInfo.IssuingUnit = IssuingUnit //颁发单位"` + if TimeData != "" { + cerInfo.TimeData = cureeTime //获得时间"` + } + yearInt, _ := strconv.Atoi(overallhandle.UnixTimeToDay(cureeTime, 16)) + cerInfo.Years = yearInt //年"` + monthsInt, _ := strconv.Atoi(overallhandle.UnixTimeToDay(cureeTime, 17)) + cerInfo.Months = monthsInt //月"` + cerInfo.Number = Number //证书编号"` + if EndTime != "" { + cerInfo.EndTime = overallhandle.ExcelDateToDate(EndTime).Unix() //截止时间"` + } + cerInfo.ValidPeriod = ValidPeriod //有效期限"` + overall.CONSTANT_DB_HR.Create(&cerInfo) + // } else { //编辑 + // editCont := overallhandle.MapOut() + // editCont["`title`"] = Title + // editCont["`number`"] = Number + // editCont["`issuing_unit`"] = IssuingUnit + // editCont["`timedata`"] = cureeTime + // if EndTime != "" { + // editCont["`endTime`"] = overallhandle.ExcelDateToDate(EndTime).Unix() + // } + // editCont["`validPeriod`"] = ValidPeriod + // if State == "是" { + // editCont["`state`"] = 1 //状态(1:启用;2:禁用;3:删除)` + // } else { + // editCont["`state`"] = 2 //状态(1:启用;2:禁用;3:删除)` + // } + // yearInt, _ := strconv.Atoi(overallhandle.UnixTimeToDay(cureeTime, 16)) + // editCont["`years`"] = yearInt + // editCont["`types`"] = 4 + // monthsInt, _ := strconv.Atoi(overallhandle.UnixTimeToDay(cureeTime, 17)) + // editCont["`months`"] = monthsInt + // var editInfoCont models.CertificateHonors + // editInfoCont.EiteCont(map[string]interface{}{"`id`": cerInfo.Id}, editCont) + // } } /* @@ -550,12 +594,54 @@ func (g *GroupParsingData) EditCertificateCont(Title, Number, IssuingUnit, TimeD */ func (g *GroupParsingData) EditAcademicTitle(info map[int]string) { defer synPros.Done() - if info[331] != "" { - g.EditAcademicTitleInfo(info[328], info[329], info[330], info[331], info[332]) + // if info[331] != "" { + // g.EditAcademicTitleInfo(info[328], info[329], info[330], info[331], info[332]) + // } + // if info[336] != "" { + // g.EditAcademicTitleInfo(info[333], info[334], info[335], info[336], info[337]) + // } + var acaList []models.AcademicTitle + err := overall.CONSTANT_DB_HR.Where("`userKey` = ?", g.UserKey).Find(&acaList).Error + if err != nil || len(acaList) < 1 { + if info[331] != "" { + g.InsetAcaInfo(info[328], info[329], info[330], info[331], info[332]) + } + if info[336] != "" { + g.InsetAcaInfo(info[333], info[334], info[335], info[336], info[337]) + } + } else { + jsonInfo, _ := json.Marshal(acaList) + overallhandle.WriteLog("del", "删除旧职称数据!", string(jsonInfo)) + var workGroupLogCont models.AcademicTitle + workGroupLogCont.DelCont(map[string]interface{}{"`userKey`": g.UserKey}) + if info[331] != "" { + g.InsetAcaInfo(info[328], info[329], info[330], info[331], info[332]) + } + if info[336] != "" { + g.InsetAcaInfo(info[333], info[334], info[335], info[336], info[337]) + } } - if info[336] != "" { - g.EditAcademicTitleInfo(info[333], info[334], info[335], info[336], info[337]) +} + +/* +* +@ 作者: 秦东 +@ 时间: 2024-02-04 13:39:42 +@ 功能: 写入职称 +*/ +func (g *GroupParsingData) InsetAcaInfo(types, series, speciality, number, timeVal string) { + var acaInfo models.AcademicTitle + acaInfo.Types = types //职称级别"` + acaInfo.Series = series //职称系列"` + acaInfo.Speciality = speciality //职称专业"` + acaInfo.Number = number //资格证书编号"` + if timeVal != "" { + acaInfo.Time = overallhandle.ExcelDateToDate(timeVal).Unix() //生效时间"` } + + acaInfo.EditTime = time.Now().Unix() //写入时间"` + acaInfo.UserKey = g.UserKey //人员唯一识别符"` + overall.CONSTANT_DB_HR.Create(&acaInfo) } /* @@ -565,9 +651,10 @@ func (g *GroupParsingData) EditAcademicTitle(info map[int]string) { @ 功能: 编辑职称内容 */ func (g *GroupParsingData) EditAcademicTitleInfo(types, series, speciality, number, timeVal string) { - var acaInfo models.AcademicTitle - err := acaInfo.GetCont(map[string]interface{}{"`userKey`": g.UserKey, "`number`": number}) - if err != nil { + var acaList []models.AcademicTitle + err := overall.CONSTANT_DB_HR.Where("`userKey` = ?", g.UserKey).Find(&acaList).Error + if err != nil || len(acaList) < 1 { + var acaInfo models.AcademicTitle acaInfo.Types = types //职称级别"` acaInfo.Series = series //职称系列"` acaInfo.Speciality = speciality //职称专业"` @@ -579,19 +666,39 @@ func (g *GroupParsingData) EditAcademicTitleInfo(types, series, speciality, numb acaInfo.EditTime = time.Now().Unix() //写入时间"` acaInfo.UserKey = g.UserKey //人员唯一识别符"` overall.CONSTANT_DB_HR.Create(&acaInfo) - } else { //编辑 - editCont := overallhandle.MapOut() - editCont["`types`"] = types - editCont["`series`"] = series - editCont["`speciality`"] = speciality - editCont["`number`"] = number + } else { + jsonInfo, _ := json.Marshal(acaList) + overallhandle.WriteLog("del", "删除旧职称数据!", string(jsonInfo)) + var acaInfo models.AcademicTitle + acaInfo.Types = types //职称级别"` + acaInfo.Series = series //职称系列"` + acaInfo.Speciality = speciality //职称专业"` + acaInfo.Number = number //资格证书编号"` if timeVal != "" { - editCont["`time`"] = overallhandle.ExcelDateToDate(timeVal).Unix() + acaInfo.Time = overallhandle.ExcelDateToDate(timeVal).Unix() //生效时间"` } - editCont["`editTime`"] = time.Now().Unix() - var rewPunYearEditCont models.AcademicTitle - rewPunYearEditCont.EiteCont(map[string]interface{}{"`id`": acaInfo.Id}, editCont) + acaInfo.EditTime = time.Now().Unix() //写入时间"` + acaInfo.UserKey = g.UserKey //人员唯一识别符"` + overall.CONSTANT_DB_HR.Create(&acaInfo) } + + // var acaInfo models.AcademicTitle + // err := acaInfo.GetCont(map[string]interface{}{"`userKey`": g.UserKey, "`number`": number}) + // if err != nil { + + // } else { //编辑 + // editCont := overallhandle.MapOut() + // editCont["`types`"] = types + // editCont["`series`"] = series + // editCont["`speciality`"] = speciality + // editCont["`number`"] = number + // if timeVal != "" { + // editCont["`time`"] = overallhandle.ExcelDateToDate(timeVal).Unix() + // } + // editCont["`editTime`"] = time.Now().Unix() + // var rewPunYearEditCont models.AcademicTitle + // rewPunYearEditCont.EiteCont(map[string]interface{}{"`id`": acaInfo.Id}, editCont) + // } } /* @@ -633,7 +740,7 @@ func (g *GroupParsingData) EditRewardsPunishments(info map[int]string, rewPunYea } func (g *GroupParsingData) EditRewPunInfo(years int, level, rewPunClass, title, timeData, issuingUnit string) { - fmt.Printf("奖惩记录2: %v\n", timeData) + // fmt.Printf("奖惩记录2: %v\n", timeData) jiangCeng := RewPunLevelClassStr(rewPunClass) var rewPunYearCont models.RewardsPenalties @@ -828,6 +935,7 @@ WitnessTel 证明人电话 Remarks 备注 */ func (g *GroupParsingData) ExternalWorkGroupLog(EntryTime, Leavedate, Company, CompanyNature, Industry, Deparment, Job, WorkCont, MinionNumber, SuperiorPosition, Witness, WitnessTel, Remarks string) { + // fmt.Printf("rrweljl===>%v\n", Leavedate) var myWorkLog models.WorkHistory myWorkLog.Number = g.UserNum //工号"` myWorkLog.Key = g.UserKey //身份识别"` @@ -986,6 +1094,7 @@ func (g *GroupParsingData) EditGroupInWorkLog(startTime, endTime, changeType, ch sunOrg.Id = append(sunOrg.Id, comOrg.Id) adminOrg = comOrg.Id } + // fmt.Printf("所有子级--->%v--->%v--->%v\n", sunOrg.Id, department, adminOrg) if department != "" { mastOrg := GetMyOrgSunId(department, sunOrg.Id) inWorkGroupInfo.Department = mastOrg //一级部室"` @@ -1399,7 +1508,7 @@ func (g *GroupParsingData) AddOneSchollLog(Education, EducationType, AcademicDeg firstLog.EducationCn = Education //学历中文说明"` firstLog.EducationType = EducationTypeStr(EducationType) //学历类型(1、统招;2、函授)"` firstLog.CollegeFaction = CollegeFaction //所属院系"` - firstLog.SchoolType = EducationTypeStr(SchoolType) //学历类型(院校类型(1、私立中学;2:公立中学;3:高职院校;4:民办专科院校;5:公办专科院校;6:民办本科院校;7:公办本科院校;8:”211“工程院校;9:”985“工程院校;10:双一流院校))"` + firstLog.SchoolType = SchoolTypeStr(SchoolType) //学历类型(院校类型(1、私立中学;2:公立中学;3:高职院校;4:民办专科院校;5:公办专科院校;6:民办本科院校;7:公办本科院校;8:”211“工程院校;9:”985“工程院校;10:双一流院校))"` overall.CONSTANT_DB_HR.Create(&firstLog) } @@ -1596,11 +1705,12 @@ func (g *GroupParsingData) SecondaryTableUser(info map[int]string) { # */ func (g *GroupParsingData) EditVeterans(info map[int]string, isTrue bool) { - var veteransInfo models.Veterans - err := veteransInfo.GetCont(map[string]interface{}{"`userkey`": g.UserKey}) - // fmt.Printf("退役军人:%v\n%v\n", err, veteransInfo) - if err != nil { - if info[322] != "" { + if info[322] != "" { + var veteransInfo models.Veterans + err := veteransInfo.GetCont(map[string]interface{}{"`userkey`": g.UserKey}) + // fmt.Printf("退役军人:%v\n%v\n", err, veteransInfo) + if err != nil { + veteransInfo.Userkey = g.UserKey //gned;not null;comment:员工唯一识别符;"` if isTrue { veteransInfo.IsRetire = 1 //5是否为退役军人(1:是;2:否)"` @@ -1619,26 +1729,26 @@ func (g *GroupParsingData) EditVeterans(info map[int]string, isTrue bool) { veteransInfo.TypesOfSoldiers = info[327] //5) ;comment:兵种"` veteransInfo.Time = time.Now().Unix() //t null;comment:创建时间"` overall.CONSTANT_DB_HR.Create(&veteransInfo) - } - } else { - editCont := overallhandle.MapOut() - if isTrue { - editCont["isRetire"] = 1 } else { - editCont["isRetire"] = 2 - } - editCont["retireNumber"] = info[322] - if info[323] != "" { - editCont["joinTime"] = overallhandle.ExcelDateToDate(info[323]).Unix() //ult:入伍时间"` - } - if info[324] != "" { - editCont["retireTime"] = overallhandle.ExcelDateToDate(info[324]).Unix() //default:退伍时间"` + editCont := overallhandle.MapOut() + if isTrue { + editCont["isRetire"] = 1 + } else { + editCont["isRetire"] = 2 + } + editCont["retireNumber"] = info[322] + if info[323] != "" { + editCont["joinTime"] = overallhandle.ExcelDateToDate(info[323]).Unix() //ult:入伍时间"` + } + if info[324] != "" { + editCont["retireTime"] = overallhandle.ExcelDateToDate(info[324]).Unix() //default:退伍时间"` + } + editCont["armyUnits"] = info[326] + editCont["typesOfSoldiers"] = info[327] + editCont["time"] = time.Now().Unix() + veteransInfo.EiteCont(map[string]interface{}{"`userkey`": g.UserKey}, editCont) } - editCont["armyUnits"] = info[326] - editCont["typesOfSoldiers"] = info[327] - editCont["time"] = time.Now().Unix() - veteransInfo.EiteCont(map[string]interface{}{"`userkey`": g.UserKey}, editCont) } } @@ -1836,15 +1946,17 @@ func NewAddDoubleWork(userKey int64, userNum string, info map[int]string) { # */ func GetMyOrgSunId(orgName string, orgAllId []int64) (orgId int64) { + // fmt.Printf("所有子级-GetMyOrgSunId-->%v\n", orgAllId) var orgInfo models.AdministrativeOrganization - err := orgInfo.GetCont(map[string]interface{}{"`name`": orgName}, "`id`") - // err := overall.CONSTANT_DB_HR.Model(&models.AdministrativeOrganization{}).Where("`name` LIKE ? AND `id` IN ?", orgName, orgAllId).Updates(orgInfo).Error + // err := orgInfo.GetCont(map[string]interface{}{"`name`": orgName}, "`id`") + err := overall.CONSTANT_DB_HR.Model(&models.AdministrativeOrganization{}).Where("`name` LIKE ? AND `id` IN ?", orgName, orgAllId).Find(&orgInfo).Error if err != nil { return } - if overallhandle.IsInTrue[int64](orgInfo.Id, orgAllId) { - orgId = orgInfo.Id - } + // if overallhandle.IsInTrue[int64](orgInfo.Id, orgAllId) { + // orgId = orgInfo.Id + // } + orgId = orgInfo.Id return } diff --git a/api/version1/personnelapi/userarchives.go b/api/version1/personnelapi/userarchives.go index 6e8c2cd..0c69150 100644 --- a/api/version1/personnelapi/userarchives.go +++ b/api/version1/personnelapi/userarchives.go @@ -111,18 +111,18 @@ func (s *StaffApi) PersonnelFiles(c *gin.Context) { //职称证书 synPro.Add(1) go func() { - AcademicTitle := GainCertificateHonors(myInfo.Key, 1) + AcademicTitle := GainCertificateHonors(myInfo.Key, 4) saveInfo["AcademicTitle"] = strings.Join(AcademicTitle, ",") //工作履历 }() //资格证书 synPro.Add(1) go func() { - Diploma := GainCertificateHonors(myInfo.Key, 2) + Diploma := GainCertificateHonorsBook(myInfo.Key, 4) saveInfo["Diploma"] = strings.Join(Diploma, ",") //工作履历 }() currentTime := time.Now() - years := currentTime.Year() - 1 + years := currentTime.Year() - 2 //绩效成绩 Performance score synPro.Add(1) go func() { @@ -139,11 +139,21 @@ func (s *StaffApi) PersonnelFiles(c *gin.Context) { saveInfo["Penalties"] = GainRewardsPenalties(myInfo.Key, years, 2, 2) //工作履历 }() //性格社彩 - synPro.Add(1) - go func() { - xgsc := GainCharacterColor(myInfo.Number) - saveInfo["CharacterColour"] = strings.Join(xgsc.TestNumber, "、") //工作履历 - }() + var myColor personalitycolor.Charcolortest + errColor := myColor.GetCont(map[string]interface{}{"`c_states`": 1, "`c_number`": requestData.Number}, "`c_id`") + if errColor != nil { + saveInfo["isColorTrue"] = 2 + } else { + saveInfo["isColorTrue"] = 1 + } + // synPro.Add(1) + // go func() { + // xgsc := GainCharacterColor(myInfo.Number) + // // fmt.Printf("xgsc:%v\n", xgsc) + // saveInfo["CharacterColour"] = strings.Join(xgsc.TestNumber, "、") //工作履历 + // saveInfo["ColourNameList"] = xgsc.TestNumber //工作履历 + // saveInfo["RadarColour"] = xgsc.ColorMap + // }() synPro.Wait() overallhandle.Result(0, saveInfo, c) } @@ -172,11 +182,22 @@ func GainCharacterColor(num string) (tpr TestPageColorResult) { if err != nil { return } - var testPage []TestPageColor + + GetColorVal := make(map[string]int) if myColor.TestJson != "" { - json.Unmarshal([]byte(myColor.TestJson), &testPage) + var testPage []TestPageColor + errJson := json.Unmarshal([]byte(myColor.TestJson), &testPage) + if errJson != nil { + var testPageStr []TestPageColorStr + json.Unmarshal([]byte(myColor.TestJson), &testPageStr) + GetColorVal = JiSuanColorStr(testPageStr) + } else { + GetColorVal = JiSuanColor(testPage) + } } - GetColorVal := JiSuanColor(testPage) + // fmt.Printf("TestJson-->%v\n", myColor.TestJson) + // fmt.Printf("testPage-->%v\n", testPage) + // GetColorVal = JiSuanColor(testPage) var ColorStrAry []TestPageColorVal var redColor TestPageColorVal redColor.Strval = GetColorVal["RedColor"] @@ -203,6 +224,10 @@ func GainCharacterColor(num string) (tpr TestPageColorResult) { colorAry = append(colorAry, GetColorVal["BlueColor"]) colorAry = append(colorAry, GetColorVal["YellowColor"]) colorAry = append(colorAry, GetColorVal["GreenColor"]) + + colorVal, _ := json.Marshal(ColorStrAry) + fmt.Printf("colorVal-->%v\n", string(colorVal)) + tpr.ColorMap = colorAry MaxColor := overallhandle.GetMaxNum[int](colorAry) for _, v := range ColorStrAry { if v.Strval == MaxColor { @@ -235,10 +260,88 @@ func JiSuanColor(testPage []TestPageColor) map[string]int { B_after_count := 0 C_after_count := 0 D_after_count := 0 + // fmt.Printf("testPage:%v\n", testPage) + for _, v := range testPage { + // testNumInt, _ := strconv.Atoi(v.TestNumber) + // checkedValInt, _ := strconv.Atoi(v.CheckedVal) + testNumInt := v.TestNumber + checkedValInt := v.CheckedVal + if testNumInt <= 15 { + switch checkedValInt { + case 2: + B_front_count++ + case 3: + C_front_count++ + case 4: + D_front_count++ + default: + A_front_count++ + } + } else { + switch checkedValInt { + case 2: + B_after_count++ + case 3: + C_after_count++ + case 4: + D_after_count++ + default: + A_after_count++ + } + } + } + + fmt.Printf("A_front_count: %v, B_front_count: %v, C_front_count: %v, D_front_count: %v\n", A_front_count, B_front_count, C_front_count, D_front_count) + fmt.Printf("A_after_count: %v, B_after_count: %v, C_after_count: %v, D_after_count: %v\n", A_after_count, B_after_count, C_after_count, D_after_count) + + RedColor := A_front_count + D_after_count + BlueColor := B_front_count + C_after_count + YellowColor := C_front_count + B_after_count + GreenColor := D_front_count + A_after_count + + // fmt.Printf("A_front_count: %v, D_after_count: %v, B_front_count: %v, BlueColor: %v\n", A_front_count, D_after_count, B_front_count, C_after_count) + // fmt.Printf("RedColor: %v, GreenColor: %v, YellowColor: %v, BlueColor: %v\n", RedColor, GreenColor, YellowColor, BlueColor) + sendData := make(map[string]int) + sendData["RedColor"] = RedColor + sendData["BlueColor"] = BlueColor + sendData["YellowColor"] = YellowColor + sendData["GreenColor"] = GreenColor + sendData["A_front_count"] = A_front_count + sendData["B_front_count"] = B_front_count + sendData["C_front_count"] = C_front_count + sendData["D_front_count"] = D_front_count + sendData["A_after_count"] = A_after_count + sendData["B_after_count"] = B_after_count + sendData["C_after_count"] = C_after_count + sendData["D_after_count"] = D_after_count + return sendData +} + +// 计算颜色 +func JiSuanColorStr(testPage []TestPageColorStr) map[string]int { + if len(testPage) < 1 { + sendDataw := make(map[string]int) + sendDataw["RedColor"] = 0 + sendDataw["BlueColor"] = 0 + sendDataw["YellowColor"] = 0 + sendDataw["GreenColor"] = 0 + return sendDataw + } + A_front_count := 0 + B_front_count := 0 + C_front_count := 0 + D_front_count := 0 + A_after_count := 0 + B_after_count := 0 + C_after_count := 0 + D_after_count := 0 + // fmt.Printf("testPage:%v\n", testPage) for _, v := range testPage { testNumInt, _ := strconv.Atoi(v.TestNumber) checkedValInt, _ := strconv.Atoi(v.CheckedVal) + // testNumInt := v.TestNumber + // checkedValInt := v.CheckedVal if testNumInt <= 15 { switch checkedValInt { case 2: @@ -263,10 +366,18 @@ func JiSuanColor(testPage []TestPageColor) map[string]int { } } } + + fmt.Printf("A_front_count: %v, B_front_count: %v, C_front_count: %v, D_front_count: %v\n", A_front_count, B_front_count, C_front_count, D_front_count) + fmt.Printf("A_after_count: %v, B_after_count: %v, C_after_count: %v, D_after_count: %v\n", A_after_count, B_after_count, C_after_count, D_after_count) + RedColor := A_front_count + D_after_count BlueColor := B_front_count + C_after_count YellowColor := C_front_count + B_after_count GreenColor := D_front_count + A_after_count + + // fmt.Printf("A_front_count: %v, D_after_count: %v, B_front_count: %v, BlueColor: %v\n", A_front_count, D_after_count, B_front_count, C_after_count) + // fmt.Printf("RedColor: %v, GreenColor: %v, YellowColor: %v, BlueColor: %v\n", RedColor, GreenColor, YellowColor, BlueColor) + sendData := make(map[string]int) sendData["RedColor"] = RedColor sendData["BlueColor"] = BlueColor @@ -313,7 +424,7 @@ func GainRewardsPenalties(userKey int64, years, duration, class int) map[string] // fmt.Printf("奖惩记录33333: %v\n", i) timeVal := years - i var allScore []map[string]interface{} - overall.CONSTANT_DB_HR.Model(&models.RewardsPenalties{}).Where("`state` = 1 AND `userkey` = ? AND `years` = ? AND `type` = ?", userKey, timeVal, class).Find(&allScore) + overall.CONSTANT_DB_HR.Model(&models.RewardsPenalties{}).Where("`state` = 1 AND `userkey` = ? AND `years` = ? AND `types` = ?", userKey, timeVal, class).Find(&allScore) // fmt.Printf("奖惩记录11111: %v\n", err) timeValStr := strconv.Itoa(timeVal) sendData[timeValStr] = allScore @@ -321,7 +432,7 @@ func GainRewardsPenalties(userKey int64, years, duration, class int) map[string] } } else { var allScore map[string]interface{} - overall.CONSTANT_DB_HR.Model(&models.RewardsPenalties{}).Where("`state` = 1 AND `userkey` = ? AND `years` = ? AND `type` = ?", userKey, years, class).Find(&allScore) + overall.CONSTANT_DB_HR.Model(&models.RewardsPenalties{}).Where("`state` = 1 AND `userkey` = ? AND `years` = ? AND `types` = ?", userKey, years, class).Find(&allScore) timeValStr := strconv.Itoa(years) sendData[timeValStr] = allScore } @@ -353,24 +464,30 @@ func GainTimeLangMeritslog(userKey int64, years, duration int) map[string]interf if duration > 0 { for i := duration; i >= 0; i-- { timeVal := years - i - var allScore int64 - overall.CONSTANT_DB_HR.Model(&models.Meritslog{}).Select("SUM(`score`) as scoresum").Where("`status` = 1 AND `userkey` = ? AND `years` = ?", userKey, timeVal).Find(&allScore) + // var allScore int64 + // overall.CONSTANT_DB_HR.Model(&models.Meritslog{}).Select("SUM(`score`) as `scoresum`").Where("`status` = 1 AND `userkey` = ? AND `years` = ?", userKey, timeVal).Find(&allScore) timeValStr := strconv.Itoa(timeVal) - if allScore > 0 { - sendData[timeValStr] = float64(allScore) / 10000 - } else { - sendData[timeValStr] = 0 - } + // if allScore > 0 { + // sendData[timeValStr] = float64(allScore) / 10000 + // } else { + // sendData[timeValStr] = 0 + // } + var allScore string + overall.CONSTANT_DB_HR.Model(&models.Meritslog{}).Select("`level`").Where("`status` = 1 AND `userkey` = ? AND `years` = ?", userKey, timeVal).Find(&allScore) + sendData[timeValStr] = allScore } } else { - var allScore int64 - overall.CONSTANT_DB_HR.Model(&models.Meritslog{}).Select("SUM(`score`) as scoresum").Where("`status` = 1 AND `userkey` = ? AND `years` = ?", userKey, years).Find(&allScore) + // var allScore int64 + // overall.CONSTANT_DB_HR.Model(&models.Meritslog{}).Select("SUM(`score`) as `scoresum`").Where("`status` = 1 AND `userkey` = ? AND `years` = ?", userKey, years).Find(&allScore) timeValStr := strconv.Itoa(years) - if allScore > 0 { - sendData[timeValStr] = float64(allScore) / 10000 - } else { - sendData[timeValStr] = 0 - } + // if allScore > 0 { + // sendData[timeValStr] = float64(allScore) / 10000 + // } else { + // sendData[timeValStr] = 0 + // } + var allScore string + overall.CONSTANT_DB_HR.Model(&models.Meritslog{}).Select("SUM(`score`) as `scoresum`").Where("`status` = 1 AND `userkey` = ? AND `years` = ?", userKey, years).Find(&allScore) + sendData[timeValStr] = allScore } return sendData } @@ -394,7 +511,32 @@ func GainTimeLangMeritslog(userKey int64, years, duration int) map[string]interf */ func GainCertificateHonors(userKey int64, class int) (titleList []string) { synPro.Done() - overall.CONSTANT_DB_HR.Model(&models.CertificateHonors{}).Select("`title`").Where("`state` = 1 AND `type` = ? AND `userkey` = ?", class, userKey).Find(&titleList) + // overall.CONSTANT_DB_HR.Model(&models.CertificateHonors{}).Select("`title`").Where("`state` = 1 AND `types` = ? AND `userkey` = ?", class, userKey).Find(&titleList) + overall.CONSTANT_DB_HR.Model(&models.AcademicTitle{}).Select("`types`").Where("`userkey` = ?", userKey).Find(&titleList) + return +} + +/* +* +@ 作者: 秦东 +@ 时间: 2024-02-04 13:50:10 +@ 功能: 证书 +@ 参数 + + # + +@ 返回值 + + # + +@ 方法原型 + + # +*/ +func GainCertificateHonorsBook(userKey int64, class int) (titleList []string) { + synPro.Done() + overall.CONSTANT_DB_HR.Model(&models.CertificateHonors{}).Select("`title`").Where("`state` = 1 AND `types` = ? AND `userkey` = ?", class, userKey).Find(&titleList) + // overall.CONSTANT_DB_HR.Model(&models.AcademicTitle{}).Select("`types`").Where("`userkey` = ?", userKey).Find(&titleList) return } @@ -418,7 +560,7 @@ func GainCertificateHonors(userKey int64, class int) (titleList []string) { func UserEducationalExperience(num int64) (eduExper []educatExp) { defer synPro.Done() var dowWorkMan []models.PersonnelEducation - err := overall.CONSTANT_DB_HR.Model(&models.PersonnelEducation{}).Select("`id`", "`education`", "`graduation_school`", "`subject`", "`admission_time`", "`graduation_time`", "`level`,`academic_degree`").Where("`state` = 1 AND `key` = ?", num).Order("`level` desc").Find(&dowWorkMan).Error + err := overall.CONSTANT_DB_HR.Model(&models.PersonnelEducation{}).Where("`state` = 1 AND `key` = ?", num).Order("`level` desc").Find(&dowWorkMan).Error if err != nil { return } @@ -446,3 +588,157 @@ func UserEducationalExperience(num int64) (eduExper []educatExp) { return } + +/* +* +@ 作者: 秦东 +@ 时间: 2024-02-04 15:27:53 +@ 功能: 数据库对账 +@ 参数 + + # + +@ 返回值 + + # + +@ 方法原型 + + # +*/ +// func (s *StaffApi) OneToBer(c *gin.Context) { +// var benDi []models.PersonArchives +// overall.CONSTANT_Hr_Server.Model(&models.PersonArchives{}).Select("`id`,`work_wechat`").Find(&benDi) +// // jsonCont, _ := json.Marshal(benDi) +// // fmt.Printf("jsonCont: %#v\n", string(jsonCont)) +// if len(benDi) > 0 { +// for _, v := range benDi { +// fmt.Printf("jsonCont: %#v\n", v.WorkWechat) +// if v.WorkWechat != "" { +// var newHr models.PersonArchives +// newHr.EiteCont(map[string]interface{}{"`id`": v.Id}, map[string]interface{}{"`work_wechat`": v.WorkWechat, "`eite_time`": time.Now().Unix()}) +// } +// } +// } +// } + +/* +* +@ 作者: 秦东 +@ 时间: 2024-02-06 09:01:51 +@ 功能: 获取性格色彩 +@ 参数 + + # + +@ 返回值 + + # + +@ 方法原型 + + # +*/ +func (s *StaffApi) GetPeopleColor(c *gin.Context) { + var requestData overallhandle.NmuberOverall + err := c.ShouldBindJSON(&requestData) + if err != nil { + overallhandle.Result(101, requestData, c) + return + } + if requestData.Number == "" { + overallhandle.Result(1, requestData, c, "未知人员!不可查询信息") + return + } + xgsc := GainCharacterColorNoDone(requestData.Number) + fmt.Printf("xgsc:%v\n", xgsc) + saveInfo := overallhandle.MapOut() + saveInfo["CharacterColour"] = strings.Join(xgsc.TestNumber, "、") //工作履历 + saveInfo["ColourNameList"] = xgsc.TestNumber //工作履历 + saveInfo["RadarColour"] = xgsc.ColorMap + overallhandle.Result(0, saveInfo, c) +} + +/* +* +@ 作者: 秦东 +@ 时间: 2024-01-24 08:08:43 +@ 功能: 获取性格色彩 +@ 参数 + + # + +@ 返回值 + + # + +@ 方法原型 + + # +*/ +func GainCharacterColorNoDone(num string) (tpr TestPageColorResult) { + + var myColor personalitycolor.Charcolortest + err := myColor.GetCont(map[string]interface{}{"`c_states`": 1, "`c_number`": num}) + if err != nil { + return + } + + GetColorVal := make(map[string]int) + if myColor.TestJson != "" { + var testPage []TestPageColor + errJson := json.Unmarshal([]byte(myColor.TestJson), &testPage) + if errJson != nil { + var testPageStr []TestPageColorStr + json.Unmarshal([]byte(myColor.TestJson), &testPageStr) + GetColorVal = JiSuanColorStr(testPageStr) + } else { + GetColorVal = JiSuanColor(testPage) + } + } + // fmt.Printf("TestJson-->%v\n", myColor.TestJson) + // fmt.Printf("testPage-->%v\n", testPage) + // GetColorVal = JiSuanColor(testPage) + var ColorStrAry []TestPageColorVal + var redColor TestPageColorVal + redColor.Strval = GetColorVal["RedColor"] + redColor.Name = "红色" + redColor.Setval = 1 + ColorStrAry = append(ColorStrAry, redColor) + var blueColor TestPageColorVal + blueColor.Strval = GetColorVal["BlueColor"] + blueColor.Name = "蓝色" + blueColor.Setval = 1 + ColorStrAry = append(ColorStrAry, blueColor) + var yellowColor TestPageColorVal + yellowColor.Strval = GetColorVal["YellowColor"] + yellowColor.Name = "黄色" + yellowColor.Setval = 1 + ColorStrAry = append(ColorStrAry, yellowColor) + var greenColor TestPageColorVal + greenColor.Strval = GetColorVal["GreenColor"] + greenColor.Name = "绿色" + greenColor.Setval = 1 + ColorStrAry = append(ColorStrAry, greenColor) + var colorAry []int + colorAry = append(colorAry, GetColorVal["RedColor"]) + colorAry = append(colorAry, GetColorVal["BlueColor"]) + colorAry = append(colorAry, GetColorVal["YellowColor"]) + colorAry = append(colorAry, GetColorVal["GreenColor"]) + + colorVal, _ := json.Marshal(ColorStrAry) + fmt.Printf("colorVal-->%v\n", string(colorVal)) + tpr.ColorMap = colorAry + MaxColor := overallhandle.GetMaxNum[int](colorAry) + for _, v := range ColorStrAry { + if v.Strval == MaxColor { + if !overallhandle.IsInTrue[int](v.Setval, tpr.CheckedVal) { + tpr.CheckedVal = append(tpr.CheckedVal, v.Setval) + } + if !overallhandle.IsInTrue[string](v.Name, tpr.TestNumber) { + tpr.TestNumber = append(tpr.TestNumber, v.Name) + } + } + } + return +} diff --git a/api/version1/workWechat/wechatApi.go b/api/version1/workWechat/wechatApi.go index aef1296..2b187d9 100644 --- a/api/version1/workWechat/wechatApi.go +++ b/api/version1/workWechat/wechatApi.go @@ -232,7 +232,7 @@ func (a *ApiMethod) CallBackAuthUser(c *gin.Context) { } wechatCont, err := SetUpWechatInfo(userWechatId) if err != nil { - overallhandle.Result(13, err, c) + overallhandle.Result(13, err, c, "未能查询到您的信息!企业微信授权失败!") return } callBackLoginUrl := fmt.Sprintf("%v/#/?usernum=%v&openid=%v&userkey=%v&token=%v", overall.CONSTANT_CONFIG.Appsetup.WebUrl, userNum, wechatCont.UserInfo.Number, wechatCont.UserKey, wechatCont.Token) diff --git a/apirouter/personnel/people.go b/apirouter/personnel/people.go index c1633be..367854c 100644 --- a/apirouter/personnel/people.go +++ b/apirouter/personnel/people.go @@ -21,6 +21,8 @@ func (p *PersonnelRoute) InitRouterGroup(route *gin.RouterGroup) { apiRouter.POST("archiveslistcont", apiHandle.ArchivesListCont) //人员档案列表(平台用) apiRouter.POST("archivescont", apiHandle.ArchivesCon) //个人档案 apiRouter.POST("personnelFiles", apiHandle.PersonnelFiles) //根据工号获取个人档案 + apiRouter.POST("getPeopleColor", apiHandle.GetPeopleColor) //根据工号获取个人档案 + // apiRouter.POST("oneToBer", apiHandle.OneToBer) //根据工号获取个人档案 apiRouter.POST("kingdeehr", apiHandle.NewKingdee) //对接金蝶HR系统 apiRouter.POST("editpassword", apiHandle.EditPassWord) //修改密码 @@ -82,8 +84,10 @@ func (p *PersonnelRoute) InitRouterGroup(route *gin.RouterGroup) { apiRouter.POST("getorgtimerate", apiHandle.GetOrgTimeRate) //获取公司指定年月的离职率 apiRouter.POST("get_edu_stru", apiHandle.GetEducationalStructure) //获取学历结构 - apiRouter.POST("uploadUserFiles", apiHandle.UploadUserFiles) //解析上传的人员信息表格 + apiRouter.POST("uploadUserFiles", apiHandle.UploadUserFiles) //解析上传的人员信息表格 + apiRouter.POST("uploadUserFilesRedis", apiHandle.UploadUserFilesRedis) //解析上传的人员信息表格 + apiRouter.POST("analysisRedisExelect", apiHandle.AnalysisRedisExelect) //解析Redis列表中的数据 } } diff --git a/config/configDatabase/database.go b/config/configDatabase/database.go index 4434cec..22d44a7 100644 --- a/config/configDatabase/database.go +++ b/config/configDatabase/database.go @@ -16,6 +16,7 @@ type MysqlSetUp struct { HrMysql MasterMysqlSetUp `mapstructure:"hrdatabase" json:"hrdatabase" yaml:"hrdatabase"` //HR数据库 HrMysqlJin MasterMysqlSetUp `mapstructure:"hrdatabasejin" json:"hrdatabasejin" yaml:"hrdatabasejin"` //HR数据库 PersonalityColor MasterMysqlSetUp `mapstructure:"charactercolor" json:"charactercolor" yaml:"charactercolor"` //HR数据库 + // HrNeiSever MasterMysqlSetUp `mapstructure:"hrNeiSever" json:"hrNeiSever" yaml:"hrNeiSever"` //HR数据库 } type MasterMysqlSetUp struct { diff --git a/config/configDatabase/database.yaml b/config/configDatabase/database.yaml index f7dff19..52b2dfb 100644 --- a/config/configDatabase/database.yaml +++ b/config/configDatabase/database.yaml @@ -33,6 +33,11 @@ hrdatabase: # username: 'root' #数据库用户民 # password: 'root' #数据库密码 + # url_path: '172.20.2.87' #数据库地址 + # port: 3306 #数据库端口 + # username: 'hr_new' #数据库用户民 + # password: 'AnknKiXiXaxNrw78' #数据库密码 + url_path: '172.20.5.33' #数据库地址 port: 4000 #数据库端口 username: 'root' #数据库用户民 @@ -44,7 +49,7 @@ hrdatabase: name: 'hr_new' #数据库名称 max_idle_conns: 100 #最大空闲数量 max_open_conns: 1500 #最大打开数量 - gorm_log: true #是否开启gorm日志 + gorm_log: false #是否开启gorm日志 #HR数据库 hrdatabasejin: # url_path: '127.0.0.1' #数据库地址 @@ -63,7 +68,7 @@ hrdatabasejin: name: 'human_resources' #数据库名称 max_idle_conns: 100 #最大空闲数量 max_open_conns: 1500 #最大打开数量 - gorm_log: true #是否开启gorm日志 + gorm_log: false #是否开启gorm日志 #性格色彩 charactercolor: url_path: '172.20.5.33' #数据库地址 @@ -76,4 +81,24 @@ charactercolor: password: '9z_Bu28r1*DZ3K6@+a' #数据库密码 max_idle_conns: 100 #最大空闲数量 max_open_conns: 1500 #最大打开数量 + gorm_log: false #是否开启gorm日志 + +#HR数据库 +hrNeiSever: + url_path: '127.0.0.1' #数据库地址 + port: 3306 #数据库端口 + username: 'root' #数据库用户民 + password: 'root' #数据库密码 + + # url_path: '172.20.2.87' #数据库地址 + # port: 3306 #数据库端口 + # username: 'hr_new' #数据库用户民 + # password: 'AnknKiXiXaxNrw78' #数据库密码 + + charset: 'utf8mb4' #数据库编码方式 + parseTime: 'True' #是否自动转换时间 + loc: 'Local' #时区 + name: 'hr_new' #数据库名称 + max_idle_conns: 100 #最大空闲数量 + max_open_conns: 1500 #最大打开数量 gorm_log: false #是否开启gorm日志 \ No newline at end of file diff --git a/hr_server.exe b/hr_server.exe index fdd24e7..6fdda4c 100644 Binary files a/hr_server.exe and b/hr_server.exe differ diff --git a/initialization/databaseinit/mysql.go b/initialization/databaseinit/mysql.go index 22a371c..7a32074 100644 --- a/initialization/databaseinit/mysql.go +++ b/initialization/databaseinit/mysql.go @@ -44,4 +44,11 @@ func LoadDatabase() { } else { fmt.Printf("%v数据库开启成功!\n", sqlConfig.PersonalityColor.Name) } + //开启内网数据库 + // overall.CONSTANT_Hr_Server = sqlConfig.HrNeiSever.OpenSql() + // if overall.CONSTANT_Personality_Color == nil { + // fmt.Printf("%v数据库开启失1败!\n", sqlConfig.HrNeiSever.Name) + // } else { + // fmt.Printf("%v数据库开启成1功!\n", sqlConfig.HrNeiSever.Name) + // } } diff --git a/models/certificate_honors.go b/models/certificate_honors.go index 61feb74..bcd02d7 100644 --- a/models/certificate_honors.go +++ b/models/certificate_honors.go @@ -42,3 +42,9 @@ func (cont *CertificateHonors) GetCont(whereMap interface{}, field ...string) (e err = gormDb.First(&cont).Error return } + +// 删除内容 +func (cont *CertificateHonors) DelCont(whereMap interface{}) (err error) { + err = overall.CONSTANT_DB_HR.Where(whereMap).Delete(&cont).Error + return +} diff --git a/models/personarchives.go b/models/personarchives.go index 4183df2..bf36345 100644 --- a/models/personarchives.go +++ b/models/personarchives.go @@ -40,7 +40,7 @@ type PersonArchives struct { 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"` WorkSection int64 `json:"workSection" gorm:"column:work_section;type:bigint(20) unsigned;default:0;not null;comment:工段"` - IsLock int `json:"isLock" gorm:"column:isLock;type:int(1) unsigned;default:1;not null;comment:信息是否锁定` + IsShowTrue int64 `json:"isShowTrue" gorm:"column:is_show_true;type:int(5) unsigned;default:2;not null;comment:信息是否锁定` } func (PersonArchives *PersonArchives) TableName() string { diff --git a/overall/app_config_const.go b/overall/app_config_const.go index 82fd73d..e8c6a51 100644 --- a/overall/app_config_const.go +++ b/overall/app_config_const.go @@ -17,6 +17,7 @@ var ( CONSTANT_DB_HR *gorm.DB //微信数据库 CONSTANT_DB_HR_Jin *gorm.DB //微信数据库 CONSTANT_Personality_Color *gorm.DB //性格色彩 + CONSTANT_Hr_Server *gorm.DB //性格色彩 //Redis CONSTANT_REDIS0 *redis.Client CONSTANT_REDIS1 *redis.Client diff --git a/overall/overallhandle/overall_handle.go b/overall/overallhandle/overall_handle.go index 9051c08..1b8f7bc 100644 --- a/overall/overallhandle/overall_handle.go +++ b/overall/overallhandle/overall_handle.go @@ -185,6 +185,27 @@ func DateToTimeStamp(dataStr string) (timeStamp int64, isTrue bool) { } return } +func DateToTimeStampDay(dataStr string) (timeStamp int64, isTrue bool, err error) { + // fmt.Printf("记不清威威--->%v\n", dataStr) + isTrue = false + tmp := "2006-01-02" + res, err := time.ParseInLocation(tmp, dataStr, time.Local) + timeStamp = res.Unix() + if err == nil { + isTrue = true + } + // fmt.Printf("记不清威威--2->%v\n", dataStr) + if !isTrue { + tmp := "2006/01/02" + res, err := time.ParseInLocation(tmp, dataStr, time.Local) + // fmt.Printf("记不清威威--3->%v\n", err) + timeStamp = res.Unix() + if err == nil { + isTrue = true + } + } + return +} // 数据库查询翻页 func LimitPage(page, pageSize int) (offSet int) { @@ -836,7 +857,7 @@ func GetOrgStructure(orgId int64) (groupId, companyId, departmentId, sunDepartId if err != nil { return } - fmt.Printf("获取集团属性--->%v\n", orgContTypeInfo.Level) + // fmt.Printf("获取集团属性--->%v\n", orgContTypeInfo.Level) switch orgContTypeInfo.Level { case 1: groupId = orgContTypeInfo.Id @@ -1126,6 +1147,7 @@ func HestacademicdegreeToInt(hir string) int { } // 根据字符串组合时间 +//补全时间 /* #dateTime 日期 */ @@ -1559,7 +1581,7 @@ func GetXueWeiClass(level int64) string { case 3: return "最高学历" default: - return "普通" + return "其他学历" } } @@ -1898,9 +1920,21 @@ func (g *GetOrgAllParent) GetOrgSonAllId(orgId int64) { # */ func ExcelDateToDate(excelDate string) time.Time { - excelTime := time.Date(1899, time.December, 30, 0, 0, 0, 0, time.UTC) - var days, _ = strconv.ParseFloat(excelDate, 64) - return excelTime.Add(time.Second * time.Duration(days*86400)) + timeInt, isTrue, _ := DateToTimeStampDay(excelDate) + // fmt.Printf("事件处理-222-->%v\n", err) + if isTrue { + // fmt.Printf("事件处理-222-3->%v\n", timeInt) + excelDateStrs := UnixTimeToDay(timeInt, 14) + // fmt.Printf("事件处理-222-4->%v\n", excelDateStrs) + return StringToTimeIng("d", excelDateStrs) + } else { + // fmt.Printf("事件处理--->%v\n", excelDate) + excelTime := time.Date(1899, time.December, 30, 0, 0, 0, 0, time.UTC) + var days, _ = strconv.ParseFloat(excelDate, 64) + // fmt.Printf("事件处理--1->%v\n", days) + return excelTime.Add(time.Second * time.Duration(days*86400)) + } + } /*