Browse Source

定量考核流程完成,进行企业微信相关通讯

v1_dev_2
超级管理员 3 years ago
parent
commit
7603842783
  1. 8
      api/version1/departmentseting/departmentpc/ding_xing.go
  2. 248
      api/version1/departmentseting/departmentpc/dingliang.go
  3. 11
      api/version1/departmentseting/departmentpc/type.go
  4. 24
      api/version1/flowchart/myworkflow.go
  5. 1
      api/workflow/currency_recipe/general_method.go
  6. 16
      models/modelskpi/depart_dime_post_weight.go
  7. 21
      overall/publicmethod/technique.go

8
api/version1/departmentseting/departmentpc/ding_xing.go

@ -311,10 +311,10 @@ func (a *ApiMethod) SubmitQualityAssess(c *gin.Context) {
operationTime := time.Now().Unix() //统一操作时间 operationTime := time.Now().Unix() //统一操作时间
occurrenceTime := operationTime occurrenceTime := operationTime
//计算发生时间 //计算发生时间
currentYears := publicmethod.UnixTimeToDay(operationTime, 16) currentYears := strconv.FormatInt(publicmethod.ComputingTime(operationTime, 1), 10)
currentQuarter := publicmethod.UnixTimeToDay(operationTime, 19) currentQuarter := strconv.FormatInt(publicmethod.ComputingTime(operationTime, 2), 10)
currentMonths := publicmethod.UnixTimeToDay(operationTime, 17) currentMonths := strconv.FormatInt(publicmethod.ComputingTime(operationTime, 3), 10)
currentWeek := publicmethod.UnixTimeToDay(operationTime, 23) currentWeek := strconv.FormatInt(publicmethod.ComputingTime(operationTime, 4), 10)
if receivedValue.ScoreFlowCont.Time == "" { if receivedValue.ScoreFlowCont.Time == "" {
publicmethod.Result(1, receivedValue, c, "请确认发生时间!") publicmethod.Result(1, receivedValue, c, "请确认发生时间!")
return return

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

@ -4,6 +4,8 @@ import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"key_performance_indicators/api/version1/postseting/postweb" "key_performance_indicators/api/version1/postseting/postweb"
"key_performance_indicators/api/workflow/currency_recipe"
"key_performance_indicators/api/workflow/workflowengine"
"key_performance_indicators/models/modelshr" "key_performance_indicators/models/modelshr"
"key_performance_indicators/models/modelskpi" "key_performance_indicators/models/modelskpi"
"key_performance_indicators/overall" "key_performance_indicators/overall"
@ -443,24 +445,112 @@ func (a *ApiMethod) SubmitQuantifyTarget(c *gin.Context) {
publicmethod.Result(1, receivedValue, c, "未知行政组织!不可进行提交") publicmethod.Result(1, receivedValue, c, "未知行政组织!不可进行提交")
return return
} }
acceptDepartment, _ := strconv.ParseInt(receivedValue.DepartmentId, 10, 64)
if receivedValue.PlanVersionNumber == "" { if receivedValue.PlanVersionNumber == "" {
publicmethod.Result(1, receivedValue, c, "未知方案!不可进行提交") publicmethod.Result(1, receivedValue, c, "未知方案!不可进行提交")
return return
} }
operationTime := time.Now().Unix() //统一操作时间
occurrenceTime := operationTime
//计算发生时间
currentYears := strconv.FormatInt(publicmethod.ComputingTime(operationTime, 1), 10)
currentQuarter := strconv.FormatInt(publicmethod.ComputingTime(operationTime, 2), 10)
currentMonths := strconv.FormatInt(publicmethod.ComputingTime(operationTime, 3), 10)
currentWeek := strconv.FormatInt(publicmethod.ComputingTime(operationTime, 4), 10)
if receivedValue.Time == "" { if receivedValue.Time == "" {
publicmethod.Result(1, receivedValue, c, "未知考核时间!不可进行提交") publicmethod.Result(1, receivedValue, c, "未知考核时间!不可进行提交")
return return
} else {
var dayTime publicmethod.DateTimeTotimes
dayTime.BaisStrToTime(receivedValue.Time)
if dayTime.Years != "" {
currentYears = dayTime.Years
}
if dayTime.Quarter != "" {
currentQuarter = dayTime.Quarter
}
if dayTime.Months != "" {
currentMonths = dayTime.Months
} }
if dayTime.Week != "" {
currentWeek = dayTime.Week
}
occurrenceTime = dayTime.AllTime
}
currentYearsInt, _ := strconv.ParseInt(currentYears, 10, 64) //年
currentQuarterInt, _ := strconv.ParseInt(currentQuarter, 10, 64) //季度
currentMonthsInt, _ := strconv.ParseInt(currentMonths, 10, 64) //月
currentWeekInt, _ := strconv.ParseInt(currentWeek, 10, 64) //周
if len(receivedValue.List) < 1 { if len(receivedValue.List) < 1 {
publicmethod.Result(1, receivedValue, c, "未知考核项目!不可进行提交") publicmethod.Result(1, receivedValue, c, "未知考核项目!不可进行提交")
return return
} }
var errMsg []string var errMsg []string
var dimIdList []string
var tarIdList []string
var allZreoConfig []FlowLogAllZreo
for _, v := range receivedValue.List { for _, v := range receivedValue.List {
if v.Id == "" { if v.Id == "" {
errMsg = append(errMsg, "未知考核项目") errMsg = append(errMsg, "未知考核项目")
} }
var allZreoConfigInfo FlowLogAllZreo
allZreoConfigInfo.Id = v.Id
allZreoConfigInfo.TargetId = v.Target
var qualEvalCont modelskpi.QualitativeEvaluation
err := qualEvalCont.GetCont(map[string]interface{}{"`qe_id`": v.Id}, "qe_dimension", "qe_target")
if err != nil {
errMsg = append(errMsg, fmt.Sprintf("%v未知考核项目!不可进行提交", v.Targetname))
} else {
dimStr := strconv.FormatInt(qualEvalCont.Dimension, 10)
if !publicmethod.IsInTrue[string](dimStr, dimIdList) {
dimIdList = append(dimIdList, dimStr)
}
tarStr := strconv.FormatInt(qualEvalCont.Target, 10)
if !publicmethod.IsInTrue[string](tarStr, tarIdList) {
tarIdList = append(tarIdList, tarStr)
}
switch qualEvalCont.Cycles {
case 5:
var qualConfig modelskpi.QuantitativeConfig
conWhere := publicmethod.MapOut[string]()
conWhere["`departmentid`"] = acceptDepartment
conWhere["`dimension`"] = qualEvalCont.Dimension
conWhere["`target`"] = qualEvalCont.Target
conWhere["`year`"] = currentQuarterInt
conWhere["`timecopy`"] = currentMonthsInt
qualConfig.GetCont(conWhere, "zeroprize", "allprize", "capping_val")
allZreoConfigInfo.Zeroprize = qualConfig.Zeroprize
allZreoConfigInfo.Allprize = qualConfig.Allprize
allZreoConfigInfo.Capping = qualConfig.CappingVal
case 6:
var qualConfig modelskpi.QuantitativeConfig
conWhere := publicmethod.MapOut[string]()
conWhere["`departmentid`"] = acceptDepartment
conWhere["`dimension`"] = qualEvalCont.Dimension
conWhere["`target`"] = qualEvalCont.Target
conWhere["`year`"] = currentYearsInt
conWhere["`timecopy`"] = 1
qualConfig.GetCont(conWhere, "zeroprize", "allprize", "capping_val")
allZreoConfigInfo.Zeroprize = qualConfig.Zeroprize
allZreoConfigInfo.Allprize = qualConfig.Allprize
allZreoConfigInfo.Capping = qualConfig.CappingVal
default:
var qualConfig modelskpi.QuantitativeConfig
conWhere := publicmethod.MapOut[string]()
conWhere["`departmentid`"] = acceptDepartment
conWhere["`dimension`"] = qualEvalCont.Dimension
conWhere["`target`"] = qualEvalCont.Target
conWhere["`year`"] = currentYearsInt
conWhere["`timecopy`"] = currentMonthsInt
qualConfig.GetCont(conWhere, "zeroprize", "allprize", "capping_val")
allZreoConfigInfo.Zeroprize = qualConfig.Zeroprize
allZreoConfigInfo.Allprize = qualConfig.Allprize
allZreoConfigInfo.Capping = qualConfig.CappingVal
}
allZreoConfig = append(allZreoConfig, allZreoConfigInfo)
}
if v.Actual == "" { if v.Actual == "" {
errMsg = append(errMsg, fmt.Sprintf("%v未输入实际值", v.Targetname)) errMsg = append(errMsg, fmt.Sprintf("%v未输入实际值", v.Targetname))
} }
@ -480,7 +570,7 @@ func (a *ApiMethod) SubmitQuantifyTarget(c *gin.Context) {
fmt.Printf("where--->%v\n", where) fmt.Printf("where--->%v\n", where)
var dutyData modelskpi.DutyFlowData var dutyData modelskpi.DutyFlowData
err := dutyData.GetCont(where, "fld_id") err = dutyData.GetCont(where, "fld_id")
if err == nil { if err == nil {
errMsg = append(errMsg, fmt.Sprintf("%v已经提交过!请不要重复提交!", v.Targetname)) errMsg = append(errMsg, fmt.Sprintf("%v已经提交过!请不要重复提交!", v.Targetname))
} }
@ -491,9 +581,157 @@ func (a *ApiMethod) SubmitQuantifyTarget(c *gin.Context) {
return return
} }
publicmethod.Result(0, receivedValue, c) uuid := publicmethod.GetUUid(6) //上报数据唯一识别码
// uuid := publicmethod.GetUUid(6) //上报数据唯一识别码 //获取登录人信息
// //获取登录人信息 myLoginCont, _ := publicmethod.LoginMyCont(c)
// myLoginCont, _ := publicmethod.LoginMyCont(c) myUserKey := strconv.FormatInt(myLoginCont.Key, 10)
//获取工作流
var workflowInfo currency_recipe.WorkflowEngine
jieguo := workflowInfo.InitWorkflow(receivedValue.FlowworkId, "", myUserKey, receivedValue.DepartmentId).SendData()
//处理工作流
var haveWorkflow workflowengine.OperateWorkflow
haveWorkflow.Step = 1 //操作哪一步
// haveWorkflow.OrderId = uuid //发起表单ID
// haveWorkflow.Attribute = qualEvalCont.Type //属性 1、定性;2、定量
haveWorkflow.OperationStatus = 2 //操作状态
var caoZuoRen workflowengine.ManipulatePeopleInfo
caoZuoRen.Key = strconv.FormatInt(myLoginCont.Key, 10) //操作人
caoZuoRen.OrgId = strconv.FormatInt(myLoginCont.AdminOrg, 10) //操作人行政组织
haveWorkflow.ManipulatePeople = caoZuoRen //操作人相关
haveWorkflow.WorkFlowList = jieguo.NodeContList //流程步进图
flowView := haveWorkflow.ManipulateWorkflow() //处理后的工作流
//审批主体信息
var evalProFlowView modelskpi.EvaluationProcess
evalProFlowView.OrderKey = uuid //发起表单key"`
evalProFlowView.Step = haveWorkflow.Step //当前执行到第几部"`
flowAllJson, _ := json.Marshal(flowView)
evalProFlowView.Content = string(flowAllJson) //流程步进值"`
nextNodeJson, _ := json.Marshal(haveWorkflow.NextNodeCont)
evalProFlowView.NextContent = string(nextNodeJson) //下一步内容"`
evalProFlowView.Time = operationTime //创建时间"`
evalProFlowView.State = 2 //1:起草,2:审批中;3:通过;4:驳回"`
evalProFlowView.RoleGroup = 0 //角色组"`
evalProFlowView.TypeClass = 2 //1、定性;2、定量"`
evalProFlowView.Participants = strings.Join(haveWorkflow.Participant, ",") //参与人"`
evalProFlowView.StartTime = operationTime //流程开始时间"`
evalProFlowView.NextStep = haveWorkflow.NextStep //下一步"`
evalProFlowView.NextExecutor = strings.Join(haveWorkflow.NextNodeContExecutor, ",") //下一步执行人"`
evalProFlowView.SetupDepartment = myLoginCont.MainDeparment //发起部门"`
evalProFlowView.Dimension = strings.Join(dimIdList, ",") //维度"`
evalProFlowView.Target = strings.Join(tarIdList, ",") //指标"`
evalProFlowView.AcceptDepartment = acceptDepartment //接受考核部门"`
evalProFlowView.HappenTime = occurrenceTime
flowKyeInt, _ := strconv.ParseInt(receivedValue.FlowworkId, 10, 64)
evalProFlowView.FlowKey = flowKyeInt //流程图唯一识别符
flowVersionInt, _ := strconv.ParseInt(jieguo.Version, 10, 64)
evalProFlowView.FlowVid = flowVersionInt //流程版本"`
evalProFlowView.EpOld = 2
evalProFlowView.Creater = myLoginCont.Key //发起人
evalProFlowView.Clique = myLoginCont.Company //流程归属公司
//定量数据流水值
var planIdList []string
var addFlowDataList []modelskpi.FlowLogData
for _, v := range receivedValue.List {
var flowDataCont modelskpi.FlowLogData
if !publicmethod.IsInTrue[string](v.Id, planIdList) {
planIdList = append(planIdList, v.Id)
}
planId, _ := strconv.ParseInt(v.Id, 10, 64)
flowDataCont.EvaluationPlan = planId //考核方案项目ID"`
flowDataCont.Key = uuid //识别标志"`
flowDataCont.Score = publicmethod.StrNumberToInt64(v.Actual, 100) //数据"`
flowDataCont.Content = v.Reason //描述"`
flowDataCont.Time = operationTime //创建时间"`
flowDataCont.ScoringMethod = v.ScoringMethod
reacVal := publicmethod.StrNumberToInt64(v.ReachScore, 100) //计分方式(1:自动;2:手动)"`
flowDataCont.ScoringScore = float64(reacVal) //手动分"`
flowDataCont.PlanVersion = v.PlanVersionNumber //版本号"`
flowDataCont.Year = currentYearsInt //年分"`
flowDataCont.Quarter = currentQuarterInt //季度"`
flowDataCont.Month = currentMonthsInt //月"`
flowDataCont.Week = currentWeekInt //周"`
flowDataCont.ToDay = 10 //天"`
tarInt, _ := strconv.ParseInt(v.Target, 10, 64)
flowDataCont.TargetId = tarInt //指标ID"`
addFlowDataList = append(addFlowDataList, flowDataCont)
}
//定量考核数据表
var workFlowLogCont modelskpi.FlowLog
workFlowLogCont.EvaluationPlan = strings.Join(planIdList, ",") //考核方案项目ID"`
// workFlowLogCont.Score = //数据"`
workFlowLogCont.Key = uuid //识别标志"`
// workFlowLogCont.Content = //描述"`
workFlowLogCont.Time = occurrenceTime //创建时间"`
workFlowLogCont.EiteTime = operationTime //修改时间"`
workFlowLogCont.EvaluationDepartment = myLoginCont.MainDeparment //测评部门"`
workFlowLogCont.EvaluationUser = myLoginCont.Key //测评人"`
workFlowLogCont.EvaluationGroup = myLoginCont.Company //测评集团"`
workFlowLogCont.Year = currentYearsInt //年分"`
workFlowLogCont.Quarter = currentQuarterInt //季度"`
workFlowLogCont.Month = currentMonthsInt //月"`
workFlowLogCont.Week = currentWeekInt //周"`
workFlowLogCont.ToDay = 10 //天"`
// workFlowLogCont.Enclosure = //附件"`
_, companyId, _, _, _ := publicmethod.GetOrgStructurees(acceptDepartment)
workFlowLogCont.DutyGroup = companyId //职责集团"`
workFlowLogCont.DutyDepartment = acceptDepartment //职责部门"`
workFlowLogCont.Reply = 2 //1状态(0:删除;1:起草;2:审批;3:通过)"`
workFlowLogCont.PlanVersion = receivedValue.PlanVersionNumber //版本号"`
baseJson, _ := json.Marshal(allZreoConfig)
workFlowLogCont.Baseline = string(baseJson) //基准线 "`
//审批记录
var stepsTotal int64
overall.CONSTANT_DB_KPI.Model(&modelskpi.OpenApprovalChangeLog{}).Where("`orderid` = ?", uuid).Count(&stepsTotal)
var flowLogCont modelskpi.OpenApprovalChangeLog
flowLogCont.Type = 1 //类型(1:部门;2:岗位)"`
flowLogCont.Title = haveWorkflow.CurrentNode.NodeName //节点名称"`
flowLogCont.Operator = myLoginCont.Key //操作人"`
flowLogCont.OrderId = uuid //订单ID"`
flowLogCont.OperatorTime = operationTime //操作时间"`
flowLogCont.Step = stepsTotal + 1 //操作第几步"`
flowLogCont.OperatorType = haveWorkflow.CurrentNode.State //操作状态(1:位操作;2:已操作)"`
flowLogCont.Msgid = "" //消息id,用于撤回应用消息"`
flowLogCont.ResponseCode = "" //仅消息类型为“按钮交互型”,“投票选择型”和“多项选择型”的模板卡片消息返回,应用可使用response_code调用更新模版卡片消息接口,24小时内有效,且只能使用一次"`
flowLogCont.Stepper = haveWorkflow.CurrentNode.Step //步进器"`
flowLogCont.ChangeIsTrue = 1 //是否可变更(1:可变更;2:不可变更)"`
flowLogCont.Eiteyime = operationTime //变动时间"`
flowLogCont.YesOrNo = haveWorkflow.CurrentNode.State //未操作;1:同意;2:驳回;3:撤回"`
outPur := publicmethod.MapOut[string]()
outPur["evalProFlowView"] = evalProFlowView
outPur["workFlowLogCont"] = workFlowLogCont
outPur["addFlowDataList"] = addFlowDataList
outPur["flowLogCont"] = flowLogCont
gormDb := overall.CONSTANT_DB_KPI.Begin()
evalProFlowViewErr := gormDb.Create(&evalProFlowView).Error
workFlowLogContErr := gormDb.Create(&workFlowLogCont).Error
addFlowDataListErr := gormDb.Create(&addFlowDataList).Error
flowLogContErr := gormDb.Create(&flowLogCont).Error
if evalProFlowViewErr == nil && workFlowLogContErr == nil && addFlowDataListErr == nil && flowLogContErr == nil {
addErr := gormDb.Commit().Error
if addErr == nil {
publicmethod.Result(0, addErr, c)
} else {
addErr := gormDb.Rollback().Error
publicmethod.Result(104, addErr, c)
}
} else {
outErr := publicmethod.MapOut[string]()
addErr := gormDb.Rollback().Error
outErr["evalProFlowViewErr"] = evalProFlowViewErr
outErr["workFlowLogContErr"] = workFlowLogContErr
outErr["addFlowDataListErr"] = addFlowDataListErr
outErr["flowLogContErr"] = flowLogContErr
outErr["addErr"] = addErr
publicmethod.Result(1014, outErr, c)
}
// publicmethod.Result(0, outPur, c)
} }

11
api/version1/departmentseting/departmentpc/type.go

@ -552,7 +552,7 @@ type RationLogList struct {
Id string `json:"id"` Id string `json:"id"`
Actual string `json:"actual"` //实际值 Actual string `json:"actual"` //实际值
ScoringMethod int `json:"scoringmethod"` //计分方式(1:自动;2:手动)"` ScoringMethod int `json:"scoringmethod"` //计分方式(1:自动;2:手动)"`
ReachScore string `json:"reachscore"` //指标标准 ReachScore string `json:"reachscore"` //手动
Unit string `json:"unit"` //单位 Unit string `json:"unit"` //单位
Target string `json:"target"` //指标 Target string `json:"target"` //指标
Targetname string `json:"targetname"` //指标名称 Targetname string `json:"targetname"` //指标名称
@ -566,3 +566,12 @@ type RationLogList struct {
Addtime string `json:"month"` //检查时间 Addtime string `json:"month"` //检查时间
Cycle int `json:"cycle"` //1:班;2:天;3:周;4:月;5:季度;6:年;7:半年 Cycle int `json:"cycle"` //1:班;2:天;3:周;4:月;5:季度;6:年;7:半年
} }
// 定量流水全奖值、零奖值、封顶值
type FlowLogAllZreo struct {
Id string `json:"id"`
TargetId string `json:"targetid"` //指标ID`
Zeroprize float64 `json:"zeroprize"` //零奖值"`
Allprize float64 `json:"allprize"` //全奖值"`
Capping float64 `json:"capping"` //封顶值"`
}

24
api/version1/flowchart/myworkflow.go

@ -638,14 +638,18 @@ func (a *ApiMethod) ExamineAndApprove(c *gin.Context) {
} else { } else {
editWorkflow["ep_participants"] = "" editWorkflow["ep_participants"] = ""
} }
replyState := receivedValue.YesOrNo
if receivedValue.YesOrNo == 2 { if receivedValue.YesOrNo == 2 {
if runWorkflow.NextStep == 0 { if runWorkflow.NextStep == 0 {
editWorkflow["ep_state"] = 4 editWorkflow["ep_state"] = 4
replyState = 4
} else { } else {
editWorkflow["ep_state"] = 2 editWorkflow["ep_state"] = 2
replyState = 2
} }
} else { } else {
editWorkflow["ep_state"] = receivedValue.YesOrNo editWorkflow["ep_state"] = receivedValue.YesOrNo
replyState = receivedValue.YesOrNo
} }
if runWorkflow.NextStep == 0 { if runWorkflow.NextStep == 0 {
editWorkflow["ep_step"] = len(runWorkflow.List) editWorkflow["ep_step"] = len(runWorkflow.List)
@ -663,6 +667,26 @@ func (a *ApiMethod) ExamineAndApprove(c *gin.Context) {
publicmethod.Result(104, err, c) publicmethod.Result(104, err, c)
return return
} }
if evalProCont.TypeClass == 1 {
//定性
scoFlwWhe := publicmethod.MapOut[string]()
scoFlwWhe["sf_key"] = evalProCont.OrderKey
var seeScoreFlowCont modelskpi.ScoreFlow
scoErr := seeScoreFlowCont.GetCont(scoFlwWhe, "sf_id")
if scoErr == nil {
seeScoreFlowCont.EiteCont(scoFlwWhe, map[string]interface{}{"sf_reply": replyState})
}
} else {
flwWhe := publicmethod.MapOut[string]()
flwWhe["fl_key"] = evalProCont.OrderKey
//定量
var flowLogInfo modelskpi.FlowLog
flwErr := flowLogInfo.GetCont(flwWhe, "fl_id")
if flwErr == nil {
flowLogInfo.EiteCont(flwWhe, map[string]interface{}{"fl_reply": replyState})
}
}
publicmethod.Result(0, err, c) publicmethod.Result(0, err, c)
} }

