|
|
|
@ -403,160 +403,160 @@ func (a *ApiMethod) NewSummaryDetails(c *gin.Context) { |
|
|
|
var lookStatistics []detailedResultsList |
|
|
|
for _, v := range planVersioInfo { //维度
|
|
|
|
for _, cv := range v.Child { //指标
|
|
|
|
if cv.Id == "43" { |
|
|
|
|
|
|
|
var statisCont detailedResultsList |
|
|
|
statisCont.DimensionId = v.Id //维度Id
|
|
|
|
statisCont.DimensionName = v.Name //维度名称
|
|
|
|
statisCont.DimensionWeight = int64(v.ZhiFraction) //维度权重
|
|
|
|
statisCont.TargetId = cv.Id //指标ID
|
|
|
|
statisCont.TargetName = cv.Name //指标名称
|
|
|
|
statisCont.TargetCont = cv.Content //指标名称
|
|
|
|
statisCont.Targetweight = cv.ReferenceScore //指标权重
|
|
|
|
statisCont.GroupId = strconv.FormatInt(planVersion.Group, 10) //集团Id
|
|
|
|
statisCont.Versio = planVersion.Key |
|
|
|
var groupCont modelshr.AdministrativeOrganization |
|
|
|
groupCont.GetCont(map[string]interface{}{"`id`": planVersion.Group}, "name") |
|
|
|
statisCont.GroupName = groupCont.Name //集团名称
|
|
|
|
statisCont.DepartmentId = strconv.FormatInt(planVersion.Department, 10) //部门ID
|
|
|
|
var departCont modelshr.AdministrativeOrganization |
|
|
|
departCont.GetCont(map[string]interface{}{"`id`": planVersion.Department}, "name") |
|
|
|
statisCont.DepartmentName = departCont.Name //部门名称
|
|
|
|
|
|
|
|
var evalTargetCont modelskpi.EvaluationTarget //指标信息
|
|
|
|
if cv.Id != "" && cv.Id != "0" { |
|
|
|
targetErr := evalTargetCont.GetCont(map[string]interface{}{"`et_id`": cv.Id}, "et_type") |
|
|
|
if targetErr == nil { |
|
|
|
monthInt := int64(requestData.Months) |
|
|
|
if evalTargetCont.Type == 1 { //定性指标
|
|
|
|
statisCont.Score, statisCont.ExecutiveDepartment = DingXingScoreCalculation(orgId, requestData.Year, cv.ReferenceScore, []int64{monthInt}, cv.Id) |
|
|
|
} else { //定量指标
|
|
|
|
var sendList []dingLiangKaoHe |
|
|
|
var dingLiangScore float64 = 0 |
|
|
|
switch cv.Cycles { |
|
|
|
case 5: //季度指标
|
|
|
|
var fengDingZhi float64 = 0 |
|
|
|
isTrue := true |
|
|
|
switch monthInt { |
|
|
|
case 3: |
|
|
|
for i := 1; i <= 3; i++ { |
|
|
|
sendListIng, orgNameList := GetDingLiangLog(orgId, requestData.Year, int64(i), cv.Id, fmt.Sprintf("%v月份实际分值", i)) |
|
|
|
sendList = append(sendList, sendListIng...) |
|
|
|
statisCont.ExecutiveDepartment = append(statisCont.ExecutiveDepartment, orgNameList...) |
|
|
|
if i == 3 { |
|
|
|
for _, v := range sendListIng { |
|
|
|
fengDingZhi = v.Capping |
|
|
|
if v.MtOrAt == 2 { |
|
|
|
dingLiangScore = v.Score |
|
|
|
isTrue = false |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
case 6: |
|
|
|
for i := 4; i <= 6; i++ { |
|
|
|
sendListIng, orgNameList := GetDingLiangLog(orgId, requestData.Year, int64(i), cv.Id, fmt.Sprintf("%v月份实际分值", i)) |
|
|
|
sendList = append(sendList, sendListIng...) |
|
|
|
statisCont.ExecutiveDepartment = append(statisCont.ExecutiveDepartment, orgNameList...) |
|
|
|
if i == 6 { |
|
|
|
for _, v := range sendListIng { |
|
|
|
fengDingZhi = v.Capping |
|
|
|
if v.MtOrAt == 2 { |
|
|
|
dingLiangScore = v.Score |
|
|
|
isTrue = false |
|
|
|
} |
|
|
|
// if cv.Id == "120" {
|
|
|
|
|
|
|
|
var statisCont detailedResultsList |
|
|
|
statisCont.DimensionId = v.Id //维度Id
|
|
|
|
statisCont.DimensionName = v.Name //维度名称
|
|
|
|
statisCont.DimensionWeight = int64(v.ZhiFraction) //维度权重
|
|
|
|
statisCont.TargetId = cv.Id //指标ID
|
|
|
|
statisCont.TargetName = cv.Name //指标名称
|
|
|
|
statisCont.TargetCont = cv.Content //指标名称
|
|
|
|
statisCont.Targetweight = cv.ReferenceScore //指标权重
|
|
|
|
statisCont.GroupId = strconv.FormatInt(planVersion.Group, 10) //集团Id
|
|
|
|
statisCont.Versio = planVersion.Key |
|
|
|
var groupCont modelshr.AdministrativeOrganization |
|
|
|
groupCont.GetCont(map[string]interface{}{"`id`": planVersion.Group}, "name") |
|
|
|
statisCont.GroupName = groupCont.Name //集团名称
|
|
|
|
statisCont.DepartmentId = strconv.FormatInt(planVersion.Department, 10) //部门ID
|
|
|
|
var departCont modelshr.AdministrativeOrganization |
|
|
|
departCont.GetCont(map[string]interface{}{"`id`": planVersion.Department}, "name") |
|
|
|
statisCont.DepartmentName = departCont.Name //部门名称
|
|
|
|
|
|
|
|
var evalTargetCont modelskpi.EvaluationTarget //指标信息
|
|
|
|
if cv.Id != "" && cv.Id != "0" { |
|
|
|
targetErr := evalTargetCont.GetCont(map[string]interface{}{"`et_id`": cv.Id}, "et_type") |
|
|
|
if targetErr == nil { |
|
|
|
monthInt := int64(requestData.Months) |
|
|
|
if evalTargetCont.Type == 1 { //定性指标
|
|
|
|
statisCont.Score, statisCont.ExecutiveDepartment = DingXingScoreCalculation(orgId, requestData.Year, cv.ReferenceScore, []int64{monthInt}, cv.Id) |
|
|
|
} else { //定量指标
|
|
|
|
var sendList []dingLiangKaoHe |
|
|
|
var dingLiangScore float64 = 0 |
|
|
|
switch cv.Cycles { |
|
|
|
case 5: //季度指标
|
|
|
|
var fengDingZhi float64 = 0 |
|
|
|
isTrue := true |
|
|
|
switch monthInt { |
|
|
|
case 3: |
|
|
|
for i := 1; i <= 3; i++ { |
|
|
|
sendListIng, orgNameList := GetDingLiangLog(orgId, requestData.Year, int64(i), cv.Id, fmt.Sprintf("%v月份实际分值", i)) |
|
|
|
sendList = append(sendList, sendListIng...) |
|
|
|
statisCont.ExecutiveDepartment = append(statisCont.ExecutiveDepartment, orgNameList...) |
|
|
|
if i == 3 { |
|
|
|
for _, v := range sendListIng { |
|
|
|
fengDingZhi = v.Capping |
|
|
|
if v.MtOrAt == 2 { |
|
|
|
dingLiangScore = v.Score |
|
|
|
isTrue = false |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
case 9: |
|
|
|
for i := 7; i <= 9; i++ { |
|
|
|
sendListIng, orgNameList := GetDingLiangLog(orgId, requestData.Year, int64(i), cv.Id, fmt.Sprintf("%v月份实际分值", i)) |
|
|
|
sendList = append(sendList, sendListIng...) |
|
|
|
statisCont.ExecutiveDepartment = append(statisCont.ExecutiveDepartment, orgNameList...) |
|
|
|
if i == 9 { |
|
|
|
for _, v := range sendListIng { |
|
|
|
fengDingZhi = v.Capping |
|
|
|
if v.MtOrAt == 2 { |
|
|
|
dingLiangScore = v.Score |
|
|
|
isTrue = false |
|
|
|
} |
|
|
|
} |
|
|
|
case 6: |
|
|
|
for i := 4; i <= 6; i++ { |
|
|
|
sendListIng, orgNameList := GetDingLiangLog(orgId, requestData.Year, int64(i), cv.Id, fmt.Sprintf("%v月份实际分值", i)) |
|
|
|
sendList = append(sendList, sendListIng...) |
|
|
|
statisCont.ExecutiveDepartment = append(statisCont.ExecutiveDepartment, orgNameList...) |
|
|
|
if i == 6 { |
|
|
|
for _, v := range sendListIng { |
|
|
|
fengDingZhi = v.Capping |
|
|
|
if v.MtOrAt == 2 { |
|
|
|
dingLiangScore = v.Score |
|
|
|
isTrue = false |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
case 12: |
|
|
|
for i := 10; i <= 12; i++ { |
|
|
|
sendListIng, orgNameList := GetDingLiangLog(orgId, requestData.Year, int64(i), cv.Id, fmt.Sprintf("%v月份实际分值", i)) |
|
|
|
sendList = append(sendList, sendListIng...) |
|
|
|
statisCont.ExecutiveDepartment = append(statisCont.ExecutiveDepartment, orgNameList...) |
|
|
|
if i == 12 { |
|
|
|
for _, v := range sendListIng { |
|
|
|
fengDingZhi = v.Capping |
|
|
|
if v.MtOrAt == 2 { |
|
|
|
dingLiangScore = v.Score |
|
|
|
isTrue = false |
|
|
|
} |
|
|
|
} |
|
|
|
case 9: |
|
|
|
for i := 7; i <= 9; i++ { |
|
|
|
sendListIng, orgNameList := GetDingLiangLog(orgId, requestData.Year, int64(i), cv.Id, fmt.Sprintf("%v月份实际分值", i)) |
|
|
|
sendList = append(sendList, sendListIng...) |
|
|
|
statisCont.ExecutiveDepartment = append(statisCont.ExecutiveDepartment, orgNameList...) |
|
|
|
if i == 9 { |
|
|
|
for _, v := range sendListIng { |
|
|
|
fengDingZhi = v.Capping |
|
|
|
if v.MtOrAt == 2 { |
|
|
|
dingLiangScore = v.Score |
|
|
|
isTrue = false |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
default: |
|
|
|
isTrue = true |
|
|
|
} |
|
|
|
if isTrue { |
|
|
|
targetScore, attribute, _ := GetTargetPlanScore("", cv.Id, orgId, requestData.Year, monthInt) |
|
|
|
if attribute == 3 { |
|
|
|
statisCont.Score = targetScore |
|
|
|
} else { |
|
|
|
var daChengLv float64 = 0 |
|
|
|
var pingJunXiShu float64 = 0 |
|
|
|
for _, j := range sendList { |
|
|
|
daChengLv = daChengLv + j.CompletionRateAll |
|
|
|
pingJunXiShu++ |
|
|
|
} |
|
|
|
if pingJunXiShu > 0 { |
|
|
|
pingJunZhi := daChengLv / pingJunXiShu |
|
|
|
statisCont.Score = publicmethod.DecimalEs(GetQuantifyScore(targetScore, pingJunZhi, fengDingZhi), 2) |
|
|
|
} else { |
|
|
|
statisCont.Score = targetScore |
|
|
|
case 12: |
|
|
|
for i := 10; i <= 12; i++ { |
|
|
|
sendListIng, orgNameList := GetDingLiangLog(orgId, requestData.Year, int64(i), cv.Id, fmt.Sprintf("%v月份实际分值", i)) |
|
|
|
sendList = append(sendList, sendListIng...) |
|
|
|
statisCont.ExecutiveDepartment = append(statisCont.ExecutiveDepartment, orgNameList...) |
|
|
|
if i == 12 { |
|
|
|
for _, v := range sendListIng { |
|
|
|
fengDingZhi = v.Capping |
|
|
|
if v.MtOrAt == 2 { |
|
|
|
dingLiangScore = v.Score |
|
|
|
isTrue = false |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
statisCont.Score = dingLiangScore |
|
|
|
} |
|
|
|
|
|
|
|
default: |
|
|
|
sendList, statisCont.ExecutiveDepartment = GetDingLiangLog(orgId, requestData.Year, monthInt, cv.Id, "") |
|
|
|
chushu := len(sendList) |
|
|
|
if chushu > 0 { |
|
|
|
isTrue := true |
|
|
|
for _, v := range sendList { |
|
|
|
dingLiangScore = dingLiangScore + v.Score |
|
|
|
if v.MtOrAt == 2 { |
|
|
|
dingLiangScore = v.Score |
|
|
|
isTrue = false |
|
|
|
} |
|
|
|
isTrue = true |
|
|
|
} |
|
|
|
if isTrue { |
|
|
|
targetScore, attribute, _ := GetTargetPlanScore("", cv.Id, orgId, requestData.Year, monthInt) |
|
|
|
if attribute == 3 { |
|
|
|
statisCont.Score = targetScore |
|
|
|
} else { |
|
|
|
var daChengLv float64 = 0 |
|
|
|
var pingJunXiShu float64 = 0 |
|
|
|
for _, j := range sendList { |
|
|
|
daChengLv = daChengLv + j.CompletionRateAll |
|
|
|
pingJunXiShu++ |
|
|
|
} |
|
|
|
if isTrue { |
|
|
|
dingLiangScore, _ = publicmethod.DecimalNew(dingLiangScore/float64(chushu), 2) |
|
|
|
statisCont.Score = dingLiangScore |
|
|
|
if pingJunXiShu > 0 { |
|
|
|
pingJunZhi := daChengLv / pingJunXiShu |
|
|
|
statisCont.Score = publicmethod.DecimalEs(GetQuantifyScore(targetScore, pingJunZhi, fengDingZhi), 2) |
|
|
|
} else { |
|
|
|
statisCont.Score = dingLiangScore |
|
|
|
statisCont.Score = targetScore |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
statisCont.Score = dingLiangScore |
|
|
|
} |
|
|
|
|
|
|
|
default: |
|
|
|
sendList, statisCont.ExecutiveDepartment = GetDingLiangLog(orgId, requestData.Year, monthInt, cv.Id, "") |
|
|
|
chushu := len(sendList) |
|
|
|
if chushu > 0 { |
|
|
|
isTrue := true |
|
|
|
for _, v := range sendList { |
|
|
|
dingLiangScore = dingLiangScore + v.Score |
|
|
|
if v.MtOrAt == 2 { |
|
|
|
dingLiangScore = v.Score |
|
|
|
isTrue = false |
|
|
|
} |
|
|
|
} |
|
|
|
if isTrue { |
|
|
|
dingLiangScore, _ = publicmethod.DecimalNew(dingLiangScore/float64(chushu), 2) |
|
|
|
statisCont.Score = dingLiangScore |
|
|
|
} else { |
|
|
|
targetScore, _, _ := GetTargetPlanScore("", cv.Id, orgId, requestData.Year, monthInt) |
|
|
|
statisCont.Score = targetScore |
|
|
|
statisCont.Score = dingLiangScore |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
targetScore, _, _ := GetTargetPlanScore("", cv.Id, orgId, requestData.Year, monthInt) |
|
|
|
statisCont.Score = targetScore |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
statisCont.Type = evalTargetCont.Type //1:定性;2:定量
|
|
|
|
statisCont.Unit = cv.Unit //单位
|
|
|
|
statisCont.Cycle = cv.Cycles //周期
|
|
|
|
statisCont.Cycleattr = cv.CycleAttres //辅助参数
|
|
|
|
lookStatistics = append(lookStatistics, statisCont) |
|
|
|
} |
|
|
|
statisCont.Type = evalTargetCont.Type //1:定性;2:定量
|
|
|
|
statisCont.Unit = cv.Unit //单位
|
|
|
|
statisCont.Cycle = cv.Cycles //周期
|
|
|
|
statisCont.Cycleattr = cv.CycleAttres //辅助参数
|
|
|
|
lookStatistics = append(lookStatistics, statisCont) |
|
|
|
// }
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|