|
|
@ -7,6 +7,7 @@ import ( |
|
|
"hr_server/overall" |
|
|
"hr_server/overall" |
|
|
"hr_server/overall/overallhandle" |
|
|
"hr_server/overall/overallhandle" |
|
|
"strconv" |
|
|
"strconv" |
|
|
|
|
|
"strings" |
|
|
"time" |
|
|
"time" |
|
|
|
|
|
|
|
|
"github.com/gin-gonic/gin" |
|
|
"github.com/gin-gonic/gin" |
|
|
@ -1533,11 +1534,35 @@ func (s *StaffApi) WorkHistoryList(c *gin.Context) { |
|
|
} |
|
|
} |
|
|
var insideWorkHistoryList []models.WorkHistory |
|
|
var insideWorkHistoryList []models.WorkHistory |
|
|
gormDb := overall.CONSTANT_DB_HR.Model(&models.WorkHistory{}).Where("`state` IN (1,2) AND `key` = ?", requestData.Id) |
|
|
gormDb := overall.CONSTANT_DB_HR.Model(&models.WorkHistory{}).Where("`state` IN (1,2) AND `key` = ?", requestData.Id) |
|
|
err := gormDb.Order("`id` desc").Find(&insideWorkHistoryList).Error |
|
|
err := gormDb.Order("`entrytime` desc").Order("`id` desc").Find(&insideWorkHistoryList).Error |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
overallhandle.Result(107, err, c) |
|
|
overallhandle.Result(107, err, c) |
|
|
} else { |
|
|
} else { |
|
|
overallhandle.Result(0, insideWorkHistoryList, c) |
|
|
var sendDataList []outWorkHistory |
|
|
|
|
|
for _, w := range insideWorkHistoryList { |
|
|
|
|
|
var sendCont outWorkHistory |
|
|
|
|
|
sendCont.Id = w.Id //
|
|
|
|
|
|
sendCont.Number = w.Number // 工号"`
|
|
|
|
|
|
sendCont.Key = w.Key // 身份识别"`
|
|
|
|
|
|
sendCont.Company = w.Company // 公司"`
|
|
|
|
|
|
sendCont.Deparment = w.Deparment // 部门"`
|
|
|
|
|
|
sendCont.Job = w.Job // 职务"`
|
|
|
|
|
|
sendCont.EntryTime = w.EntryTime // 入职时间"`
|
|
|
|
|
|
sendCont.Leavedate = w.Leavedate // 离职日期"`
|
|
|
|
|
|
sendCont.Witness = w.Witness // 证明人"`
|
|
|
|
|
|
sendCont.WitnessTel = w.WitnessTel // 证明人电话"`
|
|
|
|
|
|
sendCont.Remarks = w.Remarks // 备注"`
|
|
|
|
|
|
sendCont.Time = w.Time // 创建时间"`
|
|
|
|
|
|
sendCont.State = w.State // 状态(1:启用;2:禁用;3:删除)"`
|
|
|
|
|
|
sendCont.StartTime = overallhandle.UnixTimeToDay(w.EntryTime, 14) //开始时间
|
|
|
|
|
|
endTimeStr := "至今" |
|
|
|
|
|
if w.Leavedate != 0 { |
|
|
|
|
|
endTimeStr = overallhandle.UnixTimeToDay(w.Leavedate, 14) |
|
|
|
|
|
} |
|
|
|
|
|
sendCont.EndTime = endTimeStr //结束时间
|
|
|
|
|
|
sendDataList = append(sendDataList, sendCont) |
|
|
|
|
|
} |
|
|
|
|
|
overallhandle.Result(0, sendDataList, c) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -1555,7 +1580,28 @@ func (s *StaffApi) PersonnelEducationList(c *gin.Context) { |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
overallhandle.Result(107, err, c) |
|
|
overallhandle.Result(107, err, c) |
|
|
} else { |
|
|
} else { |
|
|
overallhandle.Result(0, insideWorkHistoryList, c) |
|
|
var list []OutpersonCont |
|
|
|
|
|
for _, v := range insideWorkHistoryList { |
|
|
|
|
|
var cont OutpersonCont |
|
|
|
|
|
cont.Id = v.Id //ID"`
|
|
|
|
|
|
cont.Number = v.Number //员工工号"`
|
|
|
|
|
|
cont.Education = v.Education // 学历(1:初中及以下;2:中专;3:高中;4:中技;5:高技;6:函数专科;7:大学专科;8:函数本科;9:大学本科;10:硕士研究生;11:博士研究生;12:专家、教授)"`
|
|
|
|
|
|
cont.GraduationSchool = v.GraduationSchool //毕业学校"`
|
|
|
|
|
|
cont.Subject = v.Subject //专业"`
|
|
|
|
|
|
cont.AdmissionTime = v.AdmissionTime //入学时间"`
|
|
|
|
|
|
cont.GraduationTime = v.GraduationTime //毕业时间"`
|
|
|
|
|
|
cont.Time = v.Time //写入时间"`
|
|
|
|
|
|
cont.Level = v.Level // 学历类型(1:普通;2:第一学历;3:最高学历)"`
|
|
|
|
|
|
cont.AcademicDegree = v.AcademicDegree // 学位(1:无;2:学士;3:硕士;4:博士)"`
|
|
|
|
|
|
cont.Key = v.Key //key"`
|
|
|
|
|
|
cont.State = v.State // 状态(1:启用;2:禁用;3:删除)"`
|
|
|
|
|
|
cont.AcademicDegreeCn = v.AcademicDegreeCn //学位中文说明"`
|
|
|
|
|
|
cont.EducationCn = v.EducationCn //学历中文说明"`
|
|
|
|
|
|
cont.AdmissionTimeStr = overallhandle.UnixTimeToDay(v.AdmissionTime, 14) |
|
|
|
|
|
cont.GraduationTimeStr = overallhandle.UnixTimeToDay(v.GraduationTime, 14) |
|
|
|
|
|
list = append(list, cont) |
|
|
|
|
|
} |
|
|
|
|
|
overallhandle.Result(0, list, c) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -1955,3 +2001,405 @@ func (s *StaffApi) ArchivesListExporCsv(c *gin.Context) { |
|
|
overallhandle.Result(1, filename, c) |
|
|
overallhandle.Result(1, filename, c) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
@ 作者: 秦东 |
|
|
|
|
|
@ 时间: 2022-11-27 10:04:01 |
|
|
|
|
|
@ 功能: 获取单个人员档案 |
|
|
|
|
|
@ 参数 |
|
|
|
|
|
# |
|
|
|
|
|
@ 返回值 |
|
|
|
|
|
# |
|
|
|
|
|
@ 方法原型 |
|
|
|
|
|
# |
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
func (s *StaffApi) GetArchivesCon(c *gin.Context) { |
|
|
|
|
|
var requestData overallhandle.GetId |
|
|
|
|
|
c.ShouldBindJSON(&requestData) |
|
|
|
|
|
if requestData.IdStr == "" && requestData.Id == 0 { |
|
|
|
|
|
overallhandle.Result(101, requestData, c) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
if requestData.IdStr != "" { |
|
|
|
|
|
idInt, idErr := strconv.ParseInt(requestData.IdStr, 10, 64) |
|
|
|
|
|
if idErr == nil { |
|
|
|
|
|
requestData.Id = idInt |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
var satffCont models.ManCont |
|
|
|
|
|
staffErr := satffCont.GetCont(map[string]interface{}{"`id`": requestData.Id}) |
|
|
|
|
|
if staffErr != nil { |
|
|
|
|
|
overallhandle.Result(105, staffErr, c) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
var staffCenter staffArchivesCont |
|
|
|
|
|
staffCenter.ManCont = satffCont |
|
|
|
|
|
staffCenter.IdStr = strconv.FormatInt(satffCont.Id, 10) |
|
|
|
|
|
if satffCont.Birthday != 0 { |
|
|
|
|
|
staffCenter.BirthdayTime = overallhandle.UnixTimeToDay(satffCont.Birthday, 14) //生日
|
|
|
|
|
|
} |
|
|
|
|
|
if satffCont.Idcardstartdate != 0 { |
|
|
|
|
|
staffCenter.IdCardStartTimeData = overallhandle.UnixTimeToDay(satffCont.Idcardstartdate, 14) //身份证有效期开始时间
|
|
|
|
|
|
} |
|
|
|
|
|
if satffCont.Idcardenddate != 0 { |
|
|
|
|
|
staffCenter.IdCardEndTimeData = overallhandle.UnixTimeToDay(satffCont.Idcardenddate, 14) //身份证有效期结束时间
|
|
|
|
|
|
} |
|
|
|
|
|
if satffCont.Entrydate != 0 { |
|
|
|
|
|
staffCenter.EntrydateTime = overallhandle.UnixTimeToDay(satffCont.Entrydate, 14) //入职日期
|
|
|
|
|
|
} |
|
|
|
|
|
if satffCont.Planformaldate != 0 { |
|
|
|
|
|
staffCenter.PlanformaldateTime = overallhandle.UnixTimeToDay(satffCont.Planformaldate, 14) //预计转正日期
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if satffCont.Jobstartdate != 0 { |
|
|
|
|
|
staffCenter.JobstartdateStr = overallhandle.UnixTimeToDay(satffCont.Jobstartdate, 14) //参加工作日期
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if satffCont.Entrydate != 0 { |
|
|
|
|
|
staffCenter.EntrydateStr = overallhandle.UnixTimeToDay(satffCont.Entrydate, 14) //入职日期
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// if satffCont.Company != 0 {
|
|
|
|
|
|
// var groupInfos models.AdministrativeOrganization
|
|
|
|
|
|
// groupInfos.GetCont(map[string]interface{}{"`id`": satffCont.Company}, "`name`")
|
|
|
|
|
|
// staffCenter.CompanyName = groupInfos.Name
|
|
|
|
|
|
// }
|
|
|
|
|
|
// if satffCont.MainDeparment != 0 {
|
|
|
|
|
|
// var demperMainInfos models.AdministrativeOrganization
|
|
|
|
|
|
// demperMainInfos.GetCont(map[string]interface{}{"`id`": satffCont.MainDeparment}, "`name`")
|
|
|
|
|
|
// staffCenter.MainDeparmentName = demperMainInfos.Name
|
|
|
|
|
|
// }
|
|
|
|
|
|
// if satffCont.AdminOrg != 0 {
|
|
|
|
|
|
// var adminOrg models.AdministrativeOrganization
|
|
|
|
|
|
// adminOrg.GetCont(map[string]interface{}{"`id`": satffCont.AdminOrg}, "`name`")
|
|
|
|
|
|
// staffCenter.AdminOrgName = adminOrg.Name
|
|
|
|
|
|
// }
|
|
|
|
|
|
if satffCont.Position != 0 { |
|
|
|
|
|
var postisInfo models.Position |
|
|
|
|
|
postisInfo.GetCont(map[string]interface{}{"`id`": satffCont.Position}, "`name`", "`person_in_charge`") |
|
|
|
|
|
staffCenter.PositionName = postisInfo.Name |
|
|
|
|
|
staffCenter.PersonInCharge = postisInfo.PersonInCharge |
|
|
|
|
|
} |
|
|
|
|
|
if satffCont.JobClass != 0 { |
|
|
|
|
|
var jobsInfo models.JobClass |
|
|
|
|
|
jobsInfo.GetCont(map[string]interface{}{"`id`": satffCont.JobClass}, "`name`") |
|
|
|
|
|
staffCenter.JobClassName = jobsInfo.Name |
|
|
|
|
|
} |
|
|
|
|
|
if satffCont.JobId != 0 { |
|
|
|
|
|
var dutiresInfo models.Duties |
|
|
|
|
|
dutiresInfo.GetCont(map[string]interface{}{"`id`": satffCont.JobId}, "`name`") |
|
|
|
|
|
staffCenter.JobIdName = dutiresInfo.Name |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if satffCont.Company != 0 { |
|
|
|
|
|
var comCont models.AdministrativeOrganization |
|
|
|
|
|
comCont.GetCont(map[string]interface{}{"`id`": satffCont.Company}, "`name`") |
|
|
|
|
|
staffCenter.CompanyName = comCont.Name //公司名称
|
|
|
|
|
|
if overallhandle.IsInTrue[int64](satffCont.Company, staffCenter.AllOrgList) == false { |
|
|
|
|
|
staffCenter.AllOrgList = append(staffCenter.AllOrgList, satffCont.Company) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
if satffCont.MainDeparment != 0 { |
|
|
|
|
|
var mainDepartCont models.AdministrativeOrganization |
|
|
|
|
|
mainDepartCont.GetCont(map[string]interface{}{"`id`": satffCont.MainDeparment}, "`name`") |
|
|
|
|
|
staffCenter.MainDeparmentName = mainDepartCont.Name //主部门
|
|
|
|
|
|
if overallhandle.IsInTrue[int64](satffCont.MainDeparment, staffCenter.AllOrgList) == false { |
|
|
|
|
|
staffCenter.AllOrgList = append(staffCenter.AllOrgList, satffCont.MainDeparment) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
if satffCont.SunMainDeparment != 0 { |
|
|
|
|
|
var sunDepartCont models.AdministrativeOrganization |
|
|
|
|
|
sunDepartCont.GetCont(map[string]interface{}{"`id`": satffCont.SunMainDeparment}, "`name`") |
|
|
|
|
|
staffCenter.SunMainDeparmentName = sunDepartCont.Name //二级部门
|
|
|
|
|
|
if overallhandle.IsInTrue[int64](satffCont.SunMainDeparment, staffCenter.AllOrgList) == false { |
|
|
|
|
|
staffCenter.AllOrgList = append(staffCenter.AllOrgList, satffCont.SunMainDeparment) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
if satffCont.TeamId != 0 { |
|
|
|
|
|
var teamCont models.TeamGroup |
|
|
|
|
|
teamCont.GetCont(map[string]interface{}{"`id`": satffCont.TeamId}, "`name`") |
|
|
|
|
|
staffCenter.TeamName = teamCont.Name //班组名
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if satffCont.Company != staffCenter.AdminOrg && satffCont.MainDeparment != staffCenter.AdminOrg && satffCont.SunMainDeparment != staffCenter.AdminOrg { |
|
|
|
|
|
var orgCont models.AdministrativeOrganization |
|
|
|
|
|
orgCont.GetCont(map[string]interface{}{"`id`": satffCont.AdminOrg}, "`name`") |
|
|
|
|
|
staffCenter.WorkPostName = orgCont.Name //工段
|
|
|
|
|
|
if overallhandle.IsInTrue[int64](satffCont.AdminOrg, staffCenter.AllOrgList) == false { |
|
|
|
|
|
staffCenter.AllOrgList = append(staffCenter.AllOrgList, satffCont.AdminOrg) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
staffCenter.PoliticalOutlookName = overallhandle.PolitiToString(satffCont.PoliticalOutlook) |
|
|
|
|
|
|
|
|
|
|
|
overallhandle.Result(0, staffCenter, c) |
|
|
|
|
|
// return
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
|
* |
|
|
|
|
|
@ 作者: 秦东 |
|
|
|
|
|
@ 时间: 2022-11-27 10:28:31 |
|
|
|
|
|
@ 功能: 获取员工主信息 |
|
|
|
|
|
@ 参数 |
|
|
|
|
|
|
|
|
|
|
|
# |
|
|
|
|
|
|
|
|
|
|
|
@ 返回值 |
|
|
|
|
|
|
|
|
|
|
|
# |
|
|
|
|
|
|
|
|
|
|
|
@ 方法原型 |
|
|
|
|
|
|
|
|
|
|
|
# |
|
|
|
|
|
*/ |
|
|
|
|
|
func (s *StaffApi) GetPeopleMainCont(c *gin.Context) { |
|
|
|
|
|
var requestData overallhandle.GetId |
|
|
|
|
|
c.ShouldBindJSON(&requestData) |
|
|
|
|
|
if requestData.IdStr == "" && requestData.Id == 0 { |
|
|
|
|
|
overallhandle.Result(101, requestData, c) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
if requestData.IdStr != "" { |
|
|
|
|
|
idInt, idErr := strconv.ParseInt(requestData.IdStr, 10, 64) |
|
|
|
|
|
if idErr == nil { |
|
|
|
|
|
requestData.Id = idInt |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
var myCont models.PersonArchives |
|
|
|
|
|
err := myCont.GetCont(map[string]interface{}{"`id`": requestData.Id}, "`id`", "`number`", "`name`", "`icon`", "`admin_org`", "`position`", "`teamid`", "`job_id`", "`job_class`", "`job_leve`", "`wechat`", "`work_wechat`", "`key`", "`company`", "`maindeparment`", "`sun_main_deparment`") |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
overallhandle.Result(107, requestData, c) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
var myInfo MyMainCont |
|
|
|
|
|
myInfo.Id = strconv.FormatInt(myCont.Id, 10) |
|
|
|
|
|
myInfo.Key = strconv.FormatInt(myCont.Key, 10) //员工key
|
|
|
|
|
|
myInfo.Number = myCont.Number //员工工号
|
|
|
|
|
|
myInfo.Name = myCont.Name //姓名
|
|
|
|
|
|
myInfo.Icon = myCont.Icon //头像
|
|
|
|
|
|
myInfo.AdminOrg = myCont.AdminOrg //所属行政组织
|
|
|
|
|
|
myInfo.TeamId = myCont.TeamId //班组
|
|
|
|
|
|
myInfo.Position = myCont.Position //职位
|
|
|
|
|
|
myInfo.JobClass = myCont.JobClass //职务分类
|
|
|
|
|
|
myInfo.JobId = myCont.JobId //职务
|
|
|
|
|
|
myInfo.JobLeve = myCont.JobLeve //职务等级
|
|
|
|
|
|
myInfo.Wechat = myCont.Wechat //微信UserId"`
|
|
|
|
|
|
myInfo.WorkWechat = myCont.WorkWechat //`企业微信UserId"`
|
|
|
|
|
|
if myCont.Company != 0 { |
|
|
|
|
|
var comCont models.AdministrativeOrganization |
|
|
|
|
|
comCont.GetCont(map[string]interface{}{"`id`": myCont.Company}, "`name`") |
|
|
|
|
|
myInfo.CompanyName = comCont.Name //公司名称
|
|
|
|
|
|
} |
|
|
|
|
|
if myCont.MainDeparment != 0 { |
|
|
|
|
|
var mainDepartCont models.AdministrativeOrganization |
|
|
|
|
|
mainDepartCont.GetCont(map[string]interface{}{"`id`": myCont.MainDeparment}, "`name`") |
|
|
|
|
|
myInfo.MainDeparmentName = mainDepartCont.Name //主部门
|
|
|
|
|
|
} |
|
|
|
|
|
if myCont.SunMainDeparment != 0 { |
|
|
|
|
|
var sunDepartCont models.AdministrativeOrganization |
|
|
|
|
|
sunDepartCont.GetCont(map[string]interface{}{"`id`": myCont.SunMainDeparment}, "`name`") |
|
|
|
|
|
myInfo.SunMainDeparmentName = sunDepartCont.Name //二级部门
|
|
|
|
|
|
} |
|
|
|
|
|
if myCont.TeamId != 0 { |
|
|
|
|
|
var teamCont models.TeamGroup |
|
|
|
|
|
teamCont.GetCont(map[string]interface{}{"`id`": myCont.TeamId}, "`name`") |
|
|
|
|
|
myInfo.TeamName = teamCont.Name //班组名
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if myCont.Company != myInfo.AdminOrg && myCont.MainDeparment != myInfo.AdminOrg && myCont.SunMainDeparment != myInfo.AdminOrg { |
|
|
|
|
|
var orgCont models.AdministrativeOrganization |
|
|
|
|
|
orgCont.GetCont(map[string]interface{}{"`id`": myCont.AdminOrg}, "`name`") |
|
|
|
|
|
myInfo.WorkPostName = orgCont.Name //工段
|
|
|
|
|
|
} |
|
|
|
|
|
if myCont.Position != 0 { |
|
|
|
|
|
var postCont models.Position |
|
|
|
|
|
postCont.GetCont(map[string]interface{}{"`id`": myCont.Position}, "`name`") |
|
|
|
|
|
myInfo.PositionName = postCont.Name //岗位名称
|
|
|
|
|
|
} |
|
|
|
|
|
if myCont.JobClass != 0 { |
|
|
|
|
|
var jobClassCont models.JobClass |
|
|
|
|
|
jobClassCont.GetCont(map[string]interface{}{"`id`": myCont.JobClass}, "`name`") |
|
|
|
|
|
myInfo.JobClassName = jobClassCont.Name //职务分类
|
|
|
|
|
|
} |
|
|
|
|
|
if myCont.JobId != 0 { |
|
|
|
|
|
var jobCont models.Duties |
|
|
|
|
|
jobCont.GetCont(map[string]interface{}{"`id`": myCont.JobId}, "`name`") |
|
|
|
|
|
myInfo.JobName = jobCont.Name //职务名称
|
|
|
|
|
|
} |
|
|
|
|
|
switch myCont.JobLeve { |
|
|
|
|
|
case 1: |
|
|
|
|
|
myInfo.JobLeveName = "一级" |
|
|
|
|
|
case 2: |
|
|
|
|
|
myInfo.JobLeveName = "二级" |
|
|
|
|
|
case 3: |
|
|
|
|
|
myInfo.JobLeveName = "三级" |
|
|
|
|
|
default: |
|
|
|
|
|
myInfo.JobLeveName = "" |
|
|
|
|
|
} |
|
|
|
|
|
var manContEs models.PersonnelContent |
|
|
|
|
|
manContEs.GetCont(map[string]interface{}{"`key`": myCont.Key}, "`mobilephone`") |
|
|
|
|
|
myInfo.Tel = manContEs.Mobilephone |
|
|
|
|
|
overallhandle.Result(0, myInfo, c) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
|
* |
|
|
|
|
|
@ 作者: 秦东 |
|
|
|
|
|
@ 时间: 2022-11-29 13:28:34 |
|
|
|
|
|
@ 功能: 获取集团内部工作经历列表 |
|
|
|
|
|
@ 参数 |
|
|
|
|
|
|
|
|
|
|
|
# |
|
|
|
|
|
|
|
|
|
|
|
@ 返回值 |
|
|
|
|
|
|
|
|
|
|
|
# |
|
|
|
|
|
|
|
|
|
|
|
@ 方法原型 |
|
|
|
|
|
|
|
|
|
|
|
# |
|
|
|
|
|
*/ |
|
|
|
|
|
func (s *StaffApi) GetInsideWorkHistoryList(c *gin.Context) { |
|
|
|
|
|
var requestData allocationOfRightsToRole |
|
|
|
|
|
c.ShouldBindJSON(&requestData) |
|
|
|
|
|
if requestData.Id == "" { |
|
|
|
|
|
overallhandle.Result(101, requestData.Id, c) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
var insideWorkHistoryList []models.InsideWorkHistory |
|
|
|
|
|
gormDb := overall.CONSTANT_DB_HR.Model(&models.InsideWorkHistory{}).Where("`state` = 1 AND `key` = ?", requestData.Id) |
|
|
|
|
|
err := gormDb.Order("end_time asc").Order("start_time desc").Order("`id` desc").Find(&insideWorkHistoryList).Error |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
overallhandle.Result(107, err, c) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
// orgId :=
|
|
|
|
|
|
var sendData []outInsetWork |
|
|
|
|
|
for _, v := range insideWorkHistoryList { |
|
|
|
|
|
orgId := v.Group |
|
|
|
|
|
if v.Company != 0 { |
|
|
|
|
|
orgId = v.Company |
|
|
|
|
|
} |
|
|
|
|
|
if v.Department != 0 { |
|
|
|
|
|
orgId = v.Department |
|
|
|
|
|
} |
|
|
|
|
|
if v.WorkShop != 0 { |
|
|
|
|
|
orgId = v.WorkShop |
|
|
|
|
|
} |
|
|
|
|
|
if v.WorkshopSection != 0 { |
|
|
|
|
|
orgId = v.WorkshopSection |
|
|
|
|
|
} |
|
|
|
|
|
_, companyId, departmentId, sunDepartId, workShopId := overallhandle.GetOrgStructure(orgId) |
|
|
|
|
|
allOrgName := "" |
|
|
|
|
|
if companyId != 0 { |
|
|
|
|
|
var companyCont models.AdministrativeOrganization |
|
|
|
|
|
errCom := companyCont.GetCont(map[string]interface{}{"`id`": companyId}, "`name`") |
|
|
|
|
|
if errCom == nil { |
|
|
|
|
|
allOrgName = companyCont.Name |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
if departmentId != 0 { |
|
|
|
|
|
var departCont models.AdministrativeOrganization |
|
|
|
|
|
errCom := departCont.GetCont(map[string]interface{}{"`id`": departmentId}, "`name`") |
|
|
|
|
|
if errCom == nil { |
|
|
|
|
|
if allOrgName != "" { |
|
|
|
|
|
allOrgName = fmt.Sprintf("%v / %v", allOrgName, departCont.Name) |
|
|
|
|
|
} else { |
|
|
|
|
|
allOrgName = departCont.Name |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
if sunDepartId != 0 { |
|
|
|
|
|
var sunDepartCont models.AdministrativeOrganization |
|
|
|
|
|
errCom := sunDepartCont.GetCont(map[string]interface{}{"`id`": sunDepartId}, "`name`") |
|
|
|
|
|
if errCom == nil { |
|
|
|
|
|
if allOrgName != "" { |
|
|
|
|
|
allOrgName = fmt.Sprintf("%v / %v", allOrgName, sunDepartCont.Name) |
|
|
|
|
|
} else { |
|
|
|
|
|
allOrgName = sunDepartCont.Name |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
if workShopId != 0 { |
|
|
|
|
|
var workShopCont models.AdministrativeOrganization |
|
|
|
|
|
errCom := workShopCont.GetCont(map[string]interface{}{"`id`": workShopId}, "`name`") |
|
|
|
|
|
if errCom == nil { |
|
|
|
|
|
if allOrgName != "" { |
|
|
|
|
|
allOrgName = fmt.Sprintf("%v / %v", allOrgName, workShopCont.Name) |
|
|
|
|
|
} else { |
|
|
|
|
|
allOrgName = workShopCont.Name |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var snedCont outInsetWork |
|
|
|
|
|
snedCont.StartTime = overallhandle.UnixTimeToDay(v.StartTime, 14) //开始时间
|
|
|
|
|
|
endTimeStr := "至今" |
|
|
|
|
|
if v.EndTime != 0 { |
|
|
|
|
|
endTimeStr = overallhandle.UnixTimeToDay(v.EndTime, 14) |
|
|
|
|
|
} |
|
|
|
|
|
snedCont.EndTime = endTimeStr //结束时间
|
|
|
|
|
|
snedCont.AllOrgName = allOrgName //性质组织全称
|
|
|
|
|
|
snedCont.OrgId = orgId //行政组织ID
|
|
|
|
|
|
snedCont.PostId = v.Position //职务ID
|
|
|
|
|
|
snedCont.PostLevel = v.GradePositions //职务等级
|
|
|
|
|
|
var postCont models.Position |
|
|
|
|
|
postCont.GetCont(map[string]interface{}{"`id`": v.Position}, "`name`", "`superior`") |
|
|
|
|
|
snedCont.PostName = postCont.Name //职务名称
|
|
|
|
|
|
snedCont.TeamId = v.Team //班组ID
|
|
|
|
|
|
var teamCont models.TeamGroup |
|
|
|
|
|
teamCont.GetCont(map[string]interface{}{"`id`": v.Team}, "`name`") |
|
|
|
|
|
snedCont.TeamName = teamCont.Name //班组名称
|
|
|
|
|
|
snedCont.ChangeType = v.ChangeType //调动类型
|
|
|
|
|
|
snedCont.ChangeTypeName = changeTypeToStr(v.ChangeType) |
|
|
|
|
|
snedCont.AssignType = v.AssignType //1、主职;2:兼职
|
|
|
|
|
|
|
|
|
|
|
|
// snedCont.SuperiorPostName string //上级职务名称
|
|
|
|
|
|
// snedCont.SuperiorManName []string //上级人员
|
|
|
|
|
|
// snedCont.SubordinatesCount int //下属熟练
|
|
|
|
|
|
sendData = append(sendData, snedCont) |
|
|
|
|
|
} |
|
|
|
|
|
overallhandle.Result(0, sendData, c) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
|
* |
|
|
|
|
|
@ 作者: 秦东 |
|
|
|
|
|
@ 时间: 2022-11-29 14:51:58 |
|
|
|
|
|
@ 功能: 获取职务名称,职务人员,下属数量 |
|
|
|
|
|
@ 参数 |
|
|
|
|
|
|
|
|
|
|
|
#orgId 行政组织 |
|
|
|
|
|
#postId 职务ID |
|
|
|
|
|
|
|
|
|
|
|
@ 返回值 |
|
|
|
|
|
|
|
|
|
|
|
# |
|
|
|
|
|
|
|
|
|
|
|
@ 方法原型 |
|
|
|
|
|
|
|
|
|
|
|
# |
|
|
|
|
|
*/ |
|
|
|
|
|
func getSuperiorPeopleAndSubMan(orgId, postId int64) (postName, manTitle string) { |
|
|
|
|
|
var postCont models.Position |
|
|
|
|
|
postCont.GetCont(map[string]interface{}{"`id`": postId}, "`id`", "`name`", "`administrative_organization`") |
|
|
|
|
|
postName = postCont.Name |
|
|
|
|
|
var orgAry []int64 |
|
|
|
|
|
orgAry = append(orgAry, orgId) |
|
|
|
|
|
if orgId != postCont.Id { |
|
|
|
|
|
orgAry = append(orgAry, postCont.Id) |
|
|
|
|
|
} |
|
|
|
|
|
var manList []models.PersonArchives |
|
|
|
|
|
err := overall.CONSTANT_DB_HR.Model(&models.PersonArchives{}).Select("`number`", "`name`").Where("").Find(&manList).Error |
|
|
|
|
|
if err == nil { |
|
|
|
|
|
var nameAry []string |
|
|
|
|
|
for _, v := range manList { |
|
|
|
|
|
nameAry = append(nameAry, fmt.Sprintf("%v(%v)", v.Name, v.Number)) |
|
|
|
|
|
} |
|
|
|
|
|
manTitle = strings.Join(nameAry, ",") |
|
|
|
|
|
} |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|