Browse Source

平台人员档案更新

v2_dev
超级管理员 2 years ago
parent
commit
14039fbfc2
  1. 8
      .idea/.gitignore
  2. 9
      .idea/hr_server.iml
  3. 8
      .idea/modules.xml
  4. 6
      .idea/vcs.xml
  5. 79
      api/version1/administrativeorganization/duties.go
  6. 164
      api/version1/administrativeorganization/gov_class.go
  7. 449
      api/version1/administrativeorganization/govcont.go
  8. 126
      api/version1/administrativeorganization/job_class.go
  9. 4
      api/version1/administrativeorganization/orgpost.go
  10. 360
      api/version1/administrativeorganization/position.go
  11. 110
      api/version1/administrativeorganization/type.go
  12. 251
      api/version1/personnelapi/kingdeecont.go
  13. 33
      api/version1/personnelapi/kingdeenew.go
  14. 7
      api/version1/personnelapi/mancont.go
  15. 4
      api/version1/personnelapi/staff.go
  16. 199
      api/version1/personnelapi/staffarchives.go
  17. 34
      api/version1/personnelapi/type.go
  18. 1
      api/version1/personnelapi/types.go
  19. 166
      api/version1/shiyan/shiyan.go
  20. 31
      api/version1/shiyan/type.go
  21. 19
      apirouter/organization/organization_group.go
  22. 3
      apirouter/personnel/people.go
  23. 2
      apirouter/shiyanrouter/shiyan.go
  24. BIN
      hr_server.exe
  25. 71
      models/hrmodels/orgcont.go
  26. 3
      overall/app_constant.go
  27. 119
      overall/overallhandle/overall_handle.go
  28. 5
      overall/overallhandle/type.go

8
.idea/.gitignore

@ -0,0 +1,8 @@
# 默认忽略的文件
/shelf/
/workspace.xml
# 基于编辑器的 HTTP 客户端请求
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

9
.idea/hr_server.iml

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="Go" enabled="true" />
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

8
.idea/modules.xml

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/hr_server.iml" filepath="$PROJECT_DIR$/.idea/hr_server.iml" />
</modules>
</component>
</project>

6
.idea/vcs.xml

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

79
api/version1/administrativeorganization/duties.go

