15 changed files with 3525 additions and 286 deletions
@ -0,0 +1,305 @@ |
|||
package quantification |
|||
|
|||
import ( |
|||
"strconv" |
|||
|
|||
"github.com/flipped-aurora/gin-vue-admin/server/commonus" |
|||
"github.com/flipped-aurora/gin-vue-admin/server/global" |
|||
"github.com/flipped-aurora/gin-vue-admin/server/model/assessmentmodel" |
|||
) |
|||
|
|||
//计算数值用的
|
|||
/* |
|||
计算定性数值 |
|||
*/ |
|||
//获取定性总值
|
|||
func AuxiliaryCalculationSumNature(where interface{}) (sumScore float64) { |
|||
var addSumScore float64 = 0 |
|||
//加分
|
|||
var jiaFenAry []TongjiFenShu |
|||
global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.ScoreFlow{}).Select("sf_score,sf_count").Where(where).Where("sf_plus_reduce_score = 1").Where("sf_reply IN (2,3)").Find(&jiaFenAry) |
|||
for _, jiav := range jiaFenAry { |
|||
addSumScore = addSumScore + (jiav.Score * jiav.Count) |
|||
} |
|||
//减分
|
|||
var scoreReduction float64 = 0 |
|||
var jianFenAry []TongjiFenShu |
|||
global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.ScoreFlow{}).Select("sf_score,sf_count").Where(where).Where("sf_plus_reduce_score = 2").Where("sf_reply IN (2,3)").Find(&jianFenAry) |
|||
for _, jianv := range jianFenAry { |
|||
scoreReduction = scoreReduction + (jianv.Score * jianv.Count) |
|||
} |
|||
if addSumScore > scoreReduction { |
|||
sumScore = addSumScore - scoreReduction |
|||
} else { |
|||
sumScore = scoreReduction - addSumScore |
|||
} |
|||
return |
|||
} |
|||
|
|||
//获取定性总数
|
|||
func AuxiliaryCalculationCountNature(where interface{}) (sumScore float64) { |
|||
gormDb := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.ScoreFlow{}).Where(where).Where("sf_reply IN (2,3)") |
|||
gormDb.Pluck("COALESCE(COUNT(sf_id), 0) as countid", &sumScore) //获取总数
|
|||
return |
|||
} |
|||
|
|||
//计算总值和平均值
|
|||
func AverageOfSumNature(where interface{}, class ...int) (sumScore float64, averageScore float64) { |
|||
sumScore = AuxiliaryCalculationSumNature(where) / 100 |
|||
// panic(sumScore)
|
|||
if len(class) > 0 { |
|||
countPage := AuxiliaryCalculationCountNature(where) |
|||
if countPage > 0 { |
|||
averageScore = sumScore / countPage |
|||
} |
|||
} |
|||
if sumScore != 0 { |
|||
sumScore = commonus.Decimal(sumScore) |
|||
} |
|||
if averageScore != 0 { |
|||
averageScore = commonus.Decimal(averageScore) |
|||
} |
|||
return |
|||
} |
|||
|
|||
//统计查询条件
|
|||
func (d *dataLockStatistics) StatisticalQueryCriteria(qualId int64) { |
|||
d.mutext.Lock() |
|||
defer d.mutext.Unlock() |
|||
var flowLogList []assessmentmodel.FlowLog |
|||
floLogErr := global.GVA_DB_Performanceappraisal.Where("FIND_IN_SET(?,`fl_evaluation_id`)", qualId).Find(&flowLogList).Error |
|||
if floLogErr == nil { |
|||
for _, fv := range flowLogList { |
|||
// fvDepartId := strconv.FormatInt(fv.DutyDepartment, 10)
|
|||
// if commonus.IsItTrueString(fvDepartId, d.accDepart) == false {
|
|||
// d.accDepart = append(d.accDepart, fvDepartId)
|
|||
// }
|
|||
yearStr := strconv.FormatInt(int64(fv.Year), 10) |
|||
if commonus.IsItTrueString(yearStr, d.YearTime) == false { |
|||
d.YearTime = append(d.YearTime, yearStr) |
|||
} |
|||
//判断组织架构是否有数据
|
|||
if len(d.OrgMap) > 0 { |
|||
for oi, ov := range d.OrgMap { |
|||
//判断公司是否已经存在
|
|||
if ov.Id == strconv.FormatInt(fv.DutyGroup, 10) { |
|||
//判断是否有分厂数据
|
|||
if len(ov.Child) > 0 { |
|||
isYes := true |
|||
for _, dv := range ov.Child { |
|||
if dv.Id == strconv.FormatInt(fv.DutyDepartment, 10) { |
|||
isYes = false //该部门分厂已经存在
|
|||
} |
|||
} |
|||
if isYes == true { |
|||
//该部门分厂不存在是添加
|
|||
//写入部门
|
|||
whereDepart := commonus.MapOut() |
|||
whereDepart["id"] = fv.DutyDepartment |
|||
orgDepartCont, orgDepartErr := commonus.GetNewOrgCont(whereDepart, "name") |
|||
if orgDepartErr == nil { |
|||
var orgDepartMapCont orgModels |
|||
orgDepartMapCont.Id = strconv.FormatInt(fv.DutyDepartment, 10) |
|||
orgDepartMapCont.Name = orgDepartCont.Name |
|||
d.OrgMap[oi].Child = append(d.OrgMap[oi].Child, orgDepartMapCont) |
|||
} |
|||
} |
|||
} else { |
|||
//没有分厂数据,根据上级数据进行新增
|
|||
if fv.DutyDepartment != 0 { |
|||
//写入部门
|
|||
whereDepart := commonus.MapOut() |
|||
whereDepart["id"] = fv.DutyDepartment |
|||
orgDepartCont, orgDepartErr := commonus.GetNewOrgCont(whereDepart, "name") |
|||
if orgDepartErr == nil { |
|||
var orgDepartMapCont orgModels |
|||
orgDepartMapCont.Id = strconv.FormatInt(fv.DutyDepartment, 10) |
|||
orgDepartMapCont.Name = orgDepartCont.Name |
|||
d.OrgMap[oi].Child = append(d.OrgMap[oi].Child, orgDepartMapCont) |
|||
} |
|||
} |
|||
} |
|||
|
|||
} else { |
|||
if fv.DutyGroup != 0 { |
|||
//写入集团信息
|
|||
where := commonus.MapOut() |
|||
where["id"] = fv.DutyGroup |
|||
orgGroupCont, orgGroupErr := commonus.GetNewOrgCont(where, "name") |
|||
if orgGroupErr == nil { |
|||
var orgMapCont orgModelsAry |
|||
orgMapCont.Id = strconv.FormatInt(fv.DutyGroup, 10) |
|||
orgMapCont.Name = orgGroupCont.Name |
|||
|
|||
if fv.DutyDepartment != 0 { |
|||
//写入部门
|
|||
whereDepart := commonus.MapOut() |
|||
whereDepart["id"] = fv.DutyDepartment |
|||
orgDepartCont, orgDepartErr := commonus.GetNewOrgCont(whereDepart, "name") |
|||
if orgDepartErr == nil { |
|||
var orgDepartMapCont orgModels |
|||
orgDepartMapCont.Id = strconv.FormatInt(fv.DutyDepartment, 10) |
|||
orgDepartMapCont.Name = orgDepartCont.Name |
|||
orgMapCont.Child = append(orgMapCont.Child, orgDepartMapCont) |
|||
} |
|||
} |
|||
d.OrgMap = append(d.OrgMap, orgMapCont) |
|||
} |
|||
|
|||
} |
|||
} |
|||
} |
|||
} else { |
|||
//没有数据的时候根据数值进行新增
|
|||
if fv.DutyGroup != 0 { |
|||
//写入集团信息
|
|||
where := commonus.MapOut() |
|||
where["id"] = fv.DutyGroup |
|||
orgGroupCont, orgGroupErr := commonus.GetNewOrgCont(where, "name") |
|||
if orgGroupErr == nil { |
|||
var orgMapCont orgModelsAry |
|||
orgMapCont.Id = strconv.FormatInt(fv.DutyGroup, 10) |
|||
orgMapCont.Name = orgGroupCont.Name |
|||
|
|||
if fv.DutyDepartment != 0 { |
|||
//写入部门
|
|||
whereDepart := commonus.MapOut() |
|||
whereDepart["id"] = fv.DutyDepartment |
|||
orgDepartCont, orgDepartErr := commonus.GetNewOrgCont(whereDepart, "name") |
|||
if orgDepartErr == nil { |
|||
var orgDepartMapCont orgModels |
|||
orgDepartMapCont.Id = strconv.FormatInt(fv.DutyDepartment, 10) |
|||
orgDepartMapCont.Name = orgDepartCont.Name |
|||
orgMapCont.Child = append(orgMapCont.Child, orgDepartMapCont) |
|||
} |
|||
} |
|||
d.OrgMap = append(d.OrgMap, orgMapCont) |
|||
} |
|||
|
|||
} |
|||
} |
|||
} |
|||
} |
|||
synergeticProcess.Done() |
|||
} |
|||
|
|||
func (d *dataLockStatistics) StatisticalQueryCriteriaXin(qualId int64) { |
|||
d.mutext.Lock() |
|||
defer d.mutext.Unlock() |
|||
// fmt.Printf("%v----------1--3--------%v\n", qualId, qualId)
|
|||
var flowLogList []assessmentmodel.ScoreFlow |
|||
floLogErr := global.GVA_DB_Performanceappraisal.Where("sf_evaluation_plan = ?", qualId).Find(&flowLogList).Error |
|||
if floLogErr == nil { |
|||
for _, fv := range flowLogList { |
|||
// fvDepartId := strconv.FormatInt(fv.DutyDepartment, 10)
|
|||
// if commonus.IsItTrueString(fvDepartId, d.accDepart) == false {
|
|||
// d.accDepart = append(d.accDepart, fvDepartId)
|
|||
// }
|
|||
yearStr := strconv.FormatInt(int64(fv.Year), 10) |
|||
if commonus.IsItTrueString(yearStr, d.YearTime) == false { |
|||
d.YearTime = append(d.YearTime, yearStr) |
|||
} |
|||
//判断组织架构是否有数据
|
|||
if len(d.OrgMap) > 0 { |
|||
for oi, ov := range d.OrgMap { |
|||
//判断公司是否已经存在
|
|||
if ov.Id == strconv.FormatInt(fv.DutyGroup, 10) { |
|||
//判断是否有分厂数据
|
|||
if len(ov.Child) > 0 { |
|||
isYes := true |
|||
for _, dv := range ov.Child { |
|||
if dv.Id == strconv.FormatInt(fv.DutyDepartment, 10) { |
|||
isYes = false //该部门分厂已经存在
|
|||
} |
|||
} |
|||
if isYes == true { |
|||
//该部门分厂不存在是添加
|
|||
//写入部门
|
|||
whereDepart := commonus.MapOut() |
|||
whereDepart["id"] = fv.DutyDepartment |
|||
orgDepartCont, orgDepartErr := commonus.GetNewOrgCont(whereDepart, "name") |
|||
if orgDepartErr == nil { |
|||
var orgDepartMapCont orgModels |
|||
orgDepartMapCont.Id = strconv.FormatInt(fv.DutyDepartment, 10) |
|||
orgDepartMapCont.Name = orgDepartCont.Name |
|||
d.OrgMap[oi].Child = append(d.OrgMap[oi].Child, orgDepartMapCont) |
|||
} |
|||
} |
|||
} else { |
|||
//没有分厂数据,根据上级数据进行新增
|
|||
if fv.DutyDepartment != 0 { |
|||
//写入部门
|
|||
whereDepart := commonus.MapOut() |
|||
whereDepart["id"] = fv.DutyDepartment |
|||
orgDepartCont, orgDepartErr := commonus.GetNewOrgCont(whereDepart, "name") |
|||
if orgDepartErr == nil { |
|||
var orgDepartMapCont orgModels |
|||
orgDepartMapCont.Id = strconv.FormatInt(fv.DutyDepartment, 10) |
|||
orgDepartMapCont.Name = orgDepartCont.Name |
|||
d.OrgMap[oi].Child = append(d.OrgMap[oi].Child, orgDepartMapCont) |
|||
} |
|||
} |
|||
} |
|||
|
|||
} else { |
|||
if fv.DutyGroup != 0 { |
|||
//写入集团信息
|
|||
where := commonus.MapOut() |
|||
where["id"] = fv.DutyGroup |
|||
orgGroupCont, orgGroupErr := commonus.GetNewOrgCont(where, "name") |
|||
if orgGroupErr == nil { |
|||
var orgMapCont orgModelsAry |
|||
orgMapCont.Id = strconv.FormatInt(fv.DutyGroup, 10) |
|||
orgMapCont.Name = orgGroupCont.Name |
|||
|
|||
if fv.DutyDepartment != 0 { |
|||
//写入部门
|
|||
whereDepart := commonus.MapOut() |
|||
whereDepart["id"] = fv.DutyDepartment |
|||
orgDepartCont, orgDepartErr := commonus.GetNewOrgCont(whereDepart, "name") |
|||
if orgDepartErr == nil { |
|||
var orgDepartMapCont orgModels |
|||
orgDepartMapCont.Id = strconv.FormatInt(fv.DutyDepartment, 10) |
|||
orgDepartMapCont.Name = orgDepartCont.Name |
|||
orgMapCont.Child = append(orgMapCont.Child, orgDepartMapCont) |
|||
} |
|||
} |
|||
d.OrgMap = append(d.OrgMap, orgMapCont) |
|||
} |
|||
|
|||
} |
|||
} |
|||
} |
|||
} else { |
|||
//没有数据的时候根据数值进行新增
|
|||
if fv.DutyGroup != 0 { |
|||
//写入集团信息
|
|||
where := commonus.MapOut() |
|||
where["id"] = fv.DutyGroup |
|||
orgGroupCont, orgGroupErr := commonus.GetNewOrgCont(where, "name") |
|||
if orgGroupErr == nil { |
|||
var orgMapCont orgModelsAry |
|||
orgMapCont.Id = strconv.FormatInt(fv.DutyGroup, 10) |
|||
orgMapCont.Name = orgGroupCont.Name |
|||
|
|||
if fv.DutyDepartment != 0 { |
|||
//写入部门
|
|||
whereDepart := commonus.MapOut() |
|||
whereDepart["id"] = fv.DutyDepartment |
|||
orgDepartCont, orgDepartErr := commonus.GetNewOrgCont(whereDepart, "name") |
|||
if orgDepartErr == nil { |
|||
var orgDepartMapCont orgModels |
|||
orgDepartMapCont.Id = strconv.FormatInt(fv.DutyDepartment, 10) |
|||
orgDepartMapCont.Name = orgDepartCont.Name |
|||
orgMapCont.Child = append(orgMapCont.Child, orgDepartMapCont) |
|||
} |
|||
} |
|||
d.OrgMap = append(d.OrgMap, orgMapCont) |
|||
} |
|||
|
|||
} |
|||
} |
|||
} |
|||
} |
|||
synergeticProcess.Done() |
|||
} |
|||
@ -0,0 +1,996 @@ |
|||
package quantification |
|||
|
|||
import ( |
|||
"fmt" |
|||
"strconv" |
|||
|
|||
"github.com/flipped-aurora/gin-vue-admin/server/commonus" |
|||
"github.com/flipped-aurora/gin-vue-admin/server/global" |
|||
"github.com/flipped-aurora/gin-vue-admin/server/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 |
|||
} |
|||
} |
|||
//根据时间维度进行统计
|
|||
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 { |
|||
//定性考核
|
|||
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) |
|||
} |
|||
sumScore, averageScore = AverageOfSumNature(wherStr, 1) |
|||
} 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 |
|||
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) |
|||
} |
|||
|
|||
sumScore, averageScore = AverageOfSumNature(wherStr, 1) |
|||
} 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 { |
|||
//定性考核
|
|||
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) |
|||
} |
|||
|
|||
sumScore, averageScore = AverageOfSumNature(wherStr, 1) |
|||
} 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 { |
|||
//定性考核
|
|||
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) |
|||
} |
|||
|
|||
sumScore, averageScore = AverageOfSumNature(wherStr, 1) |
|||
} 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 |
|||
} |
|||
Loading…
Reference in new issue