@ -80,7 +80,7 @@ func (p *postDimeTarSync) GetPostTargent(position modelshr.Position, dutyClass m
targetCont . Id = strconv . FormatInt ( v . Id , 10 )
targetCont . Name = v . Title
targetCont . Content = "" //指标描述
targetCont . StandardScore = getPostDimeTarWeight ( position . AdministrativeOrganization , position . Id , dutyClass . Id , v . Id , 1 , 1 ) //标准分
targetCont . StandardScore = getPostDimeTarWeight ( position . AdministrativeOrganization , position . Id , dutyClass . Id , v . Id , 2 , 1 ) //标准分
targetCont . Unit = v . Unit //单位
targetCont . IsTrue = 2 //是否允许修改 1:不允许;2:允许
targetCont . State = 1 //状态 1:启用;2:禁用;3:观察
@ -451,6 +451,12 @@ func postSchemeTargetPost(versionNumber string, source, judgeState int, scheme [
}
}
syncSetinges . Wait ( )
writeData := xizeXiecheng . readDataLock ( )
if len ( writeData ) > 0 {
for _ , wdv := range writeData {
saveNewData = append ( saveNewData , wdv )
}
}
if len ( saveNewData ) > 0 {
overall . CONSTANT_DB_KPI . Create ( & saveNewData )
}
@ -479,6 +485,34 @@ func (p *postShemeListCont) eidtPostSchemeInfo(versionNumber string, companyId,
overall . CONSTANT_DB_KPI . Where ( "`state` = 1 AND `parentid` = ? AND `parentid_sun` = ? AND `paretment` = ? AND `paretment_post` = ?" , targetId , sonTargetId , orgid , postid ) . Find ( & postTargetDetailsCont )
if len ( postTargetDetailsCont ) > 0 {
for _ , v := range postTargetDetailsCont {
var saveData modelskpi . QualitativeEvaluationScheme //方案内容结构体
//判断该细则是否存在
whereLian := publicmethod . MapOut [ string ] ( )
whereLian [ "`version_number`" ] = versionNumber
whereLian [ "`company_id`" ] = companyId
whereLian [ "`department_id`" ] = departmentId
whereLian [ "`org_id`" ] = orgid
whereLian [ "`post_id`" ] = postid
whereLian [ "`dimension_id`" ] = dimensionId
whereLian [ "`target_id`" ] = targetId
whereLian [ "`son_target_id`" ] = sonTargetId
whereLian [ "`details_id`" ] = v . Id
judgeLianErr := saveData . GetCont ( whereLian , "`id`" , "`state`" )
if judgeLianErr == nil {
eidtTargetCont := publicmethod . MapOut [ string ] ( )
eidtTargetCont [ "`scoring_method`" ] = scoringMethod
eidtTargetCont [ "`state`" ] = targetState
eidtTargetCont [ "`source`" ] = 1
eidtTargetCont [ "`run_state`" ] = runState
eidtTargetCont [ "`eitetime`" ] = timeData
eidtTargetCont [ "`min_score`" ] = v . MinScore
eidtTargetCont [ "`max_score`" ] = v . MaxScore
eidtTargetCont [ "`punishmode`" ] = v . Punishmode
eidtTargetCont [ "`maxmoney`" ] = v . Maxmoney
eidtTargetCont [ "`minmoney`" ] = v . Minmoney
saveData . EiteCont ( map [ string ] interface { } { "`id`" : saveData . Id } , eidtTargetCont )
} else { //不存在需要新增
var saveData modelskpi . QualitativeEvaluationScheme //方案内容结构体
saveData . VersionNumber = versionNumber //版本编号"`
saveData . CompanyId = companyId //归属公司"`
@ -507,6 +541,7 @@ func (p *postShemeListCont) eidtPostSchemeInfo(versionNumber string, companyId,
p . shememList = append ( p . shememList , saveData )
}
}
}
syncSetinges . Done ( )
}
@ -896,7 +931,24 @@ func (a *ApiMethod) GetCopyShemeInfor(c *gin.Context) {
}
}
}
if len ( notUsedDimensionId ) > 0 {
for _ , nuduv := range notUsedDimensionId {
syncSeting . Add ( 1 )
go shemePostList . postHandleShemeNot ( schemeCont . OrgId , schemeCont . Position , nuduv )
}
}
syncSeting . Wait ( )
shemeList := shemePostList . readDataLock ( )
if len ( shemeList ) < 1 {
publicmethod . Result ( 1 , shemeList , c , "该岗位没有设定专属指标!您可以从部门指标中引入!" )
return
}
//根据维度序号排序
sort . Slice ( shemeList , func ( i , j int ) bool {
return shemeList [ i ] . Sort < shemeList [ j ] . Sort
} )
shemeInfo . PostChild = shemeList
publicmethod . Result ( 0 , shemeInfo , c )
}
/ *
@ -907,20 +959,81 @@ func (a *ApiMethod) GetCopyShemeInfor(c *gin.Context) {
@ shemeInfo 考核项结构体
* /
func ( s * shemeSync ) postHandleSheme ( orgid , postid , dimensId int64 , shemeInfo schemeStructure ) {
// var targetPostList []schemeTargetStructure
// var idIsTrue []string
// for _, v := range shemeInfo.Child {
// idIsTrue = append(idIsTrue, v.Id)
// var targetCont schemeTargetStructure
// targetCont.Id = v.Id
// targetCont.Name = v.Title
// targetCont.Content = "" //指标描述
// targetCont.StandardScore = getPostDimeTarWeight(orgid, postid, dimensId, v.Id, 1, 1) //标准分
// targetCont.Unit = v.Unit //单位
// targetCont.IsTrue = 2 //是否允许修改 1:不允许;2:允许
// targetCont.State = 1
// targetPostList = append(targetPostList, targetCont)
// }
s . mutext . Lock ( )
defer s . mutext . Unlock ( )
var targetPostList schemeStructure
//获取维度信息
var dimeCont modelskpi . DutyClass
dimeCont . GetCont ( map [ string ] interface { } { "`id`" : dimensId } , "`title`" )
targetPostList . Id = shemeInfo . Id
targetPostList . Name = shemeInfo . Name
targetPostList . Sort = dimeCont . Sort
targetPostList . Score = shemeInfo . Score
var idIsTrue [ ] string
for _ , v := range shemeInfo . Child {
idIsTrue = append ( idIsTrue , v . Id )
targetPostList . Child = append ( targetPostList . Child , v )
}
//获取被指标下的其他
var otherTarget [ ] modelskpi . PostTarget
if len ( idIsTrue ) > 0 {
overall . CONSTANT_DB_KPI . Where ( "`state` = 1 AND `rele_depart` = ? AND `departments_post` AND `dimension` = ?" , orgid , postid , dimensId ) . Not ( map [ string ] interface { } { "`id`" : idIsTrue } ) . Find ( & otherTarget )
}
if len ( otherTarget ) > 0 {
for _ , otv := range otherTarget {
var tarCont schemeTargetStructure
tarCont . Id = strconv . FormatInt ( otv . Id , 10 ) //id
tarCont . Name = otv . Title //名称
tarCont . Content = "" //说明
scorcFloatInt := getPostDimeTarWeight ( orgid , postid , dimensId , otv . Id , 2 , 1 )
tarCont . Score = float64 ( scorcFloatInt ) //`json:"score"` //分数
tarCont . State = 1 //状态:1:启用;2:禁用;3:观察
tarCont . Type = otv . Type // //1、定性指标;2、定量指标
targetPostList . Child = append ( targetPostList . Child , tarCont )
}
}
s . shememList = append ( s . shememList , targetPostList )
syncSeting . Done ( )
}
/ *
协程处理未生成的维度指标是否有新的内容
@ orgid 行政组织ID
@ postid 岗位ID
@ dimensId 维度ID
* /
func ( s * shemeSync ) postHandleShemeNot ( orgid , postid , dimensId int64 ) {
s . mutext . Lock ( )
defer s . mutext . Unlock ( )
var targetPostList schemeStructure
//获取维度信息
var dimeCont modelskpi . DutyClass
dimeCont . GetCont ( map [ string ] interface { } { "`id`" : dimensId } , "`title`" )
targetPostList . Id = strconv . FormatInt ( dimeCont . Id , 10 )
targetPostList . Name = dimeCont . Title
targetPostList . Sort = dimeCont . Sort
targetPostList . Score = 0
//获取维度下的指标
var otherTarget [ ] modelskpi . PostTarget
overall . CONSTANT_DB_KPI . Where ( "`state` = 1 AND `rele_depart` = ? AND `departments_post` AND `dimension` = ?" , orgid , postid , dimensId ) . Find ( & otherTarget )
if len ( otherTarget ) > 0 {
for _ , otv := range otherTarget {
var tarCont schemeTargetStructure
tarCont . Id = strconv . FormatInt ( otv . Id , 10 ) //id
tarCont . Name = otv . Title //名称
tarCont . Content = "" //说明
scorcFloatInt := getPostDimeTarWeight ( orgid , postid , dimensId , otv . Id , 2 , 1 )
tarCont . Score = float64 ( scorcFloatInt ) //`json:"score"` //分数
tarCont . State = 1 //状态:1:启用;2:禁用;3:观察
tarCont . Type = otv . Type // //1、定性指标;2、定量指标
targetPostList . Child = append ( targetPostList . Child , tarCont )
}
}
s . shememList = append ( s . shememList , targetPostList )
syncSeting . Done ( )
}