@ -45,10 +45,17 @@ func (o *OrganizationApi) DutiesList(c *gin.Context) {
if totalErr != nil { if totalErr != nil {
total = 0 total = 0
} }
errGorm := gormDb.Order("`weight` ASC").Limit(requestData.PageSize).Offset(overallhandle.LimitPage(requestData.Page, requestData.PageSize)).Find(&dutiesList).Error errGorm := gormDb.Order("`weight` ASC").Order("`id` DESC").Limit(requestData.PageSize).Offset(overallhandle.LimitPage(requestData.Page, requestData.PageSize)).Find(&dutiesList).Error
if errGorm != nil { if errGorm != nil {
overallhandle.Result(105, errGorm, c) overallhandle.Result(105, errGorm, c)
} else { } else {
for i, v := range dutiesList {
if v.State == 1 {
dutiesList[i].Status = true
} else {
dutiesList[i].Status = false
}
}
overallhandle.ResultList(0, requestData.Page, requestData.PageSize, total, int64(len(dutiesList)), dutiesList, c) overallhandle.ResultList(0, requestData.Page, requestData.PageSize, total, int64(len(dutiesList)), dutiesList, c)
} }
} }
@ -157,14 +164,11 @@ func (o *OrganizationApi) EiteDutiesInfo(c *gin.Context) {
overallhandle.Result(100, err, c) overallhandle.Result(100, err, c)
return return
} }
if requestData.Id == 0 && requestData.IdStr == "" { if requestData.Id == 0 {
overallhandle.Result(101, err, c, "职务分类Id不能为空!") overallhandle.Result(101, err, c, "职务分类Id不能为空!")
return return
} }
if requestData.IdStr != "" {
idInt64, _ := strconv.ParseInt(requestData.IdStr, 10, 64)
requestData.Id = idInt64
}
whereData := overallhandle.MapOut() whereData := overallhandle.MapOut()
whereData["id"] = requestData.Id whereData["id"] = requestData.Id
//判断职务是否存在 //判断职务是否存在
@ -259,3 +263,66 @@ func (o *OrganizationApi) EiteDutiesStatOrDel(c *gin.Context) {
} }
} }
} }
/*
*
@ 作者: 秦东
@ 时间: 2023-06-09 09:04:32
@ 功能: 编辑状态或删除职务信息
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func (o *OrganizationApi) EditOrDelDutiesStatus(c *gin.Context) {
var requestData DutiesEditOrDel
err := c.ShouldBindJSON(&requestData)
if err != nil {
overallhandle.Result(100, err, c)
return
}
if len(requestData.Id) < 1 {
overallhandle.Result(101, err, c)
return
}
if requestData.Status == 0 {
requestData.Status = 1
}
if requestData.IsTrue == 0 {
requestData.IsTrue = 2
}
var inUseCont int64
overall.CONSTANT_DB_HR.Model(&models.PersonArchives{}).Select("`id`").Where("`job_id` IN ?", requestData.Id).Count(&inUseCont)
editDutiesInfo := overallhandle.MapOut()
editDutiesInfo["`time`"] = time.Now().Unix()
editDutiesInfo["`state`"] = requestData.Status
if inUseCont > 0 {
err = overall.CONSTANT_DB_HR.Model(&models.Duties{}).Where("`id` IN ?", requestData.Id).Updates(editDutiesInfo).Error
if err != nil {
overallhandle.Result(106, err, c)
return
}
} else {
if requestData.IsTrue == 1 {
err = overall.CONSTANT_DB_HR.Where("`id` IN ?", requestData.Id).Delete(&models.Duties{}).Error
if err != nil {
overallhandle.Result(106, err, c)
return
}
} else {
err = overall.CONSTANT_DB_HR.Model(&models.Duties{}).Where("`id` IN ?", requestData.Id).Updates(editDutiesInfo).Error
if err != nil {
overallhandle.Result(106, err, c)
return
}
}
}
overallhandle.Result(0, err, c)
}

164
api/version1/administrativeorganization/gov_class.go

@ -10,7 +10,56 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
//行政类型 /*
*
@ 作者: 秦东
@ 时间: 2023-06-05 15:26:31
@ 功能: 获取所有行政组织类型
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func (o *OrganizationApi) GovClassAllList(c *gin.Context) {
var requestData overallhandle.NameOverall
c.ShouldBindJSON(&requestData)
var govClassMap []models.AdministrativeOrganizationType
gormDb := overall.CONSTANT_DB_HR.Model(&models.AdministrativeOrganizationType{}).Where("state IN ?", []int{1, 2})
if requestData.Name != "" {
gormDb = gormDb.Where("name LIKE ?", "%"+requestData.Name+"%")
}
err := gormDb.Find(&govClassMap).Error
if err != nil {
overallhandle.Result(107, err, c)
return
}
var sendOrgTypesList []SendOrgTypes
for _, v := range govClassMap {
var sendOrgTypesCont SendOrgTypes
sendOrgTypesCont.Id = v.Id //
sendOrgTypesCont.Name = v.Name //类型名称"`
sendOrgTypesCont.Time = v.Time //创建时间"`
sendOrgTypesCont.State = v.State //状态(1:启用;2:禁用;3:删除)"`
sendOrgTypesCont.Level = v.Level //级别"`
sendOrgTypesCont.KingdeeId = v.KingdeeId //金蝶对照ID"`
if v.State == 1 {
sendOrgTypesCont.Status = true
} else {
sendOrgTypesCont.Status = false
}
sendOrgTypesList = append(sendOrgTypesList, sendOrgTypesCont)
}
overallhandle.Result(0, sendOrgTypesList, c)
}
// 行政类型
func (o *OrganizationApi) GovClassList(c *gin.Context) { func (o *OrganizationApi) GovClassList(c *gin.Context) {
var requestData selectNameOrState var requestData selectNameOrState
c.ShouldBindJSON(&requestData) c.ShouldBindJSON(&requestData)
@ -42,11 +91,27 @@ func (o *OrganizationApi) GovClassList(c *gin.Context) {
if errGorm != nil { if errGorm != nil {
overallhandle.Result(105, errGorm, c) overallhandle.Result(105, errGorm, c)
} else { } else {
overallhandle.ResultList(0, requestData.Page, requestData.PageSize, total, int64(len(govClassMap)), govClassMap, c) var sendOrgTypesList []SendOrgTypes
for _, v := range govClassMap {
var sendOrgTypesCont SendOrgTypes
sendOrgTypesCont.Id = v.Id //
sendOrgTypesCont.Name = v.Name //类型名称"`
sendOrgTypesCont.Time = v.Time //创建时间"`
sendOrgTypesCont.State = v.State //状态(1:启用;2:禁用;3:删除)"`
sendOrgTypesCont.Level = v.Level //级别"`
sendOrgTypesCont.KingdeeId = v.KingdeeId //金蝶对照ID"`
if v.State == 1 {
sendOrgTypesCont.Status = true
} else {
sendOrgTypesCont.Status = false
}
sendOrgTypesList = append(sendOrgTypesList, sendOrgTypesCont)
}
overallhandle.ResultList(0, requestData.Page, requestData.PageSize, total, int64(len(sendOrgTypesList)), sendOrgTypesList, c)
} }
} }
//添加行政组织类别 // 添加行政组织类别
func (o *OrganizationApi) AddGovClass(c *gin.Context) { func (o *OrganizationApi) AddGovClass(c *gin.Context) {
var requestData addGovClassInfo var requestData addGovClassInfo
err := c.ShouldBindJSON(&requestData) err := c.ShouldBindJSON(&requestData)
@ -80,7 +145,7 @@ func (o *OrganizationApi) AddGovClass(c *gin.Context) {
} }
} }
//获取行政组织类别详情 // 获取行政组织类别详情
func (o *OrganizationApi) GetGovClassCont(c *gin.Context) { func (o *OrganizationApi) GetGovClassCont(c *gin.Context) {
var requestData overallhandle.GetId var requestData overallhandle.GetId
err := c.ShouldBindJSON(&requestData) err := c.ShouldBindJSON(&requestData)
@ -105,7 +170,7 @@ func (o *OrganizationApi) GetGovClassCont(c *gin.Context) {
} }
} }
//修改行政组织类别详情 // 修改行政组织类别详情
func (o *OrganizationApi) EiteGovClassCont(c *gin.Context) { func (o *OrganizationApi) EiteGovClassCont(c *gin.Context) {
var requestData eiteGovClassInfo var requestData eiteGovClassInfo
err := c.ShouldBindJSON(&requestData) err := c.ShouldBindJSON(&requestData)
@ -157,7 +222,7 @@ func (o *OrganizationApi) EiteGovClassCont(c *gin.Context) {
} }
} }
//修改行政类别状态或删除 // 修改行政类别状态或删除
func (o *OrganizationApi) EiteGovClassStateOrDel(c *gin.Context) { func (o *OrganizationApi) EiteGovClassStateOrDel(c *gin.Context) {
var requestData EiteJobStateDel var requestData EiteJobStateDel
err := c.ShouldBindJSON(&requestData) err := c.ShouldBindJSON(&requestData)
@ -215,3 +280,90 @@ func (o *OrganizationApi) EiteGovClassStateOrDel(c *gin.Context) {
} }
} }
} }
/*
*
@ 作者: 秦东
@ 时间: 2023-06-05 10:37:05
@ 功能: 批量编辑组织分类状态或删除
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func (o *OrganizationApi) BaseEditOrgClassStatus(c *gin.Context) {
var requestData BaseOrgTypesState
err := c.ShouldBindJSON(&requestData)
if err != nil {
overallhandle.Result(100, err, c)
return
}
if len(requestData.Id) < 1 {
overallhandle.Result(1, err, c, "未知操作项!")
return
}
if requestData.Status == 0 {
requestData.Status = 1
}
if requestData.IsTrue == 0 {
requestData.IsTrue = 2
}
saveData := overallhandle.MapOut()
saveData["time"] = time.Now().Unix()
saveData["state"] = requestData.Status
if requestData.Status != 3 {
err = overall.CONSTANT_DB_HR.Model(&models.AdministrativeOrganizationType{}).Where("`id` IN ?", requestData.Id).Updates(saveData).Error
if err != nil {
overallhandle.Result(106, err, c)
return
} else {
overallhandle.Result(0, err, c)
}
} else {
if requestData.Status != 3 {
err = overall.CONSTANT_DB_HR.Model(&models.AdministrativeOrganizationType{}).Where("`id` IN ?", requestData.Id).Updates(saveData).Error
if err != nil {
overallhandle.Result(106, err, c)
return
}
} else {
var useOrgCalssCount int64
err = overall.CONSTANT_DB_HR.Model(&models.AdministrativeOrganization{}).Select("`id`").Where("`organization_type` IN ?", requestData.Id).Count(&useOrgCalssCount).Error
if err == nil && useOrgCalssCount > 0 {
err = overall.CONSTANT_DB_HR.Model(&models.AdministrativeOrganizationType{}).Where("`id` IN ?", requestData.Id).Updates(saveData).Error
if err != nil {
overallhandle.Result(106, err, c)
return
} else {
overallhandle.Result(0, err, c)
}
} else {
if requestData.IsTrue == 1 {
//硬删除
err = overall.CONSTANT_DB_HR.Where("`id` IN ?", requestData.Id).Delete(&models.AdministrativeOrganizationType{}).Error
if err == nil {
overallhandle.Result(0, err, c)
} else {
overallhandle.Result(108, err, c)
}
} else {
err = overall.CONSTANT_DB_HR.Model(&models.AdministrativeOrganizationType{}).Where("`id` IN ?", requestData.Id).Updates(saveData).Error
if err != nil {
overallhandle.Result(106, err, c)
return
} else {
overallhandle.Result(0, err, c)
}
}
}
}
}
}

449
api/version1/administrativeorganization/govcont.go

@ -5,6 +5,7 @@ import (
"fmt" "fmt"
"hr_server/grocerystore" "hr_server/grocerystore"
"hr_server/models" "hr_server/models"
"hr_server/models/hrmodels"
"hr_server/overall" "hr_server/overall"
"hr_server/overall/overallhandle" "hr_server/overall/overallhandle"
"sort" "sort"
@ -91,9 +92,9 @@ func (o *OrganizationApi) AddGovCont(c *gin.Context) {
govClassIdInt, _ := strconv.ParseInt(requestData.GovClass, 10, 64) govClassIdInt, _ := strconv.ParseInt(requestData.GovClass, 10, 64)
govClassId = govClassIdInt govClassId = govClassIdInt
} }
if requestData.WechatId == 0 { // if requestData.WechatId == 0 {
requestData.WechatId = 1 // requestData.WechatId = 1
} // }
var name string var name string
judgeErr := overall.CONSTANT_DB_HR.Model(&models.AdministrativeOrganization{}).Select("`name`").Where("`organization_type` IN ? AND `name` = ?", []int{1, 2}, requestData.Name).First(&name).Error judgeErr := overall.CONSTANT_DB_HR.Model(&models.AdministrativeOrganization{}).Select("`name`").Where("`organization_type` IN ? AND `name` = ?", []int{1, 2}, requestData.Name).First(&name).Error
if judgeErr == nil { if judgeErr == nil {
@ -495,10 +496,22 @@ func (o *OrganizationApi) GovThreeAboutMan(c *gin.Context) {
// overallhandle.Result(101, requestData, c, "行政类别Id不能为空!") // overallhandle.Result(101, requestData, c, "行政类别Id不能为空!")
// return // return
// } // }
redisFileKey := fmt.Sprintf("OrgPost:OrgAndPeople:%v_%v_%v%v%v", overall.CONSTANT_CONFIG.RedisPrefixStr.Alias, "OrgUserTree", requestData.Id, requestData.All, requestData.Level)
redisClient := grocerystore.RunRedis(overall.CONSTANT_REDIS4)
orgErr, orgUserList := redisClient.Get(redisFileKey)
var jsonErr error
if orgErr == true && orgUserList != "" {
var orgManCont orgPeopleCont
jsonErr = json.Unmarshal([]byte(orgUserList), &orgManCont)
outputDataAry := overallhandle.MapOut()
outputDataAry["three"] = orgManCont.Three
outputDataAry["list"] = orgManCont.List
overallhandle.Result(0, outputDataAry, c)
}
if jsonErr != nil || orgErr == false {
//获取行政组织 //获取行政组织
var orgList []models.OrgContType var orgList []models.OrgContType
gormDb := overall.CONSTANT_DB_HR.Where("`state` = ? ", 1) gormDb := overall.CONSTANT_DB_HR.Model(&models.OrgContType{}).Select("`id`,`numbe`,`name`,`superior`,`state`,`typename`,`level`").Where("`state` = ? ", 1)
if requestData.All == 0 { if requestData.All == 0 {
requestData.Id = "312" requestData.Id = "312"
gormDb = gormDb.Where("`id` NOT IN ?", []int{312, 293, 305, 306, 307}) gormDb = gormDb.Where("`id` NOT IN ?", []int{312, 293, 305, 306, 307})
@ -572,7 +585,15 @@ func (o *OrganizationApi) GovThreeAboutMan(c *gin.Context) {
outputDataAry := overallhandle.MapOut() outputDataAry := overallhandle.MapOut()
outputDataAry["three"] = govMapThree outputDataAry["three"] = govMapThree
outputDataAry["list"] = allOrgAndPeople.OrgAndPeopleList outputDataAry["list"] = allOrgAndPeople.OrgAndPeopleList
var orgManCont orgPeopleCont
orgManCont.List = allOrgAndPeople.OrgAndPeopleList
orgManCont.Three = govMapThree
sendStr, _ := json.Marshal(orgManCont)
redisClient.SetRedisTime(86400)
redisClient.Set(redisFileKey, string(sendStr))
overallhandle.Result(0, outputDataAry, c) overallhandle.Result(0, outputDataAry, c)
}
} }
/* /*
@ -641,7 +662,7 @@ func (s *synProReadData) GetOrgAboutPeople(orgList []OrgAndPeople) {
} }
} }
var peopleList []models.PersonArchives var peopleList []models.PersonArchives
err := overall.CONSTANT_DB_HR.Model(&models.PersonArchives{}).Select("`key`,`number`,`name`,`icon`,`admin_org`").Where("`state` = ? AND `admin_org` IN ? AND `emp_type` BETWEEN ? AND ? ", 1, orgId, 1, 10).Find(&peopleList).Error err := overall.CONSTANT_DB_HR.Model(&models.PersonArchives{}).Select("`key`,`number`,`name`,`icon`,`admin_org`,`icon_photo`").Where("`state` = ? AND `admin_org` IN ? AND `emp_type` BETWEEN ? AND ? ", 1, orgId, 1, 10).Find(&peopleList).Error
if err == nil { if err == nil {
if len(peopleList) > 0 { if len(peopleList) > 0 {
for _, v := range peopleList { for _, v := range peopleList {
@ -678,6 +699,7 @@ func (s *synProReadData) MakePeopleToOrg(manCont models.PersonArchives, orgList
sendDataCont.ParentId = v.Id //上级 sendDataCont.ParentId = v.Id //上级
sendDataCont.IsMan = 2 //是部门还是个人(1:行政组织;2:人员) sendDataCont.IsMan = 2 //是部门还是个人(1:行政组织;2:人员)
sendDataCont.Sort = 1 sendDataCont.Sort = 1
sendDataCont.IconBase64 = manCont.IconPhoto
sendDataCont.AllName = fmt.Sprintf("%v(%v)", manCont.Name, manCont.Number) sendDataCont.AllName = fmt.Sprintf("%v(%v)", manCont.Name, manCont.Number)
s.OrgAndPeopleList = append(s.OrgAndPeopleList, sendDataCont) s.OrgAndPeopleList = append(s.OrgAndPeopleList, sendDataCont)
} }
@ -1339,3 +1361,418 @@ func (o *OrganizationApi) GetAppointOrg(c *gin.Context) {
} }
overallhandle.Result(0, orgList, c) overallhandle.Result(0, orgList, c)
} }
/*
*
@ 作者: 秦东
@ 时间: 2023-04-22 15:56:42
@ 功能:
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func (o *OrganizationApi) BasisOrgAllPeople(c *gin.Context) {
var requestData overallhandle.ConstId
err := c.ShouldBindJSON(&requestData)
if err != nil {
overallhandle.Result(100, err, c)
return
}
if requestData.Id == "" {
overallhandle.Result(101, err, c)
return
}
orgInt, _ := strconv.ParseInt(requestData.Id, 10, 64)
var sunAry overallhandle.AllSunList[int64]
sunAry.GetAllSunOrg(orgInt)
sunAry.SunList = append(sunAry.SunList, orgInt)
var userList []models.PersonArchives
err = overall.CONSTANT_DB_HR.Model(&models.PersonArchives{}).Where("emp_type BETWEEN 1 AND 10 AND admin_org IN ?", sunAry.SunList).Find(&userList).Error
if err != nil {
overallhandle.Result(105, err, c)
return
}
var sendContList []OrgAllPeopleList
for _, v := range userList {
var sendCont OrgAllPeopleList
sendCont.Id = strconv.FormatInt(v.Id, 10) //id"`
sendCont.Number = v.Number //number"`
sendCont.Name = v.Name //name"`
sendCont.Icon = v.Icon //icon"`
sendCont.Adminorg = strconv.FormatInt(v.AdminOrg, 10) //adminorg"`
sendCont.Teamid = strconv.FormatInt(v.TeamId, 10) //teamid"`
sendCont.Position = strconv.FormatInt(v.Position, 10) //position"`
sendCont.Wechat = v.Wechat //wechat"`
if v.WorkWechat != "" {
sendCont.Wechat = v.WorkWechat
}
sendCont.Key = strconv.FormatInt(v.Key, 10) //key"`
sendCont.Iconphoto = v.IconPhoto //iconphoto"`
sendContList = append(sendContList, sendCont)
}
overallhandle.Result(0, sendContList, c)
}
/*
*
@ 作者: 秦东
@ 时间: 2023-06-05 11:53:21
@ 功能:
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func (o *OrganizationApi) GovNewThreeIng(c *gin.Context) {
var requestData SearchOrgCont
c.ShouldBindJSON(&requestData)
var orgContList []hrmodels.OrgCont
gotmDb := overall.CONSTANT_DB_HR.Model(&hrmodels.OrgCont{}).Where("state IN ?", []int{1, 2})
if requestData.KeyWords != "" {
gotmDb = gotmDb.Where("name LIKE ? OR number LIKE ?", "%"+requestData.KeyWords+"%", "%"+requestData.KeyWords+"%")
}
if requestData.Class != 0 {
gotmDb = gotmDb.Where("organization_type = ?", requestData.Class)
}
err := gotmDb.Find(&orgContList).Error
if err != nil && len(orgContList) < 1 {
overallhandle.Result(107, err, c)
return
}
if requestData.KeyWords != "" || requestData.Class != 0 {
var govMap []SendOrgTreeList
for i := 0; i < len(orgContList); i++ {
var govCont SendOrgTreeList
govCont.Id = orgContList[i].Id //
govCont.Number = orgContList[i].Number //行政编码"`
govCont.Name = orgContList[i].Name //组织名称"`
govCont.Superior = orgContList[i].Superior //上级ID"`
govCont.OrganizationType = orgContList[i].OrganizationType //行政组织类型"`
govCont.Abbreviation = orgContList[i].Abbreviation //行政组织简称"`
govCont.Time = orgContList[i].Time //创建时间"`
govCont.State = orgContList[i].State //状态(1:启用;2:禁用;3:删除)"`
govCont.WechatOrganizationId = orgContList[i].WechatOrganizationId //微信组织架构对照码"`
govCont.SuperiorSun = orgContList[i].SuperiorSun //级联ID"`
govCont.Schoole = orgContList[i].Schoole //原知行学院对照码"`
govCont.KingdeeId = orgContList[i].KingdeeId //金蝶对照ID"`
govCont.IsPower = orgContList[i].IsPower //是否为实权部门"`
govCont.Sort = orgContList[i].Sort //排序"`
govCont.TypeName = orgContList[i].TypeName //'类型名称"`
govCont.Level = orgContList[i].Level //级别"`
if orgContList[i].State == 1 {
govCont.Status = true
} else {
govCont.Status = false
}
govMap = append(govMap, govCont)
}
overallhandle.Result(0, govMap, c)
} else {
if requestData.OrgId == 0 {
requestData.OrgId = 313
}
govMapThree := GovOrgTree(requestData.OrgId, orgContList)
overallhandle.Result(0, govMapThree, c)
}
}
/*
*
@ 作者: 秦东
@ 时间: 2023-06-05 13:24:19
@ 功能: 行政组织树
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func GovOrgTree(parentId int64, govList []hrmodels.OrgCont) (govMap []SendOrgTreeList) {
for i := 0; i < len(govList); i++ {
if govList[i].Superior == parentId {
var govCont SendOrgTreeList
govCont.Id = govList[i].Id //
govCont.Number = govList[i].Number //行政编码"`
govCont.Name = govList[i].Name //组织名称"`
govCont.Superior = govList[i].Superior //上级ID"`
govCont.OrganizationType = govList[i].OrganizationType //行政组织类型"`
govCont.Abbreviation = govList[i].Abbreviation //行政组织简称"`
govCont.Time = govList[i].Time //创建时间"`
govCont.State = govList[i].State //状态(1:启用;2:禁用;3:删除)"`
govCont.WechatOrganizationId = govList[i].WechatOrganizationId //微信组织架构对照码"`
govCont.SuperiorSun = govList[i].SuperiorSun //级联ID"`
govCont.Schoole = govList[i].Schoole //原知行学院对照码"`
govCont.KingdeeId = govList[i].KingdeeId //金蝶对照ID"`
govCont.IsPower = govList[i].IsPower //是否为实权部门"`
govCont.Sort = govList[i].Sort //排序"`
govCont.TypeName = govList[i].TypeName //'类型名称"`
govCont.Level = govList[i].Level //级别"`
if govList[i].State == 1 {
govCont.Status = true
} else {
govCont.Status = false
}
govCont.Child = GovOrgTree(govList[i].Id, govList)
govMap = append(govMap, govCont)
}
}
return
}
// 添加行政组织
func (o *OrganizationApi) NewAddGovCont(c *gin.Context) {
var requestData addGovInfoNew
err := c.ShouldBindJSON(&requestData)
if err != nil {
overallhandle.Result(100, err, c)
return
}
if requestData.Name == "" {
overallhandle.Result(101, requestData.Name, c, "行政组织名称为空!")
return
}
var superiorId int64 = 0
if requestData.Superior != "" {
superiorInt, _ := strconv.ParseInt(requestData.Superior, 10, 64)
superiorId = superiorInt
} else {
overallhandle.Result(101, requestData.Superior, c, "请指定归属上级!")
return
}
var govClassId int64 = 0
if requestData.GovClass == "" {
overallhandle.Result(101, requestData.GovClass, c, "请指定归属行政组织类型!")
return
} else {
govClassIdInt, _ := strconv.ParseInt(requestData.GovClass, 10, 64)
govClassId = govClassIdInt
}
var wechatIdVal int64 = 0
if requestData.WechatId != "" {
wechatIdVal, _ = strconv.ParseInt(requestData.WechatId, 10, 64)
// requestData.WechatId = 1
}
var name string
judgeErr := overall.CONSTANT_DB_HR.Model(&models.AdministrativeOrganization{}).Select("`name`").Where("`organization_type` IN ? AND `name` = ?", []int{1, 2}, requestData.Name).First(&name).Error
if judgeErr == nil {
overallhandle.Result(103, name, c)
return
}
var saveData models.AdministrativeOrganization
saveData.Name = requestData.Name
saveData.Superior = superiorId
saveData.OrganizationType = govClassId
saveData.Abbreviation = requestData.Abbreviation
saveData.Time = time.Now().Unix()
saveData.State = 1
// saveData.WechatOrganizationId = int64(requestData.WechatId)
saveData.WechatOrganizationId = wechatIdVal
if requestData.Number != "" {
saveData.Number = requestData.Number
} else {
//获取首字母
govFirstWords := overallhandle.GetGovFirstWords(requestData.Name, requestData.Abbreviation, requestData.GovClass, requestData.Superior)
saveData.Number = overallhandle.CreateNumber(govFirstWords, requestData.Superior)
}
saveErr := overall.CONSTANT_DB_HR.Create(&saveData).Error
if saveErr == nil {
overallhandle.Result(0, saveData, c)
} else {
overallhandle.Result(104, saveErr, c)
}
}
// 编辑行政组织
func (o *OrganizationApi) NewEiteGovCont(c *gin.Context) {
var requestData NewEiteGovInfo
err := c.ShouldBindJSON(&requestData)
if err != nil {
overallhandle.Result(100, err, c)
return
}
if requestData.Id == 0 {
overallhandle.Result(101, err, c, "行政类别Id不能为空!")
return
}
whereAry := overallhandle.MapOut()
whereAry["id"] = requestData.Id
var govCont models.AdministrativeOrganization
judgeErr := govCont.GetCont(whereAry)
if judgeErr != nil {
overallhandle.Result(107, judgeErr, c)
return
}
saveData := overallhandle.MapOut()
saveData["time"] = time.Now().Unix()
if requestData.Name != "" && requestData.Name != govCont.Name {
saveData["name"] = requestData.Name
}
if requestData.Superior != "" && requestData.Superior != strconv.FormatInt(govCont.Superior, 10) {
saveData["superior"] = requestData.Superior
}
if requestData.GovClass != "" && requestData.GovClass != strconv.FormatInt(govCont.OrganizationType, 10) {
saveData["organization_type"] = requestData.GovClass
}
if requestData.Abbreviation != "" && requestData.Abbreviation != govCont.Abbreviation {
saveData["abbreviation"] = requestData.Abbreviation
}
if requestData.WechatId != "" {
wechatIdInt, _ := strconv.ParseInt(requestData.WechatId, 10, 64)
if wechatIdInt != govCont.WechatOrganizationId {
saveData["wechat_organization_id"] = wechatIdInt
}
} else {
saveData["wechat_organization_id"] = 0
}
if requestData.Number != "" && requestData.Number != govCont.Number {
if requestData.Superior != "" && requestData.Superior != strconv.FormatInt(govCont.Superior, 10) {
//获取首字母
govFirstWords := overallhandle.GetGovFirstWords(requestData.Name, requestData.Abbreviation, requestData.GovClass, requestData.Superior)
saveData["number"] = overallhandle.CreateNumber(govFirstWords, requestData.Superior)
} else if requestData.Superior != "" {
saveData["number"] = requestData.Number
}
}
eiteErr := govCont.EiteCont(whereAry, saveData)
if eiteErr != nil {
overallhandle.Result(106, eiteErr, c)
} else {
overallhandle.Result(0, saveData, c)
}
}
// 改变行政组织状态
func (o *OrganizationApi) NewEiteGovStateOrDel(c *gin.Context) {
var requestData DelOrgStatus
err := c.ShouldBindJSON(&requestData)
if err != nil {
overallhandle.Result(100, err, c)
return
}
if requestData.Id == 0 {
overallhandle.Result(1, err, c, "未知行政组织!请检查!")
return
}
if requestData.Status == 0 {
requestData.Status = 1
}
if requestData.IsTrue == 0 {
requestData.IsTrue = 2
}
where := overallhandle.MapOut()
where["`id`"] = requestData.Id
var orgCont models.AdministrativeOrganization
err = orgCont.GetCont(where, "`id`", "`name`", "`superior`")
if err != nil {
overallhandle.Result(1, err, c, "未知行政组织!请检查!")
return
}
editCont := overallhandle.MapOut()
editCont["state"] = requestData.Status
editCont["time"] = time.Now().Unix()
if requestData.Status != 3 {
if requestData.Status == 1 {
//获取所有上级
var fatherOrg overallhandle.AllSunList[int64]
fatherOrg.GetAllFatherOrg(orgCont.Superior)
fatherOrg.SunList = append(fatherOrg.SunList, orgCont.Id)
err = overall.CONSTANT_DB_HR.Model(&models.AdministrativeOrganization{}).Where("`id` IN ? AND state BETWEEN ? AND ?", fatherOrg.SunList, 1, 2).Updates(editCont).Error
if err != nil {
overallhandle.Result(106, err, c)
return
}
} else {
//获取所有下级
var orgSun overallhandle.AllSunList[int64]
orgSun.GetAllSunOrg(orgCont.Id)
orgSun.SunList = append(orgSun.SunList, orgCont.Id)
err = overall.CONSTANT_DB_HR.Model(&models.AdministrativeOrganization{}).Where("`id` IN ? AND state BETWEEN ? AND ?", orgSun.SunList, 1, 2).Updates(editCont).Error
if err != nil {
overallhandle.Result(106, err, c)
return
}
}
} else {
if requestData.IsTrue == 1 {
//获取所有下级
var orgSun overallhandle.AllSunList[int64]
orgSun.GetAllSunOrg(orgCont.Id)
orgSun.SunList = append(orgSun.SunList, orgCont.Id)
var curryMan int64
overall.CONSTANT_DB_HR.Model(&models.PersonArchives{}).Select("`id`").Where("admin_org IN ?", orgSun.SunList).Count(&curryMan)
if curryMan > 0 {
if requestData.Status == 1 {
var fatherOrg overallhandle.AllSunList[int64]
fatherOrg.GetAllFatherOrg(orgCont.Superior)
fatherOrg.SunList = append(fatherOrg.SunList, orgCont.Id)
err = overall.CONSTANT_DB_HR.Model(&models.AdministrativeOrganization{}).Where("`id` IN ? AND state BETWEEN ? AND ?", fatherOrg.SunList, 1, 2).Updates(editCont).Error
if err != nil {
overallhandle.Result(106, err, c)
return
}
} else {
err = overall.CONSTANT_DB_HR.Model(&models.AdministrativeOrganization{}).Where("`id` IN ? AND state BETWEEN ? AND ?", orgSun.SunList, 1, 2).Updates(editCont).Error
if err != nil {
overallhandle.Result(106, err, c)
return
}
}
} else {
err = overall.CONSTANT_DB_HR.Where("`id` IN ?", orgSun.SunList).Delete(&models.AdministrativeOrganization{}).Error
if err != nil {
overallhandle.Result(106, err, c)
return
}
}
} else {
if requestData.Status == 1 {
var fatherOrg overallhandle.AllSunList[int64]
fatherOrg.GetAllFatherOrg(orgCont.Superior)
fatherOrg.SunList = append(fatherOrg.SunList, orgCont.Id)
err = overall.CONSTANT_DB_HR.Model(&models.AdministrativeOrganization{}).Where("`id` IN ? AND state BETWEEN ? AND ?", fatherOrg.SunList, 1, 2).Updates(editCont).Error
if err != nil {
overallhandle.Result(106, err, c)
return
}
} else {
//获取所有下级
var orgSun overallhandle.AllSunList[int64]
orgSun.GetAllSunOrg(orgCont.Id)
orgSun.SunList = append(orgSun.SunList, orgCont.Id)
err = overall.CONSTANT_DB_HR.Model(&models.AdministrativeOrganization{}).Where("`id` IN ? AND state BETWEEN ? AND ?", orgSun.SunList, 1, 2).Updates(editCont).Error
if err != nil {
overallhandle.Result(106, err, c)
return
}
}
}
}
overallhandle.Result(0, err, c)
}

126
api/version1/administrativeorganization/job_class.go

@ -10,7 +10,7 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
//职务分类列表 // 职务分类列表
func (o *OrganizationApi) DutiesClassList(c *gin.Context) { func (o *OrganizationApi) DutiesClassList(c *gin.Context) {
var requestData JobClassPageSelect var requestData JobClassPageSelect
c.ShouldBindJSON(&requestData) c.ShouldBindJSON(&requestData)
@ -21,7 +21,7 @@ func (o *OrganizationApi) DutiesClassList(c *gin.Context) {
requestData.PageSize = 10 requestData.PageSize = 10
} }
var jobClassList []models.JobClass var jobClassList []models.JobClass
gormDb := overall.CONSTANT_DB_HR.Model(&models.JobClass{}).Select("`id`", "`name`", "`state`") gormDb := overall.CONSTANT_DB_HR.Model(&models.JobClass{}).Select("`id`", "`name`", "`state`,`kingdeeid`")
if requestData.Name != "" { if requestData.Name != "" {
// nameFactor := fmt.Sprintf("%%v%") // nameFactor := fmt.Sprintf("%%v%")
gormDb = gormDb.Where("`name` LIKE ?", "%"+requestData.Name+"%") gormDb = gormDb.Where("`name` LIKE ?", "%"+requestData.Name+"%")
@ -42,6 +42,12 @@ func (o *OrganizationApi) DutiesClassList(c *gin.Context) {
jobClassCont.Id = strconv.FormatInt(v.Id, 10) jobClassCont.Id = strconv.FormatInt(v.Id, 10)
jobClassCont.Name = v.Name jobClassCont.Name = v.Name
jobClassCont.State = v.State jobClassCont.State = v.State
jobClassCont.KingDeeId = v.KingdeeId
if v.State == 1 {
jobClassCont.Status = true
} else {
jobClassCont.Status = false
}
jobClassAry = append(jobClassAry, jobClassCont) jobClassAry = append(jobClassAry, jobClassCont)
} }
// overallhandle.Result(0, jobClassList, c) // overallhandle.Result(0, jobClassList, c)
@ -49,7 +55,7 @@ func (o *OrganizationApi) DutiesClassList(c *gin.Context) {
} }
} }
//添加职务分类 // 添加职务分类
func (o *OrganizationApi) AddDutiesClass(c *gin.Context) { func (o *OrganizationApi) AddDutiesClass(c *gin.Context) {
var requestData NameVal var requestData NameVal
err := c.ShouldBindJSON(&requestData) err := c.ShouldBindJSON(&requestData)
@ -80,7 +86,7 @@ func (o *OrganizationApi) AddDutiesClass(c *gin.Context) {
} }
} }
//查看职务分类详情 // 查看职务分类详情
func (o *OrganizationApi) GetDutiesClassInfo(c *gin.Context) { func (o *OrganizationApi) GetDutiesClassInfo(c *gin.Context) {
var requestData overallhandle.GetId var requestData overallhandle.GetId
err := c.ShouldBindJSON(&requestData) err := c.ShouldBindJSON(&requestData)
@ -105,7 +111,7 @@ func (o *OrganizationApi) GetDutiesClassInfo(c *gin.Context) {
} }
} }
//修改职务分类详情 // 修改职务分类详情
func (o *OrganizationApi) EiteDutiesClassInfo(c *gin.Context) { func (o *OrganizationApi) EiteDutiesClassInfo(c *gin.Context) {
var requestData EiteJobClassInfo var requestData EiteJobClassInfo
err := c.ShouldBindJSON(&requestData) err := c.ShouldBindJSON(&requestData)
@ -157,7 +163,7 @@ func (o *OrganizationApi) EiteDutiesClassInfo(c *gin.Context) {
} }
} }
//删除职务分类 // 删除职务分类
func (o *OrganizationApi) DelDutiesClassInfo(c *gin.Context) { func (o *OrganizationApi) DelDutiesClassInfo(c *gin.Context) {
var requestData EiteJobStateDel var requestData EiteJobStateDel
err := c.ShouldBindJSON(&requestData) err := c.ShouldBindJSON(&requestData)
@ -215,3 +221,111 @@ func (o *OrganizationApi) DelDutiesClassInfo(c *gin.Context) {
} }
} }
} }
// 修改职务分类详情
func (o *OrganizationApi) NewEiteDutiesClassInfo(c *gin.Context) {
var requestData EiteJobClassInfoNew
err := c.ShouldBindJSON(&requestData)
if err != nil {
overallhandle.Result(100, err, c)
return
}
if requestData.Id == 0 {
overallhandle.Result(101, err, c, "职务分类Id不能为空!")
return
}
gormDb := overall.CONSTANT_DB_HR
var jobClassInfo models.JobClass
//判断职务类型是否存在
judgeExist := gormDb.Where("`id` = ?", requestData.Id).First(&jobClassInfo).Error
if judgeExist != nil {
overallhandle.Result(107, judgeExist, c)
return
}
saveData := overallhandle.MapOut()
saveData["time"] = time.Now().Unix()
if requestData.Name != "" {
if requestData.Name != jobClassInfo.Name {
//查询一下修改的职务名称是否已经存在
var name string
judgeErr := overall.CONSTANT_DB_HR.Model(&models.JobClass{}).Select("`name`").Where("`name` = ?", requestData.Name).First(&name).Error
if judgeErr == nil {
overallhandle.Result(103, name, c)
return
}
saveData["name"] = requestData.Name
}
}
whereMap := overallhandle.MapOut()
whereMap["id"] = requestData.Id
eiteErr := jobClassInfo.EiteJobClassCont(whereMap, saveData)
if eiteErr != nil {
overallhandle.Result(106, eiteErr, c)
} else {
overallhandle.Result(0, saveData, c)
}
}
/*
*
@ 作者: 秦东
@ 时间: 2023-06-07 15:09:48
@ 功能: 编辑职务分类状态或删除
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func (o *OrganizationApi) EditDutiesClassStatus(c *gin.Context) {
var requestData DutiesEditOrDel
err := c.ShouldBindJSON(&requestData)
if err != nil {
overallhandle.Result(100, err, c)
return
}
if len(requestData.Id) < 1 {
overallhandle.Result(101, err, c, "职务分类Id不能为空!")
return
}
if requestData.Status == 0 {
requestData.Status = 1
}
if requestData.IsTrue == 0 {
requestData.IsTrue = 2
}
editCont := overallhandle.MapOut()
editCont["`state`"] = requestData.Status
editCont["`time`"] = time.Now().Unix()
if requestData.Status != 3 {
err = overall.CONSTANT_DB_HR.Model(&models.JobClass{}).Where("`id` IN ?", requestData.Id).Updates(editCont).Error
if err != nil {
overallhandle.Result(101, err, c, "数据更新失败!")
return
}
} else {
if requestData.IsTrue == 1 {
err = overall.CONSTANT_DB_HR.Where("`id` IN ?", requestData.Id).Delete(&models.JobClass{}).Error
if err != nil {
overallhandle.Result(101, err, c, "数据更新失败!")
return
}
} else {
err = overall.CONSTANT_DB_HR.Model(&models.JobClass{}).Where("`id` IN ?", requestData.Id).Updates(editCont).Error
if err != nil {
overallhandle.Result(101, err, c, "数据更新失败!")
return
}
}
}
overallhandle.Result(0, err, c)
}

4
api/version1/administrativeorganization/orgpost.go

@ -131,7 +131,7 @@ func (o *OrganizationApi) GetOrgAndPostThree(c *gin.Context) {
for _, v := range orgList { for _, v := range orgList {
var redisCont OutPutOrgAndPost var redisCont OutPutOrgAndPost
jsonErr := json.Unmarshal([]byte(v), &redisCont) jsonErr := json.Unmarshal([]byte(v), &redisCont)
fmt.Printf("jsonErr=========>%v\n", jsonErr) // fmt.Printf("jsonErr=========>%v\n", jsonErr)
if jsonErr == nil { if jsonErr == nil {
sendListCont = append(sendListCont, redisCont) sendListCont = append(sendListCont, redisCont)
allNumber = append(allNumber, redisCont.Number) allNumber = append(allNumber, redisCont.Number)
@ -166,6 +166,7 @@ func OrgAndPostThreeList(superiorId string, contList []OutPutOrgAndPost) []OutPu
node.OrgName = v.OrgName node.OrgName = v.OrgName
node.DepartId = v.DepartId node.DepartId = v.DepartId
node.DepartName = v.DepartName node.DepartName = v.DepartName
node.AdminOrg = v.AdminOrg
if len(child) > 0 { if len(child) > 0 {
node.Child = child node.Child = child
} }
@ -209,6 +210,7 @@ func (o *OrgAndPostSync) GetPostInfoList(contList []OutPutOrgAndPost) {
sendCont.OrgId = "-1" sendCont.OrgId = "-1"
sendCont.DepartId = strconv.FormatInt(departmentId, 10) sendCont.DepartId = strconv.FormatInt(departmentId, 10)
sendCont.DepartName = departCont.Name sendCont.DepartName = departCont.Name
sendCont.AdminOrg = strconv.FormatInt(v.AdministrativeOrganization, 10)
if departmentId == v.AdministrativeOrganization { if departmentId == v.AdministrativeOrganization {
sendCont.OrgName = departCont.Name sendCont.OrgName = departCont.Name
} else { } else {

360
api/version1/administrativeorganization/position.go

@ -82,6 +82,11 @@ func (o *OrganizationApi) PositionList(c *gin.Context) {
positionAry[i].DepartmentName = getSpurDepart.Name positionAry[i].DepartmentName = getSpurDepart.Name
positionAry[i].IdStr = strconv.FormatInt(v.Id, 10) positionAry[i].IdStr = strconv.FormatInt(v.Id, 10)
if positionAry[i].State == 1 {
positionAry[i].Status = true
} else {
positionAry[i].Status = false
}
} }
if errGorm != nil { if errGorm != nil {
@ -880,6 +885,11 @@ func (o *OrganizationApi) GetMyPositionList(c *gin.Context) {
positionAry[i].DepartmentName = getSpurDepart.Name positionAry[i].DepartmentName = getSpurDepart.Name
positionAry[i].IdStr = strconv.FormatInt(v.Id, 10) positionAry[i].IdStr = strconv.FormatInt(v.Id, 10)
if positionAry[i].State == 1 {
positionAry[i].Status = true
} else {
positionAry[i].Status = false
}
} }
if errGorm != nil { if errGorm != nil {
@ -1024,3 +1034,353 @@ func excudePosition(unifyCont models.PositionUnify) {
} }
} }
} }
/*
*
@ 作者: 秦东
@ 时间: 2023-06-14 09:00:13
@ 功能: 添加岗位平台通用
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func (o *OrganizationApi) AddPositionContPublic(c *gin.Context) {
var requestData PublicAddPostCont
c.ShouldBindJSON(&requestData)
if requestData.Number == "" {
overallhandle.Result(101, requestData.Number, c, "岗位编码不能为空!")
return
}
if requestData.Name == "" {
overallhandle.Result(101, requestData.Name, c, "岗位名称不能为空!")
return
}
if requestData.Duties == 0 {
overallhandle.Result(101, requestData.Duties, c, "请指定该岗位的职务!")
return
}
if requestData.Organization == 0 {
overallhandle.Result(101, requestData.Duties, c, "请指定该岗位的归属行政组织!")
return
}
incharge := 2
if requestData.Incharge != "" {
var incErr error
incharge, incErr = strconv.Atoi(requestData.Incharge)
if incErr != nil {
incharge = 2
}
} else {
incharge = 2
}
var positionCont models.Position
//判断编号是否已经存在
isNumExit := overallhandle.MapOut()
isNumExit["number"] = requestData.Number
judgeNumErr := positionCont.GetCont(isNumExit)
if judgeNumErr == nil {
overallhandle.Result(101, isNumExit, c, "该编号已经存在!请不要重复使用!")
return
}
groupId, companyId, departmentId, sunDepartId, workShopId := overallhandle.GetOrgStructure(requestData.Organization)
if departmentId == 0 {
departmentId = companyId
}
var orgList []int64
if groupId != 0 {
// groupIdStr := strconv.FormatInt(groupId, 10)
if !overallhandle.IsInTrue[int64](groupId, orgList) {
orgList = append(orgList, groupId)
}
}
if companyId != 0 {
// companyIdStr := strconv.FormatInt(companyId, 10)
if !overallhandle.IsInTrue[int64](companyId, orgList) {
orgList = append(orgList, companyId)
}
}
if departmentId != 0 {
// departmentIdStr := strconv.FormatInt(departmentId, 10)
if !overallhandle.IsInTrue[int64](departmentId, orgList) {
orgList = append(orgList, departmentId)
}
}
if sunDepartId != 0 {
// sunDepartIdStr := strconv.FormatInt(sunDepartId, 10)
if !overallhandle.IsInTrue[int64](sunDepartId, orgList) {
orgList = append(orgList, sunDepartId)
}
}
if workShopId != 0 {
// workShopIdStr := strconv.FormatInt(workShopId, 10)
if !overallhandle.IsInTrue[int64](workShopId, orgList) {
orgList = append(orgList, workShopId)
}
}
orgListJson, _ := json.Marshal(orgList)
//判断岗位名称是否已经存在
isExit := overallhandle.MapOut()
isExit["department"] = departmentId
isExit["name"] = requestData.Name
isExit["administrative_organization"] = requestData.Organization
judgeErr := positionCont.GetCont(isExit)
if judgeErr == nil {
overallhandle.Result(101, isExit, c, "该职位在本行政组织下已经存在!请不要重复添加")
return
}
positionCont.Number = requestData.Number
positionCont.Name = requestData.Name
positionCont.Duties = requestData.Duties
positionCont.AdministrativeOrganization = requestData.Organization
positionCont.Superior = requestData.Superior
positionCont.PersonInCharge = incharge
positionCont.Department = departmentId
positionCont.State = 1
positionCont.Time = time.Now().Unix()
positionCont.OrgList = string(orgListJson)
addDataErr := overall.CONSTANT_DB_HR.Create(&positionCont).Error
if addDataErr != nil {
overallhandle.Result(104, addDataErr, c)
} else {
overallhandle.Result(0, addDataErr, c)
}
}
/*
*
@ 作者: 秦东
@ 时间: 2023-06-14 10:01:34
@ 功能: 编辑岗位平台通用
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func (o *OrganizationApi) EditPositionContPublic(c *gin.Context) {
var requestData PublicAddPostCont
c.ShouldBindJSON(&requestData)
if requestData.Id == 0 {
overallhandle.Result(101, requestData.Id, c, "未知岗位!不能进行编辑!")
return
}
if requestData.Number == "" {
overallhandle.Result(101, requestData.Number, c, "岗位编码不能为空!")
return
}
if requestData.Name == "" {
overallhandle.Result(101, requestData.Name, c, "岗位名称不能为空!")
return
}
if requestData.Duties == 0 {
overallhandle.Result(101, requestData.Duties, c, "请指定该岗位的职务!")
return
}
if requestData.Organization == 0 {
overallhandle.Result(101, requestData.Duties, c, "请指定该岗位的归属行政组织!")
return
}
incharge := 2
if requestData.Incharge != "" {
var incErr error
incharge, incErr = strconv.Atoi(requestData.Incharge)
if incErr != nil {
incharge = 2
}
} else {
incharge = 2
}
whereAry := overallhandle.MapOut()
whereAry["id"] = requestData.Id
var govCont models.Position
judgeErr := govCont.GetCont(whereAry)
if judgeErr != nil {
overallhandle.Result(107, judgeErr, c)
return
}
saveData := overallhandle.MapOut()
if requestData.Number != "" && requestData.Number != govCont.Number {
isNumExit := overallhandle.MapOut()
isNumExit["number"] = requestData.Number
var govContNum models.Position
judgeNumErr := govContNum.GetCont(isNumExit, "id", "number")
if judgeNumErr == nil {
overallhandle.Result(101, isNumExit, c, "该编号已经存在!请不要重复使用!")
return
}
saveData["number"] = requestData.Number
}
// organizationId :=requestData.Organization
// _, companyId, departmentId, _, _ := overallhandle.GetOrgStructure(requestData.Organization)
// if departmentId == 0 {
// departmentId = companyId
// }
// departIsTrue := false
// if departmentId != 0 && departmentId != govCont.Department {
// departIsTrue = true
// orgListJson, _ := json.Marshal(requestData.Organization)
// saveData["department"] = departmentId
// saveData["orglist"] = orgListJson
// }
groupId, companyId, departmentId, sunDepartId, workShopId := overallhandle.GetOrgStructure(requestData.Organization)
if departmentId == 0 {
departmentId = companyId
}
var orgList []int64
if groupId != 0 {
// groupIdStr := strconv.FormatInt(groupId, 10)
if !overallhandle.IsInTrue[int64](groupId, orgList) {
orgList = append(orgList, groupId)
}
}
if companyId != 0 {
// companyIdStr := strconv.FormatInt(companyId, 10)
if !overallhandle.IsInTrue[int64](companyId, orgList) {
orgList = append(orgList, companyId)
}
}
if departmentId != 0 {
// departmentIdStr := strconv.FormatInt(departmentId, 10)
if !overallhandle.IsInTrue[int64](departmentId, orgList) {
orgList = append(orgList, departmentId)
}
}
if sunDepartId != 0 {
// sunDepartIdStr := strconv.FormatInt(sunDepartId, 10)
if !overallhandle.IsInTrue[int64](sunDepartId, orgList) {
orgList = append(orgList, sunDepartId)
}
}
if workShopId != 0 {
// workShopIdStr := strconv.FormatInt(workShopId, 10)
if !overallhandle.IsInTrue[int64](workShopId, orgList) {
orgList = append(orgList, workShopId)
}
}
orgListJson, _ := json.Marshal(orgList)
departIsTrue := false
if departmentId != 0 && departmentId != govCont.Department {
departIsTrue = true
saveData["department"] = departmentId
saveData["orglist"] = string(orgListJson)
}
if requestData.Name != "" && requestData.Name != govCont.Name {
if departIsTrue == true {
//判断岗位名称是否已经存在
isExit := overallhandle.MapOut()
isExit["department"] = departmentId
isExit["name"] = requestData.Name
var govContName models.Position
judgeErr := govContName.GetCont(isExit, "id", "department", "name")
if judgeErr == nil {
overallhandle.Result(101, isExit, c, "该职位在本部门下已经存在!请不要重复添加")
return
}
}
saveData["name"] = requestData.Name
}
if requestData.Duties != 0 && requestData.Duties != govCont.Duties {
saveData["duties"] = requestData.Duties
}
if requestData.Organization != 0 && requestData.Organization != govCont.AdministrativeOrganization {
saveData["administrative_organization"] = requestData.Organization
}
if requestData.Superior != 0 && requestData.Superior != govCont.Superior {
saveData["superior"] = requestData.Superior
}
if incharge != 0 && incharge != govCont.PersonInCharge {
saveData["person_in_charge"] = incharge
}
if len(saveData) < 1 {
overallhandle.Result(0, saveData, c)
return
}
saveData["time"] = time.Now().Unix()
eiteErr := govCont.EiteCont(whereAry, saveData)
if eiteErr != nil {
overallhandle.Result(106, eiteErr, c)
} else {
overallhandle.Result(0, saveData, c)
}
}
/*
*
@ 作者: 秦东
@ 时间: 2023-06-14 10:45:26
@ 功能: 批量删除
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func (o *OrganizationApi) BaseDelPostCont(c *gin.Context) {
var requestData DutiesEditOrDel
err := c.ShouldBindJSON(&requestData)
if err != nil {
overallhandle.Result(100, err, c)
return
}
if len(requestData.Id) < 1 {
overallhandle.Result(101, err, c, "岗位Id不能为空!")
return
}
if requestData.Status == 0 {
requestData.Status = 1
}
if requestData.IsTrue == 0 {
requestData.IsTrue = 2
}
editCont := overallhandle.MapOut()
editCont["`state`"] = requestData.Status
editCont["`time`"] = time.Now().Unix()
if requestData.Status != 3 {
err = overall.CONSTANT_DB_HR.Model(&models.Position{}).Where("`id` IN ?", requestData.Id).Updates(editCont).Error
if err != nil {
overallhandle.Result(101, err, c, "数据更新失败!")
return
}
} else {
if requestData.IsTrue == 1 {
err = overall.CONSTANT_DB_HR.Where("`id` IN ?", requestData.Id).Delete(&models.Position{}).Error
if err != nil {
overallhandle.Result(101, err, c, "数据更新失败!")
return
}
} else {
err = overall.CONSTANT_DB_HR.Model(&models.Position{}).Where("`id` IN ?", requestData.Id).Updates(editCont).Error
if err != nil {
overallhandle.Result(101, err, c, "数据更新失败!")
return
}
}
}
overallhandle.Result(0, err, c)
}

110
api/version1/administrativeorganization/type.go

@ -2,6 +2,7 @@ package administrativeorganization
import ( import (
"hr_server/models" "hr_server/models"
"hr_server/models/hrmodels"
"hr_server/overall/overallhandle" "hr_server/overall/overallhandle"
"sync" "sync"
@ -57,6 +58,7 @@ type dutiesListType struct {
type dutiesOutCont struct { type dutiesOutCont struct {
models.Duties models.Duties
DutiesClassName string `json:"dutiesclassname" gorm:"column:classname;type:varchar(255) unsigned;default:'';not null;comment:职务分类名称"` DutiesClassName string `json:"dutiesclassname" gorm:"column:classname;type:varchar(255) unsigned;default:'';not null;comment:职务分类名称"`
Status bool `json:"status"`
} }
// 添加职务 // 添加职务
@ -74,7 +76,7 @@ type getDutiesInfo struct {
// 修改职务详情 // 修改职务详情
type eiteDutiesCont struct { type eiteDutiesCont struct {
overallhandle.GetId Id int64 `json:"id"`
NameVal NameVal
JobType string `json:"jobtype"` //归属职务类型 JobType string `json:"jobtype"` //归属职务类型
Weight int64 `json:weight` //权重 Weight int64 `json:weight` //权重
@ -126,6 +128,15 @@ type addGovInfo struct {
WechatId int `json:"wechatid"` WechatId int `json:"wechatid"`
} }
type addGovInfoNew struct {
NameVal
Number string `json:"number"`
Superior string `json:"superior"`
GovClass string `json:"govclass"`
Abbreviation string `json:"abbreviation"`
WechatId string `json:"wechatid"`
}
// 修改行政组织 // 修改行政组织
type eiteGovInfo struct { type eiteGovInfo struct {
overallhandle.GetId overallhandle.GetId
@ -173,6 +184,7 @@ type positionOutInfo struct {
DepartmentName string `json:"departmentname"` DepartmentName string `json:"departmentname"`
IdStr string `json:"idstr"` IdStr string `json:"idstr"`
OrgListAry []int64 `json:"orglistary"` OrgListAry []int64 `json:"orglistary"`
Status bool `json:"status"`
} }
// 行政组织树查询 // 行政组织树查询
@ -204,6 +216,8 @@ type outJobClassList struct {
Id string `json:"id"` Id string `json:"id"`
Name string `json:"name"` Name string `json:"name"`
State int `json:"state"` State int `json:"state"`
Status bool `json:"status"`
KingDeeId string `json:"kingdeeid"`
} }
// 修改班组 // 修改班组
@ -223,6 +237,7 @@ type OrgAndPeople struct {
Name string `json:"name"` //行政组织名称或人员名称 Name string `json:"name"` //行政组织名称或人员名称
Number string `json:"number"` //行政组织编号或人员编号 Number string `json:"number"` //行政组织编号或人员编号
Icon string `json:"icon"` //行政组织头像或人员头像 Icon string `json:"icon"` //行政组织头像或人员头像
IconBase64 string `json:"iconbase64"` //行政组织头像或人员头像
ParentId string `json:"parentId"` //上级 ParentId string `json:"parentId"` //上级
OrgId string `json:"orgId"` //所属行政组织 OrgId string `json:"orgId"` //所属行政组织
IsMan int `json:"isman"` //是部门还是个人(1:行政组织;2:人员) IsMan int `json:"isman"` //是部门还是个人(1:行政组织;2:人员)
@ -390,6 +405,7 @@ type OutPutOrgAndPost struct {
OrgName string `json:"orgname"` //行政组织名称 OrgName string `json:"orgname"` //行政组织名称
DepartId string `json:"departid"` //主责部门 DepartId string `json:"departid"` //主责部门
DepartName string `json:"departname"` //主责部门名称 DepartName string `json:"departname"` //主责部门名称
AdminOrg string `json:"adminorg"` //归属行政组织
} }
// 循环输出 // 循环输出
@ -420,3 +436,95 @@ func (p *PositionUnifySync) readDataLock() []models.PositionUnify {
defer p.mutext.RUnlock() defer p.mutext.RUnlock()
return p.PositionList return p.PositionList
} }
// 输出行政组织下的所有人员
type OrgAllPeopleList struct {
Id string `json:"id"`
Number string `json:"number"`
Name string `json:"name"`
Icon string `json:"icon"`
Adminorg string `json:"adminorg"`
Teamid string `json:"teamid"`
Position string `json:"position"`
Wechat string `json:"wechat"`
Key string `json:"key"`
Iconphoto string `json:"iconphoto"`
}
// 行政组织与人
type orgPeopleCont struct {
Three []OrgAndPeopleThree `json:"three"`
List []OrgAndPeople `json:"list"`
}
// 输出组织分类
type SendOrgTypes struct {
models.AdministrativeOrganizationType
Status bool `json:"status"`
}
// 批量编辑组织分类状态
type BaseOrgTypesState struct {
Id []string `json:"id"` //状态ID
Status int `json:"status"` //状态值(1:启用;2:禁用;3:删除)
IsTrue int `json:"istrue"` //当status 为 3 时是否强制删除(1:强制删除;2:不强制)
}
// 搜索行政组织相关参数
type SearchOrgCont struct {
OrgId int64 `json:"orgid"` //行政组织ID
KeyWords string `json:"keywords"` //关键字
Class int `json:"class"` //类别
}
// 输出行政组织树
type SendOrgTreeList struct {
SendOrgTreeCont
Child []SendOrgTreeList `json:"child"`
}
type SendOrgTreeCont struct {
hrmodels.OrgCont
Status bool `json:"status"`
}
type NewEiteGovInfo struct {
Id int64 `json:"id"`
addGovInfoNew
}
/*
*
编辑行政组织状态
*/
type DelOrgStatus struct {
Id int64 `json:"id"`
Status int `json:"status"`
IsTrue int `json:"istrue"` //1:应删除;非1:软删除
}
// 修改职务类型信息
type EiteJobClassInfoNew struct {
Id int64 `json:"id"`
NameVal
}
/*
*/
type DutiesEditOrDel struct {
Id []string `json:"id"`
Status int `json:"status"`
IsTrue int `json:"istrue"` //1:应删除;非1:软删除
}
/*
添加岗位通用
*/
type PublicAddPostCont struct {
Id int64 `json:"id"` //岗位ID
NameVal //岗位名称
Number string `json:"number"` //岗位编号
Duties int64 `json:"duties"` //岗位职务
Organization int64 `json:"organization"` //归属行政组织
Superior int64 `json:"superior"` //上级岗位
Incharge string `json:"incharge"` // 1:责任岗;2:非责任岗
}

