|
|
|
|
package personnelapi
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"encoding/json"
|
|
|
|
|
"fmt"
|
|
|
|
|
"hr_server/middleware/snowflake"
|
|
|
|
|
"hr_server/models"
|
|
|
|
|
"hr_server/overall"
|
|
|
|
|
"hr_server/overall/overallhandle"
|
|
|
|
|
"strconv"
|
|
|
|
|
"strings"
|
|
|
|
|
"time"
|
|
|
|
|
|
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// 金蝶人员信息对接
|
|
|
|
|
func (s *StaffApi) NewKingdee(c *gin.Context) {
|
|
|
|
|
overallhandle.WriteLog("t", "开始执行行人员信息对接对照")
|
|
|
|
|
var requestData addKingdeePersonneles
|
|
|
|
|
c.ShouldBindJSON(&requestData)
|
|
|
|
|
if requestData.Number == "" {
|
|
|
|
|
overallhandle.Result(1, requestData.Number, c, "工号不能为空!")
|
|
|
|
|
jieShouData, _ := json.Marshal(requestData)
|
|
|
|
|
overallhandle.WriteLog("i", "接收到的参数!", string(jieShouData))
|
|
|
|
|
overallhandle.WriteLog("e", "结束执行行人员信息对接对照。原因工号不能为空!")
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var saveKingDee models.KingdeeLog
|
|
|
|
|
saveKingDee.Number = requestData.Number
|
|
|
|
|
requesJson, _ := json.Marshal(requestData)
|
|
|
|
|
saveKingDee.Cont = string(requesJson)
|
|
|
|
|
saveKingDee.Time = time.Now().Unix()
|
|
|
|
|
overallhandle.WriteLog("i", "KingDee对接数据!", saveKingDee)
|
|
|
|
|
// kingdeeErr := overall.CONSTANT_DB_HR.Create(&saveKingDee).Error
|
|
|
|
|
// overallhandle.WriteLog("w", "KingDee写入数据库状态!", kingdeeErr)
|
|
|
|
|
var manContent models.PersonArchives
|
|
|
|
|
manErr := manContent.GetCont(map[string]interface{}{"`number`": requestData.Number})
|
|
|
|
|
if manErr == nil {
|
|
|
|
|
//已经存在!进行变动操作
|
|
|
|
|
manErr = eidtAddManContJinDie(manContent, requestData)
|
|
|
|
|
overallhandle.WriteLog("i", "已经存在!进行变动操作!", saveKingDee)
|
|
|
|
|
} else {
|
|
|
|
|
//不存在!进行新增操作
|
|
|
|
|
var oldSchool models.WorkMan
|
|
|
|
|
oldSchool.GetCont(map[string]interface{}{"wm_number": requestData.Number})
|
|
|
|
|
manErr = newAddManContJinDie(oldSchool, requestData)
|
|
|
|
|
overallhandle.WriteLog("i", "不存在!进行新增操作!", manErr, saveKingDee)
|
|
|
|
|
}
|
|
|
|
|
if manErr != nil {
|
|
|
|
|
overallhandle.Result(104, manErr, c)
|
|
|
|
|
overallhandle.WriteLog("e", "数据处理失败!", manErr, saveKingDee)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
overallhandle.WriteLog("t", "执行行人员信息对接对照结束!")
|
|
|
|
|
overallhandle.Result(0, manErr, c)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
*
|
|
|
|
|
@ 作者: 秦东
|
|
|
|
|
@ 时间: 2022-12-19 09:35:48
|
|
|
|
|
@ 功能: 编辑员工
|
|
|
|
|
@ 参数
|
|
|
|
|
|
|
|
|
|
#perArcInfo 原始头像
|
|
|
|
|
#manCont 接收得员工数据
|
|
|
|
|
|
|
|
|
|
@ 返回值
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
@ 方法原型
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
*/
|
|
|
|
|
func eidtAddManContJinDie(perArcInfo models.PersonArchives, manCont addKingdeePersonneles) error {
|
|
|
|
|
fmt.Printf("编辑--->%v\n", manCont)
|
|
|
|
|
|
|
|
|
|
eidtManCont := overallhandle.MapOut()
|
|
|
|
|
if manCont.Name != "" && manCont.Name != perArcInfo.Name {
|
|
|
|
|
eidtManCont["`name`"] = manCont.Name
|
|
|
|
|
}
|
|
|
|
|
if manCont.Icon != "" {
|
|
|
|
|
newIcon := fmt.Sprintf("data:image/jpeg;base64,%v", strings.Replace(manCont.Icon, "\r\n", "", -1))
|
|
|
|
|
if newIcon != perArcInfo.Icon {
|
|
|
|
|
eidtManCont["`icon_photo`"] = newIcon
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if manCont.HireType != "" {
|
|
|
|
|
hireTypes, hireTypesErr := overallhandle.StringToInt(manCont.HireType)
|
|
|
|
|
if hireTypesErr != nil {
|
|
|
|
|
hireTypes = 1
|
|
|
|
|
}
|
|
|
|
|
if hireTypes != perArcInfo.HireClass {
|
|
|
|
|
eidtManCont["`hire_class`"] = hireTypes
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
// fmt.Printf("manCont.EmpType-------------------->%v\n", manCont.EmpType)
|
|
|
|
|
if manCont.EmpType != "" {
|
|
|
|
|
// fmt.Printf("manCont.EmpType---------3----------->%v\n", manCont.EmpType)
|
|
|
|
|
// empType, empTypeErr := overallhandle.StringToInt(manCont.EmpType)
|
|
|
|
|
|
|
|
|
|
// if empTypeErr != nil {
|
|
|
|
|
// empType = 1
|
|
|
|
|
// }
|
|
|
|
|
empType := EmptypeToInt(manCont.EmpType)
|
|
|
|
|
// fmt.Printf("manCont.EmpType------------1-------->%v\n", empType)
|
|
|
|
|
if empType != perArcInfo.EmpType {
|
|
|
|
|
eidtManCont["`emp_type`"] = empType
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//人员变更记录
|
|
|
|
|
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
|
|
|
|
|
}
|
|
|
|
|
manChangeRecord.Company = orgCompany.Id
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//主部门
|
|
|
|
|
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
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// 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
|
|
|
|
|
}
|
|
|
|
|
manChangeRecord.Company = companyId
|
|
|
|
|
manChangeRecord.MainDepartment = departmentId
|
|
|
|
|
// manChangeRecord.SunMainDeparment = sunDepartId
|
|
|
|
|
manChangeRecord.Adminorg = orgMainDepart.Id
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//部门
|
|
|
|
|
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)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
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 dutiesCont.ClassId != perArcInfo.JobClass {
|
|
|
|
|
eidtManCont["`job_class`"] = dutiesCont.ClassId
|
|
|
|
|
changeRecordTrue = true
|
|
|
|
|
}
|
|
|
|
|
manChangeRecord.JobId = dutiesCont.Id
|
|
|
|
|
manChangeRecord.JobClass = dutiesCont.ClassId
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if manCont.PositionGrade != "" {
|
|
|
|
|
positionGrade, _ := overallhandle.StringToInt64(manCont.PositionGrade)
|
|
|
|
|
if positionGrade != perArcInfo.JobLeve {
|
|
|
|
|
eidtManCont["`job_leve`"] = positionGrade
|
|
|
|
|
}
|
|
|
|
|
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)
|
|
|
|
|
if eidtErrMain != nil {
|
|
|
|
|
return eidtErrMain
|
|
|
|
|
} else {
|
|
|
|
|
if changeRecordTrue == true {
|
|
|
|
|
//写入变动记录
|
|
|
|
|
|
|
|
|
|
hireTypesbd, hireTypesbdErr := overallhandle.StringToInt(manCont.HireType)
|
|
|
|
|
if hireTypesbdErr != nil {
|
|
|
|
|
hireTypesbd = 1
|
|
|
|
|
}
|
|
|
|
|
manChangeRecord.Type = hireTypesbd
|
|
|
|
|
manChangeRecord.Number = perArcInfo.Number
|
|
|
|
|
manChangeRecord.Time = time.Now().Unix()
|
|
|
|
|
manChangeRecord.Key = perArcInfo.Key
|
|
|
|
|
// rybdErr := overall.CONSTANT_DB_HR.Create(&manChangeRecord).Error
|
|
|
|
|
// jsonCont, _ := json.Marshal(manChangeRecord)
|
|
|
|
|
// fmt.Printf("第二学历--->%v--->%v\n", rybdErr, string(jsonCont))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//编辑人员附属信息
|
|
|
|
|
synPro.Add(1)
|
|
|
|
|
go editManAuxiliaryDataNew(perArcInfo.Key, manCont)
|
|
|
|
|
//编辑紧急联系人信息
|
|
|
|
|
synPro.Add(1)
|
|
|
|
|
go emergencyContactPersonNew(perArcInfo.Key, manCont)
|
|
|
|
|
//编辑员工家属信息
|
|
|
|
|
synPro.Add(1)
|
|
|
|
|
go eidtFamilyMembersNew(perArcInfo.Key, manCont.Number, manCont.MemberOfFamily)
|
|
|
|
|
//编辑员工教育经历
|
|
|
|
|
synPro.Add(1)
|
|
|
|
|
go educatExperKingdeeNew(perArcInfo.Key, manCont)
|
|
|
|
|
//编辑工作履历
|
|
|
|
|
synPro.Add(1)
|
|
|
|
|
go editWorkHistoryMan(perArcInfo.Key, manCont.Number, manCont.WorkHistoryList)
|
|
|
|
|
//编辑集团内工作履历
|
|
|
|
|
synPro.Add(1)
|
|
|
|
|
// go editInsideWorkHistoryMan(perArcInfo.Key, manCont.InsideWorkHistory)
|
|
|
|
|
go editInsideWorkHistoryManNew(perArcInfo.Key, manCont.InsideWorkHistory)
|
|
|
|
|
synPro.Wait()
|
|
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 新增员工
|
|
|
|
|
func newAddManContJinDie(oldSchool models.WorkMan, manCont addKingdeePersonneles) error {
|
|
|
|
|
// fmt.Printf("添加")
|
|
|
|
|
var manKeyNum int64 = 0
|
|
|
|
|
node, nodeErr := snowflake.NewWorker(1)
|
|
|
|
|
if nodeErr == nil {
|
|
|
|
|
manKeyNum = node.GetId()
|
|
|
|
|
} else {
|
|
|
|
|
manKeyNum = overallhandle.TableNumber()
|
|
|
|
|
}
|
|
|
|
|
if oldSchool.Key != 0 {
|
|
|
|
|
manKeyNum = oldSchool.Key
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var manMainCont models.PersonArchives
|
|
|
|
|
manMainCont.Number = manCont.Number
|
|
|
|
|
manMainCont.Name = manCont.Name
|
|
|
|
|
// manMainCont.Icon = manCont.Icon
|
|
|
|
|
manMainCont.IconPhoto = manCont.Icon
|
|
|
|
|
// hireTypesbd, hireTypesbdErr := overallhandle.StringToInt(manCont.HireType)
|
|
|
|
|
// if hireTypesbdErr != nil {
|
|
|
|
|
// hireTypesbd = 1
|
|
|
|
|
// }
|
|
|
|
|
// manMainCont.HireClass = hireTypesbd
|
|
|
|
|
manMainCont.HireClass = hireTypeToInt(manCont.HireType)
|
|
|
|
|
manMainCont.HireClassName = manCont.HireType
|
|
|
|
|
|
|
|
|
|
// empType, empTypeErr := overallhandle.StringToInt(manCont.EmpType)
|
|
|
|
|
// if empTypeErr != nil {
|
|
|
|
|
// empType = 1
|
|
|
|
|
// }
|
|
|
|
|
// manMainCont.EmpType = empType
|
|
|
|
|
manMainCont.EmpType = EmptypeToInt(manCont.EmpType)
|
|
|
|
|
manMainCont.EmpTypeName = manCont.EmpType
|
|
|
|
|
|
|
|
|
|
timeTady := time.Now().Unix()
|
|
|
|
|
manMainCont.Time = timeTady
|
|
|
|
|
manMainCont.EiteTime = timeTady
|
|
|
|
|
manMainCont.State = 1
|
|
|
|
|
|
|
|
|
|
if manCont.Company != "" {
|
|
|
|
|
var orgCompany models.AdministrativeOrganization
|
|
|
|
|
orgErr := orgCompany.GetCont(map[string]interface{}{"kingdeeid": manCont.Company}, "`id`")
|
|
|
|
|
if orgErr == nil {
|
|
|
|
|
manMainCont.Company = orgCompany.Id
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
manMainCont.MainDeparment = departmentId
|
|
|
|
|
manMainCont.SunMainDeparment = sunDepartId
|
|
|
|
|
manMainCont.AdminOrg = orgMainDepart.Id
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
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)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
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)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
departIdStr := strings.Join(departId, ",")
|
|
|
|
|
manMainCont.Deparment = departIdStr
|
|
|
|
|
}
|
|
|
|
|
// if manCont.AdminOrg != "" {
|
|
|
|
|
// var orgMainDepartAdmin models.AdministrativeOrganization
|
|
|
|
|
// orgErr := orgMainDepartAdmin.GetCont(map[string]interface{}{"kingdeeid": manCont.AdminOrg}, "`id`")
|
|
|
|
|
// if orgErr == nil {
|
|
|
|
|
// manMainCont.AdminOrg = orgMainDepartAdmin.Id
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
//职位
|
|
|
|
|
if manCont.Position != "" {
|
|
|
|
|
var positionCont models.Position
|
|
|
|
|
positErr := positionCont.GetCont(map[string]interface{}{`kingdeeid`: manCont.Position}, "`id`")
|
|
|
|
|
if positErr == nil {
|
|
|
|
|
manMainCont.Position = positionCont.Id
|
|
|
|
|
|
|
|
|
|
var postDutiewJobInfo models.PostDutiesJob
|
|
|
|
|
posiDutJobtErr := postDutiewJobInfo.GetCont(map[string]interface{}{`id`: positionCont.Id}, "`duties`", "`job_type`")
|
|
|
|
|
if posiDutJobtErr == nil {
|
|
|
|
|
manMainCont.JobId = postDutiewJobInfo.Duties
|
|
|
|
|
manMainCont.JobClass = postDutiewJobInfo.JobType
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//职务
|
|
|
|
|
// fmt.Printf("manCont.JobName----------->-----%v\n", manCont.JobName)
|
|
|
|
|
if manCont.JobName != "" {
|
|
|
|
|
var dutiesCont models.DutiesClassLeve
|
|
|
|
|
dutiesErr := dutiesCont.GetCont(map[string]interface{}{"`d_king`": manCont.JobName}, "d_id", "c_id")
|
|
|
|
|
// fmt.Printf("dutiesCont----------->%v---------------%v\n", dutiesErr, dutiesCont)
|
|
|
|
|
if dutiesErr == nil {
|
|
|
|
|
manMainCont.JobId = dutiesCont.Id
|
|
|
|
|
manMainCont.JobClass = dutiesCont.ClassId
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if manCont.PositionGrade != "" {
|
|
|
|
|
positionGrade, _ := overallhandle.StringToInt64(manCont.PositionGrade)
|
|
|
|
|
manMainCont.JobLeve = positionGrade
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//获取老人员主表内容
|
|
|
|
|
var oldPersonArchives models.Personnel
|
|
|
|
|
oldPersErr := overall.CONSTANT_DB_HR_Jin.Where(map[string]interface{}{"`number`": manCont.Number}).First(&oldPersonArchives).Error
|
|
|
|
|
if oldPersErr == nil {
|
|
|
|
|
if manCont.Icon != "" {
|
|
|
|
|
|
|
|
|
|
manMainCont.IconPhoto = fmt.Sprintf("data:image/jpeg;base64,%v", strings.Replace(manCont.Icon, "\r\n", "", -1))
|
|
|
|
|
}
|
|
|
|
|
if oldPersonArchives.Icon != "" {
|
|
|
|
|
manMainCont.Icon = oldPersonArchives.Icon
|
|
|
|
|
}
|
|
|
|
|
if oldPersonArchives.Key != 0 {
|
|
|
|
|
manMainCont.Key = oldPersonArchives.Key
|
|
|
|
|
} else {
|
|
|
|
|
manMainCont.Key = manKeyNum
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if oldPersonArchives.Wechat != "" {
|
|
|
|
|
manMainCont.Wechat = oldPersonArchives.Wechat
|
|
|
|
|
}
|
|
|
|
|
if oldPersonArchives.WorkWechat != "" {
|
|
|
|
|
manMainCont.WorkWechat = oldPersonArchives.WorkWechat
|
|
|
|
|
}
|
|
|
|
|
manMainCont.IsAdmin = oldPersonArchives.IsAdmin
|
|
|
|
|
manMainCont.Role = oldPersonArchives.Role
|
|
|
|
|
if oldPersonArchives.Password != "" {
|
|
|
|
|
manMainCont.Password = oldPersonArchives.Password
|
|
|
|
|
} else {
|
|
|
|
|
//密码加密
|
|
|
|
|
var passwordMd5 overallhandle.Md5Encryption
|
|
|
|
|
passwordMd5.Md5EncryptionInit(overall.CONSTANT_CONFIG.Appsetup.DefaultPassword)
|
|
|
|
|
manMainCont.Password = passwordMd5.Md5EncryptionAlgorithm()
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
manMainCont.Key = manKeyNum
|
|
|
|
|
if oldSchool.Password != "" {
|
|
|
|
|
manMainCont.Password = oldSchool.Password
|
|
|
|
|
} else {
|
|
|
|
|
//密码加密
|
|
|
|
|
var passwordMd5 overallhandle.Md5Encryption
|
|
|
|
|
passwordMd5.Md5EncryptionInit(overall.CONSTANT_CONFIG.Appsetup.DefaultPassword)
|
|
|
|
|
manMainCont.Password = passwordMd5.Md5EncryptionAlgorithm()
|
|
|
|
|
}
|
|
|
|
|
if oldSchool.WorkWechatId != "" {
|
|
|
|
|
manMainCont.WorkWechat = oldSchool.WorkWechatId
|
|
|
|
|
}
|
|
|
|
|
if oldSchool.WechatId != "" {
|
|
|
|
|
manMainCont.Wechat = oldSchool.WechatId
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
addManContErr := overall.CONSTANT_DB_HR.Create(&manMainCont).Error
|
|
|
|
|
if addManContErr != nil {
|
|
|
|
|
return addManContErr
|
|
|
|
|
} else {
|
|
|
|
|
//编辑人员附属信息
|
|
|
|
|
synPro.Add(1)
|
|
|
|
|
go editManAuxiliaryDataNew(manKeyNum, manCont)
|
|
|
|
|
//编辑紧急联系人信息
|
|
|
|
|
synPro.Add(1)
|
|
|
|
|
go emergencyContactPersonNew(manKeyNum, manCont)
|
|
|
|
|
//编辑员工家属信息
|
|
|
|
|
synPro.Add(1)
|
|
|
|
|
go eidtFamilyMembersNew(manKeyNum, manCont.Number, manCont.MemberOfFamily)
|
|
|
|
|
//编辑员工教育经历
|
|
|
|
|
synPro.Add(1)
|
|
|
|
|
go educatExperKingdeeNew(manKeyNum, manCont)
|
|
|
|
|
//编辑集团外工作履历
|
|
|
|
|
synPro.Add(1)
|
|
|
|
|
go editWorkHistoryMan(manKeyNum, manCont.Number, manCont.WorkHistoryList)
|
|
|
|
|
//编辑集团内工作履历
|
|
|
|
|
synPro.Add(1)
|
|
|
|
|
// go editInsideWorkHistoryMan(manKeyNum, manCont.InsideWorkHistory)
|
|
|
|
|
go editInsideWorkHistoryManNew(manKeyNum, manCont.InsideWorkHistory)
|
|
|
|
|
synPro.Wait()
|
|
|
|
|
}
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 编辑人员附属信息
|
|
|
|
|
func editManAuxiliaryDataNew(manKeyNum int64, manCont addKingdeePersonneles) {
|
|
|
|
|
defer synPro.Done()
|
|
|
|
|
var manInfo models.PersonnelContent
|
|
|
|
|
manErr := manInfo.GetCont(map[string]interface{}{"`key`": manKeyNum})
|
|
|
|
|
fmt.Printf("editManAuxilia--------------------->%v\n", manErr)
|
|
|
|
|
if manErr == nil {
|
|
|
|
|
saveData := overallhandle.MapOut()
|
|
|
|
|
|
|
|
|
|
if manCont.Globalroaming != "" && manCont.Globalroaming != manInfo.Globalroaming {
|
|
|
|
|
saveData["globalroaming"] = manCont.Globalroaming
|
|
|
|
|
}
|
|
|
|
|
if manCont.Passportno != "" && manCont.Passportno != manInfo.Passportno {
|
|
|
|
|
saveData["passportno"] = manCont.Passportno
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if manCont.IDCardNo != "" && manCont.IDCardNo != manInfo.Idcardno {
|
|
|
|
|
saveData["idcardno"] = manCont.IDCardNo
|
|
|
|
|
}
|
|
|
|
|
if manCont.IDCardStartTime != "" {
|
|
|
|
|
idCardStarTime, idCarErr := overallhandle.DateToTimeStamp(manCont.IDCardStartTime)
|
|
|
|
|
if idCarErr == false {
|
|
|
|
|
idCardStarTime, _ = overallhandle.DateToTimeStamp(fmt.Sprintf("%v 00:00:00", manCont.IDCardStartTime))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if idCardStarTime != manInfo.Idcardstartdate {
|
|
|
|
|
saveData["idcardstartdate"] = idCardStarTime
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if manCont.IDCardEndTime != "" {
|
|
|
|
|
idCardEndTime, idCardEndTimeErr := overallhandle.DateToTimeStamp(manCont.IDCardEndTime)
|
|
|
|
|
if idCardEndTimeErr == false {
|
|
|
|
|
idCardEndTime, _ = overallhandle.DateToTimeStamp(fmt.Sprintf("%v 00:00:00", manCont.IDCardEndTime))
|
|
|
|
|
}
|
|
|
|
|
if idCardEndTime != manInfo.Idcardenddate {
|
|
|
|
|
saveData["idcardenddate"] = idCardEndTime
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if manCont.IDCardAddress != "" && manCont.IDCardAddress != manInfo.Idcardaddress {
|
|
|
|
|
saveData["idcardaddress"] = manCont.IDCardAddress
|
|
|
|
|
}
|
|
|
|
|
if manCont.IDCardIsSued != "" && manCont.IDCardIsSued != manInfo.IdcardIssued {
|
|
|
|
|
saveData["idcardIssued"] = manCont.IDCardIsSued
|
|
|
|
|
}
|
|
|
|
|
if manCont.Mobilephone != "" && manCont.Mobilephone != manInfo.Mobilephone {
|
|
|
|
|
saveData["mobilephone"] = manCont.Mobilephone
|
|
|
|
|
}
|
|
|
|
|
if manCont.Email != "" && manCont.Email != manInfo.Email {
|
|
|
|
|
saveData["email"] = manCont.Email
|
|
|
|
|
}
|
|
|
|
|
if manCont.Gender != "" {
|
|
|
|
|
// gender, _ := overallhandle.StringToInt(manCont.Gender)
|
|
|
|
|
// if gender != manInfo.Gender {
|
|
|
|
|
// saveData["gender"] = gender
|
|
|
|
|
// }
|
|
|
|
|
genderInt := genderToInt(manCont.Gender)
|
|
|
|
|
if genderInt != manInfo.Gender {
|
|
|
|
|
saveData["gender"] = genderInt
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// fmt.Printf("manCont.Birthday-------------->%v\n", manCont.Birthday)
|
|
|
|
|
if manCont.Birthday != "" {
|
|
|
|
|
brrthday, brrthdayErr := overallhandle.DateToTimeStamp(manCont.Birthday)
|
|
|
|
|
// fmt.Printf("manCont.Birthday-------1------->%v\n", brrthday)
|
|
|
|
|
if brrthdayErr == false {
|
|
|
|
|
brrthday, _ = overallhandle.DateToTimeStamp(fmt.Sprintf("%v 00:00:00", manCont.Birthday))
|
|
|
|
|
// fmt.Printf("manCont.Birthday------2-------->%v\n", brrthday)
|
|
|
|
|
}
|
|
|
|
|
if brrthday != manInfo.Birthday {
|
|
|
|
|
// fmt.Printf("manCont.Birthday------3-------->%v\n", brrthday)
|
|
|
|
|
saveData["birthday"] = brrthday
|
|
|
|
|
}
|
|
|
|
|
// fmt.Printf("manCont.Birthday-------4------->%v\n", brrthday)
|
|
|
|
|
}
|
|
|
|
|
if manCont.Nation != "" && manCont.Nation != manInfo.Myfolk {
|
|
|
|
|
saveData["myfolk"] = manCont.Nation
|
|
|
|
|
}
|
|
|
|
|
if manCont.NativePlace != "" && manCont.NativePlace != manInfo.Nativeplace {
|
|
|
|
|
saveData["nativeplace"] = manCont.NativePlace
|
|
|
|
|
}
|
|
|
|
|
if manCont.Health != "" {
|
|
|
|
|
// health, _ := overallhandle.StringToInt(manCont.Health)
|
|
|
|
|
// if health != manInfo.Health {
|
|
|
|
|
// saveData["health"] = health
|
|
|
|
|
// }
|
|
|
|
|
health := healthToInt(manCont.Health)
|
|
|
|
|
if health != manInfo.Health {
|
|
|
|
|
saveData["health"] = health
|
|
|
|
|
saveData["health_cn"] = manCont.Health
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if manCont.Maritalstatus != "" {
|
|
|
|
|
// marital, _ := overallhandle.StringToInt(manCont.Maritalstatus)
|
|
|
|
|
// if marital != manInfo.Maritalstatus {
|
|
|
|
|
// saveData["maritalstatus"] = marital
|
|
|
|
|
// }
|
|
|
|
|
marital := maritalstatusToInt(manCont.Maritalstatus)
|
|
|
|
|
if marital != manInfo.Maritalstatus {
|
|
|
|
|
saveData["maritalstatus"] = marital
|
|
|
|
|
saveData["maritalstatus_cn"] = manCont.Maritalstatus
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if manCont.CurrentResidence != "" && manCont.CurrentResidence != manInfo.Currentresidence {
|
|
|
|
|
saveData["currentresidence"] = manCont.CurrentResidence
|
|
|
|
|
}
|
|
|
|
|
if manCont.Constellation != "" {
|
|
|
|
|
// constell, _ := overallhandle.StringToInt(manCont.Constellation)
|
|
|
|
|
// if constell != manInfo.Constellation {
|
|
|
|
|
// saveData["constellationing"] = constell
|
|
|
|
|
// }
|
|
|
|
|
constell := consteToInt(manCont.Constellation)
|
|
|
|
|
if constell != manInfo.Constellation {
|
|
|
|
|
saveData["constellationing"] = constell
|
|
|
|
|
saveData["constellationing_cn"] = manCont.Constellation
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if manCont.Iisdoubleworker != "" {
|
|
|
|
|
if manCont.Iisdoubleworker == "是" {
|
|
|
|
|
saveData["isdoubleworker"] = 1
|
|
|
|
|
eidtDoubleWorkerNew(manKeyNum, manCont, 1)
|
|
|
|
|
} else {
|
|
|
|
|
isdoulw, isdoulwErr := overallhandle.StringToInt(manCont.Iisdoubleworker)
|
|
|
|
|
if isdoulwErr == nil {
|
|
|
|
|
if isdoulw == 0 {
|
|
|
|
|
isdoulw = 1
|
|
|
|
|
} else {
|
|
|
|
|
isdoulw = 2
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
isdoulw = 2
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if isdoulw != manInfo.Isdoubleworker {
|
|
|
|
|
saveData["isdoubleworker"] = isdoulw
|
|
|
|
|
}
|
|
|
|
|
eidtDoubleWorkerNew(manKeyNum, manCont, isdoulw)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if manCont.Isveterans != "" && manCont.Isveterans != "0" {
|
|
|
|
|
isveters, _ := overallhandle.StringToInt(manCont.Isveterans)
|
|
|
|
|
if isveters == 2 {
|
|
|
|
|
isveters = 1
|
|
|
|
|
} else {
|
|
|
|
|
isveters = 2
|
|
|
|
|
}
|
|
|
|
|
if isveters != manInfo.Isveterans {
|
|
|
|
|
saveData["isveterans"] = isveters
|
|
|
|
|
}
|
|
|
|
|
if isveters == 1 {
|
|
|
|
|
if manCont.Veteransnumber != "" && manCont.Veteransnumber != manInfo.Veteransnumber {
|
|
|
|
|
saveData["veteransnumber"] = manCont.Veteransnumber
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
saveData["veteransnumber"] = ""
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if manCont.Veteransnumber != "" {
|
|
|
|
|
saveData["isveterans"] = 1
|
|
|
|
|
saveData["veteransnumber"] = manCont.Veteransnumber
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if manCont.WorkingDate != "" {
|
|
|
|
|
workInData, workInDataErr := overallhandle.DateToTimeStamp(manCont.WorkingDate)
|
|
|
|
|
if workInDataErr == false {
|
|
|
|
|
workInData, _ = overallhandle.DateToTimeStamp(fmt.Sprintf("%v 00:00:00", manCont.WorkingDate))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if workInData != manInfo.Jobstartdate {
|
|
|
|
|
saveData["jobstartdate"] = workInData
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if manCont.EntryDate != "" {
|
|
|
|
|
entryData, entryDataErr := overallhandle.DateToTimeStamp(manCont.EntryDate)
|
|
|
|
|
if entryDataErr == false {
|
|
|
|
|
entryData, _ = overallhandle.DateToTimeStamp(fmt.Sprintf("%v 00:00:00", manCont.EntryDate))
|
|
|
|
|
}
|
|
|
|
|
if entryData != manInfo.Entrydate {
|
|
|
|
|
saveData["entrydate"] = entryData
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if manCont.ProbationPeriod != "" {
|
|
|
|
|
|
|
|
|
|
proBatPer, _ := overallhandle.StringToInt(manCont.ProbationPeriod)
|
|
|
|
|
if proBatPer != manInfo.Probationperiod {
|
|
|
|
|
saveData["probationperiod"] = proBatPer
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
saveData["probationperiod"] = manCont.ProbationPeriod
|
|
|
|
|
entryData := manInfo.Entrydate
|
|
|
|
|
if manCont.EntryDate != "" {
|
|
|
|
|
entryDataErr := false
|
|
|
|
|
entryData, entryDataErr = overallhandle.DateToTimeStamp(manCont.EntryDate)
|
|
|
|
|
if entryDataErr == false {
|
|
|
|
|
entryData, _ = overallhandle.DateToTimeStamp(fmt.Sprintf("%v 00:00:00", manCont.EntryDate))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
planformalData := overallhandle.GetFutureMonthTime(entryData, proBatPer, 2)
|
|
|
|
|
saveData["planformaldate"] = planformalData
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if manCont.ConfirmationDate != "" {
|
|
|
|
|
planformalData, planformalDataErr := overallhandle.DateToTimeStamp(manCont.ConfirmationDate)
|
|
|
|
|
if planformalDataErr == false {
|
|
|
|
|
planformalData, _ = overallhandle.DateToTimeStamp(fmt.Sprintf("%v 00:00:00", manCont.ConfirmationDate))
|
|
|
|
|
}
|
|
|
|
|
saveData["planformaldate"] = planformalData
|
|
|
|
|
}
|
|
|
|
|
if manCont.PoliticalOutlook != "" {
|
|
|
|
|
// politiOutlok, _ := overallhandle.StringToInt(manCont.PoliticalOutlook)
|
|
|
|
|
// if politiOutlok != manInfo.PoliticalOutlook {
|
|
|
|
|
// saveData["political_outlook"] = politiOutlok
|
|
|
|
|
// }
|
|
|
|
|
politiOutlok := politiToInt(manCont.PoliticalOutlook)
|
|
|
|
|
if politiOutlok != manInfo.PoliticalOutlook {
|
|
|
|
|
saveData["political_outlook"] = politiOutlok
|
|
|
|
|
saveData["political_outlook_cn"] = manCont.PoliticalOutlook
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if len(saveData) > 0 {
|
|
|
|
|
saveData["`time`"] = time.Now().Unix()
|
|
|
|
|
manInfo.EiteCont(map[string]interface{}{"`key`": manInfo.Key}, saveData)
|
|
|
|
|
}
|
|
|
|
|
fmt.Printf("editManAuxilia-----------1---------->%v\n", saveData)
|
|
|
|
|
} else {
|
|
|
|
|
fmt.Printf("editManAuxilia----------2----------->%v\n", manErr)
|
|
|
|
|
manInfo.Key = manKeyNum
|
|
|
|
|
manInfo.Number = manCont.Number
|
|
|
|
|
manInfo.Passportno = manCont.Passportno
|
|
|
|
|
manInfo.Globalroaming = manCont.Globalroaming
|
|
|
|
|
manInfo.Idcardno = manCont.IDCardNo
|
|
|
|
|
// idCardStarTime := time.Now().Unix()
|
|
|
|
|
var idCardStarTime int64 = 0
|
|
|
|
|
if manCont.IDCardStartTime != "" {
|
|
|
|
|
idCardStarTimeErr := false
|
|
|
|
|
idCardStarTime, idCardStarTimeErr = overallhandle.DateToTimeStamp(manCont.IDCardStartTime)
|
|
|
|
|
if idCardStarTimeErr == false {
|
|
|
|
|
idCardStarTime, _ = overallhandle.DateToTimeStamp(fmt.Sprintf("%v 00:00:00", manCont.IDCardStartTime))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
manInfo.Idcardstartdate = idCardStarTime //身份证有效期开始
|
|
|
|
|
// idCardEndTime := time.Now().Unix()
|
|
|
|
|
var idCardEndTime int64 = 0
|
|
|
|
|
if manCont.IDCardEndTime != "" {
|
|
|
|
|
idCardEndTimeErr := false
|
|
|
|
|
idCardEndTime, idCardEndTimeErr = overallhandle.DateToTimeStamp(manCont.IDCardEndTime)
|
|
|
|
|
if idCardEndTimeErr == false {
|
|
|
|
|
idCardEndTime, idCardEndTimeErr = overallhandle.DateToTimeStamp(fmt.Sprintf("%v 00:00:00", manCont.IDCardEndTime))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
manInfo.Idcardenddate = idCardEndTime //身份证有效期结束
|
|
|
|
|
manInfo.Idcardaddress = manCont.IDCardAddress //身份证地址
|
|
|
|
|
manInfo.IdcardIssued = manCont.IDCardIsSued //身份证签发机关
|
|
|
|
|
manInfo.Mobilephone = manCont.Mobilephone
|
|
|
|
|
manInfo.Email = manCont.Email
|
|
|
|
|
// genderInt, _ := overallhandle.StringToInt(manCont.Gender)
|
|
|
|
|
// manInfo.Gender = genderInt
|
|
|
|
|
|
|
|
|
|
manInfo.Gender = genderToInt(manCont.Gender)
|
|
|
|
|
|
|
|
|
|
// fmt.Printf("manCont.Birthday-------------->%v\n", manCont.Birthday)
|
|
|
|
|
brrthday, brrthdayErr := overallhandle.DateToTimeStamp(manCont.Birthday)
|
|
|
|
|
// if brrthdayErr == false {
|
|
|
|
|
// brrthday, brrthdayErr = overallhandle.DateToTimeStamp(manCont.Birthday)
|
|
|
|
|
// }
|
|
|
|
|
// fmt.Printf("manCont.Birthday-----1--------->%v\n", brrthday)
|
|
|
|
|
|
|
|
|
|
if brrthdayErr == false {
|
|
|
|
|
brrthday, _ = overallhandle.DateToTimeStamp(fmt.Sprintf("%v 00:00:00", manCont.Birthday))
|
|
|
|
|
// fmt.Printf("manCont.Birthday-----2--------->%v\n", brrthday)
|
|
|
|
|
}
|
|
|
|
|
// fmt.Printf("manCont.Birthday-----3--------->%v\n", brrthday)
|
|
|
|
|
manInfo.Birthday = brrthday
|
|
|
|
|
manInfo.Myfolk = manCont.Nation
|
|
|
|
|
manInfo.Nativeplace = manCont.NativePlace
|
|
|
|
|
// healthInt, _ := overallhandle.StringToInt(manCont.Health)
|
|
|
|
|
// manInfo.Health = healthInt
|
|
|
|
|
|
|
|
|
|
manInfo.Health = healthToInt(manCont.Health)
|
|
|
|
|
manInfo.HealthCn = manCont.Health
|
|
|
|
|
|
|
|
|
|
// maritatus, _ := overallhandle.StringToInt(manCont.Maritalstatus)
|
|
|
|
|
// manInfo.Maritalstatus = maritatus
|
|
|
|
|
manInfo.Maritalstatus = maritalstatusToInt(manCont.Maritalstatus)
|
|
|
|
|
manInfo.MaritalstatusCn = manCont.Maritalstatus
|
|
|
|
|
|
|
|
|
|
manInfo.Currentresidence = manCont.CurrentResidence
|
|
|
|
|
manInfo.Time = time.Now().Unix()
|
|
|
|
|
// consation, _ := overallhandle.StringToInt(manCont.Constellation)
|
|
|
|
|
// manInfo.Constellation = consation
|
|
|
|
|
|
|
|
|
|
manInfo.Constellation = consteToInt(manCont.Constellation)
|
|
|
|
|
manInfo.ConstellationingCn = manCont.Constellation
|
|
|
|
|
|
|
|
|
|
if manCont.Iisdoubleworker != "" {
|
|
|
|
|
isdourker, _ := overallhandle.StringToInt(manCont.Iisdoubleworker)
|
|
|
|
|
manInfo.Isdoubleworker = isdourker
|
|
|
|
|
} else {
|
|
|
|
|
manInfo.Isdoubleworker = 2
|
|
|
|
|
}
|
|
|
|
|
if manCont.Isveterans != "" && manCont.Isveterans != "0" {
|
|
|
|
|
issssveterans, _ := overallhandle.StringToInt(manCont.Isveterans)
|
|
|
|
|
manInfo.Isveterans = issssveterans
|
|
|
|
|
} else {
|
|
|
|
|
manInfo.Isveterans = 2
|
|
|
|
|
}
|
|
|
|
|
if manCont.Veteransnumber != "" {
|
|
|
|
|
manInfo.Isveterans = 1
|
|
|
|
|
}
|
|
|
|
|
manInfo.Veteransnumber = manCont.Veteransnumber
|
|
|
|
|
// workInData := time.Now().Unix()
|
|
|
|
|
var workInData int64 = 0
|
|
|
|
|
if manCont.WorkingDate != "" {
|
|
|
|
|
workInDataErr := false
|
|
|
|
|
workInData, workInDataErr = overallhandle.DateToTimeStamp(manCont.WorkingDate)
|
|
|
|
|
if workInDataErr == false {
|
|
|
|
|
workInData, _ = overallhandle.DateToTimeStamp(fmt.Sprintf("%v 00:00:00", manCont.WorkingDate))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
manInfo.Jobstartdate = workInData
|
|
|
|
|
// entryData := time.Now().Unix()
|
|
|
|
|
var entryData int64 = 0
|
|
|
|
|
if manCont.EntryDate != "" {
|
|
|
|
|
entryDataErr := false
|
|
|
|
|
entryData, entryDataErr = overallhandle.DateToTimeStamp(manCont.EntryDate)
|
|
|
|
|
if entryDataErr == false {
|
|
|
|
|
entryData, _ = overallhandle.DateToTimeStamp(fmt.Sprintf("%v 00:00:00", manCont.EntryDate))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
manInfo.Entrydate = entryData
|
|
|
|
|
probPeriod, _ := overallhandle.StringToInt(manCont.ProbationPeriod)
|
|
|
|
|
manInfo.Probationperiod = probPeriod
|
|
|
|
|
planformalData := time.Now().Unix()
|
|
|
|
|
if manCont.ConfirmationDate != "" {
|
|
|
|
|
planformalDataErr := false
|
|
|
|
|
planformalData, planformalDataErr = overallhandle.DateToTimeStamp(manCont.ConfirmationDate)
|
|
|
|
|
if planformalDataErr == false {
|
|
|
|
|
planformalData, _ = overallhandle.DateToTimeStamp(fmt.Sprintf("%v 00:00:00", manCont.ConfirmationDate))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
planformalData = overallhandle.GetFutureMonthTime(entryData, probPeriod, 2)
|
|
|
|
|
}
|
|
|
|
|
manInfo.Planformaldate = planformalData
|
|
|
|
|
// politutlook, _ := overallhandle.StringToInt(manCont.PoliticalOutlook)
|
|
|
|
|
// manInfo.PoliticalOutlook = politutlook
|
|
|
|
|
|
|
|
|
|
manInfo.PoliticalOutlook = politiToInt(manCont.PoliticalOutlook)
|
|
|
|
|
manInfo.PoliticalOutlookCn = manCont.PoliticalOutlook
|
|
|
|
|
|
|
|
|
|
overall.CONSTANT_DB_HR.Create(&manInfo)
|
|
|
|
|
if manCont.Iisdoubleworker == "0" || manCont.Iisdoubleworker == "是" {
|
|
|
|
|
//编辑双职工
|
|
|
|
|
eidtDoubleWorkerNew(manKeyNum, manCont, 1)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 编辑双职工
|
|
|
|
|
func eidtDoubleWorkerNew(manKeyNum int64, manCont addKingdeePersonneles, state int) {
|
|
|
|
|
var doubleWorkCont models.DoubleWorker
|
|
|
|
|
dwErr := doubleWorkCont.GetCont(map[string]interface{}{"`key`": manKeyNum})
|
|
|
|
|
if dwErr == nil {
|
|
|
|
|
saveData := overallhandle.MapOut()
|
|
|
|
|
if manCont.SpouseName != "" && manCont.SpouseName != doubleWorkCont.Name {
|
|
|
|
|
saveData["`name`"] = manCont.SpouseName
|
|
|
|
|
}
|
|
|
|
|
if manCont.SpouseCompany != "" && manCont.SpouseCompany != doubleWorkCont.Company {
|
|
|
|
|
saveData["`company`"] = manCont.SpouseCompany
|
|
|
|
|
}
|
|
|
|
|
if manCont.SpouseDepartment != "" && manCont.SpouseDepartment != doubleWorkCont.Department {
|
|
|
|
|
saveData["`department`"] = manCont.SpouseDepartment
|
|
|
|
|
}
|
|
|
|
|
if manCont.SpousePosition != "" && manCont.SpousePosition != doubleWorkCont.Position {
|
|
|
|
|
saveData["`position`"] = manCont.SpousePosition
|
|
|
|
|
}
|
|
|
|
|
if manCont.SpouseTel != "" && manCont.SpouseTel != doubleWorkCont.Tel {
|
|
|
|
|
saveData["`tel`"] = manCont.SpouseTel
|
|
|
|
|
}
|
|
|
|
|
if state != 0 && state != doubleWorkCont.State {
|
|
|
|
|
saveData["`state`"] = state
|
|
|
|
|
}
|
|
|
|
|
if len(saveData) > 0 {
|
|
|
|
|
saveData["`time`"] = time.Now().Unix()
|
|
|
|
|
doubleWorkCont.EiteCont(map[string]interface{}{"`number`": manCont.Number}, saveData)
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
saveData := overallhandle.MapOut()
|
|
|
|
|
saveData["state"] = 2
|
|
|
|
|
doubleWorkCont.EiteCont(map[string]interface{}{"`number`": manCont.Number}, saveData)
|
|
|
|
|
doubleWorkCont.Key = manKeyNum
|
|
|
|
|
doubleWorkCont.Number = manCont.Number
|
|
|
|
|
doubleWorkCont.Name = manCont.SpouseName
|
|
|
|
|
doubleWorkCont.Tel = manCont.SpouseTel
|
|
|
|
|
doubleWorkCont.Company = manCont.SpouseCompany
|
|
|
|
|
doubleWorkCont.Department = manCont.SpouseDepartment
|
|
|
|
|
doubleWorkCont.Position = manCont.SpousePosition
|
|
|
|
|
doubleWorkCont.State = state
|
|
|
|
|
overall.CONSTANT_DB_HR.Create(&doubleWorkCont)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 编辑紧急联系人信息
|
|
|
|
|
func emergencyContactPersonNew(manKeyNum int64, manCont addKingdeePersonneles) {
|
|
|
|
|
defer synPro.Done()
|
|
|
|
|
var emeContPerAry []emergencyContact
|
|
|
|
|
if manCont.UrgentNameOne != "" || manCont.UrgentRelationshipOne != "" || manCont.UrgentMobilephoneOne != "" {
|
|
|
|
|
var emeContPerOne emergencyContact
|
|
|
|
|
emeContPerOne.Name = manCont.UrgentNameOne //姓名1
|
|
|
|
|
emeContPerOne.Relationship = manCont.UrgentRelationshipOne //与紧急联系人1
|
|
|
|
|
emeContPerOne.Mobilephone = manCont.UrgentMobilephoneOne //联系电话1
|
|
|
|
|
emeContPerAry = append(emeContPerAry, emeContPerOne)
|
|
|
|
|
}
|
|
|
|
|
if manCont.UrgentNameTwo != "" || manCont.UrgentRelationshipTwo != "" || manCont.UrgentMobilephoneTwo != "" {
|
|
|
|
|
var emeContPerTwo emergencyContact
|
|
|
|
|
emeContPerTwo.Name = manCont.UrgentNameTwo //姓名2
|
|
|
|
|
emeContPerTwo.Relationship = manCont.UrgentRelationshipTwo //与紧急联系人2
|
|
|
|
|
emeContPerTwo.Mobilephone = manCont.UrgentMobilephoneTwo //联系电话2
|
|
|
|
|
emeContPerAry = append(emeContPerAry, emeContPerTwo)
|
|
|
|
|
}
|
|
|
|
|
if len(emeContPerAry) > 0 {
|
|
|
|
|
|
|
|
|
|
var oldEmePersList []models.EmergencyContact
|
|
|
|
|
oldEmeErr := overall.CONSTANT_DB_HR.Where("`key` = ?", manKeyNum).Find(&oldEmePersList).Error
|
|
|
|
|
if oldEmeErr == nil {
|
|
|
|
|
var writeName []string
|
|
|
|
|
var allId []int64
|
|
|
|
|
var isEite []int64
|
|
|
|
|
for _, ev := range emeContPerAry {
|
|
|
|
|
for _, ov := range oldEmePersList {
|
|
|
|
|
if overallhandle.JudgeInMap(ov.Id, allId) == false {
|
|
|
|
|
allId = append(allId, ov.Id)
|
|
|
|
|
}
|
|
|
|
|
if ev.Name == ov.Name {
|
|
|
|
|
writeName = append(writeName, ev.Name)
|
|
|
|
|
if overallhandle.JudgeInMap(ov.Id, isEite) == false {
|
|
|
|
|
isEite = append(isEite, ov.Id)
|
|
|
|
|
}
|
|
|
|
|
eitdCont := overallhandle.MapOut()
|
|
|
|
|
if ev.Relationship != "" && ev.Relationship != ov.Relationship {
|
|
|
|
|
eitdCont["relationship"] = ev.Relationship
|
|
|
|
|
}
|
|
|
|
|
if ev.Mobilephone != "" && ev.Mobilephone != ov.Tel {
|
|
|
|
|
eitdCont["tel"] = ev.Mobilephone
|
|
|
|
|
}
|
|
|
|
|
if ov.State != 1 {
|
|
|
|
|
eitdCont["state"] = 1
|
|
|
|
|
}
|
|
|
|
|
if len(eitdCont) > 0 {
|
|
|
|
|
eitdCont["time"] = time.Now().Unix()
|
|
|
|
|
var oldEmePersCont models.EmergencyContact
|
|
|
|
|
oldEmePersCont.EiteCont(map[string]interface{}{"`id`": ov.Id}, eitdCont)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//判断两个紧急人员是否都写入
|
|
|
|
|
// if len(writeName) != 2 {
|
|
|
|
|
for _, sv := range emeContPerAry {
|
|
|
|
|
if overallhandle.StringIsInMap(sv.Name, writeName) == false {
|
|
|
|
|
var addEmeCont models.EmergencyContact
|
|
|
|
|
addEmeCont.Key = manKeyNum
|
|
|
|
|
addEmeCont.Number = manCont.Number
|
|
|
|
|
addEmeCont.Name = sv.Name
|
|
|
|
|
addEmeCont.Relationship = sv.Relationship
|
|
|
|
|
addEmeCont.Tel = sv.Mobilephone
|
|
|
|
|
addEmeCont.State = 1
|
|
|
|
|
addEmeCont.Time = time.Now().Unix()
|
|
|
|
|
overall.CONSTANT_DB_HR.Create(&addEmeCont)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// }
|
|
|
|
|
} else {
|
|
|
|
|
for _, insetv := range emeContPerAry {
|
|
|
|
|
var addEmeCont models.EmergencyContact
|
|
|
|
|
addEmeCont.Key = manKeyNum
|
|
|
|
|
addEmeCont.Number = manCont.Number
|
|
|
|
|
addEmeCont.Name = insetv.Name
|
|
|
|
|
addEmeCont.Relationship = insetv.Relationship
|
|
|
|
|
addEmeCont.Tel = insetv.Mobilephone
|
|
|
|
|
addEmeCont.State = 1
|
|
|
|
|
addEmeCont.Time = time.Now().Unix()
|
|
|
|
|
overall.CONSTANT_DB_HR.Create(&addEmeCont)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 编辑员工家属
|
|
|
|
|
func eidtFamilyMembersNew(manKeyNum int64, num string, family []memberOfFamilyes) {
|
|
|
|
|
defer synPro.Done()
|
|
|
|
|
if len(family) > 0 && manKeyNum != 0 {
|
|
|
|
|
var familyAry []models.FamilyMembers
|
|
|
|
|
famErr := overall.CONSTANT_DB_HR.Where("`key` = ?", manKeyNum).Find(&familyAry).Error
|
|
|
|
|
if famErr == nil && len(familyAry) > 0 {
|
|
|
|
|
var writeName []string
|
|
|
|
|
var allId []int64
|
|
|
|
|
var isEite []int64
|
|
|
|
|
for _, fv := range family {
|
|
|
|
|
for _, fav := range familyAry {
|
|
|
|
|
if overallhandle.JudgeInMap(fav.Id, allId) == false {
|
|
|
|
|
allId = append(allId, fav.Id)
|
|
|
|
|
}
|
|
|
|
|
if fv.Name == fav.Name {
|
|
|
|
|
writeName = append(writeName, fv.Name)
|
|
|
|
|
if overallhandle.JudgeInMap(fav.Id, isEite) == false {
|
|
|
|
|
isEite = append(isEite, fav.Id)
|
|
|
|
|
}
|
|
|
|
|
eitdCont := overallhandle.MapOut()
|
|
|
|
|
if fv.Relationship != "" && fv.Relationship != fav.Relationship {
|
|
|
|
|
eitdCont["relation"] = fv.Relationship
|
|
|
|
|
}
|
|
|
|
|
if fv.Mobilephone != "" && fv.Mobilephone != fav.Tel {
|
|
|
|
|
eitdCont["tel"] = fv.Mobilephone
|
|
|
|
|
}
|
|
|
|
|
if fv.Company != "" && fv.Company != fav.Company {
|
|
|
|
|
eitdCont["company"] = fv.Company
|
|
|
|
|
}
|
|
|
|
|
if fv.Department != "" && fv.Department != fav.Deparment {
|
|
|
|
|
eitdCont["deparment"] = fv.Department
|
|
|
|
|
}
|
|
|
|
|
if fv.Position != "" && fv.Position != fav.Postnme {
|
|
|
|
|
eitdCont["postnme"] = fv.Position
|
|
|
|
|
}
|
|
|
|
|
if fv.PoliticalOutlook != "" {
|
|
|
|
|
// polilOutlook, _ := overallhandle.StringToInt(fv.PoliticalOutlook)
|
|
|
|
|
// if polilOutlook != fav.PoliticalOutlook {
|
|
|
|
|
// eitdCont["political_outlook"] = polilOutlook
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
polilOutlook := politiToInt(fv.PoliticalOutlook)
|
|
|
|
|
if polilOutlook != fav.PoliticalOutlook {
|
|
|
|
|
eitdCont["political_outlook"] = polilOutlook
|
|
|
|
|
eitdCont["political_outlook_cn"] = fv.PoliticalOutlook
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if len(eitdCont) > 0 {
|
|
|
|
|
eitdCont["time"] = time.Now().Unix()
|
|
|
|
|
var oldFamilyCont models.FamilyMembers
|
|
|
|
|
oldFamilyCont.EiteCont(map[string]interface{}{"`id`": fav.Id}, eitdCont)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//新增不存在得家庭成员
|
|
|
|
|
for _, afv := range family {
|
|
|
|
|
if overallhandle.StringIsInMap(afv.Name, writeName) == false {
|
|
|
|
|
var addFamliyCont models.FamilyMembers
|
|
|
|
|
addFamliyCont.Key = manKeyNum
|
|
|
|
|
addFamliyCont.Number = num
|
|
|
|
|
addFamliyCont.Relationship = afv.Relationship //亲属关系"`
|
|
|
|
|
addFamliyCont.Name = afv.Name //姓名"`
|
|
|
|
|
addFamliyCont.Company = afv.Company //所在公司"`
|
|
|
|
|
addFamliyCont.Deparment = afv.Department //所在部门"`
|
|
|
|
|
addFamliyCont.Postnme = afv.Position //所在岗位"`
|
|
|
|
|
addFamliyCont.Tel = afv.Mobilephone //紧急联系人电话"`
|
|
|
|
|
// polilOutlook, _ := overallhandle.StringToInt(afv.PoliticalOutlook)
|
|
|
|
|
// addFamliyCont.PoliticalOutlook = polilOutlook //政治面貌
|
|
|
|
|
|
|
|
|
|
addFamliyCont.PoliticalOutlook = politiToInt(afv.PoliticalOutlook) //政治面貌
|
|
|
|
|
addFamliyCont.PoliticalOutlookCn = afv.PoliticalOutlook
|
|
|
|
|
|
|
|
|
|
addFamliyCont.Time = time.Now().Unix() // 创建时间"`
|
|
|
|
|
overall.CONSTANT_DB_HR.Create(&addFamliyCont)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
//新增家庭成员
|
|
|
|
|
for _, v := range family {
|
|
|
|
|
var addFamliyCont models.FamilyMembers
|
|
|
|
|
addFamliyCont.Key = manKeyNum
|
|
|
|
|
addFamliyCont.Number = num
|
|
|
|
|
addFamliyCont.Relationship = v.Relationship //亲属关系"`
|
|
|
|
|
addFamliyCont.Name = v.Name //姓名"`
|
|
|
|
|
addFamliyCont.Company = v.Company //所在公司"`
|
|
|
|
|
addFamliyCont.Deparment = v.Department //所在部门"`
|
|
|
|
|
addFamliyCont.Postnme = v.Position //所在岗位"`
|
|
|
|
|
addFamliyCont.Tel = v.Mobilephone //紧急联系人电话"`
|
|
|
|
|
// polilOutlook, _ := overallhandle.StringToInt(v.PoliticalOutlook)
|
|
|
|
|
// addFamliyCont.PoliticalOutlook = polilOutlook //政治面貌
|
|
|
|
|
|
|
|
|
|
addFamliyCont.PoliticalOutlook = politiToInt(v.PoliticalOutlook) //政治面貌
|
|
|
|
|
addFamliyCont.PoliticalOutlookCn = v.PoliticalOutlook
|
|
|
|
|
|
|
|
|
|
addFamliyCont.Time = time.Now().Unix() // 创建时间"`
|
|
|
|
|
overall.CONSTANT_DB_HR.Create(&addFamliyCont)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 教育经历
|
|
|
|
|
func educatExperKingdeeNew(manKeyNum int64, manCont addKingdeePersonneles) {
|
|
|
|
|
defer synPro.Done()
|
|
|
|
|
if manCont.HighestGraduationSchool != "" {
|
|
|
|
|
//最高学历
|
|
|
|
|
var perEduContHig models.PersonnelEducation
|
|
|
|
|
highestGormDb := overall.CONSTANT_DB_HR.Model(&models.PersonnelEducation{}).Where("`key` = ? AND `graduation_school` = ? AND `subject` = ?", manKeyNum, manCont.HighestGraduationSchool, manCont.HighestSubject)
|
|
|
|
|
higErr := highestGormDb.First(&perEduContHig).Error
|
|
|
|
|
|
|
|
|
|
if higErr == nil {
|
|
|
|
|
eitdCont := overallhandle.MapOut()
|
|
|
|
|
if manCont.HighestEducation != "" {
|
|
|
|
|
// hightion, _ := overallhandle.StringToInt(manCont.HighestEducation)
|
|
|
|
|
hightion := ducationToInt(manCont.HighestEducation)
|
|
|
|
|
if hightion != perEduContHig.Education {
|
|
|
|
|
eitdCont["education"] = hightion
|
|
|
|
|
eitdCont["education_cn"] = manCont.HighestEducation
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if manCont.HighestAcademicDegree != "" {
|
|
|
|
|
// highecDegree, _ := overallhandle.StringToInt(manCont.HighestAcademicDegree)
|
|
|
|
|
highecDegree := hestacademicdegreeToInt(manCont.HighestAcademicDegree)
|
|
|
|
|
if highecDegree != perEduContHig.AcademicDegree {
|
|
|
|
|
eitdCont["academic_degree"] = highecDegree
|
|
|
|
|
eitdCont["academic_degree_cn"] = manCont.HighestAcademicDegree
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if manCont.HighestAdmissionTime != "" {
|
|
|
|
|
entranceTime, entranceTimeErr := overallhandle.DateToTimeStamp(manCont.HighestAdmissionTime)
|
|
|
|
|
if entranceTimeErr == false {
|
|
|
|
|
entranceTime, _ = overallhandle.DateToTimeStamp(fmt.Sprintf("%v 00:00:00", manCont.HighestAdmissionTime))
|
|
|
|
|
}
|
|
|
|
|
if entranceTime != perEduContHig.AdmissionTime {
|
|
|
|
|
eitdCont["admission_time"] = entranceTime
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if manCont.HighestGraduationTime != "" {
|
|
|
|
|
graduationTime, graduationTimeErr := overallhandle.DateToTimeStamp(manCont.HighestGraduationTime)
|
|
|
|
|
if graduationTimeErr == false {
|
|
|
|
|
graduationTime, _ = overallhandle.DateToTimeStamp(fmt.Sprintf("%v 00:00:00", manCont.HighestGraduationTime))
|
|
|
|
|
}
|
|
|
|
|
if graduationTime != perEduContHig.GraduationTime {
|
|
|
|
|
eitdCont["graduation_time"] = graduationTime
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if len(eitdCont) > 0 {
|
|
|
|
|
eitdCont["Time"] = time.Now().Unix()
|
|
|
|
|
eitdCont["level"] = 3
|
|
|
|
|
var oldFamilyCont models.PersonnelEducation
|
|
|
|
|
oldFamilyCont.EiteCont(map[string]interface{}{"`id`": perEduContHig.Id}, eitdCont)
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
var perEduContFirstIsTrue models.PersonnelEducation
|
|
|
|
|
highestGormDbIsTrue := overall.CONSTANT_DB_HR.Model(&models.PersonnelEducation{}).Where("`level` = 3 AND `key` = ?", manKeyNum).First(&perEduContFirstIsTrue).Error
|
|
|
|
|
if highestGormDbIsTrue == nil {
|
|
|
|
|
eitdCont := overallhandle.MapOut()
|
|
|
|
|
eitdCont["Time"] = time.Now().Unix()
|
|
|
|
|
eitdCont["level"] = 1
|
|
|
|
|
var oldFamilyCont models.PersonnelEducation
|
|
|
|
|
oldFamilyCont.EiteCont(map[string]interface{}{"`key`": manKeyNum, "level": 3}, eitdCont)
|
|
|
|
|
}
|
|
|
|
|
perEduContHig.Key = manKeyNum
|
|
|
|
|
perEduContHig.Number = manCont.Number // 员工工号
|
|
|
|
|
// highcation, _ := overallhandle.StringToInt(manCont.HighestEducation)
|
|
|
|
|
highcation := ducationToInt(manCont.HighestEducation)
|
|
|
|
|
perEduContHig.Education = highcation // 学历(1:初中及以下;2:中专;3:高中;4:中技;5:高技;6:函数专科;7:大学专科;8:函数本科;9:大学本科;10:硕士研究生;11:博士研究生;12:专家、教授)"`
|
|
|
|
|
perEduContHig.EducationCn = manCont.HighestEducation
|
|
|
|
|
perEduContHig.GraduationSchool = manCont.HighestGraduationSchool // 毕业学校"`
|
|
|
|
|
perEduContHig.Subject = manCont.HighestSubject // 专业"`
|
|
|
|
|
entranceTime := time.Now().Unix()
|
|
|
|
|
if manCont.HighestAdmissionTime != "" {
|
|
|
|
|
entranceTimeErr := false
|
|
|
|
|
entranceTime, entranceTimeErr = overallhandle.DateToTimeStamp(manCont.HighestAdmissionTime)
|
|
|
|
|
if entranceTimeErr == false {
|
|
|
|
|
entranceTime, _ = overallhandle.DateToTimeStamp(fmt.Sprintf("%v 00:00:00", manCont.HighestAdmissionTime))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
perEduContHig.AdmissionTime = entranceTime // 入学时间"`
|
|
|
|
|
graduationTime := time.Now().Unix()
|
|
|
|
|
if manCont.HighestGraduationTime != "" {
|
|
|
|
|
graduationTimeErr := false
|
|
|
|
|
graduationTime, graduationTimeErr = overallhandle.DateToTimeStamp(manCont.HighestGraduationTime)
|
|
|
|
|
if graduationTimeErr == false {
|
|
|
|
|
graduationTime, _ = overallhandle.DateToTimeStamp(fmt.Sprintf("%v 00:00:00", manCont.HighestGraduationTime))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
perEduContHig.GraduationTime = graduationTime // 毕业时间"`
|
|
|
|
|
perEduContHig.Time = time.Now().Unix() // 写入时间"`
|
|
|
|
|
// highgree, _ := overallhandle.StringToInt(manCont.HighestAcademicDegree)
|
|
|
|
|
highgree := hestacademicdegreeToInt(manCont.HighestAcademicDegree)
|
|
|
|
|
perEduContHig.AcademicDegree = highgree
|
|
|
|
|
perEduContHig.AcademicDegreeCn = manCont.HighestAcademicDegree
|
|
|
|
|
perEduContHig.Level = 3 // 学历类型(1:普通;2:第一学历;3:最高学历)"`
|
|
|
|
|
overall.CONSTANT_DB_HR.Create(&perEduContHig)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//第一学历
|
|
|
|
|
// fmt.Printf("第一学历------>%v\n", manCont.FirstGraduationSchool)
|
|
|
|
|
if manCont.FirstGraduationSchool != "" {
|
|
|
|
|
//第一学历
|
|
|
|
|
var perEduContFirst models.PersonnelEducation
|
|
|
|
|
firsthestGormDb := overall.CONSTANT_DB_HR.Model(&models.PersonnelEducation{}).Where("`key` = ? AND graduation_school = ? AND subject = ?", manKeyNum, manCont.FirstGraduationSchool, manCont.FirstSubject)
|
|
|
|
|
higErr := firsthestGormDb.First(&perEduContFirst).Error
|
|
|
|
|
|
|
|
|
|
if higErr == nil {
|
|
|
|
|
eitdContFirst := overallhandle.MapOut()
|
|
|
|
|
if manCont.FirstEducation != "" {
|
|
|
|
|
// firation, _ := overallhandle.StringToInt(manCont.FirstEducation)
|
|
|
|
|
|
|
|
|
|
firation := ducationToInt(manCont.FirstEducation)
|
|
|
|
|
|
|
|
|
|
if firation != perEduContFirst.Education {
|
|
|
|
|
eitdContFirst["education"] = firation
|
|
|
|
|
eitdContFirst["education_cn"] = manCont.FirstEducation
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if manCont.FirstAcademicDegree != "" {
|
|
|
|
|
|
|
|
|
|
// firstAcadee, _ := overallhandle.StringToInt(manCont.FirstAcademicDegree)
|
|
|
|
|
firstAcadee := hestacademicdegreeToInt(manCont.FirstAcademicDegree)
|
|
|
|
|
|
|
|
|
|
if firstAcadee != perEduContFirst.AcademicDegree {
|
|
|
|
|
eitdContFirst["academic_degree"] = firstAcadee
|
|
|
|
|
eitdContFirst["academic_degree_cn"] = manCont.FirstAcademicDegree
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if manCont.FirstAdmissionTime != "" {
|
|
|
|
|
entranceTimeFirst, entranceTimeFirstErr := overallhandle.DateToTimeStamp(manCont.FirstAdmissionTime)
|
|
|
|
|
if entranceTimeFirstErr == false {
|
|
|
|
|
entranceTimeFirst, _ = overallhandle.DateToTimeStamp(fmt.Sprintf("%v 00:00:00", manCont.FirstAdmissionTime))
|
|
|
|
|
}
|
|
|
|
|
if entranceTimeFirst != perEduContFirst.AdmissionTime {
|
|
|
|
|
eitdContFirst["admission_time"] = entranceTimeFirst
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if manCont.FirstGraduationTime != "" {
|
|
|
|
|
graduationTimeFirst, graduationTimeFirstErr := overallhandle.DateToTimeStamp(manCont.FirstGraduationTime)
|
|
|
|
|
if graduationTimeFirstErr == false {
|
|
|
|
|
graduationTimeFirst, _ = overallhandle.DateToTimeStamp(fmt.Sprintf("%v 00:00:00", manCont.FirstGraduationTime))
|
|
|
|
|
}
|
|
|
|
|
if graduationTimeFirst != perEduContFirst.GraduationTime {
|
|
|
|
|
eitdContFirst["graduation_time"] = graduationTimeFirst
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if len(eitdContFirst) > 0 {
|
|
|
|
|
eitdContFirst["Time"] = time.Now().Unix()
|
|
|
|
|
eitdContFirst["level"] = 2
|
|
|
|
|
var oldFamilyContFirst models.PersonnelEducation
|
|
|
|
|
oldFamilyContFirst.EiteCont(map[string]interface{}{"`id`": perEduContFirst.Id}, eitdContFirst)
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
var perEduContFirstIsTrue models.PersonnelEducation
|
|
|
|
|
highestGormDbIsTrue := overall.CONSTANT_DB_HR.Model(&models.PersonnelEducation{}).Where("`level` = 1 AND `key` = ?", manKeyNum).First(&perEduContFirstIsTrue).Error
|
|
|
|
|
if highestGormDbIsTrue == nil {
|
|
|
|
|
eitdContFirst := overallhandle.MapOut()
|
|
|
|
|
eitdContFirst["Time"] = time.Now().Unix()
|
|
|
|
|
eitdContFirst["level"] = 1
|
|
|
|
|
var oldFamilyContFirst models.PersonnelEducation
|
|
|
|
|
oldFamilyContFirst.EiteCont(map[string]interface{}{"`key`": manKeyNum, "level": 2}, eitdContFirst)
|
|
|
|
|
}
|
|
|
|
|
perEduContFirst.Key = manKeyNum
|
|
|
|
|
perEduContFirst.Number = manCont.Number // 员工工号
|
|
|
|
|
// fiEducation, _ := overallhandle.StringToInt(manCont.FirstEducation)
|
|
|
|
|
fiEducation := ducationToInt(manCont.FirstEducation)
|
|
|
|
|
perEduContFirst.EducationCn = manCont.FirstEducation
|
|
|
|
|
perEduContFirst.Education = fiEducation // 学历(1:初中及以下;2:中专;3:高中;4:中技;5:高技;6:函数专科;7:大学专科;8:函数本科;9:大学本科;10:硕士研究生;11:博士研究生;12:专家、教授)"`
|
|
|
|
|
perEduContFirst.GraduationSchool = manCont.FirstGraduationSchool // 毕业学校"`
|
|
|
|
|
perEduContFirst.Subject = manCont.FirstSubject // 专业"`
|
|
|
|
|
entranceTimeFirst := time.Now().Unix()
|
|
|
|
|
if manCont.HighestAdmissionTime != "" {
|
|
|
|
|
entranceTimeFirstErr := false
|
|
|
|
|
entranceTimeFirst, entranceTimeFirstErr = overallhandle.DateToTimeStamp(manCont.HighestAdmissionTime)
|
|
|
|
|
if entranceTimeFirstErr == false {
|
|
|
|
|
entranceTimeFirst, _ = overallhandle.DateToTimeStamp(fmt.Sprintf("%v 00:00:00", manCont.HighestAdmissionTime))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
perEduContFirst.AdmissionTime = entranceTimeFirst // 入学时间"`
|
|
|
|
|
graduationTimef := time.Now().Unix()
|
|
|
|
|
if manCont.FirstGraduationTime != "" {
|
|
|
|
|
graduationTimefErr := false
|
|
|
|
|
graduationTimef, graduationTimefErr = overallhandle.DateToTimeStamp(manCont.FirstGraduationTime)
|
|
|
|
|
if graduationTimefErr == false {
|
|
|
|
|
graduationTimef, _ = overallhandle.DateToTimeStamp(fmt.Sprintf("%v 00:00:00", manCont.FirstGraduationTime))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// fmt.Printf("第一学历------>%v------>%v\n", graduationTimef, manCont.FirstGraduationTime)
|
|
|
|
|
|
|
|
|
|
perEduContFirst.GraduationTime = graduationTimef // 毕业时间"`
|
|
|
|
|
perEduContFirst.Time = time.Now().Unix() // 写入时间"`
|
|
|
|
|
// fitAcmicDgree, _ := overallhandle.StringToInt(manCont.FirstAcademicDegree)
|
|
|
|
|
fitAcmicDgree := hestacademicdegreeToInt(manCont.FirstAcademicDegree)
|
|
|
|
|
perEduContFirst.AcademicDegree = fitAcmicDgree
|
|
|
|
|
perEduContFirst.AcademicDegreeCn = manCont.FirstAcademicDegree
|
|
|
|
|
perEduContFirst.Level = 2 // 学历类型(1:普通;2:第一学历;3:最高学历)"`
|
|
|
|
|
overall.CONSTANT_DB_HR.Create(&perEduContFirst)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 编辑工作履历
|
|
|
|
|
func editWorkHistoryMan(manKeyNum int64, num string, workHistoryList []workHistoryAry) {
|
|
|
|
|
defer synPro.Done()
|
|
|
|
|
if len(workHistoryList) > 0 && manKeyNum != 0 {
|
|
|
|
|
var oldWork []models.WorkHistory
|
|
|
|
|
oldWorkErr := overall.CONSTANT_DB_HR.Where("`key` = ?", manKeyNum).Find(&oldWork).Error
|
|
|
|
|
if oldWorkErr == nil && len(oldWork) > 0 {
|
|
|
|
|
for _, wvs := range workHistoryList {
|
|
|
|
|
var whCont models.WorkHistory
|
|
|
|
|
isEidtErr := whCont.GetCont(map[string]interface{}{"`key`": manKeyNum, "`company`": wvs.Company, "`deparment`": wvs.Department, "`job`": wvs.Position}, "id", "entry_time", "leavedate", "witness", "witness_tel", "remarks")
|
|
|
|
|
if isEidtErr == nil {
|
|
|
|
|
saveDate := overallhandle.MapOut()
|
|
|
|
|
if wvs.EntryTime != "" { //入职时间"`
|
|
|
|
|
|
|
|
|
|
entryData, entryDataErr := overallhandle.DateToTimeStamp(wvs.EntryTime)
|
|
|
|
|
if entryDataErr == false {
|
|
|
|
|
entryData, _ = overallhandle.DateToTimeStamp(fmt.Sprintf("%v 12:00:00", wvs.EntryTime))
|
|
|
|
|
}
|
|
|
|
|
if entryData != whCont.EntryTime {
|
|
|
|
|
saveDate["entry_time"] = entryData
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if wvs.LeaveDate != "" { //离职日期"`
|
|
|
|
|
leaveTime, leaveTimeErr := overallhandle.DateToTimeStamp(wvs.LeaveDate)
|
|
|
|
|
if leaveTimeErr == false {
|
|
|
|
|
leaveTime, _ = overallhandle.DateToTimeStamp(fmt.Sprintf("%v 12:00:00", wvs.LeaveDate))
|
|
|
|
|
}
|
|
|
|
|
if leaveTime != whCont.Leavedate {
|
|
|
|
|
saveDate["leavedate"] = leaveTime
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if wvs.Witness != "" && wvs.Witness != whCont.Witness {
|
|
|
|
|
saveDate["witness"] = wvs.Witness
|
|
|
|
|
}
|
|
|
|
|
if wvs.WitnessTel != "" && wvs.WitnessTel != whCont.WitnessTel {
|
|
|
|
|
saveDate["witness_tel"] = wvs.WitnessTel
|
|
|
|
|
}
|
|
|
|
|
if wvs.Remarks != "" && wvs.Remarks != whCont.Remarks {
|
|
|
|
|
saveDate["remarks"] = wvs.Remarks
|
|
|
|
|
}
|
|
|
|
|
if len(saveDate) > 0 {
|
|
|
|
|
saveDate["time"] = time.Now().Unix()
|
|
|
|
|
saveDate["state"] = 1
|
|
|
|
|
var eidtWorkHisCont models.WorkHistory
|
|
|
|
|
eidtWorkHisCont.EiteCont(map[string]interface{}{"`id`": whCont.Id}, saveDate)
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
var addWorkCont models.WorkHistory
|
|
|
|
|
addWorkCont.Number = num //工号"`
|
|
|
|
|
addWorkCont.Key = manKeyNum //身份识别"`
|
|
|
|
|
addWorkCont.Company = wvs.Company //公司"`
|
|
|
|
|
addWorkCont.Deparment = wvs.Department //部门"`
|
|
|
|
|
addWorkCont.Job = wvs.Position //职务"`
|
|
|
|
|
entryData := time.Now().Unix()
|
|
|
|
|
if wvs.EntryTime != "" {
|
|
|
|
|
entryDataErr := false
|
|
|
|
|
entryData, entryDataErr = overallhandle.DateToTimeStamp(wvs.EntryTime)
|
|
|
|
|
if entryDataErr == false {
|
|
|
|
|
entryData, _ = overallhandle.DateToTimeStamp(fmt.Sprintf("%v 12:00:00", wvs.EntryTime))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
addWorkCont.EntryTime = entryData //入职时间"`
|
|
|
|
|
leaveTime := time.Now().Unix()
|
|
|
|
|
if wvs.LeaveDate != "" {
|
|
|
|
|
leaveTimeErr := false
|
|
|
|
|
leaveTime, leaveTimeErr = overallhandle.DateToTimeStamp(wvs.LeaveDate)
|
|
|
|
|
if leaveTimeErr == false {
|
|
|
|
|
leaveTime, _ = overallhandle.DateToTimeStamp(fmt.Sprintf("%v 12:00:00", wvs.LeaveDate))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
addWorkCont.Leavedate = leaveTime //离职日期"`
|
|
|
|
|
addWorkCont.Witness = wvs.Witness //证明人"`
|
|
|
|
|
addWorkCont.WitnessTel = wvs.WitnessTel //证明人电话"`
|
|
|
|
|
addWorkCont.Remarks = wvs.Remarks //备注"`
|
|
|
|
|
addWorkCont.Time = time.Now().Unix() //创建时间"`
|
|
|
|
|
addWorkCont.State = 1 //状态(1:启用;2:禁用;3:删除)"`
|
|
|
|
|
overall.CONSTANT_DB_HR.Create(&addWorkCont)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
var addAllWork []models.WorkHistory
|
|
|
|
|
for _, v := range workHistoryList {
|
|
|
|
|
var addWorkCont models.WorkHistory
|
|
|
|
|
addWorkCont.Number = num //工号"`
|
|
|
|
|
addWorkCont.Key = manKeyNum //身份识别"`
|
|
|
|
|
addWorkCont.Company = v.Company //公司"`
|
|
|
|
|
addWorkCont.Deparment = v.Department //部门"`
|
|
|
|
|
addWorkCont.Job = v.Position //职务"`
|
|
|
|
|
entryData := time.Now().Unix()
|
|
|
|
|
if v.EntryTime != "" {
|
|
|
|
|
entryDataErr := false
|
|
|
|
|
entryData, entryDataErr = overallhandle.DateToTimeStamp(v.EntryTime)
|
|
|
|
|
if entryDataErr == false {
|
|
|
|
|
entryData, _ = overallhandle.DateToTimeStamp(fmt.Sprintf("%v 12:00:00", v.EntryTime))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
addWorkCont.EntryTime = entryData //入职时间"`
|
|
|
|
|
leaveTime := time.Now().Unix()
|
|
|
|
|
if v.LeaveDate != "" {
|
|
|
|
|
leaveTimeErr := false
|
|
|
|
|
leaveTime, leaveTimeErr = overallhandle.DateToTimeStamp(v.LeaveDate)
|
|
|
|
|
if leaveTimeErr == false {
|
|
|
|
|
leaveTime, _ = overallhandle.DateToTimeStamp(fmt.Sprintf("%v 12:00:00", v.LeaveDate))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
addWorkCont.Leavedate = leaveTime //离职日期"`
|
|
|
|
|
addWorkCont.Witness = v.Witness //证明人"`
|
|
|
|
|
addWorkCont.WitnessTel = v.WitnessTel //证明人电话"`
|
|
|
|
|
addWorkCont.Remarks = v.Remarks //备注"`
|
|
|
|
|
addWorkCont.Time = time.Now().Unix() //创建时间"`
|
|
|
|
|
addWorkCont.State = 1 //状态(1:启用;2:禁用;3:删除)"`
|
|
|
|
|
addAllWork = append(addAllWork, addWorkCont)
|
|
|
|
|
}
|
|
|
|
|
if len(addAllWork) > 0 {
|
|
|
|
|
overall.CONSTANT_DB_HR.Create(&addAllWork)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 编辑集团内工作经历
|
|
|
|
|
func editInsideWorkHistoryMan(manKeyNum int64, contList []insideHistoryer) {
|
|
|
|
|
defer synPro.Done()
|
|
|
|
|
if len(contList) > 0 && manKeyNum > 0 {
|
|
|
|
|
//判断是否已经存在集团内工作履历
|
|
|
|
|
var insideWork []models.InsideWorkHistory
|
|
|
|
|
err := overall.CONSTANT_DB_HR.Model(&models.InsideWorkHistory{}).Select("`id`").Where("`key` = ?", manKeyNum).Find(&insideWork).Error
|
|
|
|
|
// fmt.Printf("isErr---err--insideWork-->%v-------->%v\n", err, insideWork)
|
|
|
|
|
var topGroup int64 = 0
|
|
|
|
|
var groupTopCont models.AdministrativeOrganization
|
|
|
|
|
groupTopCont.GetCont(map[string]interface{}{"superior": 0}, "id")
|
|
|
|
|
topGroup = groupTopCont.Id
|
|
|
|
|
|
|
|
|
|
if err == nil && len(insideWork) > 0 {
|
|
|
|
|
var iInt []int
|
|
|
|
|
for i, v := range contList {
|
|
|
|
|
var wssCont models.AdministrativeOrganization
|
|
|
|
|
wssCont.GetCont(map[string]interface{}{"kingdeeid": v.WorkshopSection}, "id") //工段信息
|
|
|
|
|
|
|
|
|
|
//集团
|
|
|
|
|
|
|
|
|
|
var groupContes models.AdministrativeOrganization
|
|
|
|
|
if v.Group != "" {
|
|
|
|
|
groupContes.GetCont(map[string]interface{}{"kingdeeid": v.Group}, "id")
|
|
|
|
|
if groupContes.Id == 0 {
|
|
|
|
|
groupContes.Id = topGroup
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
groupContes.Id = topGroup
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// fmt.Printf("groupContes---err--->%v-------->%v\n", topGroup, groupContes)
|
|
|
|
|
|
|
|
|
|
//部门
|
|
|
|
|
var dempCont models.AdministrativeOrganization
|
|
|
|
|
dempCont.GetCont(map[string]interface{}{"kingdeeid": v.Department}, "id")
|
|
|
|
|
if dempCont.Id == groupContes.Id {
|
|
|
|
|
if wssCont.Id != 0 {
|
|
|
|
|
dempCont.Id = overallhandle.RecursionOrgLeve(wssCont.Id, 4)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//公司
|
|
|
|
|
var compayCont models.AdministrativeOrganization
|
|
|
|
|
compayCont.GetCont(map[string]interface{}{"kingdeeid": v.Company}, "id")
|
|
|
|
|
//职务
|
|
|
|
|
var postCont models.Position
|
|
|
|
|
postCont.GetCont(map[string]interface{}{"kingdeeid": v.Position}, "id")
|
|
|
|
|
|
|
|
|
|
var insiCont models.InsideWorkHistory
|
|
|
|
|
isErr := insiCont.GetCont(map[string]interface{}{"`key`": manKeyNum, "`group`": groupContes.Id, "`company`": compayCont.Id, "`department`": dempCont.Id, "workshop_section": wssCont.Id, "position": postCont.Id})
|
|
|
|
|
|
|
|
|
|
// fmt.Printf("isErr--->wssCont---------->%v-------->groupContes---------->%v-------->dempCont--------->%v-------->compayCont--------->%v-------->postCont---------->%v---------->%v--->%v--->%v----->v.Group----->%v\n", wssCont, groupContes, dempCont, compayCont, postCont, i, iInt, isErr, v.Group)
|
|
|
|
|
if isErr == nil {
|
|
|
|
|
iInt = append(iInt, i)
|
|
|
|
|
saveData := overallhandle.MapOut()
|
|
|
|
|
if v.Group != "" {
|
|
|
|
|
var groupCont models.AdministrativeOrganization
|
|
|
|
|
groupCont.GetCont(map[string]interface{}{"kingdeeid": v.Group}, "id")
|
|
|
|
|
if groupCont.Id != insiCont.Group {
|
|
|
|
|
saveData["group"] = groupCont.Id
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if v.Company != "" {
|
|
|
|
|
var companyCont models.AdministrativeOrganization
|
|
|
|
|
companyCont.GetCont(map[string]interface{}{"kingdeeid": v.Company}, "id")
|
|
|
|
|
if companyCont.Id != insiCont.Company {
|
|
|
|
|
saveData["company"] = companyCont.Id
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if v.Department != "" {
|
|
|
|
|
var departmentCont models.AdministrativeOrganization
|
|
|
|
|
departmentCont.GetCont(map[string]interface{}{"kingdeeid": v.Department}, "id")
|
|
|
|
|
if departmentCont.Id != insiCont.Department {
|
|
|
|
|
saveData["department"] = departmentCont.Id
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if v.Workshop != "" {
|
|
|
|
|
var workshopCont models.AdministrativeOrganization
|
|
|
|
|
workshopCont.GetCont(map[string]interface{}{"kingdeeid": v.Workshop}, "id")
|
|
|
|
|
if workshopCont.Id != insiCont.WorkShop {
|
|
|
|
|
saveData["workshop"] = workshopCont.Id
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if v.WorkshopSection != "" && wssCont.Id != insiCont.WorkshopSection {
|
|
|
|
|
saveData["workshop_section"] = wssCont.Id
|
|
|
|
|
}
|
|
|
|
|
if v.Position != "" {
|
|
|
|
|
var positionCont models.Position
|
|
|
|
|
positionCont.GetCont(map[string]interface{}{"kingdeeid": v.Position}, "id")
|
|
|
|
|
if positionCont.Id != insiCont.Position {
|
|
|
|
|
saveData["position"] = positionCont.Id
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if v.GradePositions != 0 && insiCont.GradePositions != insiCont.GradePositions {
|
|
|
|
|
saveData["grade_positions"] = v.GradePositions
|
|
|
|
|
}
|
|
|
|
|
if v.StartTime != "" {
|
|
|
|
|
startTime, startTimeErr := overallhandle.DateToTimeStamp(v.StartTime)
|
|
|
|
|
if startTimeErr == false {
|
|
|
|
|
startTime, _ = overallhandle.DateToTimeStamp(fmt.Sprintf("%v 00:00:00", v.StartTime))
|
|
|
|
|
}
|
|
|
|
|
if startTime != insiCont.StartTime {
|
|
|
|
|
saveData["start_time"] = startTime
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if v.StartTime != "" {
|
|
|
|
|
if v.EndTime != "至今" && v.EndTime != "2199-12-31 00:00:00" && v.EndTime != "2199-12-31" && v.EndTime != "7258003200" {
|
|
|
|
|
// fmt.Printf("EndTime----insiCont.Id------>%v--------->%v\n", v.StartTime, insiCont.Id)
|
|
|
|
|
endTime, endTimeErr := overallhandle.DateToTimeStamp(v.EndTime)
|
|
|
|
|
if endTimeErr == false {
|
|
|
|
|
// fmt.Printf("EndTime----1----->%v----->%v\n", endTime, insiCont.Id)
|
|
|
|
|
endTime, _ = overallhandle.DateToTimeStamp(fmt.Sprintf("%v 00:00:00", v.EndTime))
|
|
|
|
|
// fmt.Printf("EndTime----3----->%v----->%v\n", endTime, insiCont.Id)
|
|
|
|
|
}
|
|
|
|
|
if endTime != insiCont.EndTime {
|
|
|
|
|
// fmt.Printf("EndTime----3----->%v----->%v\n", endTime, insiCont.Id)
|
|
|
|
|
saveData["end_time"] = endTime
|
|
|
|
|
saveData["state"] = 2
|
|
|
|
|
}
|
|
|
|
|
// fmt.Printf("EndTime----4----->%v----->%v\n", endTime, insiCont.Id)
|
|
|
|
|
} else {
|
|
|
|
|
// fmt.Printf("EndTime----5----->%v----->%v\n", 0, insiCont.Id)
|
|
|
|
|
saveData["end_time"] = 0
|
|
|
|
|
saveData["state"] = 1
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if v.ChangeType != "" {
|
|
|
|
|
// chType, _ := overallhandle.StringToInt(v.ChangeType)
|
|
|
|
|
chType := changeTypeToInt(v.ChangeType)
|
|
|
|
|
if chType != insiCont.ChangeType {
|
|
|
|
|
saveData["change_type"] = chType
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if v.AssignType != "" {
|
|
|
|
|
assType := assignTypeToInt(v.AssignType)
|
|
|
|
|
if assType != insiCont.AssignType {
|
|
|
|
|
saveData["assign_type"] = assType
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if len(saveData) > 0 {
|
|
|
|
|
insiCont.EditCont(map[string]interface{}{"`id`": insiCont.Id}, saveData)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if len(iInt) < len(contList) {
|
|
|
|
|
var addData []models.InsideWorkHistory
|
|
|
|
|
for ii, vv := range contList {
|
|
|
|
|
if overallhandle.IsInTrue[int](ii, iInt) == false {
|
|
|
|
|
var cont models.InsideWorkHistory
|
|
|
|
|
cont.Key = manKeyNum //员工识别符"`
|
|
|
|
|
if vv.Group != "" {
|
|
|
|
|
var groupCont models.AdministrativeOrganization
|
|
|
|
|
groupErr := groupCont.GetCont(map[string]interface{}{"kingdeeid": vv.Group}, "id")
|
|
|
|
|
if groupErr == nil {
|
|
|
|
|
cont.Group = groupCont.Id //集团"`
|
|
|
|
|
} else {
|
|
|
|
|
cont.Group = topGroup //集团"`
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
cont.Group = topGroup //集团"`
|
|
|
|
|
}
|
|
|
|
|
if vv.Company != "" {
|
|
|
|
|
var companyCont models.AdministrativeOrganization
|
|
|
|
|
companyErr := companyCont.GetCont(map[string]interface{}{"kingdeeid": vv.Company}, "id")
|
|
|
|
|
if companyErr == nil {
|
|
|
|
|
cont.Company = companyCont.Id //部室"`
|
|
|
|
|
} else {
|
|
|
|
|
cont.Company = topGroup //部室"`
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
cont.Company = topGroup //部室"`
|
|
|
|
|
}
|
|
|
|
|
if vv.Department != "" {
|
|
|
|
|
var departCont models.AdministrativeOrganization
|
|
|
|
|
departErr := departCont.GetCont(map[string]interface{}{"kingdeeid": vv.Department}, "id")
|
|
|
|
|
if departErr == nil {
|
|
|
|
|
cont.Department = departCont.Id //部室"`
|
|
|
|
|
} else {
|
|
|
|
|
cont.Department = topGroup //部室"`
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
cont.Department = topGroup //部室"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if vv.Workshop != "" {
|
|
|
|
|
var workShopCont models.AdministrativeOrganization
|
|
|
|
|
workShopErr := workShopCont.GetCont(map[string]interface{}{"kingdeeid": vv.Workshop}, "id")
|
|
|
|
|
if workShopErr == nil {
|
|
|
|
|
cont.WorkShop = workShopCont.Id //部室"`
|
|
|
|
|
} else {
|
|
|
|
|
cont.WorkShop = 0 //二级部门或车间"`
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
cont.WorkShop = 0 //二级部门或车间"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if vv.WorkshopSection != "" {
|
|
|
|
|
var workShopSecCont models.AdministrativeOrganization
|
|
|
|
|
workShopSecErr := workShopSecCont.GetCont(map[string]interface{}{"kingdeeid": vv.WorkshopSection}, "id")
|
|
|
|
|
if workShopSecErr == nil {
|
|
|
|
|
cont.WorkshopSection = workShopSecCont.Id //工段"`
|
|
|
|
|
} else {
|
|
|
|
|
cont.WorkshopSection = 0 //工段"`
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
cont.WorkshopSection = 0 //工段"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if vv.Position != "" {
|
|
|
|
|
var positionCont models.Position
|
|
|
|
|
positionErr := positionCont.GetCont(map[string]interface{}{"kingdeeid": vv.Position}, "id")
|
|
|
|
|
if positionErr == nil {
|
|
|
|
|
cont.Position = positionCont.Id //职位"`
|
|
|
|
|
} else {
|
|
|
|
|
cont.Position = 1 //职位"`
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
cont.Position = 1 //职位"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cont.GradePositions = vv.GradePositions //职等"`
|
|
|
|
|
|
|
|
|
|
startTime := time.Now().Unix()
|
|
|
|
|
if vv.StartTime != "" {
|
|
|
|
|
startTimeErr := false
|
|
|
|
|
startTime, startTimeErr = overallhandle.DateToTimeStamp(vv.StartTime)
|
|
|
|
|
if startTimeErr == false {
|
|
|
|
|
startTime, _ = overallhandle.DateToTimeStamp(fmt.Sprintf("%v 00:00:00", vv.StartTime))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
cont.StartTime = startTime //开始日期"`
|
|
|
|
|
cont.State = 1 //状态(1:启用;2:禁用;3:删除)"`
|
|
|
|
|
if vv.EndTime != "" {
|
|
|
|
|
if vv.EndTime != "至今" && vv.EndTime != "2199-12-31 00:00:00" && vv.EndTime != "2199-12-31" && vv.EndTime != "7258003200" {
|
|
|
|
|
endTime, endTimeErr := overallhandle.DateToTimeStamp(vv.EndTime)
|
|
|
|
|
if endTimeErr == false {
|
|
|
|
|
endTime, _ = overallhandle.DateToTimeStamp(fmt.Sprintf("%v 00:00:00", vv.EndTime))
|
|
|
|
|
}
|
|
|
|
|
cont.EndTime = endTime
|
|
|
|
|
cont.State = 2
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// fmt.Printf("cont.EndTime------------->%v------->%v\n", cont.EndTime, vv.EndTime)
|
|
|
|
|
cont.Team = 1 //班组(1:长白;2:甲;3:乙;4:丙;5:丁)"`
|
|
|
|
|
|
|
|
|
|
// changeTypes := 1
|
|
|
|
|
// if vv.ChangeType == "" {
|
|
|
|
|
// changeTypes, _ = overallhandle.StringToInt(vv.ChangeType)
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
// cont.ChangeType = changeTypes //变动类型(1:预入职;2:雇佣入职;3:转正;4:职等调整;5:调动调入;6:借调;7:兼职;8:预离职;9:离职;10:退休;11:返聘;12:员工初始化;)"`
|
|
|
|
|
|
|
|
|
|
cont.AssignType = assignTypeToInt(vv.AssignType)
|
|
|
|
|
cont.ChangeType = changeTypeToInt(vv.ChangeType)
|
|
|
|
|
|
|
|
|
|
cont.Time = time.Now().Unix() //:创建时间"`
|
|
|
|
|
|
|
|
|
|
addData = append(addData, cont)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if len(addData) > 0 {
|
|
|
|
|
overall.CONSTANT_DB_HR.Create(&addData)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
//不存在集团内部工作经历,进行新政
|
|
|
|
|
var addData []models.InsideWorkHistory
|
|
|
|
|
for _, v := range contList {
|
|
|
|
|
var cont models.InsideWorkHistory
|
|
|
|
|
cont.Key = manKeyNum //员工识别符"`
|
|
|
|
|
if v.Group != "" {
|
|
|
|
|
var groupCont models.AdministrativeOrganization
|
|
|
|
|
groupErr := groupCont.GetCont(map[string]interface{}{"kingdeeid": v.Group}, "id")
|
|
|
|
|
if groupErr == nil {
|
|
|
|
|
cont.Group = groupCont.Id //集团"`
|
|
|
|
|
} else {
|
|
|
|
|
cont.Group = topGroup //集团"`
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
cont.Group = topGroup //集团"`
|
|
|
|
|
}
|
|
|
|
|
if v.Company != "" {
|
|
|
|
|
var companyCont models.AdministrativeOrganization
|
|
|
|
|
companyErr := companyCont.GetCont(map[string]interface{}{"kingdeeid": v.Company}, "id")
|
|
|
|
|
if companyErr == nil {
|
|
|
|
|
cont.Company = companyCont.Id //部室"`
|
|
|
|
|
} else {
|
|
|
|
|
cont.Company = topGroup //部室"`
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
cont.Company = topGroup //部室"`
|
|
|
|
|
}
|
|
|
|
|
if v.Department != "" {
|
|
|
|
|
var departCont models.AdministrativeOrganization
|
|
|
|
|
departErr := departCont.GetCont(map[string]interface{}{"kingdeeid": v.Department}, "id")
|
|
|
|
|
if departErr == nil {
|
|
|
|
|
cont.Department = departCont.Id //部室"`
|
|
|
|
|
} else {
|
|
|
|
|
cont.Department = topGroup //部室"`
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
cont.Department = topGroup //部室"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if v.Workshop != "" {
|
|
|
|
|
var workShopCont models.AdministrativeOrganization
|
|
|
|
|
workShopErr := workShopCont.GetCont(map[string]interface{}{"kingdeeid": v.Workshop}, "id")
|
|
|
|
|
if workShopErr == nil {
|
|
|
|
|
cont.WorkShop = workShopCont.Id //部室"`
|
|
|
|
|
} else {
|
|
|
|
|
cont.WorkShop = 0 //二级部门或车间"`
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
cont.WorkShop = 0 //二级部门或车间"`
|
|
|
|
|
}
|
|
|
|
|
// fmt.Printf("v.WorkshopSection --------------------->%v\n", v.WorkshopSection)
|
|
|
|
|
if v.WorkshopSection != "" {
|
|
|
|
|
var workShopSecCont models.AdministrativeOrganization
|
|
|
|
|
workShopSecErr := workShopSecCont.GetCont(map[string]interface{}{"kingdeeid": v.WorkshopSection}, "id")
|
|
|
|
|
// fmt.Printf("v.WorkshopSection ----------id----------->%v\n", workShopSecCont)
|
|
|
|
|
if workShopSecErr == nil {
|
|
|
|
|
cont.WorkshopSection = workShopSecCont.Id //工段"`
|
|
|
|
|
|
|
|
|
|
if v.Department == v.Company {
|
|
|
|
|
cont.Department = overallhandle.RecursionOrgLeve(workShopSecCont.Id, 4)
|
|
|
|
|
}
|
|
|
|
|
if cont.WorkShop == 0 {
|
|
|
|
|
cont.WorkShop = overallhandle.RecursionOrgLeve(workShopSecCont.Id, 5)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
cont.WorkshopSection = 0 //工段"`
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
cont.WorkshopSection = 0 //工段"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if v.Position != "" {
|
|
|
|
|
var positionCont models.Position
|
|
|
|
|
positionErr := positionCont.GetCont(map[string]interface{}{"kingdeeid": v.Position}, "id")
|
|
|
|
|
if positionErr == nil {
|
|
|
|
|
cont.Position = positionCont.Id //职位"`
|
|
|
|
|
} else {
|
|
|
|
|
cont.Position = 1 //职位"`
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
cont.Position = 1 //职位"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cont.GradePositions = v.GradePositions //职等"`
|
|
|
|
|
|
|
|
|
|
startTime := time.Now().Unix()
|
|
|
|
|
if v.StartTime != "" {
|
|
|
|
|
startTimeErr := false
|
|
|
|
|
startTime, startTimeErr = overallhandle.DateToTimeStamp(v.StartTime)
|
|
|
|
|
if startTimeErr == false {
|
|
|
|
|
startTime, _ = overallhandle.DateToTimeStamp(fmt.Sprintf("%v 00:00:00", v.StartTime))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
cont.StartTime = startTime //开始日期"`
|
|
|
|
|
|
|
|
|
|
cont.State = 1 //状态(1:启用;2:休眠;3:删除)"`
|
|
|
|
|
if v.EndTime != "" {
|
|
|
|
|
if v.EndTime != "至今" && v.EndTime != "2199-12-31 00:00:00" && v.EndTime != "2199-12-31" && v.EndTime != "7258003200" {
|
|
|
|
|
endTime, endTimeErr := overallhandle.DateToTimeStamp(v.EndTime)
|
|
|
|
|
if endTimeErr == false {
|
|
|
|
|
endTime, _ = overallhandle.DateToTimeStamp(fmt.Sprintf("%v 00:00:00", v.EndTime))
|
|
|
|
|
}
|
|
|
|
|
cont.EndTime = endTime
|
|
|
|
|
cont.State = 2 //状态(1:启用;2:休眠;3:删除)"`
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
cont.Team = 1 //班组(1:长白;2:甲;3:乙;4:丙;5:丁)"`
|
|
|
|
|
// changeTypes := 1
|
|
|
|
|
// if v.ChangeType == "" {
|
|
|
|
|
// changeTypes, _ = overallhandle.StringToInt(v.ChangeType)
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
// cont.ChangeType = changeTypes
|
|
|
|
|
cont.AssignType = assignTypeToInt(v.AssignType)
|
|
|
|
|
cont.ChangeType = changeTypeToInt(v.ChangeType) //变动类型(1:预入职;2:雇佣入职;3:转正;4:职等调整;5:调动调入;6:借调;7:兼职;8:预离职;9:离职;10:退休;11:返聘;12:员工初始化;)"`
|
|
|
|
|
cont.Time = time.Now().Unix() //:创建时间"`
|
|
|
|
|
|
|
|
|
|
addData = append(addData, cont)
|
|
|
|
|
}
|
|
|
|
|
if len(addData) > 0 {
|
|
|
|
|
overall.CONSTANT_DB_HR.Create(&addData)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
*
|
|
|
|
|
@ 作者: 秦东
|
|
|
|
|
@ 时间: 2022-12-19 10:16:57
|
|
|
|
|
@ 功能: 编辑集团内工作经历
|
|
|
|
|
@ 参数
|
|
|
|
|
|
|
|
|
|
#manKeyNum 员工Key
|
|
|
|
|
#contList 工作经历
|
|
|
|
|
|
|
|
|
|
@ 返回值
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
@ 方法原型
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
*/
|
|
|
|
|
func editInsideWorkHistoryManNew(manKeyNum int64, contList []insideHistoryer) {
|
|
|
|
|
defer synPro.Done()
|
|
|
|
|
if len(contList) > 0 && manKeyNum > 0 {
|
|
|
|
|
var topGroup int64 = 0 // 集团ID
|
|
|
|
|
var groupTopCont models.AdministrativeOrganization
|
|
|
|
|
groupTopCont.GetCont(map[string]interface{}{"superior": 0}, "id")
|
|
|
|
|
topGroup = groupTopCont.Id
|
|
|
|
|
|
|
|
|
|
//获取个人信息
|
|
|
|
|
var myCont models.PersonArchives
|
|
|
|
|
myCont.GetCont(map[string]interface{}{"key": manKeyNum}, "`company`", "`maindeparment`", "`admin_org`", "`sun_main_deparment`", "`position`", "`teamid`")
|
|
|
|
|
|
|
|
|
|
//1、判断是否存在集团工作经历
|
|
|
|
|
var oldInsideWork []models.InsideWorkHistory
|
|
|
|
|
overall.CONSTANT_DB_HR.Where("`key` = ?", manKeyNum).Find(&oldInsideWork)
|
|
|
|
|
|
|
|
|
|
//已经写入得编号
|
|
|
|
|
var writeIn []int
|
|
|
|
|
var creadAllData []models.InsideWorkHistory //新增工作经历
|
|
|
|
|
for i, v := range contList {
|
|
|
|
|
WorkShop := myCont.SunMainDeparment
|
|
|
|
|
if v.Workshop != "" {
|
|
|
|
|
var workShopCont models.AdministrativeOrganization
|
|
|
|
|
workShopErr := workShopCont.GetCont(map[string]interface{}{"kingdeeid": v.Workshop}, "id")
|
|
|
|
|
if workShopErr == nil {
|
|
|
|
|
WorkShop = workShopCont.Id //部室"`
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
WorkshopSection := myCont.AdminOrg
|
|
|
|
|
// fmt.Printf("v.WorkshopSection --------------------->%v\n", v.WorkshopSection)
|
|
|
|
|
if v.WorkshopSection != "" {
|
|
|
|
|
var workShopSecCont models.AdministrativeOrganization
|
|
|
|
|
workShopSecErr := workShopSecCont.GetCont(map[string]interface{}{"kingdeeid": v.WorkshopSection}, "id")
|
|
|
|
|
// fmt.Printf("v.WorkshopSection ----------id----------->%v\n", workShopSecCont)
|
|
|
|
|
if workShopSecErr == nil {
|
|
|
|
|
WorkshopSection = workShopSecCont.Id //工段"`
|
|
|
|
|
|
|
|
|
|
// if v.Department == v.Company {
|
|
|
|
|
// cont.Department = overallhandle.RecursionOrgLeve(workShopSecCont.Id, 4)
|
|
|
|
|
// }
|
|
|
|
|
// if cont.WorkShop == 0 {
|
|
|
|
|
// cont.WorkShop = overallhandle.RecursionOrgLeve(workShopSecCont.Id, 5)
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var wssCont models.AdministrativeOrganization
|
|
|
|
|
wssCont.GetCont(map[string]interface{}{"kingdeeid": v.WorkshopSection}, "id") //工段信息
|
|
|
|
|
if wssCont.Id == 0 {
|
|
|
|
|
wssCont.Id = myCont.AdminOrg
|
|
|
|
|
}
|
|
|
|
|
//集团
|
|
|
|
|
var groupContes models.AdministrativeOrganization
|
|
|
|
|
if v.Group != "" {
|
|
|
|
|
groupContes.GetCont(map[string]interface{}{"kingdeeid": v.Group}, "id")
|
|
|
|
|
if groupContes.Id == 0 {
|
|
|
|
|
groupContes.Id = topGroup
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
groupContes.Id = topGroup
|
|
|
|
|
}
|
|
|
|
|
//部门
|
|
|
|
|
var dempCont models.AdministrativeOrganization
|
|
|
|
|
dempCont.GetCont(map[string]interface{}{"kingdeeid": v.Department}, "id")
|
|
|
|
|
if dempCont.Id == groupContes.Id {
|
|
|
|
|
if wssCont.Id != 0 {
|
|
|
|
|
dempCont.Id = overallhandle.RecursionOrgLeve(wssCont.Id, 4)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if dempCont.Id == 0 {
|
|
|
|
|
dempCont.Id = myCont.MainDeparment
|
|
|
|
|
}
|
|
|
|
|
//公司
|
|
|
|
|
var compayCont models.AdministrativeOrganization
|
|
|
|
|
compayCont.GetCont(map[string]interface{}{"kingdeeid": v.Company}, "id")
|
|
|
|
|
if compayCont.Id == 0 {
|
|
|
|
|
compayCont.Id = myCont.Company
|
|
|
|
|
}
|
|
|
|
|
//职务
|
|
|
|
|
var postCont models.Position
|
|
|
|
|
postCont.GetCont(map[string]interface{}{"kingdeeid": v.Position}, "id")
|
|
|
|
|
if postCont.Id == 0 {
|
|
|
|
|
postCont.Id = myCont.Position
|
|
|
|
|
}
|
|
|
|
|
//判断是否存在集团内部工作经历
|
|
|
|
|
if len(oldInsideWork) > 0 {
|
|
|
|
|
|
|
|
|
|
changeTypeInt := changeTypeToInt(v.ChangeType)
|
|
|
|
|
//判断当前工作经历是否存在
|
|
|
|
|
var insiCont models.InsideWorkHistory
|
|
|
|
|
isErr := insiCont.GetCont(map[string]interface{}{"`key`": manKeyNum, "`group`": groupContes.Id, "`company`": compayCont.Id, "`department`": dempCont.Id, "workshop_section": wssCont.Id, "position": postCont.Id, "`change_type`": changeTypeInt})
|
|
|
|
|
if isErr == nil {
|
|
|
|
|
//此项存在
|
|
|
|
|
if overallhandle.IsInTrue[int](i, writeIn) == false {
|
|
|
|
|
writeIn = append(writeIn, i)
|
|
|
|
|
}
|
|
|
|
|
editSaveData := overallhandle.MapOut()
|
|
|
|
|
startTime := time.Now().Unix()
|
|
|
|
|
if v.StartTime != "" {
|
|
|
|
|
var startTimeErr bool
|
|
|
|
|
startTime, startTimeErr = overallhandle.DateToTimeStamp(v.StartTime)
|
|
|
|
|
if startTimeErr == false {
|
|
|
|
|
startTime, _ = overallhandle.DateToTimeStamp(fmt.Sprintf("%v 00:00:00", v.StartTime))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if startTime != insiCont.StartTime {
|
|
|
|
|
editSaveData["`start_time`"] = startTime
|
|
|
|
|
}
|
|
|
|
|
state := 1
|
|
|
|
|
var endTime int64
|
|
|
|
|
if v.EndTime != "" {
|
|
|
|
|
if v.EndTime != "至今" && v.EndTime != "2199-12-31 00:00:00" && v.EndTime != "2199-12-31" && v.EndTime != "7258003200" {
|
|
|
|
|
var endTimeErr bool
|
|
|
|
|
endTime, endTimeErr = overallhandle.DateToTimeStamp(v.EndTime)
|
|
|
|
|
if endTimeErr == false {
|
|
|
|
|
endTime, _ = overallhandle.DateToTimeStamp(fmt.Sprintf("%v 00:00:00", v.EndTime))
|
|
|
|
|
}
|
|
|
|
|
state = 2 //状态(1:启用;2:休眠;3:删除)"`
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if changeTypeInt > 12 && changeTypeInt <= 14 {
|
|
|
|
|
endTime = time.Now().Unix()
|
|
|
|
|
}
|
|
|
|
|
if endTime != insiCont.EndTime {
|
|
|
|
|
editSaveData["`end_time`"] = endTime
|
|
|
|
|
editSaveData["`state`"] = state
|
|
|
|
|
}
|
|
|
|
|
if insiCont.GradePositions != v.GradePositions {
|
|
|
|
|
editSaveData["`grade_positions`"] = v.GradePositions
|
|
|
|
|
}
|
|
|
|
|
if insiCont.ChangeType != changeTypeInt {
|
|
|
|
|
editSaveData["`change_type`"] = changeTypeInt
|
|
|
|
|
}
|
|
|
|
|
assignTypeInt := assignTypeToInt(v.AssignType)
|
|
|
|
|
if insiCont.AssignType != assignTypeInt {
|
|
|
|
|
editSaveData["`assign_type`"] = assignTypeInt
|
|
|
|
|
}
|
|
|
|
|
if len(editSaveData) > 0 {
|
|
|
|
|
var editCont models.InsideWorkHistory
|
|
|
|
|
editCont.EditCont(map[string]interface{}{"`id`": insiCont.Id}, editSaveData)
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if overallhandle.IsInTrue[int](i, writeIn) == false {
|
|
|
|
|
writeIn = append(writeIn, i)
|
|
|
|
|
}
|
|
|
|
|
//此项不存在
|
|
|
|
|
var creadCont models.InsideWorkHistory
|
|
|
|
|
creadCont.Key = manKeyNum //员工识别符"`
|
|
|
|
|
creadCont.Group = groupContes.Id //集团"`
|
|
|
|
|
creadCont.Company = compayCont.Id //公司"`
|
|
|
|
|
creadCont.Department = dempCont.Id // 部室"`
|
|
|
|
|
creadCont.WorkShop = WorkShop //二级部门或车间"`
|
|
|
|
|
creadCont.WorkshopSection = WorkshopSection //工段"`
|
|
|
|
|
creadCont.Position = postCont.Id //职位"`
|
|
|
|
|
creadCont.GradePositions = v.GradePositions //职等"`
|
|
|
|
|
startTime := time.Now().Unix()
|
|
|
|
|
if v.StartTime != "" {
|
|
|
|
|
var startTimeErr bool
|
|
|
|
|
startTime, startTimeErr = overallhandle.DateToTimeStamp(v.StartTime)
|
|
|
|
|
if startTimeErr == false {
|
|
|
|
|
startTime, _ = overallhandle.DateToTimeStamp(fmt.Sprintf("%v 00:00:00", v.StartTime))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
creadCont.StartTime = startTime //开始日期"`
|
|
|
|
|
state := 1
|
|
|
|
|
var endTime int64
|
|
|
|
|
if v.EndTime != "" {
|
|
|
|
|
if v.EndTime != "至今" && v.EndTime != "2199-12-31 00:00:00" && v.EndTime != "2199-12-31" && v.EndTime != "7258003200" {
|
|
|
|
|
var endTimeErr bool
|
|
|
|
|
endTime, endTimeErr = overallhandle.DateToTimeStamp(v.EndTime)
|
|
|
|
|
if endTimeErr == false {
|
|
|
|
|
endTime, _ = overallhandle.DateToTimeStamp(fmt.Sprintf("%v 00:00:00", v.EndTime))
|
|
|
|
|
}
|
|
|
|
|
state = 2 //状态(1:启用;2:休眠;3:删除)"`
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
changeTypeInted := changeTypeToInt(v.ChangeType)
|
|
|
|
|
if changeTypeInted > 12 && changeTypeInted <= 14 {
|
|
|
|
|
endTime = time.Now().Unix()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
creadCont.EndTime = endTime //结束日期"`
|
|
|
|
|
creadCont.Team = myCont.TeamId //(1:长白;2:甲;3:乙;4:丙;5:丁)"`
|
|
|
|
|
creadCont.ChangeType = changeTypeToInt(v.ChangeType) // 变动类型(1:预入职;2:雇佣入职;3:转正;4:晋升;5:降级;6:职等调整;7:调动调入;8:跨公司调动调入;9:借调;10:平调;11:兼职;12:预离职;13:离职;14:退休;15:返聘;16:员工初始化;)"`
|
|
|
|
|
creadCont.Time = time.Now().Unix() //创建时间"`
|
|
|
|
|
creadCont.State = state //状态(1:启用;2:禁用;3:删除)"`
|
|
|
|
|
creadCont.AssignType = assignTypeToInt(v.AssignType) // 1、主职;2:兼职"`
|
|
|
|
|
creadAllData = append(creadAllData, creadCont)
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if overallhandle.IsInTrue[int](i, writeIn) == false {
|
|
|
|
|
writeIn = append(writeIn, i)
|
|
|
|
|
}
|
|
|
|
|
var creadCont models.InsideWorkHistory
|
|
|
|
|
creadCont.Key = manKeyNum //员工识别符"`
|
|
|
|
|
creadCont.Group = groupContes.Id //集团"`
|
|
|
|
|
creadCont.Company = compayCont.Id //公司"`
|
|
|
|
|
creadCont.Department = dempCont.Id // 部室"`
|
|
|
|
|
creadCont.WorkShop = WorkShop //二级部门或车间"`
|
|
|
|
|
creadCont.WorkshopSection = WorkshopSection //工段"`
|
|
|
|
|
creadCont.Position = postCont.Id //职位"`
|
|
|
|
|
creadCont.GradePositions = v.GradePositions //职等"`
|
|
|
|
|
startTime := time.Now().Unix()
|
|
|
|
|
if v.StartTime != "" {
|
|
|
|
|
var startTimeErr bool
|
|
|
|
|
startTime, startTimeErr = overallhandle.DateToTimeStamp(v.StartTime)
|
|
|
|
|
if startTimeErr == false {
|
|
|
|
|
startTime, _ = overallhandle.DateToTimeStamp(fmt.Sprintf("%v 00:00:00", v.StartTime))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
creadCont.StartTime = startTime //开始日期"`
|
|
|
|
|
state := 1
|
|
|
|
|
var endTime int64
|
|
|
|
|
if v.EndTime != "" {
|
|
|
|
|
if v.EndTime != "至今" && v.EndTime != "2199-12-31 00:00:00" && v.EndTime != "2199-12-31" && v.EndTime != "7258003200" {
|
|
|
|
|
var endTimeErr bool
|
|
|
|
|
endTime, endTimeErr = overallhandle.DateToTimeStamp(v.EndTime)
|
|
|
|
|
if endTimeErr == false {
|
|
|
|
|
endTime, _ = overallhandle.DateToTimeStamp(fmt.Sprintf("%v 00:00:00", v.EndTime))
|
|
|
|
|
}
|
|
|
|
|
state = 2 //状态(1:启用;2:休眠;3:删除)"`
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
achangeTypeInted := changeTypeToInt(v.ChangeType)
|
|
|
|
|
if achangeTypeInted > 12 && achangeTypeInted <= 14 {
|
|
|
|
|
endTime = time.Now().Unix()
|
|
|
|
|
}
|
|
|
|
|
creadCont.EndTime = endTime //结束日期"`
|
|
|
|
|
creadCont.Team = myCont.TeamId //(1:长白;2:甲;3:乙;4:丙;5:丁)"`
|
|
|
|
|
creadCont.ChangeType = changeTypeToInt(v.ChangeType) // 变动类型(1:预入职;2:雇佣入职;3:转正;4:晋升;5:降级;6:职等调整;7:调动调入;8:跨公司调动调入;9:借调;10:平调;11:兼职;12:预离职;13:离职;14:退休;15:返聘;16:员工初始化;)"`
|
|
|
|
|
creadCont.Time = time.Now().Unix() //创建时间"`
|
|
|
|
|
creadCont.State = state //状态(1:启用;2:禁用;3:删除)"`
|
|
|
|
|
creadCont.AssignType = assignTypeToInt(v.AssignType) // 1、主职;2:兼职"`
|
|
|
|
|
creadAllData = append(creadAllData, creadCont)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if len(creadAllData) > 1 {
|
|
|
|
|
overall.CONSTANT_DB_HR.Create(&creadAllData)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|