You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2023 lines
83 KiB
2023 lines
83 KiB
package quantification
|
|
|
|
import (
|
|
"fmt"
|
|
"strconv"
|
|
|
|
"gin_server_admin/commonus"
|
|
"gin_server_admin/global"
|
|
"gin_server_admin/model/assessmentmodel"
|
|
)
|
|
|
|
//以时间维度查询统计
|
|
/*
|
|
@taskId 指标ID
|
|
@dataAry 接收的界定参数
|
|
*/
|
|
func TimeDimensionStatistics(taskId string, dataAry natureParameter) (outputData GraphicStatistics, outErr bool) {
|
|
outErr = true
|
|
var normName string = ""
|
|
norm := 1 //1:定性考核;2:定量考核
|
|
//获取指标信息
|
|
taskIdInt, _ := strconv.ParseInt(taskId, 10, 64)
|
|
taskCont, taskErr := commonus.GetTargetInfo(taskIdInt)
|
|
if taskErr == true {
|
|
normName = taskCont.Title
|
|
outErr = taskErr
|
|
norm = taskCont.Type
|
|
} else {
|
|
// outErr = error.Error("此考核项目没有数据!")
|
|
outErr = taskErr
|
|
return
|
|
}
|
|
//获取时间参数
|
|
timeFrame := EstimatedTime(dataAry)
|
|
//获取组织架构参数
|
|
// var orgAry []orgModelsAry
|
|
var orgList []orgModels
|
|
if len(dataAry.Org) > 0 {
|
|
_, orgList = getGroupOrgList(dataAry.Org)
|
|
} else {
|
|
_, orgList = getGroupOrgList(GetTargerDepartment(taskCont.Dimension, taskIdInt))
|
|
}
|
|
// fmt.Printf("orgList ---> %v\n", orgList)
|
|
//统计方式
|
|
statisticalMethod := 3
|
|
if len(dataAry.AccMethod) == 1 {
|
|
if commonus.IsItTrueInt(1, dataAry.AccMethod) == true {
|
|
statisticalMethod = 1
|
|
} else {
|
|
statisticalMethod = 2
|
|
}
|
|
}
|
|
// jsonCont, _ := json.Marshal(dataAry)
|
|
// fmt.Printf("wherStr------>%v\n", string(jsonCont))
|
|
// return
|
|
//根据时间维度进行统计
|
|
for _, tfv := range timeFrame {
|
|
if commonus.IsItTrueString(tfv.XLine, outputData.XLine) == false {
|
|
outputData.XLine = append(outputData.XLine, tfv.XLine)
|
|
}
|
|
switch tfv.Class {
|
|
case 1: //半年
|
|
|
|
//组合月
|
|
monthStr := "("
|
|
for twi, twv := range tfv.Where {
|
|
if twi != 0 {
|
|
monthStr = fmt.Sprintf("%v,%v", monthStr, twv)
|
|
} else {
|
|
monthStr = fmt.Sprintf("%v%v", monthStr, twv)
|
|
}
|
|
|
|
}
|
|
monthStr = fmt.Sprintf("%v)", monthStr)
|
|
|
|
//定量考核
|
|
if len(orgList) > 0 {
|
|
//有政组织
|
|
for _, orgv := range orgList {
|
|
var orgvSunOrg string
|
|
//获取此指标跟查询部门相关的考核方案ID
|
|
var taskIdAry []int64
|
|
|
|
// global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Select("qe_id").Where("qe_state = 1 AND qe_dimension = ? AND qe_target = ? AND qe_accept_evaluation = ?", taskCont.Dimension, taskIdInt, orgv.Id).Find(&taskIdAry)
|
|
if len(orgv.SunOrg) > 0 {
|
|
orgvSunOrg = "("
|
|
for tiai, tiav := range orgv.SunOrg {
|
|
if tiai != 0 {
|
|
orgvSunOrg = fmt.Sprintf("%v,%v", orgvSunOrg, tiav)
|
|
} else {
|
|
orgvSunOrg = fmt.Sprintf("%v%v", orgvSunOrg, tiav)
|
|
}
|
|
}
|
|
global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Select("qe_id").Where("qe_state = 1 AND qe_dimension = ? AND qe_target = ? AND qe_accept_evaluation IN ?", taskCont.Dimension, taskIdInt, orgv.SunOrg).Find(&taskIdAry)
|
|
} else {
|
|
global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Select("qe_id").Where("qe_state = 1 AND qe_dimension = ? AND qe_target = ? AND qe_accept_evaluation = ?", taskCont.Dimension, taskIdInt, orgv.Id).Find(&taskIdAry)
|
|
}
|
|
|
|
//组合考核方案ID
|
|
taskIdStrWher := "("
|
|
for tiai, tiav := range taskIdAry {
|
|
if tiai != 0 {
|
|
taskIdStrWher = fmt.Sprintf("%v,%v", taskIdStrWher, tiav)
|
|
} else {
|
|
taskIdStrWher = fmt.Sprintf("%v%v", taskIdStrWher, tiav)
|
|
}
|
|
|
|
}
|
|
taskIdStrWher = fmt.Sprintf("%v)", taskIdStrWher)
|
|
for _, yearVal := range dataAry.Year {
|
|
var sumScore float64
|
|
var averageScore float64
|
|
|
|
if len(taskIdAry) > 0 {
|
|
var wherStr string
|
|
|
|
if norm == 1 {
|
|
var canKaoZhi float64 = 0
|
|
//定性考核
|
|
if len(orgv.SunOrg) > 0 {
|
|
|
|
orgvSunOrg = fmt.Sprintf("%v)", orgvSunOrg)
|
|
wherStr = fmt.Sprintf("sf_evaluation_plan IN %v AND `sf_year` = %v AND `sf_month` IN %v AND sf_duty_department IN %v", taskIdStrWher, yearVal, monthStr, orgvSunOrg)
|
|
} else {
|
|
wherStr = fmt.Sprintf("sf_evaluation_plan IN %v AND `sf_year` = %v AND `sf_month` IN %v AND sf_duty_department = %v", taskIdStrWher, yearVal, monthStr, orgv.Id)
|
|
|
|
canKaoZhi = GetTargetReferenceValue(strconv.FormatInt(taskCont.Dimension, 10), taskId, orgv.Id)
|
|
}
|
|
sumScore, averageScore = AverageOfSumNature(wherStr, 1)
|
|
if canKaoZhi != 0 {
|
|
if sumScore > canKaoZhi {
|
|
sumScore = canKaoZhi
|
|
}
|
|
}
|
|
} else {
|
|
//定量考核
|
|
|
|
if len(orgv.SunOrg) > 0 {
|
|
wherStr = fmt.Sprintf("fld_evaluation_id IN %v AND `fl_year` = %v AND `fl_month` IN %v AND fl_duty_department IN %v", taskIdStrWher, yearVal, monthStr, orgvSunOrg)
|
|
} else {
|
|
wherStr = fmt.Sprintf("fld_evaluation_id IN %v AND `fl_year` = %v AND `fl_month` IN %v AND fl_duty_department = %v", taskIdStrWher, yearVal, monthStr, orgv.Id)
|
|
}
|
|
sumScore, averageScore = AverageOfSum(wherStr, 1)
|
|
|
|
}
|
|
}
|
|
|
|
switch statisticalMethod {
|
|
case 1:
|
|
//合计
|
|
normNameTotal := fmt.Sprintf("%v%v %v", yearVal, orgv.Name, normName)
|
|
if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false {
|
|
outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal)
|
|
var seriesInfo series
|
|
seriesInfo.Name = normNameTotal
|
|
seriesInfo.Data = append(seriesInfo.Data, sumScore)
|
|
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo)
|
|
|
|
} else {
|
|
for cdi, cdv := range outputData.CylindricalData {
|
|
if cdv.Name == normNameTotal {
|
|
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore)
|
|
}
|
|
}
|
|
}
|
|
case 2:
|
|
//平均
|
|
normNameAverage := fmt.Sprintf("%v%v %v平均值", yearVal, orgv.Name, normName)
|
|
if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false {
|
|
outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage)
|
|
var seriesInfoAverage series
|
|
seriesInfoAverage.Name = normNameAverage
|
|
seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore)
|
|
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage)
|
|
} else {
|
|
for cdi, cdv := range outputData.CylindricalData {
|
|
if cdv.Name == normNameAverage {
|
|
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore)
|
|
}
|
|
}
|
|
}
|
|
default:
|
|
//合计与平均
|
|
normNameTotal := fmt.Sprintf("%v%v %v", yearVal, orgv.Name, normName)
|
|
if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false {
|
|
outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal)
|
|
var seriesInfo series
|
|
seriesInfo.Name = normNameTotal
|
|
seriesInfo.Data = append(seriesInfo.Data, sumScore)
|
|
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo)
|
|
|
|
} else {
|
|
for cdi, cdv := range outputData.CylindricalData {
|
|
if cdv.Name == normNameTotal {
|
|
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore)
|
|
}
|
|
}
|
|
}
|
|
normNameAverage := fmt.Sprintf("%v%v %v平均值", yearVal, orgv.Name, normName)
|
|
if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false {
|
|
outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage)
|
|
var seriesInfoAverage series
|
|
seriesInfoAverage.Name = normNameAverage
|
|
seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore)
|
|
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage)
|
|
} else {
|
|
for cdi, cdv := range outputData.CylindricalData {
|
|
if cdv.Name == normNameAverage {
|
|
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
//无行政组织
|
|
var sumScore float64
|
|
var averageScore float64
|
|
//获取此指标跟查询部门相关的考核方案ID
|
|
var taskIdAry []int64
|
|
global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Select("qe_id").Where("qe_state = 1 AND qe_dimension = ? AND qe_target = ?", taskCont.Dimension, taskIdInt).Find(&taskIdAry)
|
|
//组合考核方案ID
|
|
taskIdStrWher := "("
|
|
for tiai, tiav := range taskIdAry {
|
|
if tiai != 0 {
|
|
taskIdStrWher = fmt.Sprintf("%v,%v", taskIdStrWher, tiav)
|
|
} else {
|
|
taskIdStrWher = fmt.Sprintf("%v%v", taskIdStrWher, tiav)
|
|
}
|
|
|
|
}
|
|
taskIdStrWher = fmt.Sprintf("%v)", taskIdStrWher)
|
|
if len(taskIdAry) > 0 {
|
|
if norm == 1 {
|
|
//定性考核
|
|
wherStr := fmt.Sprintf("sf_evaluation_plan IN %v AND `sf_year` = %v AND `sf_month` IN %v ", taskIdStrWher, tfv.YearName, monthStr)
|
|
sumScore, averageScore = AverageOfSumNature(wherStr, 1)
|
|
} else {
|
|
//定量考核
|
|
wherStr := fmt.Sprintf("fld_evaluation_id IN %v AND `fl_year` = %v AND `fl_month` IN %v", taskIdStrWher, tfv.YearName, monthStr)
|
|
sumScore, averageScore = AverageOfSum(wherStr, 1)
|
|
|
|
}
|
|
}
|
|
//不存在行政组织
|
|
switch statisticalMethod {
|
|
case 1:
|
|
//合计
|
|
normNameTotal := fmt.Sprintf("%v", normName)
|
|
if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false {
|
|
outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal)
|
|
var seriesInfo series
|
|
seriesInfo.Name = normNameTotal
|
|
seriesInfo.Data = append(seriesInfo.Data, sumScore)
|
|
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo)
|
|
|
|
} else {
|
|
for cdi, cdv := range outputData.CylindricalData {
|
|
if cdv.Name == normNameTotal {
|
|
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore)
|
|
}
|
|
}
|
|
}
|
|
case 2:
|
|
//平均
|
|
normNameAverage := fmt.Sprintf("%v平均值", normName)
|
|
if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false {
|
|
outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage)
|
|
var seriesInfoAverage series
|
|
seriesInfoAverage.Name = normNameAverage
|
|
seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore)
|
|
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage)
|
|
} else {
|
|
for cdi, cdv := range outputData.CylindricalData {
|
|
if cdv.Name == normNameAverage {
|
|
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore)
|
|
}
|
|
}
|
|
}
|
|
default:
|
|
//合计与平均
|
|
normNameTotal := fmt.Sprintf("%v", normName)
|
|
if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false {
|
|
outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal)
|
|
var seriesInfo series
|
|
seriesInfo.Name = normNameTotal
|
|
seriesInfo.Data = append(seriesInfo.Data, sumScore)
|
|
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo)
|
|
|
|
} else {
|
|
for cdi, cdv := range outputData.CylindricalData {
|
|
if cdv.Name == normNameTotal {
|
|
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore)
|
|
}
|
|
}
|
|
}
|
|
normNameAverage := fmt.Sprintf("%v平均值", normName)
|
|
if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false {
|
|
outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage)
|
|
var seriesInfoAverage series
|
|
seriesInfoAverage.Name = normNameAverage
|
|
seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore)
|
|
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage)
|
|
} else {
|
|
for cdi, cdv := range outputData.CylindricalData {
|
|
if cdv.Name == normNameAverage {
|
|
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
case 2: //季度
|
|
for _, yearVal := range dataAry.Year {
|
|
|
|
if len(orgList) > 0 {
|
|
//有组织
|
|
for _, orgv := range orgList {
|
|
var sumScore float64
|
|
var averageScore float64
|
|
//获取此指标跟查询部门相关的考核方案ID
|
|
var orgvSunOrg string
|
|
var taskIdAry []int64
|
|
if len(orgv.SunOrg) > 0 {
|
|
orgvSunOrg = "("
|
|
for tiai, tiav := range orgv.SunOrg {
|
|
if tiai != 0 {
|
|
orgvSunOrg = fmt.Sprintf("%v,%v", orgvSunOrg, tiav)
|
|
} else {
|
|
orgvSunOrg = fmt.Sprintf("%v%v", orgvSunOrg, tiav)
|
|
}
|
|
}
|
|
orgvSunOrg = fmt.Sprintf("%v)", orgvSunOrg)
|
|
global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Select("qe_id").Where("qe_state = 1 AND qe_dimension = ? AND qe_target = ? AND qe_accept_evaluation IN ?", taskCont.Dimension, taskIdInt, orgv.SunOrg).Find(&taskIdAry)
|
|
} else {
|
|
global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Select("qe_id").Where("qe_state = 1 AND qe_dimension = ? AND qe_target = ? AND qe_accept_evaluation = ?", taskCont.Dimension, taskIdInt, orgv.Id).Find(&taskIdAry)
|
|
}
|
|
|
|
//组合考核方案ID
|
|
taskIdStrWher := "("
|
|
for tiai, tiav := range taskIdAry {
|
|
if tiai != 0 {
|
|
taskIdStrWher = fmt.Sprintf("%v,%v", taskIdStrWher, tiav)
|
|
} else {
|
|
taskIdStrWher = fmt.Sprintf("%v%v", taskIdStrWher, tiav)
|
|
}
|
|
|
|
}
|
|
taskIdStrWher = fmt.Sprintf("%v)", taskIdStrWher)
|
|
if len(taskIdAry) > 0 {
|
|
var wherStr string
|
|
var canKaoZhi float64 = 0
|
|
if norm == 1 {
|
|
//定性考核
|
|
if len(orgv.SunOrg) > 0 {
|
|
wherStr = fmt.Sprintf("sf_evaluation_plan IN %v AND `sf_year` = %v AND `sf_quarter` = %v AND sf_duty_department IN %v", taskIdStrWher, yearVal, tfv.YearName, orgvSunOrg)
|
|
} else {
|
|
wherStr = fmt.Sprintf("sf_evaluation_plan IN %v AND `sf_year` = %v AND `sf_quarter` = %v AND sf_duty_department = %v", taskIdStrWher, yearVal, tfv.YearName, orgv.Id)
|
|
canKaoZhi = GetTargetReferenceValue(strconv.FormatInt(taskCont.Dimension, 10), taskId, orgv.Id)
|
|
}
|
|
|
|
sumScore, averageScore = AverageOfSumNature(wherStr, 1)
|
|
if canKaoZhi != 0 && sumScore > canKaoZhi {
|
|
sumScore = canKaoZhi
|
|
}
|
|
} else {
|
|
//定量考核
|
|
if len(orgv.SunOrg) > 0 {
|
|
wherStr = fmt.Sprintf("fld_evaluation_id IN %v AND `fl_year` = %v AND `fl_quarter` = %v AND fl_duty_department IN %v", taskIdStrWher, yearVal, tfv.YearName, orgvSunOrg)
|
|
} else {
|
|
wherStr = fmt.Sprintf("fld_evaluation_id IN %v AND `fl_year` = %v AND `fl_quarter` = %v AND fl_duty_department = %v", taskIdStrWher, yearVal, tfv.YearName, orgv.Id)
|
|
|
|
}
|
|
|
|
sumScore, averageScore = AverageOfSum(wherStr, 1)
|
|
}
|
|
}
|
|
switch statisticalMethod {
|
|
case 1:
|
|
//合计
|
|
normNameTotal := fmt.Sprintf("%v%v %v", yearVal, orgv.Name, normName)
|
|
if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false {
|
|
outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal)
|
|
var seriesInfo series
|
|
seriesInfo.Name = normNameTotal
|
|
seriesInfo.Data = append(seriesInfo.Data, sumScore)
|
|
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo)
|
|
|
|
} else {
|
|
for cdi, cdv := range outputData.CylindricalData {
|
|
if cdv.Name == normNameTotal {
|
|
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore)
|
|
}
|
|
}
|
|
}
|
|
case 2:
|
|
//平均
|
|
normNameAverage := fmt.Sprintf("%v%v %v平均值", yearVal, orgv.Name, normName)
|
|
if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false {
|
|
outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage)
|
|
var seriesInfoAverage series
|
|
seriesInfoAverage.Name = normNameAverage
|
|
seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore)
|
|
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage)
|
|
} else {
|
|
for cdi, cdv := range outputData.CylindricalData {
|
|
if cdv.Name == normNameAverage {
|
|
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore)
|
|
}
|
|
}
|
|
}
|
|
default:
|
|
//合计与平均
|
|
normNameTotal := fmt.Sprintf("%v%v %v", yearVal, orgv.Name, normName)
|
|
if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false {
|
|
outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal)
|
|
var seriesInfo series
|
|
seriesInfo.Name = normNameTotal
|
|
seriesInfo.Data = append(seriesInfo.Data, sumScore)
|
|
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo)
|
|
|
|
} else {
|
|
for cdi, cdv := range outputData.CylindricalData {
|
|
if cdv.Name == normNameTotal {
|
|
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore)
|
|
}
|
|
}
|
|
}
|
|
normNameAverage := fmt.Sprintf("%v %v平均值", orgv.Name, normName)
|
|
if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false {
|
|
outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage)
|
|
var seriesInfoAverage series
|
|
seriesInfoAverage.Name = normNameAverage
|
|
seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore)
|
|
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage)
|
|
} else {
|
|
for cdi, cdv := range outputData.CylindricalData {
|
|
if cdv.Name == normNameAverage {
|
|
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
var sumScore float64
|
|
var averageScore float64
|
|
//获取此指标跟查询部门相关的考核方案ID
|
|
var taskIdAry []int64
|
|
global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Select("qe_id").Where("qe_state = 1 AND qe_dimension = ? AND qe_target = ?", taskCont.Dimension, taskIdInt).Find(&taskIdAry)
|
|
//组合考核方案ID
|
|
taskIdStrWher := "("
|
|
for tiai, tiav := range taskIdAry {
|
|
if tiai != 0 {
|
|
taskIdStrWher = fmt.Sprintf("%v,%v", taskIdStrWher, tiav)
|
|
} else {
|
|
taskIdStrWher = fmt.Sprintf("%v%v", taskIdStrWher, tiav)
|
|
}
|
|
|
|
}
|
|
taskIdStrWher = fmt.Sprintf("%v)", taskIdStrWher)
|
|
//无组织
|
|
if len(taskIdAry) > 0 {
|
|
if norm == 1 {
|
|
//定性考核
|
|
} else {
|
|
//定量考核
|
|
// wherStr := fmt.Sprintf("`fl_year` = %v AND `fl_quarter` = %v", yearVal, tfv.YearName)
|
|
wherStr := fmt.Sprintf("fld_evaluation_id IN %v AND `fl_year` = %v AND `fl_quarter` IN %v ", taskIdStrWher, yearVal, tfv.YearName)
|
|
sumScore, averageScore = AverageOfSum(wherStr, 1)
|
|
|
|
}
|
|
}
|
|
switch statisticalMethod {
|
|
case 1:
|
|
//合计
|
|
normNameTotal := fmt.Sprintf("%v", normName)
|
|
if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false {
|
|
outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal)
|
|
var seriesInfo series
|
|
seriesInfo.Name = normNameTotal
|
|
seriesInfo.Data = append(seriesInfo.Data, sumScore)
|
|
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo)
|
|
|
|
} else {
|
|
for cdi, cdv := range outputData.CylindricalData {
|
|
if cdv.Name == normNameTotal {
|
|
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore)
|
|
}
|
|
}
|
|
}
|
|
case 2:
|
|
//平均
|
|
normNameAverage := fmt.Sprintf("%v平均值", normName)
|
|
if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false {
|
|
outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage)
|
|
var seriesInfoAverage series
|
|
seriesInfoAverage.Name = normNameAverage
|
|
seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore)
|
|
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage)
|
|
} else {
|
|
for cdi, cdv := range outputData.CylindricalData {
|
|
if cdv.Name == normNameAverage {
|
|
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore)
|
|
}
|
|
}
|
|
}
|
|
default:
|
|
//合计与平均
|
|
normNameTotal := fmt.Sprintf("%v", normName)
|
|
if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false {
|
|
outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal)
|
|
var seriesInfo series
|
|
seriesInfo.Name = normNameTotal
|
|
seriesInfo.Data = append(seriesInfo.Data, sumScore)
|
|
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo)
|
|
|
|
} else {
|
|
for cdi, cdv := range outputData.CylindricalData {
|
|
if cdv.Name == normNameTotal {
|
|
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore)
|
|
}
|
|
}
|
|
}
|
|
normNameAverage := fmt.Sprintf("%v平均值", normName)
|
|
if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false {
|
|
outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage)
|
|
var seriesInfoAverage series
|
|
seriesInfoAverage.Name = normNameAverage
|
|
seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore)
|
|
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage)
|
|
} else {
|
|
for cdi, cdv := range outputData.CylindricalData {
|
|
if cdv.Name == normNameAverage {
|
|
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
case 3: //月
|
|
for _, yearVal := range dataAry.Year {
|
|
|
|
if len(orgList) > 0 {
|
|
//有组织
|
|
for _, orgv := range orgList {
|
|
var sumScore float64
|
|
var averageScore float64
|
|
//获取此指标跟查询部门相关的考核方案ID
|
|
var orgvSunOrg string
|
|
var taskIdAry []int64
|
|
if len(orgv.SunOrg) > 0 {
|
|
orgvSunOrg = "("
|
|
for tiai, tiav := range orgv.SunOrg {
|
|
if tiai != 0 {
|
|
orgvSunOrg = fmt.Sprintf("%v,%v", orgvSunOrg, tiav)
|
|
} else {
|
|
orgvSunOrg = fmt.Sprintf("%v%v", orgvSunOrg, tiav)
|
|
}
|
|
}
|
|
orgvSunOrg = fmt.Sprintf("%v)", orgvSunOrg)
|
|
global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Select("qe_id").Where("qe_state = 1 AND qe_dimension = ? AND qe_target = ? AND qe_accept_evaluation IN ?", taskCont.Dimension, taskIdInt, orgv.SunOrg).Find(&taskIdAry)
|
|
} else {
|
|
global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Select("qe_id").Where("qe_state = 1 AND qe_dimension = ? AND qe_target = ? AND qe_accept_evaluation = ?", taskCont.Dimension, taskIdInt, orgv.Id).Find(&taskIdAry)
|
|
}
|
|
|
|
//组合考核方案ID
|
|
taskIdStrWher := "("
|
|
for tiai, tiav := range taskIdAry {
|
|
if tiai != 0 {
|
|
taskIdStrWher = fmt.Sprintf("%v,%v", taskIdStrWher, tiav)
|
|
} else {
|
|
taskIdStrWher = fmt.Sprintf("%v%v", taskIdStrWher, tiav)
|
|
}
|
|
|
|
}
|
|
taskIdStrWher = fmt.Sprintf("%v)", taskIdStrWher)
|
|
if len(taskIdAry) > 0 {
|
|
var wherStr string
|
|
if norm == 1 {
|
|
//定性考核
|
|
var canKaoZhi float64 = 0
|
|
if len(orgv.SunOrg) > 0 {
|
|
wherStr = fmt.Sprintf("sf_evaluation_plan IN %v AND `sf_year` = %v AND `sf_month` = %v AND sf_duty_department IN %v", taskIdStrWher, yearVal, tfv.YearName, orgvSunOrg)
|
|
} else {
|
|
wherStr = fmt.Sprintf("sf_evaluation_plan IN %v AND `sf_year` = %v AND `sf_month` = %v AND sf_duty_department = %v", taskIdStrWher, yearVal, tfv.YearName, orgv.Id)
|
|
canKaoZhi = GetTargetReferenceValue(strconv.FormatInt(taskCont.Dimension, 10), taskId, orgv.Id)
|
|
}
|
|
|
|
sumScore, averageScore = AverageOfSumNature(wherStr, 1)
|
|
if canKaoZhi != 0 && sumScore > canKaoZhi {
|
|
sumScore = canKaoZhi
|
|
}
|
|
} else {
|
|
//定量考核
|
|
if len(orgv.SunOrg) > 0 {
|
|
wherStr = fmt.Sprintf("fld_evaluation_id IN %v AND `fl_year` = %v AND `fl_month` = %v AND fl_duty_department IN %v", taskIdStrWher, yearVal, tfv.YearName, orgvSunOrg)
|
|
} else {
|
|
wherStr = fmt.Sprintf("fld_evaluation_id IN %v AND `fl_year` = %v AND `fl_month` = %v AND fl_duty_department = %v", taskIdStrWher, yearVal, tfv.YearName, orgv.Id)
|
|
}
|
|
|
|
sumScore, averageScore = AverageOfSum(wherStr, 1)
|
|
}
|
|
}
|
|
switch statisticalMethod {
|
|
case 1:
|
|
//合计
|
|
normNameTotal := fmt.Sprintf("%v%v %v", yearVal, orgv.Name, normName)
|
|
if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false {
|
|
outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal)
|
|
var seriesInfo series
|
|
seriesInfo.Name = normNameTotal
|
|
seriesInfo.Data = append(seriesInfo.Data, sumScore)
|
|
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo)
|
|
|
|
} else {
|
|
for cdi, cdv := range outputData.CylindricalData {
|
|
if cdv.Name == normNameTotal {
|
|
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore)
|
|
}
|
|
}
|
|
}
|
|
case 2:
|
|
//平均
|
|
normNameAverage := fmt.Sprintf("%v%v %v平均值", yearVal, orgv.Name, normName)
|
|
if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false {
|
|
outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage)
|
|
var seriesInfoAverage series
|
|
seriesInfoAverage.Name = normNameAverage
|
|
seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore)
|
|
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage)
|
|
} else {
|
|
for cdi, cdv := range outputData.CylindricalData {
|
|
if cdv.Name == normNameAverage {
|
|
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore)
|
|
}
|
|
}
|
|
}
|
|
default:
|
|
//合计与平均
|
|
normNameTotal := fmt.Sprintf("%v%v %v", yearVal, orgv.Name, normName)
|
|
if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false {
|
|
outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal)
|
|
var seriesInfo series
|
|
seriesInfo.Name = normNameTotal
|
|
seriesInfo.Data = append(seriesInfo.Data, sumScore)
|
|
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo)
|
|
|
|
} else {
|
|
for cdi, cdv := range outputData.CylindricalData {
|
|
if cdv.Name == normNameTotal {
|
|
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore)
|
|
}
|
|
}
|
|
}
|
|
normNameAverage := fmt.Sprintf("%v %v平均值", orgv.Name, normName)
|
|
if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false {
|
|
outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage)
|
|
var seriesInfoAverage series
|
|
seriesInfoAverage.Name = normNameAverage
|
|
seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore)
|
|
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage)
|
|
} else {
|
|
for cdi, cdv := range outputData.CylindricalData {
|
|
if cdv.Name == normNameAverage {
|
|
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
} else {
|
|
//无组织
|
|
var sumScore float64
|
|
var averageScore float64
|
|
//获取此指标跟查询部门相关的考核方案ID
|
|
var taskIdAry []int64
|
|
global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Select("qe_id").Where("qe_state = 1 AND qe_dimension = ? AND qe_target = ?", taskCont.Dimension, taskIdInt).Find(&taskIdAry)
|
|
//组合考核方案ID
|
|
taskIdStrWher := "("
|
|
for tiai, tiav := range taskIdAry {
|
|
if tiai != 0 {
|
|
taskIdStrWher = fmt.Sprintf("%v,%v", taskIdStrWher, tiav)
|
|
} else {
|
|
taskIdStrWher = fmt.Sprintf("%v%v", taskIdStrWher, tiav)
|
|
}
|
|
|
|
}
|
|
taskIdStrWher = fmt.Sprintf("%v)", taskIdStrWher)
|
|
if len(taskIdAry) > 0 {
|
|
if norm == 1 {
|
|
//定性考核
|
|
} else {
|
|
//定量考核
|
|
wherStr := fmt.Sprintf("fld_evaluation_id IN %v AND `fl_year` = %v AND `fl_month` = %v ", taskIdStrWher, yearVal, tfv.YearName)
|
|
sumScore, averageScore = AverageOfSum(wherStr, 1)
|
|
}
|
|
}
|
|
switch statisticalMethod {
|
|
case 1:
|
|
//合计
|
|
normNameTotal := fmt.Sprintf("%v", normName)
|
|
if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false {
|
|
outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal)
|
|
var seriesInfo series
|
|
seriesInfo.Name = normNameTotal
|
|
seriesInfo.Data = append(seriesInfo.Data, sumScore)
|
|
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo)
|
|
|
|
} else {
|
|
for cdi, cdv := range outputData.CylindricalData {
|
|
if cdv.Name == normNameTotal {
|
|
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore)
|
|
}
|
|
}
|
|
}
|
|
case 2:
|
|
//平均
|
|
normNameAverage := fmt.Sprintf("%v平均值", normName)
|
|
if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false {
|
|
outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage)
|
|
var seriesInfoAverage series
|
|
seriesInfoAverage.Name = normNameAverage
|
|
seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore)
|
|
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage)
|
|
} else {
|
|
for cdi, cdv := range outputData.CylindricalData {
|
|
if cdv.Name == normNameAverage {
|
|
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore)
|
|
}
|
|
}
|
|
}
|
|
default:
|
|
//合计与平均
|
|
normNameTotal := fmt.Sprintf("%v", normName)
|
|
if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false {
|
|
outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal)
|
|
var seriesInfo series
|
|
seriesInfo.Name = normNameTotal
|
|
seriesInfo.Data = append(seriesInfo.Data, sumScore)
|
|
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo)
|
|
|
|
} else {
|
|
for cdi, cdv := range outputData.CylindricalData {
|
|
if cdv.Name == normNameTotal {
|
|
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore)
|
|
}
|
|
}
|
|
}
|
|
normNameAverage := fmt.Sprintf("%v平均值", normName)
|
|
if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false {
|
|
outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage)
|
|
var seriesInfoAverage series
|
|
seriesInfoAverage.Name = normNameAverage
|
|
seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore)
|
|
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage)
|
|
} else {
|
|
for cdi, cdv := range outputData.CylindricalData {
|
|
if cdv.Name == normNameAverage {
|
|
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
default: //全年
|
|
// if tfv.YearName == ""{}
|
|
fmt.Printf("tfv------------>%v\n", tfv)
|
|
if len(orgList) > 0 {
|
|
for _, orgv := range orgList {
|
|
var sumScore float64
|
|
var averageScore float64
|
|
//获取此指标跟查询部门相关的考核方案ID
|
|
var orgvSunOrg string
|
|
var taskIdAry []int64
|
|
if len(orgv.SunOrg) > 0 {
|
|
orgvSunOrg = "("
|
|
for tiai, tiav := range orgv.SunOrg {
|
|
if tiai != 0 {
|
|
orgvSunOrg = fmt.Sprintf("%v,%v", orgvSunOrg, tiav)
|
|
} else {
|
|
orgvSunOrg = fmt.Sprintf("%v%v", orgvSunOrg, tiav)
|
|
}
|
|
}
|
|
orgvSunOrg = fmt.Sprintf("%v)", orgvSunOrg)
|
|
global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Select("qe_id").Where("qe_state = 1 AND qe_dimension = ? AND qe_target = ? AND qe_accept_evaluation IN ?", taskCont.Dimension, taskIdInt, orgv.SunOrg).Find(&taskIdAry)
|
|
} else {
|
|
global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Select("qe_id").Where("qe_state = 1 AND qe_dimension = ? AND qe_target = ? AND qe_accept_evaluation = ?", taskCont.Dimension, taskIdInt, orgv.Id).Find(&taskIdAry)
|
|
}
|
|
|
|
//组合考核方案ID
|
|
taskIdStrWher := "("
|
|
for tiai, tiav := range taskIdAry {
|
|
if tiai != 0 {
|
|
taskIdStrWher = fmt.Sprintf("%v,%v", taskIdStrWher, tiav)
|
|
} else {
|
|
taskIdStrWher = fmt.Sprintf("%v%v", taskIdStrWher, tiav)
|
|
}
|
|
|
|
}
|
|
taskIdStrWher = fmt.Sprintf("%v)", taskIdStrWher)
|
|
if len(taskIdAry) > 0 {
|
|
var wherStr string
|
|
if norm == 1 {
|
|
//定性考核
|
|
var canKaoZhi float64 = 0
|
|
if len(orgv.SunOrg) > 0 {
|
|
wherStr = fmt.Sprintf("sf_evaluation_plan IN %v AND `sf_year` = %v AND sf_duty_department IN %v", taskIdStrWher, tfv.YearName, orgvSunOrg)
|
|
} else {
|
|
wherStr = fmt.Sprintf("sf_evaluation_plan IN %v AND `sf_year` = %v AND sf_duty_department = %v", taskIdStrWher, tfv.YearName, orgv.Id)
|
|
canKaoZhi = GetTargetReferenceValue(strconv.FormatInt(taskCont.Dimension, 10), taskId, orgv.Id)
|
|
}
|
|
|
|
sumScore, averageScore = AverageOfSumNature(wherStr, 1)
|
|
if canKaoZhi != 0 && sumScore > canKaoZhi {
|
|
sumScore = canKaoZhi
|
|
}
|
|
} else {
|
|
//定量考核
|
|
if len(orgv.SunOrg) > 0 {
|
|
wherStr = fmt.Sprintf("fld_evaluation_id IN %v AND `fl_year` = %v AND fl_duty_department IN %v", taskIdStrWher, tfv.YearName, orgvSunOrg)
|
|
} else {
|
|
wherStr = fmt.Sprintf("fld_evaluation_id IN %v AND `fl_year` = %v AND fl_duty_department = %v", taskIdStrWher, tfv.YearName, orgv.Id)
|
|
}
|
|
// wherStr := fmt.Sprintf("fld_evaluation_id IN %v AND `fl_year` = %v AND fl_duty_department = %v", taskIdStrWher, tfv.YearName, orgv.Id)
|
|
sumScore, averageScore = AverageOfSum(wherStr, 1)
|
|
|
|
}
|
|
}
|
|
switch statisticalMethod {
|
|
case 1:
|
|
//合计
|
|
normNameTotal := fmt.Sprintf("%v %v", orgv.Name, normName)
|
|
if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false {
|
|
outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal)
|
|
var seriesInfo series
|
|
seriesInfo.Name = normNameTotal
|
|
seriesInfo.Data = append(seriesInfo.Data, sumScore)
|
|
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo)
|
|
|
|
} else {
|
|
for cdi, cdv := range outputData.CylindricalData {
|
|
if cdv.Name == normNameTotal {
|
|
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore)
|
|
}
|
|
}
|
|
}
|
|
case 2:
|
|
//平均
|
|
normNameAverage := fmt.Sprintf("%v %v平均值", orgv.Name, normName)
|
|
if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false {
|
|
outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage)
|
|
var seriesInfoAverage series
|
|
seriesInfoAverage.Name = normNameAverage
|
|
seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore)
|
|
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage)
|
|
} else {
|
|
for cdi, cdv := range outputData.CylindricalData {
|
|
if cdv.Name == normNameAverage {
|
|
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore)
|
|
}
|
|
}
|
|
}
|
|
default:
|
|
//合计与平均
|
|
normNameTotal := fmt.Sprintf("%v %v", orgv.Name, normName)
|
|
if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false {
|
|
outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal)
|
|
var seriesInfo series
|
|
seriesInfo.Name = normNameTotal
|
|
seriesInfo.Data = append(seriesInfo.Data, sumScore)
|
|
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo)
|
|
|
|
} else {
|
|
for cdi, cdv := range outputData.CylindricalData {
|
|
if cdv.Name == normNameTotal {
|
|
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore)
|
|
}
|
|
}
|
|
}
|
|
normNameAverage := fmt.Sprintf("%v %v平均值", orgv.Name, normName)
|
|
if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false {
|
|
outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage)
|
|
var seriesInfoAverage series
|
|
seriesInfoAverage.Name = normNameAverage
|
|
seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore)
|
|
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage)
|
|
} else {
|
|
for cdi, cdv := range outputData.CylindricalData {
|
|
if cdv.Name == normNameAverage {
|
|
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
var sumScore float64
|
|
var averageScore float64
|
|
//获取此指标跟查询部门相关的考核方案ID
|
|
var taskIdAry []int64
|
|
global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Select("qe_id").Where("qe_state = 1 AND qe_dimension = ? AND qe_target = ?", taskCont.Dimension, taskIdInt).Find(&taskIdAry)
|
|
//组合考核方案ID
|
|
taskIdStrWher := "("
|
|
for tiai, tiav := range taskIdAry {
|
|
if tiai != 0 {
|
|
taskIdStrWher = fmt.Sprintf("%v,%v", taskIdStrWher, tiav)
|
|
} else {
|
|
taskIdStrWher = fmt.Sprintf("%v%v", taskIdStrWher, tiav)
|
|
}
|
|
|
|
}
|
|
taskIdStrWher = fmt.Sprintf("%v)", taskIdStrWher)
|
|
if len(taskIdAry) > 0 {
|
|
if norm == 1 {
|
|
//定性考核
|
|
wherStr := fmt.Sprintf("sf_evaluation_plan IN %v AND `sf_year` = %v", taskIdStrWher, tfv.YearName)
|
|
sumScore, averageScore = AverageOfSumNature(wherStr, 1)
|
|
} else {
|
|
//定量考核
|
|
wherStr := fmt.Sprintf("fld_evaluation_id IN %v AND `fl_year` = %v ", taskIdStrWher, tfv.YearName)
|
|
sumScore, averageScore = AverageOfSum(wherStr, 1)
|
|
|
|
}
|
|
}
|
|
//不存在行政组织
|
|
switch statisticalMethod {
|
|
case 1:
|
|
//合计
|
|
normNameTotal := fmt.Sprintf("%v", normName)
|
|
if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false {
|
|
outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal)
|
|
var seriesInfo series
|
|
seriesInfo.Name = normNameTotal
|
|
seriesInfo.Data = append(seriesInfo.Data, sumScore)
|
|
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo)
|
|
|
|
} else {
|
|
for cdi, cdv := range outputData.CylindricalData {
|
|
if cdv.Name == normNameTotal {
|
|
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore)
|
|
}
|
|
}
|
|
}
|
|
case 2:
|
|
//平均
|
|
normNameAverage := fmt.Sprintf("%v平均值", normName)
|
|
if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false {
|
|
outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage)
|
|
var seriesInfoAverage series
|
|
seriesInfoAverage.Name = normNameAverage
|
|
seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore)
|
|
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage)
|
|
} else {
|
|
for cdi, cdv := range outputData.CylindricalData {
|
|
if cdv.Name == normNameAverage {
|
|
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore)
|
|
}
|
|
}
|
|
}
|
|
default:
|
|
//合计与平均
|
|
normNameTotal := fmt.Sprintf("%v", normName)
|
|
if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false {
|
|
outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal)
|
|
var seriesInfo series
|
|
seriesInfo.Name = normNameTotal
|
|
seriesInfo.Data = append(seriesInfo.Data, sumScore)
|
|
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo)
|
|
|
|
} else {
|
|
for cdi, cdv := range outputData.CylindricalData {
|
|
if cdv.Name == normNameTotal {
|
|
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore)
|
|
}
|
|
}
|
|
}
|
|
normNameAverage := fmt.Sprintf("%v平均值", normName)
|
|
if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false {
|
|
outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage)
|
|
var seriesInfoAverage series
|
|
seriesInfoAverage.Name = normNameAverage
|
|
seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore)
|
|
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage)
|
|
} else {
|
|
for cdi, cdv := range outputData.CylindricalData {
|
|
if cdv.Name == normNameAverage {
|
|
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// fmt.Printf("orgAry====>%v\n", orgAry)
|
|
// jn, je := json.Marshal(orgList)
|
|
// fmt.Printf("orgList-====>%v-====>%v\n", string(jn), je)
|
|
// fmt.Printf("timeFrame-====>%v\n", timeFrame)
|
|
// fmt.Printf("normName-====>%v\n", normName)
|
|
// fmt.Printf("statisticalMethod-====>%v\n", statisticalMethod)
|
|
return
|
|
}
|
|
|
|
// 获取指标关联的部门
|
|
func GetTargerDepartment(dimension, targerId int64) (departID []string) {
|
|
var taskIdAry []int64
|
|
global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Select("qe_accept_evaluation").Where("qe_state = 1 AND qe_dimension = ? AND qe_target = ?", dimension, targerId).Find(&taskIdAry)
|
|
if len(taskIdAry) > 0 {
|
|
for _, v := range taskIdAry {
|
|
departID = append(departID, strconv.FormatInt(v, 10))
|
|
}
|
|
}
|
|
return
|
|
}
|
|
|
|
func TimeDimensionStatisticsNew(taskId string, dataAry natureParameter) (outputData GraphicStatistics, outErr bool) {
|
|
outErr = true
|
|
var normName string = ""
|
|
norm := 1 //1:定性考核;2:定量考核
|
|
//获取指标信息
|
|
taskIdInt, _ := strconv.ParseInt(taskId, 10, 64)
|
|
taskCont, taskErr := commonus.GetTargetInfo(taskIdInt)
|
|
if taskErr == true {
|
|
normName = taskCont.Title
|
|
outErr = taskErr
|
|
norm = taskCont.Type
|
|
} else {
|
|
// outErr = error.Error("此考核项目没有数据!")
|
|
outErr = taskErr
|
|
return
|
|
}
|
|
//获取时间参数
|
|
timeFrame := EstimatedTime(dataAry)
|
|
//获取组织架构参数
|
|
// var orgAry []orgModelsAry
|
|
var orgList []orgModels
|
|
if len(dataAry.Org) > 0 {
|
|
_, orgList = getGroupOrgList(dataAry.Org)
|
|
} else {
|
|
_, orgList = getGroupOrgList(GetTargerDepartment(taskCont.Dimension, taskIdInt))
|
|
}
|
|
// fmt.Printf("orgList ---> %v\n", orgList)
|
|
//统计方式
|
|
statisticalMethod := 3
|
|
if len(dataAry.AccMethod) == 1 {
|
|
if commonus.IsItTrueInt(1, dataAry.AccMethod) == true {
|
|
statisticalMethod = 1
|
|
} else {
|
|
statisticalMethod = 2
|
|
}
|
|
}
|
|
// jsonCont, _ := json.Marshal(dataAry)
|
|
// fmt.Printf("wherStr------>%v\n", string(jsonCont))
|
|
// return
|
|
//根据时间维度进行统计
|
|
for _, tfv := range timeFrame {
|
|
if commonus.IsItTrueString(tfv.XLine, outputData.XLine) == false {
|
|
outputData.XLine = append(outputData.XLine, tfv.XLine)
|
|
}
|
|
switch tfv.Class {
|
|
case 1: //半年
|
|
|
|
//组合月
|
|
monthStr := "("
|
|
for twi, twv := range tfv.Where {
|
|
if twi != 0 {
|
|
monthStr = fmt.Sprintf("%v,%v", monthStr, twv)
|
|
} else {
|
|
monthStr = fmt.Sprintf("%v%v", monthStr, twv)
|
|
}
|
|
|
|
}
|
|
monthStr = fmt.Sprintf("%v)", monthStr)
|
|
|
|
//定量考核
|
|
if len(orgList) > 0 {
|
|
//有政组织
|
|
for _, orgv := range orgList {
|
|
var orgvSunOrg string
|
|
//获取此指标跟查询部门相关的考核方案ID
|
|
// var taskIdAry []int64
|
|
|
|
// global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Select("qe_id").Where("qe_state = 1 AND qe_dimension = ? AND qe_target = ? AND qe_accept_evaluation = ?", taskCont.Dimension, taskIdInt, orgv.Id).Find(&taskIdAry)
|
|
// if len(orgv.SunOrg) > 0 {
|
|
// orgvSunOrg = "("
|
|
// for tiai, tiav := range orgv.SunOrg {
|
|
// if tiai != 0 {
|
|
// orgvSunOrg = fmt.Sprintf("%v,%v", orgvSunOrg, tiav)
|
|
// } else {
|
|
// orgvSunOrg = fmt.Sprintf("%v%v", orgvSunOrg, tiav)
|
|
// }
|
|
// }
|
|
// global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Select("qe_id").Where("qe_state = 1 AND qe_dimension = ? AND qe_target = ? AND qe_accept_evaluation IN ?", taskCont.Dimension, taskIdInt, orgv.SunOrg).Find(&taskIdAry)
|
|
// } else {
|
|
// global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Select("qe_id").Where("qe_state = 1 AND qe_dimension = ? AND qe_target = ? AND qe_accept_evaluation = ?", taskCont.Dimension, taskIdInt, orgv.Id).Find(&taskIdAry)
|
|
// }
|
|
|
|
//组合考核方案ID
|
|
// taskIdStrWher := "("
|
|
// for tiai, tiav := range taskIdAry {
|
|
// if tiai != 0 {
|
|
// taskIdStrWher = fmt.Sprintf("%v,%v", taskIdStrWher, tiav)
|
|
// } else {
|
|
// taskIdStrWher = fmt.Sprintf("%v%v", taskIdStrWher, tiav)
|
|
// }
|
|
|
|
// }
|
|
// taskIdStrWher = fmt.Sprintf("%v)", taskIdStrWher)
|
|
for _, yearVal := range dataAry.Year {
|
|
var sumScore float64
|
|
var averageScore float64
|
|
|
|
// if len(taskIdAry) > 0 {
|
|
var wherStr string
|
|
|
|
if norm == 1 {
|
|
var canKaoZhi float64 = 0
|
|
//定性考核
|
|
if len(orgv.SunOrg) > 0 {
|
|
|
|
orgvSunOrg = fmt.Sprintf("%v)", orgvSunOrg)
|
|
wherStr = fmt.Sprintf("sf_target_id = %v AND `sf_year` = %v AND `sf_month` IN %v AND sf_duty_department IN %v", taskIdInt, yearVal, monthStr, orgvSunOrg)
|
|
} else {
|
|
wherStr = fmt.Sprintf("sf_target_id = %v AND `sf_year` = %v AND `sf_month` IN %v AND sf_duty_department = %v", taskIdInt, yearVal, monthStr, orgv.Id)
|
|
|
|
canKaoZhi = GetTargetReferenceValue(strconv.FormatInt(taskCont.Dimension, 10), taskId, orgv.Id)
|
|
}
|
|
sumScore, averageScore = AverageOfSumNature(wherStr, 1)
|
|
if canKaoZhi != 0 {
|
|
if sumScore > canKaoZhi {
|
|
sumScore = canKaoZhi
|
|
}
|
|
}
|
|
} else {
|
|
//定量考核
|
|
|
|
if len(orgv.SunOrg) > 0 {
|
|
wherStr = fmt.Sprintf("fld_target_id = %v AND `fl_year` = %v AND `fl_month` IN %v AND fl_duty_department IN %v", taskIdInt, yearVal, monthStr, orgvSunOrg)
|
|
} else {
|
|
wherStr = fmt.Sprintf("fld_target_id = %v AND `fl_year` = %v AND `fl_month` IN %v AND fl_duty_department = %v", taskIdInt, yearVal, monthStr, orgv.Id)
|
|
}
|
|
sumScore, averageScore = AverageOfSum(wherStr, 1)
|
|
|
|
}
|
|
// }
|
|
|
|
switch statisticalMethod {
|
|
case 1:
|
|
//合计
|
|
normNameTotal := fmt.Sprintf("%v%v %v", yearVal, orgv.Name, normName)
|
|
if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false {
|
|
outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal)
|
|
var seriesInfo series
|
|
seriesInfo.Name = normNameTotal
|
|
seriesInfo.Data = append(seriesInfo.Data, sumScore)
|
|
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo)
|
|
|
|
} else {
|
|
for cdi, cdv := range outputData.CylindricalData {
|
|
if cdv.Name == normNameTotal {
|
|
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore)
|
|
}
|
|
}
|
|
}
|
|
case 2:
|
|
//平均
|
|
normNameAverage := fmt.Sprintf("%v%v %v平均值", yearVal, orgv.Name, normName)
|
|
if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false {
|
|
outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage)
|
|
var seriesInfoAverage series
|
|
seriesInfoAverage.Name = normNameAverage
|
|
seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore)
|
|
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage)
|
|
} else {
|
|
for cdi, cdv := range outputData.CylindricalData {
|
|
if cdv.Name == normNameAverage {
|
|
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore)
|
|
}
|
|
}
|
|
}
|
|
default:
|
|
//合计与平均
|
|
normNameTotal := fmt.Sprintf("%v%v %v", yearVal, orgv.Name, normName)
|
|
if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false {
|
|
outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal)
|
|
var seriesInfo series
|
|
seriesInfo.Name = normNameTotal
|
|
seriesInfo.Data = append(seriesInfo.Data, sumScore)
|
|
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo)
|
|
|
|
} else {
|
|
for cdi, cdv := range outputData.CylindricalData {
|
|
if cdv.Name == normNameTotal {
|
|
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore)
|
|
}
|
|
}
|
|
}
|
|
normNameAverage := fmt.Sprintf("%v%v %v平均值", yearVal, orgv.Name, normName)
|
|
if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false {
|
|
outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage)
|
|
var seriesInfoAverage series
|
|
seriesInfoAverage.Name = normNameAverage
|
|
seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore)
|
|
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage)
|
|
} else {
|
|
for cdi, cdv := range outputData.CylindricalData {
|
|
if cdv.Name == normNameAverage {
|
|
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
//无行政组织
|
|
var sumScore float64
|
|
var averageScore float64
|
|
//获取此指标跟查询部门相关的考核方案ID
|
|
// var taskIdAry []int64
|
|
// global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Select("qe_id").Where("qe_state = 1 AND qe_dimension = ? AND qe_target = ?", taskCont.Dimension, taskIdInt).Find(&taskIdAry)
|
|
//组合考核方案ID
|
|
// taskIdStrWher := "("
|
|
// for tiai, tiav := range taskIdAry {
|
|
// if tiai != 0 {
|
|
// taskIdStrWher = fmt.Sprintf("%v,%v", taskIdStrWher, tiav)
|
|
// } else {
|
|
// taskIdStrWher = fmt.Sprintf("%v%v", taskIdStrWher, tiav)
|
|
// }
|
|
|
|
// }
|
|
// taskIdStrWher = fmt.Sprintf("%v)", taskIdStrWher)
|
|
// if len(taskIdAry) > 0 {
|
|
if norm == 1 {
|
|
//定性考核
|
|
wherStr := fmt.Sprintf("sf_target_id = %v AND `sf_year` = %v AND `sf_month` IN %v ", taskIdInt, tfv.YearName, monthStr)
|
|
sumScore, averageScore = AverageOfSumNature(wherStr, 1)
|
|
} else {
|
|
//定量考核
|
|
wherStr := fmt.Sprintf("fld_target_id = %v AND `fl_year` = %v AND `fl_month` IN %v", taskIdInt, tfv.YearName, monthStr)
|
|
sumScore, averageScore = AverageOfSum(wherStr, 1)
|
|
|
|
}
|
|
// }
|
|
//不存在行政组织
|
|
switch statisticalMethod {
|
|
case 1:
|
|
//合计
|
|
normNameTotal := fmt.Sprintf("%v", normName)
|
|
if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false {
|
|
outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal)
|
|
var seriesInfo series
|
|
seriesInfo.Name = normNameTotal
|
|
seriesInfo.Data = append(seriesInfo.Data, sumScore)
|
|
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo)
|
|
|
|
} else {
|
|
for cdi, cdv := range outputData.CylindricalData {
|
|
if cdv.Name == normNameTotal {
|
|
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore)
|
|
}
|
|
}
|
|
}
|
|
case 2:
|
|
//平均
|
|
normNameAverage := fmt.Sprintf("%v平均值", normName)
|
|
if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false {
|
|
outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage)
|
|
var seriesInfoAverage series
|
|
seriesInfoAverage.Name = normNameAverage
|
|
seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore)
|
|
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage)
|
|
} else {
|
|
for cdi, cdv := range outputData.CylindricalData {
|
|
if cdv.Name == normNameAverage {
|
|
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore)
|
|
}
|
|
}
|
|
}
|
|
default:
|
|
//合计与平均
|
|
normNameTotal := fmt.Sprintf("%v", normName)
|
|
if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false {
|
|
outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal)
|
|
var seriesInfo series
|
|
seriesInfo.Name = normNameTotal
|
|
seriesInfo.Data = append(seriesInfo.Data, sumScore)
|
|
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo)
|
|
|
|
} else {
|
|
for cdi, cdv := range outputData.CylindricalData {
|
|
if cdv.Name == normNameTotal {
|
|
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore)
|
|
}
|
|
}
|
|
}
|
|
normNameAverage := fmt.Sprintf("%v平均值", normName)
|
|
if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false {
|
|
outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage)
|
|
var seriesInfoAverage series
|
|
seriesInfoAverage.Name = normNameAverage
|
|
seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore)
|
|
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage)
|
|
} else {
|
|
for cdi, cdv := range outputData.CylindricalData {
|
|
if cdv.Name == normNameAverage {
|
|
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
case 2: //季度
|
|
for _, yearVal := range dataAry.Year {
|
|
|
|
if len(orgList) > 0 {
|
|
//有组织
|
|
for _, orgv := range orgList {
|
|
var sumScore float64
|
|
var averageScore float64
|
|
//获取此指标跟查询部门相关的考核方案ID
|
|
var orgvSunOrg string
|
|
// var taskIdAry []int64
|
|
if len(orgv.SunOrg) > 0 {
|
|
orgvSunOrg = "("
|
|
for tiai, tiav := range orgv.SunOrg {
|
|
if tiai != 0 {
|
|
orgvSunOrg = fmt.Sprintf("%v,%v", orgvSunOrg, tiav)
|
|
} else {
|
|
orgvSunOrg = fmt.Sprintf("%v%v", orgvSunOrg, tiav)
|
|
}
|
|
}
|
|
orgvSunOrg = fmt.Sprintf("%v)", orgvSunOrg)
|
|
// global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Select("qe_id").Where("qe_state = 1 AND qe_dimension = ? AND qe_target = ? AND qe_accept_evaluation IN ?", taskCont.Dimension, taskIdInt, orgv.SunOrg).Find(&taskIdAry)
|
|
} else {
|
|
// global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Select("qe_id").Where("qe_state = 1 AND qe_dimension = ? AND qe_target = ? AND qe_accept_evaluation = ?", taskCont.Dimension, taskIdInt, orgv.Id).Find(&taskIdAry)
|
|
}
|
|
|
|
//组合考核方案ID
|
|
// taskIdStrWher := "("
|
|
// for tiai, tiav := range taskIdAry {
|
|
// if tiai != 0 {
|
|
// taskIdStrWher = fmt.Sprintf("%v,%v", taskIdStrWher, tiav)
|
|
// } else {
|
|
// taskIdStrWher = fmt.Sprintf("%v%v", taskIdStrWher, tiav)
|
|
// }
|
|
|
|
// }
|
|
// taskIdStrWher = fmt.Sprintf("%v)", taskIdStrWher)
|
|
// if len(taskIdAry) > 0 {
|
|
var wherStr string
|
|
var canKaoZhi float64 = 0
|
|
if norm == 1 {
|
|
//定性考核
|
|
if len(orgv.SunOrg) > 0 {
|
|
wherStr = fmt.Sprintf("sf_target_id = %v AND `sf_year` = %v AND `sf_quarter` = %v AND sf_duty_department IN %v", taskIdInt, yearVal, tfv.YearName, orgvSunOrg)
|
|
} else {
|
|
wherStr = fmt.Sprintf("sf_target_id = %v AND `sf_year` = %v AND `sf_quarter` = %v AND sf_duty_department = %v", taskIdInt, yearVal, tfv.YearName, orgv.Id)
|
|
canKaoZhi = GetTargetReferenceValue(strconv.FormatInt(taskCont.Dimension, 10), taskId, orgv.Id)
|
|
}
|
|
|
|
sumScore, averageScore = AverageOfSumNature(wherStr, 1)
|
|
if canKaoZhi != 0 && sumScore > canKaoZhi {
|
|
sumScore = canKaoZhi
|
|
}
|
|
} else {
|
|
//定量考核
|
|
if len(orgv.SunOrg) > 0 {
|
|
wherStr = fmt.Sprintf("fld_target_id = %v AND `fl_year` = %v AND `fl_quarter` = %v AND fl_duty_department IN %v", taskIdInt, yearVal, tfv.YearName, orgvSunOrg)
|
|
} else {
|
|
wherStr = fmt.Sprintf("fld_target_id = %v AND `fl_year` = %v AND `fl_quarter` = %v AND fl_duty_department = %v", taskIdInt, yearVal, tfv.YearName, orgv.Id)
|
|
|
|
}
|
|
|
|
sumScore, averageScore = AverageOfSum(wherStr, 1)
|
|
}
|
|
// }
|
|
switch statisticalMethod {
|
|
case 1:
|
|
//合计
|
|
normNameTotal := fmt.Sprintf("%v%v %v", yearVal, orgv.Name, normName)
|
|
if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false {
|
|
outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal)
|
|
var seriesInfo series
|
|
seriesInfo.Name = normNameTotal
|
|
seriesInfo.Data = append(seriesInfo.Data, sumScore)
|
|
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo)
|
|
|
|
} else {
|
|
for cdi, cdv := range outputData.CylindricalData {
|
|
if cdv.Name == normNameTotal {
|
|
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore)
|
|
}
|
|
}
|
|
}
|
|
case 2:
|
|
//平均
|
|
normNameAverage := fmt.Sprintf("%v%v %v平均值", yearVal, orgv.Name, normName)
|
|
if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false {
|
|
outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage)
|
|
var seriesInfoAverage series
|
|
seriesInfoAverage.Name = normNameAverage
|
|
seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore)
|
|
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage)
|
|
} else {
|
|
for cdi, cdv := range outputData.CylindricalData {
|
|
if cdv.Name == normNameAverage {
|
|
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore)
|
|
}
|
|
}
|
|
}
|
|
default:
|
|
//合计与平均
|
|
normNameTotal := fmt.Sprintf("%v%v %v", yearVal, orgv.Name, normName)
|
|
if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false {
|
|
outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal)
|
|
var seriesInfo series
|
|
seriesInfo.Name = normNameTotal
|
|
seriesInfo.Data = append(seriesInfo.Data, sumScore)
|
|
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo)
|
|
|
|
} else {
|
|
for cdi, cdv := range outputData.CylindricalData {
|
|
if cdv.Name == normNameTotal {
|
|
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore)
|
|
}
|
|
}
|
|
}
|
|
normNameAverage := fmt.Sprintf("%v %v平均值", orgv.Name, normName)
|
|
if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false {
|
|
outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage)
|
|
var seriesInfoAverage series
|
|
seriesInfoAverage.Name = normNameAverage
|
|
seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore)
|
|
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage)
|
|
} else {
|
|
for cdi, cdv := range outputData.CylindricalData {
|
|
if cdv.Name == normNameAverage {
|
|
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
var sumScore float64
|
|
var averageScore float64
|
|
//获取此指标跟查询部门相关的考核方案ID
|
|
// var taskIdAry []int64
|
|
// global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Select("qe_id").Where("qe_state = 1 AND qe_dimension = ? AND qe_target = ?", taskCont.Dimension, taskIdInt).Find(&taskIdAry)
|
|
//组合考核方案ID
|
|
// taskIdStrWher := "("
|
|
// for tiai, tiav := range taskIdAry {
|
|
// if tiai != 0 {
|
|
// taskIdStrWher = fmt.Sprintf("%v,%v", taskIdStrWher, tiav)
|
|
// } else {
|
|
// taskIdStrWher = fmt.Sprintf("%v%v", taskIdStrWher, tiav)
|
|
// }
|
|
|
|
// }
|
|
// taskIdStrWher = fmt.Sprintf("%v)", taskIdStrWher)
|
|
//无组织
|
|
// if len(taskIdAry) > 0 {
|
|
if norm == 1 {
|
|
//定性考核
|
|
wherStr := fmt.Sprintf("sf_target_id = %v AND `sf_year` = %v AND `fl_quarter` IN %v ", taskIdInt, tfv.YearName, tfv.YearName)
|
|
sumScore, averageScore = AverageOfSumNature(wherStr, 1)
|
|
} else {
|
|
//定量考核
|
|
// wherStr := fmt.Sprintf("`fl_year` = %v AND `fl_quarter` = %v", yearVal, tfv.YearName)
|
|
wherStr := fmt.Sprintf("fld_target_id = %v AND `fl_year` = %v AND `fl_quarter` IN %v ", taskIdInt, yearVal, tfv.YearName)
|
|
sumScore, averageScore = AverageOfSum(wherStr, 1)
|
|
|
|
}
|
|
// }
|
|
switch statisticalMethod {
|
|
case 1:
|
|
//合计
|
|
normNameTotal := fmt.Sprintf("%v", normName)
|
|
if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false {
|
|
outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal)
|
|
var seriesInfo series
|
|
seriesInfo.Name = normNameTotal
|
|
seriesInfo.Data = append(seriesInfo.Data, sumScore)
|
|
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo)
|
|
|
|
} else {
|
|
for cdi, cdv := range outputData.CylindricalData {
|
|
if cdv.Name == normNameTotal {
|
|
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore)
|
|
}
|
|
}
|
|
}
|
|
case 2:
|
|
//平均
|
|
normNameAverage := fmt.Sprintf("%v平均值", normName)
|
|
if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false {
|
|
outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage)
|
|
var seriesInfoAverage series
|
|
seriesInfoAverage.Name = normNameAverage
|
|
seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore)
|
|
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage)
|
|
} else {
|
|
for cdi, cdv := range outputData.CylindricalData {
|
|
if cdv.Name == normNameAverage {
|
|
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore)
|
|
}
|
|
}
|
|
}
|
|
default:
|
|
//合计与平均
|
|
normNameTotal := fmt.Sprintf("%v", normName)
|
|
if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false {
|
|
outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal)
|
|
var seriesInfo series
|
|
seriesInfo.Name = normNameTotal
|
|
seriesInfo.Data = append(seriesInfo.Data, sumScore)
|
|
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo)
|
|
|
|
} else {
|
|
for cdi, cdv := range outputData.CylindricalData {
|
|
if cdv.Name == normNameTotal {
|
|
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore)
|
|
}
|
|
}
|
|
}
|
|
normNameAverage := fmt.Sprintf("%v平均值", normName)
|
|
if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false {
|
|
outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage)
|
|
var seriesInfoAverage series
|
|
seriesInfoAverage.Name = normNameAverage
|
|
seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore)
|
|
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage)
|
|
} else {
|
|
for cdi, cdv := range outputData.CylindricalData {
|
|
if cdv.Name == normNameAverage {
|
|
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
case 3: //月
|
|
for _, yearVal := range dataAry.Year {
|
|
|
|
if len(orgList) > 0 {
|
|
//有组织
|
|
for _, orgv := range orgList {
|
|
var sumScore float64
|
|
var averageScore float64
|
|
//获取此指标跟查询部门相关的考核方案ID
|
|
var orgvSunOrg string
|
|
// var taskIdAry []int64
|
|
if len(orgv.SunOrg) > 0 {
|
|
orgvSunOrg = "("
|
|
for tiai, tiav := range orgv.SunOrg {
|
|
if tiai != 0 {
|
|
orgvSunOrg = fmt.Sprintf("%v,%v", orgvSunOrg, tiav)
|
|
} else {
|
|
orgvSunOrg = fmt.Sprintf("%v%v", orgvSunOrg, tiav)
|
|
}
|
|
}
|
|
orgvSunOrg = fmt.Sprintf("%v)", orgvSunOrg)
|
|
// global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Select("qe_id").Where("qe_state = 1 AND qe_dimension = ? AND qe_target = ? AND qe_accept_evaluation IN ?", taskCont.Dimension, taskIdInt, orgv.SunOrg).Find(&taskIdAry)
|
|
} else {
|
|
// global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Select("qe_id").Where("qe_state = 1 AND qe_dimension = ? AND qe_target = ? AND qe_accept_evaluation = ?", taskCont.Dimension, taskIdInt, orgv.Id).Find(&taskIdAry)
|
|
}
|
|
|
|
//组合考核方案ID
|
|
// taskIdStrWher := "("
|
|
// for tiai, tiav := range taskIdAry {
|
|
// if tiai != 0 {
|
|
// taskIdStrWher = fmt.Sprintf("%v,%v", taskIdStrWher, tiav)
|
|
// } else {
|
|
// taskIdStrWher = fmt.Sprintf("%v%v", taskIdStrWher, tiav)
|
|
// }
|
|
|
|
// }
|
|
// taskIdStrWher = fmt.Sprintf("%v)", taskIdStrWher)
|
|
// if len(taskIdAry) > 0 {
|
|
var wherStr string
|
|
if norm == 1 {
|
|
//定性考核
|
|
var canKaoZhi float64 = 0
|
|
if len(orgv.SunOrg) > 0 {
|
|
wherStr = fmt.Sprintf("sf_target_id = %v AND `sf_year` = %v AND `sf_month` = %v AND sf_duty_department IN %v", taskIdInt, yearVal, tfv.YearName, orgvSunOrg)
|
|
} else {
|
|
wherStr = fmt.Sprintf("sf_target_id = %v AND `sf_year` = %v AND `sf_month` = %v AND sf_duty_department = %v", taskIdInt, yearVal, tfv.YearName, orgv.Id)
|
|
canKaoZhi = GetTargetReferenceValue(strconv.FormatInt(taskCont.Dimension, 10), taskId, orgv.Id)
|
|
}
|
|
|
|
sumScore, averageScore = AverageOfSumNature(wherStr, 1)
|
|
if canKaoZhi != 0 && sumScore > canKaoZhi {
|
|
sumScore = canKaoZhi
|
|
}
|
|
} else {
|
|
//定量考核
|
|
if len(orgv.SunOrg) > 0 {
|
|
wherStr = fmt.Sprintf("fld_target_id = %v AND `fl_year` = %v AND `fl_month` = %v AND fl_duty_department IN %v", taskIdInt, yearVal, tfv.YearName, orgvSunOrg)
|
|
} else {
|
|
wherStr = fmt.Sprintf("fld_target_id = %v AND `fl_year` = %v AND `fl_month` = %v AND fl_duty_department = %v", taskIdInt, yearVal, tfv.YearName, orgv.Id)
|
|
}
|
|
|
|
sumScore, averageScore = AverageOfSum(wherStr, 1)
|
|
}
|
|
// }
|
|
switch statisticalMethod {
|
|
case 1:
|
|
//合计
|
|
normNameTotal := fmt.Sprintf("%v%v %v", yearVal, orgv.Name, normName)
|
|
if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false {
|
|
outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal)
|
|
var seriesInfo series
|
|
seriesInfo.Name = normNameTotal
|
|
seriesInfo.Data = append(seriesInfo.Data, sumScore)
|
|
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo)
|
|
|
|
} else {
|
|
for cdi, cdv := range outputData.CylindricalData {
|
|
if cdv.Name == normNameTotal {
|
|
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore)
|
|
}
|
|
}
|
|
}
|
|
case 2:
|
|
//平均
|
|
normNameAverage := fmt.Sprintf("%v%v %v平均值", yearVal, orgv.Name, normName)
|
|
if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false {
|
|
outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage)
|
|
var seriesInfoAverage series
|
|
seriesInfoAverage.Name = normNameAverage
|
|
seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore)
|
|
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage)
|
|
} else {
|
|
for cdi, cdv := range outputData.CylindricalData {
|
|
if cdv.Name == normNameAverage {
|
|
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore)
|
|
}
|
|
}
|
|
}
|
|
default:
|
|
//合计与平均
|
|
normNameTotal := fmt.Sprintf("%v%v %v", yearVal, orgv.Name, normName)
|
|
if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false {
|
|
outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal)
|
|
var seriesInfo series
|
|
seriesInfo.Name = normNameTotal
|
|
seriesInfo.Data = append(seriesInfo.Data, sumScore)
|
|
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo)
|
|
|
|
} else {
|
|
for cdi, cdv := range outputData.CylindricalData {
|
|
if cdv.Name == normNameTotal {
|
|
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore)
|
|
}
|
|
}
|
|
}
|
|
normNameAverage := fmt.Sprintf("%v %v平均值", orgv.Name, normName)
|
|
if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false {
|
|
outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage)
|
|
var seriesInfoAverage series
|
|
seriesInfoAverage.Name = normNameAverage
|
|
seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore)
|
|
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage)
|
|
} else {
|
|
for cdi, cdv := range outputData.CylindricalData {
|
|
if cdv.Name == normNameAverage {
|
|
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
} else {
|
|
//无组织
|
|
var sumScore float64
|
|
var averageScore float64
|
|
//获取此指标跟查询部门相关的考核方案ID
|
|
// var taskIdAry []int64
|
|
// global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Select("qe_id").Where("qe_state = 1 AND qe_dimension = ? AND qe_target = ?", taskCont.Dimension, taskIdInt).Find(&taskIdAry)
|
|
//组合考核方案ID
|
|
// taskIdStrWher := "("
|
|
// for tiai, tiav := range taskIdAry {
|
|
// if tiai != 0 {
|
|
// taskIdStrWher = fmt.Sprintf("%v,%v", taskIdStrWher, tiav)
|
|
// } else {
|
|
// taskIdStrWher = fmt.Sprintf("%v%v", taskIdStrWher, tiav)
|
|
// }
|
|
|
|
// }
|
|
// taskIdStrWher = fmt.Sprintf("%v)", taskIdStrWher)
|
|
// if len(taskIdAry) > 0 {
|
|
if norm == 1 {
|
|
//定性考核
|
|
wherStr := fmt.Sprintf("sf_target_id = %v AND `sf_year` = %v AND `fl_month` IN %v ", taskIdInt, tfv.YearName, tfv.YearName)
|
|
sumScore, averageScore = AverageOfSumNature(wherStr, 1)
|
|
} else {
|
|
//定量考核
|
|
wherStr := fmt.Sprintf("fld_target_id = %v AND `fl_year` = %v AND `fl_month` = %v ", taskIdInt, yearVal, tfv.YearName)
|
|
sumScore, averageScore = AverageOfSum(wherStr, 1)
|
|
}
|
|
// }
|
|
switch statisticalMethod {
|
|
case 1:
|
|
//合计
|
|
normNameTotal := fmt.Sprintf("%v", normName)
|
|
if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false {
|
|
outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal)
|
|
var seriesInfo series
|
|
seriesInfo.Name = normNameTotal
|
|
seriesInfo.Data = append(seriesInfo.Data, sumScore)
|
|
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo)
|
|
|
|
} else {
|
|
for cdi, cdv := range outputData.CylindricalData {
|
|
if cdv.Name == normNameTotal {
|
|
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore)
|
|
}
|
|
}
|
|
}
|
|
case 2:
|
|
//平均
|
|
normNameAverage := fmt.Sprintf("%v平均值", normName)
|
|
if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false {
|
|
outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage)
|
|
var seriesInfoAverage series
|
|
seriesInfoAverage.Name = normNameAverage
|
|
seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore)
|
|
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage)
|
|
} else {
|
|
for cdi, cdv := range outputData.CylindricalData {
|
|
if cdv.Name == normNameAverage {
|
|
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore)
|
|
}
|
|
}
|
|
}
|
|
default:
|
|
//合计与平均
|
|
normNameTotal := fmt.Sprintf("%v", normName)
|
|
if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false {
|
|
outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal)
|
|
var seriesInfo series
|
|
seriesInfo.Name = normNameTotal
|
|
seriesInfo.Data = append(seriesInfo.Data, sumScore)
|
|
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo)
|
|
|
|
} else {
|
|
for cdi, cdv := range outputData.CylindricalData {
|
|
if cdv.Name == normNameTotal {
|
|
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore)
|
|
}
|
|
}
|
|
}
|
|
normNameAverage := fmt.Sprintf("%v平均值", normName)
|
|
if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false {
|
|
outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage)
|
|
var seriesInfoAverage series
|
|
seriesInfoAverage.Name = normNameAverage
|
|
seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore)
|
|
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage)
|
|
} else {
|
|
for cdi, cdv := range outputData.CylindricalData {
|
|
if cdv.Name == normNameAverage {
|
|
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
default: //全年
|
|
// if tfv.YearName == ""{}
|
|
// fmt.Printf("tfv------------>%v\n", tfv)
|
|
if len(orgList) > 0 {
|
|
for _, orgv := range orgList {
|
|
var sumScore float64
|
|
var averageScore float64
|
|
//获取此指标跟查询部门相关的考核方案ID
|
|
var orgvSunOrg string
|
|
// var taskIdAry []int64
|
|
if len(orgv.SunOrg) > 0 {
|
|
orgvSunOrg = "("
|
|
for tiai, tiav := range orgv.SunOrg {
|
|
if tiai != 0 {
|
|
orgvSunOrg = fmt.Sprintf("%v,%v", orgvSunOrg, tiav)
|
|
} else {
|
|
orgvSunOrg = fmt.Sprintf("%v%v", orgvSunOrg, tiav)
|
|
}
|
|
}
|
|
orgvSunOrg = fmt.Sprintf("%v)", orgvSunOrg)
|
|
// global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Select("qe_id").Where("qe_state = 1 AND qe_dimension = ? AND qe_target = ? AND qe_accept_evaluation IN ?", taskCont.Dimension, taskIdInt, orgv.SunOrg).Find(&taskIdAry)
|
|
} else {
|
|
// global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Select("qe_id").Where("qe_state = 1 AND qe_dimension = ? AND qe_target = ? AND qe_accept_evaluation = ?", taskCont.Dimension, taskIdInt, orgv.Id).Find(&taskIdAry)
|
|
}
|
|
|
|
//组合考核方案ID
|
|
// taskIdStrWher := "("
|
|
// for tiai, tiav := range taskIdAry {
|
|
// if tiai != 0 {
|
|
// taskIdStrWher = fmt.Sprintf("%v,%v", taskIdStrWher, tiav)
|
|
// } else {
|
|
// taskIdStrWher = fmt.Sprintf("%v%v", taskIdStrWher, tiav)
|
|
// }
|
|
|
|
// }
|
|
// taskIdStrWher = fmt.Sprintf("%v)", taskIdStrWher)
|
|
// if len(taskIdAry) > 0 {
|
|
var wherStr string
|
|
if norm == 1 {
|
|
//定性考核
|
|
var canKaoZhi float64 = 0
|
|
if len(orgv.SunOrg) > 0 {
|
|
wherStr = fmt.Sprintf("sf_target_id = %v AND `sf_year` = %v AND sf_duty_department IN %v", taskIdInt, tfv.YearName, orgvSunOrg)
|
|
} else {
|
|
wherStr = fmt.Sprintf("sf_target_id = %v AND `sf_year` = %v AND sf_duty_department = %v", taskIdInt, tfv.YearName, orgv.Id)
|
|
canKaoZhi = GetTargetReferenceValue(strconv.FormatInt(taskCont.Dimension, 10), taskId, orgv.Id)
|
|
}
|
|
|
|
sumScore, averageScore = AverageOfSumNature(wherStr, 1)
|
|
if canKaoZhi != 0 && sumScore > canKaoZhi {
|
|
sumScore = canKaoZhi
|
|
}
|
|
} else {
|
|
//定量考核
|
|
if len(orgv.SunOrg) > 0 {
|
|
wherStr = fmt.Sprintf("fld_target_id = %v AND `fl_year` = %v AND fl_duty_department IN %v", taskIdInt, tfv.YearName, orgvSunOrg)
|
|
} else {
|
|
wherStr = fmt.Sprintf("fld_target_id = %v AND `fl_year` = %v AND fl_duty_department = %v", taskIdInt, tfv.YearName, orgv.Id)
|
|
}
|
|
// wherStr := fmt.Sprintf("fld_evaluation_id IN %v AND `fl_year` = %v AND fl_duty_department = %v", taskIdStrWher, tfv.YearName, orgv.Id)
|
|
sumScore, averageScore = AverageOfSum(wherStr, 1)
|
|
|
|
}
|
|
// }
|
|
switch statisticalMethod {
|
|
case 1:
|
|
//合计
|
|
normNameTotal := fmt.Sprintf("%v %v", orgv.Name, normName)
|
|
if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false {
|
|
outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal)
|
|
var seriesInfo series
|
|
seriesInfo.Name = normNameTotal
|
|
seriesInfo.Data = append(seriesInfo.Data, sumScore)
|
|
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo)
|
|
|
|
} else {
|
|
for cdi, cdv := range outputData.CylindricalData {
|
|
if cdv.Name == normNameTotal {
|
|
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore)
|
|
}
|
|
}
|
|
}
|
|
case 2:
|
|
//平均
|
|
normNameAverage := fmt.Sprintf("%v %v平均值", orgv.Name, normName)
|
|
if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false {
|
|
outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage)
|
|
var seriesInfoAverage series
|
|
seriesInfoAverage.Name = normNameAverage
|
|
seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore)
|
|
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage)
|
|
} else {
|
|
for cdi, cdv := range outputData.CylindricalData {
|
|
if cdv.Name == normNameAverage {
|
|
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore)
|
|
}
|
|
}
|
|
}
|
|
default:
|
|
//合计与平均
|
|
normNameTotal := fmt.Sprintf("%v %v", orgv.Name, normName)
|
|
if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false {
|
|
outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal)
|
|
var seriesInfo series
|
|
seriesInfo.Name = normNameTotal
|
|
seriesInfo.Data = append(seriesInfo.Data, sumScore)
|
|
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo)
|
|
|
|
} else {
|
|
for cdi, cdv := range outputData.CylindricalData {
|
|
if cdv.Name == normNameTotal {
|
|
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore)
|
|
}
|
|
}
|
|
}
|
|
normNameAverage := fmt.Sprintf("%v %v平均值", orgv.Name, normName)
|
|
if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false {
|
|
outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage)
|
|
var seriesInfoAverage series
|
|
seriesInfoAverage.Name = normNameAverage
|
|
seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore)
|
|
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage)
|
|
} else {
|
|
for cdi, cdv := range outputData.CylindricalData {
|
|
if cdv.Name == normNameAverage {
|
|
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
var sumScore float64
|
|
var averageScore float64
|
|
//获取此指标跟查询部门相关的考核方案ID
|
|
// var taskIdAry []int64
|
|
// global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Select("qe_id").Where("qe_state = 1 AND qe_dimension = ? AND qe_target = ?", taskCont.Dimension, taskIdInt).Find(&taskIdAry)
|
|
//组合考核方案ID
|
|
// taskIdStrWher := "("
|
|
// for tiai, tiav := range taskIdAry {
|
|
// if tiai != 0 {
|
|
// taskIdStrWher = fmt.Sprintf("%v,%v", taskIdStrWher, tiav)
|
|
// } else {
|
|
// taskIdStrWher = fmt.Sprintf("%v%v", taskIdStrWher, tiav)
|
|
// }
|
|
|
|
// }
|
|
// taskIdStrWher = fmt.Sprintf("%v)", taskIdStrWher)
|
|
// if len(taskIdAry) > 0 {
|
|
if norm == 1 {
|
|
//定性考核
|
|
wherStr := fmt.Sprintf("sf_target_id = %v AND `sf_year` = %v", taskIdInt, tfv.YearName)
|
|
sumScore, averageScore = AverageOfSumNature(wherStr, 1)
|
|
} else {
|
|
//定量考核
|
|
wherStr := fmt.Sprintf("fld_target_id = %v AND `fl_year` = %v ", taskIdInt, tfv.YearName)
|
|
sumScore, averageScore = AverageOfSum(wherStr, 1)
|
|
|
|
}
|
|
// }
|
|
//不存在行政组织
|
|
switch statisticalMethod {
|
|
case 1:
|
|
//合计
|
|
normNameTotal := fmt.Sprintf("%v", normName)
|
|
if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false {
|
|
outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal)
|
|
var seriesInfo series
|
|
seriesInfo.Name = normNameTotal
|
|
seriesInfo.Data = append(seriesInfo.Data, sumScore)
|
|
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo)
|
|
|
|
} else {
|
|
for cdi, cdv := range outputData.CylindricalData {
|
|
if cdv.Name == normNameTotal {
|
|
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore)
|
|
}
|
|
}
|
|
}
|
|
case 2:
|
|
//平均
|
|
normNameAverage := fmt.Sprintf("%v平均值", normName)
|
|
if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false {
|
|
outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage)
|
|
var seriesInfoAverage series
|
|
seriesInfoAverage.Name = normNameAverage
|
|
seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore)
|
|
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage)
|
|
} else {
|
|
for cdi, cdv := range outputData.CylindricalData {
|
|
if cdv.Name == normNameAverage {
|
|
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore)
|
|
}
|
|
}
|
|
}
|
|
default:
|
|
//合计与平均
|
|
normNameTotal := fmt.Sprintf("%v", normName)
|
|
if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false {
|
|
outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal)
|
|
var seriesInfo series
|
|
seriesInfo.Name = normNameTotal
|
|
seriesInfo.Data = append(seriesInfo.Data, sumScore)
|
|
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo)
|
|
|
|
} else {
|
|
for cdi, cdv := range outputData.CylindricalData {
|
|
if cdv.Name == normNameTotal {
|
|
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore)
|
|
}
|
|
}
|
|
}
|
|
normNameAverage := fmt.Sprintf("%v平均值", normName)
|
|
if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false {
|
|
outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage)
|
|
var seriesInfoAverage series
|
|
seriesInfoAverage.Name = normNameAverage
|
|
seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore)
|
|
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage)
|
|
} else {
|
|
for cdi, cdv := range outputData.CylindricalData {
|
|
if cdv.Name == normNameAverage {
|
|
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// fmt.Printf("orgAry====>%v\n", orgAry)
|
|
// jn, je := json.Marshal(orgList)
|
|
// fmt.Printf("orgList-====>%v-====>%v\n", string(jn), je)
|
|
// fmt.Printf("timeFrame-====>%v\n", timeFrame)
|
|
// fmt.Printf("normName-====>%v\n", normName)
|
|
// fmt.Printf("statisticalMethod-====>%v\n", statisticalMethod)
|
|
return
|
|
}
|
|
|