Browse Source
# Conflicts: # README.md # api/version1/honoraryArchives/honors.go # apirouter/entry.go # models/modelshonory/photos_gallery.gomaster
76 changed files with 4877 additions and 200 deletions
File diff suppressed because it is too large
@ -0,0 +1,200 @@ |
|||
package departmentpc |
|||
|
|||
import ( |
|||
"key_performance_indicators/models/modelskpi" |
|||
"key_performance_indicators/overall/publicmethod" |
|||
"sync" |
|||
|
|||
"github.com/gin-gonic/gin" |
|||
) |
|||
|
|||
type ApiMethod struct{} |
|||
|
|||
// 协程设置
|
|||
var syncSeting = sync.WaitGroup{} |
|||
|
|||
// 部门考核WEB端入口
|
|||
func (a *ApiMethod) Index(c *gin.Context) { |
|||
outputCont := publicmethod.MapOut[string]() |
|||
outputCont["index"] = "部门考核PC端入口" |
|||
publicmethod.Result(0, outputCont, c) |
|||
} |
|||
|
|||
// 查询部门考核列表
|
|||
type departListQuery struct { |
|||
publicmethod.PagesTurn |
|||
Title string `json:"title"` //指标名称
|
|||
Class int `json:"class"` //1:定性考核;2:定量考核
|
|||
State int `json:"state"` //状态(1:启用;2:禁用;3:删除)
|
|||
DepartmentId string `json:"departmentid"` //部门ID
|
|||
DimensionId string `json:"dimensionid"` //维度ID
|
|||
ReportPerson string `json:"reportperson"` //上报人
|
|||
ScoringMethod int `json:"scoringmethod"` //计分方式(1:自动;2:手动)
|
|||
Cycle int `json:"cycle"` //1:班;2:天;3:周;4:月;5:季度;6:年
|
|||
} |
|||
|
|||
// 输出部门指标列表
|
|||
type printDepartmentTarget struct { |
|||
modelskpi.EvaluationTarget |
|||
DimensionTitle string `json:"dimensiontitle"` //维度名称
|
|||
} |
|||
|
|||
// 输出指标已经关联的部门
|
|||
type departOutcome struct { |
|||
publicmethod.PublicId //部门id
|
|||
publicmethod.PublicName //部门名称
|
|||
Superior string `json:"superior"` //上级
|
|||
Ispower int `json:"ispower"` //是否为主部门
|
|||
} |
|||
|
|||
// 转换提报人格式化
|
|||
type zhuanHuanMan struct { |
|||
Id int64 `json:"id"` |
|||
Operator []string `json:"operator"` |
|||
} |
|||
|
|||
// 获取相关提报人
|
|||
type getAboutReportTarget struct { |
|||
TargetId string `json:"targetid"` |
|||
TargetSunId string `json:"targetsunid"` |
|||
TargetBylaws string `json:"targetbylaws"` |
|||
DepartmentId string `json:"departmentid"` |
|||
PostId string `json:"postid"` |
|||
} |
|||
|
|||
// 输出上报人信息
|
|||
type printReportCont struct { |
|||
Id string `json:"id"` |
|||
Key string `json:"key"` |
|||
Name string `json:"name"` |
|||
GroupName string `json:"groupname"` |
|||
DepartmentName string `json:"departmentname"` |
|||
Icon string `json:"icon"` |
|||
Number string `json:"number"` |
|||
} |
|||
|
|||
// 添加 定性考核指标关系指定
|
|||
type AddQualEval struct { |
|||
Group string `json:"group"` //归属集团
|
|||
AcceptDepartmentId []string `json:"parentid"` //接受考核部门
|
|||
Type int `json:"type"` //1:定性考核;2:定量考核
|
|||
Target string `json:"target"` //考核指标
|
|||
TargetSunTitle string `json:"targetsuntitle"` //考核指标子栏目
|
|||
EvaluationList []QualEvalSunList `json:"evaluationlist"` //测评详情
|
|||
} |
|||
|
|||
// 定性考核内容
|
|||
type QualEvalSunList struct { |
|||
Title string `json:"title"` //考核内容
|
|||
Content string `json:"content"` //备注说明
|
|||
Unit string `json:"unit"` //单位
|
|||
ReferenceScore string `json:"referencescore"` //考核标准
|
|||
Cycles int `json:"cycle"` //1:班;2:天;3:周;4:月;5:季度;6:年
|
|||
CycleAttres int `json:"cycleattr"` //辅助计数
|
|||
Operator []string `json:"userlist"` //考核执行人
|
|||
AddOrReduce int `json:"addorreduce"` //操作类型 1:减少;2:增加;3:用户自定义
|
|||
CensorType []string `json:"censortype"` //检查方式(1:现场检查;2:资料检查;3:事件触发)
|
|||
CensorCont string `json:"censorcont"` //客观证据
|
|||
CensorRate int `json:"censorrate"` //检查频次
|
|||
} |
|||
|
|||
// 获取定性考核指标列表查询参数
|
|||
type getDepartTargetContType struct { |
|||
publicmethod.PagesTurn |
|||
TargetId string `json:"targetid"` //指标ID
|
|||
DepartmentId string `json:"departmentid"` //部门ID
|
|||
ReportPerson string `json:"reportperson"` //上报人
|
|||
Cycle int `json:"cycle"` //1:班;2:天;3:周;4:月;5:季度;6:年
|
|||
TargetSunId string `json:"targetsunid"` //考核子栏目
|
|||
} |
|||
|
|||
// 输出定性指标详细内容列表
|
|||
type printDepartTargetCont struct { |
|||
modelskpi.DetailedTarget |
|||
Standard string `json:"standard"` //标准
|
|||
CensorTypeList []string `json:"censortypelist"` //检查方式(1:现场检查;2:资料检查;3:事件触发)
|
|||
SonTargetName string `json:"sontargetname"` //子栏目名称
|
|||
} |
|||
|
|||
// 根据指标栏目新增指标细则
|
|||
type basisSonTargetAddDet struct { |
|||
publicmethod.PublicId |
|||
QualEvalSunList |
|||
} |
|||
|
|||
// 根据指标和部门获取相关岗位
|
|||
type bgdgp struct { |
|||
TargetId string `json:"targetid"` //指标
|
|||
TargetSunId string `json:"targetsunid"` //子栏目
|
|||
TargetBylaws string `json:"targetbylaws"` //细则
|
|||
DepartmentId string `json:"departmentid"` //部门
|
|||
Level int `json:"level"` //级别(1:部门级;2:岗位级)
|
|||
} |
|||
|
|||
// 根据指标、部门和岗位获取相关提交人
|
|||
type btdgr struct { |
|||
bgdgp |
|||
PostId string `json:"postid"` //岗位
|
|||
} |
|||
|
|||
// 修改子栏目标题名称级考核关联部门及提报人
|
|||
type editTarDepartReport struct { |
|||
TargetSunId string `json:"targetsunid"` //子栏目
|
|||
Title string `json:"title"` //考核内容
|
|||
AcceptDepartmentId []string `json:"acceptdepartmentid"` //接受考核部门
|
|||
Operator []string `json:"userlist"` //考核执行人
|
|||
} |
|||
|
|||
// 输出
|
|||
type outCont struct { |
|||
publicmethod.PublicId |
|||
publicmethod.PublicName |
|||
} |
|||
|
|||
// 输出新版指标细则详细内容
|
|||
type NewOutPutDetailedTarget struct { |
|||
publicmethod.PublicId |
|||
QualEvalSunList |
|||
ReportManList []printReportCont `json:"reportmanlist"` //上报人
|
|||
DepartmentList []string `json:"departmentlist"` //接受考核的部门
|
|||
} |
|||
|
|||
// 修改单一指标细则内容提交参数
|
|||
type editOneDetailedTargetInfo struct { |
|||
basisSonTargetAddDet |
|||
DepartmentList []string `json:"departmentlist"` //接受考核的部门
|
|||
} |
|||
|
|||
// 添加部门指标参数
|
|||
type addTargetContDepart struct { |
|||
publicmethod.PublicName |
|||
Share int `json:"share"` //1:共用;2:私用
|
|||
AcceptDepartmentId []string `json:"acceptdepartmentid"` //接受考核部门
|
|||
Operator []string `json:"userlist"` //考核执行人
|
|||
Dimension string `json:"dimension"` //维度
|
|||
Nature int `json:"nature"` //性质 1:定性考核;2:定量考核
|
|||
Unit string `json:"unit"` //单位
|
|||
Cycles int `json:"cycle"` //1:班;2:天;3:周;4:月;5:季度;6:年
|
|||
CycleAttres int `json:"cycleattr"` //辅助计数
|
|||
ScoringMethod int `json:"scoringmethod"` //计分方式(1:自动;2:手动)'
|
|||
VisibleRangeGroup []string `json:"visiblerangegroup"` //可见范围(集团)
|
|||
VisibleRangeDepart []string `json:"visiblerangedepart"` //可见范围(分厂)
|
|||
} |
|||
|
|||
// 输出单一指标详细内容
|
|||
type printOneTargetCont struct { |
|||
publicmethod.PublicId |
|||
addTargetContDepart |
|||
} |
|||
|
|||
// 部门指标关联岗位
|
|||
type depTarAboutPost struct { |
|||
publicmethod.PublicId |
|||
OrgList []LoopStruct `json:"orglist"` |
|||
} |
|||
|
|||
// 循环体
|
|||
type LoopStruct struct { |
|||
publicmethod.PublicId |
|||
Child []LoopStruct `json:"child"` |
|||
} |
|||
@ -0,0 +1,16 @@ |
|||
package departmentweb |
|||
|
|||
import ( |
|||
"key_performance_indicators/overall/publicmethod" |
|||
|
|||
"github.com/gin-gonic/gin" |
|||
) |
|||
|
|||
type ApiMethod struct{} |
|||
|
|||
// 部门考核WEB端入口
|
|||
func (a *ApiMethod) Index(c *gin.Context) { |
|||
outputCont := publicmethod.MapOut[string]() |
|||
outputCont["index"] = "部门考核WEB端入口" |
|||
publicmethod.Result(0, outputCont, c) |
|||
} |
|||
@ -1,9 +1,19 @@ |
|||
package version1 |
|||
|
|||
import "key_performance_indicators/api/version1/honoraryArchives" |
|||
import ( |
|||
"key_performance_indicators/api/version1/departmentseting/departmentpc" |
|||
"key_performance_indicators/api/version1/departmentseting/departmentweb" |
|||
"key_performance_indicators/api/version1/honoraryArchives" |
|||
"key_performance_indicators/api/version1/postseting/postpc" |
|||
"key_performance_indicators/api/version1/postseting/postweb" |
|||
) |
|||
|
|||
type ApiEntry struct { |
|||
HonorsApi honoraryArchives.ApiMethod |
|||
PostPcApi postpc.ApiMethod |
|||
PostWebApi postweb.ApiMethod |
|||
DeparmentPcApi departmentpc.ApiMethod |
|||
DeparmentWebApi departmentweb.ApiMethod |
|||
} |
|||
|
|||
var AppApiEntry = new(ApiEntry) |
|||
|
|||
@ -0,0 +1,685 @@ |
|||
package postpc |
|||
|
|||
import ( |
|||
"encoding/json" |
|||
"fmt" |
|||
"key_performance_indicators/models/modelshr" |
|||
"key_performance_indicators/models/modelskpi" |
|||
"key_performance_indicators/overall" |
|||
"key_performance_indicators/overall/publicmethod" |
|||
"sort" |
|||
"strconv" |
|||
"strings" |
|||
"time" |
|||
|
|||
"github.com/gin-gonic/gin" |
|||
) |
|||
|
|||
// 获取岗位相关指标
|
|||
func (a *ApiMethod) GetPostAboutTarget(c *gin.Context) { |
|||
var receivedValue publicmethod.PublicId |
|||
err := c.ShouldBindJSON(&receivedValue) |
|||
if err != nil { |
|||
publicmethod.Result(100, err, c) |
|||
return |
|||
} |
|||
//获取岗位相关信息
|
|||
var postCont modelshr.Position |
|||
postContErr := postCont.GetCont(map[string]interface{}{"`id`": receivedValue.Id}, "`id`", "`duties`", "`administrative_organization`", "`superior`", "`department`") |
|||
if postContErr != nil { |
|||
publicmethod.Result(107, postContErr, c) |
|||
return |
|||
} |
|||
//根据维度生成方案列表
|
|||
//1、获取维度
|
|||
var dimensionModels modelskpi.DutyClass |
|||
dimensionList, dimeErr := dimensionModels.ContMap(map[string]interface{}{"`state`": 1}, "`id`", "`title`", "`sort`") |
|||
fmt.Printf("dimensionList--->%v\n", dimensionList) |
|||
if dimeErr != nil || len(dimensionList) <= 0 { |
|||
publicmethod.Result(107, postContErr, c) |
|||
return |
|||
} |
|||
//2、根据维度获取岗位相关指标
|
|||
var postPlanSync postDimeTarSync |
|||
for _, v := range dimensionList { |
|||
syncSeting.Add(1) |
|||
go postPlanSync.GetPostTargent(postCont, v) |
|||
} |
|||
syncSeting.Wait() |
|||
planAry := postPlanSync.readDataLock() //读取线程通道数据
|
|||
if len(planAry) < 1 { |
|||
publicmethod.Result(1, planAry, c, "该岗位没有设定专属指标!您可以从部门指标中引入!") |
|||
return |
|||
} |
|||
//根据维度序号排序
|
|||
sort.Slice(planAry, func(i, j int) bool { |
|||
return planAry[i].Sort < planAry[j].Sort |
|||
}) |
|||
publicmethod.Result(0, planAry, c) |
|||
} |
|||
|
|||
// 获取岗位与维度相关的指标
|
|||
/* |
|||
@position 岗位信息 |
|||
@dutyClass 维度信息 |
|||
*/ |
|||
func (p *postDimeTarSync) GetPostTargent(position modelshr.Position, dutyClass modelskpi.DutyClass) { |
|||
p.mutext.Lock() |
|||
defer p.mutext.Unlock() |
|||
//获取相关指标
|
|||
var postTargetList []modelskpi.PostTarget |
|||
postTarErr := overall.CONSTANT_DB_KPI.Model(&modelskpi.PostTarget{}).Where("`state` = 1 AND `dimension` = ? AND `rele_depart` = ? AND FIND_IN_SET(?,`departments_post`)", dutyClass.Id, position.AdministrativeOrganization, position.Id).Find(&postTargetList).Error |
|||
fmt.Printf("postTargetList---->%v\n", postTargetList) |
|||
if postTarErr == nil && len(postTargetList) > 0 { |
|||
var planCont postAboutDimeTar |
|||
planCont.Id = strconv.FormatInt(dutyClass.Id, 10) |
|||
planCont.Name = dutyClass.Title |
|||
planCont.Sort = dutyClass.Sort |
|||
for _, v := range postTargetList { |
|||
var targetCont postAboutTarget |
|||
targetCont.Id = strconv.FormatInt(v.Id, 10) |
|||
targetCont.Name = v.Title |
|||
targetCont.Content = "" //指标描述
|
|||
targetCont.StandardScore = getPostDimeTarWeight(position.AdministrativeOrganization, position.Id, dutyClass.Id, v.Id, 1, 1) //标准分
|
|||
targetCont.Unit = v.Unit //单位
|
|||
targetCont.IsTrue = 2 //是否允许修改 1:不允许;2:允许
|
|||
targetCont.State = 1 //状态 1:启用;2:禁用;3:观察
|
|||
|
|||
planCont.Child = append(planCont.Child, targetCont) |
|||
} |
|||
p.planList = append(p.planList, planCont) |
|||
} |
|||
syncSeting.Done() |
|||
} |
|||
|
|||
/* |
|||
获取岗位考核指标或维度标准分 |
|||
@orgid 行政组织 |
|||
@postid 岗位 |
|||
@dimensionid 维度 |
|||
@targetid 指标 |
|||
@hierarchy 1:维度;2:指标 |
|||
@isQuote 1:不是引用;2:引用部门 |
|||
getPostDimeTarWeight(orgid, postid, dimensionid, targetid int64, hierarchy, isQuote int) |
|||
*/ |
|||
func getPostDimeTarWeight(orgid, postid, dimensionid, targetid int64, hierarchy, isQuote int) int64 { |
|||
if hierarchy == 0 { |
|||
hierarchy = 2 |
|||
} |
|||
where := publicmethod.MapOut[string]() |
|||
where["orgid"] = orgid |
|||
where["postid"] = postid |
|||
where["dimension"] = dimensionid |
|||
var ddpwCont modelskpi.DepartDimePostWeight |
|||
if hierarchy == 1 { |
|||
where["hierarchy"] = 1 |
|||
// ddpwCont.GetCont(map[string]interface{}{"orgid": orgid, "postid": postid, "dimension": dimensionid, "hierarchy": 1}, "`weight`")
|
|||
ddpwCont.GetCont(where, "`weight`") |
|||
} else { |
|||
where["target"] = targetid |
|||
where["hierarchy"] = 2 |
|||
// ddpwCont.GetCont(map[string]interface{}{"orgid": orgid, "postid": postid, "dimension": dimensionid, "target": targetid, "hierarchy": 2}, "`weight`")
|
|||
ddpwCont.GetCont(where, "`weight`") |
|||
} |
|||
return ddpwCont.Weight |
|||
} |
|||
|
|||
// 引用指标部门指标
|
|||
func (a *ApiMethod) QuoteDepartmentTarget(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, err, c) |
|||
return |
|||
} |
|||
//获取维度
|
|||
var dimenId []int64 |
|||
err = overall.CONSTANT_DB_KPI.Model(&modelskpi.TargetDepartment{}).Distinct("`dimension_id`").Where("`state` = 1 AND `level` = 2 AND `post_id` = ?", receivedValue.Id).Find(&dimenId).Error |
|||
if err != nil || len(dimenId) < 1 { |
|||
publicmethod.Result(107, err, c) |
|||
return |
|||
} |
|||
var targetlist postDimeTarSync |
|||
//获取指标列表
|
|||
for _, v := range dimenId { |
|||
syncSeting.Add(1) |
|||
go targetlist.getPostQuoteDepartmentTarget(v, receivedValue.Id) |
|||
} |
|||
syncSeting.Wait() |
|||
planAry := targetlist.readDataLock() //读取线程通道数据
|
|||
if len(planAry) < 1 { |
|||
publicmethod.Result(1, planAry, c, "该岗位没有设定部门指标引入项!") |
|||
return |
|||
} |
|||
//根据维度序号排序
|
|||
sort.Slice(planAry, func(i, j int) bool { |
|||
return planAry[i].Sort < planAry[j].Sort |
|||
}) |
|||
publicmethod.Result(0, planAry, c) |
|||
} |
|||
|
|||
/* |
|||
获取岗位引入部门指标的列表 |
|||
@dimensionId 维度 |
|||
@postId 岗位 |
|||
*/ |
|||
func (p *postDimeTarSync) getPostQuoteDepartmentTarget(dimensionId int64, postId string) { |
|||
p.mutext.Lock() |
|||
defer p.mutext.Unlock() |
|||
|
|||
var listCont postAboutDimeTar |
|||
//获取维度信息
|
|||
var dimenCont modelskpi.DutyClass |
|||
dimenCont.GetCont(map[string]interface{}{"`id`": dimensionId}, "`title`", `sort`) |
|||
listCont.Id = strconv.FormatInt(dimensionId, 10) |
|||
listCont.Name = dimenCont.Title |
|||
listCont.Sort = dimenCont.Sort |
|||
//获取岗位信息
|
|||
var postCont modelshr.Position |
|||
postCont.GetCont(map[string]interface{}{"`id`": postId}, "`id`", "`administrative_organization`") |
|||
|
|||
var targetId []int64 |
|||
overall.CONSTANT_DB_KPI.Model(&modelskpi.TargetDepartment{}).Distinct("`target_id`").Where("`state` = 1 AND `level` = 2 AND `dimension_id` = ? AND `post_id` = ?", dimensionId, postId).Find(&targetId) |
|||
if len(targetId) > 0 { |
|||
//获取指标信息
|
|||
var targetList []modelskpi.EvaluationTarget |
|||
overall.CONSTANT_DB_KPI.Model(&modelskpi.EvaluationTarget{}).Where("`et_state` = 1 AND `et_id` IN ?", targetId).Find(&targetList) |
|||
if len(targetList) > 0 { |
|||
for _, v := range targetList { |
|||
var targetCont postAboutTarget |
|||
targetCont.Id = strconv.FormatInt(v.Id, 10) |
|||
targetCont.Name = v.Title |
|||
targetCont.Content = "" //指标描述
|
|||
targetCont.StandardScore = getPostDimeTarWeight(postCont.AdministrativeOrganization, postCont.Id, dimensionId, v.Id, 2, 2) //标准分
|
|||
targetCont.Unit = v.Uniteing //单位
|
|||
targetCont.IsTrue = 2 //是否允许修改 1:不允许;2:允许
|
|||
targetCont.State = 1 //状态 1:启用;2:禁用;3:观察
|
|||
targetCont.Type = v.Type |
|||
if v.Type == 1 { |
|||
detaildList := getQuoteTargetDepartList(dimensionId, v.Id, postCont.Id) |
|||
if len(detaildList) > 0 { |
|||
targetCont.Child = detaildList |
|||
listCont.Child = append(listCont.Child, targetCont) |
|||
} |
|||
} else { |
|||
listCont.Child = append(listCont.Child, targetCont) |
|||
} |
|||
|
|||
} |
|||
|
|||
} |
|||
|
|||
} |
|||
if len(listCont.Child) > 0 { |
|||
p.planList = append(p.planList, listCont) |
|||
} |
|||
|
|||
jsonStr, _ := json.Marshal(listCont) |
|||
fmt.Printf("jsonStr------->%v\n", string(jsonStr)) |
|||
syncSeting.Done() |
|||
} |
|||
|
|||
// 获取部门引用关联指标细则
|
|||
func getQuoteTargetDepartList(dimensionId, targetId, postId int64) (listCont []quoteDeatinDeparment) { |
|||
var detaildId []int64 |
|||
overall.CONSTANT_DB_KPI.Model(&modelskpi.TargetDepartment{}).Distinct("`target_bylaws`").Where("`state` = 1 AND `level` = 2 AND `dimension_id` = ? AND `target_id` = ? AND `post_id` = ? AND `target_bylaws` <> 0", dimensionId, targetId, postId).Find(&detaildId) |
|||
if len(detaildId) < 1 { |
|||
return |
|||
} |
|||
var detaildList []modelskpi.DetailedTarget |
|||
overall.CONSTANT_DB_KPI.Model(&modelskpi.DetailedTarget{}).Select("`dt_id`,`dt_title`,`dt_content`,`dt_min_score`,`dt_max_score`").Where("`dt_state` = 1 AND `dt_id` IN ?", detaildId).Find(&detaildList) |
|||
if len(detaildList) < 1 { |
|||
return |
|||
} |
|||
for _, v := range detaildList { |
|||
var contList quoteDeatinDeparment |
|||
contList.Id = strconv.FormatInt(v.Id, 10) |
|||
contList.Name = v.Title |
|||
biaoZhun := "" |
|||
if v.MinScore != 0 { |
|||
biaoZhun = fmt.Sprintf("%v-%v", v.MinScore, v.MaxScore) |
|||
} else { |
|||
biaoZhun = fmt.Sprintf("%v", v.MaxScore) |
|||
} |
|||
contList.ReferenceScore = biaoZhun |
|||
listCont = append(listCont, contList) |
|||
} |
|||
fmt.Println("----------------->") |
|||
return |
|||
} |
|||
|
|||
// 提交岗位考核方案
|
|||
func (a *ApiMethod) SubmitPostScheme(c *gin.Context) { |
|||
var receivedValue postScheme |
|||
c.ShouldBindJSON(&receivedValue) |
|||
if receivedValue.OrgId == "" { |
|||
publicmethod.Result(101, receivedValue.OrgId, c, "请指定行政组织ID") |
|||
return |
|||
} |
|||
if receivedValue.PostId == "" { |
|||
publicmethod.Result(101, receivedValue.PostId, c, "请指定行政组织ID") |
|||
return |
|||
} |
|||
if receivedValue.Year == "" { |
|||
publicmethod.Result(101, receivedValue.Year, c, "请指定方案属于哪一年的?") |
|||
return |
|||
} |
|||
if len(receivedValue.PostChild) < 1 && len(receivedValue.DepartmentChild) < 1 { |
|||
publicmethod.Result(1, receivedValue, c, "考核项目不能为空!") |
|||
return |
|||
} |
|||
orderIdInt, _ := strconv.ParseInt(receivedValue.OrgId, 10, 64) |
|||
//根据行政组织Id获取集团信息,及部门信息
|
|||
groupId, companyId, departmentId, sunDepartId, workShopId := publicmethod.GetOrgStructure(orderIdInt) |
|||
//获取公司首字母
|
|||
var companyCont modelshr.AdministrativeOrganization |
|||
companyCont.GetCont(map[string]interface{}{"`id`": companyId}, "`name`", "`abbreviation`") |
|||
firstNameWord := companyCont.Abbreviation |
|||
if firstNameWord == "" { |
|||
firstNameWord = companyCont.Name |
|||
} |
|||
companyFirstWord := publicmethod.ChineseFirstWordCapitalize(firstNameWord) //公司首字母
|
|||
//获取部门首字母
|
|||
var departmentCont modelshr.AdministrativeOrganization |
|||
departmentCont.GetCont(map[string]interface{}{"`id`": departmentId}, "`name`", "`abbreviation`") |
|||
firstNameWordDepart := departmentCont.Abbreviation |
|||
if firstNameWordDepart == "" { |
|||
firstNameWordDepart = departmentCont.Name |
|||
} |
|||
departmentFirstWord := publicmethod.ChineseFirstWordCapitalize(firstNameWordDepart) //部门首字母
|
|||
|
|||
judgeState := 1 //方案初始状态
|
|||
//判断该岗位是否有生成的考核方案
|
|||
var versionState []int |
|||
overall.CONSTANT_DB_KPI.Model(&modelskpi.PositionPlanVersio{}).Select("state").Where("`group` = ? AND `department` = ? AND `orgid` = ? AND `position` = ?", companyId, departmentId, orderIdInt, receivedValue.PostId).Find(&versionState) |
|||
fmt.Printf("versionState----------->%v------------>%v\n", len(versionState), versionState) |
|||
if len(versionState) > 0 { |
|||
for _, s_v := range versionState { |
|||
if s_v == 1 { |
|||
judgeState = 2 |
|||
} |
|||
} |
|||
} |
|||
var versioNum string //版本号
|
|||
//判断年度是否存在版本
|
|||
var sumVerson int64 |
|||
judgeVersioNum := overall.CONSTANT_DB_KPI.Model(&modelskpi.PositionPlanVersio{}).Select("`id`").Where("`group` = ? AND `department` = ? AND `years` = ?", companyId, departmentId, receivedValue.Year).Pluck("COALESCE(COUNT(id), 0) as countid", &sumVerson).Error |
|||
if judgeVersioNum != nil { |
|||
versioNum = "0001" |
|||
} else { |
|||
if sumVerson == 0 { |
|||
versioNum = "0001" |
|||
} else { |
|||
sumVerson++ |
|||
sumVersonStr := strconv.FormatInt(sumVerson, 10) |
|||
versioNum = publicmethod.ZeroFillByStr(sumVersonStr, 4, true) |
|||
} |
|||
} |
|||
todyTime := time.Now().Unix() |
|||
versionNumber := fmt.Sprintf("%v-%v-%v%v", companyFirstWord, departmentFirstWord, publicmethod.UnixTimeToDay(todyTime, 21), versioNum) |
|||
postIdInt, _ := strconv.ParseInt(receivedValue.PostId, 10, 64) //岗位id转成整形
|
|||
yearInt, _ := strconv.ParseInt(receivedValue.Year, 10, 64) |
|||
|
|||
jsonPlanCont, _ := json.Marshal(receivedValue) |
|||
//准备写入方案
|
|||
var postPlanScheme modelskpi.PositionPlanVersio |
|||
|
|||
postPlanScheme.Group = companyId //归属集团"`
|
|||
postPlanScheme.Department = departmentId //归属部门"`
|
|||
postPlanScheme.OrgId = orderIdInt //行政组织"`
|
|||
postPlanScheme.Position = postIdInt //归属岗位"`
|
|||
postPlanScheme.Key = versionNumber //编码"`
|
|||
postPlanScheme.Versio = versioNum //版本号"`
|
|||
postPlanScheme.Year = yearInt //年度"`
|
|||
postPlanScheme.State = judgeState //状态(1:启用;2:禁用;3:删除)"`
|
|||
postPlanScheme.AddTime = todyTime //创建时间"`
|
|||
postPlanScheme.EiteTime = todyTime //修改时间"`
|
|||
postPlanScheme.Content = string(jsonPlanCont) //版本内容"`
|
|||
|
|||
err := overall.CONSTANT_DB_KPI.Create(&postPlanScheme).Error |
|||
if err != nil { |
|||
publicmethod.Result(104, receivedValue.OrgId, c, "请检查您的数据格式!") |
|||
return |
|||
} |
|||
fmt.Printf("groupId-------->%v---->companyId-------->%v---->departmentId-------->%v---->sunDepartId-------->%v---->workShopId-------->%v---------versionNumber----------->%v---------judgeState----------->%v\n", groupId, companyId, departmentId, sunDepartId, workShopId, versionNumber, judgeState) |
|||
|
|||
//岗位指标处理
|
|||
if len(receivedValue.PostChild) > 0 { |
|||
syncSeting.Add(1) |
|||
go postSchemeTarget(versionNumber, 1, judgeState, receivedValue.PostChild, companyId, departmentId, orderIdInt, postIdInt) |
|||
} |
|||
|
|||
//引用部门指标处理
|
|||
if len(receivedValue.DepartmentChild) > 0 { |
|||
syncSeting.Add(1) |
|||
go postSchemeTarget(versionNumber, 2, judgeState, receivedValue.DepartmentChild, companyId, departmentId, orderIdInt, postIdInt) |
|||
} |
|||
syncSeting.Wait() |
|||
jsonCont, _ := json.Marshal(postPlanScheme) |
|||
publicmethod.Result(0, string(jsonCont), c) |
|||
} |
|||
|
|||
/* |
|||
岗位指标写入 |
|||
@versionNumber 方案版本号 |
|||
@source 来源(1:岗位;2:部门引用) |
|||
@judgeState 考核项状态 |
|||
@scheme 方案结构体 |
|||
@companyId 公司 |
|||
@departmentId 部门 |
|||
@orgid 行政组织 |
|||
@postid 岗位 |
|||
*/ |
|||
func postSchemeTarget(versionNumber string, source, judgeState int, scheme []schemeStructure, companyId, departmentId, orgid, postid int64) { |
|||
defer syncSeting.Done() |
|||
timeData := time.Now().Unix() |
|||
var saveNewData []modelskpi.QualitativeEvaluationScheme |
|||
for _, v := range scheme { //解析维度
|
|||
dimensionIdInt64, _ := strconv.ParseInt(v.Id, 10, 64) //转换维度ID
|
|||
if len(v.Child) > 0 { //判断是否有指标
|
|||
for _, cv := range v.Child { //解析指标
|
|||
targetIdInt64, _ := strconv.ParseInt(cv.Id, 10, 64) //转换指标ID
|
|||
var saveData modelskpi.QualitativeEvaluationScheme |
|||
scoringMethod := 1 |
|||
//判断计分方式
|
|||
if source != 1 { //来源于部门引用
|
|||
var departTargetInfo modelskpi.EvaluationTarget |
|||
departTargetInfo.GetCont(map[string]interface{}{"`et_id`": targetIdInt64}, "`et_scoring_method`") |
|||
if departTargetInfo.ScoringMethod != 0 { |
|||
scoringMethod = departTargetInfo.ScoringMethod |
|||
} |
|||
|
|||
} else { //来源于岗位考核
|
|||
var departPostTargetInfo modelskpi.PostTarget |
|||
departPostTargetInfo.GetCont(map[string]interface{}{"`id`": targetIdInt64}, "`scoring_method`") |
|||
if departPostTargetInfo.ScoringMethod != 0 { |
|||
scoringMethod = departPostTargetInfo.ScoringMethod |
|||
} |
|||
} |
|||
if cv.Type != 1 { //定量考核
|
|||
//判断该指标是否存在
|
|||
whereLian := publicmethod.MapOut[string]() |
|||
whereLian["`version_number`"] = versionNumber |
|||
whereLian["`company_id`"] = companyId |
|||
whereLian["`department_id`"] = departmentId |
|||
whereLian["`org_id`"] = orgid |
|||
whereLian["`post_id`"] = postid |
|||
whereLian["`dimension_id`"] = dimensionIdInt64 |
|||
whereLian["`target_id`"] = targetIdInt64 |
|||
judgeLianErr := saveData.GetCont(whereLian, "`id`", "`state`") |
|||
if judgeLianErr == nil { |
|||
eidtTargetCont := publicmethod.MapOut[string]() |
|||
eidtTargetCont["`scoring_method`"] = scoringMethod |
|||
eidtTargetCont["`state`"] = judgeState |
|||
eidtTargetCont["`source`"] = source |
|||
eidtTargetCont["`run_state`"] = cv.State |
|||
eidtTargetCont["`eitetime`"] = timeData |
|||
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.DimensionId = dimensionIdInt64 //维度"`
|
|||
saveData.TargetId = targetIdInt64 //指标"`
|
|||
saveData.SonTargetId = 0 //子栏目"`
|
|||
saveData.DetailsId = 0 //细则"`
|
|||
saveData.Attribute = cv.Type //属性 1:定性考核;2:定量考核"`
|
|||
saveData.MinScore = 0 //最小分*100保存"`
|
|||
saveData.MaxScore = 0 //最大分*100保存"`
|
|||
saveData.ScoringMethod = scoringMethod //计分方式(1:自动;2:手动)"`
|
|||
saveData.State = judgeState //状态(1:启用;2:禁用;3:删除)"`
|
|||
saveData.Addtime = timeData //添加时间"`
|
|||
saveData.Eitetime = timeData //编辑时间"`
|
|||
saveData.CensorType = "2" //检查方式(1:现场检查;2:资料检查;3:事件触发)"`
|
|||
saveData.Source = source //来源(1:岗位;2:部门引用)"`
|
|||
saveData.RunState = cv.State //运行状态(1:启用;2:禁用;3:观察)
|
|||
saveNewData = append(saveNewData, saveData) |
|||
} |
|||
|
|||
if source != 1 { //来源于部门引用
|
|||
// fmt.Printf("启用人员管理--1--->%v--->%v--->%v--->%v\n", source, targetIdInt64, len(cv.Operator), cv.Operator)
|
|||
if len(cv.Operator) > 0 { |
|||
// fmt.Printf("启用人员管理--2--->%v\n", targetIdInt64)
|
|||
syncSetinges.Add(1) |
|||
go DepartAboutPostTargetReport(dimensionIdInt64, targetIdInt64, 0, 0, orgid, postid, cv.Operator, 2, cv.Type) |
|||
} |
|||
} |
|||
} else { //定性考核
|
|||
if len(cv.Child) > 0 { //判断是否有定性考核项目
|
|||
for _, cvt := range cv.Child { |
|||
var sonTargetIdInt64 int64 = 0 |
|||
var detailsIdInt64 int64 = 0 |
|||
//获取细则内容
|
|||
if source != 1 { //来源于部门引用
|
|||
var depatrDeatCont modelskpi.DetailedTarget |
|||
depatrDeatCont.GetCont(map[string]interface{}{"`dt_id`": cvt.Id}) |
|||
sonTargetIdInt64 = depatrDeatCont.ParentIdSun |
|||
detailsIdInt64 = depatrDeatCont.Id |
|||
} else { //来源于岗位考核
|
|||
var depatrDeatCont modelskpi.PostTargetDetails |
|||
depatrDeatCont.GetCont(map[string]interface{}{"`id`": cvt.Id}) |
|||
sonTargetIdInt64 = depatrDeatCont.ParentIdSun |
|||
detailsIdInt64 = depatrDeatCont.Id |
|||
} |
|||
//判断该细则是否存在
|
|||
whereLian := publicmethod.MapOut[string]() |
|||
whereLian["`version_number`"] = versionNumber |
|||
whereLian["`company_id`"] = companyId |
|||
whereLian["`department_id`"] = departmentId |
|||
whereLian["`org_id`"] = orgid |
|||
whereLian["`post_id`"] = postid |
|||
whereLian["`dimension_id`"] = dimensionIdInt64 |
|||
whereLian["`target_id`"] = targetIdInt64 |
|||
whereLian["`son_target_id`"] = sonTargetIdInt64 |
|||
whereLian["`details_id`"] = detailsIdInt64 |
|||
judgeLianErr := saveData.GetCont(whereLian, "`id`", "`state`") |
|||
if judgeLianErr == nil { |
|||
eidtTargetCont := publicmethod.MapOut[string]() |
|||
eidtTargetCont["`scoring_method`"] = scoringMethod |
|||
eidtTargetCont["`state`"] = judgeState |
|||
eidtTargetCont["`source`"] = source |
|||
eidtTargetCont["`run_state`"] = cv.State |
|||
eidtTargetCont["`eitetime`"] = timeData |
|||
saveData.EiteCont(map[string]interface{}{"`id`": saveData.Id}, eidtTargetCont) |
|||
} else { //不存在需要新增
|
|||
var minScoreInt int64 = 0 |
|||
var maxScoreInt int64 = 0 |
|||
scoreAry := strings.Split(cvt.ReferenceScore, "-") |
|||
scoreLen := len(scoreAry) |
|||
if scoreLen > 0 { |
|||
if scoreLen == 1 { |
|||
maxScore, _ := strconv.ParseFloat(scoreAry[0], 64) |
|||
maxScoreInt, _ = strconv.ParseInt(strconv.FormatFloat(maxScore*100, 'f', -1, 64), 10, 64) |
|||
minScoreInt = 0 |
|||
} else { |
|||
minScore, _ := strconv.ParseFloat(scoreAry[0], 64) |
|||
maxScore, _ := strconv.ParseFloat(scoreAry[scoreLen-1], 64) |
|||
minScoreInt, _ = strconv.ParseInt(strconv.FormatFloat(minScore*100, 'f', -1, 64), 10, 64) |
|||
maxScoreInt, _ = strconv.ParseInt(strconv.FormatFloat(maxScore*100, 'f', -1, 64), 10, 64) |
|||
} |
|||
} |
|||
|
|||
saveData.VersionNumber = versionNumber //版本编号"`
|
|||
saveData.CompanyId = companyId //归属公司"`
|
|||
saveData.DepartmentId = departmentId //归属部门"`
|
|||
saveData.OrgId = orgid //归属行政组织"`
|
|||
saveData.PostId = postid //归属岗位"`
|
|||
saveData.Title = cv.Name //考核项名称"`
|
|||
saveData.DimensionId = dimensionIdInt64 //维度"`
|
|||
saveData.TargetId = targetIdInt64 //指标"`
|
|||
saveData.SonTargetId = sonTargetIdInt64 //子栏目"`
|
|||
saveData.DetailsId = detailsIdInt64 //细则"`
|
|||
saveData.Attribute = cv.Type //属性 1:定性考核;2:定量考核"`
|
|||
saveData.MinScore = minScoreInt //最小分*100保存"`
|
|||
saveData.MaxScore = maxScoreInt //最大分*100保存"`
|
|||
saveData.ScoringMethod = scoringMethod //计分方式(1:自动;2:手动)"`
|
|||
saveData.State = judgeState //状态(1:启用;2:禁用;3:删除)"`
|
|||
saveData.Addtime = timeData //添加时间"`
|
|||
saveData.Eitetime = timeData //编辑时间"`
|
|||
saveData.CensorType = "2" //检查方式(1:现场检查;2:资料检查;3:事件触发)"`
|
|||
saveData.Source = source //来源(1:岗位;2:部门引用)"`
|
|||
saveData.RunState = cv.State //运行状态(1:启用;2:禁用;3:观察)
|
|||
saveNewData = append(saveNewData, saveData) |
|||
} |
|||
|
|||
if source != 1 { //来源于部门引用
|
|||
// fmt.Printf("启用人员管理--3--->%v--->%v--->%v--->%v\n", source, targetIdInt64, len(cv.Operator), cv.Operator)
|
|||
if len(cvt.Operator) > 0 { |
|||
// fmt.Printf("启用人员管理--4--->%v--->%v\n", targetIdInt64, detailsIdInt64)
|
|||
syncSetinges.Add(1) |
|||
go DepartAboutPostTargetReport(dimensionIdInt64, targetIdInt64, sonTargetIdInt64, detailsIdInt64, orgid, postid, cvt.Operator, 2, cv.Type) |
|||
} |
|||
} |
|||
|
|||
} |
|||
} |
|||
} |
|||
|
|||
} |
|||
} |
|||
|
|||
} |
|||
if len(saveNewData) > 0 { |
|||
overall.CONSTANT_DB_KPI.Create(&saveNewData) |
|||
} |
|||
syncSetinges.Wait() |
|||
} |
|||
|
|||
/* |
|||
协程处理 |
|||
|
|||
部门指标岗位提报人关联通用函数 |
|||
@dimensionId 维度 |
|||
@targetId 指标ID |
|||
@targetSunId 栏目ID |
|||
@bylawsId 指标细则 |
|||
@departmentId 接受考核部门 |
|||
@postId 岗位 |
|||
@repart 提报人 |
|||
@class 级别(1:部门级;2:岗位级) |
|||
@nature 1:定性考核;2:定量考核 |
|||
func departAboutPostTargetReport(dimensionId, targetId, targetSunId, bylawsId, departmentId, postId int64, repart []loopStruct, class, nature int) |
|||
*/ |
|||
func DepartAboutPostTargetReport(dimensionId, targetId, targetSunId, bylawsId, departmentId, postId int64, repart []string, class, nature int) { |
|||
defer syncSetinges.Done() |
|||
// fmt.Printf("启用人员管理----->%v\n", targetId)
|
|||
//将不属于该指标细则的部门至禁用
|
|||
otherSaveData := publicmethod.MapOut[string]() |
|||
otherSaveData["`state`"] = 2 |
|||
otherSaveData["`time`"] = time.Now().Unix() |
|||
|
|||
where := publicmethod.MapOut[string]() |
|||
where["`type`"] = class |
|||
if targetId != 0 { |
|||
where["`target_id`"] = targetId |
|||
} |
|||
if targetSunId != 0 { |
|||
where["`target_sun_id`"] = targetSunId |
|||
} |
|||
if bylawsId != 0 { |
|||
where["`target_bylaws`"] = bylawsId |
|||
} |
|||
if departmentId != 0 { |
|||
where["`department_id`"] = departmentId |
|||
} |
|||
if postId != 0 { |
|||
where["`post_id`"] = postId |
|||
} |
|||
if len(repart) < 1 { |
|||
overall.CONSTANT_DB_KPI.Model(&modelskpi.TargetReport{}).Where(where).Updates(&otherSaveData) |
|||
} else { |
|||
//获取关联的人员
|
|||
var userKeyAbout []string |
|||
for _, v := range repart { |
|||
if publicmethod.IsInTrue[string](v, userKeyAbout) == false { |
|||
userKeyAbout = append(userKeyAbout, v) |
|||
|
|||
//获取评价人部门
|
|||
var manCont modelshr.PersonArchives |
|||
manCont.GetCont(map[string]interface{}{"`key`": v}, "`maindeparment`") |
|||
|
|||
var tarReportCont modelskpi.TargetReport |
|||
trWhere := publicmethod.MapOut[string]() |
|||
trWhere["`man_key`"] = v |
|||
trWhere["`type`"] = class |
|||
if targetId != 0 { |
|||
trWhere["`target_id`"] = targetId |
|||
} |
|||
if targetSunId != 0 { |
|||
trWhere["`target_sun_id`"] = targetSunId |
|||
} |
|||
if bylawsId != 0 { |
|||
trWhere["`target_bylaws`"] = bylawsId |
|||
} |
|||
if departmentId != 0 { |
|||
trWhere["`department_id`"] = departmentId |
|||
} |
|||
if postId != 0 { |
|||
trWhere["`post_id`"] = postId |
|||
} |
|||
saveErr := tarReportCont.GetCont(trWhere, "`id`", "`state`") |
|||
if saveErr == nil { |
|||
if tarReportCont.State != 1 { |
|||
|
|||
tarReportCont.EiteCont(map[string]interface{}{"`id`": tarReportCont.Id}, map[string]interface{}{"`state`": 1, "`dimension_id`": dimensionId, "`man_department`": manCont.MainDeparment, "`time`": time.Now().Unix()}) |
|||
} |
|||
} else { |
|||
xiZe := 3 |
|||
if targetId != 0 && targetSunId != 0 && bylawsId == 0 { |
|||
xiZe = 2 |
|||
} else if targetId != 0 && targetSunId == 0 && bylawsId == 0 { |
|||
xiZe = 1 |
|||
} |
|||
tarReportCont.Dimension = dimensionId |
|||
tarReportCont.TargetId = targetId //指标ID"`
|
|||
tarReportCont.TargetSunId = targetSunId //子目标"`
|
|||
tarReportCont.TargetBylaws = bylawsId //指标细则"`
|
|||
tarReportCont.DepartmentId = departmentId //部门ID"`
|
|||
tarReportCont.PostId = postId //岗位ID"`
|
|||
tarReportCont.Type = class //类型(1:公司级;2:部门级)"`
|
|||
tarReportCont.State = 1 //状态(1:启用;2:禁用;3:删除)"`
|
|||
reportId, _ := strconv.ParseInt(v, 10, 64) |
|||
tarReportCont.ReportPerson = reportId //上报人"`
|
|||
tarReportCont.ManDepartment = manCont.MainDeparment //提报人所在部门"`
|
|||
tarReportCont.Time = time.Now().Unix() //写入时间"`
|
|||
tarReportCont.Class = nature //1:定性考核;2:定量考核"`
|
|||
tarReportCont.Level = xiZe //1:指标;2:子目标;3:细则
|
|||
overall.CONSTANT_DB_KPI.Create(&tarReportCont) |
|||
} |
|||
|
|||
} |
|||
} |
|||
//清除不需要提报的人员
|
|||
// if len(userKeyAbout) > 0 {
|
|||
// overall.CONSTANT_DB_KPI.Model(&modelskpi.TargetReport{}).Where(where).Not(map[string]interface{}{"man_key": userKeyAbout}).Updates(&otherSaveData)
|
|||
// }
|
|||
} |
|||
} |
|||
|
|||
// 获取岗位方案内容列表
|
|||
func (a *ApiMethod) GetPostScheme(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, err, c) |
|||
return |
|||
} |
|||
//获取维度
|
|||
var schemeCont modelskpi.PositionPlanVersio |
|||
err = overall.CONSTANT_DB_KPI.Where("`id` = ?", receivedValue.Id).Find(&schemeCont).Error |
|||
if err != nil { |
|||
publicmethod.Result(107, err, c) |
|||
return |
|||
} |
|||
} |
|||
@ -0,0 +1,106 @@ |
|||
package postpc |
|||
|
|||
import ( |
|||
"key_performance_indicators/overall/publicmethod" |
|||
"sync" |
|||
|
|||
"github.com/gin-gonic/gin" |
|||
) |
|||
|
|||
type ApiMethod struct{} |
|||
|
|||
// 协程设置
|
|||
var syncSeting = sync.WaitGroup{} |
|||
var syncSetinges = sync.WaitGroup{} |
|||
|
|||
// 岗位指标协程操作
|
|||
type postDimeTarSync struct { |
|||
planList []postAboutDimeTar |
|||
mutext sync.RWMutex |
|||
} |
|||
|
|||
// 读取岗位指标协程数据
|
|||
func (d *postDimeTarSync) readDataLock() []postAboutDimeTar { |
|||
d.mutext.RLock() |
|||
defer d.mutext.RUnlock() |
|||
return d.planList |
|||
} |
|||
|
|||
// 岗位考核PC端入口
|
|||
func (a *ApiMethod) Index(c *gin.Context) { |
|||
outputCont := publicmethod.MapOut[string]() |
|||
outputCont["index"] = "岗位考核PC端入口" |
|||
publicmethod.Result(0, outputCont, c) |
|||
} |
|||
|
|||
// 获取岗位相关指标
|
|||
type postAboutTarget struct { |
|||
publicmethod.PublicId |
|||
publicmethod.PublicName //指标名称
|
|||
Content string `json:"content"` //指标描述
|
|||
StandardScore int64 `json:"standardscore"` //标准分
|
|||
Unit string `json:"unit"` //单位
|
|||
IsTrue int `json:"istrue"` //是否允许修改 1:不允许;2:允许
|
|||
State int `json:"state"` //状态 1:启用;2:禁用;3:观察
|
|||
Type int `json:"type"` //1:定性考核;2:定量考核
|
|||
Child []quoteDeatinDeparment `json:"child"` //指标细则列表
|
|||
} |
|||
|
|||
// 岗位相关维度指标列表
|
|||
type postAboutDimeTar struct { |
|||
publicmethod.PublicId |
|||
publicmethod.PublicName //维度名称
|
|||
Sort int `json:"sort"` //排序
|
|||
Child []postAboutTarget `json:"child"` //指标列表
|
|||
} |
|||
|
|||
// 引用部门定性考核细则列表
|
|||
type quoteDeatinDeparment struct { |
|||
publicmethod.PublicId |
|||
publicmethod.PublicName //细则
|
|||
ReferenceScore string `json:"referencescore"` //考核标准
|
|||
} |
|||
|
|||
// 岗位考核方案
|
|||
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 //名称
|
|||
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 postSchemeList struct { |
|||
publicmethod.PagesTurn |
|||
VersionNumber string `json:"versionnumber"` //版本号
|
|||
} |
|||
@ -0,0 +1,16 @@ |
|||
package postweb |
|||
|
|||
import ( |
|||
"key_performance_indicators/overall/publicmethod" |
|||
|
|||
"github.com/gin-gonic/gin" |
|||
) |
|||
|
|||
type ApiMethod struct{} |
|||
|
|||
// 岗位考核WEB端入口
|
|||
func (a *ApiMethod) Index(c *gin.Context) { |
|||
outputCont := publicmethod.MapOut[string]() |
|||
outputCont["index"] = "岗位考核WEB端入口" |
|||
publicmethod.Result(0, outputCont, c) |
|||
} |
|||
@ -0,0 +1,45 @@ |
|||
package departmentseting |
|||
|
|||
import ( |
|||
"key_performance_indicators/api/version1" |
|||
|
|||
"github.com/gin-gonic/gin" |
|||
) |
|||
|
|||
// 部门考核PC端
|
|||
func (a *ApiRouter) RouterGroupPc(router *gin.RouterGroup) { |
|||
apiRouter := router.Group("department_pc") |
|||
|
|||
var methodBinding = version1.AppApiEntry.DeparmentPcApi |
|||
{ |
|||
apiRouter.GET("", methodBinding.Index) //入口
|
|||
apiRouter.POST("", methodBinding.Index) //入口
|
|||
|
|||
apiRouter.POST("departmenttargetlist", methodBinding.DepartmentTargetList) //部门指标列表
|
|||
apiRouter.POST("shiyan", methodBinding.Shiyan) //实验
|
|||
apiRouter.POST("getdepartabouttarget", methodBinding.GetDepartAboutTarget) //获取部门定性考核部门关联列表
|
|||
apiRouter.POST("gettargetreport", methodBinding.GetTargetReport) //获取部门指标相关执行人
|
|||
|
|||
apiRouter.POST("addsuntargetdetailed", methodBinding.AddSunTargetDetailed) //添加定性考核子栏目及细则
|
|||
apiRouter.POST("getdepartmenttragetcontlist", methodBinding.GetDepartmentTragetContList) //获取定性考核指标列表内容
|
|||
apiRouter.POST("basissontargetadddetailed", methodBinding.BasisSonTargetAddDetailed) //根据指标栏目新增指标细则
|
|||
apiRouter.POST("basistargetdearpetmentgetpost", methodBinding.BasisTargetDearpetmentGetPost) //根据指标和部门获取相关岗位
|
|||
apiRouter.POST("basistaegetdeparmentreport", methodBinding.BasisTaegetDeparmentReport) //获取部门指标岗位提交人
|
|||
|
|||
apiRouter.POST("editsontargetdepartmentreport", methodBinding.EditSonTargetDepartmentReport) //修改子栏目标题名称级考核关联部门及提报人
|
|||
apiRouter.POST("getsontargetcont", methodBinding.GetSonTargetCont) //获取子栏目基础信息
|
|||
apiRouter.POST("delsontarget", methodBinding.DelSonTarget) //删除子栏目
|
|||
|
|||
apiRouter.POST("getonedetailedtarget", methodBinding.GetOneDetailedTarget) //获取单一指标细则内容
|
|||
apiRouter.POST("edit_one_detailed_target", methodBinding.EditOneDetailedTarget) //编辑单一指标细则内容
|
|||
apiRouter.POST("del_one_detailed_target", methodBinding.DelOneDetailedTarget) //删除单一指标细则
|
|||
|
|||
apiRouter.POST("add_department_target", methodBinding.AddDepartmentTarget) //添加部门指标
|
|||
apiRouter.POST("get_one_terget_info", methodBinding.GetOneTergetInfo) //获取单一指标详细内容
|
|||
apiRouter.POST("edit_one_target", methodBinding.EditOneTarget) //编辑单一部门指标
|
|||
|
|||
apiRouter.POST("deparment_target_about_post", methodBinding.DeparmentTargetAboutPost) //指标关联岗位
|
|||
apiRouter.POST("depar_son_target_about_post", methodBinding.DeparSonTargetAboutPost) //子栏目关联部门岗位
|
|||
apiRouter.POST("depar_detaile_about_post", methodBinding.DeparDetaileAboutPost) //指标细则关联部门岗位
|
|||
} |
|||
} |
|||
@ -0,0 +1,4 @@ |
|||
package departmentseting |
|||
|
|||
//部门考核
|
|||
type ApiRouter struct{} |
|||
@ -0,0 +1,19 @@ |
|||
package departmentseting |
|||
|
|||
import ( |
|||
"key_performance_indicators/api/version1" |
|||
|
|||
"github.com/gin-gonic/gin" |
|||
) |
|||
|
|||
// 部门考核web端
|
|||
func (a *ApiRouter) RouterGroupWeb(router *gin.RouterGroup) { |
|||
apiRouter := router.Group("department_web") |
|||
|
|||
var methodBinding = version1.AppApiEntry.DeparmentWebApi |
|||
{ |
|||
apiRouter.GET("", methodBinding.Index) //入口
|
|||
apiRouter.POST("", methodBinding.Index) //入口
|
|||
|
|||
} |
|||
} |
|||
@ -0,0 +1,21 @@ |
|||
package postseting |
|||
|
|||
import ( |
|||
"key_performance_indicators/api/version1" |
|||
|
|||
"github.com/gin-gonic/gin" |
|||
) |
|||
|
|||
// 岗位考核PC端
|
|||
func (a *ApiRouter) RouterGroupPc(router *gin.RouterGroup) { |
|||
apiRouter := router.Group("postpc") |
|||
|
|||
var methodBinding = version1.AppApiEntry.PostPcApi |
|||
{ |
|||
apiRouter.GET("", methodBinding.Index) //入口
|
|||
apiRouter.POST("", methodBinding.Index) //入口
|
|||
apiRouter.POST("getpostabouttarget", methodBinding.GetPostAboutTarget) //获取岗位相关指标
|
|||
apiRouter.POST("quote_department_target", methodBinding.QuoteDepartmentTarget) //引用指标部门指标
|
|||
apiRouter.POST("submit_post_scheme", methodBinding.SubmitPostScheme) //提交岗位考核方案
|
|||
} |
|||
} |
|||
@ -0,0 +1,4 @@ |
|||
package postseting |
|||
|
|||
//岗位考核
|
|||
type ApiRouter struct{} |
|||
@ -0,0 +1,18 @@ |
|||
package postseting |
|||
|
|||
import ( |
|||
"key_performance_indicators/api/version1" |
|||
|
|||
"github.com/gin-gonic/gin" |
|||
) |
|||
|
|||
// 岗位考核web端
|
|||
func (a *ApiRouter) RouterGroupWeb(router *gin.RouterGroup) { |
|||
apiRouter := router.Group("postweb") |
|||
|
|||
var methodBinding = version1.AppApiEntry.PostWebApi |
|||
{ |
|||
apiRouter.GET("", methodBinding.Index) //入口
|
|||
apiRouter.POST("", methodBinding.Index) //入口
|
|||
} |
|||
} |
|||
Binary file not shown.
@ -1,4 +1,4 @@ |
|||
package models |
|||
package modelshonory |
|||
|
|||
import ( |
|||
"key_performance_indicators/overall" |
|||
@ -1,4 +1,4 @@ |
|||
package models |
|||
package modelshonory |
|||
|
|||
import ( |
|||
"key_performance_indicators/overall" |
|||
@ -1,12 +1,17 @@ |
|||
package models |
|||
package modelshonory |
|||
|
|||
import ( |
|||
"key_performance_indicators/overall" |
|||
"strings" |
|||
) |
|||
|
|||
<<<<<<< HEAD:models/photos_gallery.go |
|||
//图片库
|
|||
type PhotosGallery struct { |
|||
======= |
|||
// 图片库
|
|||
type PhotosGallery struct { |
|||
>>>>>>> v1_dev:models/modelshonory/photos_gallery.go |
|||
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:ID"` |
|||
Url string `json:"url" gorm:"column:url;type:varchar(255) unsigned;default:'';not null;comment:图片地址"` |
|||
ImgPath string `json:"imgpath" gorm:"column:img_path;type:varchar(255) unsigned;default:'';not null;comment:物理地址"` |
|||
@ -1,4 +1,4 @@ |
|||
package models |
|||
package modelshr |
|||
|
|||
import ( |
|||
"key_performance_indicators/overall" |
|||
@ -1,4 +1,4 @@ |
|||
package models |
|||
package modelshr |
|||
|
|||
import ( |
|||
"key_performance_indicators/overall" |
|||
@ -1,4 +1,4 @@ |
|||
package models |
|||
package modelshr |
|||
|
|||
import ( |
|||
"key_performance_indicators/overall" |
|||
@ -1,4 +1,4 @@ |
|||
package models |
|||
package modelshr |
|||
|
|||
import ( |
|||
"key_performance_indicators/overall" |
|||
@ -1,4 +1,4 @@ |
|||
package models |
|||
package modelshr |
|||
|
|||
import ( |
|||
"key_performance_indicators/overall" |
|||
@ -1,4 +1,4 @@ |
|||
package models |
|||
package modelshr |
|||
|
|||
import ( |
|||
"key_performance_indicators/overall" |
|||
@ -1,4 +1,4 @@ |
|||
package models |
|||
package modelshr |
|||
|
|||
import ( |
|||
"key_performance_indicators/overall" |
|||
@ -1,4 +1,4 @@ |
|||
package models |
|||
package modelshr |
|||
|
|||
import ( |
|||
"key_performance_indicators/overall" |
|||
@ -1,4 +1,4 @@ |
|||
package models |
|||
package modelshr |
|||
|
|||
import ( |
|||
"key_performance_indicators/overall" |
|||
@ -1,4 +1,4 @@ |
|||
package models |
|||
package modelshr |
|||
|
|||
import ( |
|||
"key_performance_indicators/overall" |
|||
@ -1,4 +1,4 @@ |
|||
package models |
|||
package modelshr |
|||
|
|||
import ( |
|||
"key_performance_indicators/overall" |
|||
@ -1,4 +1,4 @@ |
|||
package models |
|||
package modelshr |
|||
|
|||
import ( |
|||
"key_performance_indicators/overall" |
|||
@ -1,4 +1,4 @@ |
|||
package models |
|||
package modelshr |
|||
|
|||
import ( |
|||
"key_performance_indicators/overall" |
|||
@ -1,4 +1,4 @@ |
|||
package models |
|||
package modelshr |
|||
|
|||
import ( |
|||
"key_performance_indicators/overall" |
|||
@ -1,4 +1,4 @@ |
|||
package models |
|||
package modelshr |
|||
|
|||
import ( |
|||
"key_performance_indicators/overall" |
|||
@ -1,4 +1,4 @@ |
|||
package models |
|||
package modelshr |
|||
|
|||
import "key_performance_indicators/overall" |
|||
|
|||
@ -1,4 +1,4 @@ |
|||
package models |
|||
package modelshr |
|||
|
|||
import ( |
|||
"key_performance_indicators/overall" |
|||
@ -1,4 +1,4 @@ |
|||
package models |
|||
package modelshr |
|||
|
|||
import ( |
|||
"key_performance_indicators/overall" |
|||
@ -1,4 +1,4 @@ |
|||
package models |
|||
package modelshr |
|||
|
|||
import ( |
|||
"key_performance_indicators/overall" |
|||
@ -1,4 +1,4 @@ |
|||
package models |
|||
package modelshr |
|||
|
|||
import "key_performance_indicators/overall" |
|||
|
|||
@ -1,4 +1,4 @@ |
|||
package models |
|||
package modelshr |
|||
|
|||
import ( |
|||
"key_performance_indicators/overall" |
|||
@ -1,4 +1,4 @@ |
|||
package models |
|||
package modelshr |
|||
|
|||
import ( |
|||
"key_performance_indicators/overall" |
|||
@ -0,0 +1,82 @@ |
|||
package modelshr |
|||
|
|||
import ( |
|||
"key_performance_indicators/overall" |
|||
"strings" |
|||
) |
|||
|
|||
type UserPostDuties struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:ID"` |
|||
Number string `json:"number" gorm:"column:number;type:varchar(30) unsigned;not null;comment:员工工号"` |
|||
Name string `json:"name" gorm:"column:name;type:varchar(255) unsigned;default:'';not null;comment:姓名"` |
|||
Icon string `json:"icon" gorm:"column:icon;type:varchar(255) unsigned;default:'';not null;comment:头像"` |
|||
Company int64 `json:"company" gorm:"column:company;type:bigint(20) unsigned;default:0;not null;comment:入职公司"` |
|||
MainDeparment int64 `json:"maindeparment" gorm:"column:maindeparment;type:bigint(20) unsigned;default:0;not null;comment:主部门"` |
|||
AdminOrg int64 `json:"adminorg" gorm:"column:admin_org;type:bigint(20) unsigned;default:0;not null;comment:所属行政组织"` |
|||
TeamId int64 `json:"teamid" gorm:"column:teamid;type:bigint(20) unsigned;default:0;not null;comment:班组"` |
|||
Position int64 `json:"position" gorm:"column:position;type:bigint(20) unsigned;default:0;not null;comment:职位"` |
|||
JobId int64 `json:"jobid" gorm:"column:job_id;type:bigint(20) unsigned;default:0;not null;comment:职务"` |
|||
JobLeve int64 `json:"jobleve" gorm:"column:job_leve;type:bigint(20) unsigned;default:0;not null;comment:职务等级"` |
|||
Wechat string `json:"wechat" gorm:"column:wechat;type:varchar(255) unsigned;default:'';not null;comment:微信UserId"` |
|||
WorkWechat string `json:"workwechat" gorm:"column:work_wechat;type:varchar(255) unsigned;default:'';not null;comment:企业微信UserId"` |
|||
Key int64 `json:"key" gorm:"column:key;type:bigint(50) unsigned;default:0;not null;comment:key"` |
|||
IsAdmin int `json:"isadmin" gorm:"column:is_admin;type:tinyint(1) unsigned;default:1;not null;comment:是否为管理员(1:不是;2:分公司;3:集团管理员;4:超级管` |
|||
Password string `json:"password" gorm:"column:password;type:varchar(255) unsigned;default:'';not null;comment:密码"` |
|||
Role string `json:"role" gorm:"column:role;type:longtext;comment:角色"` |
|||
SunMainDeparment int64 `json:"sunmaindeparment" gorm:"column:sun_main_deparment;type:bigint(20) unsigned;default:0;not null;comment:主部门"` |
|||
|
|||
Mobilephone string `json:"mobilephone" gorm:"column:mobilephone;type:varchar(50) unsigned;default:'';not null;comment:手机号码"` |
|||
Gender int `json:"gender" gorm:"column:gender;type:tinyint(1) unsigned;default:1;not null;comment:性别(1:男性;2:女性;3:中性)"` |
|||
|
|||
PostName string `json:"postname" gorm:"column:postname;type:varchar(255) unsigned;default:'';not null;comment:职位名称"` |
|||
PersonInCharge int `json:"personincharge" gorm:"column:leading_cadre;type:int(1) unsigned;default:2;not null;comment:是否为本部门负责人(1:是;2:否)"` |
|||
Superior int64 `json:"superior" gorm:"column:post_superior;type:bigint(20) unsigned;default:0;not null;comment:上级ID"` |
|||
MenuPermit string `json:"menupermit" gorm:"column:menu_permit;type:longtext;comment:菜单许可证"` |
|||
ButtonPermit string `json:"buttonpermit" gorm:"column:button_permit;type:longtext;comment:按钮许可"` |
|||
DutiesName string `json:"dutiesname" gorm:"column:duties_name;type:varchar(255) unsigned;default:'';not null;comment:职务名称"` |
|||
} |
|||
|
|||
func (UserPostDuties *UserPostDuties) TableName() string { |
|||
return "user_post_duties" |
|||
} |
|||
|
|||
// 编辑内容
|
|||
func (cont *UserPostDuties) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取内容
|
|||
func (cont *UserPostDuties) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_HR.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 *UserPostDuties) CountCont(whereMap interface{}) (countId int64) { |
|||
overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Count(&countId) |
|||
return |
|||
} |
|||
|
|||
// 读取全部信息
|
|||
func (cont *UserPostDuties) ContMap(whereMap interface{}, field ...string) (countAry []UserPostDuties, err error) { |
|||
gormDb := overall.CONSTANT_DB_HR.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
err = gormDb.Where(whereMap).Find(&countAry).Error |
|||
return |
|||
} |
|||
|
|||
// 删除内容
|
|||
func (cont *UserPostDuties) DelCont(whereMap interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_HR.Where(whereMap).Delete(&cont).Error |
|||
return |
|||
} |
|||
@ -1,4 +1,4 @@ |
|||
package models |
|||
package modelshr |
|||
|
|||
import ( |
|||
"key_performance_indicators/overall" |
|||
@ -0,0 +1,64 @@ |
|||
package modelskpi |
|||
|
|||
import ( |
|||
"key_performance_indicators/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 定性考核指标关系指定
|
|||
type Assesstarget struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:at_id;type:bigint(20) unsigned;not null;comment:Id;index"` |
|||
Group int64 `json:"group" gorm:"column:group;type:bigint(20) unsigned;default:0;not null;comment:集团ID"` |
|||
Departmentmap string `json:"departmentmap" gorm:"column:departmentmap;type:mediumtext unsigned;default:0;comment:部门ID"` |
|||
TargetId int64 `json:"targetid" gorm:"column:targetid;type:bigint(20) unsigned;default:0;not null;comment:指标"` |
|||
SunTargetId int64 `json:"suntargetid" gorm:"column:suntargetid;type:bigint(20) unsigned;default:0;not null;comment:子栏目ID"` |
|||
Content string `json:"content" gorm:"column:content;type:longtext;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:删除)"` |
|||
Dimension int64 `json:"dimension" gorm:"column:dimension;type:bigint(20) unsigned;default:0;not null;comment:维度"` |
|||
} |
|||
|
|||
func (Assesstarget *Assesstarget) TableName() string { |
|||
return "assesstarget" |
|||
} |
|||
|
|||
// 编辑内容
|
|||
func (cont *Assesstarget) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取内容
|
|||
func (cont *Assesstarget) 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 *Assesstarget) CountCont(whereMap interface{}) (countId int64) { |
|||
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId) |
|||
return |
|||
} |
|||
|
|||
// 读取全部信息
|
|||
func (cont *Assesstarget) ContMap(whereMap interface{}, field ...string) (countAry []Assesstarget, 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 *Assesstarget) DelCont(whereMap interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,65 @@ |
|||
package modelskpi |
|||
|
|||
import ( |
|||
"key_performance_indicators/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 部门考核指标权重
|
|||
type DepartDimePostWeight struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` |
|||
Type int64 `json:"type" gorm:"column:type;type:bigint(20) unsigned;default:0;not null;comment:1:定性考核;2:定量考核"` |
|||
Orgid int64 `json:"orgid" gorm:"column:orgid;type:bigint(20) unsigned;default:0;not null;comment:行政组织"` |
|||
Postid int64 `json:"postid" gorm:"column:postid;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:指标"` |
|||
Weight int64 `json:"weight" gorm:"column:weight;type:int(6) unsigned;default:0;not null;comment:权重"` |
|||
Addtime int64 `json:"addtime" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:添加时间"` |
|||
Hierarchy int64 `json:"hierarchy" gorm:"column:hierarchy;type:bigint(20) unsigned;default:0;not null;comment:维度;2:指标"` |
|||
Quote int64 `json:"quote" gorm:"column:is_quote;type:bigint(20) unsigned;default:0;not null;comment:1:不是引用;2:引用部门"` |
|||
} |
|||
|
|||
func (DepartDimePostWeight *DepartDimePostWeight) TableName() string { |
|||
return "depart_dime_post_weight" |
|||
} |
|||
|
|||
// 编辑内容
|
|||
func (cont *DepartDimePostWeight) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取内容
|
|||
func (cont *DepartDimePostWeight) 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 *DepartDimePostWeight) CountCont(whereMap interface{}) (countId int64) { |
|||
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId) |
|||
return |
|||
} |
|||
|
|||
// 读取全部信息
|
|||
func (cont *DepartDimePostWeight) ContMap(whereMap interface{}, field ...string) (countAry []DepartDimePostWeight, 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 *DepartDimePostWeight) DelCont(whereMap interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,73 @@ |
|||
package modelskpi |
|||
|
|||
import ( |
|||
"key_performance_indicators/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 指标细则
|
|||
type DetailedTarget struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:dt_id;type:bigint(20) unsigned;not null;comment:Id;index"` |
|||
Title string `json:"title" gorm:"column:dt_title;type:text;comment:指标细则"` |
|||
Content string `json:"content" gorm:"column:dt_content;type:text;comment:指标说明"` |
|||
ParentId int64 `json:"parentid" gorm:"column:dt_parentid;type:bigint(20) unsigned;default:0;not null;comment:归属指标栏目"` |
|||
ParentIdSun int64 `json:"parentidsun" gorm:"column:dt_parentid_sun;type:bigint(20) unsigned;default:0;not null;comment:归属指标子栏目"` |
|||
State int `json:"state" gorm:"column:dt_state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` |
|||
AddTime int64 `json:"addtime" gorm:"column:dt_time;type:bigint(20) unsigned;default:0;not null;comment:制定时间"` |
|||
MinScore int64 `json:"minscore" gorm:"column:dt_min_score;type:bigint(20) unsigned;default:0;not null;comment:最小分*100保存"` |
|||
MaxScore int64 `json:"maxscore" gorm:"column:dt_max_score;type:bigint(20) unsigned;default:0;not null;comment:最大分*100保存"` |
|||
Company string `json:"company" gorm:"column:dt_company;type:varchar(20) unsigned;default:0;not null;comment:单位"` |
|||
AddReduce int `json:"addreduce" gorm:"column:dt_add_reduce;type:int(1) unsigned;default:1;not null;comment:1:减少;2:增加;3:无属性,现场确认加或减"` |
|||
CensorType string `json:"censortype" gorm:"column:dt_censor_type;type:text;comment:检查方式"` |
|||
CensorCont string `json:"censorcont" gorm:"column:dt_censor_cont;type:longtext;comment:检查依据"` |
|||
CensorRate int `json:"censorrate" gorm:"column:dt_censor_rate;type:int(5) unsigned;default:1;not null;comment:检查频次"` |
|||
Cycles int `json:"cycle" gorm:"column:dt_cycle;type:tinyint(1) unsigned;default:1;not null;comment:1:班;2:天;3:周;4:月;5:季度;6:年"` |
|||
CycleAttres int `json:"cycleattr" gorm:"column:dt_cycleattr;type:int(9) unsigned;default:1;not null;comment:辅助计数"` |
|||
Paretment string `json:"paretment" gorm:"column:dt_paretment;type:longtext;comment:接受考核的部门"` |
|||
Reportary string `json:"reportary" gorm:"column:reportary;type:longtext;comment:提报人"` |
|||
} |
|||
|
|||
func (DetailedTarget *DetailedTarget) TableName() string { |
|||
return "detailed_target" |
|||
} |
|||
|
|||
// 编辑内容
|
|||
func (cont *DetailedTarget) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(&saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取内容
|
|||
func (cont *DetailedTarget) 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 *DetailedTarget) CountCont(whereMap interface{}) (countId int64) { |
|||
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId) |
|||
return |
|||
} |
|||
|
|||
// 读取全部信息
|
|||
func (cont *DetailedTarget) ContMap(whereMap interface{}, field ...string) (countAry []DetailedTarget, 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).Order("sort ASC").Find(&countAry).Error |
|||
return |
|||
} |
|||
|
|||
// 删除内容
|
|||
func (cont *DetailedTarget) DelCont(whereMap interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,62 @@ |
|||
package modelskpi |
|||
|
|||
import ( |
|||
"key_performance_indicators/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 考核维度
|
|||
type DutyClass struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id"` |
|||
Title string `json:"title" gorm:"column:title;type:varchar(255);comment:考核维度名称"` |
|||
Type int `json:"type" gorm:"column:type;type:tinyint(1) unsigned;default:1;not null;comment:类型(1:定性考核;2:定量考核)"` |
|||
Weight int `json:"weight" gorm:"column:weight;type:int(3) 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:tinyint(1) unsigned;default:1;not null;comment:状态"` |
|||
Sort int `json:"sort" gorm:"column:sort;type:int(5) unsigned;default:0;not null;comment:排序"` |
|||
} |
|||
|
|||
func (DutyClass *DutyClass) TableName() string { |
|||
return "dutyclass" |
|||
} |
|||
|
|||
// 编辑内容
|
|||
func (cont *DutyClass) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取内容
|
|||
func (cont *DutyClass) 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 *DutyClass) CountCont(whereMap interface{}) (countId int64) { |
|||
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId) |
|||
return |
|||
} |
|||
|
|||
// 读取全部信息
|
|||
func (cont *DutyClass) ContMap(whereMap interface{}, field ...string) (countAry []DutyClass, 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).Order("sort ASC").Find(&countAry).Error |
|||
return |
|||
} |
|||
|
|||
// 删除内容
|
|||
func (cont *DutyClass) DelCont(whereMap interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,71 @@ |
|||
package modelskpi |
|||
|
|||
import ( |
|||
"key_performance_indicators/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 测评指标
|
|||
type EvaluationTarget struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:et_id;type:bigint(20) unsigned;not null;comment:Id;index"` |
|||
Title string `json:"title" gorm:"column:et_title;type:varchar(255);comment:指标名称"` |
|||
Type int `json:"type" gorm:"column:et_type;type:int(1) unsigned;default:1;not null;comment:1:定性考核;2:定量考核"` |
|||
State int `json:"state" gorm:"column:et_state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` |
|||
AddTime int64 `json:"addTime" gorm:"column:et_time;type:bigint(20) unsigned;default:0;not null;comment:制定时间"` |
|||
Share int `json:"share" gorm:"column:et_share;type:int(1) unsigned;default:1;not null;comment:1:共用;2:私用"` |
|||
RelevantDepartments string `json:"relevantdepartments" gorm:"column:et_relevant_departments;type:text;comment:相关部门"` |
|||
Dimension int64 `json:"dimension" gorm:"column:et_dimension;type:bigint(20) unsigned;default:0;not null;comment:维度"` |
|||
Key int64 `json:"key" gorm:"column:et_key;type:bigint(20) unsigned;default:0;not null;comment:UUID"` |
|||
Report string `json:"report" gorm:"column:et_report;type:text;comment:上报人"` |
|||
Uniteing string `json:"unites" gorm:"column:et_unit;type:varchar(255);comment:计量单位"` |
|||
Cycles int `json:"cycle" gorm:"column:et_cycle;type:tinyint(1) unsigned;default:1;not null;comment:1:班;2:天;3:周;4:月;5:季度;6:年"` |
|||
CycleAttres int `json:"cycleattr" gorm:"column:et_cycleattr;type:int(9) unsigned;default:1;not null;comment:辅助计数"` |
|||
VisibleRange string `json:"visiblerange" gorm:"column:et_visible_range;type:text;comment:可见范围"` |
|||
VisibleRangeGroup string `json:"visiblerangegroup" gorm:"column:et_visible_group;type:text;comment:可见范围(集团)"` |
|||
ScoringMethod int `json:"scoringmethod" gorm:"column:et_scoring_method;type:tinyint(1) unsigned;default:1;not null;comment:计分方式(1:自动;2:手动)"` |
|||
} |
|||
|
|||
func (EvaluationTarget *EvaluationTarget) TableName() string { |
|||
return "evaluationtarget" |
|||
} |
|||
|
|||
// 编辑内容
|
|||
func (cont *EvaluationTarget) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取内容
|
|||
func (cont *EvaluationTarget) 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 *EvaluationTarget) CountCont(whereMap interface{}) (countId int64) { |
|||
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId) |
|||
return |
|||
} |
|||
|
|||
// 读取全部信息
|
|||
func (cont *EvaluationTarget) ContMap(whereMap interface{}, field ...string) (countAry []EvaluationTarget, 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).Order("sort ASC").Find(&countAry).Error |
|||
return |
|||
} |
|||
|
|||
// 删除内容
|
|||
func (cont *EvaluationTarget) DelCont(whereMap interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,67 @@ |
|||
package modelskpi |
|||
|
|||
import ( |
|||
"key_performance_indicators/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 岗位考核方案版本管理
|
|||
type PositionPlanVersio struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` |
|||
Group int64 `json:"group" gorm:"column:group;type:bigint(20) unsigned;default:0;not null;comment:归属集团"` |
|||
Department int64 `json:"department" gorm:"column:department;type:bigint(20) unsigned;default:0;comment:归属部门"` |
|||
OrgId int64 `json:"orgid" gorm:"column:orgid;type:bigint(20) unsigned;default:0;comment:行政组织"` |
|||
Position int64 `json:"position" gorm:"column:position;type:bigint(20) unsigned;default:0;comment:归属岗位"` |
|||
Key string `json:"key" gorm:"column:key;type:varchar(200) unsigned;default:0;not null;comment:编码"` |
|||
Versio string `json:"versio" gorm:"column:version;type:varchar(20) unsigned;default:0;not null;comment:版本号"` |
|||
Year int64 `json:"year" gorm:"column:years;type:int(5) 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:删除)"` |
|||
AddTime int64 `json:"addtime" gorm:"column:addtime;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` |
|||
EiteTime int64 `json:"eitetime" gorm:"column:eitetime;type:bigint(20) unsigned;default:0;not null;comment:修改时间"` |
|||
Content string `json:"content" gorm:"column:content;type:longtext;comment:版本内容"` |
|||
} |
|||
|
|||
func (PositionPlanVersio *PositionPlanVersio) TableName() string { |
|||
return "position_plan_version" |
|||
} |
|||
|
|||
// 编辑内容
|
|||
func (cont *PositionPlanVersio) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取内容
|
|||
func (cont *PositionPlanVersio) 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 *PositionPlanVersio) CountCont(whereMap interface{}) (countId int64) { |
|||
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId) |
|||
return |
|||
} |
|||
|
|||
// 读取全部信息
|
|||
func (cont *PositionPlanVersio) ContMap(whereMap interface{}, field ...string) (countAry []PositionPlanVersio, 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 *PositionPlanVersio) DelCont(whereMap interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,72 @@ |
|||
package modelskpi |
|||
|
|||
import ( |
|||
"key_performance_indicators/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 岗位指标
|
|||
type PostTarget struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` |
|||
Title string `json:"title" gorm:"column:title;type:varchar(255) unsigned;default:'';not null;comment:标题"` |
|||
Type int `json:"type" gorm:"column:type;type:int(1) unsigned;default:1;not null;comment:1:定性考核;2:定量考核"` |
|||
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:创建时间"` |
|||
Share int `json:"share" gorm:"column:share;type:int(1) unsigned;default:1;not null;comment:1:共用;2:私用"` |
|||
ReleDepart int64 `json:"reledepart" gorm:"column:rele_depart;type:bigint(20) unsigned;default:0;not null;comment:相关部门"` |
|||
DepartmentsPost string `json:"departmentspost" gorm:"column:departments_post;type:text ;default:'';comment:相关岗位"` |
|||
Dimension int64 `json:"dimension" gorm:"column:dimension;type:bigint(20) unsigned;default:0;not null;comment:维度"` |
|||
Key int64 `json:"key" gorm:"column:key;type:bigint(20) unsigned;default:0;not null;comment:UUID"` |
|||
Report string `json:"report" gorm:"column:report;type:text ;default:'';comment:上报人"` |
|||
Unit string `json:"unit" gorm:"column:unit;type:varchar(255) unsigned;default:'';not null;comment:单位"` |
|||
Cycle int `json:"cycle" gorm:"column:cycle;type:int(1) unsigned;default:1;not null;comment:1:班;2:天;3:周;4:月;5:季度;6:年"` |
|||
Cycleattr int `json:"cycleattr" gorm:"column:cycleattr;type:int(9) unsigned;default:1;not null;comment:辅助计数"` |
|||
ScoringMethod int `json:"scoringmethod" gorm:"column:scoring_method;type:int(1) unsigned;default:0;not null;comment:计分方式(1:自动;2:手动)"` |
|||
VisibleRange string `json:"visiblerange" gorm:"column:visible_range;type:text ;default:'';comment:可见范围"` |
|||
VisibleGroup string `json:"visiblegroup" gorm:"column:visible_group;type:text ;default:'';comment:可见范围(集团)"` |
|||
} |
|||
|
|||
func (PostTarget *PostTarget) TableName() string { |
|||
return "post_target" |
|||
} |
|||
|
|||
// 编辑内容
|
|||
func (cont *PostTarget) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取内容
|
|||
func (cont *PostTarget) 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 *PostTarget) CountCont(whereMap interface{}) (countId int64) { |
|||
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId) |
|||
return |
|||
} |
|||
|
|||
// 读取全部信息
|
|||
func (cont *PostTarget) ContMap(whereMap interface{}, field ...string) (countAry []PostTarget, 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 *PostTarget) DelCont(whereMap interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,77 @@ |
|||
package modelskpi |
|||
|
|||
import ( |
|||
"key_performance_indicators/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 指标细则
|
|||
type PostTargetDetails struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` |
|||
Title string `json:"title" gorm:"column:title;type:text;comment:指标细则"` |
|||
Content string `json:"content" gorm:"column:content;type:text;comment:指标说明"` |
|||
ParentId int64 `json:"parentid" gorm:"column:parentid;type:bigint(20) unsigned;default:0;not null;comment:归属指标栏目"` |
|||
ParentIdSun int64 `json:"parentidsun" gorm:"column:parentid_sun;type:bigint(20) unsigned;default:0;not null;comment:归属指标子栏目"` |
|||
State int `json:"state" gorm:"column:state;type:tinyint(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` |
|||
AddTime int64 `json:"addtime" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:制定时间"` |
|||
MinScore int64 `json:"minscore" gorm:"column:min_score;type:bigint(20) unsigned;default:0;not null;comment:最小分*100保存"` |
|||
MaxScore int64 `json:"maxscore" gorm:"column:max_score;type:bigint(20) unsigned;default:0;not null;comment:最大分*100保存"` |
|||
Company string `json:"company" gorm:"column:company;type:varchar(20) unsigned;default:0;not null;comment:单位"` |
|||
AddReduce int `json:"addreduce" gorm:"column:add_reduce;type:int(1) unsigned;default:1;not null;comment:1:减少;2:增加;3:无属性,现场确认加或减"` |
|||
CensorType string `json:"censortype" gorm:"column:censor_type;type:text;comment:检查方式"` |
|||
CensorCont string `json:"censorcont" gorm:"column:censor_cont;type:longtext;comment:检查依据"` |
|||
CensorRate int `json:"censorrate" gorm:"column:censor_rate;type:int(5) unsigned;default:1;not null;comment:检查频次"` |
|||
Cycles int `json:"cycle" gorm:"column:cycle;type:tinyint(1) unsigned;default:1;not null;comment:1:班;2:天;3:周;4:月;5:季度;6:年"` |
|||
CycleAttres int `json:"cycleattr" gorm:"column:cycleattr;type:int(9) unsigned;default:1;not null;comment:辅助计数"` |
|||
Paretment int64 `json:"paretment" gorm:"column:paretment;type:bigint(20);comment:接受考核的部门"` |
|||
ParetmentPost string `json:"paretmentpost" gorm:"column:paretment_post;type:longtext;comment:接受考核的部门岗位"` |
|||
Reportary string `json:"reportary" gorm:"column:reportary;type:longtext;comment:提报人"` |
|||
Punishmode int `json:"punishmode" gorm:"column:punishmode;type:tinyint(1) unsigned;default:1;not null;comment:处罚方式 1:扣分;2:现金处罚;3:扣分加现金"` |
|||
Maxmoney int64 `json:"maxmoney" gorm:"column:maxmoney;type:bigint(20) unsigned;default:0;not null;comment:最高罚款"` |
|||
Minmoney int64 `json:"minmoney" gorm:"column:minmoney;type:bigint(20) unsigned;default:0;not null;comment:最低罚款"` |
|||
} |
|||
|
|||
func (PostTargetDetails *PostTargetDetails) TableName() string { |
|||
return "post_target_details" |
|||
} |
|||
|
|||
// 编辑内容
|
|||
func (cont *PostTargetDetails) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取内容
|
|||
func (cont *PostTargetDetails) 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 *PostTargetDetails) CountCont(whereMap interface{}) (countId int64) { |
|||
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId) |
|||
return |
|||
} |
|||
|
|||
// 读取全部信息
|
|||
func (cont *PostTargetDetails) ContMap(whereMap interface{}, field ...string) (countAry []PostTargetDetails, 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).Order("sort ASC").Find(&countAry).Error |
|||
return |
|||
} |
|||
|
|||
// 删除内容
|
|||
func (cont *PostTargetDetails) DelCont(whereMap interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,76 @@ |
|||
package modelskpi |
|||
|
|||
import ( |
|||
"key_performance_indicators/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 岗位评估方案
|
|||
type QualitativeEvaluationScheme struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` |
|||
VersionNumber string `json:"versionnumber" gorm:"column:version_number;type:varchar(255) unsigned;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:归属岗位"` |
|||
Title string `json:"title" gorm:"column:title;type:varchar(255) ;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:子栏目"` |
|||
DetailsId int64 `json:"detailsid" gorm:"column:details_id;type:bigint(20) unsigned;default:0;not null;comment:细则"` |
|||
Attribute int `json:"attribute" gorm:"column:attribute;type:tinyint(1) unsigned;default:1;not null;comment:属性 1:定性考核;2:定量考核"` |
|||
MinScore int64 `json:"minscore" gorm:"column:min_score;type:bigint(20) unsigned;default:0;not null;comment:最小分*100保存"` |
|||
MaxScore int64 `json:"maxscore" gorm:"column:max_score;type:bigint(20) unsigned;default:0;not null;comment:最大分*100保存"` |
|||
ScoringMethod int `json:"scoringmethod" gorm:"column:scoring_method;type:tinyint(1) unsigned;default:1;not null;comment:计分方式(1:自动;2:手动)"` |
|||
State int `json:"state" gorm:"column:state;type:tinyint(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` |
|||
Addtime int64 `json:"addtime" gorm:"column:addtime;type:bigint(20) unsigned;default:0;not null;comment:添加时间"` |
|||
Eitetime int64 `json:"eitetime" gorm:"column:eitetime;type:bigint(20) unsigned;default:0;not null;comment:编辑时间"` |
|||
CensorType string `json:"censortype" gorm:"column:censor_type;type:tinytext;comment:检查方式(1:现场检查;2:资料检查;3:事件触发)"` |
|||
Source int `json:"source" gorm:"column:source;type:tinyint(1) unsigned;default:1;not null;comment:来源(1:岗位;2:部门引用)"` |
|||
RunState int `json:"run_state" gorm:"column:run_state;type:tinyint(1) unsigned;default:1;not null;comment:运行状态(1:启用;2:禁用;3:观察)"` |
|||
} |
|||
|
|||
func (QualitativeEvaluationScheme *QualitativeEvaluationScheme) TableName() string { |
|||
return "qualitative_evaluation_scheme" |
|||
} |
|||
|
|||
// 编辑内容
|
|||
func (cont *QualitativeEvaluationScheme) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取内容
|
|||
func (cont *QualitativeEvaluationScheme) 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 *QualitativeEvaluationScheme) CountCont(whereMap interface{}) (countId int64) { |
|||
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId) |
|||
return |
|||
} |
|||
|
|||
// 读取全部信息
|
|||
func (cont *QualitativeEvaluationScheme) ContMap(whereMap interface{}, field ...string) (countAry []QualitativeEvaluationScheme, 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 *QualitativeEvaluationScheme) DelCont(whereMap interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,75 @@ |
|||
package modelskpi |
|||
|
|||
import ( |
|||
"key_performance_indicators/overall" |
|||
"strings" |
|||
"time" |
|||
) |
|||
|
|||
// 定性测评指标子栏目
|
|||
type QualitativeTarget struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:q_id;type:bigint(20) unsigned;not null;comment:Id;index"` |
|||
Title string `json:"title" gorm:"column:q_title;type:varchar(255);comment:指标子栏目名称"` |
|||
ParentId int64 `json:"parentid" gorm:"column:q_parent_id;type:bigint(20) unsigned;default:0;not null;comment:归属指标"` |
|||
State int `json:"state" gorm:"column:q_state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` |
|||
AddTime int64 `json:"addTime" gorm:"column:q_time;type:bigint(20) unsigned;default:0;not null;comment:制定时间"` |
|||
Depart string `json:"depart" gorm:"column:q_depart;type:mediumtext;comment:关联部门"` |
|||
} |
|||
|
|||
func (QualitativeTarget *QualitativeTarget) TableName() string { |
|||
return "qualitative_target" |
|||
} |
|||
|
|||
// 编辑内容
|
|||
func (cont *QualitativeTarget) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取内容
|
|||
func (cont *QualitativeTarget) 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 *QualitativeTarget) CountCont(whereMap interface{}) (countId int64) { |
|||
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId) |
|||
return |
|||
} |
|||
|
|||
// 读取全部信息
|
|||
func (cont *QualitativeTarget) ContMap(whereMap interface{}, field ...string) (countAry []QualitativeTarget, 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).Order("sort ASC").Find(&countAry).Error |
|||
return |
|||
} |
|||
|
|||
// 删除内容
|
|||
func (cont *QualitativeTarget) DelCont(whereMap interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error |
|||
return |
|||
} |
|||
|
|||
// 判断子目标是否存在
|
|||
func (cont *QualitativeTarget) JudgeIsTrue(whereMap interface{}, addCont QualitativeTarget) (err error) { |
|||
err = cont.GetCont(whereMap) |
|||
if err != nil { |
|||
err = overall.CONSTANT_DB_KPI.Create(&addCont).Error |
|||
} else { |
|||
if cont.State != 1 { |
|||
err = cont.EiteCont(map[string]interface{}{"`q_id`": cont.Id}, map[string]interface{}{"`q_state`": 1, "`q_time`": time.Now().Unix()}) |
|||
} |
|||
} |
|||
return nil |
|||
} |
|||
@ -0,0 +1,70 @@ |
|||
package modelskpi |
|||
|
|||
import ( |
|||
"key_performance_indicators/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 子栏目关联指标视图
|
|||
type SonTargetFather struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:q_id;type:bigint(20) unsigned;not null;comment:Id;index"` |
|||
Title string `json:"title" gorm:"column:q_title;type:varchar(255);comment:指标子栏目名称"` |
|||
ParentId int64 `json:"parentid" gorm:"column:q_parent_id;type:bigint(20) unsigned;default:0;not null;comment:归属指标"` |
|||
State int `json:"state" gorm:"column:q_state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` |
|||
AddTime int64 `json:"addTime" gorm:"column:q_time;type:bigint(20) unsigned;default:0;not null;comment:制定时间"` |
|||
Depart string `json:"depart" gorm:"column:q_depart;type:mediumtext;comment:关联部门"` |
|||
|
|||
EtTitle string `json:"ettitle" gorm:"column:et_title;type:varchar(255);comment:指标名称"` |
|||
Type int `json:"type" gorm:"column:et_type;type:int(1) unsigned;default:1;not null;comment:1:定性考核;2:定量考核"` |
|||
Dimension int64 `json:"dimension" gorm:"column:et_dimension;type:bigint(20) unsigned;default:0;not null;comment:维度"` |
|||
Key int64 `json:"key" gorm:"column:et_key;type:bigint(20) unsigned;default:0;not null;comment:UUID"` |
|||
Uniteing string `json:"unites" gorm:"column:et_unit;type:varchar(255);comment:计量单位"` |
|||
Cycles int `json:"cycle" gorm:"column:et_cycle;type:tinyint(1) unsigned;default:1;not null;comment:1:班;2:天;3:周;4:月;5:季度;6:年"` |
|||
CycleAttres int `json:"cycleattr" gorm:"column:et_cycleattr;type:int(9) unsigned;default:1;not null;comment:辅助计数"` |
|||
ScoringMethod int `json:"scoringmethod" gorm:"column:et_scoring_method;type:tinyint(1) unsigned;default:1;not null;comment:计分方式(1:自动;2:手动)"` |
|||
} |
|||
|
|||
func (SonTargetFather *SonTargetFather) TableName() string { |
|||
return "son_target_father" |
|||
} |
|||
|
|||
// 编辑内容
|
|||
func (cont *SonTargetFather) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取内容
|
|||
func (cont *SonTargetFather) 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 *SonTargetFather) CountCont(whereMap interface{}) (countId int64) { |
|||
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId) |
|||
return |
|||
} |
|||
|
|||
// 读取全部信息
|
|||
func (cont *SonTargetFather) ContMap(whereMap interface{}, field ...string) (countAry []SonTargetFather, 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).Order("sort ASC").Find(&countAry).Error |
|||
return |
|||
} |
|||
|
|||
// 删除内容
|
|||
func (cont *SonTargetFather) DelCont(whereMap interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,67 @@ |
|||
package modelskpi |
|||
|
|||
import ( |
|||
"key_performance_indicators/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 指标、栏目、细则关联部门
|
|||
type TargetDepartment struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id"` |
|||
Dimension int64 `json:"dimension" 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:指标ID"` |
|||
TargetSunId int64 `json:"targetsunid" gorm:"column:target_sun_id;type:bigint(20) unsigned;default:0;not null;comment:子目标"` |
|||
TargetBylaws int64 `json:"targetbylaws" gorm:"column:target_bylaws;type:bigint(20) unsigned;default:0;not null;comment:指标细则"` |
|||
Type int `json:"type" gorm:"column:type;type:tinyint(1) unsigned;default:1;not null;comment:类型(1:指标;2:子目标;3:细则)"` |
|||
DepartmentId int64 `json:"departmentid" gorm:"column:department_id;type:bigint(20) unsigned;default:0;not null;comment:部门ID"` |
|||
PostId int64 `json:"postid" gorm:"column:post_id;type:bigint(20) unsigned;default:0;not null;comment:岗位ID"` |
|||
State int `json:"state" gorm:"column:state;type:tinyint(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:写入时间"` |
|||
Class int `json:"class" gorm:"column:class;type:tinyint(1) unsigned;default:1;not null;comment:1:定性考核;2:定量考核"` |
|||
Level int `json:"level" gorm:"column:level;type:tinyint(1) unsigned;default:1;not null;comment:级别(1:部门级;2:岗位级)"` |
|||
} |
|||
|
|||
func (TargetDepartment *TargetDepartment) TableName() string { |
|||
return "target_department" |
|||
} |
|||
|
|||
// 编辑内容
|
|||
func (cont *TargetDepartment) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取内容
|
|||
func (cont *TargetDepartment) 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 *TargetDepartment) CountCont(whereMap interface{}) (countId int64) { |
|||
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId) |
|||
return |
|||
} |
|||
|
|||
// 读取全部信息
|
|||
func (cont *TargetDepartment) ContMap(whereMap interface{}, field ...string) (countAry []TargetDepartment, 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).Order("sort ASC").Find(&countAry).Error |
|||
return |
|||
} |
|||
|
|||
// 删除内容
|
|||
func (cont *TargetDepartment) DelCont(whereMap interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,69 @@ |
|||
package modelskpi |
|||
|
|||
import ( |
|||
"key_performance_indicators/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 指标部门、岗位上报人对照表
|
|||
type TargetReport struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id"` |
|||
Dimension int64 `json:"dimension" 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:指标ID"` |
|||
TargetSunId int64 `json:"targetsunid" gorm:"column:target_sun_id;type:bigint(20) unsigned;default:0;not null;comment:子目标"` |
|||
TargetBylaws int64 `json:"targetbylaws" gorm:"column:target_bylaws;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"` |
|||
PostId int64 `json:"postid" gorm:"column:post_id;type:bigint(20) unsigned;default:0;not null;comment:岗位ID"` |
|||
Type int `json:"type" gorm:"column:type;type:tinyint(1) unsigned;default:1;not null;comment:类型(1:公司级;2:部门级)"` |
|||
State int `json:"state" gorm:"column:state;type:tinyint(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` |
|||
ReportPerson int64 `json:"reportperson" gorm:"column:man_key;type:bigint(20) unsigned;default:0;not null;comment:上报人"` |
|||
ManDepartment int64 `json:"mandepartment" gorm:"column:man_department;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:写入时间"` |
|||
Class int `json:"class" gorm:"column:class;type:tinyint(1) unsigned;default:1;not null;comment:1:定性考核;2:定量考核"` |
|||
Level int `json:"level" gorm:"column:type_level;type:tinyint(1) unsigned;default:1;not null;comment:类型(1:指标;2:子目标;3:细则)"` |
|||
} |
|||
|
|||
func (TargetReport *TargetReport) TableName() string { |
|||
return "target_report" |
|||
} |
|||
|
|||
// 编辑内容
|
|||
func (cont *TargetReport) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取内容
|
|||
func (cont *TargetReport) 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 *TargetReport) CountCont(whereMap interface{}) (countId int64) { |
|||
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId) |
|||
return |
|||
} |
|||
|
|||
// 读取全部信息
|
|||
func (cont *TargetReport) ContMap(whereMap interface{}, field ...string) (countAry []TargetReport, 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).Order("sort ASC").Find(&countAry).Error |
|||
return |
|||
} |
|||
|
|||
// 删除内容
|
|||
func (cont *TargetReport) DelCont(whereMap interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error |
|||
return |
|||
} |
|||
@ -1,4 +1,4 @@ |
|||
package models |
|||
package modelsschool |
|||
|
|||
//菜单功能
|
|||
type MenuOperation struct { |
|||
@ -1,4 +1,4 @@ |
|||
package models |
|||
package modelsschool |
|||
|
|||
import "key_performance_indicators/overall" |
|||
|
|||
@ -1,4 +1,4 @@ |
|||
package models |
|||
package modelsschool |
|||
|
|||
import ( |
|||
"key_performance_indicators/overall" |
|||
@ -1,4 +1,4 @@ |
|||
package models |
|||
package modelsschool |
|||
|
|||
import "key_performance_indicators/overall" |
|||
|
|||
@ -1,4 +1,4 @@ |
|||
package models |
|||
package modelsschool |
|||
|
|||
import "key_performance_indicators/overall" |
|||
|
|||
@ -1,4 +1,4 @@ |
|||
package models |
|||
package modelsschool |
|||
|
|||
import "key_performance_indicators/overall" |
|||
|
|||
@ -1,4 +1,4 @@ |
|||
package models |
|||
package modelswechat |
|||
|
|||
//企业微信人员架构
|
|||
type WechatUsers struct { |
|||
Loading…
Reference in new issue