@ -739,6 +739,14 @@ func (e *EvaluationInterface) QualitativeEvalRation(c *gin.Context) {
return
return
}
}
//获取当月的起止时间
startMonth , endMonth := commonus . GetAppointMonthStarAndEndTimeInt ( time . Now ( ) . Unix ( ) )
//获取当月内所有的审批流程的部门及指标ID
// var qualEvalFlowLogList QualEvalFlowLog
var evalId [ ] int64
global . GVA_DB_Performanceappraisal . Model ( & assessmentmodel . FlowLog { } ) . Select ( "fl_evaluation_id" ) . Where ( "fl_time BETWEEN ? AND ?" , startMonth , endMonth ) . Find ( & evalId )
// var qualEvaList []assessmentmodel.QualitativeEvaluation
// var qualEvaList []assessmentmodel.QualitativeEvaluation
// var detailsId []int64
// var detailsId []int64
// listErr := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Select("qe_accept_evaluation").Where("`qe_type` = 1 AND `qe_state` = 1 AND FIND_IN_SET(?,`qe_operator`)", userCont.Key).Group("qe_accept_evaluation").Find(&detailsId).Error
// listErr := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Select("qe_accept_evaluation").Where("`qe_type` = 1 AND `qe_state` = 1 AND FIND_IN_SET(?,`qe_operator`)", userCont.Key).Group("qe_accept_evaluation").Find(&detailsId).Error
@ -750,12 +758,18 @@ func (e *EvaluationInterface) QualitativeEvalRation(c *gin.Context) {
var qualEvaList [ ] assessmentmodel . QualitativeEvaluation
var qualEvaList [ ] assessmentmodel . QualitativeEvaluation
gormDbIng := global . GVA_DB_Performanceappraisal
gormDbIng := global . GVA_DB_Performanceappraisal
gormDbIng = gormDbIng . Where ( "`qe_type` = 2 AND `qe_state` = 1 AND FIND_IN_SET(?,`qe_operator`)" , userCont . Key )
gormDbIng = gormDbIng . Where ( "`qe_type` = 2 AND `qe_state` = 1 AND FIND_IN_SET(?,`qe_operator`)" , userCont . Key )
if len ( evalId ) > 0 {
gormDbIng = gormDbIng . Not ( map [ string ] interface { } { "qe_id" : evalId } )
}
if requestData . GroupId != "" {
if requestData . GroupId != "" {
gormDbIng = gormDbIng . Where ( "qe_group = ?" , requestData . GroupId )
gormDbIng = gormDbIng . Where ( "qe_group = ?" , requestData . GroupId )
}
}
if requestData . DepartmentID != "" {
if requestData . DepartmentID != "" {
gormDbIng = gormDbIng . Where ( "qe_accept_evaluation = ?" , requestData . DepartmentID )
gormDbIng = gormDbIng . Where ( "qe_accept_evaluation = ?" , requestData . DepartmentID )
}
}
if requestData . TargetId != "" {
gormDbIng = gormDbIng . Where ( "qe_target = ?" , requestData . TargetId )
}
listErr := gormDbIng . Order ( "qe_type ASC,qe_group ASC,qe_accept_evaluation ASC,qe_dimension ASC,qe_target ASC,qe_target_sun ASC,qe_detailed_target ASC" ) . Find ( & qualEvaList ) . Error
listErr := gormDbIng . Order ( "qe_type ASC,qe_group ASC,qe_accept_evaluation ASC,qe_dimension ASC,qe_target ASC,qe_target_sun ASC,qe_detailed_target ASC" ) . Find ( & qualEvaList ) . Error
if listErr != nil || len ( qualEvaList ) < 1 {
if listErr != nil || len ( qualEvaList ) < 1 {
response . Result ( 102 , qualEvaList , "您没有要参加的考核项目!" , c )
response . Result ( 102 , qualEvaList , "您没有要参加的考核项目!" , c )
@ -763,7 +777,7 @@ func (e *EvaluationInterface) QualitativeEvalRation(c *gin.Context) {
}
}
var uotContAry [ ] TargetContOutCont
var uotContAry [ ] TargetContOutCont
for _ , v := range qualEvaList {
for _ , v := range qualEvaList {
kickOut := 1 //踢出设置
// kickOut := 1 //踢出设置
var uotCont TargetContOutCont
var uotCont TargetContOutCont
uotCont . Id = strconv . FormatInt ( v . Id , 10 )
uotCont . Id = strconv . FormatInt ( v . Id , 10 )
uotCont . Type = v . Type
uotCont . Type = v . Type
@ -779,6 +793,7 @@ func (e *EvaluationInterface) QualitativeEvalRation(c *gin.Context) {
orgContDepart , _ := commonus . GetNewOrgCont ( whereDepart , "id" , "name" )
orgContDepart , _ := commonus . GetNewOrgCont ( whereDepart , "id" , "name" )
uotCont . DepartmentName = orgContDepart . Name
uotCont . DepartmentName = orgContDepart . Name
uotCont . PlanVersionNumber = v . QualEvalId
// groupErr, groupCont := commonus.GetGroupCont(v.Group)
// groupErr, groupCont := commonus.GetGroupCont(v.Group)
// if groupErr == true {
// if groupErr == true {
// uotCont.GroupNAme = groupCont.Name
// uotCont.GroupNAme = groupCont.Name
@ -849,7 +864,7 @@ func (e *EvaluationInterface) QualitativeEvalRation(c *gin.Context) {
uotCont . ZeroPrize = strconv . FormatFloat ( float64 ( quanTitCont . Zeroprize ) / 100 , 'f' , - 1 , 64 )
uotCont . ZeroPrize = strconv . FormatFloat ( float64 ( quanTitCont . Zeroprize ) / 100 , 'f' , - 1 , 64 )
uotCont . AllPrize = strconv . FormatFloat ( float64 ( quanTitCont . Allprize ) / 100 , 'f' , - 1 , 64 )
uotCont . AllPrize = strconv . FormatFloat ( float64 ( quanTitCont . Allprize ) / 100 , 'f' , - 1 , 64 )
uotCont . CappingVal = quanTitCont . CappingVal / 100
//获取实际值
//获取实际值
shiJiZhi := commonus . MapOut ( )
shiJiZhi := commonus . MapOut ( )
shiJiZhi [ "fl_evaluation_user" ] = userCont . Key
shiJiZhi [ "fl_evaluation_user" ] = userCont . Key
@ -903,10 +918,10 @@ func (e *EvaluationInterface) QualitativeEvalRation(c *gin.Context) {
uotCont . ReachScore = 0
uotCont . ReachScore = 0
}
}
judgeActualValue := commonus . GetTimeIntervalDutyJudge ( shiJiZhi , v . Id ) //判断当前条件下时候又审批中和审批通过的
// judgeActualValue := commonus.GetTimeIntervalDutyJudge(shiJiZhi, v.Id) //判断当前条件下时候又审批中和审批通过的
if judgeActualValue > 0 {
// if judgeActualValue > 0 {
kickOut = 2
// kickOut = 2
}
// }
//计算达成率
//计算达成率
if quanTitCont . Zeroprize == 0 && quanTitCont . Allprize == 0 {
if quanTitCont . Zeroprize == 0 && quanTitCont . Allprize == 0 {
uotCont . Reach = "未设置目标值"
uotCont . Reach = "未设置目标值"
@ -916,7 +931,7 @@ func (e *EvaluationInterface) QualitativeEvalRation(c *gin.Context) {
if dividend == 0 {
if dividend == 0 {
uotCont . Reach = "未设置目标值"
uotCont . Reach = "未设置目标值"
} else {
} else {
uotCont . Reach = fmt . Sprintf ( "((实际值-零奖值)/(全奖值-零奖值))*指标权重\n((S-Z)/(A-Z))*W " )
uotCont . Reach = fmt . Sprintf ( "((实际值-零奖值)/(全奖值-零奖值))*指标权重" )
// reachValue := ((divisor / 100) / (float64(dividend) / 100)) * 100
// reachValue := ((divisor / 100) / (float64(dividend) / 100)) * 100
// if reachValue < 0 {
// if reachValue < 0 {
// uotCont.Reach = "0%"
// uotCont.Reach = "0%"
@ -929,10 +944,10 @@ func (e *EvaluationInterface) QualitativeEvalRation(c *gin.Context) {
}
}
uotCont . Reason = ""
uotCont . Reason = ""
uotCont . DetailedTarget = strconv . FormatInt ( v . DetailedTarget , 10 )
uotCont . DetailedTarget = strconv . FormatInt ( v . DetailedTarget , 10 )
if kickOut == 1 {
// if kickOut == 1 {
uotContAry = append ( uotContAry , uotCont )
// uotContAry = append(uotContAry, uotCont)
}
// }
// uotContAry = append(uotContAry, uotCont)
uotContAry = append ( uotContAry , uotCont )
}
}
response . Result ( 0 , uotContAry , "用户端个人要执行的考核任务" , c )
response . Result ( 0 , uotContAry , "用户端个人要执行的考核任务" , c )
}
}
@ -960,6 +975,13 @@ func (e *EvaluationInterface) AddFlowRationLog(c *gin.Context) {
return
return
}
}
todaying := commonus . ComputingTime ( time . Now ( ) . Unix ( ) , 5 )
if todaying > 10 {
// response.Result(1051, todaying, "不在可提交数据提时间期限内!不可提交数据。请每月10号前提交数据!。", c)
// return
}
var requestData AddRationFlowLog
var requestData AddRationFlowLog
err := c . ShouldBindJSON ( & requestData )
err := c . ShouldBindJSON ( & requestData )
if err != nil {
if err != nil {
@ -979,6 +1001,10 @@ func (e *EvaluationInterface) AddFlowRationLog(c *gin.Context) {
return
return
}
}
//判断是否已经添加的条件
existenceProess := commonus . MapOut ( )
existenceProess [ "fl_planversion" ] = requestData . PlanVersionNumber
operationTime := time . Now ( ) . Unix ( )
operationTime := time . Now ( ) . Unix ( )
keyNumber := commonus . GetFileNumberEs ( )
keyNumber := commonus . GetFileNumberEs ( )
var flowLog assessmentmodel . FlowLog
var flowLog assessmentmodel . FlowLog
@ -986,6 +1012,7 @@ func (e *EvaluationInterface) AddFlowRationLog(c *gin.Context) {
flowLog . Key = keyNumber
flowLog . Key = keyNumber
flowLog . Time = time . Now ( ) . Unix ( )
flowLog . Time = time . Now ( ) . Unix ( )
flowLog . EiteTime = time . Now ( ) . Unix ( )
flowLog . EiteTime = time . Now ( ) . Unix ( )
flowLog . PlanVersion = requestData . PlanVersionNumber
if requestData . Addtime != "" {
if requestData . Addtime != "" {
timeOccurrence := commonus . DateToTimeStamp ( requestData . Addtime ) //发生时间
timeOccurrence := commonus . DateToTimeStamp ( requestData . Addtime ) //发生时间
flowLog . Year = commonus . ComputingTime ( timeOccurrence , 1 )
flowLog . Year = commonus . ComputingTime ( timeOccurrence , 1 )
@ -993,6 +1020,13 @@ func (e *EvaluationInterface) AddFlowRationLog(c *gin.Context) {
flowLog . Month = commonus . ComputingTime ( timeOccurrence , 3 )
flowLog . Month = commonus . ComputingTime ( timeOccurrence , 3 )
flowLog . Week = commonus . ComputingTime ( timeOccurrence , 4 )
flowLog . Week = commonus . ComputingTime ( timeOccurrence , 4 )
flowLog . ToDay = commonus . ComputingTime ( timeOccurrence , 5 )
flowLog . ToDay = commonus . ComputingTime ( timeOccurrence , 5 )
existenceProess [ "fl_year" ] = commonus . ComputingTime ( timeOccurrence , 1 )
existenceProess [ "fl_quarter" ] = commonus . ComputingTime ( timeOccurrence , 2 )
existenceProess [ "fl_month" ] = commonus . ComputingTime ( timeOccurrence , 3 )
existenceProess [ "fl_week" ] = commonus . ComputingTime ( timeOccurrence , 4 )
existenceProess [ "fl_day" ] = commonus . ComputingTime ( timeOccurrence , 5 )
} else {
} else {
lastMonth , _ , _ := commonus . GetLastMonth ( )
lastMonth , _ , _ := commonus . GetLastMonth ( )
@ -1005,74 +1039,147 @@ func (e *EvaluationInterface) AddFlowRationLog(c *gin.Context) {
flowLog . Month = commonus . ComputingTime ( operationTime , 3 )
flowLog . Month = commonus . ComputingTime ( operationTime , 3 )
flowLog . Week = commonus . ComputingTime ( operationTime , 4 )
flowLog . Week = commonus . ComputingTime ( operationTime , 4 )
flowLog . ToDay = commonus . ComputingTime ( operationTime , 5 )
flowLog . ToDay = commonus . ComputingTime ( operationTime , 5 )
existenceProess [ "fl_year" ] = commonus . ComputingTime ( operationTime , 1 )
existenceProess [ "fl_quarter" ] = commonus . ComputingTime ( operationTime , 2 )
existenceProess [ "fl_month" ] = commonus . ComputingTime ( operationTime , 3 )
existenceProess [ "fl_week" ] = commonus . ComputingTime ( operationTime , 4 )
existenceProess [ "fl_day" ] = commonus . ComputingTime ( operationTime , 5 )
}
}
flowLog . EvaluationDepartment = departmentId
flowLog . EvaluationDepartment = departmentId
flowLog . EvaluationUser = userKey
flowLog . EvaluationUser = userKey
flowLog . EvaluationGroup = userGroup
flowLog . EvaluationGroup = userGroup
// existenceProess["fl_evaluation_department"] = departmentId
// existenceProess["fl_evaluation_user"] = userKey
// existenceProess["fl_evaluation_group"] = userGroup
dutyGroup , dutyGroupErr := strconv . ParseInt ( requestData . GroupId , 10 , 64 )
dutyGroup , dutyGroupErr := strconv . ParseInt ( requestData . GroupId , 10 , 64 )
if dutyGroupErr == nil {
if dutyGroupErr == nil {
flowLog . DutyGroup = dutyGroup
flowLog . DutyGroup = dutyGroup
existenceProess [ "fl_duty_group" ] = dutyGroup
}
}
departIdInt , departIdIntErr := strconv . ParseInt ( requestData . DepartmentID , 10 , 64 )
departIdInt , departIdIntErr := strconv . ParseInt ( requestData . DepartmentID , 10 , 64 )
if departIdIntErr == nil {
if departIdIntErr == nil {
flowLog . DutyDepartment = departIdInt
flowLog . DutyDepartment = departIdInt
existenceProess [ "fl_duty_department" ] = departIdInt
}
}
flowLog . Reply = 1
flowLog . Reply = 1
var evaluationIdStr string
global . GVA_DB_Performanceappraisal . Model ( & assessmentmodel . FlowLog { } ) . Select ( "fl_evaluation_id" ) . Where ( existenceProess ) . First ( & evaluationIdStr )
var evaluationIdStrAry [ ] string
if evaluationIdStr != "" {
evaluationIdStrAry = strings . Split ( evaluationIdStr , "," )
}
var flowDataLogAry [ ] assessmentmodel . FlowLogData
var flowDataLogAry [ ] assessmentmodel . FlowLogData
var reason string
var reason string
var evaluationPlan [ ] string //方案ID
var evaluationPlan [ ] string //方案ID
var yiTianJianMingc [ ] string
// jsonMapStr, _ := json.Marshal(requestData.List)
// jsonMapStr, _ := json.Marshal(requestData.List)
json . Marshal ( requestData . List )
json . Marshal ( requestData . List )
//fmt.Printf("OutJsonMap-----1------>%\n", string(jsonMapStr))
//fmt.Printf("OutJsonMap-----1------>%\n", string(jsonMapStr))
for i , v := range requestData . List {
for i , v := range requestData . List {
var flowDataLog assessmentmodel . FlowLogData
evaluationPlan = append ( evaluationPlan , v . Id )
if len ( evaluationIdStrAry ) > 0 {
evaluationPlanid , evaluationPlanidErr := strconv . ParseInt ( v . Id , 10 , 64 )
if commonus . IsItTrueString ( v . Id , evaluationIdStrAry ) == false {
if evaluationPlanidErr == nil {
var flowDataLog assessmentmodel . FlowLogData
flowDataLog . EvaluationPlan = evaluationPlanid
evaluationPlan = append ( evaluationPlan , v . Id )
}
evaluationPlanid , evaluationPlanidErr := strconv . ParseInt ( v . Id , 10 , 64 )
flowDataLog . Key = keyNumber
if evaluationPlanidErr == nil {
flowDataLog . Score = commonus . GetDuyCycle ( v . Actual , 100 )
flowDataLog . EvaluationPlan = evaluationPlanid
flowDataLog . Content = v . Reason
}
flowDataLog . Enclosure = strings . Join ( v . Enclosure , "," )
flowDataLog . Key = keyNumber
if v . ScoringMethod == 2 {
flowDataLog . Score = commonus . GetDuyCycle ( v . Actual , 100 )
flowDataLog . ScoringMethod = 2
flowDataLog . Content = v . Reason
flowDataLog . ScoringScore = v . ScoringScore
flowDataLog . Enclosure = strings . Join ( v . Enclosure , "," )
} else {
if v . ScoringMethod == 2 {
flowDataLog . ScoringMethod = 1
flowDataLog . ScoringMethod = 2
flowDataLog . ScoringScore = 0
flowDataLog . ScoringScore = v . ScoringScore
}
flowDataLog . Time = time . Now ( ) . Unix ( )
targetInfo , targetInfoErr := commonus . GetQualitativeEvaluation ( strconv . FormatInt ( evaluationPlanid , 10 ) )
tarInfo , _ := commonus . GetTargetInfo ( targetInfo . Target )
if i == 0 {
if targetInfoErr == true {
if v . Reason != "" {
reason = fmt . Sprintf ( "%v :%v%v\n备注:%v" , tarInfo . Title , v . Actual , v . Unit , v . Reason )
} else {
} else {
reason = fmt . Sprintf ( "%v :%v%v" , tarInfo . Title , v . Actual , v . Unit )
flowDataLog . ScoringMethod = 1
flowDataLog . ScoringScore = 0
}
}
// flowDataLog.PlanVersion = v.PlanVersionNumber
flowDataLog . Time = time . Now ( ) . Unix ( )
targetInfo , targetInfoErr := commonus . GetQualitativeEvaluation ( strconv . FormatInt ( evaluationPlanid , 10 ) )
tarInfo , _ := commonus . GetTargetInfo ( targetInfo . Target )
if i == 0 {
if targetInfoErr == true {
if v . Reason != "" {
reason = fmt . Sprintf ( "%v :%v%v\n备注:%v" , tarInfo . Title , v . Actual , v . Unit , v . Reason )
} else {
reason = fmt . Sprintf ( "%v :%v%v" , tarInfo . Title , v . Actual , v . Unit )
}
}
} else {
if targetInfoErr == true {
if v . Reason != "" {
reason = fmt . Sprintf ( "%v\n%v :%v%v\n备注:%v" , reason , tarInfo . Title , v . Actual , v . Unit , v . Reason )
} else {
reason = fmt . Sprintf ( "%v\n%v :%v%v" , reason , tarInfo . Title , v . Actual , v . Unit )
}
}
}
flowDataLogAry = append ( flowDataLogAry , flowDataLog )
} else {
yiTianJianMingc = append ( yiTianJianMingc , v . TargetName )
}
}
} else {
} else {
if targetInfoErr == true {
var flowDataLog assessmentmodel . FlowLogData
if v . Reason != "" {
evaluationPlan = append ( evaluationPlan , v . Id )
reason = fmt . Sprintf ( "%v\n%v :%v%v\n备注:%v" , reason , tarInfo . Title , v . Actual , v . Unit , v . Reason )
evaluationPlanid , evaluationPlanidErr := strconv . ParseInt ( v . Id , 10 , 64 )
} else {
if evaluationPlanidErr == nil {
reason = fmt . Sprintf ( "%v\n%v :%v%v" , reason , tarInfo . Title , v . Actual , v . Unit )
flowDataLog . EvaluationPlan = evaluationPlanid
}
flowDataLog . Key = keyNumber
flowDataLog . Score = commonus . GetDuyCycle ( v . Actual , 100 )
flowDataLog . Content = v . Reason
flowDataLog . Enclosure = strings . Join ( v . Enclosure , "," )
if v . ScoringMethod == 2 {
flowDataLog . ScoringMethod = 2
flowDataLog . ScoringScore = v . ScoringScore
} else {
flowDataLog . ScoringMethod = 1
flowDataLog . ScoringScore = 0
}
flowDataLog . PlanVersion = requestData . PlanVersionNumber
flowDataLog . Time = time . Now ( ) . Unix ( )
targetInfo , targetInfoErr := commonus . GetQualitativeEvaluation ( strconv . FormatInt ( evaluationPlanid , 10 ) )
tarInfo , _ := commonus . GetTargetInfo ( targetInfo . Target )
if i == 0 {
if targetInfoErr == true {
if v . Reason != "" {
reason = fmt . Sprintf ( "%v :%v%v\n备注:%v" , tarInfo . Title , v . Actual , v . Unit , v . Reason )
} else {
reason = fmt . Sprintf ( "%v :%v%v" , tarInfo . Title , v . Actual , v . Unit )
}
}
}
} else {
if targetInfoErr == true {
if v . Reason != "" {
reason = fmt . Sprintf ( "%v\n%v :%v%v\n备注:%v" , reason , tarInfo . Title , v . Actual , v . Unit , v . Reason )
} else {
reason = fmt . Sprintf ( "%v\n%v :%v%v" , reason , tarInfo . Title , v . Actual , v . Unit )
}
}
}
}
flowDataLogAry = append ( flowDataLogAry , flowDataLog )
}
}
flowDataLogAry = append ( flowDataLogAry , flowDataLog )
}
}
gromDb := global . GVA_DB_Performanceappraisal . Begin ( )
gromDb := global . GVA_DB_Performanceappraisal . Begin ( )
flowLog . EvaluationPlan = strings . Join ( evaluationPlan , "," )
flowLog . EvaluationPlan = strings . Join ( evaluationPlan , "," )
if len ( flowDataLogAry ) <= 0 {
response . Result ( 0 , yiTianJianMingc , "您的数据已经提交!请不要重复提交!" , c )
return
}
addFlowLogErr := gromDb . Create ( & flowLog ) . Error
addFlowLogErr := gromDb . Create ( & flowLog ) . Error
addFlowLogDataErr := gromDb . Create ( & flowDataLogAry ) . Error
addFlowLogDataErr := gromDb . Create ( & flowDataLogAry ) . Error
@ -1093,7 +1200,7 @@ func (e *EvaluationInterface) AddFlowRationLog(c *gin.Context) {
}
}
// UpEvaluationProcessApproval(keyNumber, 16182159043990656, keyNumber, 1, userCont.Key)
// UpEvaluationProcessApproval(keyNumber, 16182159043990656, keyNumber, 1, userCont.Key)
commonus . StepAddData ( keyNumber , 16182159043990656 , 2 , 7 , 2 , 2 , 1 , userCont . Key )
commonus . StepAddData ( keyNumber , 16182159043990656 , 2 , 7 , 2 , 1 , 1 , userCont . Key )
mainTitle := fmt . Sprintf ( "%v数据表" , commonus . TimeStampToDate ( operationTime , 10 ) )
mainTitle := fmt . Sprintf ( "%v数据表" , commonus . TimeStampToDate ( operationTime , 10 ) )
mainTitleDesc := ""
mainTitleDesc := ""
@ -1120,23 +1227,28 @@ func (e *EvaluationInterface) AddFlowRationLog(c *gin.Context) {
//fmt.Printf("1、更新发送信息返回:%v-----------%v----------->%v-----%v\n", string(callbakcMsg), isTrueCall, callBackCont, sendText)
//fmt.Printf("1、更新发送信息返回:%v-----------%v----------->%v-----%v\n", string(callbakcMsg), isTrueCall, callBackCont, sendText)
response . Result ( 0 , affairDbErr , "数据写入 成功!", c )
response . Result ( 0 , yiTianJianMingc , "数据提交 成功!", c )
} else {
} else {
gromDb . Rollback ( )
gromDb . Rollback ( )
response . Result ( 118 , affairDbErr , "数据写入 失败!", c )
response . Result ( 118 , yiTianJianMingc , "数据提交 失败!", c )
}
}
} else {
} else {
affairDbErr := gromDb . Rollback ( ) . Error
affairDbErr := gromDb . Rollback ( ) . Error
if affairDbErr == nil {
if affairDbErr == nil {
response . Result ( 119 , affairDbErr , "数据写入 失败!", c )
response . Result ( 119 , yiTianJianMingc , "数据提交 失败!", c )
} else {
} else {
response . Result ( 120 , affairDbErr , "数据写入 失败!", c )
response . Result ( 120 , yiTianJianMingc , "数据提交 失败!", c )
}
}
}
}
}
}
//查看定性考核审批列表
//查看定性考核审批列表
func ( e * EvaluationInterface ) LookDutkScoreFlow ( c * gin . Context ) {
func ( e * EvaluationInterface ) LookDutkScoreFlow ( c * gin . Context ) {
isTrue , userCont := commonus . ClientIdentity ( )
if isTrue != true {
response . Result ( 1001 , userCont , "您的身份令牌已经失效!请重新登录获取身份令牌!" , c )
return
}
var requestData commonus . SetIds
var requestData commonus . SetIds
err := c . ShouldBindJSON ( & requestData )
err := c . ShouldBindJSON ( & requestData )
if err != nil {
if err != nil {
@ -1320,6 +1432,14 @@ func (e *EvaluationInterface) LookDutkScoreFlow(c *gin.Context) {
gerEvalErr := global . GVA_DB_Performanceappraisal . Where ( "`ep_order_key` = ?" , requestData . Id ) . Find ( & evalProInfo ) . Error
gerEvalErr := global . GVA_DB_Performanceappraisal . Where ( "`ep_order_key` = ?" , requestData . Id ) . Find ( & evalProInfo ) . Error
//fmt.Printf("9-----------1--------->%v\n", gerEvalErr)
//fmt.Printf("9-----------1--------->%v\n", gerEvalErr)
if gerEvalErr == nil {
if gerEvalErr == nil {
fmt . Printf ( "evalProInfo.NextExecutor------->%v\n" , evalProInfo . NextExecutor )
dutyCecorFlowInfo . IsSet = 2
isSetUser := strings . Split ( evalProInfo . NextExecutor , "," )
if len ( isSetUser ) > 0 {
if commonus . IsItTrueString ( userCont . Key , isSetUser ) == true {
dutyCecorFlowInfo . IsSet = 1
}
}
var flowStepAryMaps [ ] FlowStep
var flowStepAryMaps [ ] FlowStep
jsonFlowErr := json . Unmarshal ( [ ] byte ( evalProInfo . Content ) , & flowStepAryMaps )
jsonFlowErr := json . Unmarshal ( [ ] byte ( evalProInfo . Content ) , & flowStepAryMaps )
//fmt.Printf("9-----------2--------->%v\n", flowStepAryMaps)
//fmt.Printf("9-----------2--------->%v\n", flowStepAryMaps)
@ -1334,10 +1454,11 @@ func (e *EvaluationInterface) LookDutkScoreFlow(c *gin.Context) {
//fmt.Printf("9-----------4-----2---->%v\n", fw_v)
//fmt.Printf("9-----------4-----2---->%v\n", fw_v)
if workUserErr == true {
if workUserErr == true {
//fmt.Printf("9-----------4-----1---->%v\n", workUserErr)
//fmt.Printf("9-----------4-----1---->%v\n", workUserErr)
bfErr , bf := commonus . GetBranchFactory ( workUser . DepartmentId )
// bfErr, bf := commonus.GetBranchFactory(workUser.DepartmentId)
bf , bfErr := commonus . GetNewOrgCont ( workUser . DepartmentId )
//fmt.Printf("9-----------4-----3---->%v\n", bfErr)
//fmt.Printf("9-----------4-----3---->%v\n", bfErr)
if bfErr == true {
if bfErr == nil {
getGroupRoleInfoErr , getGroupRoleInfo , roleGroupInfo := commonus . GetOfficeWork ( fw_v . RoleGroup , int64 ( bf . WechatId ) )
getGroupRoleInfoErr , getGroupRoleInfo , roleGroupInfo := commonus . GetOfficeWork ( fw_v . RoleGroup , int64 ( bf . WechatOrganization Id ) )
//fmt.Printf("9-----------4-----5---->%v---->%v---->%v\n", getGroupRoleInfoErr, getGroupRoleInfo, roleGroupInfo)
//fmt.Printf("9-----------4-----5---->%v---->%v---->%v\n", getGroupRoleInfoErr, getGroupRoleInfo, roleGroupInfo)
if getGroupRoleInfoErr == true {
if getGroupRoleInfoErr == true {
flowLog . GroupName = roleGroupInfo . Title
flowLog . GroupName = roleGroupInfo . Title
@ -1395,6 +1516,11 @@ func (e *EvaluationInterface) LookDutkScoreFlow(c *gin.Context) {
//查看定量考核列表
//查看定量考核列表
func ( d * EvaluationInterface ) LookRationkScoreFlow ( c * gin . Context ) {
func ( d * EvaluationInterface ) LookRationkScoreFlow ( c * gin . Context ) {
isTrue , userCont := commonus . ClientIdentity ( )
if isTrue != true {
response . Result ( 1001 , userCont , "您的身份令牌已经失效!请重新登录获取身份令牌!" , c )
return
}
var requestData commonus . SetIds
var requestData commonus . SetIds
err := c . ShouldBindJSON ( & requestData )
err := c . ShouldBindJSON ( & requestData )
if err != nil {
if err != nil {
@ -1417,18 +1543,65 @@ func (d *EvaluationInterface) LookRationkScoreFlow(c *gin.Context) {
response . Result ( 103 , err , "参数错误!请重新提交!" , c )
response . Result ( 103 , err , "参数错误!请重新提交!" , c )
return
return
}
}
var flowLogInfo assessmentmodel . FlowLog
getErrs := global . GVA_DB_Performanceappraisal . Where ( "`fl_key` = ?" , requestData . Id ) . First ( & flowLogInfo ) . Error
var planVersioCont assessmentmodel . PlanVersio
global . GVA_DB_Performanceappraisal . Where ( "`key` = ?" , flowLogInfo . PlanVersion ) . First ( & planVersioCont )
var planVersioInfo [ ] AddDutyNewCont
if planVersioCont . Content != "" {
json . Unmarshal ( [ ] byte ( planVersioCont . Content ) , & planVersioInfo )
// jsonErr := json.Unmarshal([]byte(planVersioCont.Content), &planVersioInfo)
// if jsonErr == nil {
// for _, v := range planVersioInfo {
// for _, cv := range v.Child {
// if cv.Id == strconv.FormatInt(planVersioCont.Id, 10) {
// targetScore = cv.ReferenceScore
// }
// }
// }
// }
}
// var flowLogInfo
var outList [ ] RationOutStruct
var outList [ ] RationOutStruct
for _ , v := range flowDataLog {
for _ , v := range flowDataLog {
var targetScore int64 = 0
var outContt RationOutStruct
var outContt RationOutStruct
outContt . Id = strconv . FormatInt ( v . Id , 10 )
outContt . Id = strconv . FormatInt ( v . Id , 10 )
outContt . FlowId = strconv . FormatInt ( v . Key , 10 )
outContt . FlowId = strconv . FormatInt ( v . Key , 10 )
targetCont , targetContErr := commonus . LookRationInfo ( v . EvaluationPlan )
targetCont , targetContErr := commonus . LookRationInfo ( v . EvaluationPlan )
if targetContErr == true {
if targetContErr == true {
outContt . Title = targetCont . Title
outContt . Title = targetCont . Title
outContt . Unit = targetCont . Unit
outContt . Unit = targetCont . Unit
outContt . Cycles = targetCont . Cycles
outContt . Cycles = targetCont . Cycles
outContt . CycleAttres = targetCont . CycleAttres
outContt . CycleAttres = targetCont . CycleAttres
var monthQues int64 = 1
switch targetCont . Cycles {
case 5 :
monthQues = flowLogInfo . Quarter
case 6 :
monthQues = 1
default :
monthQues = flowLogInfo . Month
}
if len ( planVersioInfo ) > 0 {
for _ , pviv := range planVersioInfo {
for _ , pvivcv := range pviv . Child {
if pvivcv . Id == strconv . FormatInt ( targetCont . Target , 10 ) {
targetScore = pvivcv . ReferenceScore
}
}
}
}
outContt . Weight = float64 ( targetScore )
//获取指标
var tarGetId int64
global . GVA_DB_Performanceappraisal . Model ( & assessmentmodel . QualitativeEvaluation { } ) . Select ( "qe_target" ) . Where ( "`qe_id` = ?" , v . EvaluationPlan ) . First ( & tarGetId )
// outContt.Actual, outContt.AllPrize, outContt.ZeroPrize, outContt.CappingVal, outContt.Achievement = GetQuantitativeConfig(targetScore, float64(v.Score), strconv.FormatInt(flowLogInfo.DutyGroup, 10), strconv.FormatInt(flowLogInfo.DutyDepartment, 10), strconv.FormatInt(targetCont.Dimension, 10), strconv.FormatInt(tarGetId, 10), strconv.FormatInt(targetCont.DetailedTarget, 10), flowLogInfo.Year, monthQues)
// targetScore = v.Score
outContt . Actual , outContt . AllPrize , outContt . ZeroPrize , outContt . CappingVal , outContt . Achievement = GetQuantitativeConfig ( targetScore , float64 ( v . Score ) , strconv . FormatInt ( flowLogInfo . DutyGroup , 10 ) , strconv . FormatInt ( flowLogInfo . DutyDepartment , 10 ) , strconv . FormatInt ( targetCont . Dimension , 10 ) , strconv . FormatInt ( tarGetId , 10 ) , strconv . FormatInt ( targetCont . DetailedTarget , 10 ) , flowLogInfo . Year , monthQues )
}
}
outContt . Score = float64 ( v . Score ) / 100
outContt . Score = float64 ( v . Score ) / 100
outContt . Content = v . Content
outContt . Content = v . Content
@ -1444,6 +1617,9 @@ func (d *EvaluationInterface) LookRationkScoreFlow(c *gin.Context) {
var evalProInfo assessmentmodel . EvaluationProcess
var evalProInfo assessmentmodel . EvaluationProcess
gerEvalErr := global . GVA_DB_Performanceappraisal . Where ( "`ep_order_key` = ?" , requestData . Id ) . Find ( & evalProInfo ) . Error
gerEvalErr := global . GVA_DB_Performanceappraisal . Where ( "`ep_order_key` = ?" , requestData . Id ) . Find ( & evalProInfo ) . Error
//fmt.Printf("9-----------1--------->%v\n", gerEvalErr)
//fmt.Printf("9-----------1--------->%v\n", gerEvalErr)
var isShenPi int = 2
if gerEvalErr == nil {
if gerEvalErr == nil {
var flowStepAryMaps [ ] FlowStep
var flowStepAryMaps [ ] FlowStep
jsonFlowErr := json . Unmarshal ( [ ] byte ( evalProInfo . Content ) , & flowStepAryMaps )
jsonFlowErr := json . Unmarshal ( [ ] byte ( evalProInfo . Content ) , & flowStepAryMaps )
@ -1459,10 +1635,11 @@ func (d *EvaluationInterface) LookRationkScoreFlow(c *gin.Context) {
// //fmt.Printf("9-----------4-----2---->%v\n", fw_v)
// //fmt.Printf("9-----------4-----2---->%v\n", fw_v)
if workUserErr == true {
if workUserErr == true {
// //fmt.Printf("9-----------4-----1---->%v\n", workUserErr)
// //fmt.Printf("9-----------4-----1---->%v\n", workUserErr)
bfErr , bf := commonus . GetBranchFactory ( workUser . DepartmentId )
// bfErr, bf := commonus.GetBranchFactory(workUser.DepartmentId)
bf , bfErr := commonus . GetNewOrgCont ( workUser . DepartmentId )
// //fmt.Printf("9-----------4-----3---->%v\n", bfErr)
// //fmt.Printf("9-----------4-----3---->%v\n", bfErr)
if bfErr == true {
if bfErr == nil {
getGroupRoleInfoErr , getGroupRoleInfo , roleGroupInfo := commonus . GetOfficeWork ( fw_v . RoleGroup , int64 ( bf . WechatId ) )
getGroupRoleInfoErr , getGroupRoleInfo , roleGroupInfo := commonus . GetOfficeWork ( fw_v . RoleGroup , int64 ( bf . WechatOrganization Id ) )
// //fmt.Printf("9-----------4-----5---->%v---->%v---->%v\n", getGroupRoleInfoErr, getGroupRoleInfo, roleGroupInfo)
// //fmt.Printf("9-----------4-----5---->%v---->%v---->%v\n", getGroupRoleInfoErr, getGroupRoleInfo, roleGroupInfo)
if getGroupRoleInfoErr == true {
if getGroupRoleInfoErr == true {
flowLog . GroupName = roleGroupInfo . Title
flowLog . GroupName = roleGroupInfo . Title
@ -1512,6 +1689,13 @@ func (d *EvaluationInterface) LookRationkScoreFlow(c *gin.Context) {
if jsonFlowErr == nil {
if jsonFlowErr == nil {
}
}
}
}
fmt . Printf ( "evalProInfo.NextExecutor-------------->%v\n" , evalProInfo . NextExecutor )
if evalProInfo . NextExecutor != "" {
zhiXingRenAry := strings . Split ( evalProInfo . NextExecutor , "," )
if commonus . IsItTrueString ( userCont . Key , zhiXingRenAry ) == true {
isShenPi = 1
}
}
}
}
outListMap := commonus . MapOut ( )
outListMap := commonus . MapOut ( )
@ -1519,20 +1703,22 @@ func (d *EvaluationInterface) LookRationkScoreFlow(c *gin.Context) {
outListMap [ "flowLog" ] = flowLogList
outListMap [ "flowLog" ] = flowLogList
outListMap [ "flowall" ] = flowAllMapList
outListMap [ "flowall" ] = flowAllMapList
outListMap [ "title" ] = ""
outListMap [ "title" ] = ""
var flowLogInfo assessmentmodel . FlowLog
outListMap [ "isset" ] = isShenPi
getErrs := global . GVA_DB_Performanceappraisal . Where ( "`fl_key` = ?" , requestData . Id ) . First ( & flowLogInfo ) . Error
if getErrs == nil {
if getErrs == nil {
titlekUserInfo , _ := commonus . GetWorkUser ( strconv . FormatInt ( flowLogInfo . EvaluationUser , 10 ) )
titlekUserInfo , _ := commonus . GetNewHrPeopleInfo ( map [ string ] interface { } { "`key`" : flowLogInfo . EvaluationUser } , "`name`" )
titleStr := fmt . Sprintf ( "%v提交的%v年%v月%v日定量考核数据上报" , titlekUserInfo . Name , flowLogInfo . Year , flowLogInfo . Month , flowLogInfo . ToDay )
// titlekUserInfo, _ := commonus.GetWorkUser(strconv.FormatInt(flowLogInfo.EvaluationUser, 10))
gErr , groupInfo := commonus . GetGroupCont ( flowLogInfo . DutyGroup )
titleStr := fmt . Sprintf ( "%v提交的%v年%v月定量考核数据" , titlekUserInfo . Name , flowLogInfo . Year , flowLogInfo . Month )
if gErr == true {
// gErr, groupInfo := commonus.GetGroupCont(flowLogInfo.DutyGroup)
groupInfo , gErr := commonus . GetNewOrgCont ( flowLogInfo . DutyGroup )
if gErr == nil {
outListMap [ "groupname" ] = groupInfo . Name
outListMap [ "groupname" ] = groupInfo . Name
} else {
} else {
outListMap [ "groupname" ] = ""
outListMap [ "groupname" ] = ""
}
}
dErr , BranchInfo := commonus . GetBranchFactory ( flowLogInfo . DutyDepartment )
// dErr, BranchInfo := commonus.GetBranchFactory(flowLogInfo.DutyDepartment)
if dErr == true {
BranchInfo , dErr := commonus . GetNewOrgCont ( flowLogInfo . DutyDepartment )
if dErr == nil {
outListMap [ "departmentname" ] = BranchInfo . Name
outListMap [ "departmentname" ] = BranchInfo . Name
titleStr = fmt . Sprintf ( "%v%v" , BranchInfo . Name , titleStr )
titleStr = fmt . Sprintf ( "%v%v" , BranchInfo . Name , titleStr )
} else {
} else {