251
api/version1/personnelapi/kingdeecont.go

@ -0,0 +1,251 @@
package personnelapi
import (
"fmt"
"hr_server/models"
"hr_server/overall"
"hr_server/overall/overallhandle"
"strings"
"time"
"github.com/gin-gonic/gin"
)
/*
*
@ 作者: 秦东
@ 时间: 2023-06-16 09:00:47
@ 功能: 集团内部工作经历
@ 参数
#manKeyNum 员工Key
#contList 工作经历
@ 返回值
#
@ 方法原型
#
*/
func EditWithinGroupWorkLog(manKeyNum int64, contList []insideHistoryer) {
defer synPro.Done()
if len(contList) > 0 && manKeyNum > 0 {
var topGroup int64 = 0 // 集团ID
var groupTopCont models.AdministrativeOrganization
groupTopCont.GetCont(map[string]interface{}{"superior": 0}, "id")
topGroup = groupTopCont.Id
//获取个人信息
var myCont models.PersonArchives
myCont.GetCont(map[string]interface{}{"key": manKeyNum}, "`company`", "`maindeparment`", "`admin_org`", "`sun_main_deparment`", "`position`", "`teamid`")
//1、判断是否存在集团工作经历
var oldLogId int64
overall.CONSTANT_DB_HR.Model(&models.InsideWorkHistory{}).Select("`id`").Where("`key` = ?", manKeyNum).Count(&oldLogId)
if oldLogId > 0 {
overall.CONSTANT_DB_HR.Where("`key` = ?", manKeyNum).Delete(&models.InsideWorkHistory{})
}
//批量写入
var creadContList []models.InsideWorkHistory
for _, v := range contList {
WorkShop := myCont.SunMainDeparment
if v.Workshop != "" {
var workShopCont models.AdministrativeOrganization
workShopErr := workShopCont.GetCont(map[string]interface{}{"kingdeeid": v.Workshop}, "id")
if workShopErr == nil {
WorkShop = workShopCont.Id //部室"`
}
}
WorkshopSection := myCont.AdminOrg
if v.WorkshopSection != "" {
var workShopSecCont models.AdministrativeOrganization
workShopSecErr := workShopSecCont.GetCont(map[string]interface{}{"kingdeeid": v.WorkshopSection}, "id")
if workShopSecErr == nil {
WorkshopSection = workShopSecCont.Id //工段"`
}
}
var wssCont models.AdministrativeOrganization
wssCont.GetCont(map[string]interface{}{"kingdeeid": v.WorkshopSection}, "id") //工段信息
if wssCont.Id == 0 {
wssCont.Id = myCont.AdminOrg
}
//集团
var groupContes models.AdministrativeOrganization
if v.Group != "" {
groupContes.GetCont(map[string]interface{}{"kingdeeid": v.Group}, "id")
if groupContes.Id == 0 {
groupContes.Id = topGroup
}
} else {
groupContes.Id = topGroup
}
//部门
var dempCont models.AdministrativeOrganization
dempCont.GetCont(map[string]interface{}{"kingdeeid": v.Department}, "id")
if dempCont.Id == groupContes.Id {
if wssCont.Id != 0 {
dempCont.Id = overallhandle.RecursionOrgLeve(wssCont.Id, 4)
}
}
if dempCont.Id == 0 {
dempCont.Id = myCont.MainDeparment
}
//公司
var compayCont models.AdministrativeOrganization
compayCont.GetCont(map[string]interface{}{"kingdeeid": v.Company}, "id")
if compayCont.Id == 0 {
compayCont.Id = myCont.Company
}
//职务
var postCont models.Position
postCont.GetCont(map[string]interface{}{"kingdeeid": v.Position}, "id")
if postCont.Id == 0 {
postCont.Id = myCont.Position
}
var creadCont models.InsideWorkHistory
creadCont.Key = manKeyNum //员工识别符"`
creadCont.Group = groupContes.Id //集团"`
creadCont.Company = compayCont.Id //公司"`
creadCont.Department = dempCont.Id // 部室"`
creadCont.WorkShop = WorkShop //二级部门或车间"`
creadCont.WorkshopSection = WorkshopSection //工段"`
creadCont.Position = postCont.Id //职位"`
creadCont.GradePositions = v.GradePositions //职等"`
startTime := time.Now().Unix()
if v.StartTime != "" {
var startTimeErr bool
startTime, startTimeErr = overallhandle.DateToTimeStamp(v.StartTime)
if !startTimeErr {
startTime, _ = overallhandle.DateToTimeStamp(fmt.Sprintf("%v 00:00:00", v.StartTime))
}
}
creadCont.StartTime = startTime //开始日期"`
state := 1
var endTime int64
if v.EndTime != "" {
if v.EndTime != "至今" && v.EndTime != "2199-12-31 00:00:00" && v.EndTime != "2199-12-31" && v.EndTime != "7258003200" {
var endTimeErr bool
endTime, endTimeErr = overallhandle.DateToTimeStamp(v.EndTime)
if !endTimeErr {
endTime, _ = overallhandle.DateToTimeStamp(fmt.Sprintf("%v 00:00:00", v.EndTime))
}
state = 2 //状态(1:启用;2:休眠;3:删除)"`
}
}
achangeTypeInted := changeTypeToInt(v.ChangeType)
if achangeTypeInted > 12 && achangeTypeInted <= 14 {
endTime = time.Now().Unix()
}
creadCont.EndTime = endTime //结束日期"`
creadCont.Team = myCont.TeamId //(1:长白;2:甲;3:乙;4:丙;5:丁)"`
creadCont.ChangeType = changeTypeToInt(v.ChangeType) // 变动类型(1:预入职;2:雇佣入职;3:转正;4:晋升;5:降级;6:职等调整;7:调动调入;8:跨公司调动调入;9:借调;10:平调;11:兼职;12:预离职;13:离职;14:退休;15:返聘;16:员工初始化;)"`
creadCont.Time = time.Now().Unix() //创建时间"`
creadCont.State = state //状态(1:启用;2:禁用;3:删除)"`
creadCont.AssignType = assignTypeToInt(v.AssignType) // 1、主职;2:兼职"`
creadContList = append(creadContList, creadCont)
}
if len(creadContList) > 0 {
overall.CONSTANT_DB_HR.Create(&creadContList)
}
}
}
/*
*
@ 作者: 秦东
@ 时间: 2023-06-16 09:40:31
@ 功能: 行政组织关系
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func (s *StaffApi) UserAboutOrgList(c *gin.Context) {
var requestData overallhandle.ConstId
err := c.ShouldBindJSON(&requestData)
if err != nil {
overallhandle.Result(100, err, c)
return
}
var workHistory []models.InsideWorkHistory
err = overall.CONSTANT_DB_HR.Where("`state` = 1 AND `end_time` = 0 AND `key` = ?", requestData.Id).Order("`assign_type` ASC").Order("`start_time` DESC").Find(&workHistory).Error
if err != nil {
overallhandle.Result(107, err, c)
return
}
var sendList []SendOrgAboutPeople
for i := 0; i < len(workHistory); i++ {
var orgList []int64
var orgNameList []string
if !overallhandle.IsInTrue[int64](workHistory[i].Company, orgList) {
orgList = append(orgList, workHistory[i].Company)
var orgOne models.AdministrativeOrganization
orgOne.GetCont(map[string]interface{}{"`id`": workHistory[i].Company}, "`name`")
orgNameList = append(orgNameList, orgOne.Name)
}
if !overallhandle.IsInTrue[int64](workHistory[i].Department, orgList) {
orgList = append(orgList, workHistory[i].Department)
var orgTwo models.AdministrativeOrganization
orgTwo.GetCont(map[string]interface{}{"`id`": workHistory[i].Department}, "`name`")
orgNameList = append(orgNameList, orgTwo.Name)
}
if !overallhandle.IsInTrue[int64](workHistory[i].WorkShop, orgList) {
orgList = append(orgList, workHistory[i].WorkShop)
var orgTree models.AdministrativeOrganization
orgTree.GetCont(map[string]interface{}{"`id`": workHistory[i].WorkShop}, "`name`")
orgNameList = append(orgNameList, orgTree.Name)
}
if !overallhandle.IsInTrue[int64](workHistory[i].WorkshopSection, orgList) {
orgList = append(orgList, workHistory[i].WorkshopSection)
var orgTree models.AdministrativeOrganization
orgTree.GetCont(map[string]interface{}{"`id`": workHistory[i].WorkshopSection}, "`name`")
orgNameList = append(orgNameList, orgTree.Name)
}
var sendCont SendOrgAboutPeople
sendCont.Id = workHistory[i].Id //
sendCont.Key = workHistory[i].Key //员工识别符"`
sendCont.Group = workHistory[i].Group //集团
sendCont.Company = workHistory[i].Company //公司"`
sendCont.Department = workHistory[i].Department //部室"`
sendCont.WorkShop = workHistory[i].WorkShop //:二级部门或车间"`
sendCont.WorkshopSection = workHistory[i].WorkshopSection //工段"`
sendCont.Position = workHistory[i].Position //职位"`
sendCont.GradePositions = workHistory[i].GradePositions //职等"`
sendCont.StartTime = workHistory[i].StartTime //开始日期"`
sendCont.EndTime = workHistory[i].EndTime //结束日期"`
sendCont.Team = workHistory[i].Team //班组(1:长白;2:甲;3:乙;4:丙;5:丁)"`
sendCont.ChangeType = workHistory[i].ChangeType //变动类型(1:预入职;2:雇佣入职;3:转正;4:晋升;5:降级;6:职等调整;7:调动调入;8:跨公司调动调入;9:借调;10:平调;11:兼职;12:预离职;13:离职;14:退休;15:返聘;16:员工初始化;)"`
sendCont.Time = workHistory[i].Time //创建时间"`
sendCont.State = workHistory[i].State //状态(1:启用;2:禁用;3:删除)"`
sendCont.AssignType = workHistory[i].AssignType //1、主职;2:兼职"`
sendCont.JobId = workHistory[i].JobId //职务"`
if workHistory[i].Position != 0 {
var postCont models.Position
postCont.GetCont(map[string]interface{}{"`id`": workHistory[i].Position}, "`name`")
if workHistory[i].GradePositions != 0 {
sendCont.PostName = fmt.Sprintf("%v级%v", workHistory[i].GradePositions, postCont.Name)
} else {
sendCont.PostName = postCont.Name
}
}
if len(orgNameList) > 0 {
sendCont.OrgAllName = strings.Join(orgNameList, " / ")
}
sendCont.StartTimeStr = overallhandle.UnixTimeToDay(workHistory[i].StartTime, 4)
if workHistory[i].EndTime == 0 {
sendCont.EndTimeStr = "至今"
} else {
sendCont.EndTimeStr = overallhandle.UnixTimeToDay(workHistory[i].EndTime, 4)
}
sendList = append(sendList, sendCont)
}
overallhandle.Result(0, sendList, c)
}

33
api/version1/personnelapi/kingdeenew.go

@ -297,7 +297,8 @@ func eidtAddManContJinDie(perArcInfo models.PersonArchives, manCont addKingdeePe
//编辑集团内工作履历 //编辑集团内工作履历
synPro.Add(1) synPro.Add(1)
// go editInsideWorkHistoryMan(perArcInfo.Key, manCont.InsideWorkHistory) // go editInsideWorkHistoryMan(perArcInfo.Key, manCont.InsideWorkHistory)
go editInsideWorkHistoryManNew(perArcInfo.Key, manCont.InsideWorkHistory) // go editInsideWorkHistoryManNew(perArcInfo.Key, manCont.InsideWorkHistory)
go EditWithinGroupWorkLog(perArcInfo.Key, manCont.InsideWorkHistory)
synPro.Wait() synPro.Wait()
return nil return nil
@ -500,7 +501,8 @@ func newAddManContJinDie(oldSchool models.WorkMan, manCont addKingdeePersonneles
//编辑集团内工作履历 //编辑集团内工作履历
synPro.Add(1) synPro.Add(1)
// go editInsideWorkHistoryMan(manKeyNum, manCont.InsideWorkHistory) // go editInsideWorkHistoryMan(manKeyNum, manCont.InsideWorkHistory)
go editInsideWorkHistoryManNew(manKeyNum, manCont.InsideWorkHistory) // go editInsideWorkHistoryManNew(manKeyNum, manCont.InsideWorkHistory)
go EditWithinGroupWorkLog(manKeyNum, manCont.InsideWorkHistory)
synPro.Wait() synPro.Wait()
} }
return nil return nil
@ -1135,6 +1137,8 @@ func educatExperKingdeeNew(manKeyNum int64, manCont addKingdeePersonneles) {
if entranceTime != perEduContHig.AdmissionTime { if entranceTime != perEduContHig.AdmissionTime {
eitdCont["admission_time"] = entranceTime eitdCont["admission_time"] = entranceTime
} }
} else {
eitdCont["admission_time"] = 0
} }
if manCont.HighestGraduationTime != "" { if manCont.HighestGraduationTime != "" {
graduationTime, graduationTimeErr := overallhandle.DateToTimeStamp(manCont.HighestGraduationTime) graduationTime, graduationTimeErr := overallhandle.DateToTimeStamp(manCont.HighestGraduationTime)
@ -1144,6 +1148,8 @@ func educatExperKingdeeNew(manKeyNum int64, manCont addKingdeePersonneles) {
if graduationTime != perEduContHig.GraduationTime { if graduationTime != perEduContHig.GraduationTime {
eitdCont["graduation_time"] = graduationTime eitdCont["graduation_time"] = graduationTime
} }
} else {
eitdCont["graduation_time"] = 0
} }
if len(eitdCont) > 0 { if len(eitdCont) > 0 {
eitdCont["Time"] = time.Now().Unix() eitdCont["Time"] = time.Now().Unix()
@ -1176,8 +1182,11 @@ func educatExperKingdeeNew(manKeyNum int64, manCont addKingdeePersonneles) {
if entranceTimeErr == false { if entranceTimeErr == false {
entranceTime, _ = overallhandle.DateToTimeStamp(fmt.Sprintf("%v 00:00:00", manCont.HighestAdmissionTime)) entranceTime, _ = overallhandle.DateToTimeStamp(fmt.Sprintf("%v 00:00:00", manCont.HighestAdmissionTime))
} }
}
perEduContHig.AdmissionTime = entranceTime // 入学时间"` perEduContHig.AdmissionTime = entranceTime // 入学时间"`
} else {
perEduContHig.AdmissionTime = 0 // 入学时间"`
}
graduationTime := time.Now().Unix() graduationTime := time.Now().Unix()
if manCont.HighestGraduationTime != "" { if manCont.HighestGraduationTime != "" {
graduationTimeErr := false graduationTimeErr := false
@ -1185,8 +1194,11 @@ func educatExperKingdeeNew(manKeyNum int64, manCont addKingdeePersonneles) {
if graduationTimeErr == false { if graduationTimeErr == false {
graduationTime, _ = overallhandle.DateToTimeStamp(fmt.Sprintf("%v 00:00:00", manCont.HighestGraduationTime)) graduationTime, _ = overallhandle.DateToTimeStamp(fmt.Sprintf("%v 00:00:00", manCont.HighestGraduationTime))
} }
}
perEduContHig.GraduationTime = graduationTime // 毕业时间"` perEduContHig.GraduationTime = graduationTime // 毕业时间"`
} else {
perEduContHig.GraduationTime = 0 // 毕业时间"`
}
perEduContHig.Time = time.Now().Unix() // 写入时间"` perEduContHig.Time = time.Now().Unix() // 写入时间"`
// highgree, _ := overallhandle.StringToInt(manCont.HighestAcademicDegree) // highgree, _ := overallhandle.StringToInt(manCont.HighestAcademicDegree)
highgree := hestacademicdegreeToInt(manCont.HighestAcademicDegree) highgree := hestacademicdegreeToInt(manCont.HighestAcademicDegree)
@ -1234,6 +1246,8 @@ func educatExperKingdeeNew(manKeyNum int64, manCont addKingdeePersonneles) {
if entranceTimeFirst != perEduContFirst.AdmissionTime { if entranceTimeFirst != perEduContFirst.AdmissionTime {
eitdContFirst["admission_time"] = entranceTimeFirst eitdContFirst["admission_time"] = entranceTimeFirst
} }
} else {
eitdContFirst["admission_time"] = 0
} }
if manCont.FirstGraduationTime != "" { if manCont.FirstGraduationTime != "" {
graduationTimeFirst, graduationTimeFirstErr := overallhandle.DateToTimeStamp(manCont.FirstGraduationTime) graduationTimeFirst, graduationTimeFirstErr := overallhandle.DateToTimeStamp(manCont.FirstGraduationTime)
@ -1243,6 +1257,8 @@ func educatExperKingdeeNew(manKeyNum int64, manCont addKingdeePersonneles) {
if graduationTimeFirst != perEduContFirst.GraduationTime { if graduationTimeFirst != perEduContFirst.GraduationTime {
eitdContFirst["graduation_time"] = graduationTimeFirst eitdContFirst["graduation_time"] = graduationTimeFirst
} }
} else {
eitdContFirst["graduation_time"] = 0
} }
if len(eitdContFirst) > 0 { if len(eitdContFirst) > 0 {
eitdContFirst["Time"] = time.Now().Unix() eitdContFirst["Time"] = time.Now().Unix()
@ -1275,8 +1291,11 @@ func educatExperKingdeeNew(manKeyNum int64, manCont addKingdeePersonneles) {
if entranceTimeFirstErr == false { if entranceTimeFirstErr == false {
entranceTimeFirst, _ = overallhandle.DateToTimeStamp(fmt.Sprintf("%v 00:00:00", manCont.HighestAdmissionTime)) entranceTimeFirst, _ = overallhandle.DateToTimeStamp(fmt.Sprintf("%v 00:00:00", manCont.HighestAdmissionTime))
} }
}
perEduContFirst.AdmissionTime = entranceTimeFirst // 入学时间"` perEduContFirst.AdmissionTime = entranceTimeFirst // 入学时间"`
} else {
perEduContFirst.AdmissionTime = 0 // 入学时间"`
}
graduationTimef := time.Now().Unix() graduationTimef := time.Now().Unix()
if manCont.FirstGraduationTime != "" { if manCont.FirstGraduationTime != "" {
graduationTimefErr := false graduationTimefErr := false
@ -1284,11 +1303,13 @@ func educatExperKingdeeNew(manKeyNum int64, manCont addKingdeePersonneles) {
if graduationTimefErr == false { if graduationTimefErr == false {
graduationTimef, _ = overallhandle.DateToTimeStamp(fmt.Sprintf("%v 00:00:00", manCont.FirstGraduationTime)) graduationTimef, _ = overallhandle.DateToTimeStamp(fmt.Sprintf("%v 00:00:00", manCont.FirstGraduationTime))
} }
perEduContFirst.GraduationTime = graduationTimef // 毕业时间"`
} else {
perEduContFirst.GraduationTime = 0 // 毕业时间"`
} }
// fmt.Printf("第一学历------>%v------>%v\n", graduationTimef, manCont.FirstGraduationTime) // fmt.Printf("第一学历------>%v------>%v\n", graduationTimef, manCont.FirstGraduationTime)
perEduContFirst.GraduationTime = graduationTimef // 毕业时间"`
perEduContFirst.Time = time.Now().Unix() // 写入时间"` perEduContFirst.Time = time.Now().Unix() // 写入时间"`
// fitAcmicDgree, _ := overallhandle.StringToInt(manCont.FirstAcademicDegree) // fitAcmicDgree, _ := overallhandle.StringToInt(manCont.FirstAcademicDegree)
fitAcmicDgree := hestacademicdegreeToInt(manCont.FirstAcademicDegree) fitAcmicDgree := hestacademicdegreeToInt(manCont.FirstAcademicDegree)

7
api/version1/personnelapi/mancont.go

@ -241,11 +241,13 @@ func (s *StaffApi) EditManMainCont(c *gin.Context) {
if requestData.Isveterans == 0 { if requestData.Isveterans == 0 {
requestData.Isveterans = 2 requestData.Isveterans = 2
} }
/*
查询主信息
*/
wheAry := overallhandle.MapOut() wheAry := overallhandle.MapOut()
wheAry["`id`"] = requestData.Id wheAry["`id`"] = requestData.Id
var myCont models.PersonArchives var myCont models.PersonArchives
err := myCont.GetCont(wheAry, "`key`", "`number`") err := myCont.GetCont(wheAry, "`key`", "`number`", "`wechat`", "`work_wechat`", "`hire_class`", "`emp_type`")
if err != nil { if err != nil {
overallhandle.Result(1, err, c, "该人员不存在!请核对后再提交!") overallhandle.Result(1, err, c, "该人员不存在!请核对后再提交!")
return return
@ -270,6 +272,7 @@ func (s *StaffApi) EditManMainCont(c *gin.Context) {
} }
wheAryEs := overallhandle.MapOut() wheAryEs := overallhandle.MapOut()
wheAryEs["`key`"] = myCont.Key wheAryEs["`key`"] = myCont.Key
var myInfo models.PersonnelContent var myInfo models.PersonnelContent
err = myInfo.GetCont(wheAryEs) err = myInfo.GetCont(wheAryEs)
if err != nil { if err != nil {

4
api/version1/personnelapi/staff.go

@ -1453,8 +1453,8 @@ func (s *StaffApi) EditPassWord(c *gin.Context) {
//判断工号是存在 //判断工号是存在
whereAry := overallhandle.MapOut() whereAry := overallhandle.MapOut()
whereAry["`key`"] = requestData.Id whereAry["`key`"] = requestData.Id
if judgeNoErr := staffInfo.GetCont(whereAry, "`key`"); judgeNoErr == nil { if judgeNoErr := staffInfo.GetCont(whereAry, "`key`"); judgeNoErr != nil {
overallhandle.Result(1, requestData, c, "该工号已经被使用!请不要重复使用!") overallhandle.Result(107, requestData, c)
return return
} }
//密码加密 //密码加密

199
api/version1/personnelapi/staffarchives.go

@ -909,6 +909,7 @@ func (s *StaffApi) AddEducationalExperience(c *gin.Context) {
eduCation = 1 eduCation = 1
} }
emerContCont.Education = eduCation emerContCont.Education = eduCation
emerContCont.EducationCn = overallhandle.DucationToInt(eduCation)
emerContCont.GraduationSchool = v.GraduationSchool emerContCont.GraduationSchool = v.GraduationSchool
emerContCont.Subject = v.Subject emerContCont.Subject = v.Subject
entranceTimeFirst := time.Now().Unix() entranceTimeFirst := time.Now().Unix()
@ -927,6 +928,18 @@ func (s *StaffApi) AddEducationalExperience(c *gin.Context) {
acaLeve = 1 acaLeve = 1
} }
emerContCont.AcademicDegree = acaLeve emerContCont.AcademicDegree = acaLeve
switch acaLeve {
case 2:
emerContCont.AcademicDegreeCn = "学士"
case 3:
emerContCont.AcademicDegreeCn = "硕士"
case 4:
emerContCont.AcademicDegreeCn = "博士"
case 5:
emerContCont.AcademicDegreeCn = "教育学学位"
default:
emerContCont.AcademicDegreeCn = "无"
}
emerContCont.Time = time.Now().Unix() //创建时间"` emerContCont.Time = time.Now().Unix() //创建时间"`
emerContCont.State = 1 //状态(1:启用;2:禁用;3:删除)"` emerContCont.State = 1 //状态(1:启用;2:禁用;3:删除)"`
emerContCont.Key = keyInt // emerContCont.Key = keyInt //
@ -986,6 +999,7 @@ func (s *StaffApi) EditEducationalExperience(c *gin.Context) {
} }
if requestData.Education != 0 && requestData.Education != enerCont.Education { if requestData.Education != 0 && requestData.Education != enerCont.Education {
saveData["education"] = requestData.Education saveData["education"] = requestData.Education
saveData["education_cn"] = overallhandle.DucationToInt(requestData.Education)
} }
if requestData.AdmissionTime != "" { if requestData.AdmissionTime != "" {
@ -1006,6 +1020,19 @@ func (s *StaffApi) EditEducationalExperience(c *gin.Context) {
acaLeve, _ := strconv.Atoi(requestData.AcademicDegree) acaLeve, _ := strconv.Atoi(requestData.AcademicDegree)
if acaLeve != enerCont.AcademicDegree { if acaLeve != enerCont.AcademicDegree {
saveData["academic_degree"] = acaLeve saveData["academic_degree"] = acaLeve
switch acaLeve {
case 2:
saveData["academic_degree_cn"] = "学士"
case 3:
saveData["academic_degree_cn"] = "硕士"
case 4:
saveData["academic_degree_cn"] = "博士"
case 5:
saveData["academic_degree_cn"] = "教育学学位"
default:
saveData["academic_degree_cn"] = "无"
}
} }
} }
@ -1368,7 +1395,7 @@ func (s *StaffApi) AddInsideHistory(c *gin.Context) {
if requestData.EndTime != "" && requestData.EndTime != "0" && requestData.EndTime != "至今" { if requestData.EndTime != "" && requestData.EndTime != "0" && requestData.EndTime != "至今" {
endTime, endErr := overallhandle.DateToTimeStamp(fmt.Sprintf("%v 00:00:00", requestData.EndTime)) endTime, endErr := overallhandle.DateToTimeStamp(fmt.Sprintf("%v 00:00:00", requestData.EndTime))
if endErr == true { if endErr == true {
insiderHistoryWork.StartTime = endTime insiderHistoryWork.EndTime = endTime
} }
} }
teamIdInt, _ := strconv.ParseInt(requestData.Team, 10, 64) teamIdInt, _ := strconv.ParseInt(requestData.Team, 10, 64)
@ -1377,6 +1404,8 @@ func (s *StaffApi) AddInsideHistory(c *gin.Context) {
insiderHistoryWork.Time = time.Now().Unix() insiderHistoryWork.Time = time.Now().Unix()
insiderHistoryWork.State = 1 insiderHistoryWork.State = 1
insiderHistoryWork.AssignType = requestData.AssignType insiderHistoryWork.AssignType = requestData.AssignType
jobIdInt, _ := strconv.ParseInt(requestData.JobId, 10, 64)
insiderHistoryWork.JobId = jobIdInt
addErr := overall.CONSTANT_DB_HR.Create(&insiderHistoryWork).Error addErr := overall.CONSTANT_DB_HR.Create(&insiderHistoryWork).Error
if addErr != nil { if addErr != nil {
overallhandle.Result(104, addErr, c) overallhandle.Result(104, addErr, c)
@ -1627,8 +1656,15 @@ func (s *StaffApi) PersonnelEducationList(c *gin.Context) {
cont.State = v.State // 状态(1:启用;2:禁用;3:删除)"` cont.State = v.State // 状态(1:启用;2:禁用;3:删除)"`
cont.AcademicDegreeCn = v.AcademicDegreeCn //学位中文说明"` cont.AcademicDegreeCn = v.AcademicDegreeCn //学位中文说明"`
cont.EducationCn = v.EducationCn //学历中文说明"` cont.EducationCn = v.EducationCn //学历中文说明"`
if v.AdmissionTime != 0 {
cont.AdmissionTimeStr = overallhandle.UnixTimeToDay(v.AdmissionTime, 14) cont.AdmissionTimeStr = overallhandle.UnixTimeToDay(v.AdmissionTime, 14)
}
if v.GraduationTime != 0 {
cont.GraduationTimeStr = overallhandle.UnixTimeToDay(v.GraduationTime, 14) cont.GraduationTimeStr = overallhandle.UnixTimeToDay(v.GraduationTime, 14)
} else {
cont.GraduationTimeStr = "至今"
}
list = append(list, cont) list = append(list, cont)
} }
overallhandle.Result(0, list, c) overallhandle.Result(0, list, c)
@ -1772,6 +1808,15 @@ func (s *StaffApi) WeChatGiveUsCont(c *gin.Context) {
redisClient := grocerystore.RunRedis(overall.CONSTANT_REDIS5) redisClient := grocerystore.RunRedis(overall.CONSTANT_REDIS5)
redisClient.SetRedisTime(10800) redisClient.SetRedisTime(10800)
redisClient.HashMsetAdd(redisFileKey, writeRedisData) redisClient.HashMsetAdd(redisFileKey, writeRedisData)
groupId, companyId, departmentId, sunDepartId, workShopId := overallhandle.GetOrgStructure(userCont.AdminOrg)
fmt.Printf("groupId----->%v\ncompanyId----->%v\ndepartmentId----->%v\nsunDepartId----->%v\nworkShopId----->%v\n", groupId, companyId, departmentId, sunDepartId, workShopId)
var sunmaindeparment int64
if companyId != sunDepartId {
sunmaindeparment = sunDepartId
}
//缓存写入个人信息 //缓存写入个人信息
redisMyContKey := fmt.Sprintf("ScanCode:Authentication:UserCont_%v_%v", overall.CONSTANT_CONFIG.RedisPrefixStr.Alias, userCont.Number) redisMyContKey := fmt.Sprintf("ScanCode:Authentication:UserCont_%v_%v", overall.CONSTANT_CONFIG.RedisPrefixStr.Alias, userCont.Number)
myCont := overallhandle.MapOut() myCont := overallhandle.MapOut()
@ -1782,8 +1827,11 @@ func (s *StaffApi) WeChatGiveUsCont(c *gin.Context) {
myCont["hireclass"] = userCont.HireClass //雇佣类型(1:雇佣入职;2:再入职;) 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["emptype"] = userCont.EmpType //用工关系(1:临时工 , 2:编外人员 ;3:实习&实习生;4:试用员工;5:待分配;6:待岗;7:临时调入;8:正式员工;9:长期病假;10:停薪留职;11:退休;12:辞职;13:辞退;14:离职)
myCont["company"] = userCont.Company //入职公司 myCont["company"] = userCont.Company //入职公司
myCont["maindeparment"] = userCont.MainDeparment //主部门 // myCont["maindeparment"] = userCont.MainDeparment //主部门
myCont["sunmaindeparment"] = userCont.SunMainDeparment //二级主部门 // myCont["sunmaindeparment"] = userCont.SunMainDeparment //二级主部门
myCont["maindeparment"] = companyId //主部门
myCont["sunmaindeparment"] = sunmaindeparment //二级主部门
myCont["deparment"] = userCont.Deparment //部门 myCont["deparment"] = userCont.Deparment //部门
myCont["adminorg"] = userCont.AdminOrg //所属行政组织 myCont["adminorg"] = userCont.AdminOrg //所属行政组织
myCont["teamid"] = userCont.TeamId //班组 myCont["teamid"] = userCont.TeamId //班组
@ -1826,7 +1874,16 @@ func (s *StaffApi) WeChatGiveUsCont(c *gin.Context) {
myCont["political_outlook"] = userCont.PoliticalOutlook //政治面貌(1:群众;2:无党派;3:台盟会员;4:九三社员;5:致公党员;6:农工党员;7:民进会员;8:民建会员;9:民盟盟员;10:民革会员,11:共青团员;12:预备党员;13:中共党员) myCont["political_outlook"] = userCont.PoliticalOutlook //政治面貌(1:群众;2:无党派;3:台盟会员;4:九三社员;5:致公党员;6:农工党员;7:民进会员;8:民建会员;9:民盟盟员;10:民革会员,11:共青团员;12:预备党员;13:中共党员)
redisClient.HashMsetAdd(redisMyContKey, myCont) redisClient.HashMsetAdd(redisMyContKey, myCont)
// fmt.Printf("redisMyContKey------Login----->%v\n", redisMyContKey) var sendKpiCont WriteIderCont
sendKpiCont.Openid = requestData.OpenId
sendKpiCont.Key = userKeyCode
sendKpiCont.Token = sha1Token
sendKpiCont.UserInfo.Key = strconv.FormatInt(userCont.Key, 10)
sendKpiCont.UserInfo.Number = userCont.Number
sendKpiCont.UserInfo.Password = userCont.Password
sendDate, _ := json.Marshal(sendKpiCont)
sdff := overallhandle.CurlPostJosn("http://kpi.hxgk.group/kpiapi/empower/write_token", sendDate)
fmt.Printf("redisMyContKey------Login----->%v----->%v\n", string(sdff), string(sendDate))
overallhandle.Result(0, saveData, c) overallhandle.Result(0, saveData, c)
// return // return
@ -2175,6 +2232,7 @@ func (s *StaffApi) GetArchivesCon(c *gin.Context) {
ruleCont.GetCont(map[string]interface{}{"`id`": satffCont.Ruleid}, "`name`") ruleCont.GetCont(map[string]interface{}{"`id`": satffCont.Ruleid}, "`name`")
staffCenter.RuleId = strconv.FormatInt(satffCont.Ruleid, 10) staffCenter.RuleId = strconv.FormatInt(satffCont.Ruleid, 10)
staffCenter.RuleName = ruleCont.Name staffCenter.RuleName = ruleCont.Name
staffCenter.KeyStr = strconv.FormatInt(satffCont.Key, 10)
if satffCont.ResponsibleDepartmentJson != "" { if satffCont.ResponsibleDepartmentJson != "" {
jsonErr := json.Unmarshal([]byte(satffCont.ResponsibleDepartmentJson), &staffCenter.OrgresList) jsonErr := json.Unmarshal([]byte(satffCont.ResponsibleDepartmentJson), &staffCenter.OrgresList)
fmt.Printf("satffCont---------->%v---------->%v---------->%v\n", satffCont.ResponsibleDepartmentJson, satffCont, jsonErr) fmt.Printf("satffCont---------->%v---------->%v---------->%v\n", satffCont.ResponsibleDepartmentJson, satffCont, jsonErr)
@ -2717,10 +2775,13 @@ func (s *StaffApi) ArchivesListWai(c *gin.Context) {
if requestData.Position != 0 { if requestData.Position != 0 {
gormDb = gormDb.Where("position = ?", requestData.Position) gormDb = gormDb.Where("position = ?", requestData.Position)
} }
// if requestData.EmpType != 0 {
// gormDb = gormDb.Where("emp_type = ?", requestData.EmpType)
// } else {
// gormDb = gormDb.Where("emp_type BETWEEN ? AND ?", 1, 10)
// }
if requestData.EmpType != 0 { if requestData.EmpType != 0 {
gormDb = gormDb.Where("emp_type = ?", requestData.EmpType) gormDb = gormDb.Where("emp_type = ?", requestData.EmpType)
} else {
gormDb = gormDb.Where("emp_type BETWEEN ? AND ?", 1, 10)
} }
if requestData.Role != "" { if requestData.Role != "" {
gormDb = gormDb.Where("FIND_IN_SET(?,`role`)", requestData.Role) gormDb = gormDb.Where("FIND_IN_SET(?,`role`)", requestData.Role)
@ -2813,3 +2874,129 @@ func (s *StaffApi) ArchivesListWai(c *gin.Context) {
overallhandle.ResultList(0, requestData.Page, requestData.PageSize, total, int64(len(positionAry)), positionAry, c) overallhandle.ResultList(0, requestData.Page, requestData.PageSize, total, int64(len(positionAry)), positionAry, c)
} }
} }
/*
*
@ 作者: 秦东
@ 时间: 2023-06-14 13:34:27
@ 功能: 人员档案列表
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func (s *StaffApi) ArchivesListCont(c *gin.Context) {
var requestData ArchivesSearch
c.ShouldBindJSON(&requestData)
if requestData.Page < 0 {
requestData.Page = 1
}
if requestData.PageSize < 0 {
requestData.PageSize = 10
}
if requestData.Right == 0 {
requestData.Right = 1
}
gormDb := overall.CONSTANT_DB_HR.Model(&models.PersonArchives{}).Select("`id`").Where("`number` NOT LIKE ?", "%W%")
if requestData.KeyWords != "" {
gormDb = gormDb.Where("number LIKE ? OR name LIKE ?", "%"+requestData.KeyWords+"%", "%"+requestData.KeyWords+"%")
}
if requestData.AdminOrg != 0 {
var sunAry overallhandle.AllSunList[int64]
sunAry.GetAllSunOrg(requestData.AdminOrg)
sunAry.SunList = append(sunAry.SunList, requestData.AdminOrg)
gormDb = gormDb.Where("admin_org IN ?", sunAry.SunList)
}
if len(requestData.Emptype) > 0 {
gormDb = gormDb.Where("emp_type IN ?", requestData.Emptype)
} else {
if requestData.Right != 1 {
gormDb = gormDb.Where("emp_type BETWEEN ? AND ?", 11, 14)
} else {
gormDb = gormDb.Where("emp_type BETWEEN ? AND ?", 1, 10)
}
}
var total int64
totalErr := gormDb.Count(&total).Error
if totalErr != nil {
total = 0
}
var idAry []int64
err := gormDb.Order("company ASC,maindeparment ASC,admin_org ASC,position ASC").Limit(requestData.PageSize).Offset(overallhandle.LimitPage(requestData.Page, requestData.PageSize)).Find(&idAry).Error
var positionAry []peopleManOutList
if err != nil {
overallhandle.ResultList(0, requestData.Page, requestData.PageSize, total, int64(len(positionAry)), positionAry, c)
return
}
var manContList []models.ManCont
err = overall.CONSTANT_DB_HR.Where("`id` IN ?", idAry).Find(&manContList).Error
if err != nil {
overallhandle.ResultList(0, requestData.Page, requestData.PageSize, total, int64(len(positionAry)), positionAry, c)
return
}
for _, v := range manContList {
var staffInfo peopleManOutList
staffInfo.ManCont = v
var getSpur models.Position
getWhe := overallhandle.MapOut()
getWhe["id"] = v.Position
getSpur.GetCont(getWhe, "name", "person_in_charge")
staffInfo.PositionName = getSpur.Name
// staffInfo.PersonInCharge = getSpur.PersonInCharge
staffInfo.KeyStr = strconv.FormatInt(v.Key, 10)
//公司
if v.Company != 0 {
var getSpurDepart models.AdministrativeOrganization
getWheDepart := overallhandle.MapOut()
getWheDepart["id"] = v.Company
getSpurDepart.GetCont(getWheDepart, "name")
staffInfo.CompanyName = getSpurDepart.Name
}
//主部门
if v.MainDeparment != 0 {
var getSpurDepartMain models.AdministrativeOrganization
getWheDepartMain := overallhandle.MapOut()
getWheDepartMain["id"] = v.MainDeparment
getSpurDepartMain.GetCont(getWheDepartMain, "name")
staffInfo.MainDeparmentName = getSpurDepartMain.Name
}
//二级著部门
if v.SunMainDeparment != 0 {
var sunMainDepart models.AdministrativeOrganization
sunMainDepart.GetCont(map[string]interface{}{"`id`": v.SunMainDeparment}, "`name`")
staffInfo.SunMainDeparmentName = sunMainDepart.Name
}
var orgContTypeCont models.OrgContType
orgContTypeCont.GetCont(map[string]interface{}{"`id`": v.AdminOrg}, "`name`", "`level`")
if orgContTypeCont.Level >= 6 {
staffInfo.WorkPostName = orgContTypeCont.Name
}
staffInfo.PersonInCharge = 2
if v.PersonInCharge == 1 {
orgResList := strings.Split(v.ResponsibleDepartment, ",")
if len(orgResList) > 0 {
orgIdStr := strconv.FormatInt(requestData.AdminOrg, 10)
if overallhandle.IsInTrue[string](orgIdStr, orgResList) == true {
staffInfo.PersonInCharge = 1
}
}
}
positionAry = append(positionAry, staffInfo)
}
overallhandle.ResultList(0, requestData.Page, requestData.PageSize, total, int64(len(positionAry)), positionAry, c)
}

34
api/version1/personnelapi/type.go

@ -288,6 +288,7 @@ type addKingdeePersonnel struct {
// 人员档案详情 // 人员档案详情
type staffArchivesCont struct { type staffArchivesCont struct {
models.ManCont models.ManCont
KeyStr string `json:"keystr"` //唯一标识符
BirthdayTime string `json:"birthdaytime"` //生日 BirthdayTime string `json:"birthdaytime"` //生日
IdCardStartTimeData string `json:"idcardstarttimedata"` //身份证有效期开始时间 IdCardStartTimeData string `json:"idcardstarttimedata"` //身份证有效期开始时间
IdCardEndTimeData string `json:"idcardendtimedata"` //身份证有效期结束时间 IdCardEndTimeData string `json:"idcardendtimedata"` //身份证有效期结束时间
@ -541,3 +542,36 @@ type passwordCont struct {
Password string `json:"password"` //密码1 v Password string `json:"password"` //密码1 v
ConfirmPassword string `json:"confirmPassword"` // v ConfirmPassword string `json:"confirmPassword"` // v
} }
// 写入身份认证
type WriteIderCont struct {
Openid string `json:"openid"`
Key string `json:"key"`
Token string `json:"token"`
UserInfo UserInfoCont `json:"userinfo"`
}
// 人员信息
type UserInfoCont struct {
Number string `json:"number"`
Password string `json:"password"`
Key string `json:"key"`
}
// 档案列表参数
type ArchivesSearch struct {
overallhandle.PageTurning
KeyWords string `json:"keywords"` //关键字
AdminOrg int64 `json:"adminorg"` //行政组织
Emptype []int `json:"emptype"` //用工关系
Right int `json:"right"` //显示正常
}
// 输出行政组织关系
type SendOrgAboutPeople struct {
models.InsideWorkHistory
OrgAllName string `json:"orgallname"` //
PostName string `json:"postname"` //
StartTimeStr string `json:"starttimeing"` //
EndTimeStr string `json:"endtimeing"` //
}

1
api/version1/personnelapi/types.go

@ -202,6 +202,7 @@ type EditOrgPeople struct {
//编辑人员主体信息 //编辑人员主体信息
type EditContData struct { type EditContData struct {
Id string `json:"id"` Id string `json:"id"`
Name string `json:"name"` //姓名
Mobilephone string `json:"mobilephone"` //手机号码 Mobilephone string `json:"mobilephone"` //手机号码
Idcardno string `json:"idcardno"` //身份证号 Idcardno string `json:"idcardno"` //身份证号
Entrydatetime string `json:"entrydatetime"` //入职日期 Entrydatetime string `json:"entrydatetime"` //入职日期

166
api/version1/shiyan/shiyan.go

@ -4,7 +4,7 @@ import (
"fmt" "fmt"
"hr_server/api/jindie_docking/dockingorganization" "hr_server/api/jindie_docking/dockingorganization"
"hr_server/api/version1/personnelapi" "hr_server/api/version1/personnelapi"
"hr_server/middleware/snowflake" "hr_server/grocerystore"
"hr_server/models" "hr_server/models"
"hr_server/overall" "hr_server/overall"
"hr_server/overall/overallhandle" "hr_server/overall/overallhandle"
@ -294,14 +294,23 @@ func (s *ShiYan) Shitu(c *gin.Context) {
// var shituList []ShituType // var shituList []ShituType
// err := overall.CONSTANT_DB_HR.Limit(20).Offset(21).Find(&shituList) // err := overall.CONSTANT_DB_HR.Limit(20).Offset(21).Find(&shituList)
// fmt.Printf("%v-----------%v\n", err, shituList) // fmt.Printf("%v-----------%v\n", err, shituList)
var req Sdfg
c.ShouldBindJSON(&req)
out := overallhandle.MapOut() out := overallhandle.MapOut()
node, err := snowflake.NewWorker(1) groupId, companyId, departmentId, sunDepartId, workShopId := overallhandle.GetOrgStructure(req.Id)
fmt.Printf("node--------->%v\n", err) sdee := overallhandle.RecursionOrgLeve(req.Id, 3)
// node, err := snowflake.NewWorker(1)
// fmt.Printf("node--------->%v\n", err)
out["node"] = node.GetId() // out["node"] = node.GetId()
out["err "] = err // 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) overallhandle.Result(0, out, c)
} }
@ -425,3 +434,148 @@ func (s *ShiYan) HandMovementOrgCont(c *gin.Context) {
func (s *ShiYan) HandMovementPostCont(c *gin.Context) { func (s *ShiYan) HandMovementPostCont(c *gin.Context) {
dockingorganization.Position() 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)
}

31
api/version1/shiyan/type.go

@ -10,10 +10,10 @@ import (
var synPro = sync.WaitGroup{} var synPro = sync.WaitGroup{}
//人员API // 人员API
type ShiYan struct{} type ShiYan struct{}
//入口 // 入口
func (s *ShiYan) Index(c *gin.Context) { func (s *ShiYan) Index(c *gin.Context) {
outputCont := overallhandle.MapOut() outputCont := overallhandle.MapOut()
outputCont["index"] = "实验API" outputCont["index"] = "实验API"
@ -25,12 +25,12 @@ type Jieshou struct {
ProbationPeriod int `json:"probationperiod"` //试用期(月) ProbationPeriod int `json:"probationperiod"` //试用期(月)
} }
//输出知行学院的人员信息 // 输出知行学院的人员信息
type schoolUser struct { type schoolUser struct {
models.WorkMan models.WorkMan
} }
//输出迁移组织架构 // 输出迁移组织架构
type outOrgCont struct { type outOrgCont struct {
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"`
Superior int64 `json:"superior" gorm:"column:superior;type:bigint(20) unsigned;default:0;not null;comment:上级ID"` Superior int64 `json:"superior" gorm:"column:superior;type:bigint(20) unsigned;default:0;not null;comment:上级ID"`
@ -43,14 +43,14 @@ type peopleQianyi struct {
mutext sync.RWMutex mutext sync.RWMutex
} }
//读取锁数据 // 读取锁数据
func (d *peopleQianyi) readMyDayData() ([]models.Personnel, []models.PersonnelContent) { func (d *peopleQianyi) readMyDayData() ([]models.Personnel, []models.PersonnelContent) {
d.mutext.RLock() d.mutext.RLock()
defer d.mutext.RUnlock() defer d.mutext.RUnlock()
return d.dataMap, d.userAll return d.dataMap, d.userAll
} }
//职务相关 // 职务相关
type jobAttber struct { type jobAttber struct {
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"`
Number string `json:"number" gorm:"column:number;type:varchar(255) unsigned;default:'';not null;comment:编号"` Number string `json:"number" gorm:"column:number;type:varchar(255) unsigned;default:'';not null;comment:编号"`
@ -76,3 +76,22 @@ type ShituType struct {
func (ShituType *ShituType) TableName() string { func (ShituType *ShituType) TableName() string {
return "orglist" return "orglist"
} }
// 写入身份认证
type WriteIderCont struct {
Openid string `json:"openid"`
Key string `json:"key"`
Token string `json:"token"`
UserInfo UserInfoCont `json:"userinfo"`
}
// 人员信息
type UserInfoCont struct {
Number string `json:"number"`
Password string `json:"password"`
Key string `json:"key"`
}
type Sdfg struct {
Id int64 `json:"id"`
}

19
apirouter/organization/organization_group.go

@ -18,30 +18,41 @@ func (o *OrganizationRoute) InitRouterGroup(route *gin.RouterGroup) {
apiRouter.POST("utiesclasslist", apiHandle.DutiesClassList) //职务分类列表 apiRouter.POST("utiesclasslist", apiHandle.DutiesClassList) //职务分类列表
apiRouter.POST("getutiesclassinfo", apiHandle.GetDutiesClassInfo) //获取职务分类详情 apiRouter.POST("getutiesclassinfo", apiHandle.GetDutiesClassInfo) //获取职务分类详情
apiRouter.POST("eiteutiesclassinfo", apiHandle.EiteDutiesClassInfo) //修改职务分类详情 apiRouter.POST("eiteutiesclassinfo", apiHandle.EiteDutiesClassInfo) //修改职务分类详情
apiRouter.POST("neweiteutiesclassinfo", apiHandle.NewEiteDutiesClassInfo) //修改职务分类详情(新)
apiRouter.POST("delutiesclassinfo", apiHandle.DelDutiesClassInfo) //删除职务分类 apiRouter.POST("delutiesclassinfo", apiHandle.DelDutiesClassInfo) //删除职务分类
apiRouter.POST("editdutiesclassstatus", apiHandle.EditDutiesClassStatus) //编辑职务分类状态或删除
//职务路由 //职务路由
apiRouter.POST("dutieslist", apiHandle.DutiesList) //职务列表 apiRouter.POST("dutieslist", apiHandle.DutiesList) //职务列表
apiRouter.POST("getdutiescont", apiHandle.GetDutiesCont) //获取职务详情 apiRouter.POST("getdutiescont", apiHandle.GetDutiesCont) //获取职务详情
apiRouter.POST("adddutiescont", apiHandle.AddDutiesCont) //添加职务 apiRouter.POST("adddutiescont", apiHandle.AddDutiesCont) //添加职务
apiRouter.POST("eitedutiescont", apiHandle.EiteDutiesInfo) //编辑职务 apiRouter.POST("eitedutiescont", apiHandle.EiteDutiesInfo) //编辑职务
apiRouter.POST("eitedutiesstatordel", apiHandle.EiteDutiesStatOrDel) //编辑职务状态或删除 apiRouter.POST("eitedutiesstatordel", apiHandle.EiteDutiesStatOrDel) //编辑职务状态或删除
apiRouter.POST("editordeldutiesstatus", apiHandle.EditOrDelDutiesStatus) //编辑状态或删除职务信息
//行政组织类型 //行政组织类型
apiRouter.POST("govclasslist", apiHandle.GovClassList) //行政组织类型列表 apiRouter.POST("govclasslist", apiHandle.GovClassList) //行政组织类型列表
apiRouter.POST("govclassalllist", apiHandle.GovClassAllList) //行政组织类型列表(全)
apiRouter.POST("getgovclasscont", apiHandle.GetGovClassCont) //获取行政组织类型 apiRouter.POST("getgovclasscont", apiHandle.GetGovClassCont) //获取行政组织类型
apiRouter.POST("addgovclass", apiHandle.AddGovClass) //添加行政组织类型 apiRouter.POST("addgovclass", apiHandle.AddGovClass) //添加行政组织类型
apiRouter.POST("eitegovclasscont", apiHandle.EiteGovClassCont) //编辑行政组织类型 apiRouter.POST("eitegovclasscont", apiHandle.EiteGovClassCont) //编辑行政组织类型
apiRouter.POST("eitegovclassstateordel", apiHandle.EiteGovClassStateOrDel) //编辑行政组织类型状态或删除 apiRouter.POST("eitegovclassstateordel", apiHandle.EiteGovClassStateOrDel) //编辑行政组织类型状态或删除
apiRouter.POST("base_edit_orgclass_status", apiHandle.BaseEditOrgClassStatus) //批量编辑组织分类状态或删除
//行政组织 //行政组织
apiRouter.POST("govlist", apiHandle.GovList) //行政组织列表 apiRouter.POST("govlist", apiHandle.GovList) //行政组织列表
apiRouter.POST("getgovcont", apiHandle.GetGovCont) //获取行政组织 apiRouter.POST("getgovcont", apiHandle.GetGovCont) //获取行政组织
apiRouter.POST("addgovcont", apiHandle.AddGovCont) //添加行政组织 apiRouter.POST("addgovcont", apiHandle.AddGovCont) //添加行政组织
apiRouter.POST("eitegovcont", apiHandle.EiteGovCont) //编辑行政组织 apiRouter.POST("eitegovcont", apiHandle.EiteGovCont) //编辑行政组织
apiRouter.POST("neweitegovcont", apiHandle.NewEiteGovCont) //编辑行政组织(新)
apiRouter.POST("eitegovstateordel", apiHandle.EiteGovStateOrDel) //编辑行政组织状态或删除 apiRouter.POST("eitegovstateordel", apiHandle.EiteGovStateOrDel) //编辑行政组织状态或删除
apiRouter.POST("neweitegovstateordel", apiHandle.NewEiteGovStateOrDel) //编辑行政组织状态或删除(新)
apiRouter.POST("newaddgovcont", apiHandle.NewAddGovCont) //添加行政组织
apiRouter.POST("govthree", apiHandle.GovThree) //行政组织树 apiRouter.POST("govthree", apiHandle.GovThree) //行政组织树
apiRouter.POST("govthreeing", apiHandle.GovThreeIng) //行政组织树(副本) apiRouter.POST("govthreeing", apiHandle.GovThreeIng) //行政组织树(副本)
apiRouter.POST("getorgallsun", apiHandle.GetOrgAllSun) //获取当前行政组织的所有子类 apiRouter.POST("getorgallsun", apiHandle.GetOrgAllSun) //获取当前行政组织的所有子类
apiRouter.POST("govnewthreeing", apiHandle.GovNewThreeIng) //行政组织树(新副本)
apiRouter.POST("govthreeaboutman", apiHandle.GovThreeAboutMan) //行政组织树及相关人员 apiRouter.POST("govthreeaboutman", apiHandle.GovThreeAboutMan) //行政组织树及相关人员
apiRouter.POST("search_org_people", apiHandle.SearchOrgAndPeople) //角色组织与人员搜索列表 apiRouter.POST("search_org_people", apiHandle.SearchOrgAndPeople) //角色组织与人员搜索列表
@ -52,6 +63,7 @@ func (o *OrganizationRoute) InitRouterGroup(route *gin.RouterGroup) {
apiRouter.POST("getcompanydeparment", apiHandle.GetCompanyDeparment) //获取当前行政组织的所有主行政部门 apiRouter.POST("getcompanydeparment", apiHandle.GetCompanyDeparment) //获取当前行政组织的所有主行政部门
apiRouter.POST("basis_org_obtain_sonorg_and_man", apiHandle.BasisOrgObtainSonOrgAndMan) //根据行政组织编号获取组织及人员 apiRouter.POST("basis_org_obtain_sonorg_and_man", apiHandle.BasisOrgObtainSonOrgAndMan) //根据行政组织编号获取组织及人员
apiRouter.POST("basis_org_all_people", apiHandle.BasisOrgAllPeople) //根据行政组织编号获取全部人员
apiRouter.POST("getappointorg", apiHandle.GetAppointOrg) //获取指定行政组织列表 apiRouter.POST("getappointorg", apiHandle.GetAppointOrg) //获取指定行政组织列表
//职位(岗位) //职位(岗位)
@ -67,6 +79,9 @@ func (o *OrganizationRoute) InitRouterGroup(route *gin.RouterGroup) {
apiRouter.POST("basis_org_postList", apiHandle.BasisOrgGetPostList) //根据行政组织获取岗位 apiRouter.POST("basis_org_postList", apiHandle.BasisOrgGetPostList) //根据行政组织获取岗位
apiRouter.POST("addpositioncontnew", apiHandle.AddPositionContNew) //添加职位(岗位)新版 apiRouter.POST("addpositioncontnew", apiHandle.AddPositionContNew) //添加职位(岗位)新版
apiRouter.POST("get_my_posit_list", apiHandle.GetMyPositionList) //获取本岗位下的职位(岗位)列表不包含子行政组织 apiRouter.POST("get_my_posit_list", apiHandle.GetMyPositionList) //获取本岗位下的职位(岗位)列表不包含子行政组织
apiRouter.POST("addpositioncontpublic", apiHandle.AddPositionContPublic) //添加岗位平台通用
apiRouter.POST("editpositioncontpublic", apiHandle.EditPositionContPublic) //编辑岗位平台通用
apiRouter.POST("basedelpostcont", apiHandle.BaseDelPostCont) //批量删除岗位
apiRouter.POST("positionpeoplelist", apiHandle.PositionPeopleList) //职位(岗位)列表及相关人员 apiRouter.POST("positionpeoplelist", apiHandle.PositionPeopleList) //职位(岗位)列表及相关人员
@ -115,6 +130,10 @@ func (o *OrganizationRouteOpen) InitRouterGroup(route *gin.RouterGroup) {
apiRouter.POST("eitegovcont", apiHandle.EiteGovCont) //编辑行政组织 apiRouter.POST("eitegovcont", apiHandle.EiteGovCont) //编辑行政组织
apiRouter.POST("eitegovstateordel", apiHandle.EiteGovStateOrDel) //编辑行政组织状态或删除 apiRouter.POST("eitegovstateordel", apiHandle.EiteGovStateOrDel) //编辑行政组织状态或删除
apiRouter.POST("neweitegovstateordel", apiHandle.NewEiteGovStateOrDel) //编辑行政组织状态或删除(新)
apiRouter.POST("newaddgovcont", apiHandle.NewAddGovCont) //添加行政组织
apiRouter.POST("govthree", apiHandle.GovThree) //行政组织树 apiRouter.POST("govthree", apiHandle.GovThree) //行政组织树
apiRouter.POST("getorgallsun", apiHandle.GetOrgAllSun) //获取当前行政组织的所有子类 apiRouter.POST("getorgallsun", apiHandle.GetOrgAllSun) //获取当前行政组织的所有子类

3
apirouter/personnel/people.go

@ -18,11 +18,14 @@ func (p *PersonnelRoute) InitRouterGroup(route *gin.RouterGroup) {
apiRouter.POST("allocationofrights", apiHandle.AllocationOfRights) //分配权限 apiRouter.POST("allocationofrights", apiHandle.AllocationOfRights) //分配权限
// apiRouter.POST("archiveslist", apiHandle.ArchivesList) //人员列表(新) // apiRouter.POST("archiveslist", apiHandle.ArchivesList) //人员列表(新)
apiRouter.POST("archiveslist", apiHandle.ArchivesListWai) //人员列表(新) apiRouter.POST("archiveslist", apiHandle.ArchivesListWai) //人员列表(新)
apiRouter.POST("archiveslistcont", apiHandle.ArchivesListCont) //人员档案列表(平台用)
apiRouter.POST("archivescont", apiHandle.ArchivesCon) //个人档案 apiRouter.POST("archivescont", apiHandle.ArchivesCon) //个人档案
apiRouter.POST("kingdeehr", apiHandle.NewKingdee) //对接金蝶HR系统 apiRouter.POST("kingdeehr", apiHandle.NewKingdee) //对接金蝶HR系统
apiRouter.POST("editpassword", apiHandle.EditPassWord) //修改密码 apiRouter.POST("editpassword", apiHandle.EditPassWord) //修改密码
apiRouter.POST("wechat_give_uscont", apiHandle.WeChatGiveUsCont) //根据微信OpenId获取个人档案 apiRouter.POST("wechat_give_uscont", apiHandle.WeChatGiveUsCont) //根据微信OpenId获取个人档案
apiRouter.POST("edit_us_wechat_openid", apiHandle.EditUsWechatOpenId) //修改员工微信或企业微信UserId apiRouter.POST("edit_us_wechat_openid", apiHandle.EditUsWechatOpenId) //修改员工微信或企业微信UserId
apiRouter.POST("useraboutorglist", apiHandle.UserAboutOrgList) //行政组织关系
//双职工 //双职工
apiRouter.POST("doubleworkerlist", apiHandle.DoubleWorkerList) //双职工列表 apiRouter.POST("doubleworkerlist", apiHandle.DoubleWorkerList) //双职工列表
apiRouter.POST("adddoubleworker", apiHandle.AddDoubleWorkerApi) //添加双职工 apiRouter.POST("adddoubleworker", apiHandle.AddDoubleWorkerApi) //添加双职工

2
apirouter/shiyanrouter/shiyan.go

@ -23,5 +23,7 @@ func (p *ShiyanApiRouter) InitRouterGroup(route *gin.RouterGroup) {
apiRouter.POST("hand_movement_job", apiHandle.HandMovementJob) //手动同步职务类型 apiRouter.POST("hand_movement_job", apiHandle.HandMovementJob) //手动同步职务类型
apiRouter.POST("hand_movement_orgcont", apiHandle.HandMovementOrgCont) //手动同步行政组织 apiRouter.POST("hand_movement_orgcont", apiHandle.HandMovementOrgCont) //手动同步行政组织
apiRouter.POST("hand_movement_postcont", apiHandle.HandMovementPostCont) //手动同步职位 apiRouter.POST("hand_movement_postcont", apiHandle.HandMovementPostCont) //手动同步职位
apiRouter.POST("write_token", apiHandle.WriteToken) //写入令牌
} }
} }

BIN
hr_server.exe

Binary file not shown.

71
models/hrmodels/orgcont.go

@ -0,0 +1,71 @@
package hrmodels
import (
"hr_server/overall"
"strings"
)
// 行政组织内哦他那个
type OrgCont struct {
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"`
Number string `json:"number" gorm:"column:number;type:varchar(50) unsigned;default:'';not null;comment:行政编码"`
Name string `json:"name" gorm:"column:name;type:varchar(255) unsigned;default:'';not null;comment:组织名称"`
Superior int64 `json:"superior" gorm:"column:superior;type:bigint(20) unsigned;default:0;not null;comment:上级ID"`
OrganizationType int64 `json:"organizationtype" gorm:"column:organization_type;type:bigint(20) unsigned;default:0;not null;comment:行政组织类型"`
Abbreviation string `json:"abbreviation" gorm:"column:abbreviation;type:varchar(255) unsigned;default:'';not null;comment:行政组织简称"`
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"`
State int `json:"state" gorm:"column:state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"`
WechatOrganizationId int64 `json:"wechatorganizationid" gorm:"column:wechat_organization_id;type:bigint(20) unsigned;default:0;not null;comment:微信组织架构对照码"`
SuperiorSun string `json:"superiorsun" gorm:"column:superior_sun;type:mediumtext;comment:级联ID"`
Schoole int64 `json:"schoole" gorm:"column:schoole;type:bigint(20) unsigned;default:0;not null;comment:原知行学院对照码"`
KingdeeId string `json:"kingdeeid" gorm:"column:kingdeeid;type:varchar(255) unsigned;default:'';comment:金蝶对照ID"`
IsPower int `json:"ispower" gorm:"column:ispower;type:int(1) unsigned;default:2;not null;comment:是否为实权部门"`
Sort int `json:"sort" gorm:"column:sort;type:int(6) unsigned;default:100;not null;comment:排序"`
TypeName string `json:"typeName" gorm:"column:type_name;type:varchar(255) unsigned;default:'';not null;comment:类型名称"`
Level int64 `json:"level" gorm:"column:level;type:int(5) unsigned;default:1;not null;comment:级别"`
}
func (OrgCont *OrgCont) TableName() string {
return "org_cont"
}
// 编辑内容
func (cont *OrgCont) EiteCont(whereMap interface{}, saveData interface{}) (err error) {
err = overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Updates(saveData).Error
return
}
// 获取内容
func (cont *OrgCont) GetCont(whereMap interface{}, field ...string) (err error) {
gormDb := overall.CONSTANT_DB_HR.Model(&cont)
if len(field) > 0 {
fieldStr := strings.Join(field, ",")
gormDb = gormDb.Select(fieldStr)
}
gormDb = gormDb.Where(whereMap)
err = gormDb.First(&cont).Error
return
}
// 根据条件获取总数
func (cont *OrgCont) CountCont(whereMap interface{}) (countId int64) {
overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Count(&countId)
return
}
// 读取全部信息
func (cont *OrgCont) ContMap(whereMap interface{}, field ...string) (countAry []OrgCont, err error) {
gormDb := overall.CONSTANT_DB_HR.Model(&cont)
if len(field) > 0 {
fieldStr := strings.Join(field, ",")
gormDb = gormDb.Select(fieldStr)
}
err = gormDb.Where(whereMap).Find(&countAry).Error
return
}
// 删除内容
func (cont *OrgCont) DelCont(whereMap interface{}) (err error) {
err = overall.CONSTANT_DB_HR.Where(whereMap).Delete(&cont).Error
return
}

3
overall/app_constant.go

@ -7,5 +7,6 @@ var (
ConfigRedisConstant = "./config/configNosql/redis.yaml" ConfigRedisConstant = "./config/configNosql/redis.yaml"
EmployeeStatusIng = []int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10} //用工关系(1:临时工 , 2:编外人员 ;3:实习&实习生;4:试用员工;5:待分配;6:待岗;7:临时调入;8:正式员工;9:长期病假;10:停薪留职;11:退休;12:辞职;13:辞退;14:离职) EmployeeStatusIng = []int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10} //用工关系(1:临时工 , 2:编外人员 ;3:实习&实习生;4:试用员工;5:待分配;6:待岗;7:临时调入;8:正式员工;9:长期病假;10:停薪留职;11:退休;12:辞职;13:辞退;14:离职)
EmployeeStatusOld = []int{11, 12, 13, 14} //用工关系(1:临时工 , 2:编外人员 ;3:实习&实习生;4:试用员工;5:待分配;6:待岗;7:临时调入;8:正式员工;9:长期病假;10:停薪留职;11:退休;12:辞职;13:辞退;14:离职) EmployeeStatusOld = []int{11, 12, 13, 14} //用工关系(1:临时工 , 2:编外人员 ;3:实习&实习生;4:试用员工;5:待分配;6:待岗;7:临时调入;8:正式员工;9:长期病假;10:停薪留职;11:退休;12:辞职;13:辞退;14:离职)
DockingKingdeeUrl = "http://36.134.44.40:18888" // DockingKingdeeUrl = "http://36.134.44.40:18888"
DockingKingdeeUrl = "http://36.133.124.113:18888"
) )

119
overall/overallhandle/overall_handle.go

@ -10,8 +10,10 @@ import (
"hr_server/middleware/snowflake" "hr_server/middleware/snowflake"
"hr_server/models" "hr_server/models"
"hr_server/overall" "hr_server/overall"
"io/ioutil"
"math" "math"
"math/big" "math/big"
"net/http"
"strconv" "strconv"
"time" "time"
@ -726,12 +728,15 @@ func RecursionOrgLeve(superior int64, leve int64) (groupId int64) {
if leve == 0 { if leve == 0 {
leve = 1 leve = 1
} }
if superior == 0 {
return
}
var orgMap models.OrgContType var orgMap models.OrgContType
err := orgMap.GetCont(map[string]interface{}{"`id`": superior, "`state`": 1}, "`id`", "`superior`", "`level`") err := orgMap.GetCont(map[string]interface{}{"`id`": superior, "`state`": 1}, "`id`", "`superior`", "`level`")
if err != nil { if err != nil {
return return
} }
if orgMap.Level <= leve { if orgMap.Level <= leve || (orgMap.Level == 5 && leve == 4 && (orgMap.Id == 282 || orgMap.Id == 115)) {
if orgMap.Level == leve { if orgMap.Level == leve {
groupId = superior groupId = superior
} else { } else {
@ -749,6 +754,9 @@ func RecursionOrgLeveEs(oldId, superior, leve int64) (groupId int64) {
if leve == 0 { if leve == 0 {
leve = 1 leve = 1
} }
if superior == 0 {
return
}
var orgMap models.OrgContType var orgMap models.OrgContType
err := orgMap.GetCont(map[string]interface{}{"`id`": superior, "`state`": 1}, "`id`", "`superior`", "`level`") err := orgMap.GetCont(map[string]interface{}{"`id`": superior, "`state`": 1}, "`id`", "`superior`", "`level`")
if err != nil { if err != nil {
@ -775,6 +783,7 @@ func GetOrgStructure(orgId int64) (groupId, companyId, departmentId, sunDepartId
if err != nil { if err != nil {
return return
} }
fmt.Printf("获取集团属性--->%v\n", orgContTypeInfo.Level)
switch orgContTypeInfo.Level { switch orgContTypeInfo.Level {
case 1: case 1:
groupId = orgContTypeInfo.Id groupId = orgContTypeInfo.Id
@ -794,7 +803,7 @@ func GetOrgStructure(orgId int64) (groupId, companyId, departmentId, sunDepartId
departmentId = RecursionOrgLeve(orgContTypeInfo.Superior, 4) departmentId = RecursionOrgLeve(orgContTypeInfo.Superior, 4)
sunDepartId = orgContTypeInfo.Id sunDepartId = orgContTypeInfo.Id
case 6: case 6:
groupId = RecursionOrgLeve(orgContTypeInfo.Superior, 2) groupId = RecursionOrgLeve(orgContTypeInfo.Superior, 1)
companyId = RecursionOrgLeve(orgContTypeInfo.Superior, 3) companyId = RecursionOrgLeve(orgContTypeInfo.Superior, 3)
departmentId = RecursionOrgLeve(orgContTypeInfo.Superior, 4) departmentId = RecursionOrgLeve(orgContTypeInfo.Superior, 4)
sunDepartId = RecursionOrgLeve(orgContTypeInfo.Superior, 5) sunDepartId = RecursionOrgLeve(orgContTypeInfo.Superior, 5)
@ -846,6 +855,28 @@ func (a *AllSunList[int64]) GetAllSunOrg(superior int64) (err error) {
return return
} }
// 获取行政组织所有上级
func (a *AllSunList[int64]) GetAllFatherOrg(superior int64) (err error) {
var orgAry []models.AdministrativeOrganization
err = overall.CONSTANT_DB_HR.Model(&models.AdministrativeOrganization{}).Select("`id`,`superior`").Where("`id` = ?", superior).Find(&orgAry).Error
if err != nil {
if IsInTrue[int64](superior, a.SunList) == false {
a.SunList = append(a.SunList, superior)
}
return
}
for _, v := range orgAry {
// var idInt int64
idInt := int64(v.Id)
if IsInTrue[int64](idInt, a.SunList) == false {
a.SunList = append(a.SunList, idInt)
}
supId := int64(v.Superior)
a.GetAllSunOrg(supId)
}
return
}
//浮点数保留小数 //浮点数保留小数
/* /*
@value 浮点数值 @value 浮点数值
@ -942,3 +973,87 @@ func (a *AllSunList[int64]) GetAllParentOrg(superior int64, level int) (err erro
a.GetAllParentOrg(idInt, level) a.GetAllParentOrg(idInt, level)
return return
} }
// Post请求 json
func CurlPostJosn(postUrl string, jsonData []byte) []byte {
req, err := http.NewRequest("POST", postUrl, bytes.NewBuffer(jsonData))
if err != nil {
var kkl []byte
return kkl
}
req.Header.Set("Content-Type", "application/json;charset=utf-8")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := ioutil.ReadAll(resp.Body)
return body
}
func NewGovThreeList(parentId int64, govAry []OutGovCont) []govThree {
var govMap []govThree
// fmt.Printf("govAry---------------->%v\n", govAry)
for _, v := range govAry {
// var zhucont govThree
if v.Superior == parentId {
child := GovThreeList(v.Id, govAry)
govMap = append(govMap, govThree{v, child})
}
}
return govMap
}
func DucationToInt(emp int) string {
switch emp {
case 1:
return "初中及以下"
case 2:
return "中专"
case 3:
return "高中"
case 4:
return "中技"
case 5:
return "高技"
case 6:
return "函授专科"
case 7:
return "专科"
case 8:
return "函授本科"
case 9:
return "本科"
case 10:
return "硕士"
case 11:
return "博士"
case 12:
return "专家、教授"
default:
return "初中及以下"
}
}
// 学位(0:无;1:学士;2:硕士;3:博士;4:工学学士;5:教育学学位)int
func HestacademicdegreeToInt(hir string) int {
switch hir {
case "学士":
return 1
case "硕士":
return 2
case "博士":
return 3
case "学士学位":
return 1
case "工学学士":
return 4
case "教育学学位":
return 5
default:
return 0
}
}

5
overall/overallhandle/type.go

@ -29,6 +29,10 @@ type StateOverall struct {
State int `json:"state"` //状态 State int `json:"state"` //状态
} }
type NameOverall struct {
Name string `json:"name"` //编码
}
//状态 //状态
type NmuberOverall struct { type NmuberOverall struct {
Number string `json:"number"` //编码 Number string `json:"number"` //编码
@ -47,6 +51,7 @@ type OutGovCont struct {
ClassName string `json:"classname" gorm:"column:classname;type:varchar(255) unsigned;default:'';not null;comment:行政组织分类名称"` ClassName string `json:"classname" gorm:"column:classname;type:varchar(255) unsigned;default:'';not null;comment:行政组织分类名称"`
Level int64 `json:"level" gorm:"column:level;type:int(5) unsigned;default:1;not null;comment:级别"` Level int64 `json:"level" gorm:"column:level;type:int(5) unsigned;default:1;not null;comment:级别"`
IsMan int `json:"isman"` //1:行政组织;2:人 IsMan int `json:"isman"` //1:行政组织;2:人
Status bool `json:"status"`
} }
//组织架构树 //组织架构树

Loading…
Cancel
Save