32 changed files with 1967 additions and 234 deletions
@ -0,0 +1,218 @@ |
|||||
|
package evaluation |
||||
|
|
||||
|
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" |
||||
|
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response" |
||||
|
"github.com/flipped-aurora/gin-vue-admin/server/model/hrsystem" |
||||
|
"github.com/gin-gonic/gin" |
||||
|
) |
||||
|
|
||||
|
func (e *EvaluationInterface) ExamineFlow(c *gin.Context) { |
||||
|
isTrue, userCont := commonus.ClientIdentity() |
||||
|
if isTrue != true { |
||||
|
response.Result(1001, isTrue, "您的身份令牌已经失效!请重新登录获取身份令牌!", c) |
||||
|
return |
||||
|
} |
||||
|
var requestData getExamineFlow |
||||
|
c.ShouldBindJSON(&requestData) |
||||
|
if requestData.Id == "" { |
||||
|
response.Result(101, requestData, "数据获取失败!", c) |
||||
|
return |
||||
|
} |
||||
|
if requestData.IsCorrection == 0 { |
||||
|
requestData.IsCorrection = 2 |
||||
|
} |
||||
|
|
||||
|
var qualEvalInfo assessmentmodel.QualitativeEvaluation |
||||
|
qualWhere := commonus.MapOut() |
||||
|
qualWhere["`qe_id`"] = requestData.Id |
||||
|
qualEvalInfoErr := qualEvalInfo.GetCont(qualWhere) |
||||
|
if qualEvalInfoErr != nil { |
||||
|
response.Result(102, qualEvalInfoErr, "未查询到数据!", c) |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
var flowMap []commonus.FlowAllMap |
||||
|
|
||||
|
// wxkStr := userCont.Wechat
|
||||
|
//1、创建
|
||||
|
var oneFlowInfo commonus.FlowAllMap |
||||
|
oneFlowInfo.Step = 1 |
||||
|
oneFlowInfo.NodeName = commonus.GetSetpName(1) |
||||
|
oneFlowInfo.State = 2 |
||||
|
oneFlowInfo.Class = 1 |
||||
|
oneFlowInfo.UserList = append(oneFlowInfo.UserList, GetApproveUser(userCont.Wechat)) |
||||
|
flowMap = append(flowMap, oneFlowInfo) |
||||
|
|
||||
|
if qualEvalInfo.Type == 1 { |
||||
|
//定性
|
||||
|
//2、创建人部门负责人审核
|
||||
|
var twoFlowInfo commonus.FlowAllMap |
||||
|
twoFlowInfo.Step = 2 |
||||
|
twoFlowInfo.NodeName = commonus.GetSetpName(2) |
||||
|
twoFlowInfo.State = 1 |
||||
|
twoFlowInfo.Class = 1 |
||||
|
// orgCont, _ := commonus.GetNewOrgCont(map[string]interface{}{"`id`": userCont.Deparment}, "id", "wechat_organization_id")
|
||||
|
// sendUserIsTrue, sendUserList := commonus.GetSendMsgUserAry(16182159043990656, orgCont.WechatOrganizationId)
|
||||
|
twoDepartId, _ := strconv.ParseInt(userCont.Deparment, 10, 64) |
||||
|
sendUserIsTrue, sendUserList := commonus.GetSendMsgUserAry(16182159043990656, twoDepartId) |
||||
|
if sendUserIsTrue == true { |
||||
|
for _, v := range sendUserList { |
||||
|
twoFlowInfo.UserList = append(twoFlowInfo.UserList, GetApproveUser(v)) |
||||
|
} |
||||
|
} |
||||
|
flowMap = append(flowMap, twoFlowInfo) |
||||
|
//3、被考核部门内勤进行责任划分
|
||||
|
var threeFlowInfo commonus.FlowAllMap |
||||
|
threeFlowInfo.Step = 3 |
||||
|
threeFlowInfo.NodeName = commonus.GetSetpName(3) |
||||
|
threeFlowInfo.State = 1 |
||||
|
threeFlowInfo.Class = 1 |
||||
|
|
||||
|
// threeorgCont, _ := commonus.GetNewOrgCont(map[string]interface{}{"`id`": qualEvalInfo.AcceptEvaluation}, "id", "wechat_organization_id")
|
||||
|
// sendUserIsTrueThree, sendUserListThree := commonus.GetSendMsgUserAry(16118387069540343, threeorgCont.WechatOrganizationId)
|
||||
|
sendUserIsTrueThree, sendUserListThree := commonus.GetSendMsgUserAry(16118387069540343, qualEvalInfo.AcceptEvaluation) |
||||
|
if sendUserIsTrueThree == true { |
||||
|
for _, v := range sendUserListThree { |
||||
|
threeFlowInfo.UserList = append(threeFlowInfo.UserList, GetApproveUser(v)) |
||||
|
} |
||||
|
} |
||||
|
flowMap = append(flowMap, threeFlowInfo) |
||||
|
//4、被考核部门负责人对责任划分确认
|
||||
|
var fourFlowInfo commonus.FlowAllMap |
||||
|
fourFlowInfo.Step = 4 |
||||
|
fourFlowInfo.NodeName = commonus.GetSetpName(7) |
||||
|
fourFlowInfo.State = 1 |
||||
|
fourFlowInfo.Class = 1 |
||||
|
|
||||
|
// fourorgCont, _ := commonus.GetNewOrgCont(map[string]interface{}{"`id`": qualEvalInfo.AcceptEvaluation}, "id", "wechat_organization_id")
|
||||
|
// sendUserIsTrueFour, sendUserListFour := commonus.GetSendMsgUserAry(16182159043990656, fourorgCont.WechatOrganizationId)
|
||||
|
sendUserIsTrueFour, sendUserListFour := commonus.GetSendMsgUserAry(16182159043990656, qualEvalInfo.AcceptEvaluation) |
||||
|
if sendUserIsTrueFour == true { |
||||
|
for _, v := range sendUserListFour { |
||||
|
fourFlowInfo.UserList = append(fourFlowInfo.UserList, GetApproveUser(v)) |
||||
|
} |
||||
|
} |
||||
|
flowMap = append(flowMap, fourFlowInfo) |
||||
|
if requestData.IsCorrection == 1 { |
||||
|
//5、整改人节点。由内勤指定
|
||||
|
var fiveFlowInfo commonus.FlowAllMap |
||||
|
fiveFlowInfo.Step = 5 |
||||
|
fiveFlowInfo.NodeName = commonus.GetSetpName(4) |
||||
|
fiveFlowInfo.State = 1 |
||||
|
fiveFlowInfo.Class = 2 |
||||
|
// fiveFlowInfo.UserList = GetFlowNodeManEs(flowID, class, 5,encFile)
|
||||
|
flowMap = append(flowMap, fiveFlowInfo) |
||||
|
//6、被考核部门负责人对整改措施确认
|
||||
|
var sixFlowInfo commonus.FlowAllMap |
||||
|
sixFlowInfo.Step = 6 |
||||
|
sixFlowInfo.NodeName = commonus.GetSetpName(7) |
||||
|
sixFlowInfo.State = 1 |
||||
|
sixFlowInfo.Class = 1 |
||||
|
|
||||
|
// sixorgCont, _ := commonus.GetNewOrgCont(map[string]interface{}{"`id`": qualEvalInfo.AcceptEvaluation}, "id", "wechat_organization_id")
|
||||
|
// sendUserIsTrueSix, sendUserListSix := commonus.GetSendMsgUserAry(16182159043990656, sixorgCont.WechatOrganizationId)
|
||||
|
sendUserIsTrueSix, sendUserListSix := commonus.GetSendMsgUserAry(16182159043990656, qualEvalInfo.AcceptEvaluation) |
||||
|
if sendUserIsTrueSix == true { |
||||
|
for _, v := range sendUserListSix { |
||||
|
sixFlowInfo.UserList = append(sixFlowInfo.UserList, GetApproveUser(v)) |
||||
|
} |
||||
|
} |
||||
|
flowMap = append(flowMap, sixFlowInfo) |
||||
|
//7、发起人验收
|
||||
|
var serverFlowInfo commonus.FlowAllMap |
||||
|
serverFlowInfo.Step = 7 |
||||
|
serverFlowInfo.NodeName = commonus.GetSetpName(5) |
||||
|
serverFlowInfo.State = 1 |
||||
|
serverFlowInfo.Class = 1 |
||||
|
serverFlowInfo.UserList = append(serverFlowInfo.UserList, GetApproveUser(userCont.Wechat)) |
||||
|
flowMap = append(flowMap, serverFlowInfo) |
||||
|
} else { |
||||
|
//5、发起人验收
|
||||
|
var serverEsFlowInfo commonus.FlowAllMap |
||||
|
serverEsFlowInfo.Step = 5 |
||||
|
serverEsFlowInfo.NodeName = commonus.GetSetpName(5) |
||||
|
serverEsFlowInfo.State = 1 |
||||
|
serverEsFlowInfo.Class = 1 |
||||
|
serverEsFlowInfo.UserList = append(serverEsFlowInfo.UserList, GetApproveUser(userCont.Wechat)) |
||||
|
flowMap = append(flowMap, serverEsFlowInfo) |
||||
|
} |
||||
|
} else { |
||||
|
//定量
|
||||
|
//审批结束
|
||||
|
var twoFlowInfo commonus.FlowAllMap |
||||
|
twoFlowInfo.Step = 2 |
||||
|
twoFlowInfo.NodeName = commonus.GetSetpName(7) |
||||
|
twoFlowInfo.State = 1 |
||||
|
twoFlowInfo.Class = 1 |
||||
|
|
||||
|
// where := commonus.MapOut()
|
||||
|
// where["id"] = userCont.Deparment
|
||||
|
// orgCont, _ := commonus.GetNewOrgCont(where, "id", "wechat_organization_id")
|
||||
|
departId, _ := strconv.ParseInt(userCont.Deparment, 10, 64) |
||||
|
sendUserIsTrue, sendUserList := commonus.GetSendMsgUserAry(16182159043990656, departId) |
||||
|
if sendUserIsTrue == true { |
||||
|
for _, v := range sendUserList { |
||||
|
twoFlowInfo.UserList = append(twoFlowInfo.UserList, GetApproveUser(v)) |
||||
|
} |
||||
|
} |
||||
|
flowMap = append(flowMap, twoFlowInfo) |
||||
|
} |
||||
|
|
||||
|
// flowMap = append(flowMap, oneFlowInfo)
|
||||
|
response.Result(0, flowMap, "查询成功!", c) |
||||
|
} |
||||
|
|
||||
|
//获取人员信息
|
||||
|
func GetApproveUser(key string) (returnUser commonus.UserListFlowAll) { |
||||
|
var userCont hrsystem.Personnel |
||||
|
// qualWhere := commonus.MapOut()
|
||||
|
// qualWhere["`key`"] = key
|
||||
|
|
||||
|
userErr := global.GVA_DB_HrDataBase.Where("`wechat` = ? OR `work_wechat` = ?", key, key).First(&userCont).Error |
||||
|
if userErr == nil { |
||||
|
returnUser.Id = strconv.FormatInt(userCont.Key, 10) |
||||
|
returnUser.Name = userCont.Name |
||||
|
returnUser.Icon = userCont.Icon |
||||
|
returnUser.Group = userCont.Company |
||||
|
|
||||
|
where := commonus.MapOut() |
||||
|
where["id"] = userCont.Company |
||||
|
orgCont, _ := commonus.GetNewOrgCont(where, "id", "name") |
||||
|
returnUser.GroupName = orgCont.Name |
||||
|
|
||||
|
returnUser.DepartmentId, _ = strconv.ParseInt(userCont.Deparment, 10, 64) |
||||
|
whereDepart := commonus.MapOut() |
||||
|
whereDepart["id"] = userCont.Deparment |
||||
|
orgContDepart, _ := commonus.GetNewOrgCont(whereDepart, "id", "name") |
||||
|
returnUser.DepartmentName = orgContDepart.Name |
||||
|
// returnUser.DepartmentName = userCont.DepartmentName
|
||||
|
returnUser.WorkshopId = userCont.Position |
||||
|
var positionCont hrsystem.Position |
||||
|
positionContErr := positionCont.GetCont(map[string]interface{}{"`id`": userCont.Position}, "`name`") |
||||
|
if positionContErr == nil { |
||||
|
returnUser.WorkshopName = positionCont.Name |
||||
|
} |
||||
|
|
||||
|
returnUser.PostId = userCont.AdminOrg |
||||
|
var postCont hrsystem.AdministrativeOrganization |
||||
|
postContErr := postCont.GetCont(map[string]interface{}{"`id`": userCont.AdminOrg}, "`name`") |
||||
|
if postContErr == nil { |
||||
|
returnUser.PostName = postCont.Name |
||||
|
} |
||||
|
|
||||
|
// returnUser.Tema = userCont.Tema
|
||||
|
// returnUser.TemaName = userCont.TemaName
|
||||
|
if userCont.Wechat != "" { |
||||
|
returnUser.Wechat = userCont.Wechat |
||||
|
} |
||||
|
if userCont.WorkWechat != "" { |
||||
|
returnUser.Wechat = userCont.WorkWechat |
||||
|
} |
||||
|
} |
||||
|
return |
||||
|
} |
||||
@ -0,0 +1,611 @@ |
|||||
|
package statistics |
||||
|
|
||||
|
import ( |
||||
|
"encoding/json" |
||||
|
"fmt" |
||||
|
"sort" |
||||
|
"strconv" |
||||
|
"time" |
||||
|
|
||||
|
"github.com/flipped-aurora/gin-vue-admin/server/api/statistics/quantification" |
||||
|
"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" |
||||
|
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response" |
||||
|
"github.com/gin-gonic/gin" |
||||
|
) |
||||
|
|
||||
|
//获取有效版本考核
|
||||
|
func (a *ApiGroup) GetPlanVersionValid(c *gin.Context) { |
||||
|
isTrue, userCont := commonus.ClientIdentity() |
||||
|
if isTrue != true { |
||||
|
response.Result(1001, isTrue, "您的身份令牌已经失效!请重新登录获取身份令牌!", c) |
||||
|
return |
||||
|
} |
||||
|
var requestData DutyPlanVersio |
||||
|
c.ShouldBindJSON(&requestData) |
||||
|
if requestData.Year == "" { |
||||
|
requestData.Year = commonus.TimeStampToDate(time.Now().Unix(), 11) |
||||
|
} |
||||
|
// fmt.Printf("年---->%v\n", requestData.Year)
|
||||
|
var planVersioCont []assessmentmodel.PlanVersio |
||||
|
gormDb := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.PlanVersio{}).Where("`state` = 1") |
||||
|
switch userCont.IsAdmin { |
||||
|
case "2": |
||||
|
if requestData.DeaprtId != "" { |
||||
|
gormDb = gormDb.Where("`department` = ? ", userCont.Deparment) |
||||
|
} |
||||
|
gormDb = gormDb.Where("`group` = ? ", userCont.Company) |
||||
|
case "3": |
||||
|
if requestData.Group != "" { |
||||
|
gormDb = gormDb.Where("`group` = ? ", requestData.Group) |
||||
|
} |
||||
|
if requestData.DeaprtId != "" { |
||||
|
gormDb = gormDb.Where("`department` = ? ", requestData.DeaprtId) |
||||
|
} |
||||
|
case "4": |
||||
|
if requestData.Group != "" { |
||||
|
gormDb = gormDb.Where("`group` = ? ", requestData.Group) |
||||
|
} |
||||
|
if requestData.DeaprtId != "" { |
||||
|
gormDb = gormDb.Where("`department` = ? ", requestData.DeaprtId) |
||||
|
} |
||||
|
default: |
||||
|
// gormDb = gormDb.Where("`group` = ? AND `department` = ?", userCont.Company, userCont.Deparment)
|
||||
|
} |
||||
|
if requestData.Group != "" { |
||||
|
gormDb = gormDb.Where("`group` = ? ", requestData.Group) |
||||
|
} |
||||
|
if requestData.DeaprtId != "" { |
||||
|
gormDb = gormDb.Where("`department` = ? ", requestData.DeaprtId) |
||||
|
} |
||||
|
err := gormDb.Find(&planVersioCont).Error |
||||
|
if err != nil { |
||||
|
response.Result(102, err, "没有查询到数据", c) |
||||
|
return |
||||
|
} |
||||
|
// yserInt, _ := strconv.ParseInt(requestData.Year, 10, 64)
|
||||
|
// var outData []TargetContOutCont
|
||||
|
var xieCheng dataLockStatistics |
||||
|
for _, v := range planVersioCont { //版本列表
|
||||
|
syncProcess.Add(1) |
||||
|
go xieCheng.planVersiconProcess(v, requestData) |
||||
|
// return
|
||||
|
} |
||||
|
syncProcess.Wait() |
||||
|
readDingXingDataMap := xieCheng.readMyDayData() |
||||
|
// var outList []TargetContOutCont
|
||||
|
// mapstructure.Decode(readDingXingDataMap, &outList)
|
||||
|
response.Result(0, readDingXingDataMap, "获取成功", c) |
||||
|
} |
||||
|
|
||||
|
func (d *dataLockStatistics) planVersiconProcess(pvInfo assessmentmodel.PlanVersio, giveData DutyPlanVersio) { |
||||
|
d.mutext.Lock() |
||||
|
defer d.mutext.Unlock() |
||||
|
yserInt, _ := strconv.ParseInt(giveData.Year, 10, 64) |
||||
|
// fmt.Printf("年--2-->%v--->%v\n", giveData.Year, yserInt)
|
||||
|
if pvInfo.Content != "" { |
||||
|
//当版本内容不为空时
|
||||
|
var planInfo []AddDutyNewCont |
||||
|
jsonErr := json.Unmarshal([]byte(pvInfo.Content), &planInfo) |
||||
|
if jsonErr == nil { |
||||
|
//进行维度操作
|
||||
|
for _, pv := range planInfo { |
||||
|
for _, pcv := range pv.Child { //指标列表
|
||||
|
|
||||
|
if pcv.Status != 2 { //忽略掉禁用的指标
|
||||
|
var outCont TargetContOutCont |
||||
|
outCont.Id = strconv.FormatInt(pvInfo.Id, 10) |
||||
|
//集团信息
|
||||
|
outCont.Group = strconv.FormatInt(pvInfo.Group, 10) |
||||
|
where := commonus.MapOut() |
||||
|
where["id"] = pvInfo.Group |
||||
|
orgCont, _ := commonus.GetNewOrgCont(where, "id", "name") |
||||
|
outCont.GroupName = orgCont.Name |
||||
|
//接受考核部门
|
||||
|
outCont.DepartmentId = strconv.FormatInt(pvInfo.Department, 10) |
||||
|
whereDepart := commonus.MapOut() |
||||
|
whereDepart["id"] = pvInfo.Department |
||||
|
orgContDer, _ := commonus.GetNewOrgCont(whereDepart, "id", "name") |
||||
|
outCont.DepartmentName = orgContDer.Name |
||||
|
//维度信息
|
||||
|
outCont.Dimension = pv.Id |
||||
|
outCont.DimensionName = pv.Name |
||||
|
outCont.DimensionWeight = int64(pv.ZhiFraction) |
||||
|
//指标信息
|
||||
|
outCont.Target = pcv.Id |
||||
|
outCont.TargetName = pcv.Name |
||||
|
outCont.TargetCont = pcv.Content |
||||
|
outCont.TargetWeight = pcv.ReferenceScore |
||||
|
outCont.Unit = pcv.Unit |
||||
|
//获取指标内容
|
||||
|
var evalTargerCont assessmentmodel.EvaluationTarget |
||||
|
evalErr := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.EvaluationTarget{}).Select("et_type,et_scoring_method").Where("`et_id` = ?", pcv.Id).First(&evalTargerCont).Error |
||||
|
scoringMethod := 1 |
||||
|
if evalErr == nil { |
||||
|
outCont.Type = evalTargerCont.Type |
||||
|
scoringMethod = evalTargerCont.ScoringMethod |
||||
|
} |
||||
|
//获取执行部门及指标性质
|
||||
|
taskId, _, departName, cycle, cycleattr, isDuty, isDutyErr := getDepartTarget(pvInfo.Key, pv.Id, pcv.Id, strconv.FormatInt(pvInfo.Group, 10), strconv.FormatInt(pvInfo.Department, 10)) |
||||
|
if isDutyErr == nil { |
||||
|
outCont.ExecutiveDepartment = departName |
||||
|
outCont.Cycles = cycle |
||||
|
outCont.CycleAttres = cycleattr |
||||
|
if isDuty != 0 { |
||||
|
outCont.Type = isDuty |
||||
|
} |
||||
|
} else { |
||||
|
isDuty = 2 |
||||
|
} |
||||
|
var stccStatistics ScoreListAry |
||||
|
stccStatistics.Class = isDuty |
||||
|
if isDuty == 1 { |
||||
|
//定性考核
|
||||
|
switch cycle { |
||||
|
case 1: |
||||
|
case 2: //天
|
||||
|
case 3: |
||||
|
case 5: //季度
|
||||
|
// monthValue := commonus.TimeStampToDate(time.Now().Unix(), 12)
|
||||
|
// if commonus.TimeStampToDate(time.Now().Unix(), 11) != giveData.Year {
|
||||
|
// monthValue = "12"
|
||||
|
// }
|
||||
|
// monthValueInt, _ := strconv.Atoi(monthValue)
|
||||
|
var tpsProcess tablePlanVersionStic |
||||
|
for i := 1; i <= 4; i++ { |
||||
|
wherStr := fmt.Sprintf("`sf_evaluation_plan` = %v AND `sf_duty_group` = %v AND `sf_duty_department` = %v AND `sf_year` = %v AND `sf_quarter` = %v", taskId, pvInfo.Group, pvInfo.Department, yserInt, i) |
||||
|
// wherStr := fmt.Sprintf("`sf_evaluation_plan` = %v AND `sf_duty_group` = %v AND `sf_duty_department` = %v AND `sf_year` = %v AND `sf_month` = %v", taskId, pvInfo.Group, pvInfo.Department, yserInt, i)
|
||||
|
syncProcessDepartTarget.Add(1) |
||||
|
go tpsProcess.SubjectiveAuxiliaryCalculationSumMethod(wherStr, i, pcv.Status, 1, pcv.ReferenceScore) |
||||
|
} |
||||
|
syncProcessDepartTarget.Wait() |
||||
|
readStatisticsData := tpsProcess.readMyDayData() |
||||
|
//按照最大值排序
|
||||
|
sort.Slice(readStatisticsData, func(i int, j int) bool { |
||||
|
return readStatisticsData[i].Counter < readStatisticsData[j].Counter |
||||
|
}) |
||||
|
for _, rsdv := range readStatisticsData { |
||||
|
|
||||
|
for ik := 0; ik <= 1; ik++ { |
||||
|
var jiSuanZhiBuLing ScoreList |
||||
|
outCont.Score = append(outCont.Score, jiSuanZhiBuLing) |
||||
|
stccStatistics.ScoreVal = append(stccStatistics.ScoreVal, 0) |
||||
|
stccStatistics.AllPrize = append(stccStatistics.AllPrize, 0) |
||||
|
stccStatistics.ZeroPrize = append(stccStatistics.ZeroPrize, 0) |
||||
|
stccStatistics.CappingVal = append(stccStatistics.CappingVal, 0) |
||||
|
stccStatistics.ActualScore = append(stccStatistics.ActualScore, 0) |
||||
|
stccStatistics.Achievement = append(stccStatistics.Achievement, 0) |
||||
|
} |
||||
|
|
||||
|
var jiSuanZhi ScoreList |
||||
|
jiSuanZhi.Class = rsdv.Class |
||||
|
jiSuanZhi.ScoreVal = rsdv.ScoreVal |
||||
|
jiSuanZhi.ActualScore = rsdv.ActualScore |
||||
|
jiSuanZhi.AllPrize = rsdv.AllPrize |
||||
|
jiSuanZhi.ZeroPrize = rsdv.ZeroPrize |
||||
|
jiSuanZhi.CappingVal = rsdv.CappingVal |
||||
|
jiSuanZhi.Achievement = rsdv.Achievement |
||||
|
|
||||
|
outCont.Score = append(outCont.Score, jiSuanZhi) |
||||
|
if len(rsdv.ExecutiveDepartment) > 0 { //写入执行考核的部门
|
||||
|
for _, edv := range rsdv.ExecutiveDepartment { |
||||
|
if commonus.IsItTrueString(edv, outCont.ExecutiveDepartment) == false { |
||||
|
outCont.ExecutiveDepartment = append(outCont.ExecutiveDepartment, edv) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
stccStatistics.ScoreVal = append(stccStatistics.ScoreVal, rsdv.ScoreVal) |
||||
|
stccStatistics.AllPrize = append(stccStatistics.AllPrize, rsdv.AllPrize) |
||||
|
stccStatistics.ZeroPrize = append(stccStatistics.ZeroPrize, rsdv.ZeroPrize) |
||||
|
stccStatistics.CappingVal = append(stccStatistics.CappingVal, rsdv.CappingVal) |
||||
|
stccStatistics.ActualScore = append(stccStatistics.ActualScore, rsdv.ActualScore) |
||||
|
stccStatistics.Achievement = append(stccStatistics.Achievement, rsdv.Achievement) |
||||
|
} |
||||
|
case 6: //年
|
||||
|
monthValue := commonus.TimeStampToDate(time.Now().Unix(), 12) |
||||
|
if commonus.TimeStampToDate(time.Now().Unix(), 11) != giveData.Year { |
||||
|
monthValue = "12" |
||||
|
} |
||||
|
monthValueInt, _ := strconv.Atoi(monthValue) |
||||
|
var tpsProcess tablePlanVersionStic |
||||
|
for i := 1; i <= monthValueInt; i++ { |
||||
|
wherStr := fmt.Sprintf("`sf_evaluation_plan` = %v AND `sf_duty_group` = %v AND `sf_duty_department` = %v AND `sf_year` = %v AND `sf_month` = %v", taskId, pvInfo.Group, pvInfo.Department, yserInt, i) |
||||
|
syncProcessDepartTarget.Add(1) |
||||
|
go tpsProcess.SubjectiveAuxiliaryCalculationSumMethod(wherStr, i, pcv.Status, 1, pcv.ReferenceScore) |
||||
|
} |
||||
|
syncProcessDepartTarget.Wait() |
||||
|
readStatisticsData := tpsProcess.readMyDayData() |
||||
|
//按照最大值排序
|
||||
|
sort.Slice(readStatisticsData, func(i int, j int) bool { |
||||
|
return readStatisticsData[i].Counter < readStatisticsData[j].Counter |
||||
|
}) |
||||
|
for _, rsdv := range readStatisticsData { |
||||
|
var jiSuanZhi ScoreList |
||||
|
jiSuanZhi.Class = rsdv.Class |
||||
|
jiSuanZhi.ScoreVal = rsdv.ScoreVal |
||||
|
jiSuanZhi.ActualScore = rsdv.ActualScore |
||||
|
jiSuanZhi.AllPrize = rsdv.AllPrize |
||||
|
jiSuanZhi.ZeroPrize = rsdv.ZeroPrize |
||||
|
jiSuanZhi.CappingVal = rsdv.CappingVal |
||||
|
jiSuanZhi.Achievement = rsdv.Achievement |
||||
|
|
||||
|
outCont.Score = append(outCont.Score, jiSuanZhi) |
||||
|
if len(rsdv.ExecutiveDepartment) > 0 { //写入执行考核的部门
|
||||
|
for _, edv := range rsdv.ExecutiveDepartment { |
||||
|
if commonus.IsItTrueString(edv, outCont.ExecutiveDepartment) == false { |
||||
|
outCont.ExecutiveDepartment = append(outCont.ExecutiveDepartment, edv) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
stccStatistics.ScoreVal = append(stccStatistics.ScoreVal, rsdv.ScoreVal) |
||||
|
stccStatistics.AllPrize = append(stccStatistics.AllPrize, rsdv.AllPrize) |
||||
|
stccStatistics.ZeroPrize = append(stccStatistics.ZeroPrize, rsdv.ZeroPrize) |
||||
|
stccStatistics.CappingVal = append(stccStatistics.CappingVal, rsdv.CappingVal) |
||||
|
stccStatistics.ActualScore = append(stccStatistics.ActualScore, rsdv.ActualScore) |
||||
|
stccStatistics.Achievement = append(stccStatistics.Achievement, rsdv.Achievement) |
||||
|
} |
||||
|
default: //月
|
||||
|
monthValue := commonus.TimeStampToDate(time.Now().Unix(), 12) |
||||
|
if commonus.TimeStampToDate(time.Now().Unix(), 11) != giveData.Year { |
||||
|
monthValue = "12" |
||||
|
} |
||||
|
monthValueInt, _ := strconv.Atoi(monthValue) |
||||
|
var tpsProcess tablePlanVersionStic |
||||
|
for i := 1; i <= monthValueInt; i++ { |
||||
|
wherStr := fmt.Sprintf("`sf_evaluation_plan` = %v AND `sf_duty_group` = %v AND `sf_duty_department` = %v AND `sf_year` = %v AND `sf_month` = %v", taskId, pvInfo.Group, pvInfo.Department, yserInt, i) |
||||
|
syncProcessDepartTarget.Add(1) |
||||
|
go tpsProcess.SubjectiveAuxiliaryCalculationSumMethod(wherStr, i, pcv.Status, 1, pcv.ReferenceScore) |
||||
|
} |
||||
|
syncProcessDepartTarget.Wait() |
||||
|
readStatisticsData := tpsProcess.readMyDayData() |
||||
|
//按照最大值排序
|
||||
|
sort.Slice(readStatisticsData, func(i int, j int) bool { |
||||
|
return readStatisticsData[i].Counter < readStatisticsData[j].Counter |
||||
|
}) |
||||
|
for _, rsdv := range readStatisticsData { |
||||
|
var jiSuanZhi ScoreList |
||||
|
jiSuanZhi.Class = rsdv.Class |
||||
|
jiSuanZhi.ScoreVal = rsdv.ScoreVal |
||||
|
jiSuanZhi.ActualScore = rsdv.ActualScore |
||||
|
jiSuanZhi.AllPrize = rsdv.AllPrize |
||||
|
jiSuanZhi.ZeroPrize = rsdv.ZeroPrize |
||||
|
jiSuanZhi.CappingVal = rsdv.CappingVal |
||||
|
jiSuanZhi.Achievement = rsdv.Achievement |
||||
|
|
||||
|
outCont.Score = append(outCont.Score, jiSuanZhi) |
||||
|
if len(rsdv.ExecutiveDepartment) > 0 { //写入执行考核的部门
|
||||
|
for _, edv := range rsdv.ExecutiveDepartment { |
||||
|
if commonus.IsItTrueString(edv, outCont.ExecutiveDepartment) == false { |
||||
|
outCont.ExecutiveDepartment = append(outCont.ExecutiveDepartment, edv) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
stccStatistics.ScoreVal = append(stccStatistics.ScoreVal, rsdv.ScoreVal) |
||||
|
stccStatistics.AllPrize = append(stccStatistics.AllPrize, rsdv.AllPrize) |
||||
|
stccStatistics.ZeroPrize = append(stccStatistics.ZeroPrize, rsdv.ZeroPrize) |
||||
|
stccStatistics.CappingVal = append(stccStatistics.CappingVal, rsdv.CappingVal) |
||||
|
stccStatistics.ActualScore = append(stccStatistics.ActualScore, rsdv.ActualScore) |
||||
|
stccStatistics.Achievement = append(stccStatistics.Achievement, rsdv.Achievement) |
||||
|
} |
||||
|
} |
||||
|
} else { |
||||
|
//定量考核
|
||||
|
switch cycle { |
||||
|
case 1: |
||||
|
case 2: //天
|
||||
|
case 3: |
||||
|
case 5: //季度
|
||||
|
// monthValue := commonus.TimeStampToDate(time.Now().Unix(), 12)
|
||||
|
// if commonus.TimeStampToDate(time.Now().Unix(), 11) != giveData.Year {
|
||||
|
// monthValue = "12"
|
||||
|
// }
|
||||
|
// monthValueInt, _ := strconv.Atoi(monthValue)
|
||||
|
var tpsProcess tablePlanVersionStic |
||||
|
for i := 1; i <= 4; i++ { |
||||
|
|
||||
|
// fmt.Printf("年--4-->%v--->%v-->%v\n", i, giveData.Year, yserInt)
|
||||
|
wherStr := fmt.Sprintf("fld_evaluation_id = %v AND `fl_year` = %v AND `fl_duty_group` = %v AND `fl_duty_department` = %v AND `fl_quarter` = %v", taskId, yserInt, pvInfo.Group, pvInfo.Department, i) |
||||
|
// wherStr := fmt.Sprintf("fld_evaluation_id = %v AND `fl_year` = %v AND `fl_duty_group` = %v AND `fl_duty_department` = %v AND `fl_month` = %v", taskId, yserInt, pvInfo.Group, pvInfo.Department, i)
|
||||
|
syncProcessDepartTarget.Add(1) |
||||
|
go tpsProcess.conditionStatistics(wherStr, strconv.FormatInt(pvInfo.Group, 10), strconv.FormatInt(pvInfo.Department, 10), pv.Id, pcv.Id, i, pcv.Status, scoringMethod, 2, yserInt, pcv.ReferenceScore) |
||||
|
} |
||||
|
|
||||
|
/* |
||||
|
统计分数 |
||||
|
@wherStr 统计条件 |
||||
|
@group 集团 |
||||
|
@department 部门 |
||||
|
@dimensionId 维度 |
||||
|
@targetId 指标 |
||||
|
@i 步进器 |
||||
|
@status 是否为观察数据 |
||||
|
@scoringMethod 手动计分还是自动计分 |
||||
|
@class 指标类型 1、定性;2:定量 |
||||
|
@referenceScore 指标权重 |
||||
|
@yserInt 年度 |
||||
|
*/ |
||||
|
syncProcessDepartTarget.Wait() |
||||
|
readStatisticsData := tpsProcess.readMyDayData() |
||||
|
//按照最大值排序
|
||||
|
sort.Slice(readStatisticsData, func(i int, j int) bool { |
||||
|
return readStatisticsData[i].Counter < readStatisticsData[j].Counter |
||||
|
}) |
||||
|
// jsonVal, jsonErr := json.Marshal(readStatisticsData)
|
||||
|
// fmt.Printf("排序------%v--------》%v--------》%v\n", pvInfo.Id, string(jsonVal), jsonErr)
|
||||
|
|
||||
|
for _, rsdv := range readStatisticsData { |
||||
|
for ik := 0; ik <= 1; ik++ { |
||||
|
var jiSuanZhiBuLing ScoreList |
||||
|
outCont.Score = append(outCont.Score, jiSuanZhiBuLing) |
||||
|
stccStatistics.ScoreVal = append(stccStatistics.ScoreVal, 0) |
||||
|
stccStatistics.AllPrize = append(stccStatistics.AllPrize, 0) |
||||
|
stccStatistics.ZeroPrize = append(stccStatistics.ZeroPrize, 0) |
||||
|
stccStatistics.CappingVal = append(stccStatistics.CappingVal, 0) |
||||
|
stccStatistics.ActualScore = append(stccStatistics.ActualScore, 0) |
||||
|
stccStatistics.Achievement = append(stccStatistics.Achievement, 0) |
||||
|
} |
||||
|
var jiSuanZhi ScoreList |
||||
|
jiSuanZhi.Class = rsdv.Class |
||||
|
jiSuanZhi.ScoreVal = rsdv.ScoreVal |
||||
|
jiSuanZhi.ActualScore = rsdv.ActualScore |
||||
|
jiSuanZhi.AllPrize = rsdv.AllPrize |
||||
|
jiSuanZhi.ZeroPrize = rsdv.ZeroPrize |
||||
|
jiSuanZhi.CappingVal = rsdv.CappingVal |
||||
|
jiSuanZhi.Achievement = rsdv.Achievement |
||||
|
|
||||
|
outCont.Score = append(outCont.Score, jiSuanZhi) |
||||
|
if len(rsdv.ExecutiveDepartment) > 0 { //写入执行考核的部门
|
||||
|
for _, edv := range rsdv.ExecutiveDepartment { |
||||
|
if commonus.IsItTrueString(edv, outCont.ExecutiveDepartment) == false { |
||||
|
outCont.ExecutiveDepartment = append(outCont.ExecutiveDepartment, edv) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
stccStatistics.ScoreVal = append(stccStatistics.ScoreVal, rsdv.ScoreVal) |
||||
|
stccStatistics.AllPrize = append(stccStatistics.AllPrize, rsdv.AllPrize) |
||||
|
stccStatistics.ZeroPrize = append(stccStatistics.ZeroPrize, rsdv.ZeroPrize) |
||||
|
stccStatistics.CappingVal = append(stccStatistics.CappingVal, rsdv.CappingVal) |
||||
|
stccStatistics.ActualScore = append(stccStatistics.ActualScore, rsdv.ActualScore) |
||||
|
stccStatistics.Achievement = append(stccStatistics.Achievement, rsdv.Achievement) |
||||
|
} |
||||
|
case 6: //年
|
||||
|
monthValue := commonus.TimeStampToDate(time.Now().Unix(), 12) |
||||
|
if commonus.TimeStampToDate(time.Now().Unix(), 11) != giveData.Year { |
||||
|
monthValue = "12" |
||||
|
} |
||||
|
monthValueInt, _ := strconv.Atoi(monthValue) |
||||
|
var tpsProcess tablePlanVersionStic |
||||
|
for i := 1; i <= monthValueInt; i++ { |
||||
|
// fmt.Printf("年--5-->%v--->%v-->%v\n", i, giveData.Year, yserInt)
|
||||
|
wherStr := fmt.Sprintf("fld_evaluation_id = %v AND `fl_year` = %v AND `fl_duty_group` = %v AND `fl_duty_department` = %v AND `fl_month` = %v", taskId, yserInt, pvInfo.Group, pvInfo.Department, i) |
||||
|
syncProcessDepartTarget.Add(1) |
||||
|
go tpsProcess.conditionStatistics(wherStr, strconv.FormatInt(pvInfo.Group, 10), strconv.FormatInt(pvInfo.Department, 10), pv.Id, pcv.Id, i, pcv.Status, scoringMethod, 2, yserInt, pcv.ReferenceScore) |
||||
|
} |
||||
|
syncProcessDepartTarget.Wait() |
||||
|
readStatisticsData := tpsProcess.readMyDayData() |
||||
|
//按照最大值排序
|
||||
|
sort.Slice(readStatisticsData, func(i int, j int) bool { |
||||
|
return readStatisticsData[i].Counter < readStatisticsData[j].Counter |
||||
|
}) |
||||
|
// jsonVal, jsonErr := json.Marshal(readStatisticsData)
|
||||
|
// fmt.Printf("排序------%v--------》%v--------》%v\n", pvInfo.Id, string(jsonVal), jsonErr)
|
||||
|
|
||||
|
for _, rsdv := range readStatisticsData { |
||||
|
var jiSuanZhi ScoreList |
||||
|
jiSuanZhi.Class = rsdv.Class |
||||
|
jiSuanZhi.ScoreVal = rsdv.ScoreVal |
||||
|
jiSuanZhi.ActualScore = rsdv.ActualScore |
||||
|
jiSuanZhi.AllPrize = rsdv.AllPrize |
||||
|
jiSuanZhi.ZeroPrize = rsdv.ZeroPrize |
||||
|
jiSuanZhi.CappingVal = rsdv.CappingVal |
||||
|
jiSuanZhi.Achievement = rsdv.Achievement |
||||
|
|
||||
|
outCont.Score = append(outCont.Score, jiSuanZhi) |
||||
|
if len(rsdv.ExecutiveDepartment) > 0 { //写入执行考核的部门
|
||||
|
for _, edv := range rsdv.ExecutiveDepartment { |
||||
|
if commonus.IsItTrueString(edv, outCont.ExecutiveDepartment) == false { |
||||
|
outCont.ExecutiveDepartment = append(outCont.ExecutiveDepartment, edv) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
stccStatistics.ScoreVal = append(stccStatistics.ScoreVal, rsdv.ScoreVal) |
||||
|
stccStatistics.AllPrize = append(stccStatistics.AllPrize, rsdv.AllPrize) |
||||
|
stccStatistics.ZeroPrize = append(stccStatistics.ZeroPrize, rsdv.ZeroPrize) |
||||
|
stccStatistics.CappingVal = append(stccStatistics.CappingVal, rsdv.CappingVal) |
||||
|
stccStatistics.ActualScore = append(stccStatistics.ActualScore, rsdv.ActualScore) |
||||
|
stccStatistics.Achievement = append(stccStatistics.Achievement, rsdv.Achievement) |
||||
|
} |
||||
|
default: //月
|
||||
|
monthValue := commonus.TimeStampToDate(time.Now().Unix(), 12) |
||||
|
if commonus.TimeStampToDate(time.Now().Unix(), 11) != giveData.Year { |
||||
|
monthValue = "12" |
||||
|
} |
||||
|
monthValueInt, _ := strconv.Atoi(monthValue) |
||||
|
var tpsProcess tablePlanVersionStic |
||||
|
for i := 1; i <= monthValueInt; i++ { |
||||
|
// fmt.Printf("年--6-->%v--->%v-->%v\n", i, giveData.Year, yserInt)
|
||||
|
wherStr := fmt.Sprintf("fld_evaluation_id = %v AND `fl_year` = %v AND `fl_duty_group` = %v AND `fl_duty_department` = %v AND `fl_month` = %v", taskId, yserInt, pvInfo.Group, pvInfo.Department, i) |
||||
|
syncProcessDepartTarget.Add(1) |
||||
|
go tpsProcess.conditionStatistics(wherStr, strconv.FormatInt(pvInfo.Group, 10), strconv.FormatInt(pvInfo.Department, 10), pv.Id, pcv.Id, i, pcv.Status, scoringMethod, 2, yserInt, pcv.ReferenceScore) |
||||
|
} |
||||
|
syncProcessDepartTarget.Wait() |
||||
|
readStatisticsData := tpsProcess.readMyDayData() |
||||
|
//按照最大值排序
|
||||
|
sort.Slice(readStatisticsData, func(i int, j int) bool { |
||||
|
return readStatisticsData[i].Counter < readStatisticsData[j].Counter |
||||
|
}) |
||||
|
// jsonVal, jsonErr := json.Marshal(readStatisticsData)
|
||||
|
// fmt.Printf("排序------%v--------》%v--------》%v\n", pvInfo.Id, string(jsonVal), jsonErr)
|
||||
|
|
||||
|
for _, rsdv := range readStatisticsData { |
||||
|
var jiSuanZhi ScoreList |
||||
|
jiSuanZhi.Class = rsdv.Class |
||||
|
jiSuanZhi.ScoreVal = rsdv.ScoreVal |
||||
|
jiSuanZhi.ActualScore = rsdv.ActualScore |
||||
|
jiSuanZhi.AllPrize = rsdv.AllPrize |
||||
|
jiSuanZhi.ZeroPrize = rsdv.ZeroPrize |
||||
|
jiSuanZhi.CappingVal = rsdv.CappingVal |
||||
|
jiSuanZhi.Achievement = rsdv.Achievement |
||||
|
|
||||
|
outCont.Score = append(outCont.Score, jiSuanZhi) |
||||
|
if len(rsdv.ExecutiveDepartment) > 0 { //写入执行考核的部门
|
||||
|
for _, edv := range rsdv.ExecutiveDepartment { |
||||
|
if commonus.IsItTrueString(edv, outCont.ExecutiveDepartment) == false { |
||||
|
outCont.ExecutiveDepartment = append(outCont.ExecutiveDepartment, edv) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
stccStatistics.ScoreVal = append(stccStatistics.ScoreVal, rsdv.ScoreVal) |
||||
|
stccStatistics.AllPrize = append(stccStatistics.AllPrize, rsdv.AllPrize) |
||||
|
stccStatistics.ZeroPrize = append(stccStatistics.ZeroPrize, rsdv.ZeroPrize) |
||||
|
stccStatistics.CappingVal = append(stccStatistics.CappingVal, rsdv.CappingVal) |
||||
|
stccStatistics.ActualScore = append(stccStatistics.ActualScore, rsdv.ActualScore) |
||||
|
stccStatistics.Achievement = append(stccStatistics.Achievement, rsdv.Achievement) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
outCont.ScoreAllList = append(outCont.ScoreAllList, stccStatistics) |
||||
|
outCont.StatisticsName = []string{"全奖值", "零奖值", "实际值", "达成率", "得分"} |
||||
|
d.outData = append(d.outData, outCont) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} else { |
||||
|
//当版本内容为空时
|
||||
|
} |
||||
|
syncProcess.Done() |
||||
|
} |
||||
|
|
||||
|
/* |
||||
|
统计分数 |
||||
|
@wherStr 统计条件 |
||||
|
@group 集团 |
||||
|
@department 部门 |
||||
|
@dimensionId 维度 |
||||
|
@targetId 指标 |
||||
|
@i 步进器 |
||||
|
@status 是否为观察数据 |
||||
|
@scoringMethod 手动计分还是自动计分 |
||||
|
@class 指标类型 1、定性;2:定量 |
||||
|
@referenceScore 指标权重 |
||||
|
@yserInt 年度 |
||||
|
*/ |
||||
|
func (t *tablePlanVersionStic) conditionStatistics(wherStr, group, department, dimensionId, targetId string, i, status, scoringMethod, class int, yserInt, referenceScore int64) { |
||||
|
t.mutext.Lock() |
||||
|
defer t.mutext.Unlock() |
||||
|
// fmt.Printf("年--3-4->%v--->%v--->%v--->%v--->%v--->%v--->%v--->%v--->%v--->%v--->%v\n", wherStr, group, department, dimensionId, targetId, i, status, scoringMethod, class, yserInt, referenceScore)
|
||||
|
var tableScoreCont TableScoreList |
||||
|
tableScoreCont.Counter = i |
||||
|
var sumScore float64 |
||||
|
var departmentAry []int64 //部门ID
|
||||
|
if scoringMethod == 2 { |
||||
|
gormDb := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.FlowLogData{}).Joins("left join flow_log as fl on fl.fl_key = flow_log_data.fld_flow_log").Where(wherStr) |
||||
|
gormDb.Pluck("COALESCE(SUM(fld_scoring_score), 0) as rescore", &sumScore) |
||||
|
} else { |
||||
|
gormDb := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.FlowLogData{}).Joins("left join flow_log as fl on fl.fl_key = flow_log_data.fld_flow_log").Where(wherStr) |
||||
|
gormDb.Pluck("COALESCE(SUM(fld_score), 0) as rescore", &sumScore) |
||||
|
} |
||||
|
|
||||
|
// fmt.Printf("计算得分--3-->%v--->%v-->%v--->%v\n", scoringMethod, wherStr, i, sumScore)
|
||||
|
|
||||
|
//获取测评部门
|
||||
|
global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.FlowLogData{}).Select("fl_evaluation_department").Joins("left join flow_log as fl on fl.fl_key = flow_log_data.fld_flow_log").Where(wherStr).Find(&departmentAry) |
||||
|
if len(departmentAry) > 0 { |
||||
|
for _, v := range departmentAry { |
||||
|
whereDepart := commonus.MapOut() |
||||
|
whereDepart["id"] = v |
||||
|
orgContDer, _ := commonus.GetNewOrgCont(whereDepart, "name") |
||||
|
tableScoreCont.ExecutiveDepartment = append(tableScoreCont.ExecutiveDepartment, orgContDer.Name) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// fmt.Printf("年--3-->%v--->%v\n", wherStr, yserInt)
|
||||
|
//组装数据
|
||||
|
resultData := commonus.Decimal(sumScore / 100) |
||||
|
tableScoreCont.Class = class |
||||
|
tableScoreCont.ScoreVal = resultData |
||||
|
if status != 3 { |
||||
|
tableScoreCont.ActualScore, tableScoreCont.AllPrize, tableScoreCont.ZeroPrize, tableScoreCont.CappingVal, tableScoreCont.Achievement = quantification.GetQuantitativeConfig(referenceScore, resultData, group, department, dimensionId, targetId, "0", yserInt, i) |
||||
|
|
||||
|
t.TableScore = append(t.TableScore, tableScoreCont) |
||||
|
} else { |
||||
|
tableScoreCont.ActualScore = float64(referenceScore) |
||||
|
tableScoreCont.AllPrize, tableScoreCont.ZeroPrize, tableScoreCont.CappingVal, tableScoreCont.Achievement = quantification.GetQuantitativeConfigEs(resultData, group, department, dimensionId, targetId, "0", yserInt, i) |
||||
|
t.TableScore = append(t.TableScore, tableScoreCont) |
||||
|
} |
||||
|
syncProcessDepartTarget.Done() |
||||
|
} |
||||
|
|
||||
|
//定性
|
||||
|
/* |
||||
|
统计分数 |
||||
|
@wherStr 统计条件 |
||||
|
@i 步进器 |
||||
|
@status 是否为观察数据 |
||||
|
@class 指标类型 1、定性;2:定量 |
||||
|
@referenceScore 指标权重 |
||||
|
*/ |
||||
|
func (t *tablePlanVersionStic) SubjectiveAuxiliaryCalculationSumMethod(wherStr string, i, status, class int, referenceScore int64) { |
||||
|
t.mutext.Lock() |
||||
|
defer t.mutext.Unlock() |
||||
|
var tableScoreCont TableScoreList |
||||
|
tableScoreCont.Counter = i |
||||
|
var sumScore float64 |
||||
|
var departmentAry []int64 //部门ID
|
||||
|
//加分
|
||||
|
var addSumScore float64 = 0 |
||||
|
global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.ScoreFlow{}).Select("sf_score").Where(wherStr).Where("sf_plus_reduce_score = 1").Pluck("COALESCE(SUM(sf_score), 0) as addrescore", &addSumScore) |
||||
|
//加分
|
||||
|
var scoreReduction float64 = 0 |
||||
|
global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.ScoreFlow{}).Select("sf_score").Where(wherStr).Where("sf_plus_reduce_score = 2").Pluck("COALESCE(SUM(sf_score), 0) as redurescore", &scoreReduction) |
||||
|
if addSumScore != 0 && scoreReduction != 0 { |
||||
|
if addSumScore > scoreReduction { |
||||
|
sumScore = addSumScore - scoreReduction |
||||
|
} else { |
||||
|
sumScore = scoreReduction - addSumScore |
||||
|
} |
||||
|
} else if addSumScore != 0 { |
||||
|
sumScore = addSumScore |
||||
|
} else { |
||||
|
sumScore = scoreReduction |
||||
|
} |
||||
|
//获取测评部门
|
||||
|
global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.ScoreFlow{}).Select("sf_evaluation_department").Where(wherStr).Find(&departmentAry) |
||||
|
if len(departmentAry) > 0 { |
||||
|
for _, v := range departmentAry { |
||||
|
whereDepart := commonus.MapOut() |
||||
|
whereDepart["id"] = v |
||||
|
orgContDer, _ := commonus.GetNewOrgCont(whereDepart, "name") |
||||
|
tableScoreCont.ExecutiveDepartment = append(tableScoreCont.ExecutiveDepartment, orgContDer.Name) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
resultData := commonus.Decimal(sumScore / 100) |
||||
|
if resultData > float64(referenceScore) { |
||||
|
resultData = float64(referenceScore) |
||||
|
} |
||||
|
|
||||
|
//组装数据
|
||||
|
// var jiSuanZhi ScoreList
|
||||
|
tableScoreCont.Class = class |
||||
|
tableScoreCont.AllPrize = 0 |
||||
|
tableScoreCont.ZeroPrize = 0 |
||||
|
tableScoreCont.CappingVal = 0 |
||||
|
tableScoreCont.ScoreVal = 0 |
||||
|
tableScoreCont.Achievement = 0 |
||||
|
if status != 3 { |
||||
|
tableScoreCont.ActualScore = resultData |
||||
|
} else { |
||||
|
tableScoreCont.ActualScore = float64(referenceScore) |
||||
|
} |
||||
|
t.TableScore = append(t.TableScore, tableScoreCont) |
||||
|
syncProcessDepartTarget.Done() |
||||
|
} |
||||
Loading…
Reference in new issue