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.
701 lines
22 KiB
701 lines
22 KiB
package shiyan
|
|
|
|
import (
|
|
"fmt"
|
|
"hr_server/api/jindie_docking/dockingorganization"
|
|
"hr_server/api/version1/personnelapi"
|
|
"hr_server/api/version1/workWechat"
|
|
"hr_server/grocerystore"
|
|
"hr_server/models"
|
|
"hr_server/overall"
|
|
"hr_server/overall/overallhandle"
|
|
"strconv"
|
|
"time"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
// "github.com/golang-migrate/migrate/v4/database/snowflake"
|
|
)
|
|
|
|
func (s *ShiYan) ShiyanCont(c *gin.Context) {
|
|
// var requestData Jieshou
|
|
// c.ShouldBindJSON(&requestData)
|
|
// if requestData.Time == "" {
|
|
// requestData.Time = overallhandle.UnixTimeToDay(time.Now().Unix(), 11)
|
|
// }
|
|
// entryData, _ := overallhandle.DateToTimeStamp(fmt.Sprintf("%v 00:00:00", requestData.Time))
|
|
// planformalData := overallhandle.GetFutureMonthTime(entryData, requestData.ProbationPeriod, 2)
|
|
|
|
// timeStr := overallhandle.UnixTimeToDay(planformalData, 11)
|
|
number := overallhandle.TableNumber()
|
|
out := overallhandle.MapOut()
|
|
out["time"] = number
|
|
fmt.Printf("Number ----->%v\n", number)
|
|
// out["time"] = requestData.Time
|
|
// out["entryData"] = entryData
|
|
// out["timeStr"] = timeStr
|
|
|
|
var eitePersonnel models.Personnel
|
|
eiteCont := overallhandle.MapOut()
|
|
eiteCont["role"] = 58
|
|
eiteCont["eite_time"] = time.Now().Unix()
|
|
eiteErr := eitePersonnel.EiteCont("`role` = ''", eiteCont)
|
|
overallhandle.Result(0, eiteErr, c)
|
|
}
|
|
|
|
// 人员迁移
|
|
func (s *ShiYan) PersonnelMigration(c *gin.Context) {
|
|
var oldManCount int64
|
|
err := overall.CONSTANT_DB_Master.Model(&models.WorkMan{}).Where("wm_group = 3").Pluck("COALESCE(COUNT(wm_id), 0) as countid", &oldManCount).Error
|
|
if err != nil {
|
|
overallhandle.Result(1, err, c, "没有要迁移的人员!")
|
|
return
|
|
}
|
|
//分片
|
|
var pian int64 = 0
|
|
pian = oldManCount / 100
|
|
if oldManCount%100 > 0 {
|
|
pian++
|
|
}
|
|
var writePeople peopleQianyi
|
|
for i := 1; int64(i) <= pian+1; i++ {
|
|
synPro.Add(1)
|
|
go writePeople.writeUser(i, 100)
|
|
// if i > 1 {
|
|
// break
|
|
// }
|
|
}
|
|
synPro.Wait()
|
|
|
|
readDataMap, allUser := writePeople.readMyDayData()
|
|
outMap := overallhandle.MapOut()
|
|
outMap["count"] = len(readDataMap)
|
|
outMap["list"] = readDataMap
|
|
outMap["allUser"] = allUser
|
|
overallhandle.Result(0, outMap, c)
|
|
}
|
|
|
|
// 分片写入人员
|
|
func (p *peopleQianyi) writeUser(page, pagesize int) {
|
|
// p.mutext.Lock()
|
|
// defer p.mutext.Unlock()
|
|
|
|
offsetVal := overallhandle.LimitPage(page, pagesize)
|
|
var oldUser []models.PersonalDetails
|
|
err := overall.CONSTANT_DB_Master.Model(&models.WorkMan{}).Select("worker_man.*,wmd.*").Joins("left join worker_man_data as wmd on wmd.wmd_key = worker_man.wm_key").Where("wm_group = 3").Limit(pagesize).Offset(offsetVal).Find(&oldUser).Error
|
|
if err != nil {
|
|
return
|
|
}
|
|
// jsonVal, _ := json.Marshal(oldUser)
|
|
fmt.Printf("page=======>%v=====>%v\n", page, offsetVal)
|
|
//员工主表
|
|
var staffAry []models.Personnel //主资料库
|
|
var staffAttributeAry []models.PersonnelContent //人物属性库
|
|
for _, v := range oldUser {
|
|
if len(v.Number) > 4 {
|
|
company, adminOrg, positionId, deparment := getUserOrgSchool(v.Group, v.DepartmentId, v.WorkshopId, v.PostId)
|
|
var staffInfo models.Personnel
|
|
staffInfo.Number = v.Number //员工工号
|
|
staffInfo.Name = v.Name //姓名
|
|
staffInfo.HireClass = 1 //雇佣类型(1:雇佣入职;2:再入职;)
|
|
staffInfo.Position = positionId //职位
|
|
// //获取职务信息
|
|
jobCont, jobErr := getJobInfo(positionId)
|
|
if jobErr == nil {
|
|
staffInfo.PositionLevel = jobCont.Dutid //职位等级
|
|
staffInfo.JobClass = jobCont.Jobid //职务分类
|
|
}
|
|
staffInfo.AdminOrg = adminOrg //所属行政组织
|
|
staffInfo.Company = company //入职公司
|
|
staffInfo.EmpType = 4 //用工关系(1:实习生;2:待分配;3:试用员工;4:正式员工;5:停薪留职;6:退休;7:辞退;8:离职)
|
|
staffInfo.Deparment = deparment //部门
|
|
staffInfo.Time = time.Now().Unix()
|
|
staffInfo.EiteTime = time.Now().Unix()
|
|
// staffInfo.PositionGrade = v.PositionGrade //入职职等
|
|
staffInfo.Icon = v.Icon //头像
|
|
|
|
// staffInfo.Password = v.Password
|
|
|
|
staffInfo.Wechat = v.WechatId
|
|
staffInfo.WorkWechat = v.WorkWechatId
|
|
|
|
weChatOpenId := v.WechatId
|
|
if v.WorkWechatId != "" {
|
|
weChatOpenId = v.WorkWechatId
|
|
}
|
|
//获取微信头像
|
|
wechatCont, _ := GetWorkWechatDuiZhao(weChatOpenId)
|
|
staffInfo.Icon = wechatCont.Avatar //头像
|
|
|
|
staffInfo.Password = v.Password //密码
|
|
staffInfo.State = v.State
|
|
staffInfo.Key = v.Key
|
|
staffAry = append(staffAry, staffInfo)
|
|
|
|
var staffAttribute models.PersonnelContent
|
|
staffAttribute.Number = v.Number
|
|
staffAttribute.Idcardno = v.CertificatesNum
|
|
staffAttribute.Mobilephone = v.Tel
|
|
staffAttribute.Gender = v.Gender
|
|
staffAttribute.Birthday = v.Birthday
|
|
// staffAttribute.Myfolk = contData.Nation
|
|
// staffAttribute.Nativeplace = contData.NativePlace
|
|
staffAttribute.Health = 1
|
|
staffAttribute.Maritalstatus = 1
|
|
staffAttribute.Currentresidence = v.Addrest
|
|
staffAttribute.Time = time.Now().Unix()
|
|
staffAttribute.Constellation = 1
|
|
staffAttribute.Isdoubleworker = 2
|
|
staffAttribute.Isveterans = 2
|
|
// staffAttribute.Veteransnumber = contData.Veteransnumber
|
|
staffAttribute.Jobstartdate = time.Now().Unix()
|
|
staffAttribute.Entrydate = v.EntryTime
|
|
staffAttribute.Probationperiod = 3
|
|
staffAttribute.Planformaldate = time.Now().Unix()
|
|
staffAttribute.PoliticalOutlook = 1
|
|
|
|
staffAttributeAry = append(staffAttributeAry, staffAttribute)
|
|
}
|
|
|
|
// p.dataMap = append(p.dataMap, staffInfo)
|
|
// p.userAll = append(p.userAll, staffAttribute)
|
|
// break
|
|
}
|
|
if len(staffAry) > 0 {
|
|
addErrMaster := overall.CONSTANT_DB_HR.Model(&models.Personnel{}).Create(&staffAry).Error
|
|
if addErrMaster == nil {
|
|
if len(staffAttributeAry) > 0 {
|
|
overall.CONSTANT_DB_HR.Model(&models.PersonnelContent{}).Create(&staffAttributeAry)
|
|
}
|
|
}
|
|
}
|
|
// fmt.Printf("%v\n", staffAry)
|
|
synPro.Done()
|
|
}
|
|
|
|
// 获取企业微信对照表
|
|
func GetWorkWechatDuiZhao(openid string) (userInfoStruct models.WechatUsers, isTrue bool) {
|
|
isTrue = false
|
|
myErr := overall.CONSTANT_DB_Wechat.Where("userid = ?", openid).First(&userInfoStruct).Error
|
|
if myErr == nil {
|
|
isTrue = true
|
|
}
|
|
return
|
|
}
|
|
|
|
// 获取人员组织架构信息
|
|
func getUserOrgSchool(group, depart, workid, position int64) (gro, org, positionId int64, department string) {
|
|
groupAry := map[int64]int64{3: 2}
|
|
for gi, gv := range groupAry {
|
|
if gi == group {
|
|
gro = gv
|
|
break
|
|
}
|
|
}
|
|
//部门对照
|
|
//部门
|
|
var buMen string
|
|
// departAry := map[int64]string{
|
|
// 11: "3",
|
|
// 12: "4",
|
|
// 9: "5",
|
|
// 14: "6",
|
|
// 13: "7",
|
|
// 15: "8",
|
|
// 5: "9",
|
|
// 6: "10",
|
|
// 8: "11",
|
|
// 2: "13",
|
|
// 1: "14",
|
|
// 3: "15",
|
|
// 16: "16",
|
|
// 17: "17",
|
|
// 39: "19",
|
|
// 50: "20",
|
|
// 7: "12,41",
|
|
// 4: "12,42",
|
|
// }
|
|
departAry := map[int64]string{
|
|
11: "3",
|
|
12: "4",
|
|
9: "5",
|
|
14: "6",
|
|
13: "7",
|
|
15: "8",
|
|
5: "9",
|
|
6: "10",
|
|
8: "11",
|
|
2: "13",
|
|
1: "14",
|
|
3: "15",
|
|
16: "16",
|
|
17: "17",
|
|
39: "19",
|
|
50: "20",
|
|
7: "41",
|
|
4: "42",
|
|
}
|
|
for di, dv := range departAry {
|
|
if depart == di {
|
|
buMen = dv
|
|
break
|
|
}
|
|
}
|
|
_, org = getOrgSchool(workid)
|
|
// departId, org := getOrgSchool(workid)
|
|
// if departId != 0 {
|
|
// buMen = fmt.Sprintf("%v,%v", buMen, departId)
|
|
// }
|
|
department = buMen
|
|
|
|
positionId = getHrPosition(position)
|
|
return
|
|
}
|
|
|
|
// 获取组织架构对照
|
|
func getOrgSchool(id int64) (deparmentId, orgId int64) {
|
|
var orgInfo outOrgCont
|
|
err := overall.CONSTANT_DB_HR.Model(&models.AdministrativeOrganization{}).Select("id,organization_type,superior").Where("schoole = ?", id).First(&orgInfo).Error
|
|
if err != nil {
|
|
deparmentId = 0
|
|
orgId = 0
|
|
return
|
|
}
|
|
if orgInfo.OrganizationType == 5 {
|
|
var suoOrgInfo models.AdministrativeOrganization
|
|
whereAry := overallhandle.MapOut()
|
|
whereAry["id"] = orgInfo.Superior
|
|
supErr := suoOrgInfo.GetCont(whereAry)
|
|
if supErr == nil {
|
|
deparmentId = suoOrgInfo.Id
|
|
}
|
|
}
|
|
orgId = orgInfo.Id
|
|
return
|
|
}
|
|
|
|
// 获取hr系统中的职务
|
|
func getHrPosition(posId int64) int64 {
|
|
var id int64
|
|
err := overall.CONSTANT_DB_HR.Model(&models.Position{}).Select("id").Where("`school` = ?", posId).First(&id).Error
|
|
if err == nil {
|
|
return id
|
|
}
|
|
return 0
|
|
}
|
|
|
|
// 获取职务相关属性
|
|
func getJobInfo(jobId int64) (cont jobAttber, err error) {
|
|
var positionInfo models.Position
|
|
// err = overall.CONSTANT_DB_HR.Table(fmt.Sprintf("%s p", positionInfo.TableName())).Select("p.id,p.number,p.name,p.person_in_charge,d.id as dutid,d.name as dutname,d.number as dutnumber,j.id as jobid,j.name as jobname").Joins("left join duties as d on d.id = p.duties").Joins("left join job_class as j on j.id = d.job_type").Where("`p`.`id` = ?", jobId).First(&cont).Error
|
|
err = overall.CONSTANT_DB_HR.Model(&positionInfo).Select("position.id,position.number,position.name,position.person_in_charge,d.id as dutid,d.name as dutname,d.number as dutnumber,j.id as jobid,j.name as jobname").Joins("left join duties as d on d.id = position.duties").Joins("left join job_class as j on j.id = d.job_type").Where("`position`.`id` = ?", jobId).First(&cont).Error
|
|
return
|
|
}
|
|
|
|
// 视图操作
|
|
func (s *ShiYan) Shitu(c *gin.Context) {
|
|
// var shituList []ShituType
|
|
// err := overall.CONSTANT_DB_HR.Limit(20).Offset(21).Find(&shituList)
|
|
// fmt.Printf("%v-----------%v\n", err, shituList)
|
|
var req Sdfg
|
|
c.ShouldBindJSON(&req)
|
|
out := overallhandle.MapOut()
|
|
|
|
// groupId := overallhandle.RecursionOrgLevees(103, req.Id, 4)
|
|
groupId, companyId, departmentId, sunDepartId, workShopId := overallhandle.GetOrgStructure(req.Id)
|
|
// sdee := overallhandle.RecursionOrgLeve(req.Id, 3)
|
|
// // node, err := snowflake.NewWorker(1)
|
|
// // fmt.Printf("node--------->%v\n", err)_, companyId, departmentId, sunDepartId, _ := overallhandle.GetOrgStructure(orgMainDepart.Id)
|
|
|
|
// // out["node"] = node.GetId()
|
|
// // out["err "] = err
|
|
out["groupId "] = groupId
|
|
out["companyId "] = companyId
|
|
out["departmentId "] = departmentId
|
|
out["sunDepartId "] = sunDepartId
|
|
out["workShopId "] = workShopId
|
|
// out["sdee "] = sdee
|
|
|
|
overallhandle.Result(0, out, c)
|
|
}
|
|
|
|
// 人员状态数据对正
|
|
func (s *ShiYan) PeopleStatus(c *gin.Context) {
|
|
var manList []models.PersonArchives
|
|
err := overall.CONSTANT_DB_HR.Model(&manList).Select("`id`,`emp_type_name`").Find(&manList).Error
|
|
if err != nil {
|
|
return
|
|
}
|
|
for _, v := range manList {
|
|
stateInt := personnelapi.EmptypeToInt(v.EmpTypeName)
|
|
var eidtMan models.PersonArchives
|
|
eidtMan.EiteCont(map[string]interface{}{"id": v.Id}, map[string]interface{}{"emp_type": stateInt})
|
|
}
|
|
overallhandle.Result(0, err, c)
|
|
}
|
|
|
|
/*
|
|
*
|
|
@ 作者: 秦东
|
|
@ 时间: 2023-02-22 11:34:18
|
|
@ 功能: 手动同步行政组织类型
|
|
@ 参数
|
|
|
|
#
|
|
|
|
@ 返回值
|
|
|
|
#
|
|
|
|
@ 方法原型
|
|
|
|
#
|
|
*/
|
|
func (s *ShiYan) HandMovementType(c *gin.Context) {
|
|
dockingorganization.GetOrgType()
|
|
}
|
|
|
|
/*
|
|
*
|
|
@ 作者: 秦东
|
|
@ 时间: 2023-02-22 11:37:00
|
|
@ 功能: 手动同步职务类型
|
|
@ 参数
|
|
|
|
#
|
|
|
|
@ 返回值
|
|
|
|
#
|
|
|
|
@ 方法原型
|
|
|
|
#
|
|
*/
|
|
func (s *ShiYan) HandMovementJobType(c *gin.Context) {
|
|
dockingorganization.JobClass()
|
|
}
|
|
|
|
/*
|
|
*
|
|
@ 作者: 秦东
|
|
@ 时间: 2023-02-22 11:38:08
|
|
@ 功能: 手动同步职务
|
|
@ 参数
|
|
|
|
#
|
|
|
|
@ 返回值
|
|
|
|
#
|
|
|
|
@ 方法原型
|
|
|
|
#
|
|
*/
|
|
func (s *ShiYan) HandMovementJob(c *gin.Context) {
|
|
dockingorganization.DutiesContrast()
|
|
}
|
|
|
|
/*
|
|
*
|
|
@ 作者: 秦东
|
|
@ 时间: 2023-02-22 11:39:28
|
|
@ 功能: 手动同步行政组织
|
|
@ 参数
|
|
|
|
#
|
|
|
|
@ 返回值
|
|
|
|
#
|
|
|
|
@ 方法原型
|
|
|
|
#
|
|
*/
|
|
func (s *ShiYan) HandMovementOrgCont(c *gin.Context) {
|
|
dockingorganization.OrgAdmin()
|
|
}
|
|
|
|
/*
|
|
*
|
|
@ 作者: 秦东
|
|
@ 时间: 2023-02-22 11:39:28
|
|
@ 功能: 手动同步职位
|
|
@ 参数
|
|
|
|
#
|
|
|
|
@ 返回值
|
|
|
|
#
|
|
|
|
@ 方法原型
|
|
|
|
#
|
|
*/
|
|
func (s *ShiYan) HandMovementPostCont(c *gin.Context) {
|
|
dockingorganization.Position()
|
|
}
|
|
|
|
// 写入令牌
|
|
func (a *ShiYan) WriteToken(c *gin.Context) {
|
|
var requestData WriteIderCont
|
|
err := c.ShouldBindJSON(&requestData)
|
|
fmt.Printf("err--->%v\n", err)
|
|
if err != nil {
|
|
overallhandle.Result(100, err, c)
|
|
return
|
|
}
|
|
fmt.Printf("requestData--->%v--->%v--->%v\n", requestData.Openid, requestData.Key, requestData.Token)
|
|
if requestData.Key == "" || requestData.Token == "" {
|
|
overallhandle.Result(101, err, c)
|
|
return
|
|
}
|
|
fmt.Printf("UserInfo--->%v--->%v--->%v\n", requestData.UserInfo.Number, requestData.UserInfo.Password, requestData.UserInfo.Key)
|
|
if requestData.UserInfo.Number == "" || requestData.UserInfo.Password == "" || requestData.UserInfo.Key == "" {
|
|
overallhandle.Result(101, err, c)
|
|
return
|
|
}
|
|
var userCont models.ManCont
|
|
err = userCont.GetCont(map[string]interface{}{"`number`": requestData.UserInfo.Number, "`key`": requestData.UserInfo.Key, "`password`": requestData.UserInfo.Password})
|
|
fmt.Printf("err--1->%v\n", err)
|
|
if err != nil {
|
|
overallhandle.Result(105, err, c)
|
|
return
|
|
}
|
|
// if requestData.Openid != userCont.Wechat && requestData.Openid != userCont.WorkWechat {
|
|
// fmt.Printf("err--2->%v\n", err)
|
|
// overallhandle.Result(105, err, c)
|
|
// return
|
|
// }
|
|
|
|
// _, pointId, operation, _ := overallhandle.GetNewAccredit("cangchu", userCont.Role, userCont.Key, userCont.AdminOrg, userCont.Position)
|
|
|
|
saveData := overallhandle.MapOut()
|
|
saveData["key"] = requestData.Key
|
|
saveData["token"] = requestData.Token
|
|
saveData["userinfo"] = userCont
|
|
writeRedisData := map[string]interface{}{
|
|
"userkey": requestData.Key,
|
|
"key": userCont.Key,
|
|
"usernumber": userCont.Number,
|
|
"userpwd": userCont.Password,
|
|
"usertoken": requestData.Token,
|
|
"jurisdiction": "",
|
|
"menuOper": "",
|
|
"wand": 118,
|
|
}
|
|
// var surisdictionStr []string
|
|
// var surisdictionInt []int64
|
|
// jsonErr := json.Unmarshal([]byte(operation), &surisdictionStr)
|
|
// if jsonErr == nil {
|
|
// for _, jurVal := range surisdictionStr {
|
|
// jurValInt, jurValErr := strconv.ParseInt(jurVal, 10, 64)
|
|
// if jurValErr == nil {
|
|
// surisdictionInt = append(surisdictionInt, jurValInt)
|
|
// }
|
|
|
|
// }
|
|
// }
|
|
// var menuOperStr []string
|
|
// var menuOperInts []int64
|
|
// menuOperStr = strings.Split(pointId, ",")
|
|
// for _, menuOperVal := range menuOperStr {
|
|
// menuOperInt, menuOperErr := strconv.ParseInt(menuOperVal, 10, 64)
|
|
// if menuOperErr == nil {
|
|
// menuOperInts = append(menuOperInts, menuOperInt)
|
|
// }
|
|
|
|
// }
|
|
// redisFileKey := "ScanCode:Authentication:LoginApi_" + global.GVA_CONFIG.RedisPrefix.Alias + "_" + userKeyCode
|
|
redisFileKey := fmt.Sprintf("ScanCode:Authentication:LoginApi_%v_%v", overall.CONSTANT_CONFIG.RedisPrefixStr.Alias, requestData.Key)
|
|
redisClient := grocerystore.RunRedis(overall.CONSTANT_REDIS5)
|
|
redisClient.SetRedisTime(10800)
|
|
redisClient.HashMsetAdd(redisFileKey, writeRedisData)
|
|
|
|
//缓存写入个人信息
|
|
redisMyContKey := fmt.Sprintf("ScanCode:Authentication:UserCont_%v_%v", overall.CONSTANT_CONFIG.RedisPrefixStr.Alias, userCont.Number)
|
|
myCont := overallhandle.MapOut()
|
|
myCont["id"] = userCont.Id
|
|
myCont["number"] = userCont.Number //员工工号
|
|
myCont["name"] = userCont.Name //姓名
|
|
myCont["icon"] = userCont.Icon //头像
|
|
myCont["hireclass"] = userCont.HireClass //雇佣类型(1:雇佣入职;2:再入职;)
|
|
myCont["emptype"] = userCont.EmpType //用工关系(1:临时工 , 2:编外人员 ;3:实习&实习生;4:试用员工;5:待分配;6:待岗;7:临时调入;8:正式员工;9:长期病假;10:停薪留职;11:退休;12:辞职;13:辞退;14:离职)
|
|
myCont["company"] = userCont.Company //入职公司
|
|
myCont["maindeparment"] = userCont.MainDeparment //主部门
|
|
myCont["sunmaindeparment"] = userCont.SunMainDeparment //二级主部门
|
|
myCont["deparment"] = userCont.Deparment //部门
|
|
myCont["adminorg"] = userCont.AdminOrg //所属行政组织
|
|
myCont["teamid"] = userCont.TeamId //班组
|
|
myCont["position"] = userCont.Position //职位
|
|
myCont["jobclass"] = userCont.JobClass //职务分类
|
|
myCont["jobid"] = userCont.JobId //职务
|
|
myCont["jobleve"] = userCont.JobLeve //职务等级
|
|
myCont["wechat"] = userCont.Wechat //微信UserId
|
|
myCont["workwechat"] = userCont.WorkWechat //企业微信UserId
|
|
myCont["state"] = userCont.State //状态(1:启用;2:禁用;3:删除)
|
|
myCont["key"] = userCont.Key //key
|
|
myCont["isadmin"] = userCont.IsAdmin //是否为管理员(1:不是;2:分公司;3:集团管理员;4:超级管
|
|
myCont["password"] = userCont.Password //密码
|
|
myCont["role"] = userCont.Role //角色
|
|
myCont["idcardno"] = userCont.Idcardno //身份证号
|
|
myCont["passportno"] = userCont.Passportno //护照号码
|
|
myCont["globalroaming"] = userCont.Globalroaming //国际区号
|
|
myCont["mobilephone"] = userCont.Mobilephone //手机号码
|
|
myCont["email"] = userCont.Email //电子邮件
|
|
myCont["gender"] = userCont.Gender //性别(1:男性;2:女性;3:中性)
|
|
myCont["birthday"] = userCont.Birthday //birthday
|
|
myCont["myfolk"] = userCont.Myfolk //民族
|
|
myCont["nativeplace"] = userCont.Nativeplace //籍贯
|
|
myCont["idcardstartdate"] = userCont.Idcardstartdate //身份证有效期开始
|
|
myCont["idcardenddate"] = userCont.Idcardenddate //身份证有效期结束
|
|
myCont["idcardaddress"] = userCont.Idcardaddress //身份证地址
|
|
myCont["idcardIssued"] = userCont.IdcardIssued //身份证签发机关
|
|
myCont["health"] = userCont.Health //健康状况(1:良好;2:一般;3:较弱,4:有生理缺陷;5:残废)
|
|
myCont["maritalstatus"] = userCont.Maritalstatus //婚姻状况(1:未婚;2:已婚;3:丧偶;4:离异)
|
|
myCont["internaltelephone"] = userCont.Internaltelephone //内线电话
|
|
myCont["currentresidence"] = userCont.Currentresidence //现居住地址
|
|
myCont["constellationing"] = userCont.Constellation //星座(1:白羊座;2:金牛座;3:双子座;4:巨蟹座;5:狮子座;6:处女座;7:天枰座;8:天蝎座;9:射手座;10:摩羯座;11:水瓶座;12:双鱼座)
|
|
myCont["isdoubleworker"] = userCont.Isdoubleworker //是否双职工(1:是;2:否)
|
|
myCont["isveterans"] = userCont.Isveterans //是否为退役军人(1:是;2:否)
|
|
myCont["veteransnumber"] = userCont.Veteransnumber //退役证编号
|
|
myCont["jobstartdate"] = userCont.Jobstartdate //参加工作日期
|
|
myCont["entrydate"] = userCont.Entrydate //入职日期
|
|
myCont["probationperiod"] = userCont.Probationperiod //试用期
|
|
myCont["planformaldate"] = userCont.Planformaldate //预计转正日期
|
|
myCont["political_outlook"] = userCont.PoliticalOutlook //政治面貌(1:群众;2:无党派;3:台盟会员;4:九三社员;5:致公党员;6:农工党员;7:民进会员;8:民建会员;9:民盟盟员;10:民革会员,11:共青团员;12:预备党员;13:中共党员)
|
|
|
|
var companyCont models.AdministrativeOrganization
|
|
companyCont.GetCont(map[string]interface{}{"`id`": userCont.Company}, "`name`")
|
|
myCont["companyname"] = companyCont.Name
|
|
var departmentCont models.AdministrativeOrganization
|
|
departmentCont.GetCont(map[string]interface{}{"`id`": userCont.MainDeparment}, "`name`")
|
|
myCont["maindeparmentname"] = departmentCont.Name
|
|
var postInfo models.Position
|
|
postInfo.GetCont(map[string]interface{}{"`id`": userCont.Position}, "`name`")
|
|
myCont["positionname"] = postInfo.Name
|
|
shjd := redisClient.HashMsetAdd(redisMyContKey, myCont)
|
|
|
|
saveData["usercont"] = myCont
|
|
fmt.Printf("redisMyContKey------Login----->%v----->%v\n", redisMyContKey, shjd)
|
|
overallhandle.Result(0, saveData, c)
|
|
}
|
|
|
|
func (s *ShiYan) WorkWechat(c *gin.Context) {
|
|
var requestData overallhandle.ConstId
|
|
err := c.ShouldBindJSON(&requestData)
|
|
fmt.Printf("err--1->%v\n", err)
|
|
if err != nil {
|
|
overallhandle.Result(100, err, c)
|
|
return
|
|
}
|
|
// token := workWechat.GainWechatTokenUnify()
|
|
// // md5Token := "WorkWechatUpdatePeopleInfo"
|
|
// // // errWechat := workWechat.UpdateWechatOrgPeople(51, "txl", md5Token, 1)
|
|
// var orgMap workWechat.WechatOrg
|
|
// orgMap.OrgId = 51
|
|
// orgMap.Token = token
|
|
// // orgList, err := workWechat.GainWechatDepartment(51, "txl", md5Token, 1)
|
|
// orgMap.GainWechatOrgList()
|
|
// if orgMap.NewToekn {
|
|
// token = orgMap.Token
|
|
// }
|
|
// orgMap.GainOrgPeopleList()
|
|
// sendMap := make(map[string]interface{})
|
|
// sendMap["token"] = token
|
|
// sendMap["orgMap"] = orgMap
|
|
// sendMap["jiegou"] = jiegou
|
|
// sendMap["newToken"] = newToken
|
|
|
|
// if err != nil {
|
|
// overallhandle.Result(0, sendMap, c)
|
|
// return
|
|
// }
|
|
//获取行政组织下的人员信息
|
|
// var orgPeople workWechat.WechatOrgPeole
|
|
// for _, v := range orgMap.OrgList {
|
|
// synPro.Add(1)
|
|
// // go GainOrgManAry(int64(v.Id), "txl", md5Token, 1)
|
|
// go orgPeople.GainOrgPeopleList(v)
|
|
// }
|
|
// synPro.Wait()
|
|
// overallhandle.Result(0, sendMap, c)
|
|
idInt, err := strconv.ParseInt(requestData.Id, 10, 64)
|
|
fmt.Printf("err--2->%v\n", err)
|
|
workWechat.NewTimedTasksForOrgWechat(idInt)
|
|
overallhandle.Result(100, err, c)
|
|
}
|
|
|
|
/*
|
|
*
|
|
@ 作者: 秦东
|
|
@ 时间: 2024-07-02 10:57:08
|
|
@ 功能: 获取去行政组织下的人员信息
|
|
@ 参数
|
|
|
|
#
|
|
|
|
@ 返回值
|
|
|
|
#
|
|
|
|
@ 方法原型
|
|
|
|
#
|
|
*/
|
|
func GainOrgManAry(orgId int64, systemApp, key string, isAgain int) {
|
|
defer synPro.Done()
|
|
|
|
}
|
|
|
|
/*
|
|
*
|
|
@ 作者: 秦东
|
|
@ 时间: 2024-10-30 08:34:40
|
|
@ 功能: 测试获取职务
|
|
@ 参数
|
|
|
|
#
|
|
|
|
@ 返回值
|
|
|
|
#
|
|
|
|
@ 方法原型
|
|
|
|
#
|
|
*/
|
|
func (s *ShiYan) GetTestPost(c *gin.Context) {
|
|
postId, _ := personnelapi.GetFasterPostId(12)
|
|
overallhandle.Result(0, postId, c)
|
|
}
|
|
|
|
/*
|
|
*
|
|
@ 作者: 秦东
|
|
@ 时间: 2025-04-02 14:56:52
|
|
@ 功能: 三方校正
|
|
*/
|
|
func (s *ShiYan) SanFang(c *gin.Context) {
|
|
dockingorganization.UserDataCorrection()
|
|
overallhandle.Result(0, "123", c)
|
|
}
|
|
|
|
/*
|
|
*
|
|
@ 作者: 秦东
|
|
@ 时间: 2025-04-17 10:45:10
|
|
@ 功能: 增加角色
|
|
*/
|
|
func (s *ShiYan) AddUserRole(c *gin.Context) {
|
|
var requestData overallhandle.PublicId[string]
|
|
err := c.ShouldBindJSON(&requestData)
|
|
if err != nil {
|
|
overallhandle.Result(100, err, c)
|
|
return
|
|
}
|
|
dockingorganization.AddRolePeople(requestData.Id)
|
|
overallhandle.Result(0, "数据校验完成!", c)
|
|
}
|
|
|