You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2256 lines
78 KiB
2256 lines
78 KiB
package personnelapi
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
"hr_server/models"
|
|
"hr_server/overall"
|
|
"hr_server/overall/overallhandle"
|
|
"path"
|
|
"sort"
|
|
"strconv"
|
|
"strings"
|
|
"time"
|
|
|
|
"github.com/360EntSecGroup-Skylar/excelize"
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
/*
|
|
*
|
|
@ 作者: 秦东
|
|
@ 时间: 2024-01-29 08:25:02
|
|
@ 功能: 解析上传的人员信息表格
|
|
@ 参数
|
|
|
|
#
|
|
|
|
@ 返回值
|
|
|
|
#
|
|
|
|
@ 方法原型
|
|
|
|
#
|
|
*/
|
|
func (s *StaffApi) UploadUserFiles(c *gin.Context) {
|
|
fileInfo, fileHeader, fileErr := c.Request.FormFile("file")
|
|
// fmt.Printf("fileInfo:%v\n", fileInfo)
|
|
// fmt.Printf("fileHeader:%v\n", fileHeader)
|
|
// fmt.Printf("fileErr:%v\n", fileErr)
|
|
if fileErr != nil {
|
|
overallhandle.Result(1, fileErr, c)
|
|
return
|
|
}
|
|
tageExt := path.Ext(fileHeader.Filename)
|
|
fmt.Printf("tageExt:%v\n", tageExt)
|
|
fileType := overallhandle.JudgeUpFileType(tageExt)
|
|
if fileType != 5 {
|
|
overallhandle.Result(1, fileType, c, "您上传的不是电子表格!请上传正确的文件!")
|
|
return
|
|
}
|
|
|
|
xlsx, err := excelize.OpenReader(fileInfo)
|
|
if err != nil {
|
|
overallhandle.Result(2, err, c)
|
|
return
|
|
}
|
|
var userInfoData GroupParsingData
|
|
//解析excel的数据
|
|
// lxProducts, listAry, lxRrr := ReadExcel(xlsx)
|
|
list := userInfoData.ReadExcel(xlsx)
|
|
// if lxRrr != nil {
|
|
// Logger.Error("read excel error:[%s]", lxRrr.Error())
|
|
// baseReturn(c, 0, "解析excel文件失败")
|
|
// return
|
|
// }
|
|
// fmt.Printf("lxRrr:%v\n", lxRrr)
|
|
// fmt.Printf("lxProducts:%v\n", lxProducts)
|
|
// lxService := LxProductService{}
|
|
// errCode := lxService.ExportLxProduct(lxProducts)
|
|
// baseReturn(c, errCode, len(lxProducts))
|
|
sendData := overallhandle.MapOut()
|
|
sendData["list"] = list
|
|
sendData["listAry"] = userInfoData.Msg
|
|
overallhandle.Result(0, sendData, c)
|
|
}
|
|
|
|
// ReadExcel .读取excel 转成切片
|
|
func (g *GroupParsingData) ReadExcel(xlsx *excelize.File) (list []interface{}) {
|
|
rows := xlsx.GetRows(xlsx.GetSheetName(xlsx.GetActiveSheetIndex()))
|
|
isDateYear := time.Now().Year()
|
|
//获取绩效年度
|
|
meritsYear := make(map[int]int)
|
|
if rows[1][289] != "" {
|
|
yearAry := strings.Split(rows[1][289], "年")
|
|
if len(yearAry) > 0 {
|
|
|
|
yearVal, _ := strconv.Atoi(yearAry[0])
|
|
meritsYear[0] = yearVal
|
|
}
|
|
} else {
|
|
meritsYear[0] = isDateYear - 3
|
|
}
|
|
if rows[1][290] != "" {
|
|
yearAry := strings.Split(rows[1][290], "年")
|
|
if len(yearAry) > 0 {
|
|
yearVal, _ := strconv.Atoi(yearAry[0])
|
|
meritsYear[1] = yearVal
|
|
}
|
|
} else {
|
|
meritsYear[1] = isDateYear - 2
|
|
}
|
|
if rows[1][291] != "" {
|
|
yearAry := strings.Split(rows[1][291], "年")
|
|
if len(yearAry) > 0 {
|
|
yearVal, _ := strconv.Atoi(yearAry[0])
|
|
meritsYear[2] = yearVal
|
|
}
|
|
} else {
|
|
meritsYear[2] = isDateYear - 1
|
|
}
|
|
//获取奖惩年度
|
|
rewPunYears := make(map[int]int)
|
|
if rows[2][299] != "" {
|
|
jcYearAry := strings.Split(rows[2][299], "奖惩")
|
|
if len(jcYearAry) > 0 {
|
|
|
|
jcYearVal, _ := strconv.Atoi(jcYearAry[0])
|
|
rewPunYears[0] = jcYearVal
|
|
}
|
|
} else {
|
|
rewPunYears[0] = isDateYear - 3
|
|
}
|
|
if rows[2][304] != "" {
|
|
jcYearAry := strings.Split(rows[2][304], "奖惩")
|
|
if len(jcYearAry) > 0 {
|
|
|
|
jcYearVal, _ := strconv.Atoi(jcYearAry[0])
|
|
rewPunYears[1] = jcYearVal
|
|
}
|
|
} else {
|
|
rewPunYears[1] = isDateYear - 2
|
|
}
|
|
if rows[2][309] != "" {
|
|
jcYearAry := strings.Split(rows[2][309], "奖惩")
|
|
if len(jcYearAry) > 0 {
|
|
|
|
jcYearVal, _ := strconv.Atoi(jcYearAry[0])
|
|
rewPunYears[2] = jcYearVal
|
|
}
|
|
} else {
|
|
rewPunYears[2] = isDateYear - 1
|
|
}
|
|
jiBuQi := 1
|
|
var upMap []interface{}
|
|
|
|
for i, row := range rows {
|
|
if i < 4 {
|
|
continue
|
|
}
|
|
//判断工号是否已经存在
|
|
// shijian := overallhandle.ExcelDateToDate(row[11])
|
|
// fmt.Println("%v出生日期:%v\n", row[2], shijian.Unix())
|
|
// manMap := overallhandle.MapOutint()
|
|
newList := make(map[int]string)
|
|
// var data ExcelInfo
|
|
for k, v := range row {
|
|
// manMap[k] = v
|
|
newList[k] = v
|
|
// // 第一列是展示位名称
|
|
// if k == 0 {
|
|
// data.TypeName = v
|
|
// }
|
|
// // 第二列是产品主标题
|
|
// if k == 289 {
|
|
// data.ProductMasterTitle = v
|
|
// }
|
|
// // 第三列是产品副标题
|
|
// if k == 290 {
|
|
// data.ProductSlaveTitle = v
|
|
// }
|
|
}
|
|
// LxProducts = append(LxProducts, data)
|
|
upMap = append(upMap, newList)
|
|
list = append(list, newList)
|
|
if len(upMap) != 0 && len(upMap)%100 == 0 {
|
|
synPro.Add(1)
|
|
go g.GroupParsingDataInfo(upMap, meritsYear, rewPunYears)
|
|
jiBuQi++
|
|
// fmt.Printf("总数:%v\n", len(upMap))
|
|
var upNewMap []interface{}
|
|
upMap = upNewMap
|
|
}
|
|
|
|
}
|
|
|
|
if len(upMap) > 0 {
|
|
jiBuQi++
|
|
synPro.Add(1)
|
|
go g.GroupParsingDataInfo(upMap, meritsYear, rewPunYears)
|
|
}
|
|
synPro.Wait()
|
|
return
|
|
}
|
|
|
|
/*
|
|
*
|
|
@ 作者: 秦东
|
|
@ 时间: 2024-01-30 08:10:16
|
|
@ 功能: 分组数据解析
|
|
@ 参数
|
|
|
|
#info //人员信息
|
|
#meritsYear 绩效年度
|
|
#rewPunYearsmap 奖惩年度
|
|
|
|
@ 返回值
|
|
|
|
#
|
|
|
|
@ 方法原型
|
|
|
|
#
|
|
*/
|
|
func (g *GroupParsingData) GroupParsingDataInfo(list []interface{}, meritsYear, rewPunYearsmap map[int]int) {
|
|
defer synPro.Done()
|
|
// fmt.Printf("时间段:%v\n%v\n", meritsYear, rewPunYearsmap)
|
|
for _, v := range list {
|
|
if val, ok := v.(map[int]string); ok {
|
|
// fmt.Printf("分成的段:%v\n%v\n", ok, val[1])
|
|
g.IsOk = false
|
|
g.UserNum = val[1]
|
|
if val[1] != "" {
|
|
var myCont models.PersonArchives
|
|
err := myCont.GetCont(map[string]interface{}{"`number`": val[1]}, "`key`")
|
|
if err != nil {
|
|
g.IsOk = true
|
|
} else {
|
|
g.UserKey = myCont.Key
|
|
}
|
|
g.ProcessMainTable(val, meritsYear, rewPunYearsmap, "309")
|
|
} else {
|
|
g.Msg = append(g.Msg, fmt.Sprintf("序号:%v--->%v:没有工号", val[0], val[2]))
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
/*
|
|
*
|
|
@ 作者: 秦东
|
|
@ 时间: 2024-01-30 13:03:11
|
|
@ 功能: 主表数据处理
|
|
@ 参数
|
|
|
|
#info //人员信息
|
|
#meritsYear 绩效年度
|
|
#rewPunYearsmap 奖惩年度
|
|
|
|
@ 返回值
|
|
|
|
#
|
|
|
|
@ 方法原型
|
|
|
|
#
|
|
*/
|
|
func (g *GroupParsingData) ProcessMainTable(info map[int]string, meritsYear, rewPunYearsmap map[int]int, orgId string) {
|
|
// fmt.Printf("分成的段:%v\n%v\n%v\n", g.UserNum, g.UserKey, g.IsOk)
|
|
if g.UserKey == 0 {
|
|
g.UserKey = overallhandle.OnlyOneNumber(2)
|
|
}
|
|
curryTime := time.Now().Unix()
|
|
if g.IsOk {
|
|
|
|
var userInfo models.PersonArchives
|
|
userInfo.Key = g.UserKey //唯一编号
|
|
userInfo.Name = info[2] //姓名"`
|
|
userInfo.Number = info[1] //工号
|
|
userInfo.HireClass = 1 //雇佣类型(1:雇佣入职;2:再入职;)"`
|
|
userInfo.EmpType = 8 //用工关系(1:临时工 , 2:编外人员 ;3:实习&实习生;4:试用员工;5:待分配;6:待岗;7:临时调入;8:正式员工;9:长期病假;10:停薪留职;11:退休;12:辞职;13:辞退;14:离职)"`
|
|
orgIdInt, _ := strconv.ParseInt(orgId, 10, 64)
|
|
userInfo.ExcelTemplate = orgIdInt
|
|
var adminOrg int64
|
|
var allOrgId []int64
|
|
if info[3] != "" {
|
|
var comOrg models.AdministrativeOrganization
|
|
comOrg.GetCont(map[string]interface{}{"`name`": info[3]}, "`id`")
|
|
if comOrg.Id != 0 {
|
|
userInfo.Company = comOrg.Id //入职公司"`
|
|
adminOrg = comOrg.Id
|
|
var sunOrg overallhandle.GetOrgAllParent
|
|
sunOrg.GetOrgSonAllId(comOrg.Id)
|
|
sunOrg.Id = append(sunOrg.Id, comOrg.Id)
|
|
allOrgId = sunOrg.Id
|
|
}
|
|
}
|
|
if info[4] != "" {
|
|
if len(allOrgId) > 0 {
|
|
mastOrg := GetMyOrgSunId(info[4], allOrgId)
|
|
if mastOrg != 0 {
|
|
userInfo.MainDeparment = mastOrg //主部门"`
|
|
adminOrg = mastOrg
|
|
}
|
|
}
|
|
}
|
|
if info[5] != "" {
|
|
if len(allOrgId) > 0 {
|
|
suntOrg := GetMyOrgSunId(info[5], allOrgId)
|
|
if suntOrg != 0 {
|
|
userInfo.SunMainDeparment = suntOrg //二级主部门"`
|
|
adminOrg = suntOrg
|
|
}
|
|
}
|
|
}
|
|
if info[6] != "" {
|
|
if len(allOrgId) > 0 {
|
|
postOrg := GetMyOrgSunId(info[6], allOrgId)
|
|
if postOrg != 0 {
|
|
userInfo.WorkSection = postOrg //二级主部门"`
|
|
adminOrg = postOrg
|
|
}
|
|
}
|
|
}
|
|
if adminOrg != 0 {
|
|
userInfo.AdminOrg = adminOrg //所属行政组织"`
|
|
// userInfo.Position, userInfo.JobId, userInfo.PersonInCharge = GetMyPositisName(info[7], adminOrg)
|
|
position, jobId, PersonInCharge := GetMyPositisName(info[7], adminOrg)
|
|
if position != 0 {
|
|
userInfo.Position = position
|
|
}
|
|
if jobId != 0 {
|
|
userInfo.JobId = jobId
|
|
}
|
|
if PersonInCharge != 0 {
|
|
userInfo.PersonInCharge = PersonInCharge
|
|
}
|
|
}
|
|
switch info[8] {
|
|
case "一级":
|
|
userInfo.JobLeve = 1 // 职务等级"`
|
|
case "二级":
|
|
userInfo.JobLeve = 2 // 职务等级"`
|
|
case "三级":
|
|
userInfo.JobLeve = 3 // 职务等级"`
|
|
case "四级":
|
|
userInfo.JobLeve = 4 // 职务等级"`
|
|
case "五级":
|
|
userInfo.JobLeve = 5 // 职务等级"`
|
|
default:
|
|
}
|
|
if info[9] != "" {
|
|
var jobInfo models.JobClass
|
|
jobInfo.GetCont(map[string]interface{}{"`name`": info[9]}, "`id`")
|
|
if jobInfo.Id != 0 {
|
|
userInfo.JobClass = jobInfo.Id //管理类别"`
|
|
}
|
|
}
|
|
userInfo.Time = curryTime //写入时间"`
|
|
userInfo.EiteTime = curryTime //编辑时间"`
|
|
userInfo.State = 1 //状态(1:启用;2:禁用;3:删除)`
|
|
userInfo.Key = g.UserKey //key"`
|
|
var md5JiaMi overallhandle.Md5Encryption
|
|
md5JiaMi.Md5EncryptionInit(overall.CONSTANT_CONFIG.Appsetup.DefaultPassword)
|
|
md5Token := md5JiaMi.Md5EncryptionAlgorithm()
|
|
userInfo.Password = md5Token //密码"`
|
|
userInfo.IsShowTrue = 1
|
|
if info[30] != "" {
|
|
userInfo.Wechat = info[30]
|
|
}
|
|
err := overall.CONSTANT_DB_HR.Create(&userInfo).Error
|
|
if err != nil {
|
|
g.Msg = append(g.Msg, fmt.Sprintf("%v[%v]处理失败!--- %v 原因:%v", info[2], info[1], overallhandle.UnixTimeToDay(curryTime, 11), err))
|
|
g.MsgStr = fmt.Sprintf("%v[%v]处理失败!--- %v 原因:%v", info[2], info[1], overallhandle.UnixTimeToDay(curryTime, 11), err)
|
|
} else {
|
|
g.Msg = append(g.Msg, fmt.Sprintf("%v[%v]处理完成!--- %v", info[2], info[1], overallhandle.UnixTimeToDay(curryTime, 11)))
|
|
g.MsgStr = fmt.Sprintf("%v[%v]处理完成!--- %v", info[2], info[1], overallhandle.UnixTimeToDay(curryTime, 11))
|
|
}
|
|
} else {
|
|
editInfo := overallhandle.MapOut()
|
|
editInfo["`name`"] = info[2]
|
|
var adminOrg int64
|
|
var allOrgId []int64
|
|
if info[3] != "" {
|
|
var comOrg models.AdministrativeOrganization
|
|
comOrg.GetCont(map[string]interface{}{"`name`": info[3]}, "`id`")
|
|
if comOrg.Id != 0 {
|
|
editInfo["`company`"] = comOrg.Id //入职公司"`
|
|
|
|
adminOrg = comOrg.Id
|
|
|
|
var sunOrg overallhandle.GetOrgAllParent
|
|
sunOrg.GetOrgSonAllId(comOrg.Id)
|
|
sunOrg.Id = append(sunOrg.Id, comOrg.Id)
|
|
allOrgId = sunOrg.Id
|
|
}
|
|
}
|
|
if info[4] != "" {
|
|
if len(allOrgId) > 0 {
|
|
mastOrg := GetMyOrgSunId(info[4], allOrgId)
|
|
|
|
if mastOrg != 0 {
|
|
editInfo["`maindeparment`"] = mastOrg //主部门"`
|
|
adminOrg = mastOrg
|
|
}
|
|
}
|
|
}
|
|
if info[5] != "" {
|
|
if len(allOrgId) > 0 {
|
|
suntOrg := GetMyOrgSunId(info[5], allOrgId)
|
|
|
|
if suntOrg != 0 {
|
|
editInfo["`sun_main_deparment`"] = suntOrg //二级主部门"`
|
|
adminOrg = suntOrg
|
|
}
|
|
}
|
|
}
|
|
if info[6] != "" {
|
|
if len(allOrgId) > 0 {
|
|
postOrg := GetMyOrgSunId(info[6], allOrgId)
|
|
|
|
if postOrg != 0 {
|
|
editInfo["`work_section`"] = postOrg //二级主部门"`
|
|
adminOrg = postOrg
|
|
}
|
|
}
|
|
}
|
|
if adminOrg != 0 {
|
|
editInfo["`admin_org`"] = adminOrg //所属行政组织"`
|
|
position, jobId, PersonInCharge := GetMyPositisName(info[7], adminOrg)
|
|
if position != 0 {
|
|
editInfo["`position`"] = position
|
|
}
|
|
if jobId != 0 {
|
|
editInfo["`job_id`"] = jobId
|
|
}
|
|
if PersonInCharge != 0 {
|
|
editInfo["`person_in_charge`"] = PersonInCharge
|
|
}
|
|
}
|
|
switch info[8] {
|
|
case "一级":
|
|
editInfo["`job_leve`"] = 1 // 职务等级"`
|
|
case "二级":
|
|
editInfo["`job_leve`"] = 2 // 职务等级"`
|
|
case "三级":
|
|
editInfo["`job_leve`"] = 3 // 职务等级"`
|
|
case "四级":
|
|
editInfo["`job_leve`"] = 4 // 职务等级"`
|
|
case "五级":
|
|
editInfo["`job_leve`"] = 5 // 职务等级"`
|
|
default:
|
|
}
|
|
if info[9] != "" {
|
|
var jobInfo models.JobClass
|
|
jobInfo.GetCont(map[string]interface{}{"`name`": info[9]}, "`id`")
|
|
if jobInfo.Id != 0 {
|
|
editInfo["`job_class`"] = jobInfo.Id //管理类别"`
|
|
}
|
|
}
|
|
editInfo["`eite_time`"] = curryTime
|
|
editInfo["`is_show_true`"] = 1
|
|
if info[30] != "" {
|
|
editInfo["`wechat`"] = info[30]
|
|
}
|
|
orgIdInt, _ := strconv.ParseInt(orgId, 10, 64)
|
|
editInfo["`excel_template`"] = orgIdInt
|
|
var userInfo models.PersonArchives
|
|
err := userInfo.EiteCont(map[string]interface{}{"`key`": g.UserKey}, editInfo)
|
|
// fmt.Printf("编辑信息:%v\n", err)
|
|
if err != nil {
|
|
g.Msg = append(g.Msg, fmt.Sprintf("%v[%v]处理失败!--- %v 原因:%v", info[2], info[1], overallhandle.UnixTimeToDay(curryTime, 11), err))
|
|
g.MsgStr = fmt.Sprintf("%v[%v]处理失败!--- %v 原因:%v", info[2], info[1], overallhandle.UnixTimeToDay(curryTime, 11), err)
|
|
} else {
|
|
g.Msg = append(g.Msg, fmt.Sprintf("%v[%v]处理完成!--- %v", info[2], info[1], overallhandle.UnixTimeToDay(curryTime, 11)))
|
|
g.MsgStr = fmt.Sprintf("%v[%v]处理完成!--- %v", info[2], info[1], overallhandle.UnixTimeToDay(curryTime, 11))
|
|
}
|
|
// fmt.Printf("修改的数据:%v\n", editInfo)
|
|
}
|
|
synPros.Add(1)
|
|
go g.SecondaryTableUser(info) //人员信息副本
|
|
synPros.Add(1)
|
|
go g.PoliticalOutlookEdit(info) //政治面貌
|
|
synPros.Add(1)
|
|
go g.EditEducationInfo(info) //学历信息
|
|
synPros.Add(1)
|
|
go g.FamilyMembers(info) //家庭成员
|
|
synPros.Add(1)
|
|
go g.GrowthExperienceWithinTheGroup(info, orgId) //集团内成长经历
|
|
synPros.Add(1)
|
|
go g.ExternalWorkExperienceOfTheGroup(info) //集团外部工作经历
|
|
synPros.Add(1)
|
|
go g.EditExamineLevel(info, meritsYear) //绩效考核成绩
|
|
synPros.Add(1)
|
|
go g.EditRewardsPunishments(info, rewPunYearsmap) //奖惩记录
|
|
synPros.Add(1)
|
|
go g.EditAcademicTitle(info) //编辑职称
|
|
synPros.Add(1)
|
|
go g.EditCertificate(info) //编辑证书
|
|
synPros.Add(1)
|
|
go g.TalentInventory(info, orgId) //人才盘点
|
|
// synPros.Wait()
|
|
|
|
// g.SecondaryTableUser(info) //人员信息副本
|
|
// g.PoliticalOutlookEdit(info) //政治面貌
|
|
// g.EditEducationInfo(info) //学历信息
|
|
// g.FamilyMembers(info) //家庭成员
|
|
// g.GrowthExperienceWithinTheGroup(info) //集团内成长经历
|
|
// g.ExternalWorkExperienceOfTheGroup(info) //集团外部工作经历
|
|
// g.EditExamineLevel(info, meritsYear) //绩效考核成绩
|
|
// g.EditRewardsPunishments(info, rewPunYearsmap) //奖惩记录
|
|
// g.EditAcademicTitle(info) //编辑职称
|
|
// g.EditCertificate(info) //编辑证书
|
|
synPros.Wait()
|
|
}
|
|
|
|
/*
|
|
*
|
|
@ 作者: 秦东
|
|
@ 时间: 2024-02-02 10:23:12
|
|
@ 功能: 编辑证书
|
|
@ 参数
|
|
|
|
#
|
|
|
|
@ 返回值
|
|
|
|
#
|
|
|
|
@ 方法原型
|
|
|
|
#
|
|
*/
|
|
func (g *GroupParsingData) EditCertificate(info map[int]string) {
|
|
defer synPros.Done()
|
|
|
|
var cerHonList []models.CertificateHonors
|
|
err := overall.CONSTANT_DB_HR.Where("`userKey` = ?", g.UserKey).Find(&cerHonList).Error
|
|
if err != nil || len(cerHonList) < 1 {
|
|
if info[338] != "" {
|
|
g.EditCertificateCont(info[337], info[338], info[339], info[340], info[341], info[342], info[343])
|
|
}
|
|
if info[345] != "" {
|
|
g.EditCertificateCont(info[344], info[345], info[346], info[347], info[348], info[349], info[350])
|
|
}
|
|
if info[352] != "" {
|
|
g.EditCertificateCont(info[351], info[352], info[353], info[354], info[355], info[356], info[357])
|
|
}
|
|
if info[359] != "" {
|
|
g.EditCertificateCont(info[358], info[359], info[360], info[361], info[362], info[363], info[364])
|
|
}
|
|
if info[366] != "" {
|
|
g.EditCertificateCont(info[365], info[366], info[367], info[368], info[369], info[370], info[371])
|
|
}
|
|
if info[373] != "" {
|
|
g.EditCertificateCont(info[372], info[373], info[374], info[375], info[376], info[377], info[378])
|
|
}
|
|
} else {
|
|
jsonInfo, _ := json.Marshal(cerHonList)
|
|
overallhandle.WriteLog("del", "删除旧证书数据!", string(jsonInfo))
|
|
var workGroupLogCont models.CertificateHonors
|
|
workGroupLogCont.DelCont(map[string]interface{}{"`userKey`": g.UserKey})
|
|
if info[338] != "" {
|
|
g.EditCertificateCont(info[337], info[338], info[339], info[340], info[341], info[342], info[343])
|
|
}
|
|
if info[345] != "" {
|
|
g.EditCertificateCont(info[344], info[345], info[346], info[347], info[348], info[349], info[350])
|
|
}
|
|
if info[352] != "" {
|
|
g.EditCertificateCont(info[351], info[352], info[353], info[354], info[355], info[356], info[357])
|
|
}
|
|
if info[359] != "" {
|
|
g.EditCertificateCont(info[358], info[359], info[360], info[361], info[362], info[363], info[364])
|
|
}
|
|
if info[366] != "" {
|
|
g.EditCertificateCont(info[365], info[366], info[367], info[368], info[369], info[370], info[371])
|
|
}
|
|
if info[373] != "" {
|
|
g.EditCertificateCont(info[372], info[373], info[374], info[375], info[376], info[377], info[378])
|
|
}
|
|
}
|
|
}
|
|
|
|
/*
|
|
*
|
|
@ 作者: 秦东
|
|
@ 时间: 2024-02-02 10:24:21
|
|
@ 功能: 编辑证书内容
|
|
*/
|
|
func (g *GroupParsingData) EditCertificateCont(Title, Number, IssuingUnit, TimeData, EndTime, ValidPeriod, State string) {
|
|
var cerInfo models.CertificateHonors
|
|
// err := cerInfo.GetCont(map[string]interface{}{"`userKey`": g.UserKey, "`number`": Number, "`title`": Title})
|
|
cureeTime := time.Now().Unix()
|
|
if TimeData != "" {
|
|
cureeTime = overallhandle.ExcelDateToDate(TimeData).Unix()
|
|
}
|
|
// if err != nil {
|
|
cerInfo.Title = Title //证书/荣誉名称"`
|
|
cerInfo.UserKey = g.UserKey //获得人员"`
|
|
cerInfo.Types = 4 //类型(1:职称证书;2:资格证书;3:荣誉;4:专业证书)`
|
|
if State == "是" {
|
|
cerInfo.State = 1 //状态(1:启用;2:禁用;3:删除)`
|
|
} else {
|
|
cerInfo.State = 2 //状态(1:启用;2:禁用;3:删除)`
|
|
}
|
|
|
|
cerInfo.IssuingUnit = IssuingUnit //颁发单位"`
|
|
if TimeData != "" {
|
|
cerInfo.TimeData = cureeTime //获得时间"`
|
|
}
|
|
yearInt, _ := strconv.Atoi(overallhandle.UnixTimeToDay(cureeTime, 16))
|
|
cerInfo.Years = yearInt //年"`
|
|
monthsInt, _ := strconv.Atoi(overallhandle.UnixTimeToDay(cureeTime, 17))
|
|
cerInfo.Months = monthsInt //月"`
|
|
cerInfo.Number = Number //证书编号"`
|
|
if EndTime != "" && EndTime != "无" {
|
|
cerInfo.EndTime = overallhandle.ExcelDateToDate(EndTime).Unix() //截止时间"`
|
|
}
|
|
cerInfo.ValidPeriod = ValidPeriod //有效期限"`
|
|
overall.CONSTANT_DB_HR.Create(&cerInfo)
|
|
// } else { //编辑
|
|
// editCont := overallhandle.MapOut()
|
|
// editCont["`title`"] = Title
|
|
// editCont["`number`"] = Number
|
|
// editCont["`issuing_unit`"] = IssuingUnit
|
|
// editCont["`timedata`"] = cureeTime
|
|
// if EndTime != "" {
|
|
// editCont["`endTime`"] = overallhandle.ExcelDateToDate(EndTime).Unix()
|
|
// }
|
|
// editCont["`validPeriod`"] = ValidPeriod
|
|
// if State == "是" {
|
|
// editCont["`state`"] = 1 //状态(1:启用;2:禁用;3:删除)`
|
|
// } else {
|
|
// editCont["`state`"] = 2 //状态(1:启用;2:禁用;3:删除)`
|
|
// }
|
|
// yearInt, _ := strconv.Atoi(overallhandle.UnixTimeToDay(cureeTime, 16))
|
|
// editCont["`years`"] = yearInt
|
|
// editCont["`types`"] = 4
|
|
// monthsInt, _ := strconv.Atoi(overallhandle.UnixTimeToDay(cureeTime, 17))
|
|
// editCont["`months`"] = monthsInt
|
|
// var editInfoCont models.CertificateHonors
|
|
// editInfoCont.EiteCont(map[string]interface{}{"`id`": cerInfo.Id}, editCont)
|
|
// }
|
|
}
|
|
|
|
/*
|
|
*
|
|
@ 作者: 秦东
|
|
@ 时间: 2024-02-02 09:59:24
|
|
@ 功能: 编辑职称
|
|
@ 参数
|
|
|
|
#
|
|
|
|
@ 返回值
|
|
|
|
#
|
|
|
|
@ 方法原型
|
|
|
|
#
|
|
*/
|
|
func (g *GroupParsingData) EditAcademicTitle(info map[int]string) {
|
|
defer synPros.Done()
|
|
// if info[331] != "" {
|
|
// g.EditAcademicTitleInfo(info[328], info[329], info[330], info[331], info[332])
|
|
// }
|
|
// if info[336] != "" {
|
|
// g.EditAcademicTitleInfo(info[333], info[334], info[335], info[336], info[337])
|
|
// }
|
|
var acaList []models.AcademicTitle
|
|
err := overall.CONSTANT_DB_HR.Where("`userKey` = ?", g.UserKey).Find(&acaList).Error
|
|
if err != nil || len(acaList) < 1 {
|
|
if info[330] != "" {
|
|
g.InsetAcaInfo(info[327], info[328], info[329], info[330], info[331])
|
|
}
|
|
if info[335] != "" {
|
|
g.InsetAcaInfo(info[332], info[333], info[334], info[335], info[336])
|
|
}
|
|
} else {
|
|
jsonInfo, _ := json.Marshal(acaList)
|
|
overallhandle.WriteLog("del", "删除旧职称数据!", string(jsonInfo))
|
|
var workGroupLogCont models.AcademicTitle
|
|
workGroupLogCont.DelCont(map[string]interface{}{"`userKey`": g.UserKey})
|
|
if info[330] != "" {
|
|
g.InsetAcaInfo(info[327], info[328], info[329], info[330], info[331])
|
|
}
|
|
if info[335] != "" {
|
|
g.InsetAcaInfo(info[332], info[333], info[334], info[335], info[336])
|
|
}
|
|
}
|
|
}
|
|
|
|
/*
|
|
*
|
|
@ 作者: 秦东
|
|
@ 时间: 2024-02-04 13:39:42
|
|
@ 功能: 写入职称
|
|
*/
|
|
func (g *GroupParsingData) InsetAcaInfo(types, series, speciality, number, timeVal string) {
|
|
var acaInfo models.AcademicTitle
|
|
acaInfo.Types = types //职称级别"`
|
|
acaInfo.Series = series //职称系列"`
|
|
acaInfo.Speciality = speciality //职称专业"`
|
|
acaInfo.Number = number //资格证书编号"`
|
|
if timeVal != "" {
|
|
acaInfo.Time = overallhandle.ExcelDateToDate(timeVal).Unix() //生效时间"`
|
|
}
|
|
|
|
acaInfo.EditTime = time.Now().Unix() //写入时间"`
|
|
acaInfo.UserKey = g.UserKey //人员唯一识别符"`
|
|
overall.CONSTANT_DB_HR.Create(&acaInfo)
|
|
}
|
|
|
|
/*
|
|
*
|
|
@ 作者: 秦东
|
|
@ 时间: 2024-02-02 10:00:42
|
|
@ 功能: 编辑职称内容
|
|
*/
|
|
func (g *GroupParsingData) EditAcademicTitleInfo(types, series, speciality, number, timeVal string) {
|
|
var acaList []models.AcademicTitle
|
|
err := overall.CONSTANT_DB_HR.Where("`userKey` = ?", g.UserKey).Find(&acaList).Error
|
|
if err != nil || len(acaList) < 1 {
|
|
var acaInfo models.AcademicTitle
|
|
acaInfo.Types = types //职称级别"`
|
|
acaInfo.Series = series //职称系列"`
|
|
acaInfo.Speciality = speciality //职称专业"`
|
|
acaInfo.Number = number //资格证书编号"`
|
|
if timeVal != "" {
|
|
acaInfo.Time = overallhandle.ExcelDateToDate(timeVal).Unix() //生效时间"`
|
|
}
|
|
|
|
acaInfo.EditTime = time.Now().Unix() //写入时间"`
|
|
acaInfo.UserKey = g.UserKey //人员唯一识别符"`
|
|
overall.CONSTANT_DB_HR.Create(&acaInfo)
|
|
} else {
|
|
jsonInfo, _ := json.Marshal(acaList)
|
|
overallhandle.WriteLog("del", "删除旧职称数据!", string(jsonInfo))
|
|
var acaInfo models.AcademicTitle
|
|
acaInfo.Types = types //职称级别"`
|
|
acaInfo.Series = series //职称系列"`
|
|
acaInfo.Speciality = speciality //职称专业"`
|
|
acaInfo.Number = number //资格证书编号"`
|
|
if timeVal != "" {
|
|
acaInfo.Time = overallhandle.ExcelDateToDate(timeVal).Unix() //生效时间"`
|
|
}
|
|
acaInfo.EditTime = time.Now().Unix() //写入时间"`
|
|
acaInfo.UserKey = g.UserKey //人员唯一识别符"`
|
|
overall.CONSTANT_DB_HR.Create(&acaInfo)
|
|
}
|
|
|
|
// var acaInfo models.AcademicTitle
|
|
// err := acaInfo.GetCont(map[string]interface{}{"`userKey`": g.UserKey, "`number`": number})
|
|
// if err != nil {
|
|
|
|
// } else { //编辑
|
|
// editCont := overallhandle.MapOut()
|
|
// editCont["`types`"] = types
|
|
// editCont["`series`"] = series
|
|
// editCont["`speciality`"] = speciality
|
|
// editCont["`number`"] = number
|
|
// if timeVal != "" {
|
|
// editCont["`time`"] = overallhandle.ExcelDateToDate(timeVal).Unix()
|
|
// }
|
|
// editCont["`editTime`"] = time.Now().Unix()
|
|
// var rewPunYearEditCont models.AcademicTitle
|
|
// rewPunYearEditCont.EiteCont(map[string]interface{}{"`id`": acaInfo.Id}, editCont)
|
|
// }
|
|
}
|
|
|
|
/*
|
|
*
|
|
@ 作者: 秦东
|
|
@ 时间: 2024-02-02 08:50:56
|
|
@ 功能: 编辑奖惩
|
|
@ 参数
|
|
|
|
#
|
|
|
|
@ 返回值
|
|
|
|
#
|
|
|
|
@ 方法原型
|
|
|
|
#
|
|
*/
|
|
func (g *GroupParsingData) EditRewardsPunishments(info map[int]string, rewPunYearsmap map[int]int) {
|
|
defer synPros.Done()
|
|
// fmt.Printf("奖惩记录1: %v\n", rewPunYearsmap)
|
|
// fmt.Printf("奖惩记录: %v\n %v\n %v\n", info[299], info[304], info[309])
|
|
if val, isOk := rewPunYearsmap[0]; isOk {
|
|
// if info[298] != "" {
|
|
g.EditRewPunInfo(val, info[298], info[299], info[300], info[301], info[302])
|
|
// }
|
|
}
|
|
if val, isOk := rewPunYearsmap[1]; isOk {
|
|
// if info[303] != "" {
|
|
g.EditRewPunInfo(val, info[303], info[304], info[305], info[306], info[307])
|
|
// }
|
|
}
|
|
if val, isOk := rewPunYearsmap[2]; isOk {
|
|
// if info[308] != "" {
|
|
g.EditRewPunInfo(val, info[308], info[309], info[310], info[311], info[312])
|
|
// }
|
|
}
|
|
}
|
|
func (g *GroupParsingData) EditRewPunInfo(years int, level, rewPunClass, title, timeData, issuingUnit string) {
|
|
|
|
fmt.Printf("奖惩记录2: %v----> %v\n", level, timeData)
|
|
|
|
jiangCeng := RewPunLevelClassStr(rewPunClass)
|
|
var rewPunYearCont models.RewardsPenalties
|
|
err := rewPunYearCont.GetCont(map[string]interface{}{"`userkey`": g.UserKey, "`years`": years, "`months`": 0})
|
|
timeVal := time.Now().Unix()
|
|
// yserInt, _ := strconv.Atoi(overallhandle.UnixTimeToDay(timeVal, 16))
|
|
if err == nil {
|
|
overall.CONSTANT_DB_HR.Where("`id` = ? ", rewPunYearCont.Id).Delete(&rewPunYearCont)
|
|
// overall.CONSTANT_DB_HR.Where("`userkey` = ? AND `years` = ? AND `months` = ?", g.UserKey, years, 0).Delete(&rewPunYearCont)
|
|
}
|
|
if timeData != "" {
|
|
timeVal = overallhandle.ExcelDateToDate(timeData).Unix()
|
|
fmt.Printf("奖惩记录3: %v\n", timeVal)
|
|
}
|
|
if level != "" {
|
|
|
|
// if err != nil { //新增
|
|
rewPunYearCont.Title = title //奖励/处分项目"`
|
|
rewPunYearCont.UserKey = g.UserKey //获得人员"`
|
|
if jiangCeng <= 6 {
|
|
rewPunYearCont.Types = 1 //类型(1:奖励;2:处分;)`
|
|
} else {
|
|
rewPunYearCont.Types = 2 //类型(1:奖励;2:处分;)`
|
|
}
|
|
rewPunYearCont.State = 1 //状态(1:启用;2:禁用;3:删除)`
|
|
rewPunYearCont.IssuingUnit = issuingUnit //颁发单位"`
|
|
|
|
rewPunYearCont.TimeData = timeVal //获得时间"`
|
|
|
|
rewPunYearCont.Years = years //年"`
|
|
rewPunYearCont.Months = 0 //月"`
|
|
rewPunYearCont.Level = RewPunLevelStr(level) //奖惩级别(1:部门级;2:公司级;3:县级;4:市级;5:省级;6:国家级)"`
|
|
rewPunYearCont.RewPunClass = jiangCeng //奖惩类型(1:年终评优;2:表扬;3:嘉奖;4:记功;5:记大功;6:特别奖励;7:批评;8:警告;9:记过;10:记大过;11:降级;12:留用察看;13:开除)"`
|
|
overall.CONSTANT_DB_HR.Create(&rewPunYearCont)
|
|
}
|
|
// } else { //编辑
|
|
// editCont := overallhandle.MapOut()
|
|
// editCont["`title`"] = title
|
|
// if jiangCeng <= 6 {
|
|
// editCont["`types`"] = 1 //类型(1:奖励;2:处分;)`
|
|
// } else {
|
|
// editCont["`types`"] = 2 //类型(1:奖励;2:处分;)`
|
|
// }
|
|
// editCont["`state`"] = 1
|
|
// editCont["`issuing_unit`"] = issuingUnit
|
|
// editCont["`timedata`"] = timeVal
|
|
// editCont["`years`"] = years
|
|
// editCont["`months`"] = 0
|
|
// editCont["`level`"] = RewPunLevelStr(level)
|
|
// editCont["`rewPunClass`"] = jiangCeng
|
|
// var rewPunYearEditCont models.RewardsPenalties
|
|
// rewPunYearEditCont.EiteCont(map[string]interface{}{"`id`": rewPunYearCont.Id}, editCont)
|
|
// }
|
|
}
|
|
|
|
/*
|
|
*
|
|
@ 作者: 秦东
|
|
@ 时间: 2024-02-02 08:17:12
|
|
@ 功能: 编辑考核成绩
|
|
@ 参数
|
|
|
|
#
|
|
|
|
@ 返回值
|
|
|
|
#
|
|
|
|
@ 方法原型
|
|
|
|
#
|
|
*/
|
|
func (g *GroupParsingData) EditExamineLevel(info map[int]string, meritsYear map[int]int) {
|
|
defer synPros.Done()
|
|
// if info[289] == "" {
|
|
// }
|
|
if val, isOk := meritsYear[0]; isOk {
|
|
g.EditExamineLevelInfo(info[288], val)
|
|
}
|
|
if val, isOk := meritsYear[1]; isOk {
|
|
g.EditExamineLevelInfo(info[289], val)
|
|
}
|
|
if val, isOk := meritsYear[2]; isOk {
|
|
g.EditExamineLevelInfo(info[290], val)
|
|
}
|
|
}
|
|
|
|
/*
|
|
*
|
|
@ 作者: 秦东
|
|
@ 时间: 2024-02-02 08:23:55
|
|
@ 功能: 编辑绩效考核内容
|
|
*/
|
|
func (g *GroupParsingData) EditExamineLevelInfo(level string, years int) {
|
|
// if level == "" {
|
|
// return
|
|
// }
|
|
var merInfo models.Meritslog
|
|
err := merInfo.GetCont(map[string]interface{}{"`userkey`": g.UserKey, "`years`": years, "`months`": 0}, "`id`", "`level`")
|
|
if err != nil { //新增
|
|
merInfo.Score = 0 //绩效分数*10000保存"`
|
|
merInfo.UserKey = g.UserKey //获得人员"`
|
|
merInfo.Status = 1 //(1:启用;2:禁用;3:删除)`
|
|
merInfo.TimeData = time.Now().Unix() //获得时间"`
|
|
merInfo.Years = years //年"`
|
|
merInfo.Months = 0 //月"`
|
|
merInfo.Level = level //考核等级"`
|
|
overall.CONSTANT_DB_HR.Create(&merInfo)
|
|
} else {
|
|
editCont := overallhandle.MapOut()
|
|
if merInfo.Level != level {
|
|
editCont["`level`"] = level
|
|
editCont["`status`"] = 1
|
|
editCont["`timedata`"] = time.Now().Unix()
|
|
var merNewInfo models.Meritslog
|
|
merNewInfo.EiteCont(map[string]interface{}{"`id`": merInfo.Id}, editCont)
|
|
}
|
|
}
|
|
}
|
|
|
|
/*
|
|
*
|
|
@ 作者: 秦东
|
|
@ 时间: 2024-02-01 16:14:40
|
|
@ 功能: 集团外部工作经历
|
|
@ 参数
|
|
|
|
#
|
|
|
|
@ 返回值
|
|
|
|
#
|
|
|
|
@ 方法原型
|
|
|
|
#
|
|
*/
|
|
func (g *GroupParsingData) ExternalWorkExperienceOfTheGroup(info map[int]string) {
|
|
defer synPros.Done()
|
|
var workList []models.WorkHistory
|
|
err := overall.CONSTANT_DB_HR.Where("`key` = ?", g.UserKey).Find(&workList).Error
|
|
if err != nil || len(workList) < 1 {
|
|
if info[222] != "" {
|
|
g.ExternalWorkGroupLog(info[222], info[223], info[224], info[225], info[226], info[227], info[228], info[229], info[230], info[231], info[232], info[233], info[234])
|
|
}
|
|
if info[235] != "" {
|
|
g.ExternalWorkGroupLog(info[235], info[236], info[237], info[238], info[239], info[240], info[241], info[242], info[243], info[244], info[245], info[246], info[247])
|
|
}
|
|
if info[248] != "" {
|
|
g.ExternalWorkGroupLog(info[248], info[249], info[250], info[251], info[252], info[253], info[254], info[255], info[256], info[257], info[258], info[259], info[260])
|
|
}
|
|
if info[261] != "" {
|
|
g.ExternalWorkGroupLog(info[261], info[262], info[263], info[264], info[265], info[266], info[267], info[268], info[269], info[270], info[271], info[272], info[273])
|
|
}
|
|
if info[274] != "" {
|
|
g.ExternalWorkGroupLog(info[274], info[275], info[276], info[277], info[278], info[279], info[280], info[281], info[282], info[283], info[284], info[285], info[286])
|
|
}
|
|
} else { //已经存在历史记录了
|
|
jsonInfo, _ := json.Marshal(workList)
|
|
overallhandle.WriteLog("del", "删除旧集团外部工作经历数据!", string(jsonInfo))
|
|
var workGroupLogCont models.WorkHistory
|
|
workGroupLogCont.DelCont(map[string]interface{}{"`key`": g.UserKey})
|
|
if info[222] != "" {
|
|
g.ExternalWorkGroupLog(info[222], info[223], info[224], info[225], info[226], info[227], info[228], info[229], info[230], info[231], info[232], info[233], info[234])
|
|
}
|
|
if info[235] != "" {
|
|
g.ExternalWorkGroupLog(info[235], info[236], info[237], info[238], info[239], info[240], info[241], info[242], info[243], info[244], info[245], info[246], info[247])
|
|
}
|
|
if info[248] != "" {
|
|
g.ExternalWorkGroupLog(info[248], info[249], info[250], info[251], info[252], info[253], info[254], info[255], info[256], info[257], info[258], info[259], info[260])
|
|
}
|
|
if info[261] != "" {
|
|
g.ExternalWorkGroupLog(info[261], info[262], info[263], info[264], info[265], info[266], info[267], info[268], info[269], info[270], info[271], info[272], info[273])
|
|
}
|
|
if info[274] != "" {
|
|
g.ExternalWorkGroupLog(info[274], info[275], info[276], info[277], info[278], info[279], info[280], info[281], info[282], info[283], info[284], info[285], info[286])
|
|
}
|
|
}
|
|
}
|
|
|
|
/*
|
|
*
|
|
@ 作者: 秦东
|
|
@ 时间: 2024-02-01 16:46:06
|
|
@ 功能: 写入集团外工作经历
|
|
EntryTime 入职时间
|
|
Leavedate 离职日期
|
|
Company 公司
|
|
CompanyNature 公司性质
|
|
Industry 所属行业
|
|
Deparment 部门
|
|
Job 职务
|
|
WorkCont 工作内容
|
|
MinionNumber 下属人数
|
|
SuperiorPosition 上级职务
|
|
Witness 证明人
|
|
WitnessTel 证明人电话
|
|
Remarks 备注
|
|
*/
|
|
func (g *GroupParsingData) ExternalWorkGroupLog(EntryTime, Leavedate, Company, CompanyNature, Industry, Deparment, Job, WorkCont, MinionNumber, SuperiorPosition, Witness, WitnessTel, Remarks string) {
|
|
// fmt.Printf("rrweljl===>%v\n", Leavedate)
|
|
var myWorkLog models.WorkHistory
|
|
myWorkLog.Number = g.UserNum //工号"`
|
|
myWorkLog.Key = g.UserKey //身份识别"`
|
|
myWorkLog.Company = Company //公司"`
|
|
myWorkLog.Deparment = Deparment //部门"`
|
|
myWorkLog.Job = Job //职务"`
|
|
if EntryTime != "" {
|
|
if EntryTime != "至今" {
|
|
myWorkLog.EntryTime = overallhandle.ExcelDateToDate(EntryTime).Unix() //入职时间"`
|
|
} else {
|
|
myWorkLog.EntryTime = 0
|
|
}
|
|
}
|
|
if Leavedate != "" {
|
|
if Leavedate != "至今" {
|
|
myWorkLog.Leavedate = overallhandle.ExcelDateToDate(Leavedate).Unix() //离职日期"`
|
|
} else {
|
|
myWorkLog.Leavedate = 0
|
|
}
|
|
}
|
|
myWorkLog.Witness = Witness //证明人"`
|
|
myWorkLog.WitnessTel = WitnessTel //证明人电话"`
|
|
myWorkLog.Remarks = Remarks //备注"`
|
|
myWorkLog.Time = time.Now().Unix() //创建时间"`
|
|
myWorkLog.State = 1 //状态(1:启用;2:禁用;3:删除)"`
|
|
myWorkLog.WorkCont = WorkCont //工作内容"`
|
|
myWorkLog.SuperiorPosition = SuperiorPosition //上级职务"`
|
|
if MinionNumber != "" {
|
|
manNum, _ := strconv.Atoi(MinionNumber)
|
|
myWorkLog.MinionNumber = manNum //下属人数"`
|
|
} else {
|
|
myWorkLog.MinionNumber = 0
|
|
}
|
|
myWorkLog.CompanyNature = CompanyNature //公司性质
|
|
myWorkLog.Industry = Industry //所属行业
|
|
overall.CONSTANT_DB_HR.Create(&myWorkLog)
|
|
}
|
|
|
|
/*
|
|
*
|
|
@ 作者: 秦东
|
|
@ 时间: 2024-02-01 11:43:27
|
|
@ 功能: 集团内部经历
|
|
@ 参数
|
|
|
|
#
|
|
|
|
@ 返回值
|
|
|
|
#
|
|
|
|
@ 方法原型
|
|
|
|
#
|
|
*/
|
|
func (g *GroupParsingData) GrowthExperienceWithinTheGroup(info map[int]string, orgId string) {
|
|
defer synPros.Done()
|
|
var growInGroup []models.InsideWorkHistory
|
|
err := overall.CONSTANT_DB_HR.Where("`key` = ?", g.UserKey).Find(&growInGroup).Error
|
|
if err != nil || len(growInGroup) < 1 {
|
|
if info[92] != "" {
|
|
g.EditGroupInWorkLog(info[92], info[93], info[94], info[95], info[96], info[97], info[98], info[99], info[100], info[101], "", info[102], info[103], info[104], orgId)
|
|
}
|
|
if info[105] != "" {
|
|
g.EditGroupInWorkLog(info[105], info[106], info[107], info[108], info[109], info[110], info[111], info[112], info[113], info[114], "", info[115], info[116], info[117], orgId)
|
|
}
|
|
if info[118] != "" {
|
|
g.EditGroupInWorkLog(info[118], info[119], info[120], info[121], info[122], info[123], info[124], info[125], info[126], info[127], "", info[128], info[129], info[130], orgId)
|
|
}
|
|
if info[131] != "" {
|
|
g.EditGroupInWorkLog(info[131], info[132], info[133], info[134], info[135], info[136], info[137], info[138], info[139], info[140], "", info[141], info[142], info[143], orgId)
|
|
}
|
|
if info[144] != "" {
|
|
g.EditGroupInWorkLog(info[144], info[145], info[146], info[147], info[148], info[149], info[150], info[151], info[152], info[153], "", info[154], info[155], info[156], orgId)
|
|
}
|
|
if info[157] != "" {
|
|
g.EditGroupInWorkLog(info[157], info[158], info[159], info[160], info[161], info[162], info[163], info[164], info[165], info[166], "", info[167], info[168], info[169], orgId)
|
|
}
|
|
if info[170] != "" {
|
|
g.EditGroupInWorkLog(info[170], info[171], info[172], info[173], info[174], info[175], info[176], info[177], info[178], info[179], "", info[180], info[181], info[182], orgId)
|
|
}
|
|
if info[183] != "" {
|
|
g.EditGroupInWorkLog(info[183], info[184], info[185], info[186], info[187], info[188], info[189], info[190], info[191], info[192], "", info[193], info[194], info[195], orgId)
|
|
}
|
|
if info[196] != "" {
|
|
g.EditGroupInWorkLog(info[196], info[197], info[198], info[199], info[200], info[201], info[202], info[203], info[204], info[205], "", info[206], info[207], info[208], orgId)
|
|
}
|
|
if info[209] != "" {
|
|
g.EditGroupInWorkLog(info[209], info[210], info[211], info[212], info[213], info[214], info[215], info[216], info[217], info[218], "", info[219], info[220], info[221], orgId)
|
|
}
|
|
} else {
|
|
jsonInfo, _ := json.Marshal(growInGroup)
|
|
overallhandle.WriteLog("del", "删除旧集团内部经历数据!", string(jsonInfo))
|
|
var workGroupLogCont models.InsideWorkHistory
|
|
workGroupLogCont.DelCont(map[string]interface{}{"`key`": g.UserKey})
|
|
if info[92] != "" {
|
|
g.EditGroupInWorkLog(info[92], info[93], info[94], info[95], info[96], info[97], info[98], info[99], info[100], info[101], "", info[102], info[103], info[104], orgId)
|
|
}
|
|
if info[105] != "" {
|
|
g.EditGroupInWorkLog(info[105], info[106], info[107], info[108], info[109], info[110], info[111], info[112], info[113], info[114], "", info[115], info[116], info[117], orgId)
|
|
}
|
|
if info[118] != "" {
|
|
g.EditGroupInWorkLog(info[118], info[119], info[120], info[121], info[122], info[123], info[124], info[125], info[126], info[127], "", info[128], info[129], info[130], orgId)
|
|
}
|
|
if info[131] != "" {
|
|
g.EditGroupInWorkLog(info[131], info[132], info[133], info[134], info[135], info[136], info[137], info[138], info[139], info[140], "", info[141], info[142], info[143], orgId)
|
|
}
|
|
if info[144] != "" {
|
|
g.EditGroupInWorkLog(info[144], info[145], info[146], info[147], info[148], info[149], info[150], info[151], info[152], info[153], "", info[154], info[155], info[156], orgId)
|
|
}
|
|
if info[157] != "" {
|
|
g.EditGroupInWorkLog(info[157], info[158], info[159], info[160], info[161], info[162], info[163], info[164], info[165], info[166], "", info[167], info[168], info[169], orgId)
|
|
}
|
|
if info[170] != "" {
|
|
g.EditGroupInWorkLog(info[170], info[171], info[172], info[173], info[174], info[175], info[176], info[177], info[178], info[179], "", info[180], info[181], info[182], orgId)
|
|
}
|
|
if info[183] != "" {
|
|
g.EditGroupInWorkLog(info[183], info[184], info[185], info[186], info[187], info[188], info[189], info[190], info[191], info[192], "", info[193], info[194], info[195], orgId)
|
|
}
|
|
if info[196] != "" {
|
|
g.EditGroupInWorkLog(info[196], info[197], info[198], info[199], info[200], info[201], info[202], info[203], info[204], info[205], "", info[206], info[207], info[208], orgId)
|
|
}
|
|
if info[209] != "" {
|
|
g.EditGroupInWorkLog(info[209], info[210], info[211], info[212], info[213], info[214], info[215], info[216], info[217], info[218], "", info[219], info[220], info[221], orgId)
|
|
}
|
|
}
|
|
}
|
|
|
|
/*
|
|
*
|
|
@ 作者: 秦东
|
|
@ 时间: 2024-02-01 13:49:00
|
|
@ 功能: 编辑集团内部记录
|
|
startTime 开始时间
|
|
endTime 结束时间
|
|
changeType 变动类型
|
|
changeReason 变动原因
|
|
company 公司
|
|
department 一级部室
|
|
workShop 二级部门或车间
|
|
workshopSection 工段
|
|
position 职位
|
|
gradePositions 职务等级
|
|
workContent 工作内容
|
|
superiorPosition 上级职位
|
|
superiorName 上级名称
|
|
subordinates 下属人数
|
|
*/
|
|
func (g *GroupParsingData) EditGroupInWorkLog(startTime, endTime, changeType, changeReason, company, department, workShop, workshopSection, position, gradePositions, workContent, superiorPosition, superiorName, subordinates string, org string) {
|
|
var adminOrg int64
|
|
var sunOrg overallhandle.GetOrgAllParent
|
|
var inWorkGroupInfo models.InsideWorkHistory
|
|
inWorkGroupInfo.Key = g.UserKey //员工识别符"`
|
|
|
|
inWorkGroupInfo.Bdlx = changeType
|
|
inWorkGroupInfo.Gsmc = company
|
|
inWorkGroupInfo.Yjbm = department
|
|
inWorkGroupInfo.Ejbm = workShop
|
|
inWorkGroupInfo.Gongduan = workshopSection
|
|
inWorkGroupInfo.WorkCont = workContent
|
|
inWorkGroupInfo.Zhiwei = position
|
|
|
|
if company != "" {
|
|
var comOrg models.AdministrativeOrganization
|
|
comOrg.GetCont(map[string]interface{}{"`name`": company}, "`id`")
|
|
if comOrg.Id != 0 {
|
|
inWorkGroupInfo.Company = comOrg.Id //公司"`
|
|
sunOrg.GetOrgSonAllId(comOrg.Id)
|
|
sunOrg.Id = append(sunOrg.Id, comOrg.Id)
|
|
adminOrg = comOrg.Id
|
|
}
|
|
|
|
}
|
|
|
|
if department != "" {
|
|
if len(sunOrg.Id) > 0 {
|
|
mastOrg := GetMyOrgSunId(department, sunOrg.Id)
|
|
if mastOrg != 0 {
|
|
inWorkGroupInfo.Department = mastOrg //一级部室"`
|
|
adminOrg = mastOrg
|
|
}
|
|
}
|
|
|
|
}
|
|
if workShop != "" {
|
|
if len(sunOrg.Id) > 0 {
|
|
suntOrg := GetMyOrgSunId(workShop, sunOrg.Id)
|
|
if suntOrg != 0 {
|
|
inWorkGroupInfo.WorkShop = suntOrg //二级部门或车间"`
|
|
adminOrg = suntOrg
|
|
}
|
|
|
|
}
|
|
}
|
|
if workshopSection != "" {
|
|
if len(sunOrg.Id) > 0 {
|
|
workOrg := GetMyOrgSunId(workshopSection, sunOrg.Id)
|
|
if workOrg != 0 {
|
|
inWorkGroupInfo.WorkshopSection = workOrg //工段"`
|
|
adminOrg = workOrg
|
|
}
|
|
|
|
}
|
|
}
|
|
if adminOrg != 0 {
|
|
positions, jobIds, _ := GetMyPositisName(position, adminOrg) //职位"`
|
|
inWorkGroupInfo.Position = positions
|
|
inWorkGroupInfo.JobId = jobIds
|
|
|
|
// inWorkGroupInfo.Position, inWorkGroupInfo.JobId, _ = GetMyPositisName(position, adminOrg) //职位"`
|
|
}
|
|
|
|
switch gradePositions {
|
|
case "一级":
|
|
inWorkGroupInfo.GradePositions = 1 // 职务等级"`
|
|
case "二级":
|
|
inWorkGroupInfo.GradePositions = 2 // 职务等级"`
|
|
case "三级":
|
|
inWorkGroupInfo.GradePositions = 3 // 职务等级"`
|
|
case "四级":
|
|
inWorkGroupInfo.GradePositions = 4 // 职务等级"`
|
|
case "五级":
|
|
inWorkGroupInfo.GradePositions = 5 // 职务等级"`
|
|
case "协议":
|
|
inWorkGroupInfo.GradePositions = 6 // 职务等级"`
|
|
default:
|
|
}
|
|
if startTime != "" {
|
|
if startTime == "至今" {
|
|
inWorkGroupInfo.StartTime = 0
|
|
} else {
|
|
inWorkGroupInfo.StartTime = overallhandle.ExcelDateToDate(startTime).Unix() //开始日期"`
|
|
}
|
|
}
|
|
if endTime != "" {
|
|
if endTime == "至今" {
|
|
inWorkGroupInfo.EndTime = 0
|
|
} else {
|
|
inWorkGroupInfo.EndTime = overallhandle.ExcelDateToDate(endTime).Unix() //结束日期"`
|
|
}
|
|
}
|
|
// Team = //班组(1:长白;2:甲;3:乙;4:丙;5:丁)"`
|
|
inWorkGroupInfo.ChangeType = changeTypeToInt(changeType) //变动类型(1:预入职;2:雇佣入职;3:转正;4:晋升;5:降级;6:职等调整;7:调动调入;8:跨公司调动调入;9:借调;10:平调;11:兼职;12:预离职;13:离职;14:退休;15:返聘;16:员工初始化;)"`
|
|
inWorkGroupInfo.Time = time.Now().Unix() //创建时间"`
|
|
inWorkGroupInfo.State = 1 //状态(1:启用;2:禁用;3:删除)"`
|
|
// inWorkGroupInfo.AssignType = //1、主职;2:兼职"`
|
|
// inWorkGroupInfo.JobId = //职务"`
|
|
fmt.Printf("行政职务--->%v\n", org)
|
|
// switch org {
|
|
// case "296":
|
|
// inWorkGroupInfo.Dengji = gradePositions
|
|
// default:
|
|
// inWorkGroupInfo.WorkCont = gradePositions
|
|
// }
|
|
inWorkGroupInfo.Dengji = gradePositions
|
|
// inWorkGroupInfo.WorkCont = //工作内容"`
|
|
inWorkGroupInfo.ChangeReason = changeReason //变动原因"`
|
|
inWorkGroupInfo.SuperiorPosition = superiorPosition //上级职位"`
|
|
inWorkGroupInfo.SuperiorName = superiorName //上级名称"`
|
|
if subordinates != "" {
|
|
subNum, _ := strconv.Atoi(subordinates)
|
|
inWorkGroupInfo.Subordinates = subNum //下属人数"`
|
|
} else {
|
|
inWorkGroupInfo.Subordinates = 0
|
|
}
|
|
overall.CONSTANT_DB_HR.Create(&inWorkGroupInfo)
|
|
}
|
|
|
|
/*
|
|
*
|
|
@ 作者: 秦东
|
|
@ 时间: 2024-01-31 16:49:21
|
|
@ 功能: 家庭成员
|
|
@ 参数
|
|
|
|
#
|
|
|
|
@ 返回值
|
|
|
|
#
|
|
|
|
@ 方法原型
|
|
|
|
#
|
|
*/
|
|
func (g *GroupParsingData) FamilyMembers(info map[int]string) {
|
|
defer synPros.Done()
|
|
var familyAry []models.FamilyMembers
|
|
err := overall.CONSTANT_DB_HR.Where("`key` = ?", g.UserKey).Find(&familyAry).Error
|
|
var emergencyFamily []models.EmergencyContact
|
|
creeTime := time.Now().Unix()
|
|
if err != nil || len(familyAry) < 1 {
|
|
if info[59] != "" && info[60] != "" {
|
|
g.EditFamilyInfo(info[59], info[60], info[61], info[62], info[63], info[63], info[64])
|
|
if info[64] == "是" {
|
|
var oneInfo models.EmergencyContact
|
|
oneInfo.Number = g.UserNum //员工工号;index"`
|
|
oneInfo.Key = g.UserKey //
|
|
oneInfo.Name = info[60] //紧急联系人姓名"`
|
|
oneInfo.Relationship = info[59] //与紧急联系人关系"`
|
|
oneInfo.Tel = info[61] //紧急联系人电话"`
|
|
oneInfo.Time = creeTime //创建时间"`
|
|
oneInfo.State = 1 //状态(1:启用;2:禁用;3:删除)"`
|
|
emergencyFamily = append(emergencyFamily, oneInfo)
|
|
}
|
|
}
|
|
if info[65] != "" && info[66] != "" {
|
|
g.EditFamilyInfo(info[65], info[66], info[67], info[68], info[69], info[70], "否")
|
|
if info[70] == "是" {
|
|
var twoInfo models.EmergencyContact
|
|
twoInfo.Number = g.UserNum //员工工号;index"`
|
|
twoInfo.Key = g.UserKey //
|
|
twoInfo.Name = info[66] //紧急联系人姓名"`
|
|
twoInfo.Relationship = info[65] //与紧急联系人关系"`
|
|
twoInfo.Tel = info[67] //紧急联系人电话"`
|
|
twoInfo.Time = creeTime //创建时间"`
|
|
twoInfo.State = 1 //状态(1:启用;2:禁用;3:删除)"`
|
|
emergencyFamily = append(emergencyFamily, twoInfo)
|
|
}
|
|
}
|
|
if info[71] != "" && info[72] != "" {
|
|
g.EditFamilyInfo(info[71], info[72], info[73], info[74], info[75], info[76], "否")
|
|
if info[76] == "是" {
|
|
var twoInfo models.EmergencyContact
|
|
twoInfo.Number = g.UserNum //员工工号;index"`
|
|
twoInfo.Key = g.UserKey //
|
|
twoInfo.Name = info[72] //紧急联系人姓名"`
|
|
twoInfo.Relationship = info[71] //与紧急联系人关系"`
|
|
twoInfo.Tel = info[73] //紧急联系人电话"`
|
|
twoInfo.Time = creeTime //创建时间"`
|
|
twoInfo.State = 1 //状态(1:启用;2:禁用;3:删除)"`
|
|
emergencyFamily = append(emergencyFamily, twoInfo)
|
|
}
|
|
}
|
|
if info[77] != "" && info[78] != "" {
|
|
g.EditFamilyInfo(info[77], info[78], info[79], info[80], info[81], info[82], "否")
|
|
if info[76] == "是" {
|
|
var twoInfo models.EmergencyContact
|
|
twoInfo.Number = g.UserNum //员工工号;index"`
|
|
twoInfo.Key = g.UserKey //
|
|
twoInfo.Name = info[78] //紧急联系人姓名"`
|
|
twoInfo.Relationship = info[77] //与紧急联系人关系"`
|
|
twoInfo.Tel = info[79] //紧急联系人电话"`
|
|
twoInfo.Time = creeTime //创建时间"`
|
|
twoInfo.State = 1 //状态(1:启用;2:禁用;3:删除)"`
|
|
emergencyFamily = append(emergencyFamily, twoInfo)
|
|
}
|
|
}
|
|
} else {
|
|
jsonInfo, _ := json.Marshal(familyAry)
|
|
overallhandle.WriteLog("del", "删除旧家庭成员数据!", string(jsonInfo))
|
|
var familyCont models.FamilyMembers
|
|
familyCont.DelCont(map[string]interface{}{"`key`": g.UserKey})
|
|
if info[59] != "" && info[60] != "" {
|
|
g.EditFamilyInfo(info[59], info[60], info[61], info[62], info[63], info[64], "否")
|
|
if info[64] == "是" {
|
|
var oneInfo models.EmergencyContact
|
|
oneInfo.Number = g.UserNum //员工工号;index"`
|
|
oneInfo.Key = g.UserKey //
|
|
oneInfo.Name = info[60] //紧急联系人姓名"`
|
|
oneInfo.Relationship = info[59] //与紧急联系人关系"`
|
|
oneInfo.Tel = info[61] //紧急联系人电话"`
|
|
oneInfo.Time = creeTime //创建时间"`
|
|
oneInfo.State = 1 //状态(1:启用;2:禁用;3:删除)"`
|
|
emergencyFamily = append(emergencyFamily, oneInfo)
|
|
}
|
|
}
|
|
if info[65] != "" && info[66] != "" {
|
|
g.EditFamilyInfo(info[65], info[66], info[67], info[68], info[69], info[70], "否")
|
|
if info[70] == "是" {
|
|
var twoInfo models.EmergencyContact
|
|
twoInfo.Number = g.UserNum //员工工号;index"`
|
|
twoInfo.Key = g.UserKey //
|
|
twoInfo.Name = info[66] //紧急联系人姓名"`
|
|
twoInfo.Relationship = info[65] //与紧急联系人关系"`
|
|
twoInfo.Tel = info[67] //紧急联系人电话"`
|
|
twoInfo.Time = creeTime //创建时间"`
|
|
twoInfo.State = 1 //状态(1:启用;2:禁用;3:删除)"`
|
|
emergencyFamily = append(emergencyFamily, twoInfo)
|
|
}
|
|
}
|
|
if info[71] != "" && info[72] != "" {
|
|
g.EditFamilyInfo(info[71], info[72], info[73], info[74], info[75], info[76], "否")
|
|
if info[76] == "是" {
|
|
var twoInfo models.EmergencyContact
|
|
twoInfo.Number = g.UserNum //员工工号;index"`
|
|
twoInfo.Key = g.UserKey //
|
|
twoInfo.Name = info[72] //紧急联系人姓名"`
|
|
twoInfo.Relationship = info[71] //与紧急联系人关系"`
|
|
twoInfo.Tel = info[73] //紧急联系人电话"`
|
|
twoInfo.Time = creeTime //创建时间"`
|
|
twoInfo.State = 1 //状态(1:启用;2:禁用;3:删除)"`
|
|
emergencyFamily = append(emergencyFamily, twoInfo)
|
|
}
|
|
}
|
|
if info[77] != "" && info[78] != "" {
|
|
g.EditFamilyInfo(info[77], info[78], info[79], info[80], info[81], info[82], "否")
|
|
if info[82] == "是" {
|
|
var twoInfo models.EmergencyContact
|
|
twoInfo.Number = g.UserNum //员工工号;index"`
|
|
twoInfo.Key = g.UserKey //
|
|
twoInfo.Name = info[78] //紧急联系人姓名"`
|
|
twoInfo.Relationship = info[77] //与紧急联系人关系"`
|
|
twoInfo.Tel = info[79] //紧急联系人电话"`
|
|
twoInfo.Time = creeTime //创建时间"`
|
|
twoInfo.State = 1 //状态(1:启用;2:禁用;3:删除)"`
|
|
emergencyFamily = append(emergencyFamily, twoInfo)
|
|
}
|
|
}
|
|
}
|
|
//处理紧急联系人数据
|
|
if len(emergencyFamily) > 0 {
|
|
var oldEmeList []models.EmergencyContact
|
|
err := overall.CONSTANT_DB_HR.Where("`key` = ?", g.UserKey).Find(&oldEmeList).Error
|
|
if err == nil {
|
|
jsonInfo, _ := json.Marshal(oldEmeList)
|
|
overallhandle.WriteLog("del", "删除旧紧急联系人数据!", string(jsonInfo))
|
|
var emeDel models.EmergencyContact
|
|
emeDel.DelCont(map[string]interface{}{"`key`": g.UserKey})
|
|
}
|
|
overall.CONSTANT_DB_HR.Create(&emergencyFamily)
|
|
}
|
|
}
|
|
|
|
/*
|
|
*
|
|
@ 作者: 秦东
|
|
@ 时间: 2024-02-01 10:05:31
|
|
@ 功能: 编辑员工家属
|
|
*/
|
|
func (g *GroupParsingData) EditFamilyInfo(relationship, name, tel, workUnitPost, postnme, politicalOutlookCn, isSos string) {
|
|
var familyCont models.FamilyMembers
|
|
familyCont.Number = g.UserNum //员工工号"`
|
|
familyCont.Key = g.UserKey //key"`
|
|
familyCont.Relationship = relationship //亲属关系"`
|
|
familyCont.Name = name //姓名"`
|
|
familyCont.Company = "" //所在公司"`
|
|
familyCont.Deparment = "" //所在部门"`
|
|
familyCont.Postnme = postnme //所在岗位"`
|
|
familyCont.Tel = tel //紧急联系人电话"`
|
|
familyCont.PoliticalOutlook = politiToInt(politicalOutlookCn) //政治面貌(1:群众;2:无党派;3:台盟会员;4:九三社员;5:致公党员;6:农工党员;7:民进会员;8:民建会员;9:民盟盟员;10:民革会员,11:共青团员;12:预备党员;13:中共党员)"`
|
|
familyCont.Time = time.Now().Unix() //创建时间"`
|
|
familyCont.State = 1 //状态(1:启用;2:禁用;3:删除)"`
|
|
familyCont.PoliticalOutlookCn = politicalOutlookCn //政治面貌汉字说明"`
|
|
familyCont.WorkUnitPost = workUnitPost //工作单位及职务"`
|
|
if isSos == "是" {
|
|
familyCont.IsSos = 1 //是否为紧急联系人(1、是;2:否)"`
|
|
} else {
|
|
familyCont.IsSos = 2 //是否为紧急联系人(1、是;2:否)"`
|
|
}
|
|
overall.CONSTANT_DB_HR.Create(&familyCont)
|
|
}
|
|
|
|
/*
|
|
*
|
|
@ 作者: 秦东
|
|
@ 时间: 2024-01-31 15:30:20
|
|
@ 功能: 编辑学历信息
|
|
@ 参数
|
|
|
|
#
|
|
|
|
@ 返回值
|
|
|
|
#
|
|
|
|
@ 方法原型
|
|
|
|
#
|
|
*/
|
|
func (g *GroupParsingData) EditEducationInfo(info map[int]string) {
|
|
defer synPros.Done()
|
|
|
|
var mySchoolLog []models.PersonnelEducation
|
|
err := overall.CONSTANT_DB_HR.Model(&models.PersonnelEducation{}).Where("`key` = ?", g.UserKey).Find(&mySchoolLog).Error
|
|
if err != nil || len(mySchoolLog) < 1 {
|
|
if info[32] != "" || info[35] != "" { //第一学历
|
|
|
|
g.AddOneSchollLog(info[32], info[33], info[34], info[35], info[36], info[37], info[38], info[39], info[40], 2)
|
|
|
|
}
|
|
if info[41] != "" || info[44] != "" { //最高学历
|
|
g.AddOneSchollLog(info[41], info[42], info[43], info[44], info[45], info[46], info[47], info[48], info[49], 3)
|
|
}
|
|
if info[50] != "" || info[53] != "" { //其他学历
|
|
g.AddOneSchollLog(info[50], info[51], info[52], info[53], info[54], info[55], info[56], info[57], info[58], 1)
|
|
}
|
|
} else {
|
|
jsonInfo, _ := json.Marshal(mySchoolLog)
|
|
overallhandle.WriteLog("del", "删除旧集团外部工作经历数据!", string(jsonInfo))
|
|
var delScho models.PersonnelEducation
|
|
delScho.DelCont(map[string]interface{}{"`key`": g.UserKey})
|
|
if info[32] != "" || info[35] != "" { //第一学历
|
|
|
|
g.AddOneSchollLog(info[32], info[33], info[34], info[35], info[36], info[37], info[38], info[39], info[40], 2)
|
|
|
|
}
|
|
if info[41] != "" || info[44] != "" { //最高学历
|
|
g.AddOneSchollLog(info[41], info[42], info[43], info[44], info[45], info[46], info[47], info[48], info[49], 3)
|
|
}
|
|
if info[50] != "" || info[53] != "" { //其他学历
|
|
g.AddOneSchollLog(info[50], info[51], info[52], info[53], info[54], info[55], info[56], info[57], info[58], 1)
|
|
}
|
|
}
|
|
}
|
|
|
|
/*
|
|
*
|
|
@ 作者: 秦东
|
|
@ 时间: 2024-01-31 15:59:16
|
|
@ 功能: 编辑第一学历
|
|
Education 学历
|
|
EducationType 学历类型
|
|
AcademicDegree 学位
|
|
GraduationSchool 毕业学校
|
|
SchoolType 院校类型
|
|
CollegeFaction 所属院系
|
|
Subject 专业
|
|
AdmissionTime 入学时间
|
|
GraduationTime 毕业时间
|
|
*/
|
|
func (g *GroupParsingData) EditSchollLog(Education, EducationType, AcademicDegree, GraduationSchool, SchoolType, CollegeFaction, Subject, AdmissionTime, GraduationTime string, level int) {
|
|
var mySchoolLog []models.PersonnelEducation
|
|
err := overall.CONSTANT_DB_HR.Model(&models.PersonnelEducation{}).Select("`id`,`level`").Where("`key` = ?", g.UserKey).Find(&mySchoolLog).Error
|
|
if err != nil || len(mySchoolLog) < 1 {
|
|
g.AddOneSchollLog(Education, EducationType, AcademicDegree, GraduationSchool, SchoolType, CollegeFaction, Subject, AdmissionTime, GraduationTime, level)
|
|
} else {
|
|
var editId int64
|
|
fisrVal := 0
|
|
higVal := 0
|
|
for _, v := range mySchoolLog {
|
|
if v.Education == ducationToInt(Education) && v.GraduationSchool == GraduationSchool {
|
|
editId = v.Id
|
|
if v.Level == 3 {
|
|
higVal = 3
|
|
}
|
|
if v.Level == 2 {
|
|
fisrVal = 2
|
|
}
|
|
}
|
|
}
|
|
switch level {
|
|
case 2:
|
|
if fisrVal == 2 {
|
|
var editLevLog models.PersonnelEducation
|
|
editLevLog.EiteCont(map[string]interface{}{"`key`": g.UserKey, "`level`": 2}, map[string]interface{}{"`level`": 1})
|
|
}
|
|
|
|
case 3:
|
|
if higVal == 3 {
|
|
var editLevLog models.PersonnelEducation
|
|
editLevLog.EiteCont(map[string]interface{}{"`key`": g.UserKey, "`level`": 3}, map[string]interface{}{"`level`": 1})
|
|
}
|
|
default:
|
|
}
|
|
if editId == 0 {
|
|
g.AddOneSchollLog(Education, EducationType, AcademicDegree, GraduationSchool, SchoolType, CollegeFaction, Subject, AdmissionTime, GraduationTime, level)
|
|
} else {
|
|
switch level {
|
|
case 2:
|
|
var editLevLog models.PersonnelEducation
|
|
editLevLog.EiteCont(map[string]interface{}{"`key`": g.UserKey, "`level`": 2}, map[string]interface{}{"`level`": 1})
|
|
case 3:
|
|
var editLevLog models.PersonnelEducation
|
|
editLevLog.EiteCont(map[string]interface{}{"`key`": g.UserKey, "`level`": 3}, map[string]interface{}{"`level`": 1})
|
|
default:
|
|
}
|
|
editCont := overallhandle.MapOut()
|
|
editCont["`time`"] = time.Now().Unix()
|
|
editCont["`education`"] = ducationToInt(Education)
|
|
editCont["`graduation_school`"] = GraduationSchool
|
|
editCont["`subject`"] = Subject
|
|
if AdmissionTime != "" {
|
|
editCont["`admission_time`"] = overallhandle.ExcelDateToDate(AdmissionTime).Unix() //入学时间"`
|
|
}
|
|
if GraduationTime != "" {
|
|
editCont["`graduation_time`"] = overallhandle.ExcelDateToDate(GraduationTime).Unix() //毕业时间"`
|
|
}
|
|
editCont["`level`"] = level
|
|
editCont["`academic_degree`"] = hestacademicdegreeToInt(AcademicDegree)
|
|
editCont["`state`"] = 1
|
|
editCont["`academic_degree_cn`"] = AcademicDegree
|
|
editCont["`education_cn`"] = Education
|
|
editCont["`education_type`"] = EducationTypeStr(EducationType)
|
|
editCont["`collegeFaction`"] = CollegeFaction
|
|
editCont["`collegeFaction`"] = EducationTypeStr(SchoolType)
|
|
var editLog models.PersonnelEducation
|
|
editLog.EiteCont(map[string]interface{}{"`id`": editId}, editCont)
|
|
}
|
|
}
|
|
}
|
|
|
|
/*
|
|
*
|
|
@ 作者: 秦东
|
|
@ 时间: 2024-01-31 16:16:00
|
|
@ 功能: 写入单一教育记录
|
|
*/
|
|
func (g *GroupParsingData) AddOneSchollLog(Education, EducationType, AcademicDegree, GraduationSchool, SchoolType, CollegeFaction, Subject, AdmissionTime, GraduationTime string, level int) {
|
|
var firstLog models.PersonnelEducation
|
|
firstLog.Number = g.UserNum //员工工号"`
|
|
firstLog.XueLi = Education
|
|
firstLog.Education = ducationToInt(Education) //学历(1:初中及以下;2:中专;3:高中;4:中技;5:高技;6:函数专科;7:大学专科;8:函数本科;9:大学本科;10:硕士研究生;11:博士研究生;12:专家、教授)"`
|
|
firstLog.GraduationSchool = GraduationSchool //毕业学校"`
|
|
firstLog.Subject = Subject
|
|
// fmt.Printf("\n\n获取得时间--------->%v\n\n", AdmissionTime) //专业"`
|
|
if AdmissionTime != "" {
|
|
|
|
date, err := ParseExcelDate(AdmissionTime)
|
|
|
|
if err == nil {
|
|
firstLog.AdmissionTime = overallhandle.ExcelDateToDate(date.Format("2006-01-02")).Unix() //入学时间"`
|
|
}
|
|
}
|
|
if GraduationTime != "" {
|
|
date, err := ParseExcelDate(GraduationTime)
|
|
|
|
if err == nil {
|
|
firstLog.GraduationTime = overallhandle.ExcelDateToDate(date.Format("2006-01-02")).Unix() //入学时间"`
|
|
}
|
|
// firstLog.GraduationTime = overallhandle.ExcelDateToDate(GraduationTime).Unix() //毕业时间"`
|
|
}
|
|
firstLog.Time = time.Now().Unix() //写入时间"`
|
|
firstLog.Level = level //学历类型(1:普通;2:第一学历;3:最高学历)"`
|
|
firstLog.AcademicDegree = hestacademicdegreeToInt(AcademicDegree) //学位(1:无;2:学士;3:硕士;4:博士)"`
|
|
firstLog.Key = g.UserKey //key"`
|
|
firstLog.State = 1 //状态(1:启用;2:禁用;3:删除)"`
|
|
|
|
firstLog.AcademicDegreeCn = AcademicDegree //学位中文说明"`
|
|
firstLog.EducationCn = Education //学历中文说明"`
|
|
firstLog.EducationType = EducationTypeStr(EducationType) //学历类型(1、统招;2、函授)"`
|
|
firstLog.CollegeFaction = CollegeFaction //所属院系"`
|
|
firstLog.SchoolType = SchoolTypeStr(SchoolType) //学历类型(院校类型(1、私立中学;2:公立中学;3:高职院校;4:民办专科院校;5:公办专科院校;6:民办本科院校;7:公办本科院校;8:”211“工程院校;9:”985“工程院校;10:双一流院校))"`
|
|
firstLog.XueLiLeixing = EducationType
|
|
firstLog.YuanXiaoLeiXing = SchoolType
|
|
overall.CONSTANT_DB_HR.Create(&firstLog)
|
|
}
|
|
|
|
/*
|
|
*
|
|
@ 作者: 秦东
|
|
@ 时间: 2024-01-30 14:29:56
|
|
@ 功能: 人员信息副本
|
|
@ 参数
|
|
|
|
#
|
|
|
|
@ 返回值
|
|
|
|
#
|
|
|
|
@ 方法原型
|
|
|
|
#
|
|
*/
|
|
func (g *GroupParsingData) SecondaryTableUser(info map[int]string) {
|
|
defer synPros.Done()
|
|
var myInfo models.PersonnelContent
|
|
err := myInfo.GetCont(map[string]interface{}{"`key`": g.UserKey}, "`number`")
|
|
fmt.Printf("员工附属信息%v\n", err)
|
|
if err != nil {
|
|
//附属内容不存在,进行新增。
|
|
myInfo.Key = g.UserKey //Key"`
|
|
myInfo.Number = g.UserNum //员工工号;index"`
|
|
myInfo.Idcardno = info[23] //身份证号"`
|
|
// myInfo. Passportno = //护照号码"`
|
|
// myInfo. Globalroaming = //国际区号"`
|
|
myInfo.Mobilephone = info[28] //手机号码"`
|
|
myInfo.Email = info[31] //电子邮件"`
|
|
myInfo.Gender = genderToInt(info[10]) //性别(1:男性;2:女性;3:中性)"`
|
|
if info[11] != "" {
|
|
myInfo.Birthday = overallhandle.ExcelDateToDate(info[11]).Unix() //birthday"`
|
|
}
|
|
myInfo.Myfolk = info[13] //民族"`
|
|
myInfo.Nativeplace = info[19] //籍贯"`
|
|
if info[24] != "" {
|
|
myInfo.Idcardstartdate = overallhandle.ExcelDateToDate(info[24]).Unix() //身份证有效期开始"`
|
|
}
|
|
if info[25] != "" {
|
|
myInfo.Idcardenddate = overallhandle.ExcelDateToDate(info[25]).Unix() //身份证有效期结束"`
|
|
}
|
|
|
|
myInfo.Idcardaddress = info[27] //身份证地址"`
|
|
// myInfo. IdcardIssued = //身份证签发机关"`
|
|
myInfo.Health = healthToInt(info[15]) //健康状况(1:良好;2:一般;3:较弱,4:有生理缺陷;5:残废)"`
|
|
myInfo.Maritalstatus = maritalstatusToInt(info[14]) //婚姻状况(1:未婚;2:已婚;3:丧偶;4:离异)"`
|
|
// myInfo. Internaltelephone = //内线电话"`
|
|
myInfo.Currentresidence = info[18] //现居住地址"`
|
|
myInfo.Time = time.Now().Unix() //创建时间"`
|
|
myInfo.Constellation = consteToInt(info[21]) //星座(1:白羊座;2:金牛座;3:双子座;4:巨蟹座;5:狮子座;6:处女座;7:天枰座;8:天蝎座;9:射手座;10:摩羯座;11:水瓶座;12:双鱼座)"`
|
|
if info[83] == "是" {
|
|
myInfo.Isdoubleworker = 1 //是否双职工(1:是;2:否)"`
|
|
g.WorkingCouple(info, true)
|
|
} else {
|
|
myInfo.Isdoubleworker = 2 //是否双职工(1:是;2:否)"`
|
|
g.WorkingCouple(info, false)
|
|
}
|
|
if info[320] == "是" {
|
|
myInfo.Isveterans = 1 //是否为退役军人(1:是;2:否)"`
|
|
g.EditVeterans(info, true)
|
|
} else {
|
|
myInfo.Isveterans = 2
|
|
g.EditVeterans(info, false)
|
|
}
|
|
myInfo.Veteransnumber = info[321]
|
|
if info[294] != "" {
|
|
myInfo.Jobstartdate = overallhandle.ExcelDateToDate(info[294]).Unix() //参加工作日期"`
|
|
} //退役证编号"`
|
|
if info[296] != "" {
|
|
myInfo.Entrydate = overallhandle.ExcelDateToDate(info[296]).Unix() //入职日期"`
|
|
}
|
|
// myInfo. Probationperiod = //试用期"`
|
|
// myInfo. Planformaldate = //预计转正日期"`
|
|
if info[16] != "" {
|
|
myInfo.PoliticalOutlook = politiToInt(info[16]) //政治面貌(1:群众;2:无党派;3:台盟会员;4:九三社员;5:致公党员;6:农工党员;7:民进会员;8:民建会员;9:民盟盟员;10:民革会员,11:共青团员;12:预备党员;13:中共党员)"`
|
|
}
|
|
if info[313] != "" {
|
|
myInfo.PoliticalOutlook = politiToInt(info[313]) //政治面貌(1:群众;2:无党派;3:台盟会员;4:九三社员;5:致公党员;6:农工党员;7:民进会员;8:民建会员;9:民盟盟员;10:民革会员,11:共青团员;12:预备党员;13:中共党员)"`
|
|
}
|
|
myInfo.MaritalstatusCn = info[14] //婚姻状况汉字说明"`
|
|
myInfo.ConstellationingCn = info[21] //星座汉字说明"`
|
|
myInfo.PoliticalOutlookCn = info[16] //政治面貌汉字说明"`
|
|
myInfo.HealthCn = info[15] //健康状况中文说明"`
|
|
// myInfo.NameUsedBefore = //曾用名"`
|
|
myInfo.CareerPlanning = info[291] //职业生涯规划"`
|
|
myInfo.HelpObtained = info[292] //个人期望从组织获得的帮助"`
|
|
myInfo.Hobby = info[22] //爱好"`
|
|
|
|
myInfo.DomicileType = info[17] //户籍类型
|
|
if info[26] == "是" {
|
|
myInfo.IdCardnoLongTerm = 1 //身份证是否长期有效(1:是;2:否)
|
|
|
|
} else {
|
|
myInfo.IdCardnoLongTerm = 2 //身份证是否长期有效(1:是;2:否)
|
|
|
|
}
|
|
myInfo.MobileShortNumber = info[29] //手机小号
|
|
myInfo.Channel = JoinJobChanel(info[293]) //入职渠道(1:社会招聘;2:校园招聘;3:内部推荐)
|
|
myInfo.BloodType = info[20] //血型
|
|
// myInfo.EiteCont(map[string]interface{}{"`key`": g.UserKey}, myInfo)
|
|
overall.CONSTANT_DB_HR.Create(&myInfo)
|
|
} else {
|
|
//附属内容存在,进行编辑。
|
|
editCont := overallhandle.MapOut()
|
|
editCont["`idcardno`"] = info[23]
|
|
editCont["`mobilephone`"] = info[28]
|
|
editCont["`email`"] = info[31]
|
|
editCont["`gender`"] = genderToInt(info[10])
|
|
if info[11] != "" {
|
|
editCont["`birthday`"] = overallhandle.ExcelDateToDate(info[11]).Unix()
|
|
}
|
|
editCont["`myfolk`"] = info[13]
|
|
editCont["`nativeplace`"] = info[19]
|
|
if info[24] != "" {
|
|
editCont["`idcardstartdate`"] = overallhandle.ExcelDateToDate(info[24]).Unix()
|
|
}
|
|
if info[25] != "" {
|
|
editCont["`idcardenddate`"] = overallhandle.ExcelDateToDate(info[25]).Unix()
|
|
}
|
|
editCont["`idcardaddress`"] = info[27]
|
|
editCont["`health`"] = healthToInt(info[15])
|
|
editCont["`maritalstatus`"] = maritalstatusToInt(info[14])
|
|
editCont["`currentresidence`"] = info[18]
|
|
editCont["`constellationing`"] = consteToInt(info[21])
|
|
if info[83] == "是" {
|
|
editCont["`isdoubleworker`"] = 1 //是否双职工(1:是;2:否)"`
|
|
g.WorkingCouple(info, true)
|
|
} else {
|
|
editCont["`isdoubleworker`"] = 2 //是否双职工(1:是;2:否)"`
|
|
g.WorkingCouple(info, false)
|
|
}
|
|
if info[320] == "是" {
|
|
editCont["`isveterans`"] = 1 //是否为退役军人(1:是;2:否)"`
|
|
g.EditVeterans(info, true)
|
|
} else {
|
|
editCont["`isveterans`"] = 2
|
|
g.EditVeterans(info, false)
|
|
}
|
|
editCont["`veteransnumber`"] = info[321]
|
|
if info[294] != "" {
|
|
editCont["`jobstartdate`"] = overallhandle.ExcelDateToDate(info[294]).Unix()
|
|
}
|
|
if info[296] != "" {
|
|
editCont["`entrydate`"] = overallhandle.ExcelDateToDate(info[296]).Unix()
|
|
}
|
|
if info[16] != "" {
|
|
editCont["`political_outlook`"] = politiToInt(info[16])
|
|
}
|
|
if info[313] != "" {
|
|
editCont["`political_outlook`"] = politiToInt(info[313])
|
|
}
|
|
editCont["`maritalstatus_cn`"] = info[14]
|
|
editCont["`constellationing_cn`"] = info[21]
|
|
editCont["`political_outlook_cn`"] = info[16]
|
|
editCont["`health_cn`"] = info[15]
|
|
editCont["`career_planning`"] = info[291]
|
|
editCont["`help_obtained`"] = info[292]
|
|
editCont["`hobby`"] = info[22]
|
|
editCont["`domicile_type`"] = info[17]
|
|
if info[26] == "是" {
|
|
editCont["`idCardnoLongTerm`"] = 1 //身份证是否长期有效(1:是;2:否)
|
|
// g.WorkingCouple(info, true)
|
|
} else {
|
|
editCont["`idCardnoLongTerm`"] = 2 //身份证是否长期有效(1:是;2:否)
|
|
// g.WorkingCouple(info, false)
|
|
}
|
|
editCont["`mobileShortNumber`"] = info[29]
|
|
editCont["`channel`"] = JoinJobChanel(info[293])
|
|
editCont["`bloodType`"] = info[20]
|
|
editCont["`time`"] = time.Now().Unix()
|
|
myInfo.EiteCont(map[string]interface{}{"`key`": g.UserKey}, editCont)
|
|
}
|
|
}
|
|
|
|
/*
|
|
*
|
|
@ 作者: 秦东
|
|
@ 时间: 2024-01-31 11:21:26
|
|
@ 功能: 退役军人
|
|
@ 参数
|
|
|
|
#info 人员信息
|
|
#isTrue 是否为老兵
|
|
|
|
@ 返回值
|
|
|
|
#
|
|
|
|
@ 方法原型
|
|
|
|
#
|
|
*/
|
|
func (g *GroupParsingData) EditVeterans(info map[int]string, isTrue bool) {
|
|
if info[321] != "" {
|
|
var veteransInfo models.Veterans
|
|
err := veteransInfo.GetCont(map[string]interface{}{"`userkey`": g.UserKey})
|
|
// fmt.Printf("退役军人:%v\n%v\n", err, veteransInfo)
|
|
if err != nil {
|
|
|
|
veteransInfo.Userkey = g.UserKey //gned;not null;comment:员工唯一识别符;"`
|
|
if isTrue {
|
|
veteransInfo.IsRetire = 1 //5是否为退役军人(1:是;2:否)"`
|
|
} else {
|
|
veteransInfo.IsRetire = 2 //5是否为退役军人(1:是;2:否)"`
|
|
}
|
|
|
|
veteransInfo.RetireNumber = info[321] //mment:退役证编号"`
|
|
if info[322] != "" {
|
|
veteransInfo.JoinTime = overallhandle.ExcelDateToDate(info[322]).Unix() //ult:入伍时间"`
|
|
}
|
|
if info[323] != "" {
|
|
veteransInfo.RetireTime = overallhandle.ExcelDateToDate(info[323]).Unix() //default:退伍时间"`
|
|
}
|
|
veteransInfo.ArmyUnits = info[325] //参军单位"`
|
|
veteransInfo.TypesOfSoldiers = info[326] //5) ;comment:兵种"`
|
|
veteransInfo.Time = time.Now().Unix() //t null;comment:创建时间"`
|
|
overall.CONSTANT_DB_HR.Create(&veteransInfo)
|
|
|
|
} else {
|
|
editCont := overallhandle.MapOut()
|
|
if isTrue {
|
|
editCont["isRetire"] = 1
|
|
} else {
|
|
editCont["isRetire"] = 2
|
|
}
|
|
editCont["retireNumber"] = info[312]
|
|
if info[322] != "" {
|
|
editCont["joinTime"] = overallhandle.ExcelDateToDate(info[322]).Unix() //ult:入伍时间"`
|
|
}
|
|
if info[323] != "" {
|
|
editCont["retireTime"] = overallhandle.ExcelDateToDate(info[323]).Unix() //default:退伍时间"`
|
|
}
|
|
editCont["armyUnits"] = info[325]
|
|
editCont["typesOfSoldiers"] = info[326]
|
|
editCont["time"] = time.Now().Unix()
|
|
veteransInfo.EiteCont(map[string]interface{}{"`userkey`": g.UserKey}, editCont)
|
|
}
|
|
}
|
|
}
|
|
|
|
/*
|
|
*
|
|
@ 作者: 秦东
|
|
@ 时间: 2024-01-31 10:03:58
|
|
@ 功能: 政治面貌
|
|
@ 参数
|
|
|
|
#info 表单内容
|
|
|
|
@ 返回值
|
|
|
|
#
|
|
|
|
@ 方法原型
|
|
|
|
#
|
|
*/
|
|
func (g *GroupParsingData) PoliticalOutlookEdit(info map[int]string) {
|
|
defer synPros.Done()
|
|
if info[313] != "" {
|
|
var polOutInfo models.PoliticalIdentity
|
|
err := polOutInfo.GetCont(map[string]interface{}{"`userkey`": g.UserKey})
|
|
if err != nil { //不存在,新增
|
|
// if info[315] != "" || info[316] != "" {
|
|
polOutInfo.Userkey = g.UserKey //员工唯一识别符;"`
|
|
polOutInfo.PoliticalOutlook = politiToInt(info[313]) //政治面貌(1:群众;2:无党派;3:台盟会员;4:九三社员;5:致公党员;6:农工党员;7:民进会员;8:民建会员;9:民盟盟员;10:民革会员,11:共青团员;12:预备党员;13:中共党员)"`
|
|
if info[314] != "" {
|
|
polOutInfo.JoinTime = overallhandle.ExcelDateToDate(info[314]).Unix() //加入时间"`
|
|
}
|
|
polOutInfo.Branch = info[315] //所在党支部"`
|
|
polOutInfo.Bosition = info[316] //党内职务"`
|
|
polOutInfo.JoiningParty = info[317] //入党时所在单位"`
|
|
if info[318] == "是" {
|
|
polOutInfo.SwitchToClass = 1 //组织关系是否转入(1:是;2:否)"`
|
|
} else {
|
|
polOutInfo.SwitchToClass = 2 //组织关系是否转入(1:是;2:否)"`
|
|
}
|
|
if info[319] != "" {
|
|
polOutInfo.SwitchToTime = overallhandle.ExcelDateToDate(info[319]).Unix() //组织关系转入时间"`
|
|
}
|
|
polOutInfo.Time = time.Now().Unix() //创建时间"`
|
|
overall.CONSTANT_DB_HR.Create(&polOutInfo)
|
|
// }
|
|
} else {
|
|
editCont := overallhandle.MapOut()
|
|
if info[313] != "" {
|
|
poloutName := politiToInt(info[313])
|
|
if poloutName != polOutInfo.PoliticalOutlook {
|
|
editCont["`political_outlook`"] = poloutName
|
|
}
|
|
}
|
|
if info[314] != "" {
|
|
joinTimeVal := overallhandle.ExcelDateToDate(info[314]).Unix()
|
|
if joinTimeVal != polOutInfo.JoinTime {
|
|
editCont["`joinTime`"] = joinTimeVal
|
|
}
|
|
}
|
|
if info[315] != "" && info[315] != polOutInfo.Branch {
|
|
editCont["`branch`"] = info[315]
|
|
}
|
|
if info[316] != "" && info[316] != polOutInfo.Bosition {
|
|
editCont["`position`"] = info[316]
|
|
}
|
|
if info[317] != "" && info[317] != polOutInfo.JoiningParty {
|
|
editCont["`joiningParty`"] = info[317]
|
|
}
|
|
zhuan := 2
|
|
if info[318] == "是" {
|
|
zhuan = 1
|
|
}
|
|
if zhuan != polOutInfo.SwitchToClass {
|
|
editCont["`switchToClass`"] = zhuan
|
|
}
|
|
if info[319] != "" {
|
|
switchTimeVal := overallhandle.ExcelDateToDate(info[319]).Unix()
|
|
if switchTimeVal != polOutInfo.SwitchToTime {
|
|
editCont["`switchToTime`"] = switchTimeVal
|
|
}
|
|
}
|
|
if len(editCont) > 0 {
|
|
editCont["`time`"] = time.Now().Unix()
|
|
polOutInfo.EiteCont(map[string]interface{}{"`userkey`": g.UserKey}, editCont)
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
/*
|
|
*
|
|
@ 作者: 秦东
|
|
@ 时间: 2024-01-31 08:18:15
|
|
@ 功能: 双职工处理
|
|
@ 参数
|
|
|
|
#info 表单内容
|
|
#isTrue 是否为双职工
|
|
|
|
@ 返回值
|
|
|
|
#
|
|
|
|
@ 方法原型
|
|
|
|
#
|
|
*/
|
|
func (g *GroupParsingData) WorkingCouple(info map[int]string, isTrue bool) {
|
|
var doubleWorkMan []models.DoubleWorker
|
|
err := overall.CONSTANT_DB_HR.Where("`key` = ?", g.UserKey).Find(&doubleWorkMan).Error //获取旧数据
|
|
if isTrue { //是双职工
|
|
if err != nil || len(doubleWorkMan) < 1 { //无记录,新增
|
|
NewAddDoubleWork(g.UserKey, g.UserNum, info)
|
|
} else {
|
|
var oldId int64
|
|
oldId = 0
|
|
//判断是否已经有存在得记录
|
|
for _, v := range doubleWorkMan {
|
|
if v.Name == info[84] {
|
|
oldId = v.Id
|
|
break
|
|
}
|
|
}
|
|
if oldId != 0 { //存在,数据编辑
|
|
editInfo := overallhandle.MapOut()
|
|
editInfo["`name`"] = info[84]
|
|
editInfo["`company`"] = info[85]
|
|
editInfo["`department`"] = info[86]
|
|
editInfo["`position`"] = info[88]
|
|
editInfo["`workPosit`"] = info[88]
|
|
editInfo["`workUnit`"] = info[87]
|
|
editInfo["`levele`"] = info[89]
|
|
if info[90] != "" {
|
|
editInfo["`joinTime`"] = overallhandle.ExcelDateToDate(info[90]).Unix()
|
|
}
|
|
|
|
editInfo["`tel`"] = info[91]
|
|
editInfo["`time`"] = time.Now().Unix()
|
|
editInfo["`state`"] = 1
|
|
var editCont models.DoubleWorker
|
|
editCont.EiteCont(map[string]interface{}{"`id`": oldId}, editInfo)
|
|
} else { //无记录,新增
|
|
NewAddDoubleWork(g.UserKey, g.UserNum, info)
|
|
}
|
|
}
|
|
} else { //不是双职工,软删除老数据
|
|
if len(doubleWorkMan) > 0 {
|
|
var delDoubleWork models.DoubleWorker
|
|
delDoubleWork.EiteCont(map[string]interface{}{"`key`": g.UserKey}, map[string]interface{}{"`state`": 3})
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
// 新增双职工
|
|
func NewAddDoubleWork(userKey int64, userNum string, info map[int]string) {
|
|
var inSetInfo models.DoubleWorker
|
|
inSetInfo.Key = userKey //
|
|
inSetInfo.Number = userNum //"`
|
|
inSetInfo.Name = info[84] //姓名"`
|
|
inSetInfo.Company = info[85] //所在公司"`
|
|
inSetInfo.Department = info[86] //所在部门"`
|
|
inSetInfo.Position = info[88] //所在岗位"`
|
|
inSetInfo.WorkUnit = info[87]
|
|
inSetInfo.WorkPosit = info[88]
|
|
|
|
inSetInfo.Levele = info[89]
|
|
if info[90] != "" {
|
|
inSetInfo.JoinTime = overallhandle.ExcelDateToDate(info[90]).Unix()
|
|
}
|
|
inSetInfo.Tel = info[91] //联系方式"`
|
|
inSetInfo.Time = time.Now().Unix() //创建时间"`
|
|
inSetInfo.State = 1 //状态(1:启用;2:禁用;3:删除)`
|
|
overall.CONSTANT_DB_HR.Create(&inSetInfo)
|
|
}
|
|
|
|
/*
|
|
*
|
|
@ 作者: 秦东
|
|
@ 时间: 2024-01-30 13:51:25
|
|
@ 功能: 计算本集团下得行政组织
|
|
@ 参数
|
|
|
|
#orgName 行政组织名称
|
|
#orgAllId 本组织下得所有行政部门
|
|
|
|
@ 返回值
|
|
|
|
#
|
|
|
|
@ 方法原型
|
|
|
|
#
|
|
*/
|
|
func GetMyOrgSunId(orgName string, orgAllId []int64) (orgId int64) {
|
|
// fmt.Printf("所有子级-GetMyOrgSunId-->%v\n", orgAllId)
|
|
var orgInfo models.AdministrativeOrganization
|
|
// err := orgInfo.GetCont(map[string]interface{}{"`name`": orgName}, "`id`")
|
|
err := overall.CONSTANT_DB_HR.Model(&models.AdministrativeOrganization{}).Where("`name` LIKE ? AND `id` IN ?", orgName, orgAllId).Find(&orgInfo).Error
|
|
if err != nil {
|
|
return
|
|
}
|
|
// if overallhandle.IsInTrue[int64](orgInfo.Id, orgAllId) {
|
|
// orgId = orgInfo.Id
|
|
// }
|
|
orgId = orgInfo.Id
|
|
return
|
|
}
|
|
|
|
/*
|
|
*
|
|
@ 作者: 秦东
|
|
@ 时间: 2024-01-30 13:57:08
|
|
@ 功能: 根据名称获取位
|
|
@ 参数
|
|
|
|
#name 职位名称
|
|
#orgId 归属行政组织
|
|
|
|
@ 返回值
|
|
|
|
#posistId 职位ID
|
|
#dutiesId 职务ID
|
|
#isTrue 是否为本行政组织得负责人
|
|
|
|
@ 方法原型
|
|
|
|
#func GetMyPositisName(name string,orgId int64)(posistId,dutiesId int64,isTrue int)
|
|
*/
|
|
func GetMyPositisName(name string, orgId int64) (posistId, dutiesId int64, isTrue int) {
|
|
var sunOrg overallhandle.GetOrgAllParent
|
|
sunOrg.GetOrgSonAllId(orgId)
|
|
sunOrg.Id = append(sunOrg.Id, orgId)
|
|
var posistInfo models.Position
|
|
err := overall.CONSTANT_DB_HR.Model(&models.Position{}).Select("`id`,`person_in_charge`,`duties`").Where("`name` LIKE ? AND `administrative_organization` IN ?", "%"+name+"%", sunOrg.Id).Find(&posistInfo).Error
|
|
// fmt.Printf("职务---》%v---》%v\n", err, posistInfo)
|
|
if err != nil || posistInfo.Id == 0 {
|
|
newPoster := WriteNewPost(name, orgId)
|
|
posistId = newPoster.Id
|
|
dutiesId = newPoster.Duties
|
|
isTrue = newPoster.PersonInCharge
|
|
if newPoster.PersonInCharge == 0 {
|
|
isTrue = 2
|
|
}
|
|
return
|
|
}
|
|
posistId = posistInfo.Id
|
|
dutiesId = posistInfo.Duties
|
|
isTrue = posistInfo.PersonInCharge
|
|
if posistInfo.PersonInCharge == 0 {
|
|
isTrue = 2
|
|
}
|
|
return
|
|
}
|
|
|
|
/*
|
|
*
|
|
@ 作者: 秦东
|
|
@ 时间: 2024-10-30 10:21:28
|
|
@ 功能: 写入新的岗位
|
|
@ 参数
|
|
|
|
#
|
|
|
|
@ 返回值
|
|
|
|
#
|
|
|
|
@ 方法原型
|
|
|
|
#
|
|
*/
|
|
func WriteNewPost(name string, orgId int64) models.Position {
|
|
|
|
supId, _ := GetFasterPostId(orgId)
|
|
_, _, departmentId, _, _ := overallhandle.GetOrgStructure(orgId)
|
|
var posistInfo models.Position
|
|
posistInfo.Number = overallhandle.StringToPinYin(8, name, "", "") //职位编码"`
|
|
posistInfo.Name = name //职位名称"`
|
|
posistInfo.Duties = GetDuties(departmentId) //职务"`
|
|
posistInfo.Time = time.Now().Unix() //创建时间"`
|
|
posistInfo.State = 1 //状态(1:启用;2:禁用;3:删除)"`
|
|
posistInfo.AdministrativeOrganization = orgId //归属行政组织"`
|
|
posistInfo.Superior = supId //上级ID"`
|
|
posistInfo.PersonInCharge = 2 //是否为本部门负责人(1:是;2:否)"`
|
|
posistInfo.Department = departmentId //部门"`
|
|
posistInfo.MenuPermit = "" //菜单许可证"`
|
|
posistInfo.ButtonPermit = "" //按钮许可"`
|
|
posistInfo.School = 0 //部门"`
|
|
posistInfo.KingdeeId = "" //金蝶对照ID"`
|
|
posistInfo.OrgList = "" //
|
|
posistInfo.UnifyId = 0 //统一名称"`
|
|
overall.CONSTANT_DB_HR.Create(&posistInfo)
|
|
return posistInfo
|
|
}
|
|
|
|
/*
|
|
*
|
|
@ 作者: 秦东
|
|
@ 时间: 2024-10-30 13:19:35
|
|
@ 功能: 获取职务
|
|
*/
|
|
func GetDuties(departId int64) (dutisId int64) {
|
|
dutisId = 3
|
|
var dutisIdAry []int64
|
|
overall.CONSTANT_DB_HR.Model(&models.Position{}).Select("`duties`").Where(" `department` = ?", departId).Find(&dutisIdAry)
|
|
if len(dutisIdAry) > 0 {
|
|
var dutAry []models.Duties
|
|
overall.CONSTANT_DB_HR.Model(&models.Duties{}).Select("`id`,`weight`").Where(" `id` IN ?", dutisIdAry).Order("`id` DESC").Find(&dutAry)
|
|
if len(dutAry) > 0 {
|
|
sort.Slice(dutAry, func(i, j int) bool {
|
|
return dutAry[i].Weight < dutAry[j].Weight
|
|
})
|
|
dutisId = dutAry[0].Id
|
|
}
|
|
|
|
}
|
|
return dutisId
|
|
}
|
|
|
|
/*
|
|
*
|
|
@ 作者: 秦东
|
|
@ 时间: 2024-10-29 16:00:05
|
|
@ 功能: 获取上级职务
|
|
@ 参数
|
|
|
|
#
|
|
|
|
@ 返回值
|
|
|
|
#
|
|
|
|
@ 方法原型
|
|
|
|
#
|
|
*/
|
|
func GetFasterPostId(orgId int64) (isSuperiorId, dutiesId int64) {
|
|
//查询平级职务
|
|
var pingJiPost []models.Position
|
|
overall.CONSTANT_DB_HR.Model(&models.Position{}).Select("`id`,`superior`,`person_in_charge`,`duties`").Where("`state` = 1 AND `administrative_organization` = ?", orgId).Find(&pingJiPost)
|
|
if len(pingJiPost) < 1 {
|
|
//获取上级行政组织
|
|
var superiorId int64
|
|
err := overall.CONSTANT_DB_HR.Model(&models.AdministrativeOrganization{}).Select("`superior`").Where("`id` = ?", orgId).First(&superiorId).Error
|
|
if err != nil {
|
|
superiorId = 313
|
|
}
|
|
GetFasterPostId(superiorId)
|
|
}
|
|
isTrue := true
|
|
var allPostList []PositionlrInfo
|
|
for _, v := range pingJiPost {
|
|
if v.PersonInCharge == 1 {
|
|
isTrue = false
|
|
isSuperiorId = v.Id
|
|
}
|
|
var postCont PositionlrInfo
|
|
postCont.Id = v.Id
|
|
var dutisInfor models.Duties
|
|
dutisInfor.GetCont(map[string]interface{}{"`id`": v.Duties}, "`weight`")
|
|
postCont.DutId = v.Duties
|
|
postCont.Weight = dutisInfor.Weight
|
|
allPostList = append(allPostList, postCont)
|
|
}
|
|
if isTrue {
|
|
if len(allPostList) > 0 {
|
|
sort.Slice(allPostList, func(i, j int) bool {
|
|
return allPostList[i].Weight < allPostList[j].Weight
|
|
})
|
|
isSuperiorId = allPostList[0].Id
|
|
}
|
|
}
|
|
return
|
|
}
|
|
|