Browse Source

岗位指标与部门指标页面更新优化完毕

v1_dev_2
超级管理员 3 years ago
parent
commit
db20594d50
  1. 52
      api/version1/departmentseting/departmentpc/departtarget.go
  2. 40
      api/version1/departmentseting/departmentpc/detailscont.go
  3. 10
      api/version1/departmentseting/departmentpc/programme.go
  4. 84
      api/version1/departmentseting/departmentpc/qualitativekpi.go
  5. 2
      api/version1/departmentseting/departmentpc/type.go
  6. 633
      api/version1/postseting/postpc/details.go
  7. 74
      api/version1/postseting/postpc/targetpost.go
  8. 46
      api/version1/postseting/postpc/teshutype.go
  9. 3
      api/version1/postseting/postpc/type.go
  10. 4
      apirouter/v1/postseting/pc.go

52
api/version1/departmentseting/departmentpc/departtarget.go

@ -109,11 +109,11 @@ func (a *ApiMethod) NewAddDepartmentTarget(c *gin.Context) {
publicmethod.Result(104, err, c) publicmethod.Result(104, err, c)
return return
} }
syncSeting.Add(1) SyncSeting.Add(1)
go DepartAboutTarget(dimensionId, saveData.Id, 0, 0, receivedValue.AcceptDepartmentId, 1, receivedValue.Nature, 1) go DepartAboutTarget(dimensionId, saveData.Id, 0, 0, receivedValue.AcceptDepartmentId, 1, receivedValue.Nature, 1)
syncSeting.Add(1) SyncSeting.Add(1)
go DepartAndReportAboutTarget(dimensionId, saveData.Id, 0, 0, receivedValue.AcceptDepartmentId, receivedValue.Operator, 1, receivedValue.Nature, 1) go DepartAndReportAboutTarget(dimensionId, saveData.Id, 0, 0, receivedValue.AcceptDepartmentId, receivedValue.Operator, 1, receivedValue.Nature, 1)
syncSeting.Wait() SyncSeting.Wait()
} }
/* /*
@ -142,7 +142,7 @@ func (a *ApiMethod) NewAddDepartmentTarget(c *gin.Context) {
#DepartAboutTarget(dimensionId, targetId, targetSunId, targetBylaws int64, departmentId []string, typeInt, class, level int) #DepartAboutTarget(dimensionId, targetId, targetSunId, targetBylaws int64, departmentId []string, typeInt, class, level int)
*/ */
func DepartAboutTarget(dimensionId, targetId, targetSunId, targetBylaws int64, departmentId []string, typeInt, class, level int) { func DepartAboutTarget(dimensionId, targetId, targetSunId, targetBylaws int64, departmentId []string, typeInt, class, level int) {
defer syncSeting.Done() defer SyncSeting.Done()
if typeInt == 0 { if typeInt == 0 {
typeInt = 1 typeInt = 1
} }
@ -215,7 +215,7 @@ func DepartAboutTarget(dimensionId, targetId, targetSunId, targetBylaws int64, d
#DepartAndReportAboutTarget(dimensionId, targetId, targetSunId, targetBylaws int64, departmentId, manKey []string, typeInt, class, typeLevel int) #DepartAndReportAboutTarget(dimensionId, targetId, targetSunId, targetBylaws int64, departmentId, manKey []string, typeInt, class, typeLevel int)
*/ */
func DepartAndReportAboutTarget(dimensionId, targetId, targetSunId, targetBylaws int64, departmentId, manKey []string, typeInt, class, typeLevel int) { func DepartAndReportAboutTarget(dimensionId, targetId, targetSunId, targetBylaws int64, departmentId, manKey []string, typeInt, class, typeLevel int) {
defer syncSeting.Done() defer SyncSeting.Done()
if typeInt == 0 { if typeInt == 0 {
typeInt = 1 typeInt = 1
} }
@ -334,15 +334,15 @@ func (a *ApiMethod) TargetChangeState(c *gin.Context) {
//硬删除 //硬删除
editTargetState.DelCont(where) editTargetState.DelCont(where)
} }
syncSeting.Add(1) SyncSeting.Add(1)
go SunTargetState(targetCont.Id, receivedValue.State, softDel) // 处理目标 go SunTargetState(targetCont.Id, receivedValue.State, softDel) // 处理目标
syncSeting.Add(1) SyncSeting.Add(1)
go TargetDatailedState(targetCont.Id, 0, receivedValue.State, softDel) // 处理细则 go TargetDatailedState(targetCont.Id, 0, receivedValue.State, softDel) // 处理细则
syncSeting.Add(1) SyncSeting.Add(1)
go TarDepartState(targetCont.Id, 0, 0, receivedValue.State, softDel, 1, 1) // 处理关联部门 go TarDepartState(targetCont.Id, 0, 0, receivedValue.State, softDel, 1, 1) // 处理关联部门
syncSeting.Add(1) SyncSeting.Add(1)
go TarAboutReport(targetCont.Id, 0, 0, receivedValue.State, softDel, 1, 1) // 处理相关提报人 go TarAboutReport(targetCont.Id, 0, 0, receivedValue.State, softDel, 1, 1) // 处理相关提报人
syncSeting.Wait() SyncSeting.Wait()
publicmethod.Result(0, err, c) publicmethod.Result(0, err, c)
} }
@ -353,7 +353,7 @@ func (a *ApiMethod) TargetChangeState(c *gin.Context) {
#isTrue 1软删非1硬删除 #isTrue 1软删非1硬删除
*/ */
func SunTargetState(ParentId int64, state, isTrue int) { func SunTargetState(ParentId int64, state, isTrue int) {
defer syncSeting.Done() defer SyncSeting.Done()
if state == 0 { if state == 0 {
state = 1 state = 1
} }
@ -382,7 +382,7 @@ func SunTargetState(ParentId int64, state, isTrue int) {
#isTrue 1软删非1硬删除 #isTrue 1软删非1硬删除
*/ */
func TargetDatailedState(ParentId, SunID int64, state, isTrue int) { func TargetDatailedState(ParentId, SunID int64, state, isTrue int) {
defer syncSeting.Done() defer SyncSeting.Done()
if state == 0 { if state == 0 {
state = 1 state = 1
} }
@ -421,7 +421,7 @@ func TargetDatailedState(ParentId, SunID int64, state, isTrue int) {
#typeInt 1指标2子目标3细则 #typeInt 1指标2子目标3细则
*/ */
func TarDepartState(parentId, sunID, bylawsId int64, state, isTrue, level, typeInt int) { func TarDepartState(parentId, sunID, bylawsId int64, state, isTrue, level, typeInt int) {
defer syncSeting.Done() defer SyncSeting.Done()
if state == 0 { if state == 0 {
state = 1 state = 1
} }
@ -465,7 +465,7 @@ func TarDepartState(parentId, sunID, bylawsId int64, state, isTrue, level, typeI
#typeInt 1指标2子目标3细则 #typeInt 1指标2子目标3细则
*/ */
func TarAboutReport(parentId, sunID, bylawsId int64, state, isTrue, level, typeInt int) { func TarAboutReport(parentId, sunID, bylawsId int64, state, isTrue, level, typeInt int) {
defer syncSeting.Done() defer SyncSeting.Done()
if state == 0 { if state == 0 {
state = 1 state = 1
} }
@ -621,7 +621,7 @@ func (a *ApiMethod) NewEditOneTarget(c *gin.Context) {
if departAryStr != accDepart { if departAryStr != accDepart {
departIsTreu = true departIsTreu = true
saveData["et_relevant_departments"] = accDepart saveData["et_relevant_departments"] = accDepart
syncSeting.Add(1) SyncSeting.Add(1)
go DepartAboutTarget(dimensionId, targetCont.Id, 0, 0, receivedValue.AcceptDepartmentId, 1, natureVal, 1) go DepartAboutTarget(dimensionId, targetCont.Id, 0, 0, receivedValue.AcceptDepartmentId, 1, natureVal, 1)
} }
} }
@ -640,7 +640,7 @@ func (a *ApiMethod) NewEditOneTarget(c *gin.Context) {
if reportStr != accDepart { if reportStr != accDepart {
reportIsTrue = true reportIsTrue = true
saveData["et_report"] = accDepart saveData["et_report"] = accDepart
syncSeting.Add(1) SyncSeting.Add(1)
go DepartAndReportAboutTarget(dimensionId, targetCont.Id, 0, 0, receivedValue.AcceptDepartmentId, receivedValue.Operator, 1, natureVal, 1) go DepartAndReportAboutTarget(dimensionId, targetCont.Id, 0, 0, receivedValue.AcceptDepartmentId, receivedValue.Operator, 1, natureVal, 1)
} }
} }
@ -654,7 +654,7 @@ func (a *ApiMethod) NewEditOneTarget(c *gin.Context) {
return return
} }
if reportIsTrue == true || departIsTreu == true { if reportIsTrue == true || departIsTreu == true {
syncSeting.Wait() SyncSeting.Wait()
} }
publicmethod.Result(0, err, c) publicmethod.Result(0, err, c)
} }
@ -733,29 +733,29 @@ func (a *ApiMethod) NewDeparmentTargetAboutPost(c *gin.Context) {
for _, vc := range v.Child { //抽离岗位数据 for _, vc := range v.Child { //抽离岗位数据
postId, _ := strconv.ParseInt(vc.Id, 10, 64) postId, _ := strconv.ParseInt(vc.Id, 10, 64)
postListId = append(postListId, postId) postListId = append(postListId, postId)
syncSeting.Add(1) SyncSeting.Add(1)
go DepartTargetAboutPost(targetCont.Dimension, targetCont.Id, 0, 0, departId, postId, 1, targetCont.Type, 1) go DepartTargetAboutPost(targetCont.Dimension, targetCont.Id, 0, 0, departId, postId, 1, targetCont.Type, 1)
var peopleListId []int64 var peopleListId []int64
for _, vvc := range vc.Child { //抽离人员 for _, vvc := range vc.Child { //抽离人员
peoId, _ := strconv.ParseInt(vvc.Id, 10, 64) peoId, _ := strconv.ParseInt(vvc.Id, 10, 64)
peopleListId = append(peopleListId, peoId) peopleListId = append(peopleListId, peoId)
syncSeting.Add(1) SyncSeting.Add(1)
go BeparTargetAboutPostMan(targetCont.Dimension, targetCont.Id, 0, 0, departId, postId, peoId, 1, targetCont.Type, 1) go BeparTargetAboutPostMan(targetCont.Dimension, targetCont.Id, 0, 0, departId, postId, peoId, 1, targetCont.Type, 1)
} }
if len(peopleListId) > 0 { if len(peopleListId) > 0 {
syncSeting.Add(1) SyncSeting.Add(1)
go ClearTargetDepartAboutPostMan(targetCont.Dimension, targetCont.Id, 0, 0, departId, postId, peopleListId, 1, targetCont.Type, 1) go ClearTargetDepartAboutPostMan(targetCont.Dimension, targetCont.Id, 0, 0, departId, postId, peopleListId, 1, targetCont.Type, 1)
} }
} }
if len(postListId) > 0 { if len(postListId) > 0 {
//清理不需要的岗位关联 //清理不需要的岗位关联
syncSeting.Add(1) SyncSeting.Add(1)
go ClearTargetDepartAboutPost(targetCont.Dimension, targetCont.Id, 0, 0, departId, postListId, 1, targetCont.Type, 1) go ClearTargetDepartAboutPost(targetCont.Dimension, targetCont.Id, 0, 0, departId, postListId, 1, targetCont.Type, 1)
} }
} }
syncSeting.Wait() SyncSeting.Wait()
publicmethod.Result(0, err, c) publicmethod.Result(0, err, c)
} }
@ -786,7 +786,7 @@ func (a *ApiMethod) NewDeparmentTargetAboutPost(c *gin.Context) {
#ClearTargetDepartAboutPostMan(dimensionId, targetId, targetSunId, targetBylaws, departmentId, postId int64, manKey []int64, typeInt, class, level int) #ClearTargetDepartAboutPostMan(dimensionId, targetId, targetSunId, targetBylaws, departmentId, postId int64, manKey []int64, typeInt, class, level int)
*/ */
func ClearTargetDepartAboutPostMan(dimensionId, targetId, targetSunId, targetBylaws, departmentId, postId int64, manKey []int64, typeInt, class, level int) { func ClearTargetDepartAboutPostMan(dimensionId, targetId, targetSunId, targetBylaws, departmentId, postId int64, manKey []int64, typeInt, class, level int) {
defer syncSeting.Done() defer SyncSeting.Done()
if typeInt == 0 { if typeInt == 0 {
typeInt = 1 typeInt = 1
} }
@ -830,7 +830,7 @@ func ClearTargetDepartAboutPostMan(dimensionId, targetId, targetSunId, targetByl
#func BeparTargetAboutPostMan(dimensionId, targetId, targetSunId, targetBylaws, departmentId, postId, manKey int64, typeInt, class, typeLevel int) #func BeparTargetAboutPostMan(dimensionId, targetId, targetSunId, targetBylaws, departmentId, postId, manKey int64, typeInt, class, typeLevel int)
*/ */
func BeparTargetAboutPostMan(dimensionId, targetId, targetSunId, targetBylaws, departmentId, postId, manKey int64, typeInt, class, typeLevel int) { func BeparTargetAboutPostMan(dimensionId, targetId, targetSunId, targetBylaws, departmentId, postId, manKey int64, typeInt, class, typeLevel int) {
defer syncSeting.Done() defer SyncSeting.Done()
if typeInt == 0 { if typeInt == 0 {
typeInt = 1 typeInt = 1
} }
@ -902,7 +902,7 @@ func BeparTargetAboutPostMan(dimensionId, targetId, targetSunId, targetBylaws, d
#ClearTargetDepartAboutPost(dimensionId, targetId, targetSunId, targetBylaws, departmentId int64, postId []int64, typeInt, class, level int) #ClearTargetDepartAboutPost(dimensionId, targetId, targetSunId, targetBylaws, departmentId int64, postId []int64, typeInt, class, level int)
*/ */
func ClearTargetDepartAboutPost(dimensionId, targetId, targetSunId, targetBylaws, departmentId int64, postId []int64, typeInt, class, level int) { func ClearTargetDepartAboutPost(dimensionId, targetId, targetSunId, targetBylaws, departmentId int64, postId []int64, typeInt, class, level int) {
defer syncSeting.Done() defer SyncSeting.Done()
if typeInt == 0 { if typeInt == 0 {
typeInt = 1 typeInt = 1
} }
@ -945,7 +945,7 @@ func ClearTargetDepartAboutPost(dimensionId, targetId, targetSunId, targetBylaws
#func DepartTargetAboutPost(dimensionId, targetId, targetSunId, targetBylaws, departmentId, postId int64, typeInt, class, level int) #func DepartTargetAboutPost(dimensionId, targetId, targetSunId, targetBylaws, departmentId, postId int64, typeInt, class, level int)
*/ */
func DepartTargetAboutPost(dimensionId, targetId, targetSunId, targetBylaws, departmentId, postId int64, typeInt, class, level int) { func DepartTargetAboutPost(dimensionId, targetId, targetSunId, targetBylaws, departmentId, postId int64, typeInt, class, level int) {
defer syncSeting.Done() defer SyncSeting.Done()
if typeInt == 0 { if typeInt == 0 {
typeInt = 1 typeInt = 1
} }

40
api/version1/departmentseting/departmentpc/detailscont.go

@ -127,13 +127,13 @@ func (a *ApiMethod) NewAddDepartDetails(c *gin.Context) {
// insetContList = append(insetContList, insetDeatilsCont) // insetContList = append(insetContList, insetDeatilsCont)
addErr := overall.CONSTANT_DB_KPI.Create(&insetDeatilsCont).Error addErr := overall.CONSTANT_DB_KPI.Create(&insetDeatilsCont).Error
if addErr == nil { if addErr == nil {
syncSeting.Add(1) SyncSeting.Add(1)
go DepartAboutTarget(targetCont.Dimension, targetCont.Id, tableId, insetDeatilsCont.Id, v.Department, 3, targetCont.Type, 1) go DepartAboutTarget(targetCont.Dimension, targetCont.Id, tableId, insetDeatilsCont.Id, v.Department, 3, targetCont.Type, 1)
syncSeting.Add(1) SyncSeting.Add(1)
go DepartAndReportAboutTarget(targetCont.Dimension, targetCont.Id, tableId, insetDeatilsCont.Id, v.Department, v.Executor, 1, targetCont.Type, 3) go DepartAndReportAboutTarget(targetCont.Dimension, targetCont.Id, tableId, insetDeatilsCont.Id, v.Department, v.Executor, 1, targetCont.Type, 3)
} }
} }
syncSeting.Wait() SyncSeting.Wait()
publicmethod.Result(0, err, c) publicmethod.Result(0, err, c)
} }
@ -192,7 +192,7 @@ func HandleTableCont(dimensionId, tragetId int64, class int, title string, targe
insetTableCont.Depart = strings.Join(targetOrgIdList, ",") //关联部门"` insetTableCont.Depart = strings.Join(targetOrgIdList, ",") //关联部门"`
err = overall.CONSTANT_DB_KPI.Create(&insetTableCont).Error err = overall.CONSTANT_DB_KPI.Create(&insetTableCont).Error
tableId = insetTableCont.Id tableId = insetTableCont.Id
syncSeting.Add(1) SyncSeting.Add(1)
go DepartAboutTarget(dimensionId, tragetId, insetTableCont.Id, 0, targetOrgIdList, 2, class, 1) go DepartAboutTarget(dimensionId, tragetId, insetTableCont.Id, 0, targetOrgIdList, 2, class, 1)
} else { } else {
tableId = tableCont.Id tableId = tableCont.Id
@ -204,7 +204,7 @@ func HandleTableCont(dimensionId, tragetId int64, class int, title string, targe
orgListStr := strings.Join(targetOrgIdList, ",") orgListStr := strings.Join(targetOrgIdList, ",")
if tableCont.Depart != orgListStr { if tableCont.Depart != orgListStr {
editCont["q_depart"] = orgListStr editCont["q_depart"] = orgListStr
syncSeting.Add(1) SyncSeting.Add(1)
go DepartAboutTarget(dimensionId, tragetId, tableCont.Id, 0, targetOrgIdList, 2, class, 1) go DepartAboutTarget(dimensionId, tragetId, tableCont.Id, 0, targetOrgIdList, 2, class, 1)
} }
if len(editCont) > 0 { if len(editCont) > 0 {
@ -214,7 +214,7 @@ func HandleTableCont(dimensionId, tragetId int64, class int, title string, targe
} }
} }
syncSeting.Wait() SyncSeting.Wait()
return return
} }
@ -282,11 +282,11 @@ func (a *ApiMethod) EditDetailsState(c *gin.Context) {
//硬删除 //硬删除
editDetailsInfo.DelCont(where) editDetailsInfo.DelCont(where)
} }
syncSeting.Add(1) SyncSeting.Add(1)
go TarDepartState(detailsCont.ParentId, detailsCont.ParentIdSun, detailsCont.Id, receivedValue.State, softDel, 1, 3) // 处理关联部门 go TarDepartState(detailsCont.ParentId, detailsCont.ParentIdSun, detailsCont.Id, receivedValue.State, softDel, 1, 3) // 处理关联部门
syncSeting.Add(1) SyncSeting.Add(1)
go TarAboutReport(detailsCont.ParentId, detailsCont.ParentIdSun, detailsCont.Id, receivedValue.State, softDel, 1, 3) // 处理相关提报人 go TarAboutReport(detailsCont.ParentId, detailsCont.ParentIdSun, detailsCont.Id, receivedValue.State, softDel, 1, 3) // 处理相关提报人
syncSeting.Wait() SyncSeting.Wait()
publicmethod.Result(0, err, c) publicmethod.Result(0, err, c)
} }
@ -423,11 +423,11 @@ func (a *ApiMethod) EditDetailsCont(c *gin.Context) {
return return
} }
} }
syncSeting.Add(1) SyncSeting.Add(1)
go DepartAboutTarget(targetCont.Dimension, detailsCont.ParentId, detailsCont.ParentIdSun, detailsCont.Id, receivedValue.Department, 3, targetCont.Type, 1) go DepartAboutTarget(targetCont.Dimension, detailsCont.ParentId, detailsCont.ParentIdSun, detailsCont.Id, receivedValue.Department, 3, targetCont.Type, 1)
syncSeting.Add(1) SyncSeting.Add(1)
go DepartAndReportAboutTarget(targetCont.Dimension, detailsCont.ParentId, detailsCont.ParentIdSun, detailsCont.Id, receivedValue.Department, receivedValue.Executor, 1, targetCont.Type, 3) go DepartAndReportAboutTarget(targetCont.Dimension, detailsCont.ParentId, detailsCont.ParentIdSun, detailsCont.Id, receivedValue.Department, receivedValue.Executor, 1, targetCont.Type, 3)
syncSeting.Wait() SyncSeting.Wait()
publicmethod.Result(0, err, c) publicmethod.Result(0, err, c)
} }
@ -541,13 +541,13 @@ func (a *ApiMethod) TableAddDetailses(c *gin.Context) {
// insetContList = append(insetContList, insetDeatilsCont) // insetContList = append(insetContList, insetDeatilsCont)
addErr := overall.CONSTANT_DB_KPI.Create(&insetDeatilsCont).Error addErr := overall.CONSTANT_DB_KPI.Create(&insetDeatilsCont).Error
if addErr == nil { if addErr == nil {
syncSeting.Add(1) SyncSeting.Add(1)
go DepartAboutTarget(targetCont.Dimension, targetCont.Id, tableInfo.Id, insetDeatilsCont.Id, v.Department, 3, targetCont.Type, 1) go DepartAboutTarget(targetCont.Dimension, targetCont.Id, tableInfo.Id, insetDeatilsCont.Id, v.Department, 3, targetCont.Type, 1)
syncSeting.Add(1) SyncSeting.Add(1)
go DepartAndReportAboutTarget(targetCont.Dimension, targetCont.Id, tableInfo.Id, insetDeatilsCont.Id, v.Department, v.Executor, 1, targetCont.Type, 3) go DepartAndReportAboutTarget(targetCont.Dimension, targetCont.Id, tableInfo.Id, insetDeatilsCont.Id, v.Department, v.Executor, 1, targetCont.Type, 3)
} }
} }
syncSeting.Wait() SyncSeting.Wait()
publicmethod.Result(0, err, c) publicmethod.Result(0, err, c)
} }
@ -605,11 +605,11 @@ func (a *ApiMethod) EditTableContAndDepartOfMan(c *gin.Context) {
if departStr != targetTableCont.Depart { if departStr != targetTableCont.Depart {
editSaveData["q_depart"] = departStr editSaveData["q_depart"] = departStr
} }
syncSeting.Add(1) SyncSeting.Add(1)
go DepartAboutTarget(targetCont.Dimension, targetTableCont.ParentId, targetTableCont.Id, 0, receivedValue.Departmentint, 2, targetCont.Type, 1) go DepartAboutTarget(targetCont.Dimension, targetTableCont.ParentId, targetTableCont.Id, 0, receivedValue.Departmentint, 2, targetCont.Type, 1)
} }
if len(receivedValue.UserList) > 0 { if len(receivedValue.UserList) > 0 {
syncSeting.Add(1) SyncSeting.Add(1)
go DepartAndReportAboutTarget(targetCont.Dimension, targetTableCont.ParentId, targetTableCont.Id, 0, receivedValue.Departmentint, receivedValue.UserList, 1, targetCont.Type, 2) go DepartAndReportAboutTarget(targetCont.Dimension, targetTableCont.ParentId, targetTableCont.Id, 0, receivedValue.Departmentint, receivedValue.UserList, 1, targetCont.Type, 2)
} }
if len(editSaveData) > 0 { if len(editSaveData) > 0 {
@ -622,13 +622,13 @@ func (a *ApiMethod) EditTableContAndDepartOfMan(c *gin.Context) {
err = overall.CONSTANT_DB_KPI.Model(&modelskpi.DetailedTarget{}).Select("dt_id").Where("`dt_parentid` = ? AND `dt_parentid_sun` = ?", targetTableCont.ParentId, targetTableCont.Id).Find(&bylawsId).Error err = overall.CONSTANT_DB_KPI.Model(&modelskpi.DetailedTarget{}).Select("dt_id").Where("`dt_parentid` = ? AND `dt_parentid_sun` = ?", targetTableCont.ParentId, targetTableCont.Id).Find(&bylawsId).Error
if err == nil && len(bylawsId) > 0 { if err == nil && len(bylawsId) > 0 {
for _, v := range bylawsId { for _, v := range bylawsId {
syncSeting.Add(1) SyncSeting.Add(1)
go DepartAboutTarget(targetCont.Dimension, targetTableCont.ParentId, targetTableCont.Id, v, receivedValue.Departmentint, 3, targetCont.Type, 1) go DepartAboutTarget(targetCont.Dimension, targetTableCont.ParentId, targetTableCont.Id, v, receivedValue.Departmentint, 3, targetCont.Type, 1)
syncSeting.Add(1) SyncSeting.Add(1)
go DepartAndReportAboutTarget(targetCont.Dimension, targetTableCont.ParentId, targetTableCont.Id, v, receivedValue.Departmentint, receivedValue.UserList, 1, targetCont.Type, 3) go DepartAndReportAboutTarget(targetCont.Dimension, targetTableCont.ParentId, targetTableCont.Id, v, receivedValue.Departmentint, receivedValue.UserList, 1, targetCont.Type, 3)
} }
} }
syncSeting.Wait() SyncSeting.Wait()
publicmethod.Result(0, err, c) publicmethod.Result(0, err, c)
} }

10
api/version1/departmentseting/departmentpc/programme.go

@ -254,11 +254,11 @@ func SearchPlanVersion(key string) (isTrue bool) {
} }
} }
var syncListCont judgePlanTask var syncListCont judgePlanTask
syncSeting.Add(1) SyncSeting.Add(1)
go syncListCont.SearchDingXingPlan(dingXing) go syncListCont.SearchDingXingPlan(dingXing)
syncSeting.Add(1) SyncSeting.Add(1)
go syncListCont.SearchDingLiangPlan(dingLiang) go syncListCont.SearchDingLiangPlan(dingLiang)
syncSeting.Wait() SyncSeting.Wait()
readDingXingMap, readDingLiangMap := syncListCont.readPlanTaskData() readDingXingMap, readDingLiangMap := syncListCont.readPlanTaskData()
if len(readDingXingMap) > 0 || len(readDingLiangMap) > 0 { if len(readDingXingMap) > 0 || len(readDingLiangMap) > 0 {
@ -301,7 +301,7 @@ func (j *judgePlanTask) SearchDingXingPlan(id []int64) {
} }
} }
} }
syncSeting.Done() SyncSeting.Done()
} }
/* /*
@ -338,7 +338,7 @@ func (j *judgePlanTask) SearchDingLiangPlan(id []int64) {
} }
} }
} }
syncSeting.Done() SyncSeting.Done()
} }
/* /*

84
api/version1/departmentseting/departmentpc/qualitativekpi.go

@ -877,11 +877,11 @@ func addDetaInfo(targetId, sunTargetId int64, qualEvalCont QualEvalSunList, depa
detaildeTarInfo.Reportary = strings.Join(operatorList, ",") //提报人"` detaildeTarInfo.Reportary = strings.Join(operatorList, ",") //提报人"`
err = overall.CONSTANT_DB_KPI.Create(&detaildeTarInfo).Error err = overall.CONSTANT_DB_KPI.Create(&detaildeTarInfo).Error
if err == nil { if err == nil {
syncSeting.Add(1) SyncSeting.Add(1)
go handleDetarildTargetDepart(targetId, sunTargetId, detaildeTarInfo.Id, departmentAry, 1, 1) go handleDetarildTargetDepart(targetId, sunTargetId, detaildeTarInfo.Id, departmentAry, 1, 1)
syncSeting.Add(1) SyncSeting.Add(1)
go handleDetarildTargetRepart(targetId, sunTargetId, detaildeTarInfo.Id, operatorList, 1, 1) go handleDetarildTargetRepart(targetId, sunTargetId, detaildeTarInfo.Id, operatorList, 1, 1)
syncSeting.Wait() SyncSeting.Wait()
} }
return nil return nil
} }
@ -974,11 +974,11 @@ func editDetaAdd(targetId, sunTargetId int64, qualEvalCont QualEvalSunList, deta
var editCont modelskpi.DetailedTarget var editCont modelskpi.DetailedTarget
err = editCont.EiteCont(map[string]interface{}{"`dt_id`": detailInfof.Id}, saveData) err = editCont.EiteCont(map[string]interface{}{"`dt_id`": detailInfof.Id}, saveData)
} }
syncSeting.Add(1) SyncSeting.Add(1)
go handleDetarildTargetDepart(targetId, sunTargetId, detailInfof.Id, departmentAry, 1, 1) go handleDetarildTargetDepart(targetId, sunTargetId, detailInfof.Id, departmentAry, 1, 1)
syncSeting.Add(1) SyncSeting.Add(1)
go handleDetarildTargetRepart(targetId, sunTargetId, detailInfof.Id, qualEvalCont.Operator, 1, 1) go handleDetarildTargetRepart(targetId, sunTargetId, detailInfof.Id, qualEvalCont.Operator, 1, 1)
syncSeting.Wait() SyncSeting.Wait()
return nil return nil
} }
@ -992,7 +992,7 @@ func editDetaAdd(targetId, sunTargetId int64, qualEvalCont QualEvalSunList, deta
@nature 1定性考核2定量考核 @nature 1定性考核2定量考核
*/ */
func handleDetarildTargetDepart(targetId, targetSunId, bylawsId int64, department []string, class, nature int) { func handleDetarildTargetDepart(targetId, targetSunId, bylawsId int64, department []string, class, nature int) {
defer syncSeting.Done() defer SyncSeting.Done()
if nature == 0 { if nature == 0 {
nature = 1 nature = 1
} }
@ -1042,7 +1042,7 @@ func handleDetarildTargetDepart(targetId, targetSunId, bylawsId int64, departmen
@nature 1定性考核2定量考核 @nature 1定性考核2定量考核
*/ */
func handleDetarildTargetRepart(targetId, targetSunId, bylawsId int64, repart []string, class, nature int) { func handleDetarildTargetRepart(targetId, targetSunId, bylawsId int64, repart []string, class, nature int) {
defer syncSeting.Done() defer SyncSeting.Done()
if nature == 0 { if nature == 0 {
nature = 1 nature = 1
} }
@ -1442,14 +1442,14 @@ func (a *ApiMethod) EditSonTargetDepartmentReport(c *gin.Context) {
if err == nil && len(detaildId) > 0 { if err == nil && len(detaildId) > 0 {
for _, v := range detaildId { for _, v := range detaildId {
if len(departmentAry) > 0 { if len(departmentAry) > 0 {
syncSeting.Add(1) SyncSeting.Add(1)
go handleDetarildTargetDepart(sonTargetCont.ParentId, sonTargetCont.Id, v, departmentAry, 1, 1) go handleDetarildTargetDepart(sonTargetCont.ParentId, sonTargetCont.Id, v, departmentAry, 1, 1)
} }
if len(operatorList) > 0 { if len(operatorList) > 0 {
syncSeting.Add(1) SyncSeting.Add(1)
go handleDetarildTargetRepart(sonTargetCont.ParentId, sonTargetCont.Id, v, operatorList, 1, 1) go handleDetarildTargetRepart(sonTargetCont.ParentId, sonTargetCont.Id, v, operatorList, 1, 1)
} }
syncSeting.Wait() SyncSeting.Wait()
} }
} }
//获取该子栏目所有的接受考核部门 //获取该子栏目所有的接受考核部门
@ -1570,18 +1570,18 @@ func (a *ApiMethod) DelSonTarget(c *gin.Context) {
delTime := time.Now().Unix() delTime := time.Now().Unix()
//软删除所有此子栏目下的指标细则 //软删除所有此子栏目下的指标细则
syncSeting.Add(1) SyncSeting.Add(1)
go softDetaildeCont(sonTargetCont.ParentId, sonTargetCont.Id, delTime) go softDetaildeCont(sonTargetCont.ParentId, sonTargetCont.Id, delTime)
//软删除所有此子栏目相关的联部门 //软删除所有此子栏目相关的联部门
syncSeting.Add(1) SyncSeting.Add(1)
go softDelTargetDepartment(map[string]interface{}{"target_id": sonTargetCont.ParentId, "target_sun_id": sonTargetCont.Id, "`state`": 1}, delTime) go softDelTargetDepartment(map[string]interface{}{"target_id": sonTargetCont.ParentId, "target_sun_id": sonTargetCont.Id, "`state`": 1}, delTime)
//软删除所有此子栏目相关联的提报人 //软删除所有此子栏目相关联的提报人
syncSeting.Add(1) SyncSeting.Add(1)
go softDelTargetReport(map[string]interface{}{"`target_id`": sonTargetCont.ParentId, "`target_sun_id`": sonTargetCont.Id, "`state`": 1}, delTime) go softDelTargetReport(map[string]interface{}{"`target_id`": sonTargetCont.ParentId, "`target_sun_id`": sonTargetCont.Id, "`state`": 1}, delTime)
//软删除此栏目 //软删除此栏目
var delTargetSon modelskpi.QualitativeTarget var delTargetSon modelskpi.QualitativeTarget
err = delTargetSon.EiteCont(map[string]interface{}{"`q_id`": sonTargetCont.Id}, map[string]interface{}{"`q_state`": 3, "`q_time`": delTime}) err = delTargetSon.EiteCont(map[string]interface{}{"`q_id`": sonTargetCont.Id}, map[string]interface{}{"`q_state`": 3, "`q_time`": delTime})
syncSeting.Wait() SyncSeting.Wait()
if err != nil { if err != nil {
publicmethod.Result(106, err, c) publicmethod.Result(106, err, c)
return return
@ -1591,21 +1591,21 @@ func (a *ApiMethod) DelSonTarget(c *gin.Context) {
// 软删除所有此子栏目下的指标细则 // 软删除所有此子栏目下的指标细则
func softDetaildeCont(targetId, sonTargetId, delTime int64) { func softDetaildeCont(targetId, sonTargetId, delTime int64) {
defer syncSeting.Done() defer SyncSeting.Done()
var detaildeCont modelskpi.DetailedTarget var detaildeCont modelskpi.DetailedTarget
detaildeCont.EiteCont(map[string]interface{}{"dt_parentid": targetId, "dt_parentid_sun": sonTargetId, "dt_state": 1}, map[string]interface{}{"dt_state": 3, "dt_time": delTime}) detaildeCont.EiteCont(map[string]interface{}{"dt_parentid": targetId, "dt_parentid_sun": sonTargetId, "dt_state": 1}, map[string]interface{}{"dt_state": 3, "dt_time": delTime})
} }
// 软删除所有此子栏目相关联的提报人 // 软删除所有此子栏目相关联的提报人
func softDelTargetReport(where interface{}, delTime int64) { func softDelTargetReport(where interface{}, delTime int64) {
defer syncSeting.Done() defer SyncSeting.Done()
var delTargetReport modelskpi.TargetReport var delTargetReport modelskpi.TargetReport
delTargetReport.EiteCont(where, map[string]interface{}{"`state`": 3, "`time`": delTime}) delTargetReport.EiteCont(where, map[string]interface{}{"`state`": 3, "`time`": delTime})
} }
// 软删除所有此子栏目相关的联部门 // 软删除所有此子栏目相关的联部门
func softDelTargetDepartment(where interface{}, delTime int64) { func softDelTargetDepartment(where interface{}, delTime int64) {
defer syncSeting.Done() defer SyncSeting.Done()
var delTargetDepartment modelskpi.TargetDepartment var delTargetDepartment modelskpi.TargetDepartment
delTargetDepartment.EiteCont(where, map[string]interface{}{"`state`": 3, "`time`": delTime}) delTargetDepartment.EiteCont(where, map[string]interface{}{"`state`": 3, "`time`": delTime})
} }
@ -1854,12 +1854,12 @@ func (a *ApiMethod) DelOneDetailedTarget(c *gin.Context) {
} }
//软删除所有此子栏目相关的联部门 //软删除所有此子栏目相关的联部门
syncSeting.Add(1) SyncSeting.Add(1)
go softDelTargetDepartment(map[string]interface{}{"target_id": detailedTargetCont.ParentId, "`target_sun_id`": detailedTargetCont.ParentIdSun, "target_bylaws": detailedTargetCont.Id, "`state`": 1}, delTime) go softDelTargetDepartment(map[string]interface{}{"target_id": detailedTargetCont.ParentId, "`target_sun_id`": detailedTargetCont.ParentIdSun, "target_bylaws": detailedTargetCont.Id, "`state`": 1}, delTime)
//软删除所有此子栏目相关联的提报人 //软删除所有此子栏目相关联的提报人
syncSeting.Add(1) SyncSeting.Add(1)
go softDelTargetReport(map[string]interface{}{"`target_id`": detailedTargetCont.ParentId, "`target_sun_id`": detailedTargetCont.ParentIdSun, "target_bylaws": detailedTargetCont.Id, "`state`": 1}, delTime) go softDelTargetReport(map[string]interface{}{"`target_id`": detailedTargetCont.ParentId, "`target_sun_id`": detailedTargetCont.ParentIdSun, "target_bylaws": detailedTargetCont.Id, "`state`": 1}, delTime)
syncSeting.Wait() SyncSeting.Wait()
publicmethod.Result(0, err, c) publicmethod.Result(0, err, c)
} }
@ -1943,14 +1943,14 @@ func (a *ApiMethod) AddDepartmentTarget(c *gin.Context) {
} }
if len(receivedValue.AcceptDepartmentId) > 0 { if len(receivedValue.AcceptDepartmentId) > 0 {
syncSeting.Add(1) SyncSeting.Add(1)
go handleDetarildTargetDepart(saveData.Id, 0, 0, receivedValue.AcceptDepartmentId, 1, receivedValue.Nature) go handleDetarildTargetDepart(saveData.Id, 0, 0, receivedValue.AcceptDepartmentId, 1, receivedValue.Nature)
} }
if len(receivedValue.Operator) > 0 { if len(receivedValue.Operator) > 0 {
syncSeting.Add(1) SyncSeting.Add(1)
go handleDetarildTargetRepart(saveData.Id, 0, 0, receivedValue.Operator, 1, receivedValue.Nature) go handleDetarildTargetRepart(saveData.Id, 0, 0, receivedValue.Operator, 1, receivedValue.Nature)
} }
syncSeting.Wait() SyncSeting.Wait()
publicmethod.Result(0, err, c) publicmethod.Result(0, err, c)
} }
@ -2127,7 +2127,7 @@ func (a *ApiMethod) EditOneTarget(c *gin.Context) {
if departAryStr != accDepart { if departAryStr != accDepart {
departIsTreu = true departIsTreu = true
saveData["et_relevant_departments"] = accDepart saveData["et_relevant_departments"] = accDepart
syncSeting.Add(1) SyncSeting.Add(1)
go handleTargetDepart(targetCont.Id, 0, 0, receivedValue.AcceptDepartmentId, 1, targetCont.Type) go handleTargetDepart(targetCont.Id, 0, 0, receivedValue.AcceptDepartmentId, 1, targetCont.Type)
} }
} }
@ -2142,7 +2142,7 @@ func (a *ApiMethod) EditOneTarget(c *gin.Context) {
if reportStr != accDepart { if reportStr != accDepart {
reportIsTrue = true reportIsTrue = true
saveData["et_report"] = accDepart saveData["et_report"] = accDepart
syncSeting.Add(1) SyncSeting.Add(1)
go handleTargetRepart(targetCont.Id, 0, 0, receivedValue.Operator, 1, targetCont.Type) go handleTargetRepart(targetCont.Id, 0, 0, receivedValue.Operator, 1, targetCont.Type)
} }
} }
@ -2163,7 +2163,7 @@ func (a *ApiMethod) EditOneTarget(c *gin.Context) {
} }
if reportIsTrue == true || departIsTreu == true { if reportIsTrue == true || departIsTreu == true {
syncSeting.Wait() SyncSeting.Wait()
} }
publicmethod.Result(0, err, c) publicmethod.Result(0, err, c)
@ -2179,7 +2179,7 @@ func (a *ApiMethod) EditOneTarget(c *gin.Context) {
@nature 1定性考核2定量考核 @nature 1定性考核2定量考核
*/ */
func handleTargetDepart(targetId, targetSunId, bylawsId int64, department []string, class, nature int) { func handleTargetDepart(targetId, targetSunId, bylawsId int64, department []string, class, nature int) {
defer syncSeting.Done() defer SyncSeting.Done()
if nature == 0 { if nature == 0 {
nature = 1 nature = 1
} }
@ -2259,7 +2259,7 @@ func handleTargetDepart(targetId, targetSunId, bylawsId int64, department []stri
@nature 1定性考核2定量考核 @nature 1定性考核2定量考核
*/ */
func handleTargetRepart(targetId, targetSunId, bylawsId int64, repart []string, class, nature int) { func handleTargetRepart(targetId, targetSunId, bylawsId int64, repart []string, class, nature int) {
defer syncSeting.Done() defer SyncSeting.Done()
if nature == 0 { if nature == 0 {
nature = 1 nature = 1
} }
@ -2364,10 +2364,10 @@ func (a *ApiMethod) DeparmentTargetAboutPost(c *gin.Context) {
publicmethod.Result(101, ov, c, "请指定部的对照岗位!") publicmethod.Result(101, ov, c, "请指定部的对照岗位!")
return return
} }
syncSeting.Add(1) SyncSeting.Add(1)
go departmentAboutPostTarget(targetCont.Dimension, targetCont.Id, 0, 0, ov.Id, ov.Child, 2, targetCont.Type) go departmentAboutPostTarget(targetCont.Dimension, targetCont.Id, 0, 0, ov.Id, ov.Child, 2, targetCont.Type)
} }
syncSeting.Wait() SyncSeting.Wait()
publicmethod.Result(0, err, c) publicmethod.Result(0, err, c)
} }
@ -2384,7 +2384,7 @@ func (a *ApiMethod) DeparmentTargetAboutPost(c *gin.Context) {
@nature 1定性考核2定量考核 @nature 1定性考核2定量考核
*/ */
func departmentAboutPostTarget(dimensionId, targetId, targetSunId, bylawsId int64, departmentId string, postList []LoopStruct, class, nature int) { func departmentAboutPostTarget(dimensionId, targetId, targetSunId, bylawsId int64, departmentId string, postList []LoopStruct, class, nature int) {
defer syncSeting.Done() defer SyncSeting.Done()
// fmt.Printf("targetCont-----1---->%v\n", nature) // fmt.Printf("targetCont-----1---->%v\n", nature)
if nature == 0 { if nature == 0 {
@ -2474,7 +2474,7 @@ func departmentAboutPostTarget(dimensionId, targetId, targetSunId, bylawsId int6
// fmt.Printf("targetCont----3----->%v\n", string(jsonCont)) // fmt.Printf("targetCont----3----->%v\n", string(jsonCont))
overall.CONSTANT_DB_KPI.Create(&tarDepartCont) overall.CONSTANT_DB_KPI.Create(&tarDepartCont)
} }
syncSeting.Add(1) SyncSeting.Add(1)
go DepartAboutPostTargetReport(dimensionId, targetId, targetSunId, bylawsId, departId, postId, v.Child, class, nature) go DepartAboutPostTargetReport(dimensionId, targetId, targetSunId, bylawsId, departId, postId, v.Child, class, nature)
} }
@ -2502,7 +2502,7 @@ func departmentAboutPostTarget(dimensionId, targetId, targetSunId, bylawsId int6
func departAboutPostTargetReport(dimensionId, targetId, targetSunId, bylawsId, departmentId, postId int64, repart []loopStruct, class, nature int) func departAboutPostTargetReport(dimensionId, targetId, targetSunId, bylawsId, departmentId, postId int64, repart []loopStruct, class, nature int)
*/ */
func DepartAboutPostTargetReport(dimensionId, targetId, targetSunId, bylawsId, departmentId, postId int64, repart []LoopStruct, class, nature int) { func DepartAboutPostTargetReport(dimensionId, targetId, targetSunId, bylawsId, departmentId, postId int64, repart []LoopStruct, class, nature int) {
defer syncSeting.Done() defer SyncSeting.Done()
//将不属于该指标细则的部门至禁用 //将不属于该指标细则的部门至禁用
otherSaveData := publicmethod.MapOut[string]() otherSaveData := publicmethod.MapOut[string]()
otherSaveData["`state`"] = 2 otherSaveData["`state`"] = 2
@ -2624,10 +2624,10 @@ func (a *ApiMethod) DeparSonTargetAboutPost(c *gin.Context) {
publicmethod.Result(101, ov, c, "请指定部的对照岗位!") publicmethod.Result(101, ov, c, "请指定部的对照岗位!")
return return
} }
syncSeting.Add(1) SyncSeting.Add(1)
go departmentAboutPostTarget(fashTar.Dimension, targetCont.ParentId, targetCont.Id, 0, ov.Id, ov.Child, 2, fashTar.Type) go departmentAboutPostTarget(fashTar.Dimension, targetCont.ParentId, targetCont.Id, 0, ov.Id, ov.Child, 2, fashTar.Type)
} }
syncSeting.Wait() SyncSeting.Wait()
publicmethod.Result(0, err, c) publicmethod.Result(0, err, c)
} }
@ -2659,10 +2659,10 @@ func (a *ApiMethod) DeparDetaileAboutPost(c *gin.Context) {
publicmethod.Result(101, ov, c, "请指定部的对照岗位!") publicmethod.Result(101, ov, c, "请指定部的对照岗位!")
return return
} }
syncSeting.Add(1) SyncSeting.Add(1)
go departmentAboutPostTarget(fashTar.Dimension, targetCont.ParentId, targetCont.ParentIdSun, targetCont.Id, ov.Id, ov.Child, 2, fashTar.Type) go departmentAboutPostTarget(fashTar.Dimension, targetCont.ParentId, targetCont.ParentIdSun, targetCont.Id, ov.Id, ov.Child, 2, fashTar.Type)
} }
syncSeting.Wait() SyncSeting.Wait()
publicmethod.Result(0, err, c) publicmethod.Result(0, err, c)
} }
@ -2695,13 +2695,13 @@ func (a *ApiMethod) DelTarget(c *gin.Context) {
if len(sonTargetList) > 0 { if len(sonTargetList) > 0 {
for _, v := range sonTargetList { for _, v := range sonTargetList {
//软删除所有此子栏目下的指标细则 //软删除所有此子栏目下的指标细则
syncSeting.Add(1) SyncSeting.Add(1)
go softDetaildeCont(sonTargetCont.Id, v, delTime) go softDetaildeCont(sonTargetCont.Id, v, delTime)
//软删除所有此子栏目相关的联部门 //软删除所有此子栏目相关的联部门
syncSeting.Add(1) SyncSeting.Add(1)
go softDelTargetDepartment(map[string]interface{}{"target_id": sonTargetCont.Id, "target_sun_id": v, "`state`": 1}, delTime) go softDelTargetDepartment(map[string]interface{}{"target_id": sonTargetCont.Id, "target_sun_id": v, "`state`": 1}, delTime)
//软删除所有此子栏目相关联的提报人 //软删除所有此子栏目相关联的提报人
syncSeting.Add(1) SyncSeting.Add(1)
go softDelTargetReport(map[string]interface{}{"`target_id`": sonTargetCont.Id, "`target_sun_id`": v, "`state`": 1}, delTime) go softDelTargetReport(map[string]interface{}{"`target_id`": sonTargetCont.Id, "`target_sun_id`": v, "`state`": 1}, delTime)
} }
} }
@ -2709,7 +2709,7 @@ func (a *ApiMethod) DelTarget(c *gin.Context) {
//软删除此指标 //软删除此指标
var delTargetSon modelskpi.EvaluationTarget var delTargetSon modelskpi.EvaluationTarget
err = delTargetSon.EiteCont(map[string]interface{}{"`et_id`": sonTargetCont.Id}, map[string]interface{}{"`et_state`": 3, "`et_time`": delTime}) err = delTargetSon.EiteCont(map[string]interface{}{"`et_id`": sonTargetCont.Id}, map[string]interface{}{"`et_state`": 3, "`et_time`": delTime})
syncSeting.Wait() SyncSeting.Wait()
if err != nil { if err != nil {
publicmethod.Result(106, err, c) publicmethod.Result(106, err, c)
return return

2
api/version1/departmentseting/departmentpc/type.go

@ -11,7 +11,7 @@ import (
type ApiMethod struct{} type ApiMethod struct{}
// 协程设置 // 协程设置
var syncSeting = sync.WaitGroup{} var SyncSeting = sync.WaitGroup{}
// 部门考核WEB端入口 // 部门考核WEB端入口
func (a *ApiMethod) Index(c *gin.Context) { func (a *ApiMethod) Index(c *gin.Context) {

633
api/version1/postseting/postpc/details.go

@ -202,6 +202,7 @@ func (a *ApiMethod) GetNewTargetAboutDepartToPostMan(c *gin.Context) {
} }
var orgPostInfo OrgPostCont var orgPostInfo OrgPostCont
orgPostInfo.Id = postIdstr orgPostInfo.Id = postIdstr
orgPostInfo.OrgId = orgIdstr
var postInfo modelshr.Position var postInfo modelshr.Position
postInfo.GetCont(map[string]interface{}{"`id`": v.PostId}, "`name`") postInfo.GetCont(map[string]interface{}{"`id`": v.PostId}, "`name`")
_, _, departmentId, sunDepartId, workShopId := publicmethod.GetOrgStructure(v.DepartmentId) _, _, departmentId, sunDepartId, workShopId := publicmethod.GetOrgStructure(v.DepartmentId)
@ -634,7 +635,7 @@ func PostDetailsBaseOrgPostMan(dimensionId, targetId, tableId, bylawsId int64, c
otherSaveData["`state`"] = 2 otherSaveData["`state`"] = 2
otherSaveData["`time`"] = time.Now().Unix() otherSaveData["`time`"] = time.Now().Unix()
for _, val := range orgManList { for _, val := range orgManList {
overall.CONSTANT_DB_KPI.Model(&modelskpi.TargetReport{}).Where("`level` = ? AND `target_id` = ? AND `target_sun_id` = ? AND `target_bylaws` = ? AND `type` = ? AND `department_id` = ? AND `post_id` = ?", types, targetId, targetId, bylawsId, level, val.OrgId, val.PostId).Not(map[string]interface{}{"man_key": val.ManKey}).Updates(&otherSaveData) overall.CONSTANT_DB_KPI.Model(&modelskpi.TargetReport{}).Where("`type_level` = ? AND `target_id` = ? AND `target_sun_id` = ? AND `target_bylaws` = ? AND `type` = ? AND `department_id` = ? AND `post_id` = ?", types, targetId, tableId, bylawsId, level, val.OrgId, val.PostId).Not(map[string]interface{}{"man_key": val.ManKey}).Updates(&otherSaveData)
} }
//处理指标细则提报人问题 //处理指标细则提报人问题
for _, v := range orgPostManList { for _, v := range orgPostManList {
@ -642,7 +643,7 @@ func PostDetailsBaseOrgPostMan(dimensionId, targetId, tableId, bylawsId int64, c
var manCont modelshr.PersonArchives var manCont modelshr.PersonArchives
manCont.GetCont(map[string]interface{}{"`key`": v.ManKey}, "`maindeparment`") manCont.GetCont(map[string]interface{}{"`key`": v.ManKey}, "`maindeparment`")
var tarDepartCont modelskpi.TargetReport var tarDepartCont modelskpi.TargetReport
saveErr := tarDepartCont.GetCont(map[string]interface{}{"`level`": types, "`type`": level, "`target_id`": targetId, "`target_sun_id`": tableId, "`target_bylaws`": bylawsId, "`department_id`": v.OrgId, "`post_id`": v.PostId, "`man_key`": v.ManKey}, "`id`", "`state`") saveErr := tarDepartCont.GetCont(map[string]interface{}{"`type_level`": types, "`type`": level, "`target_id`": targetId, "`target_sun_id`": tableId, "`target_bylaws`": bylawsId, "`department_id`": v.OrgId, "`post_id`": v.PostId, "`man_key`": v.ManKey}, "`id`", "`state`")
if saveErr == nil { if saveErr == nil {
if tarDepartCont.State != 1 { if tarDepartCont.State != 1 {
tarDepartCont.EiteCont(map[string]interface{}{"`id`": tarDepartCont.Id}, map[string]interface{}{"`state`": 1, "`man_department`": manCont.MainDeparment, "`time`": time.Now().Unix()}) tarDepartCont.EiteCont(map[string]interface{}{"`id`": tarDepartCont.Id}, map[string]interface{}{"`state`": 1, "`man_department`": manCont.MainDeparment, "`time`": time.Now().Unix()})
@ -651,7 +652,7 @@ func PostDetailsBaseOrgPostMan(dimensionId, targetId, tableId, bylawsId int64, c
var tarReportContAdd modelskpi.TargetReport var tarReportContAdd modelskpi.TargetReport
tarReportContAdd.Dimension = dimensionId //维度 tarReportContAdd.Dimension = dimensionId //维度
tarReportContAdd.TargetId = targetId //指标ID"` tarReportContAdd.TargetId = targetId //指标ID"`
tarReportContAdd.TargetSunId = targetId //子目标"` tarReportContAdd.TargetSunId = tableId //子目标"`
tarReportContAdd.TargetBylaws = bylawsId //指标细则"` tarReportContAdd.TargetBylaws = bylawsId //指标细则"`
tarReportContAdd.DepartmentId = v.OrgId //部门ID"` tarReportContAdd.DepartmentId = v.OrgId //部门ID"`
tarReportContAdd.PostId = v.PostId //岗位ID"` tarReportContAdd.PostId = v.PostId //岗位ID"`
@ -887,3 +888,629 @@ func EditPostTableCont(targetId int64, title string) (tableId int64, err error)
} }
return return
} }
/*
*
@ 作者: 秦东
@ 时间: 2023-02-23 08:15:29
@ 功能: 修改岗位指标细则新版
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func (a *ApiMethod) EditPostDetailsCont(c *gin.Context) {
var receivedValue EditDetailsCont
c.ShouldBindJSON(&receivedValue)
if receivedValue.Id == "" {
publicmethod.Result(101, receivedValue, c)
return
}
if receivedValue.Title == "" {
publicmethod.Result(1, receivedValue, c, "请输入考核内容!")
return
}
if receivedValue.PunishType == 0 {
receivedValue.PunishType = 3
}
switch receivedValue.PunishType {
case 2:
if receivedValue.CashStandard == "" {
publicmethod.Result(1, receivedValue, c, "请输入现金考核标准!")
return
}
case 3:
if receivedValue.Standard == "" {
publicmethod.Result(1, receivedValue, c, "请输入考核标准!")
return
}
if receivedValue.Unit == "" {
publicmethod.Result(1, receivedValue, c, "请输入计量单位!")
return
}
if receivedValue.CashStandard == "" {
publicmethod.Result(1, receivedValue, c, "请输入现金考核标准!")
return
}
default:
if receivedValue.Standard == "" {
publicmethod.Result(1, receivedValue, c, "请输入考核标准!")
return
}
if receivedValue.Unit == "" {
publicmethod.Result(1, receivedValue, c, "请输入计量单位!")
return
}
}
if receivedValue.Types == 0 {
receivedValue.Types = 2
}
if len(receivedValue.Inspemethod) < 1 {
publicmethod.Result(1, receivedValue, c, "请选择检查方式!")
return
}
if receivedValue.Cycle == 0 {
receivedValue.Cycle = 4
}
if receivedValue.Frequency == 0 {
receivedValue.Frequency = 1
}
var orgPost []OrgAndPostCont
var orgPostMan []OrgAndPostManCont
var orgList []string
var postList []string
var manList []string
if len(receivedValue.PostandExport) < 1 {
publicmethod.Result(1, receivedValue, c, "请设定岗位及提报人!")
return
} else {
for _, v := range receivedValue.PostandExport {
var orgPostCont OrgAndPostCont
orgIdInt, _ := strconv.ParseInt(v.OrgId, 10, 64)
orgPostCont.OrgId = orgIdInt
postIdInt, _ := strconv.ParseInt(v.Id, 10, 64)
orgPostCont.PostId = postIdInt
orgPost = append(orgPost, orgPostCont)
if publicmethod.IsInTrue[string](v.OrgId, orgList) == false {
orgList = append(orgList, v.OrgId)
}
if publicmethod.IsInTrue[string](v.Id, postList) == false {
postList = append(postList, v.Id)
}
if len(v.Operator) < 1 {
publicmethod.Result(1, receivedValue, c, "有未设定的岗位提报人!请检查!")
return
} else {
for _, mv := range v.Operator {
var orgPostManCont OrgAndPostManCont
orgPostManCont.OrgId = orgIdInt
orgPostManCont.PostId = postIdInt
mvIdInt, _ := strconv.ParseInt(mv, 10, 64)
orgPostManCont.ManKey = mvIdInt
orgPostMan = append(orgPostMan, orgPostManCont)
if publicmethod.IsInTrue[string](mv, manList) == false {
manList = append(manList, mv)
}
}
}
}
}
wher := publicmethod.MapOut[string]()
wher["`id`"] = receivedValue.Id
var oldDetailsCont modelskpi.PostTargetDetails
err := oldDetailsCont.GetCont(wher)
if err != nil {
publicmethod.Result(1, receivedValue, c, "细则不存在!请检查!")
return
}
editCont := publicmethod.MapOut[string]()
if receivedValue.Title != oldDetailsCont.Title {
editCont["`title`"] = receivedValue.Title
}
if receivedValue.PunishType != oldDetailsCont.Punishmode {
editCont["`punishmode`"] = receivedValue.PunishType
}
if receivedValue.Standard != "" {
minSecor, MaxSecor := departmentpc.SplitCriteria(receivedValue.Standard)
if minSecor != oldDetailsCont.MinScore {
editCont["`min_score`"] = minSecor
}
if MaxSecor != oldDetailsCont.MaxScore {
editCont["`max_score`"] = MaxSecor
}
}
if receivedValue.Unit != oldDetailsCont.Company {
editCont["`company`"] = receivedValue.Unit
}
if receivedValue.CashStandard != "" {
minMoneys, MaxMoneys := departmentpc.SplitCriteria(receivedValue.CashStandard)
if minMoneys != oldDetailsCont.Minmoney {
editCont["`minmoney`"] = minMoneys
}
if MaxMoneys != oldDetailsCont.Maxmoney {
editCont["`maxmoney`"] = MaxMoneys
}
}
if receivedValue.Types != oldDetailsCont.AddReduce {
editCont["`add_reduce`"] = receivedValue.Types
}
if len(receivedValue.Inspemethod) > 0 {
insStr := strings.Join(receivedValue.Inspemethod, ",")
if insStr != oldDetailsCont.CensorType {
editCont["`censor_type`"] = insStr
}
}
if receivedValue.Cycle != oldDetailsCont.Cycles {
editCont["`cycle`"] = receivedValue.Cycle
}
if receivedValue.Frequency != oldDetailsCont.CensorRate {
editCont["`censor_rate`"] = receivedValue.Frequency
}
if receivedValue.Evidence != oldDetailsCont.CensorCont {
editCont["`censor_cont`"] = receivedValue.Evidence
}
if receivedValue.Remarks != oldDetailsCont.Content {
editCont["`content`"] = receivedValue.Remarks
}
editCont["`paretment`"] = strings.Join(orgList, ",")
editCont["`paretment_post`"] = strings.Join(postList, ",")
editCont["`reportary`"] = strings.Join(manList, ",")
if len(editCont) > 0 {
editCont["`time`"] = time.Now().Unix()
var editInfoCont modelskpi.PostTargetDetails
err = editInfoCont.EiteCont(wher, editCont)
if err != nil {
publicmethod.Result(106, err, c)
return
}
}
var targetCont modelskpi.PostTarget
targetCont.GetCont(map[string]interface{}{"`id`": oldDetailsCont.ParentId})
syncSeting.Add(1)
go PostDetailsBaseOrgPost(targetCont.Dimension, targetCont.Id, oldDetailsCont.ParentIdSun, oldDetailsCont.Id, targetCont.Type, 3, 2, orgPost)
syncSeting.Add(1)
go PostDetailsBaseOrgPostMan(targetCont.Dimension, targetCont.Id, oldDetailsCont.ParentIdSun, oldDetailsCont.Id, targetCont.Type, 3, 2, orgPostMan)
syncSeting.Wait()
publicmethod.Result(0, err, c)
}
/*
*
@ 作者: 秦东
@ 时间: 2023-02-23 13:49:06
@ 功能: 根据栏目添加细则列表
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func (a *ApiMethod) AddTableDetailsList(c *gin.Context) {
var receivedValue AddTablePostDetails
c.ShouldBindJSON(&receivedValue)
if receivedValue.TargetId == "" {
publicmethod.Result(101, receivedValue, c)
return
}
if receivedValue.TableId == "" {
publicmethod.Result(1, receivedValue, c, "未知栏目!请选择或输入栏目!")
return
}
iswrite := true
if len(receivedValue.DetailsList) < 1 {
publicmethod.Result(1, receivedValue, c, "至少要有一条细则!")
return
} else {
for _, v := range receivedValue.DetailsList {
if v.Title == "" {
iswrite = false
break
}
switch v.PunishType {
case 2:
if v.CashStandard == "" {
iswrite = false
break
} else {
testInt := strings.Split(v.CashStandard, "-")
testLen := len(testInt)
_, oenErr := strconv.ParseFloat(testInt[0], 10)
if oenErr != nil {
iswrite = false
break
} else {
if testLen > 1 {
_, twoErr := strconv.ParseFloat(testInt[testLen-1], 10)
if twoErr != nil {
iswrite = false
break
}
}
}
}
case 3:
if v.CashStandard == "" || v.Standard == "" {
iswrite = false
break
} else {
testInt := strings.Split(v.CashStandard, "-")
testLen := len(testInt)
_, oenErr := strconv.ParseFloat(testInt[0], 10)
if oenErr != nil {
iswrite = false
break
} else {
if testLen > 1 {
_, twoErr := strconv.ParseFloat(testInt[testLen-1], 10)
if twoErr != nil {
iswrite = false
break
}
}
}
testIntTwo := strings.Split(v.Standard, "-")
testLenTwo := len(testIntTwo)
_, oenErrTwo := strconv.ParseFloat(testIntTwo[0], 10)
if oenErrTwo != nil {
iswrite = false
break
} else {
if testLenTwo > 1 {
_, twoErr := strconv.ParseFloat(testIntTwo[testLenTwo-1], 10)
if twoErr != nil {
iswrite = false
break
}
}
}
}
default:
if v.Standard == "" {
iswrite = false
break
} else {
testInt := strings.Split(v.Standard, "-")
testLen := len(testInt)
_, oenErr := strconv.ParseFloat(testInt[0], 10)
if oenErr != nil {
iswrite = false
break
} else {
if testLen > 1 {
_, twoErr := strconv.ParseFloat(testInt[testLen-1], 10)
if twoErr != nil {
iswrite = false
break
}
}
}
}
}
if len(v.Inspemethod) < 1 {
iswrite = false
break
}
}
}
if !iswrite {
publicmethod.Result(1, receivedValue, c, "至少有一条细则内容填写不规范!请检查!")
return
}
var targetCont modelskpi.PostTarget
err := targetCont.GetCont(map[string]interface{}{"`id`": receivedValue.TargetId})
if err != nil {
publicmethod.Result(1, receivedValue, c, "指标不存在!不允许添加细则内容!")
return
}
orgList, postList, manList, orgPost, orgPostMan := GetTargetBaseDepartMan(targetCont.Id)
// tableId, err := EditPostTableCont(targetCont.Id, receivedValue.TableName)
// if err != nil {
// publicmethod.Result(1, receivedValue, c, "没有栏目信息!栏目添加失败!请重新提交!")
// return
// }
tableId, _ := strconv.ParseInt(receivedValue.TableId, 10, 64)
var tableDepartList []string
var tablePostList []string
var tableDepartPost []OrgAndPostCont
var tableDepartPostMan []OrgAndPostManCont
//处理岗位细则内容
for _, v := range receivedValue.DetailsList {
var targetDetailsInfo modelskpi.PostTargetDetails
targetDetailsInfo.Title = v.Title //指标细则"`
targetDetailsInfo.Content = v.Remarks //指标说明"`
targetDetailsInfo.ParentId = targetCont.Id //归属指标栏目"`
targetDetailsInfo.ParentIdSun = tableId //归属指标子栏目"`
targetDetailsInfo.State = 1 //状态(1:启用;2:禁用;3:删除)"`
targetDetailsInfo.AddTime = time.Now().Unix() //制定时间"`
targetDetailsInfo.MinScore, targetDetailsInfo.MaxScore = departmentpc.SplitCriteria(v.Standard) //最小分*100保存"` && 最大分*100保存"`
targetDetailsInfo.Company = v.Unit //单位"`
targetDetailsInfo.AddReduce = v.Types //1:减少;2:增加;3:无属性,现场确认加或减"`
targetDetailsInfo.CensorType = strings.Join(v.Inspemethod, ",") //检查方式"`
targetDetailsInfo.CensorCont = v.Evidence //检查依据"`
targetDetailsInfo.CensorRate = v.Frequency //检查频次"`
targetDetailsInfo.Cycles = v.Cycle //1:班;2:天;3:周;4:月;5:季度;6:年"`
targetDetailsInfo.CycleAttres = 1 //辅助计数"`
if len(v.PostandExport) > 0 {
orgList, postList, manList, orgPost, orgPostMan = HandleOrgOfPostReportRelation(v.PostandExport)
// orgListJson, _ := json.Marshal(orgList)
// postListJson, _ := json.Marshal(postList)
// manListJson, _ := json.Marshal(manList)
// orgPostJson, _ := json.Marshal(orgPost)
// orgPostManJson, _ := json.Marshal(orgPostMan)
// fmt.Printf("明细表关联关系--->%v--->%v--->%v--->%v--->%v\n", string(orgListJson), string(postListJson), string(manListJson), string(orgPostJson), string(orgPostManJson))
}
targetDetailsInfo.Paretment = strings.Join(orgList, ",") //接受考核的部门"`
targetDetailsInfo.ParetmentPost = strings.Join(postList, ",") //接受考核的部门岗位"`
targetDetailsInfo.Reportary = strings.Join(manList, ",") //提报人"`
targetDetailsInfo.Punishmode = v.PunishType //处罚方式 1:扣分;2:现金处罚;3:扣分加现金"`
targetDetailsInfo.Minmoney, targetDetailsInfo.Maxmoney = departmentpc.SplitCriteria(v.CashStandard) //最高罚款"`&& 最低罚款"`
addErr := overall.CONSTANT_DB_KPI.Create(&targetDetailsInfo).Error //添加指标
if addErr == nil {
syncSeting.Add(1)
go PostDetailsBaseOrgPost(targetCont.Dimension, targetCont.Id, tableId, targetDetailsInfo.Id, targetCont.Type, 3, 2, orgPost)
syncSeting.Add(1)
go PostDetailsBaseOrgPostMan(targetCont.Dimension, targetCont.Id, tableId, targetDetailsInfo.Id, targetCont.Type, 3, 2, orgPostMan)
}
//处理指标关联数据
for _, ov := range orgList {
if publicmethod.IsInTrue[string](ov, tableDepartList) == false {
tableDepartList = append(tableDepartList, ov)
}
}
for _, pv := range postList {
if publicmethod.IsInTrue[string](pv, tablePostList) == false {
tablePostList = append(tablePostList, pv)
}
}
for _, opv := range orgPost {
if JudgeDeparPost(opv, tableDepartPost) == false {
tableDepartPost = append(tableDepartPost, opv)
}
}
for _, opvm := range orgPostMan {
if JudgeDeparPostMan(opvm, tableDepartPostMan) == false {
tableDepartPostMan = append(tableDepartPostMan, opvm)
}
}
}
// one, _ := json.Marshal(tableDepartList)
// two, _ := json.Marshal(tablePostList)
// three, _ := json.Marshal(tableDepartPost)
// four, _ := json.Marshal(tableDepartPostMan)
// fmt.Printf("栏目明细表关联关系--->%v--->%v--->%v--->%v\n", string(one), string(two), string(three), string(four))
editTabelInfo := publicmethod.MapOut[string]()
tableDepartStr := strings.Join(tableDepartList, ",")
editTabelInfo["`depart`"] = tableDepartStr
tablePostStr := strings.Join(tablePostList, ",")
editTabelInfo["`depart_post`"] = tablePostStr
editTabelInfo["`time`"] = time.Now().Unix()
var editTableCont modelskpi.PostSonTarget
editTableCont.EiteCont(map[string]interface{}{"`id`": tableId}, editTabelInfo)
syncSeting.Add(1)
go PostDetailsBaseOrgPost(targetCont.Dimension, targetCont.Id, tableId, 0, targetCont.Type, 2, 2, tableDepartPost)
syncSeting.Add(1)
go PostDetailsBaseOrgPostMan(targetCont.Dimension, targetCont.Id, tableId, 0, targetCont.Type, 2, 2, tableDepartPostMan)
syncSeting.Wait()
publicmethod.Result(0, receivedValue, c)
}
/*
*
@ 作者: 秦东
@ 时间: 2023-02-23 14:58:36
@ 功能: 获取岗位栏目关联部门相关岗位及提报人(新版)
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func (a *ApiMethod) GetNewTableDepartToPostMan(c *gin.Context) {
var receivedValue publicmethod.PublicId
err := c.ShouldBindJSON(&receivedValue)
if err != nil {
publicmethod.Result(100, err, c)
return
}
if receivedValue.Id == "" {
publicmethod.Result(101, receivedValue, c)
return
}
var postTargetCont modelskpi.PostSonTarget
err = postTargetCont.GetCont(map[string]interface{}{"`id`": receivedValue.Id})
if err != nil {
publicmethod.Result(107, err, c)
return
}
var sendCont OutTableDepatPostMan
sendCont.Name = postTargetCont.Title
var tarDepatContList []modelskpi.TargetDepartment
err = overall.CONSTANT_DB_KPI.Model(&modelskpi.TargetDepartment{}).Select("`department_id`,`post_id`").Where("`state` = 1 AND `type` = 2 AND `level` = 2 AND `target_id` = ? AND `target_sun_id` = ? AND `target_bylaws` = 0", postTargetCont.ParentId, postTargetCont.Id).Find(&tarDepatContList).Error
if err != nil && len(tarDepatContList) < 1 {
publicmethod.Result(107, err, c)
return
}
for _, v := range tarDepatContList {
orgIdstr := strconv.FormatInt(v.DepartmentId, 10)
if publicmethod.IsInTrue[string](orgIdstr, sendCont.OrgId) == false {
sendCont.OrgId = append(sendCont.OrgId, orgIdstr)
}
postIdstr := strconv.FormatInt(v.PostId, 10)
if publicmethod.IsInTrue[string](postIdstr, sendCont.PostId) == false {
sendCont.PostId = append(sendCont.PostId, postIdstr)
}
var orgPostInfo OrgPostCont
orgPostInfo.Id = postIdstr
orgPostInfo.OrgId = orgIdstr
var postInfo modelshr.Position
postInfo.GetCont(map[string]interface{}{"`id`": v.PostId}, "`name`")
_, _, departmentId, sunDepartId, workShopId := publicmethod.GetOrgStructure(v.DepartmentId)
fmt.Printf("%v------->%v------->%v\n", departmentId, sunDepartId, workShopId)
if departmentId != 0 && sunDepartId != 0 && workShopId != 0 {
if departmentId != workShopId && sunDepartId != workShopId && departmentId != sunDepartId {
orgPostInfo.Name = fmt.Sprintf("%v/%v/%v/%v", getOrgCont(departmentId), getOrgCont(sunDepartId), getOrgCont(workShopId), postInfo.Name)
} else if departmentId != workShopId && sunDepartId != workShopId && departmentId == sunDepartId {
orgPostInfo.Name = fmt.Sprintf("%v/%v/%v", getOrgCont(departmentId), getOrgCont(sunDepartId), postInfo.Name)
} else {
orgPostInfo.Name = fmt.Sprintf("%v/%v", getOrgCont(departmentId), postInfo.Name)
}
} else if departmentId != 0 && sunDepartId != 0 && workShopId == 0 {
if departmentId != sunDepartId {
orgPostInfo.Name = fmt.Sprintf("%v/%v/%v", getOrgCont(departmentId), getOrgCont(sunDepartId), postInfo.Name)
} else {
orgPostInfo.Name = fmt.Sprintf("%v/%v", getOrgCont(departmentId), postInfo.Name)
}
} else {
orgPostInfo.Name = fmt.Sprintf("%v/%v", getOrgCont(departmentId), postInfo.Name)
}
orgPostInfo.KeyList, orgPostInfo.Child = GetReportAndAllDepartMan(postTargetCont.ParentId, postTargetCont.Id, 0, 0, v.PostId, departmentId, 2, 2)
sendCont.OrgAndPostList = append(sendCont.OrgAndPostList, orgPostInfo)
}
publicmethod.Result(0, sendCont, c)
}
/*
*
@ 作者: 秦东
@ 时间: 2023-02-23 15:29:30
@ 功能: 编辑岗位子栏目内容(新版)
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func (a *ApiMethod) EditSonTargetContNew(c *gin.Context) {
var receivedValue EditTableCont
c.ShouldBindJSON(&receivedValue)
if receivedValue.Id == "" {
publicmethod.Result(101, receivedValue, c)
return
}
if receivedValue.Title == "" {
publicmethod.Result(1, receivedValue, c, "请输入考核内容!")
return
}
var orgPost []OrgAndPostCont
var orgPostMan []OrgAndPostManCont
var orgList []string
var postList []string
var manList []string
if len(receivedValue.PostandExport) < 1 {
publicmethod.Result(1, receivedValue, c, "请设定岗位及提报人!")
return
} else {
for _, v := range receivedValue.PostandExport {
var orgPostCont OrgAndPostCont
orgIdInt, _ := strconv.ParseInt(v.OrgId, 10, 64)
orgPostCont.OrgId = orgIdInt
postIdInt, _ := strconv.ParseInt(v.Id, 10, 64)
orgPostCont.PostId = postIdInt
orgPost = append(orgPost, orgPostCont)
if publicmethod.IsInTrue[string](v.OrgId, orgList) == false {
orgList = append(orgList, v.OrgId)
}
if publicmethod.IsInTrue[string](v.Id, postList) == false {
postList = append(postList, v.Id)
}
if len(v.KeyList) < 1 {
publicmethod.Result(1, receivedValue, c, "有未设定的岗位提报人!请检查!")
return
} else {
for _, mv := range v.KeyList {
var orgPostManCont OrgAndPostManCont
orgPostManCont.OrgId = orgIdInt
orgPostManCont.PostId = postIdInt
mvIdInt, _ := strconv.ParseInt(mv, 10, 64)
orgPostManCont.ManKey = mvIdInt
orgPostMan = append(orgPostMan, orgPostManCont)
if publicmethod.IsInTrue[string](mv, manList) == false {
manList = append(manList, mv)
}
}
}
}
}
wher := publicmethod.MapOut[string]()
wher["`id`"] = receivedValue.Id
var oldDetailsCont modelskpi.PostSonTarget
err := oldDetailsCont.GetCont(wher)
if err != nil {
publicmethod.Result(1, receivedValue, c, "细则不存在!请检查!")
return
}
editCont := publicmethod.MapOut[string]()
if receivedValue.Title != oldDetailsCont.Title {
editCont["`title`"] = receivedValue.Title
}
orgString := strings.Join(orgList, ",")
if orgString != oldDetailsCont.Depart {
editCont["`depart`"] = orgString
}
postString := strings.Join(postList, ",")
if postString != oldDetailsCont.DepartPost {
editCont["`depart_post`"] = postList
}
if oldDetailsCont.State != 1 {
editCont["`state`"] = 1
}
if len(editCont) > 0 {
editCont["`time`"] = time.Now().Unix()
var editTabInfo modelskpi.PostSonTarget
err = editTabInfo.EiteCont(wher, editCont)
}
// sendData := publicmethod.MapOut[string]()
// sendData["orgPost"] = orgPost
// sendData["orgPostMan"] = orgPostMan
// sendData["orgList"] = orgList
// sendData["postList"] = postList
// sendData["manList"] = manList
// sendData["oldDetailsCont"] = oldDetailsCont
var targetCont modelskpi.PostTarget
targetCont.GetCont(map[string]interface{}{"`id`": oldDetailsCont.ParentId})
syncSeting.Add(1)
go PostDetailsBaseOrgPost(targetCont.Dimension, targetCont.Id, oldDetailsCont.Id, 0, targetCont.Type, 2, 2, orgPost)
syncSeting.Add(1)
go PostDetailsBaseOrgPostMan(targetCont.Dimension, targetCont.Id, oldDetailsCont.Id, 0, targetCont.Type, 2, 2, orgPostMan)
syncSeting.Wait()
publicmethod.Result(0, err, c)
}

74
api/version1/postseting/postpc/targetpost.go

@ -1108,7 +1108,7 @@ func (a *ApiMethod) DelSonTargetCont(c *gin.Context) {
xiZeWhere := publicmethod.MapOut[string]() xiZeWhere := publicmethod.MapOut[string]()
xiZeWhere["`parentid`"] = sonTarCont.ParentId xiZeWhere["`parentid`"] = sonTarCont.ParentId
xiZeWhere["`parentid_sun`"] = sonTarCont.Id xiZeWhere["`parentid_sun`"] = sonTarCont.Id
xiZeWhere["`paretment`"] = sonTarCont.Depart // xiZeWhere["`paretment`"] = sonTarCont.Depart
var postTarDetaCont modelskpi.PostTargetDetails var postTarDetaCont modelskpi.PostTargetDetails
postTarDetaCont.EiteCont(xiZeWhere, map[string]interface{}{"`state`": 3, "`time`": time.Now().Unix()}) postTarDetaCont.EiteCont(xiZeWhere, map[string]interface{}{"`state`": 3, "`time`": time.Now().Unix()})
publicmethod.Result(0, err, c) publicmethod.Result(0, err, c)
@ -1319,6 +1319,7 @@ func (a *ApiMethod) EidtPostTarDetailsStrte(c *gin.Context) {
publicmethod.Result(1, detaErr, c, "该指标细则不存在!") publicmethod.Result(1, detaErr, c, "该指标细则不存在!")
return return
} }
softDel := 1
if requestData.State != 3 { if requestData.State != 3 {
saveData := publicmethod.MapOut[string]() saveData := publicmethod.MapOut[string]()
saveData["state"] = requestData.State saveData["state"] = requestData.State
@ -1339,6 +1340,7 @@ func (a *ApiMethod) EidtPostTarDetailsStrte(c *gin.Context) {
return return
} }
} else { } else {
softDel = 2
saveErr := detaCont.DelCont(where) saveErr := detaCont.DelCont(where)
if saveErr != nil { if saveErr != nil {
publicmethod.Result(1, saveErr, c, "编辑失败!") publicmethod.Result(1, saveErr, c, "编辑失败!")
@ -1346,6 +1348,11 @@ func (a *ApiMethod) EidtPostTarDetailsStrte(c *gin.Context) {
} }
} }
} }
departmentpc.SyncSeting.Add(1)
go departmentpc.TarDepartState(detaCont.ParentId, detaCont.ParentIdSun, detaCont.Id, requestData.State, softDel, 2, 3) // 处理关联部门
departmentpc.SyncSeting.Add(1)
go departmentpc.TarAboutReport(detaCont.ParentId, detaCont.ParentIdSun, detaCont.Id, requestData.State, softDel, 2, 3) // 处理相关提报人
departmentpc.SyncSeting.Wait()
publicmethod.Result(0, detaCont, c) publicmethod.Result(0, detaCont, c)
} }
@ -1523,24 +1530,79 @@ func (a *ApiMethod) GetDetailsCont(c *gin.Context) {
} else { } else {
sendData.CashStandard = fmt.Sprintf("%v", publicmethod.DecimalEs(float64(detaCont.Maxmoney)/100, 2)) sendData.CashStandard = fmt.Sprintf("%v", publicmethod.DecimalEs(float64(detaCont.Maxmoney)/100, 2))
} }
paretmentIdInt, _ := strconv.ParseInt(detaCont.Paretment, 10, 64) // paretmentIdInt, _ := strconv.ParseInt(detaCont.Paretment, 10, 64)
var postTarCont modelskpi.PostTarget var postTarCont modelskpi.PostTarget
postTarCont.GetCont(map[string]interface{}{"`id`": detaCont.ParentId}, "`dimension`") postTarCont.GetCont(map[string]interface{}{"`id`": detaCont.ParentId}, "`dimension`")
dimensionId := postTarCont.Dimension // dimensionId := postTarCont.Dimension
sendData.Title = detaCont.Title sendData.Title = detaCont.Title
sendData.Unit = detaCont.Company //单位 sendData.Unit = detaCont.Company //单位
sendData.Class = detaCont.AddReduce //1:减少;2:增加;3:无属性,现场确认加或减 sendData.Class = detaCont.AddReduce
sendData.Inspect = strings.Split(detaCont.CensorType, ",") //检查方式(1:现场检查;2:资料检查;3:事件触发) var inspectInt []int
inspectStrList := strings.Split(detaCont.CensorType, ",")
for _, iv := range inspectStrList {
ivInt, _ := strconv.Atoi(iv)
inspectInt = append(inspectInt, ivInt)
} //1:减少;2:增加;3:无属性,现场确认加或减
sendData.InspectItn = inspectInt
sendData.Inspect = inspectStrList //检查方式(1:现场检查;2:资料检查;3:事件触发)
sendData.Cycle = detaCont.Cycles //1:班;2:天;3:周;4:月;5:季度;6:年 sendData.Cycle = detaCont.Cycles //1:班;2:天;3:周;4:月;5:季度;6:年
sendData.CycleAttr = detaCont.CycleAttres //辅助计数 sendData.CycleAttr = detaCont.CycleAttres //辅助计数
sendData.Frequency = detaCont.CensorRate //频次 sendData.Frequency = detaCont.CensorRate //频次
sendData.Evidence = detaCont.CensorCont //客观证据 sendData.Evidence = detaCont.CensorCont //客观证据
sendData.Explain = detaCont.Content //备注说明 sendData.Explain = detaCont.Content //备注说明
_, sendData.RelevantPostsMan, _ = getTargetAboutPostDeta(paretmentIdInt, dimensionId, detaCont.ParentId, detaCont.ParentIdSun, detaCont.Id, 2) //相关岗位与提报人 // _, sendData.RelevantPostsMan, _ = getTargetAboutPostDeta(paretmentIdInt, dimensionId, detaCont.ParentId, detaCont.ParentIdSun, detaCont.Id, 2) //相关岗位与提报人
sendData.RelevantPostsMan = GetPostReportList(detaCont.ParentId, detaCont.ParentIdSun, detaCont.Id, 3, 2)
sendData.PunishMode = detaCont.Punishmode //处罚方式 1:扣分;2:现金处罚;3:扣分加现金 sendData.PunishMode = detaCont.Punishmode //处罚方式 1:扣分;2:现金处罚;3:扣分加现金
publicmethod.Result(0, sendData, c) publicmethod.Result(0, sendData, c)
} }
// 获取关联岗位及提报人
/*
#targetId 指标ID
#tableId 栏目ID
#bylawsId 细则ID
#types 类型1指标2子目标3细则
#level 级别1部门级2岗位级
*/
func GetPostReportList(targetId, tableId, bylawsId int64, types, level int) (listCont []postPeople) {
var postTarDepartList []modelskpi.TargetDepartment
err := overall.CONSTANT_DB_KPI.Model(&modelskpi.TargetDepartment{}).Select("`department_id`,`post_id`").Where("`state` = 1 AND `type` = ? AND `level` = ? AND `target_id` = ? AND `target_sun_id` = ? AND `target_bylaws` = ?", types, level, targetId, tableId, bylawsId).Find(&postTarDepartList).Error
if err != nil {
return
}
for _, v := range postTarDepartList {
var contInfo postPeople
contInfo.Id = strconv.FormatInt(v.PostId, 10)
contInfo.OrgId = strconv.FormatInt(v.DepartmentId, 10)
contInfo.Operator = GetRepostList(targetId, tableId, bylawsId, v.DepartmentId, v.PostId, types, level)
listCont = append(listCont, contInfo)
}
return
}
// 获取提报人
/*
#targetId 指标ID
#tableId 栏目ID
#bylawsId 细则ID
#types 类型1指标2子目标3细则
#level 级别1部门级2岗位级
*/
func GetRepostList(targetId, tableId, bylawsId, orgId, postId int64, types, level int) (userKey []string) {
var mankey []int64
err := overall.CONSTANT_DB_KPI.Model(&modelskpi.TargetReport{}).Select("`man_key`").Where("`state` = 1 AND `type` = ? AND `type_level` = ? AND `target_id` = ? AND `target_sun_id` = ? AND `target_bylaws` = ? AND `department_id` = ? AND `post_id` = ?", level, types, targetId, tableId, bylawsId, orgId, postId).Find(&mankey).Error
if err != nil || len(mankey) < 1 {
return
}
for _, v := range mankey {
manKeyStr := strconv.FormatInt(v, 10)
if publicmethod.IsInTrue[string](manKeyStr, userKey) == false {
userKey = append(userKey, manKeyStr)
}
}
return
}
/* /*
获取岗位指标子细则相关岗位 获取岗位指标子细则相关岗位
@departmentId 部门Id @departmentId 部门Id

46
api/version1/postseting/postpc/teshutype.go

@ -63,6 +63,7 @@ type OrgPostCont struct {
publicmethod.PublicId publicmethod.PublicId
publicmethod.PublicName publicmethod.PublicName
Number string `json:"number"` Number string `json:"number"`
OrgId string `json:"orgid"`
KeyList []string `json:"keylist"` //已选择标识 KeyList []string `json:"keylist"` //已选择标识
Child *[]OrgPostCont `json:"child"` Child *[]OrgPostCont `json:"child"`
} }
@ -107,3 +108,48 @@ type ReportAry struct {
OrgAndPostCont OrgAndPostCont
ManKey []int64 `json:"mankey"` ManKey []int64 `json:"mankey"`
} }
// 编辑岗位细则结构体
type EditDetailsCont struct {
publicmethod.PublicId
Title string `json:"title"` //考核内容
PunishType int `json:"punishtype"` //1:分数;2:现金;3:分数加现金
Standard string `json:"standard"` //考核标准
Unit string `json:"unit"` //计量单位
CashStandard string `json:"cashstandard"` //现金考核标准
Types int `json:"types"` //操作种类1:加分;2:减分;3:加减分
Inspemethod []string `json:"inspemethod"` //检查方式
Cycle int `json:"cycle"` //周期
Frequency int `json:"frequency"` //检查频次
Evidence string `json:"evidence"` //客观证据
Remarks string `json:"remarks"` //备注说明
PostandExport []RelevantPostsMan `json:"relevantpostsman"` //相关岗位及提报人
}
// 相关行政组织岗位提报人
type RelevantPostsMan struct {
publicmethod.PublicId
OrgId string `json:"orgid"`
Operator []string `json:"operator"`
}
// 根据指标添加岗位细则
type AddTablePostDetails struct {
TargetId string `json:"targetid"` //指标Id
TableId string `json:"tableid"` //栏目名称
DetailsList []DetailsCont `json:"detailslist"` //岗位细则列表
}
type OutTableDepatPostMan struct {
publicmethod.PublicName
OrgId []string `json:"orgid"` //行政组织id
PostId []string `json:"postid"` //岗位ID
OrgAndPostList []OrgPostCont `json:"organdpostlist"` //行政组织与岗位列表
}
// 编辑栏目内容
type EditTableCont struct {
publicmethod.PublicId
Title string `json:"title"` //
PostandExport []OrgPostCont `json:"repostlist"` //
}

3
api/version1/postseting/postpc/type.go

@ -168,6 +168,7 @@ type getPostOneTarget struct {
type postPeople struct { type postPeople struct {
publicmethod.PublicId publicmethod.PublicId
publicmethod.PublicName publicmethod.PublicName
OrgId string `json:"orgid"` //行政组织Id
Operator []string `json:"operator"` //考核执行人 Operator []string `json:"operator"` //考核执行人
} }
@ -223,6 +224,8 @@ type postContList struct {
RelevantPostsMan []postPeople `json:"relevantpostsman"` //相关岗位与提报人 RelevantPostsMan []postPeople `json:"relevantpostsman"` //相关岗位与提报人
PunishMode int `json:"punishmode"` //处罚方式 1:扣分;2:现金处罚;3:扣分加现金 PunishMode int `json:"punishmode"` //处罚方式 1:扣分;2:现金处罚;3:扣分加现金
CashStandard string `json:"cashstandard"` //现金标准 CashStandard string `json:"cashstandard"` //现金标准
InspectItn []int `json:"inspectint"` //检查方式(1:现场检查;2:资料检查;3:事件触发)
PostManList []OrgPostCont `json:"postmanlist"` //关联岗位及提报人
} }
// 查看岗位定性考核细则列表 // 查看岗位定性考核细则列表

4
apirouter/v1/postseting/pc.go

@ -59,6 +59,8 @@ func (a *ApiRouter) RouterGroupPc(router *gin.RouterGroup) {
apiRouter.POST("edit_son_target_cont", methodBinding.EditSonTargetCont) //编辑岗位子栏目内容 apiRouter.POST("edit_son_target_cont", methodBinding.EditSonTargetCont) //编辑岗位子栏目内容
apiRouter.POST("del_son_target_cont", methodBinding.DelSonTargetCont) //删除子栏目 apiRouter.POST("del_son_target_cont", methodBinding.DelSonTargetCont) //删除子栏目
apiRouter.POST("table_base_post_target", methodBinding.TableBasePostTarget) //根据指标获取岗位指标栏目 apiRouter.POST("table_base_post_target", methodBinding.TableBasePostTarget) //根据指标获取岗位指标栏目
apiRouter.POST("get_new_table_departMan", methodBinding.GetNewTableDepartToPostMan) //获取岗位栏目关联部门相关岗位及提报人(新版)
apiRouter.POST("edit_newson_target_cont", methodBinding.EditSonTargetContNew) //编辑岗位子栏目内容(新版)
/* /*
定性指标细则 定性指标细则
*/ */
@ -69,6 +71,8 @@ func (a *ApiRouter) RouterGroupPc(router *gin.RouterGroup) {
apiRouter.POST("getdetailslist", methodBinding.GetDetailsList) //根据指标获取细则列表 apiRouter.POST("getdetailslist", methodBinding.GetDetailsList) //根据指标获取细则列表
apiRouter.POST("adddetailslist", methodBinding.AddDetailsList) //根据指标添加细则列表 apiRouter.POST("adddetailslist", methodBinding.AddDetailsList) //根据指标添加细则列表
apiRouter.POST("edit_post_detailscont", methodBinding.EditPostDetailsCont) //编辑岗位指标细则(新版)
apiRouter.POST("addtabledetailslist", methodBinding.AddTableDetailsList) //根据栏目添加细则列表
/* /*
针对岗位指标特殊要求API 针对岗位指标特殊要求API

Loading…
Cancel
Save