Browse Source

修改工作流

v1_dev_2
超级管理员 2 years ago
parent
commit
67bb9dbf4d
  1. 361
      api/version1/departmentseting/departmentpc/dingliang.go
  2. 10
      api/workflow/workflowengine/flowhandle.go

361
api/version1/departmentseting/departmentpc/dingliang.go

@ -77,198 +77,203 @@ func (a *ApiMethod) GetQuantitativeTasks(c *gin.Context) {
publicmethod.Result(1, qualEvaList, c, "您没有要参加的考核项目!") publicmethod.Result(1, qualEvaList, c, "您没有要参加的考核项目!")
return return
} }
var idInAry []int64
var sendListCont []TargetContOutCont var sendListCont []TargetContOutCont
for _, vsss := range qualEvaList { for _, vsss := range qualEvaList {
var v modelskpi.QualitativeEvaluation var v modelskpi.QualitativeEvaluation
v.GetCont(map[string]interface{}{"`qe_accept_evaluation`": vsss.AcceptEvaluation, "`qe_target`": vsss.Target, "`qe_state`": 1}) v.GetCont(map[string]interface{}{"`qe_accept_evaluation`": vsss.AcceptEvaluation, "`qe_target`": vsss.Target, "`qe_state`": 1})
var sendCont TargetContOutCont
sendCont.Id = strconv.FormatInt(v.Id, 10) if !publicmethod.IsInTrue[int64](v.Id, idInAry) {
sendCont.Type = v.Type idInAry = append(idInAry, v.Id)
sendCont.Group = strconv.FormatInt(v.Group, 10) var sendCont TargetContOutCont
//公司 sendCont.Id = strconv.FormatInt(v.Id, 10)
var groupCont modelshr.AdministrativeOrganization sendCont.Type = v.Type
groupCont.GetCont(map[string]interface{}{"`id`": v.Group}, "`name`") sendCont.Group = strconv.FormatInt(v.Group, 10)
sendCont.GroupNAme = groupCont.Name //公司
//部门 var groupCont modelshr.AdministrativeOrganization
var departCont modelshr.AdministrativeOrganization groupCont.GetCont(map[string]interface{}{"`id`": v.Group}, "`name`")
departCont.GetCont(map[string]interface{}{"`id`": v.AcceptEvaluation}, "`name`") sendCont.GroupNAme = groupCont.Name
sendCont.DepartmentName = departCont.Name //部门
sendCont.DepartmentId = strconv.FormatInt(v.AcceptEvaluation, 10) var departCont modelshr.AdministrativeOrganization
sendCont.PlanVersionNumber = v.QualEvalId //执行方案版本号 departCont.GetCont(map[string]interface{}{"`id`": v.AcceptEvaluation}, "`name`")
//维度相关信息 sendCont.DepartmentName = departCont.Name
sendCont.Dimension = strconv.FormatInt(v.Dimension, 10) sendCont.DepartmentId = strconv.FormatInt(v.AcceptEvaluation, 10)
var dimeCont modelskpi.DutyClass sendCont.PlanVersionNumber = v.QualEvalId //执行方案版本号
dimeCont.GetCont(map[string]interface{}{"`id`": v.Dimension}, "`title`") //维度相关信息
sendCont.DimensionName = dimeCont.Title sendCont.Dimension = strconv.FormatInt(v.Dimension, 10)
//指标信息 var dimeCont modelskpi.DutyClass
sendCont.Target = strconv.FormatInt(v.Target, 10) dimeCont.GetCont(map[string]interface{}{"`id`": v.Dimension}, "`title`")
var targetCont modelskpi.EvaluationTarget sendCont.DimensionName = dimeCont.Title
targetCont.GetCont(map[string]interface{}{"`et_id`": v.Target}, "`et_title`", "`et_scoring_method`") //指标信息
sendCont.TargetName = targetCont.Title sendCont.Target = strconv.FormatInt(v.Target, 10)
//子栏目 var targetCont modelskpi.EvaluationTarget
sendCont.ScoringMethod = int64(targetCont.ScoringMethod) targetCont.GetCont(map[string]interface{}{"`et_id`": v.Target}, "`et_title`", "`et_scoring_method`")
if v.TargetSun != 0 { sendCont.TargetName = targetCont.Title
sendCont.TargetSun = strconv.FormatInt(v.TargetSun, 10) //子栏目
var sunTargetCont modelskpi.QualitativeTarget sendCont.ScoringMethod = int64(targetCont.ScoringMethod)
sunTargetCont.GetCont(map[string]interface{}{"`q_id`": v.Target}, "`q_title`") if v.TargetSun != 0 {
sendCont.TargetSunName = sunTargetCont.Title sendCont.TargetSun = strconv.FormatInt(v.TargetSun, 10)
} var sunTargetCont modelskpi.QualitativeTarget
//指标细则 sunTargetCont.GetCont(map[string]interface{}{"`q_id`": v.Target}, "`q_title`")
if v.DetailedTarget != 0 { sendCont.TargetSunName = sunTargetCont.Title
sendCont.DetailedTarget = strconv.FormatInt(v.DetailedTarget, 10)
var detailedTargetCont modelskpi.DetailedTarget
detailedTargetCont.GetCont(map[string]interface{}{"`dt_id`": v.Target}, "`dt_title`", "`dt_content`")
sendCont.DetailedTargetName = detailedTargetCont.Title
sendCont.Content = detailedTargetCont.Content
}
sendCont.Unit = v.Unit
sendCont.ReferenceScore = v.ReferenceScore
sendCont.Cycles = v.Cycles
sendCont.CycleAttres = v.CycleAttres
sendCont.State = v.State
userAry := strings.Split(v.Operator, ",")
sendCont.UserList = userAry
for _, u_v := range userAry {
var repoCont modelshr.PersonArchives
repoErr := repoCont.GetCont(map[string]interface{}{"`key`": u_v}, "`number`", "`name`")
if repoErr == nil {
var userCont QualEvalArrt
userCont.Id = u_v
userCont.Name = repoCont.Name
sendCont.UserListAry = append(sendCont.UserListAry, userCont)
} }
} //指标细则
fmt.Printf("版本号吗!--->%v\n", v.QualEvalId) if v.DetailedTarget != 0 {
sendCont.DimensionWeight, sendCont.TargetWeight = getPlanVersionWeghit(v.QualEvalId, strconv.FormatInt(v.Dimension, 10), strconv.FormatInt(v.Target, 10)) sendCont.DetailedTarget = strconv.FormatInt(v.DetailedTarget, 10)
//获取目标设定 var detailedTargetCont modelskpi.DetailedTarget
quanTitWhere := publicmethod.MapOut[string]() detailedTargetCont.GetCont(map[string]interface{}{"`dt_id`": v.Target}, "`dt_title`", "`dt_content`")
// quanTitWhere["company_id"] = v.Group sendCont.DetailedTargetName = detailedTargetCont.Title
quanTitWhere["departmentid"] = v.AcceptEvaluation sendCont.Content = detailedTargetCont.Content
// quanTitWhere["dimension"] = v.Dimension }
quanTitWhere["target"] = v.Target sendCont.Unit = v.Unit
if v.DetailedTarget != 0 { sendCont.ReferenceScore = v.ReferenceScore
quanTitWhere["targetconfig"] = v.DetailedTarget sendCont.Cycles = v.Cycles
} sendCont.CycleAttres = v.CycleAttres
quanTitWhere["year"] = publicmethod.UnixTimeToDay(time.Now().Unix(), 16) sendCont.State = v.State
quanTitWhere["timecopy"] = AllZreoConfig(v.Cycles) userAry := strings.Split(v.Operator, ",")
//目标值设定 sendCont.UserList = userAry
var quanTitCont modelskpi.QuantitativeConfig for _, u_v := range userAry {
quanTitCont.GetCont(quanTitWhere) var repoCont modelshr.PersonArchives
//全奖值、零奖值、封顶值 repoErr := repoCont.GetCont(map[string]interface{}{"`key`": u_v}, "`number`", "`name`")
sendCont.ZeroPrize = strconv.FormatFloat(float64(quanTitCont.Zeroprize)/100, 'f', -1, 64) if repoErr == nil {
sendCont.AllPrize = strconv.FormatFloat(float64(quanTitCont.Allprize)/100, 'f', -1, 64) var userCont QualEvalArrt
sendCont.CappingVal = quanTitCont.CappingVal / 100 userCont.Id = u_v
//获取实际值 userCont.Name = repoCont.Name
shiJiZhi := publicmethod.MapOut[string]() sendCont.UserListAry = append(sendCont.UserListAry, userCont)
shiJiZhi["fl_evaluation_user"] = myLoginCont.Key }
shiJiZhi["fl_evaluation_department"] = myLoginCont.MainDeparment }
shiJiZhi["fl_evaluation_group"] = myLoginCont.Company fmt.Printf("版本号吗!--->%v\n", v.QualEvalId)
shiJiZhi["fl_duty_department"] = v.AcceptEvaluation sendCont.DimensionWeight, sendCont.TargetWeight = getPlanVersionWeghit(v.QualEvalId, strconv.FormatInt(v.Dimension, 10), strconv.FormatInt(v.Target, 10))
//获取目标设定
operationTime := time.Now().Unix() quanTitWhere := publicmethod.MapOut[string]()
if receivedValue.Time != "" { // quanTitWhere["company_id"] = v.Group
strTime := fmt.Sprintf("%v-01 00:00:00", receivedValue.Time) quanTitWhere["departmentid"] = v.AcceptEvaluation
stringToTime, strToTimeErr := publicmethod.DateToTimeStamp(strTime) // quanTitWhere["dimension"] = v.Dimension
if strToTimeErr == true { quanTitWhere["target"] = v.Target
operationTime = stringToTime if v.DetailedTarget != 0 {
} else { quanTitWhere["targetconfig"] = v.DetailedTarget
strTime = fmt.Sprintf("%v 00:00:00", receivedValue.Time) }
stringToTime, strToTimeErr = publicmethod.DateToTimeStamp(strTime) quanTitWhere["year"] = publicmethod.UnixTimeToDay(time.Now().Unix(), 16)
quanTitWhere["timecopy"] = AllZreoConfig(v.Cycles)
//目标值设定
var quanTitCont modelskpi.QuantitativeConfig
quanTitCont.GetCont(quanTitWhere)
//全奖值、零奖值、封顶值
sendCont.ZeroPrize = strconv.FormatFloat(float64(quanTitCont.Zeroprize)/100, 'f', -1, 64)
sendCont.AllPrize = strconv.FormatFloat(float64(quanTitCont.Allprize)/100, 'f', -1, 64)
sendCont.CappingVal = quanTitCont.CappingVal / 100
//获取实际值
shiJiZhi := publicmethod.MapOut[string]()
shiJiZhi["fl_evaluation_user"] = myLoginCont.Key
shiJiZhi["fl_evaluation_department"] = myLoginCont.MainDeparment
shiJiZhi["fl_evaluation_group"] = myLoginCont.Company
shiJiZhi["fl_duty_department"] = v.AcceptEvaluation
operationTime := time.Now().Unix()
if receivedValue.Time != "" {
strTime := fmt.Sprintf("%v-01 00:00:00", receivedValue.Time)
stringToTime, strToTimeErr := publicmethod.DateToTimeStamp(strTime)
if strToTimeErr == true { if strToTimeErr == true {
operationTime = stringToTime operationTime = stringToTime
} else {
strTime = fmt.Sprintf("%v 00:00:00", receivedValue.Time)
stringToTime, strToTimeErr = publicmethod.DateToTimeStamp(strTime)
if strToTimeErr == true {
operationTime = stringToTime
}
} }
} }
} years := publicmethod.ComputingTime(operationTime, 1)
years := publicmethod.ComputingTime(operationTime, 1) quarter := publicmethod.ComputingTime(operationTime, 2)
quarter := publicmethod.ComputingTime(operationTime, 2) months := publicmethod.ComputingTime(operationTime, 3)
months := publicmethod.ComputingTime(operationTime, 3) switch v.Cycles {
switch v.Cycles { case 1:
case 1: shiJiZhi["fl_year"] = years
shiJiZhi["fl_year"] = years shiJiZhi["fl_quarter"] = quarter
shiJiZhi["fl_quarter"] = quarter shiJiZhi["fl_month"] = months
shiJiZhi["fl_month"] = months shiJiZhi["fl_week"] = publicmethod.ComputingTime(operationTime, 4)
shiJiZhi["fl_week"] = publicmethod.ComputingTime(operationTime, 4) shiJiZhi["fl_day"] = publicmethod.ComputingTime(operationTime, 5)
shiJiZhi["fl_day"] = publicmethod.ComputingTime(operationTime, 5) case 2:
case 2: shiJiZhi["fl_year"] = years
shiJiZhi["fl_year"] = years shiJiZhi["fl_quarter"] = quarter
shiJiZhi["fl_quarter"] = quarter shiJiZhi["fl_month"] = months
shiJiZhi["fl_month"] = months shiJiZhi["fl_week"] = publicmethod.ComputingTime(operationTime, 4)
shiJiZhi["fl_week"] = publicmethod.ComputingTime(operationTime, 4) shiJiZhi["fl_day"] = publicmethod.ComputingTime(operationTime, 5)
shiJiZhi["fl_day"] = publicmethod.ComputingTime(operationTime, 5) case 3:
case 3: shiJiZhi["fl_year"] = years
shiJiZhi["fl_year"] = years shiJiZhi["fl_quarter"] = quarter
shiJiZhi["fl_quarter"] = quarter shiJiZhi["fl_month"] = months
shiJiZhi["fl_month"] = months shiJiZhi["fl_week"] = publicmethod.ComputingTime(operationTime, 4)
shiJiZhi["fl_week"] = publicmethod.ComputingTime(operationTime, 4) case 4:
case 4: shiJiZhi["fl_year"] = years
shiJiZhi["fl_year"] = years shiJiZhi["fl_quarter"] = quarter
shiJiZhi["fl_quarter"] = quarter shiJiZhi["fl_month"] = months
shiJiZhi["fl_month"] = months case 5:
case 5: shiJiZhi["fl_year"] = years
shiJiZhi["fl_year"] = years shiJiZhi["fl_quarter"] = quarter
shiJiZhi["fl_quarter"] = quarter case 6:
case 6: shiJiZhi["fl_year"] = years
shiJiZhi["fl_year"] = years default:
default: shiJiZhi["fl_year"] = years
shiJiZhi["fl_year"] = years shiJiZhi["fl_quarter"] = quarter
shiJiZhi["fl_quarter"] = quarter shiJiZhi["fl_month"] = months
shiJiZhi["fl_month"] = months shiJiZhi["fl_week"] = publicmethod.ComputingTime(operationTime, 4)
shiJiZhi["fl_week"] = publicmethod.ComputingTime(operationTime, 4) shiJiZhi["fl_day"] = publicmethod.ComputingTime(operationTime, 5)
shiJiZhi["fl_day"] = publicmethod.ComputingTime(operationTime, 5) }
} sendCont.ReferTo = JudgeDingLiangIsTrue(v.Id, v.AcceptEvaluation, years, quarter, months, v.Cycles)
sendCont.ReferTo = JudgeDingLiangIsTrue(v.Id, v.AcceptEvaluation, years, quarter, months, v.Cycles) actualValue, shouDongScore := GetTimeIntervalDuty(shiJiZhi, v.Id) //实际值
actualValue, shouDongScore := GetTimeIntervalDuty(shiJiZhi, v.Id) //实际值 sendCont.Actual = strconv.FormatFloat(actualValue/100, 'f', -1, 64)
sendCont.Actual = strconv.FormatFloat(actualValue/100, 'f', -1, 64) // chuShuVal := actualValue - quanTitCont.Zeroprize
// chuShuVal := actualValue - quanTitCont.Zeroprize // beiChuShuVal := quanTitCont.Allprize - quanTitCont.Zeroprize
// beiChuShuVal := quanTitCont.Allprize - quanTitCont.Zeroprize // if beiChuShuVal > 0 {
// if beiChuShuVal > 0 { // sendCont.ReachScore = chuShuVal / beiChuShuVal
// sendCont.ReachScore = chuShuVal / beiChuShuVal // } else {
// } else { // sendCont.ReachScore = 0
// sendCont.ReachScore = 0 // }
// } var actual float64
var actual float64 actual, sendCont.ReachScore = postweb.GetAchieAndActual(actualValue, float64(sendCont.TargetWeight), quanTitCont.Zeroprize, quanTitCont.Allprize, quanTitCont.CappingVal)
actual, sendCont.ReachScore = postweb.GetAchieAndActual(actualValue, float64(sendCont.TargetWeight), quanTitCont.Zeroprize, quanTitCont.Allprize, quanTitCont.CappingVal) if targetCont.ScoringMethod != 1 {
if targetCont.ScoringMethod != 1 { sendCont.ReachScore = publicmethod.DecimalEs(shouDongScore/100, 2)
sendCont.ReachScore = publicmethod.DecimalEs(shouDongScore/100, 2) }
} // fmt.Printf("All--->score:%v------>weight:%v------>zeroprize:%v------>allprize:%v------>cappingval:%v------>achievement:%v------>actual:%v\n", actualValue, sendCont.TargetWeight, quanTitCont.Zeroprize, quanTitCont.Allprize, quanTitCont.CappingVal, sendCont.ReachScore, actual)
// fmt.Printf("All--->score:%v------>weight:%v------>zeroprize:%v------>allprize:%v------>cappingval:%v------>achievement:%v------>actual:%v\n", actualValue, sendCont.TargetWeight, quanTitCont.Zeroprize, quanTitCont.Allprize, quanTitCont.CappingVal, sendCont.ReachScore, actual) if quanTitCont.Zeroprize == 0 && quanTitCont.Allprize == 0 {
if quanTitCont.Zeroprize == 0 && quanTitCont.Allprize == 0 {
sendCont.Reach = "未设置目标值"
} else {
dividend := quanTitCont.Allprize - quanTitCont.Zeroprize //被除数
if dividend == 0 {
sendCont.Reach = "未设置目标值" sendCont.Reach = "未设置目标值"
} else { } else {
// sendCont.Reach = fmt.Sprintf("(实际值-零奖值)/(全奖值-零奖值)") dividend := quanTitCont.Allprize - quanTitCont.Zeroprize //被除数
actual = publicmethod.DecimalEs(actual*100, 2) if dividend == 0 {
sendCont.Reach = fmt.Sprintf("%v%v", actual, "%") sendCont.Reach = "未设置目标值"
if actualValue == 0 { } else {
sendCont.Reach = "100%" // sendCont.Reach = fmt.Sprintf("(实际值-零奖值)/(全奖值-零奖值)")
actual = publicmethod.DecimalEs(actual*100, 2)
sendCont.Reach = fmt.Sprintf("%v%v", actual, "%")
if actualValue == 0 {
sendCont.Reach = "100%"
}
} }
} }
sendCont.Reason = ""
sendCont.DetailedTarget = strconv.FormatInt(v.DetailedTarget, 10)
// switch v.Cycles {
// case 5:
// banNian := []int64{3, 6, 9, 12}
// if publicmethod.IsInTrue[int64](months, banNian) {
// sendListCont = append(sendListCont, sendCont)
// }
// case 6:
// if months == 12 {
// sendListCont = append(sendListCont, sendCont)
// }
// case 7:
// banNian := []int64{6, 12}
// if publicmethod.IsInTrue[int64](months, banNian) {
// sendListCont = append(sendListCont, sendCont)
// }
// default:
// sendListCont = append(sendListCont, sendCont)
// }
sendListCont = append(sendListCont, sendCont)
} }
sendCont.Reason = ""
sendCont.DetailedTarget = strconv.FormatInt(v.DetailedTarget, 10)
// switch v.Cycles {
// case 5:
// banNian := []int64{3, 6, 9, 12}
// if publicmethod.IsInTrue[int64](months, banNian) {
// sendListCont = append(sendListCont, sendCont)
// }
// case 6:
// if months == 12 {
// sendListCont = append(sendListCont, sendCont)
// }
// case 7:
// banNian := []int64{6, 12}
// if publicmethod.IsInTrue[int64](months, banNian) {
// sendListCont = append(sendListCont, sendCont)
// }
// default:
// sendListCont = append(sendListCont, sendCont)
// }
sendListCont = append(sendListCont, sendCont)
} }
publicmethod.Result(0, sendListCont, c) publicmethod.Result(0, sendListCont, c)
} }

10
api/workflow/workflowengine/flowhandle.go

@ -93,7 +93,15 @@ func (a *ApiMethod) GetAllParentNode(c *gin.Context) {
} }
var outCont outAllNodeCont var outCont outAllNodeCont
outCont.SeekFromNodeCont(receivedValue.Id, receivedValue.AllCont) outCont.SeekFromNodeCont(receivedValue.Id, receivedValue.AllCont)
sendCont.AllCont = outCont.AllCont var daoXun []NodePublicStruct
contLen := len(outCont.AllCont)
if contLen > 0 {
for i := contLen - 1; i >= 0; i-- {
daoXun = append(daoXun, outCont.AllCont[i])
}
}
sendCont.AllCont = daoXun
sendCont.Total = len(outCont.AllCont) sendCont.Total = len(outCont.AllCont)
publicmethod.Result(0, sendCont, c) publicmethod.Result(0, sendCont, c)
} }

Loading…
Cancel
Save