From dff15a4b1fde1b1b1b915c91900662d948cfc05a Mon Sep 17 00:00:00 2001 From: herenshan112 Date: Fri, 2 Sep 2022 10:53:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=8B=E6=9C=BA=E7=AB=AF=E5=AE=9A=E9=87=8F?= =?UTF-8?q?=E8=80=83=E6=A0=B8=E4=B8=8E=E5=AE=9A=E6=80=A7=E8=80=83=E6=A0=B8?= =?UTF-8?q?=E6=8F=90=E6=8A=A5=E5=AE=8C=E6=88=90=EF=BC=88=E9=99=A4=E5=AE=A1?= =?UTF-8?q?=E6=89=B9=E6=A8=A1=E5=9D=97=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/version1/postseting/postpc/scheme.go | 36 ++- api/version1/postseting/postweb/postration.go | 288 ++++++++++++++++++ api/version1/postseting/postweb/type.go | 75 +++++ apirouter/v1/postseting/web.go | 2 + models/modelskpi/post_metering_flow.go | 48 +-- .../qualitative_evaluation_scheme.go | 1 + models/modelskpi/quan_post_config.go | 72 +++++ models/modelskpi/quantitative_config.go | 70 +++++ 8 files changed, 557 insertions(+), 35 deletions(-) create mode 100644 api/version1/postseting/postweb/postration.go create mode 100644 models/modelskpi/quan_post_config.go create mode 100644 models/modelskpi/quantitative_config.go diff --git a/api/version1/postseting/postpc/scheme.go b/api/version1/postseting/postpc/scheme.go index 0f8063b..4d2e102 100644 --- a/api/version1/postseting/postpc/scheme.go +++ b/api/version1/postseting/postpc/scheme.go @@ -410,6 +410,9 @@ func postSchemeTargetPost(versionNumber string, source, judgeState int, scheme [ eidtTargetCont["`source`"] = source eidtTargetCont["`run_state`"] = cv.State eidtTargetCont["`eitetime`"] = timeData + if cv.Content != "" { + eidtTargetCont["`content`"] = cv.Content + } saveData.EiteCont(map[string]interface{}{"`id`": saveData.Id}, eidtTargetCont) } else { //不存在需要新增 saveData.VersionNumber = versionNumber //版本编号"` @@ -418,6 +421,7 @@ func postSchemeTargetPost(versionNumber string, source, judgeState int, scheme [ saveData.OrgId = orgid //归属行政组织"` saveData.PostId = postid //归属岗位"` saveData.Title = cv.Name //考核项名称"` + saveData.Content = cv.Content //考核项说明"` saveData.DimensionId = dimensionIdInt64 //维度"` saveData.TargetId = targetIdInt64 //指标"` saveData.SonTargetId = 0 //子栏目"` @@ -601,14 +605,18 @@ func postSchemeTarget(versionNumber string, source, judgeState int, scheme []sch eidtTargetCont["`source`"] = source eidtTargetCont["`run_state`"] = cv.State eidtTargetCont["`eitetime`"] = timeData + if cv.Content != "" { + eidtTargetCont["`content`"] = cv.Content + } saveData.EiteCont(map[string]interface{}{"`id`": saveData.Id}, eidtTargetCont) } else { //不存在需要新增 - saveData.VersionNumber = versionNumber //版本编号"` - saveData.CompanyId = companyId //归属公司"` - saveData.DepartmentId = departmentId //归属部门"` - saveData.OrgId = orgid //归属行政组织"` - saveData.PostId = postid //归属岗位"` - saveData.Title = cv.Name //考核项名称"` + saveData.VersionNumber = versionNumber //版本编号"` + saveData.CompanyId = companyId //归属公司"` + saveData.DepartmentId = departmentId //归属部门"` + saveData.OrgId = orgid //归属行政组织"` + saveData.PostId = postid //归属岗位"` + saveData.Title = cv.Name //考核项名称"` + saveData.Content = cv.Content saveData.DimensionId = dimensionIdInt64 //维度"` saveData.TargetId = targetIdInt64 //指标"` saveData.SonTargetId = 0 //子栏目"` @@ -670,6 +678,9 @@ func postSchemeTarget(versionNumber string, source, judgeState int, scheme []sch eidtTargetCont["`source`"] = source eidtTargetCont["`run_state`"] = cv.State eidtTargetCont["`eitetime`"] = timeData + if cv.Content != "" { + eidtTargetCont["`content`"] = cv.Content + } saveData.EiteCont(map[string]interface{}{"`id`": saveData.Id}, eidtTargetCont) } else { //不存在需要新增 var minScoreInt int64 = 0 @@ -689,12 +700,13 @@ func postSchemeTarget(versionNumber string, source, judgeState int, scheme []sch } } - saveData.VersionNumber = versionNumber //版本编号"` - saveData.CompanyId = companyId //归属公司"` - saveData.DepartmentId = departmentId //归属部门"` - saveData.OrgId = orgid //归属行政组织"` - saveData.PostId = postid //归属岗位"` - saveData.Title = cv.Name //考核项名称"` + saveData.VersionNumber = versionNumber //版本编号"` + saveData.CompanyId = companyId //归属公司"` + saveData.DepartmentId = departmentId //归属部门"` + saveData.OrgId = orgid //归属行政组织"` + saveData.PostId = postid //归属岗位"` + saveData.Title = cv.Name //考核项名称"` + saveData.Content = cv.Content saveData.DimensionId = dimensionIdInt64 //维度"` saveData.TargetId = targetIdInt64 //指标"` saveData.SonTargetId = sonTargetIdInt64 //子栏目"` diff --git a/api/version1/postseting/postweb/postration.go b/api/version1/postseting/postweb/postration.go new file mode 100644 index 0000000..e9c83a6 --- /dev/null +++ b/api/version1/postseting/postweb/postration.go @@ -0,0 +1,288 @@ +package postweb + +import ( + "encoding/json" + "fmt" + "key_performance_indicators/models/modelshr" + "key_performance_indicators/models/modelskpi" + "key_performance_indicators/overall" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +//定量考核相关操作 + +// 获取定量考核详细内容 +func (a *ApiMethod) GetRationTargetCont(c *gin.Context) { + var receivedValue publicmethod.PublicId + err := c.ShouldBindJSON(&receivedValue) + if err != nil { + publicmethod.Result(100, err, c) + return + } + if receivedValue.Id == "" { + publicmethod.Result(101, receivedValue, c) + return + } + currentTime := time.Now().Unix() + + var schemeCont modelskpi.QualitativeEvaluationScheme + err = schemeCont.GetCont(map[string]interface{}{"`id`": receivedValue.Id}) + if err != nil { + publicmethod.Result(107, err, c) + return + } + var sendData sendPostTargetRationCont + sendData.Id = receivedValue.Id + //获取指标信息 + var targerCont modelskpi.PostTarget + targerCont.GetCont(map[string]interface{}{"`id`": schemeCont.TargetId}) + sendData.Name = targerCont.Title + sendData.Content = schemeCont.Content + yearVal := publicmethod.ComputingTime(currentTime, 1) + timecopy := publicmethod.ComputingTime(currentTime, 3) //月"` + switch targerCont.Cycle { + case 5: + timecopy = publicmethod.ComputingTime(currentTime, 2) //季度"` + case 6: + timecopy = 1 + default: + timecopy = publicmethod.ComputingTime(currentTime, 3) //月"` + } + //获取指标的全奖、零奖、封顶值 + sendData.Allprize, sendData.Zeroprize, sendData.Capping = GetPostTagetRewardSeting(schemeCont.CompanyId, schemeCont.OrgId, schemeCont.PostId, schemeCont.DimensionId, schemeCont.TargetId, schemeCont.DetailsId, yearVal, timecopy) + //获取指标权重 + dimensionIdStr := strconv.FormatInt(schemeCont.DimensionId, 10) + targetIdStr := strconv.FormatInt(schemeCont.TargetId, 10) + sendData.Weight = GetSchemeTargetWeight(schemeCont.VersionNumber, dimensionIdStr, targetIdStr, schemeCont.Source) + sendData.ScoringMethod = schemeCont.ScoringMethod + publicmethod.Result(0, sendData, c) +} + +/* +获取岗位指标全奖、零奖、封顶值 +@company 公司 +@org 行政组织 +@post 岗位 +@dimension 维度 +@target 指标 +@detailed 细则 +GetPostTagetRewardSeting(company, org, post, dimension, target, detailed, year int64, timecopy int) +*/ +func GetPostTagetRewardSeting(company, org, post, dimension, target, detailed, year, timecopy int64) (allprize, zeroprize, capping float64) { + allprize = 0 + zeroprize = 0 + capping = 0 + var quanPostConfig modelskpi.QuanPostConfig + gormDb := overall.CONSTANT_DB_KPI.Model(&modelskpi.QuanPostConfig{}).Where("`state` = 1 AND `company_id` = ? AND `org_id` = ? AND `post_id` = ? AND `dimension` = ? AND `target` = ? AND `year` = ? AND `timecopy` = ?", company, org, post, dimension, target, year, timecopy) + if detailed != 0 { + gormDb = gormDb.Where("`detailed` = ?", detailed) + } + err := gormDb.First(&quanPostConfig).Error + if err == nil { + allprize = publicmethod.DecimalEs(quanPostConfig.Allprize, 2) + zeroprize = publicmethod.DecimalEs(quanPostConfig.Zeroprize, 2) + capping = publicmethod.DecimalEs(quanPostConfig.CappingVal, 2) + } + return +} + +/* +获取考核项目指标权重 +@versionNumber 版本编号 +@dimension 维度 +@target 指标 +@source 来源(1:岗位;2:部门引用) +@weight 指标权重 +GetSchemeTargetWeight(versionNumber, dimension, target string, source int) +*/ +func GetSchemeTargetWeight(versionNumber, dimension, target string, source int) (weight float64) { + var postPlanVersion modelskpi.PositionPlanVersio + err := postPlanVersion.GetCont(map[string]interface{}{"`key`": versionNumber}) + if err != nil { + return + } + //解析岗位指标放啊 + var shemeInfo postScheme + jsonErr := json.Unmarshal([]byte(postPlanVersion.Content), &shemeInfo) + if jsonErr != nil { + return + } + if source == 1 { //岗位 + if len(shemeInfo.PostChild) > 0 { + for _, pv := range shemeInfo.PostChild { //维度 + if pv.Id == dimension { + if len(pv.Child) > 0 { + for _, tv := range pv.Child { //指标 + if tv.Id == target { + weight = tv.Score + } + } + } + } + } + } + } else { //部门引用 + if len(shemeInfo.DepartmentChild) > 0 { + for _, pv := range shemeInfo.DepartmentChild { //维度 + if pv.Id == dimension { + if len(pv.Child) > 0 { + for _, tv := range pv.Child { //指标 + if tv.Id == target { + weight = tv.Score + } + } + } + } + } + } + } + return +} + +// 提交定量考核数据 +func (a *ApiMethod) SubmitRationPostCont(c *gin.Context) { + var receivedValue submitPostSchemeTarget + err := c.ShouldBindJSON(&receivedValue) + if err != nil { + publicmethod.Result(100, err, c) + return + } + if receivedValue.Id == "" { + publicmethod.Result(101, receivedValue, c) + return + } + currentTime := time.Now().Unix() + if receivedValue.SubmitTime != "" { + happTime, timeErr := publicmethod.DateToTimeStamp(fmt.Sprintf("%v-01 12:00:00", receivedValue.SubmitTime)) + if timeErr == true { + currentTime = happTime + } + } else { + yearVal := publicmethod.ComputingTime(currentTime, 1) + timecopy := publicmethod.ComputingTime(currentTime, 3) //月"` + happTime, timeErr := publicmethod.DateToTimeStamp(fmt.Sprintf("%v-%v-01 12:00:00", yearVal, timecopy)) + if timeErr == true { + currentTime = happTime + } + } + if receivedValue.Score == 0 { + publicmethod.Result(1, receivedValue, c, "请输入您的实际值!") + return + } + if receivedValue.ScoringMethod == 0 { + receivedValue.ScoringMethod = 1 + } + + if receivedValue.ScoringMethod != 1 { + if receivedValue.ScoringScore == 0 { + publicmethod.Result(1, receivedValue, c, "请输入您的手动打分值!") + return + } + } + if receivedValue.PersonLiable == "" { + publicmethod.Result(1, receivedValue, c, "没有确定责任人是谁!") + return + } + //获取考核项目信息 + var postShemeCont modelskpi.QualitativeEvaluationScheme + err = postShemeCont.GetCont(map[string]interface{}{"`id`": receivedValue.Id}) + if err != nil { + publicmethod.Result(107, err, c) + return + } + //获取被考核人基本信息 + var userCont modelshr.PersonArchives + err = userCont.GetCont(map[string]interface{}{"`key`": receivedValue.PersonLiable}, "`company`", "`maindeparment`", "`admin_org`", "`position`") + if err != nil { + publicmethod.Result(107, err, c) + return + } + //获取登录人信息 + context, _ := publicmethod.LoginMyCont(c) + + uuId := publicmethod.GetUUid(1) + + //流程列表 + var flowCont modelskpi.PostWorkflowOrders + flowCont.OrderId = uuId //审批单ID"` + flowCont.Step = 1 //当前执行到第几步"` + flowCont.NextStep = 2 //下一步执行哪个步骤"` + flowCont.WorkFlow = "" //工作流(审批json字符串)"` + flowCont.CompanyId = userCont.Company //公司"` + flowCont.DepartmentId = userCont.MainDeparment //部门"` + flowCont.OrgId = userCont.AdminOrg //行政组织"` + flowCont.PostId = userCont.Position //岗位"` + flowCont.Class = postShemeCont.Attribute //属性1、定性;2、定量"` + flowCont.Dimension = postShemeCont.DimensionId //维度"` + flowCont.Target = postShemeCont.TargetId //指标"` + flowCont.SonTarget = postShemeCont.SonTargetId //指标子栏目"` + flowCont.Detailed = postShemeCont.DetailsId //指标细则"` + flowCont.Executor = context.Key //执行人"` + flowCont.ExecutorDepartment = context.MainDeparment //执行人部门"` + flowCont.State = 3 //流程状态 1:草稿;2:驳回;3:审批中;4:归档;5:废弃;6:删除"` + flowCont.StartTime = time.Now().Unix() //流程开始时间"` + flowCont.Time = time.Now().Unix() //时间"` + if len(receivedValue.Enclosure) > 0 { + jsonFileList, _ := json.Marshal(receivedValue.Enclosure) + flowCont.EnclosureFormat = string(jsonFileList) //附件"` + } + + yearVal := publicmethod.ComputingTime(currentTime, 1) + timecopy := publicmethod.ComputingTime(currentTime, 3) //月"` + var baseLine baseLineType + //获取指标的全奖、零奖、封顶值 + baseLine.Allprize, baseLine.Zeroprize, baseLine.Capping = GetPostTagetRewardSeting(postShemeCont.CompanyId, postShemeCont.OrgId, postShemeCont.PostId, postShemeCont.DimensionId, postShemeCont.TargetId, postShemeCont.DetailsId, yearVal, timecopy) + //获取指标权重 + dimensionIdStr := strconv.FormatInt(postShemeCont.DimensionId, 10) + targetIdStr := strconv.FormatInt(postShemeCont.TargetId, 10) + baseLine.Weight = GetSchemeTargetWeight(postShemeCont.VersionNumber, dimensionIdStr, targetIdStr, postShemeCont.Source) + + baseLine.SchemeId = receivedValue.Id + baseLine.TargetId = targetIdStr + //定量考核流水 + var postMeterFlow modelskpi.PostMeteringFlow + + postMeterFlow.OrderId = uuId // 审批单ID"` + postMeterFlow.ShemeId = postShemeCont.Id // 方案ID"` + postMeterFlow.ShemeVersion = postShemeCont.VersionNumber //方案版本编号"` + postMeterFlow.Dimension = postShemeCont.DimensionId //维度"` + postMeterFlow.Target = postShemeCont.TargetId //指标"` + postMeterFlow.Score = receivedValue.Score * 100 //分值(*100保存)"` + postMeterFlow.Reason = receivedValue.Reason //这样操作的原因"` + postMeterFlow.Year = yearVal //年"` + postMeterFlow.Quarter = publicmethod.ComputingTime(currentTime, 2) //季度"` + postMeterFlow.Month = publicmethod.ComputingTime(currentTime, 3) //月"` + postMeterFlow.Week = publicmethod.ComputingTime(currentTime, 4) //周"` + postMeterFlow.PersonLiable = userCont.Key //责任人"` + postMeterFlow.CompanyId = userCont.Company //公司"` + postMeterFlow.DepartmentId = userCont.MainDeparment //部门"` + postMeterFlow.OrgId = userCont.AdminOrg //行政组织"` + postMeterFlow.PostId = userCont.Position //岗位"` + postMeterFlow.Executor = context.Key //执行人"` + postMeterFlow.ExecutorDepartment = context.MainDeparment //执行人部门"` + postMeterFlow.HappenTime = currentTime //发生时间"` + postMeterFlow.Time = time.Now().Unix() //时间"` + baseLineJson, _ := json.Marshal(baseLine) + postMeterFlow.Baseline = string(baseLineJson) //基准线"` + + postMeterFlow.ScoringMethod = receivedValue.ScoringMethod //计分方式(1:自动;2:手动) + if receivedValue.ScoringMethod != 1 { + postMeterFlow.ScoringScore = receivedValue.ScoringScore * 100 //手动分 + } + //开启事务提交 + gormDbAffair := overall.CONSTANT_DB_KPI + passorErr := gormDbAffair.Create(&flowCont).Error + flowErr := gormDbAffair.Create(&postMeterFlow).Error + + if passorErr == nil && flowErr == nil { + addErr := gormDbAffair.Commit().Error + publicmethod.Result(0, addErr, c) + } else { + addErr := gormDbAffair.Rollback().Error + publicmethod.Result(104, addErr, c) + } +} diff --git a/api/version1/postseting/postweb/type.go b/api/version1/postseting/postweb/type.go index eb0c37e..60e9fab 100644 --- a/api/version1/postseting/postweb/type.go +++ b/api/version1/postseting/postweb/type.go @@ -94,3 +94,78 @@ type sendMyEvaluationData struct { MoneyState int `json:"moneystate"` //1、定分;2、区间分;3、不定性分值 Enclosure []publicmethod.EnclosureFormat `json:"enclosure"` //附件 } + +// 岗位考核方案 +type postScheme struct { + OrgId string `json:"orgid"` //行政组织ID + PostId string `json:"postid"` //岗位 + Year string `json:"year"` //年 + PostChild []schemeStructure `json:"postchild"` //岗位指标 + DepartmentChild []schemeStructure `json:"departmentchild"` //引用部门指标 +} + +// 方案结构体 维度 +type schemeStructure struct { + publicmethod.PublicId //id + publicmethod.PublicName //名称 + Sort int `json:"sort"` //排序 + Score float64 `json:"score"` //分数 + Child []schemeTargetStructure `json:"child"` //指标列表 +} + +// 方案中的指标 +type schemeTargetStructure struct { + publicmethod.PublicId //id + publicmethod.PublicName //名称 + Content string `json:"content"` //说明 + Score float64 `json:"score"` //分数 + State int `json:"state"` //状态:1:启用;2:禁用;3:观察 + Type int `json:"type"` //1、定性指标;2、定量指标 + Child []schemeDetailedStructure `json:"child"` //指标细则列表 + Operator []string `json:"operator"` //考核执行人 +} + +// 方案中的定性指标细则 +type schemeDetailedStructure struct { + publicmethod.PublicId //id + publicmethod.PublicName //名称 + ReferenceScore string `json:"referencescore"` //考核标准 + State int `json:"state"` //状态:1:启用;2:禁用;3:观察 + Operator []string `json:"operator"` //考核执行人 +} + +// 输出岗位定量指标提报内容 +type sendPostTargetRationCont struct { + publicmethod.PublicId //考核项ID + publicmethod.PublicName //指标名称 + Content string `json:"content"` //指标说明 + AllZeroCappingWeight + ScoringMethod int `json:"scoringmethod"` //计分方式(1:自动;2:手动) +} + +// 获取岗位定量考核参数 +type submitPostSchemeTarget struct { + publicmethod.PublicId //考核项ID + SubmitTime string `json:"submittime"` //提报时间 + ScoringMethod int `json:"scoringmethod"` //计分方式(1:自动;2:手动) + Score float64 `json:"score"` //实际数值 + ScoringScore float64 `json:"scoringscore"` //手动分 + Reason string `json:"reason"` //:这样操作的原因"` + PersonLiable string `json:"personliable"` //责任人 + Enclosure []publicmethod.EnclosureFormat `json:"enclosure"` //附件 +} + +// 全奖、零奖、封顶、权重 +type AllZeroCappingWeight struct { + Allprize float64 `json:"allprize"` //全奖值 + Zeroprize float64 `json:"zeroprize"` //零奖值 + Capping float64 `json:"capping"` //封顶值 + Weight float64 `json:"weight"` //权重 +} + +// 定量考核基准线 +type baseLineType struct { + SchemeId string `json:"schemeid"` + TargetId string `json:"targetid"` + AllZeroCappingWeight +} diff --git a/apirouter/v1/postseting/web.go b/apirouter/v1/postseting/web.go index cecbd99..1cd4b1e 100644 --- a/apirouter/v1/postseting/web.go +++ b/apirouter/v1/postseting/web.go @@ -21,5 +21,7 @@ func (a *ApiRouter) RouterGroupWeb(router *gin.RouterGroup) { apiRouter.POST("get_post_deimenso_info", methodBinding.GetPostDeimensoInfo) //获取岗位定性考核指标细则列表 apiRouter.POST("get_nature_post_dimerons", methodBinding.GetNaturePostDimerons) //获取被考核人定性指标细则详细内容 apiRouter.POST("send_us_nature_evaluation", methodBinding.SendUsNatureEvaluation) //提交个人岗位定性考核数据 + apiRouter.POST("get_ration_target_cont", methodBinding.GetRationTargetCont) //获取定量考核详细内容 + apiRouter.POST("submit_ration_post_cont", methodBinding.SubmitRationPostCont) //提交定量考核数据 } } diff --git a/models/modelskpi/post_metering_flow.go b/models/modelskpi/post_metering_flow.go index 67872d3..2bdf622 100644 --- a/models/modelskpi/post_metering_flow.go +++ b/models/modelskpi/post_metering_flow.go @@ -5,30 +5,32 @@ import ( "strings" ) -// 定性考核流水 +// 定量考核流水 type PostMeteringFlow struct { - Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;autoIncrement;comment:ID"` - OrderId int64 `json:"orderid" gorm:"column:order_id;type:bigint(20) unsigned;default:0;not null;comment:审批单ID"` - ShemeId int64 `json:"shemeid" gorm:"column:sheme_id;type:bigint(20) unsigned;default:0;not null;comment:方案ID"` - ShemeVersion string `json:"shemeversion" gorm:"column:sheme_version;type:varchar(255) ;not null;comment:方案版本编号"` - Dimension int64 `json:"dimension" gorm:"column:dimension;type:bigint(20) unsigned;default:0;not null;comment:维度"` - Target int64 `json:"target" gorm:"column:target;type:bigint(20) unsigned;default:0;not null;comment:指标"` - Score int64 `json:"score" gorm:"column:score;type:bigint(20) unsigned;default:0;not null;comment:分值(*100保存)"` - Reason string `json:"reason" gorm:"column:reason;type:text;comment:这样操作的原因"` - Year int `json:"year" gorm:"column:year;type:int(7) unsigned;default:0;not null;comment:年"` - Quarter int `json:"quarter" gorm:"column:quarter;type:int(3) unsigned;default:0;not null;comment:季度"` - Month int `json:"month" gorm:"column:month;type:int(3) unsigned;default:0;not null;comment:月"` - Week int `json:"week" gorm:"column:week;type:int(3) unsigned;default:0;not null;comment:周"` - PersonLiable int64 `json:"personliable" gorm:"column:person_liable;type:bigint(20) unsigned;default:0;not null;comment:责任人"` - CompanyId int64 `json:"companyid" gorm:"column:company_id;type:bigint(20) unsigned;default:0;not null;comment:公司"` - DepartmentId int64 `json:"departmentid" gorm:"column:department_id;type:bigint(20) unsigned;default:0;not null;comment:部门"` - OrgId int64 `json:"orgid" gorm:"column:org_id;type:bigint(20) unsigned;default:0;not null;comment:行政组织"` - PostId int64 `json:"postid" gorm:"column:post_id;type:bigint(20) unsigned;default:0;not null;comment:岗位"` - Executor int64 `json:"executor" gorm:"column:executor;type:bigint(20) unsigned;default:0;not null;comment:执行人"` - ExecutorDepartment int64 `json:"executordepartment" gorm:"column:executor_department;type:bigint(20) unsigned;default:0;not null;comment:执行人部门"` - HappenTime int64 `json:"happentime" gorm:"column:happen_time;type:bigint(20) unsigned;default:0;not null;comment:发生时间"` - Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:时间"` - Baseline string `json:"baseline" gorm:"column:baseline;type:text;comment:基准线"` + Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;autoIncrement;comment:ID"` + OrderId int64 `json:"orderid" gorm:"column:order_id;type:bigint(20) unsigned;default:0;not null;comment:审批单ID"` + ShemeId int64 `json:"shemeid" gorm:"column:sheme_id;type:bigint(20) unsigned;default:0;not null;comment:方案ID"` + ShemeVersion string `json:"shemeversion" gorm:"column:sheme_version;type:varchar(255) ;not null;comment:方案版本编号"` + Dimension int64 `json:"dimension" gorm:"column:dimension;type:bigint(20) unsigned;default:0;not null;comment:维度"` + Target int64 `json:"target" gorm:"column:target;type:bigint(20) unsigned;default:0;not null;comment:指标"` + Score float64 `json:"score" gorm:"column:score;type:bigint(20) unsigned;default:0;not null;comment:分值(*100保存)"` + Reason string `json:"reason" gorm:"column:reason;type:text;comment:这样操作的原因"` + Year int64 `json:"year" gorm:"column:year;type:int(7) unsigned;default:0;not null;comment:年"` + Quarter int64 `json:"quarter" gorm:"column:quarter;type:int(3) unsigned;default:0;not null;comment:季度"` + Month int64 `json:"month" gorm:"column:month;type:int(3) unsigned;default:0;not null;comment:月"` + Week int64 `json:"week" gorm:"column:week;type:int(3) unsigned;default:0;not null;comment:周"` + PersonLiable int64 `json:"personliable" gorm:"column:person_liable;type:bigint(20) unsigned;default:0;not null;comment:责任人"` + CompanyId int64 `json:"companyid" gorm:"column:company_id;type:bigint(20) unsigned;default:0;not null;comment:公司"` + DepartmentId int64 `json:"departmentid" gorm:"column:department_id;type:bigint(20) unsigned;default:0;not null;comment:部门"` + OrgId int64 `json:"orgid" gorm:"column:org_id;type:bigint(20) unsigned;default:0;not null;comment:行政组织"` + PostId int64 `json:"postid" gorm:"column:post_id;type:bigint(20) unsigned;default:0;not null;comment:岗位"` + Executor int64 `json:"executor" gorm:"column:executor;type:bigint(20) unsigned;default:0;not null;comment:执行人"` + ExecutorDepartment int64 `json:"executordepartment" gorm:"column:executor_department;type:bigint(20) unsigned;default:0;not null;comment:执行人部门"` + HappenTime int64 `json:"happentime" gorm:"column:happen_time;type:bigint(20) unsigned;default:0;not null;comment:发生时间"` + Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:时间"` + Baseline string `json:"baseline" gorm:"column:baseline;type:text;comment:基准线"` + ScoringMethod int `json:"scoringmethod" gorm:"column:scoring_method;type:tinyint(1) unsigned;default:1;not null;comment:计分方式(1:自动;2:手动)"` + ScoringScore float64 `json:"scoringscore" gorm:"column:scoring_score;type:bigint(20) unsigned;default:0;not null;comment:手动分"` } func (PostMeteringFlow *PostMeteringFlow) TableName() string { diff --git a/models/modelskpi/qualitative_evaluation_scheme.go b/models/modelskpi/qualitative_evaluation_scheme.go index 7be9167..e36bf2b 100644 --- a/models/modelskpi/qualitative_evaluation_scheme.go +++ b/models/modelskpi/qualitative_evaluation_scheme.go @@ -14,6 +14,7 @@ type QualitativeEvaluationScheme struct { OrgId int64 `json:"orgid" gorm:"column:org_id;type:bigint(20) unsigned;default:0;not null;comment:归属行政组织"` PostId int64 `json:"postid" gorm:"column:post_id;type:bigint(20) unsigned;default:0;not null;comment:归属岗位"` Title string `json:"title" gorm:"column:title;type:varchar(255) ;default:'';comment:考核项名称"` + Content string `json:"content" gorm:"column:content;type:text ;default:'';comment:考核说明"` DimensionId int64 `json:"dimensionid" gorm:"column:dimension_id;type:bigint(20) unsigned;default:0;not null;comment:维度"` TargetId int64 `json:"targetid" gorm:"column:target_id;type:bigint(20) unsigned;default:0;not null;comment:指标"` SonTargetId int64 `json:"sontargetid" gorm:"column:son_target_id;type:bigint(20) unsigned;default:0;not null;comment:子栏目"` diff --git a/models/modelskpi/quan_post_config.go b/models/modelskpi/quan_post_config.go new file mode 100644 index 0000000..890e5e0 --- /dev/null +++ b/models/modelskpi/quan_post_config.go @@ -0,0 +1,72 @@ +package modelskpi + +import ( + "key_performance_indicators/overall" + "strings" +) + +// 岗位定量考核目标设定 +type QuanPostConfig struct { + Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` + CompanyId int64 `json:"companyid" gorm:"column:company_id;type:bigint(20) unsigned;default:0;not null;comment:公司"` + DepartmentId int64 `json:"departmentid" gorm:"column:department_id;type:bigint(20) unsigned;default:0;not null;comment:部门ID"` + OrgId int64 `json:"orgid" gorm:"column:org_id;type:bigint(20) unsigned;default:0;not null;comment:行政组织"` + PostId int64 `json:"postid" gorm:"column:post_id;type:bigint(20) unsigned;default:0;not null;comment:岗位"` + Dimension int64 `json:"dimension" gorm:"column:dimension;type:bigint(20) unsigned;default:0;not null;comment:维度"` + Target int64 `json:"target" gorm:"column:target;type:bigint(20) unsigned;default:0;not null;comment:指标"` + Detailed int64 `json:"detailed" gorm:"column:detailed;type:bigint(20) unsigned;default:0;not null;comment:指标细则"` + Type int64 `json:"type" gorm:"column:type;type:tinyint(1) unsigned;default:0;not null;comment:1、年度;2、季度;3、月度"` + Year int64 `json:"year" gorm:"column:year;type:bigint(20) unsigned;default:0;not null;comment:年度"` + Timecopy int64 `json:"timecopy" gorm:"column:timecopy;type:int(3) unsigned;default:0;not null;comment:季度与月度辅助值"` + Zeroprize float64 `json:"zeroprize" gorm:"column:zeroprize;type:int(7) unsigned;default:0;not null;comment:零奖值"` + Allprize float64 `json:"allprize" gorm:"column:allprize;type:int(7) unsigned;default:0;not null;comment:全奖值"` + Capping int `json:"capping" gorm:"column:capping;type:int(1) unsigned;default:2;not null;comment:是否封顶(1、是;2:否)"` + CappingVal float64 `json:"cappingval" gorm:"column:capping_val;type:bigint(20) unsigned;default:0;not null;comment:封顶值"` + State int `json:"state" gorm:"column:state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` + Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` +} + +func (QuanPostConfig *QuanPostConfig) TableName() string { + return "quan_post_config" +} + +// 编辑内容 +func (cont *QuanPostConfig) EiteCont(whereMap interface{}, saveData interface{}) (err error) { + err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error + return +} + +// 获取内容 +func (cont *QuanPostConfig) GetCont(whereMap interface{}, field ...string) (err error) { + gormDb := overall.CONSTANT_DB_KPI.Model(&cont) + if len(field) > 0 { + fieldStr := strings.Join(field, ",") + gormDb = gormDb.Select(fieldStr) + } + gormDb = gormDb.Where(whereMap) + err = gormDb.First(&cont).Error + return +} + +// 根据条件获取总数 +func (cont *QuanPostConfig) CountCont(whereMap interface{}) (countId int64) { + overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId) + return +} + +// 读取全部信息 +func (cont *QuanPostConfig) ContMap(whereMap interface{}, field ...string) (countAry []QuanPostConfig, err error) { + gormDb := overall.CONSTANT_DB_KPI.Model(&cont) + if len(field) > 0 { + fieldStr := strings.Join(field, ",") + gormDb = gormDb.Select(fieldStr) + } + err = gormDb.Where(whereMap).Find(&countAry).Error + return +} + +// 删除内容 +func (cont *QuanPostConfig) DelCont(whereMap interface{}) (err error) { + err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error + return +} diff --git a/models/modelskpi/quantitative_config.go b/models/modelskpi/quantitative_config.go new file mode 100644 index 0000000..6f1482d --- /dev/null +++ b/models/modelskpi/quantitative_config.go @@ -0,0 +1,70 @@ +package modelskpi + +import ( + "key_performance_indicators/overall" + "strings" +) + +// 定量考核目标设定 +type QuantitativeConfig struct { + Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` + DepartmentId int64 `json:"departmentid" gorm:"column:departmentid;type:bigint(20) unsigned;default:0;not null;comment:部门ID"` + Group int64 `json:"group" gorm:"column:group;type:bigint(20) unsigned;default:0;not null;comment:集团ID"` + Dimension int64 `json:"dimension" gorm:"column:dimension;type:bigint(20) unsigned;default:0;not null;comment:维度"` + Target int64 `json:"target" gorm:"column:target;type:bigint(20) unsigned;default:0;not null;comment:指标"` + TargetConfig int64 `json:"targetconfig" gorm:"column:targetconfig;type:bigint(20) unsigned;default:0;not null;comment:指标细则"` + Type int64 `json:"type" gorm:"column:type;type:tinyint(1) unsigned;default:0;not null;comment:1、年度;2、季度;3、月度"` + Year int64 `json:"year" gorm:"column:year;type:bigint(20) unsigned;default:0;not null;comment:年度"` + Timecopy int64 `json:"timecopy" gorm:"column:timecopy;type:int(3) unsigned;default:0;not null;comment:季度与月度辅助值"` + Zeroprize float64 `json:"zeroprize" gorm:"column:zeroprize;type:int(7) unsigned;default:0;not null;comment:零奖值"` + Allprize float64 `json:"allprize" gorm:"column:allprize;type:int(7) unsigned;default:0;not null;comment:全奖值"` + Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` + State int `json:"state" gorm:"column:state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` + Capping int `json:"capping" gorm:"column:capping;type:int(1) unsigned;default:2;not null;comment:是否封顶(1、是;2:否)"` + CappingVal float64 `json:"cappingval" gorm:"column:capping_val;type:bigint(20) unsigned;default:0;not null;comment:封顶值"` +} + +func (QuantitativeConfig *QuantitativeConfig) TableName() string { + return "quantitative_config" +} + +// 编辑内容 +func (cont *QuantitativeConfig) EiteCont(whereMap interface{}, saveData interface{}) (err error) { + err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error + return +} + +// 获取内容 +func (cont *QuantitativeConfig) GetCont(whereMap interface{}, field ...string) (err error) { + gormDb := overall.CONSTANT_DB_KPI.Model(&cont) + if len(field) > 0 { + fieldStr := strings.Join(field, ",") + gormDb = gormDb.Select(fieldStr) + } + gormDb = gormDb.Where(whereMap) + err = gormDb.First(&cont).Error + return +} + +// 根据条件获取总数 +func (cont *QuantitativeConfig) CountCont(whereMap interface{}) (countId int64) { + overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId) + return +} + +// 读取全部信息 +func (cont *QuantitativeConfig) ContMap(whereMap interface{}, field ...string) (countAry []QuantitativeConfig, err error) { + gormDb := overall.CONSTANT_DB_KPI.Model(&cont) + if len(field) > 0 { + fieldStr := strings.Join(field, ",") + gormDb = gormDb.Select(fieldStr) + } + err = gormDb.Where(whereMap).Find(&countAry).Error + return +} + +// 删除内容 +func (cont *QuantitativeConfig) DelCont(whereMap interface{}) (err error) { + err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error + return +}