1
api/workflow/currency_recipe/general_method.go

@ -84,6 +84,7 @@ func (w *WorkflowEngine) SendData() (sendCont SendOneWorkflow) {
var nodeInfo []NodeCont var nodeInfo []NodeCont
nodeInfo, sendCont.IsTrue, sendCont.Msg = w.promoter() nodeInfo, sendCont.IsTrue, sendCont.Msg = w.promoter()
sendCont.NodeContList = RectificationNode(nodeInfo) sendCont.NodeContList = RectificationNode(nodeInfo)
sendCont.Version = w.VersionId
// sjkdjk, _ := json.Marshal(w) // sjkdjk, _ := json.Marshal(w)
// fmt.Printf("输出工作流--->%v\n", string(sjkdjk)) // fmt.Printf("输出工作流--->%v\n", string(sjkdjk))
return return

16
models/modelskpi/depart_dime_post_weight.go

@ -2,7 +2,6 @@ package modelskpi
import ( import (
"key_performance_indicators/overall" "key_performance_indicators/overall"
"key_performance_indicators/overall/publicmethod"
"strings" "strings"
"time" "time"
) )
@ -77,7 +76,8 @@ func (cont *DepartDimePostWeight) DelCont(whereMap interface{}) (err error) {
*/ */
// 写入岗位考核维度与指标权重 // 写入岗位考核维度与指标权重
func (cont *DepartDimePostWeight) WriteTargetWeight() (err error) { func (cont *DepartDimePostWeight) WriteTargetWeight() (err error) {
where := publicmethod.MapOut[string]() where := make(map[string]interface{})
// where := publicmethod.MapOut[string]()
where["`orgid`"] = cont.Orgid where["`orgid`"] = cont.Orgid
where["`postid`"] = cont.Postid where["`postid`"] = cont.Postid
where["`dimension`"] = cont.Dimension where["`dimension`"] = cont.Dimension
@ -90,9 +90,11 @@ func (cont *DepartDimePostWeight) WriteTargetWeight() (err error) {
err = overall.CONSTANT_DB_KPI.Create(&cont).Error err = overall.CONSTANT_DB_KPI.Create(&cont).Error
return return
} else { } else {
editWhe := publicmethod.MapOut[string]() // editWhe := publicmethod.MapOut[string]()
editWhe := make(map[string]interface{})
editWhe["`id`"] = oldCont.Id editWhe["`id`"] = oldCont.Id
saveAry := publicmethod.MapOut[string]() // saveAry := publicmethod.MapOut[string]()
saveAry := make(map[string]interface{})
saveAry["`weight`"] = cont.Weight saveAry["`weight`"] = cont.Weight
saveAry["`time`"] = time.Now().Unix() saveAry["`time`"] = time.Now().Unix()
err = oldCont.EiteCont(editWhe, saveAry) err = oldCont.EiteCont(editWhe, saveAry)
@ -106,9 +108,11 @@ func (cont *DepartDimePostWeight) WriteTargetWeight() (err error) {
err = overall.CONSTANT_DB_KPI.Create(&cont).Error err = overall.CONSTANT_DB_KPI.Create(&cont).Error
return return
} else { } else {
editWhe := publicmethod.MapOut[string]() // editWhe := publicmethod.MapOut[string]()
editWhe := make(map[string]interface{})
editWhe["`id`"] = oldCont.Id editWhe["`id`"] = oldCont.Id
saveAry := publicmethod.MapOut[string]() // saveAry := publicmethod.MapOut[string]()
saveAry := make(map[string]interface{})
saveAry["`weight`"] = cont.Weight saveAry["`weight`"] = cont.Weight
saveAry["`time`"] = time.Now().Unix() saveAry["`time`"] = time.Now().Unix()
err = oldCont.EiteCont(editWhe, saveAry) err = oldCont.EiteCont(editWhe, saveAry)

21
overall/publicmethod/technique.go

@ -620,6 +620,9 @@ func RecursionOrgLeve(superior int64, leve int64) (groupId int64) {
if leve == 0 { if leve == 0 {
leve = 1 leve = 1
} }
if superior == 0 {
return
}
var orgMap modelshr.OrgContType var orgMap modelshr.OrgContType
err := orgMap.GetCont(map[string]interface{}{"`id`": superior, "`state`": 1}, "`id`", "`superior`", "`level`") err := orgMap.GetCont(map[string]interface{}{"`id`": superior, "`state`": 1}, "`id`", "`superior`", "`level`")
if err != nil { if err != nil {
@ -637,6 +640,9 @@ func RecursionOrgLeve(superior int64, leve int64) (groupId int64) {
// 获取集团、公司、部门、二级部门、工段 // 获取集团、公司、部门、二级部门、工段
func GetOrgStructurees(orgId int64) (groupId, companyId, departmentId, sunDepartId, workShopId int64) { func GetOrgStructurees(orgId int64) (groupId, companyId, departmentId, sunDepartId, workShopId int64) {
if orgId == 0 {
return
}
var orgContTypeInfo modelshr.OrgContType var orgContTypeInfo modelshr.OrgContType
err := orgContTypeInfo.GetCont(map[string]interface{}{"`id`": orgId}) err := orgContTypeInfo.GetCont(map[string]interface{}{"`id`": orgId})
if err != nil { if err != nil {
@ -678,6 +684,9 @@ func RecursionOrgLevees(oldId, superior int64, leve int64) (groupId int64) {
if leve == 0 { if leve == 0 {
leve = 1 leve = 1
} }
if superior == 0 {
return
}
var orgMap modelshr.OrgContType var orgMap modelshr.OrgContType
err := orgMap.GetCont(map[string]interface{}{"`id`": superior, "`state`": 1}, "`id`", "`superior`", "`level`") err := orgMap.GetCont(map[string]interface{}{"`id`": superior, "`state`": 1}, "`id`", "`superior`", "`level`")
if err != nil { if err != nil {
@ -699,6 +708,9 @@ func RecursionOrgLevees(oldId, superior int64, leve int64) (groupId int64) {
// 获取集团、公司、部门、二级部门、工段 // 获取集团、公司、部门、二级部门、工段
func GetOrgStructure(orgId int64) (groupId, companyId, departmentId, sunDepartId, workShopId int64) { func GetOrgStructure(orgId int64) (groupId, companyId, departmentId, sunDepartId, workShopId int64) {
if orgId == 0 {
return
}
var orgContTypeInfo modelshr.OrgContType var orgContTypeInfo modelshr.OrgContType
err := orgContTypeInfo.GetCont(map[string]interface{}{"`id`": orgId}) err := orgContTypeInfo.GetCont(map[string]interface{}{"`id`": orgId})
if err != nil { if err != nil {
@ -2092,3 +2104,12 @@ func CalculateScore(targetScore int64, resultval, allPrizes, zeroPrizes, Capping
//fmt.Printf("达成率--12-->%v-->%v-->%v-->%v-->%v-->%v-->%v\n", targetScore, resultval, scoreVal, allPrize, zeroPrize, CappingVal, achievement) //fmt.Printf("达成率--12-->%v-->%v-->%v-->%v-->%v-->%v-->%v\n", targetScore, resultval, scoreVal, allPrize, zeroPrize, CappingVal, achievement)
return return
} }
// 字符串数子转int64
func StrNumberToInt64(val string, cheng float64) (valInt int64) {
valFloat, _ := strconv.ParseFloat(val, 64)
valFloatGd := DecimalEs(valFloat*cheng, 2)
valStr := strconv.FormatFloat(valFloatGd, 'f', -1, 64)
valInt, _ = strconv.ParseInt(valStr, 10, 64)
return
}

Loading…
Cancel
Save