diff --git a/README.md b/README.md index 17e180e..9528316 100644 --- a/README.md +++ b/README.md @@ -53,4 +53,53 @@ therr = md5(two) 2、合并 md5(md5(md5(CodeString)+md5(AppKey))+AppKey) +``` + + +## 开发日志 + +``` +Time:2022-08-10 +绩效考核数据库添加数据表 + +CREATE TABLE `depart_dime_post_weight` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `orgid` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '行政组织', + `postid` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '岗位', + `dimension` bigint(20) NOT NULL COMMENT '维度', + `target` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '指标', + `weight` bigint(6) unsigned NOT NULL DEFAULT '0' COMMENT '权重', + `time` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '时间', + `type` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '1:定性考核;2:定量考核', + `hierarchy` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '1:维度;2:指标', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM AUTO_INCREMENT=424 DEFAULT CHARSET=utf8mb4 COMMENT='岗位考核指标权重'; + +添加 model 文件 +路径 models->modelskpi depart_dime_post_weight.go + +``` + +``` +Time:2022-08-10 +绩效考核数据库添加<指标、栏目、细则关联部门>数据表 + +CREATE TABLE `target_department` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `target_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '指标ID', + `target_sun_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '子目标', + `target_bylaws` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '指标细则', + `type` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '类型(1:指标;2:子目标)', + `department_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '部门ID', + `post_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '岗位ID', + `report_person` longtext COMMENT '上报人', + `state` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '状态(1:启用;2:禁用;3:删除)', + `time` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '写入时间', + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COMMENT='指标、栏目、细则关联部门'; + + +添加 model 文件 +路径 models->modelskpi target_department.go + ``` \ No newline at end of file diff --git a/api/base/loginVerify/login.go b/api/base/loginVerify/login.go index beb16d3..080f51c 100644 --- a/api/base/loginVerify/login.go +++ b/api/base/loginVerify/login.go @@ -3,7 +3,8 @@ package loginVerify import ( "fmt" "key_performance_indicators/middleware/grocerystore" - "key_performance_indicators/models" + "key_performance_indicators/models/modelshr" + "key_performance_indicators/models/modelsschool" "key_performance_indicators/overall" "key_performance_indicators/overall/publicmethod" @@ -44,14 +45,14 @@ func (a *ApiMethod) ScanCodeLogin(c *gin.Context) { // //原知行学院管理员账号登录 // } //新的登录认证方式 - var userCont models.ManCont + var userCont modelshr.ManCont userErr := userCont.GetCont(map[string]interface{}{"number": requestData.Username, "password": md5TokenPwd}) if userErr != nil { publicmethod.Result(2000, userErr, c) return } if requestData.OpenId != "" { - var userInfo models.PersonArchives + var userInfo modelshr.PersonArchives userInfo.EiteCont(map[string]interface{}{"id": userCont.Id}, map[string]interface{}{"work_wechat": requestData.OpenId}) } if userCont.State == 2 { @@ -151,9 +152,9 @@ func (a *ApiMethod) ScanCodeLogin(c *gin.Context) { publicmethod.Result(0, saveData, c) } -//获取权限点位 +// 获取权限点位 func getRoleSeat(roleId string) (menuStr, buttonStr string) { - var roleInfo models.SystemRole + var roleInfo modelsschool.SystemRole err := roleInfo.GetCont(map[string]interface{}{"r_id": roleId}, "r_menu_oper", "r_jurisdiction") if err != nil { return @@ -163,7 +164,7 @@ func getRoleSeat(roleId string) (menuStr, buttonStr string) { return } -//退出登录 +// 退出登录 func (a *ApiMethod) SignOut(c *gin.Context) { userKey := c.Request.Header.Get("user-key") redisFileKey := fmt.Sprintf("ScanCode:Authentication:LoginApi_%v_%v", overall.CONSTANT_CONFIG.RedisPrefixStr.Alias, userKey) diff --git a/api/base/loginVerify/type.go b/api/base/loginVerify/type.go index 01e534b..531d3cd 100644 --- a/api/base/loginVerify/type.go +++ b/api/base/loginVerify/type.go @@ -1,7 +1,7 @@ package loginVerify import ( - "key_performance_indicators/models" + "key_performance_indicators/models/modelsschool" "key_performance_indicators/overall/publicmethod" "github.com/gin-gonic/gin" @@ -9,20 +9,20 @@ import ( type ApiMethod struct{} -//系统登录入口 +// 系统登录入口 func (a *ApiMethod) Index(c *gin.Context) { outputCont := publicmethod.MapOut[string]() outputCont["index"] = "系统登录入口" publicmethod.Result(0, outputCont, c) } -//验证码输出 +// 验证码输出 type SysCaptchaResponse struct { CaptchaId string `json:"captchaid"` PicPath string `json:"picPath"` } -//登录相关 +// 登录相关 type Login struct { Username string `json:"username"` // 用户名 Password string `json:"password"` // 密码 @@ -31,8 +31,8 @@ type Login struct { OpenId string `json:"openid"` //企业微信ID } -//原知行学院管理员表 +// 原知行学院管理员表 type OldSchollAdmin struct { - models.SystemUser - models.SystemUserAttribute + modelsschool.SystemUser + modelsschool.SystemUserAttribute } diff --git a/api/empower/authorize/empower.go b/api/empower/authorize/empower.go index 18b4026..b0bca28 100644 --- a/api/empower/authorize/empower.go +++ b/api/empower/authorize/empower.go @@ -2,17 +2,17 @@ package authorize import ( "fmt" + "key_performance_indicators/models/modelshr" "key_performance_indicators/overall" "strconv" "github.com/gin-gonic/gin" "key_performance_indicators/middleware/grocerystore" - "key_performance_indicators/models" "key_performance_indicators/overall/publicmethod" ) -//授权 +// 授权 func (e *EmpowerApi) GainToken(c *gin.Context) { ContentType := c.Request.Header.Get("Content-Type") Origin := c.Request.Header.Get("Origin") @@ -38,7 +38,7 @@ func (e *EmpowerApi) GainToken(c *gin.Context) { var passwordMd5 publicmethod.Md5Encryption passwordMd5.Md5EncryptionInit(requestData.Password) passwordMd5Str := passwordMd5.Md5EncryptionAlgorithm() - var empowerUser models.EmpowerUser + var empowerUser modelshr.EmpowerUser userErr := empowerUser.GetCont(map[string]interface{}{"userkey": requestData.UserNumber, "password": passwordMd5Str}, "verification_code") if userErr != nil { publicmethod.Result(2000, passwordMd5Str, c) @@ -124,7 +124,7 @@ func (e *EmpowerApi) GainToken(c *gin.Context) { publicmethod.Result(0, sendToken, c) } -//加密验证 +// 加密验证 func (e *EmpowerApi) Encryption(c *gin.Context) { var requestData EncryptionData err := c.ShouldBindJSON(&requestData) diff --git a/api/version1/departmentseting/departmentpc/qualitativekpi.go b/api/version1/departmentseting/departmentpc/qualitativekpi.go new file mode 100644 index 0000000..7426d05 --- /dev/null +++ b/api/version1/departmentseting/departmentpc/qualitativekpi.go @@ -0,0 +1,220 @@ +package departmentpc + +import ( + "fmt" + "key_performance_indicators/models/modelshr" + "key_performance_indicators/models/modelskpi" + "key_performance_indicators/overall" + "key_performance_indicators/overall/publicmethod" + "strconv" + "strings" + "time" + + "github.com/gin-gonic/gin" +) + +// 部门指标列表 +func (a *ApiMethod) DepartmentTargetList(c *gin.Context) { + var receivedValue departListQuery + c.ShouldBindJSON(&receivedValue) + if receivedValue.Page == 0 { + receivedValue.Page = 1 + } + if receivedValue.PageSize == 0 { + receivedValue.PageSize = 20 + } + gormDb := overall.CONSTANT_DB_KPI.Model(&modelskpi.EvaluationTarget{}) + if receivedValue.State != 0 { //状态(1:启用;2:禁用;3:删除) + gormDb = gormDb.Where("et_state = ?", receivedValue.State) + } else { + gormDb = gormDb.Where("et_state BETWEEN ? AND ?", 1, 2) + } + if receivedValue.Title != "" { //指标名称 + gormDb = gormDb.Where("et_state LIKE ?", "%"+receivedValue.Title+"%") + } + if receivedValue.Class != 0 { //1:定性考核;2:定量考核 + gormDb = gormDb.Where("et_type = ?", receivedValue.Class) + } + if receivedValue.DepartmentId != "" { //部门ID + gormDb = gormDb.Where("FIND_IN_SET(?,`departments_post`)", receivedValue.DepartmentId) + } + if receivedValue.DimensionId != "" { //维度ID + gormDb = gormDb.Where("et_dimension = ?", receivedValue.DimensionId) + } + if receivedValue.ReportPerson != "" { //上报人 + gormDb = gormDb.Where("FIND_IN_SET(?,`et_report`)", receivedValue.ReportPerson) + } + if receivedValue.ScoringMethod != 0 { //计分方式(1:自动;2:手动) + gormDb = gormDb.Where("et_scoring_method = ?", receivedValue.ScoringMethod) + } + if receivedValue.Cycle != 0 { //1:班;2:天;3:周;4:月;5:季度;6:年 + gormDb = gormDb.Where("et_cycle = ?", receivedValue.Cycle) + } + + var total int64 + totalErr := gormDb.Count(&total).Error + if totalErr != nil { + total = 0 + } + var departmentTargetList []modelskpi.EvaluationTarget + gormDb = publicmethod.PageTurningSettings(gormDb, receivedValue.Page, receivedValue.PageSize) + err := gormDb.Order("`et_id` DESC").Find(&departmentTargetList).Error + if err != nil { + publicmethod.Result(105, err, c) + return + } + var targetList []printDepartmentTarget + for _, v := range departmentTargetList { + var targetCont printDepartmentTarget + targetCont.Id = v.Id + targetCont.Title = v.Title //指标名称"` + targetCont.Type = v.Type //1:定性考核;2:定量考核"` + targetCont.State = v.State //状态(1:启用;2:禁用;3:删除)"` + targetCont.AddTime = v.AddTime //制定时间"` + targetCont.Share = v.Share //1:共用;2:私用"` + targetCont.RelevantDepartments = v.RelevantDepartments //相关部门"` + targetCont.Dimension = v.Dimension //维度"` + targetCont.Key = v.Key //UUID"` + targetCont.Report = v.Report //上报人"` + targetCont.Uniteing = v.Uniteing //计量单位"` + targetCont.Cycles = v.Cycles //1:班;2:天;3:周;4:月;5:季度;6:年"` + targetCont.CycleAttres = v.CycleAttres //辅助计数"` + targetCont.VisibleRange = v.VisibleRange //可见范围"` + targetCont.VisibleRangeGroup = v.VisibleRangeGroup //可见范围(集团)"` + targetCont.ScoringMethod = v.ScoringMethod //计分方式(1:自动;2:手动)"` + var dutyClassCont modelskpi.DutyClass + dutyClassCont.GetCont(map[string]interface{}{"`id`": v.Dimension}, "`title`") + targetCont.DimensionTitle = dutyClassCont.Title + targetList = append(targetList, targetCont) + } + publicmethod.ResultList(0, receivedValue.Page, receivedValue.PageSize, total, int64(len(targetList)), targetList, c) +} + +// 实验查询 +func (a *ApiMethod) Shiyan(c *gin.Context) { + // var receivedValue departListQuery + // c.ShouldBindJSON(&receivedValue) + + // if receivedValue.DepartmentId == "" { + // receivedValue.DepartmentId = "316" + // } + // if receivedValue.DimensionId == "" { + // receivedValue.DimensionId = "1" + // } + + // var evalCont []modelskpi.EvaluationTarget + + // // gormDb := overall.CONSTANT_DB_KPI.Model(&modelskpi.EvaluationTarget{}).Select("evaluationtarget.*,(?) AS tdm", overall.CONSTANT_DB_KPI.Model(&modelskpi.TargetDepartment{}).Select("id").Where("department_id = ? AND target_id = et_id ", receivedValue.DepartmentId).Find(&modelskpi.TargetDepartment{})).Having("tdm IS NOT NULL").Find(&evalCont).Error + // // fmt.Printf("gormDb----->%v----->%v\n", gormDb, evalCont) + // err := overall.CONSTANT_DB_KPI.Raw("SELECT e.*,(SELECT id FROM target_department td WHERE td.department_id = ? AND td.post_id = ? AND td.target_id = e.et_id) as tdm FROM evaluationtarget e HAVING tdm IS NOT NULL", receivedValue.DepartmentId, receivedValue.DimensionId).Scan(&evalCont).Error + // fmt.Printf("gormDb----->%v----->%v\n", err, evalCont) + //校正部门级考核 + var dimeTargetList []modelskpi.DetailedTarget + err := overall.CONSTANT_DB_KPI.Where("dt_state = 1").Find(&dimeTargetList).Error + if err != nil || len(dimeTargetList) < 1 { + publicmethod.Result(107, err, c) + return + } + // fmt.Printf("总数---->%v\n", len(dimeTargetList)) + // var xieChengChuli []modelskpi.DetailedTarget + // for i, v := range dimeTargetList { + // if (i+1)%100 == 0 { + // xieChengChuli = append(xieChengChuli, v) + // fmt.Printf("循环--%v-->%v\n", i, len(xieChengChuli)) + // xieChengChuli = []modelskpi.DetailedTarget{} + // } else { + // xieChengChuli = append(xieChengChuli, v) + // } + // } + + for _, v := range dimeTargetList { + xiaoZhengBuMen(v) + } + + fmt.Printf("jieshu---->%v\n", len(dimeTargetList)) +} + +// 校正部门定性考核关联关系 +func xiaoZhengBuMen(detaTar modelskpi.DetailedTarget) { + if detaTar.Paretment != "" { + bumenAry := strings.Split(detaTar.Paretment, ",") + if len(bumenAry) > 0 { + for _, v := range bumenAry { + zbLmXzBm(detaTar.ParentId, detaTar.ParentIdSun, detaTar.Id, 3, v) + } + } + } +} + +//编辑指标、栏目、细则关联部门 +/* +@tarId 指标 +@sunId 栏目 +@lawsId 细则 +@class 类型(1:指标;2:子目标;3:细则) +@bumenId 部门 +*/ +func zbLmXzBm(tarId, sunId, lawsId int64, class int, bumenId string) { + var tarDepCont modelskpi.TargetDepartment + where := publicmethod.MapOut[string]() + where["`target_id`"] = tarId + where["`target_sun_id`"] = sunId + where["`target_bylaws`"] = lawsId + where["`department_id`"] = bumenId + err := tarDepCont.GetCont(where, "`id`", "`state`") + if err == nil { + //存在,判断状态 + if tarDepCont.State != 1 { //不是启用状态,改为启用 + eidtWher := publicmethod.MapOut[string]() + eidtWher["``id``"] = tarDepCont.Id + saveErr := tarDepCont.EiteCont(eidtWher, map[string]interface{}{"`state`": 1, "`time`": time.Now().Unix()}) + + fmt.Printf("编辑---->tarId----%v---->sunId----%v---->lawsId----%v---->class----%v---->bumenId----%v------>saveErr----->%v\n", tarId, sunId, lawsId, class, bumenId, saveErr) + } + } else { + tarDepCont.TargetId = tarId //指标ID"` + tarDepCont.TargetSunId = sunId //子目标"` + tarDepCont.TargetBylaws = lawsId //指标细则"` + tarDepCont.Type = class //类型(1:指标;2:子目标;3:细则)"` + bumenIdInt, _ := strconv.ParseInt(bumenId, 10, 64) + tarDepCont.DepartmentId = bumenIdInt //部门ID"` + tarDepCont.PostId = 0 //岗位ID"` + tarDepCont.ReportPerson = "" //上报人"` + tarDepCont.State = 1 //状态(1:启用;2:禁用;3:删除)"` + tarDepCont.Time = time.Now().Unix() //写入时间"` + addErr := overall.CONSTANT_DB_KPI.Create(&tarDepCont).Error + fmt.Printf("编辑---->tarId----%v---->sunId----%v---->lawsId----%v---->class----%v---->bumenId----%v------>saveErr----->%v\n", tarId, sunId, lawsId, class, bumenId, addErr) + } +} + +// 获取部门定性考核部门关联列表 +func (a *ApiMethod) GetDepartAboutTarget(c *gin.Context) { + var receivedValue publicmethod.PublicId + err := c.ShouldBindJSON(&receivedValue) + if err != nil { + publicmethod.Result(100, err, c) + return + } + var targetDepartmentID []int64 + disrErr := overall.CONSTANT_DB_KPI.Model(&modelskpi.TargetDepartment{}).Distinct("`department_id`").Where("`state` = 1 AND `target_id` = ?", receivedValue.Id).Find(&targetDepartmentID).Error + if disrErr != nil { + publicmethod.Result(107, err, c) + return + } + var departmentList []modelshr.AdministrativeOrganization + departErr := overall.CONSTANT_DB_HR.Model(&modelshr.AdministrativeOrganization{}).Select("`id`,`name`,`superior`,`ispower`").Where("`id` IN ?", targetDepartmentID).Find(&departmentList).Error + if departErr != nil || len(departmentList) < 1 { + publicmethod.Result(107, err, c) + return + } + var outList []departOutcome + for _, v := range departmentList { + var outCont departOutcome + outCont.Id = strconv.FormatInt(v.Id, 10) + outCont.Name = v.Name + outCont.Superior = strconv.FormatInt(v.Superior, 10) + outCont.Ispower = v.IsPower + outList = append(outList, outCont) + } + publicmethod.Result(0, outList, c) +} diff --git a/api/version1/departmentseting/departmentpc/type.go b/api/version1/departmentseting/departmentpc/type.go new file mode 100644 index 0000000..84e12d1 --- /dev/null +++ b/api/version1/departmentseting/departmentpc/type.go @@ -0,0 +1,44 @@ +package departmentpc + +import ( + "key_performance_indicators/models/modelskpi" + "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"] = "部门考核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"` //是否为主部门 +} diff --git a/api/version1/departmentseting/departmentweb/type.go b/api/version1/departmentseting/departmentweb/type.go new file mode 100644 index 0000000..93517db --- /dev/null +++ b/api/version1/departmentseting/departmentweb/type.go @@ -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) +} diff --git a/api/version1/entry.go b/api/version1/entry.go index c13609d..cef8218 100644 --- a/api/version1/entry.go +++ b/api/version1/entry.go @@ -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 + HonorsApi honoraryArchives.ApiMethod + PostPcApi postpc.ApiMethod + PostWebApi postweb.ApiMethod + DeparmentPcApi departmentpc.ApiMethod + DeparmentWebApi departmentweb.ApiMethod } var AppApiEntry = new(ApiEntry) diff --git a/api/version1/honoraryArchives/carriertype.go b/api/version1/honoraryArchives/carriertype.go index b77da1d..7cca4d1 100644 --- a/api/version1/honoraryArchives/carriertype.go +++ b/api/version1/honoraryArchives/carriertype.go @@ -1,7 +1,7 @@ package honoraryArchives import ( - "key_performance_indicators/models" + "key_performance_indicators/models/modelshonory" "key_performance_indicators/overall" "key_performance_indicators/overall/publicmethod" "time" @@ -11,7 +11,7 @@ import ( //档案载体 -//列表 +// 列表 func (a *ApiMethod) CarrierList(c *gin.Context) { var requestData carrierListKey errs := c.ShouldBindJSON(&requestData) @@ -19,8 +19,8 @@ func (a *ApiMethod) CarrierList(c *gin.Context) { publicmethod.Result(100, errs, c) return } - var carrierList []models.CarrierType - gormDb := overall.CONSTANT_DB_MANAGE_ARCHIVES.Model(&models.CarrierType{}).Where("`state` BETWEEN ? AND ?", 1, 2) + var carrierList []modelshonory.CarrierType + gormDb := overall.CONSTANT_DB_MANAGE_ARCHIVES.Model(&modelshonory.CarrierType{}).Where("`state` BETWEEN ? AND ?", 1, 2) if requestData.Name != "" { gormDb = gormDb.Where("`name` LIKE ?", "%"+requestData.Name+"%") } @@ -38,7 +38,7 @@ func (a *ApiMethod) CarrierList(c *gin.Context) { publicmethod.ResultList(0, requestData.Page, requestData.PageSize, total, int64(len(carrierList)), carrierList, c) } -//添加载体类型 +// 添加载体类型 func (a *ApiMethod) AddCarrier(c *gin.Context) { var requestData addCarrierCont err := c.ShouldBindJSON(&requestData) @@ -50,7 +50,7 @@ func (a *ApiMethod) AddCarrier(c *gin.Context) { publicmethod.Result(101, err, c) return } - var carrierCont models.CarrierType + var carrierCont modelshonory.CarrierType juadgeErr := carrierCont.GetCont(map[string]interface{}{"`name`": requestData.Name}, "`id`") if juadgeErr == nil { if carrierCont.Id != 0 { @@ -68,7 +68,7 @@ func (a *ApiMethod) AddCarrier(c *gin.Context) { } } -//编辑荣誉类型 +// 编辑荣誉类型 func (a *ApiMethod) EidyCarrier(c *gin.Context) { var requestData eidyCarrierCont err := c.ShouldBindJSON(&requestData) @@ -84,14 +84,14 @@ func (a *ApiMethod) EidyCarrier(c *gin.Context) { publicmethod.Result(101, err, c) return } - var carrierCont models.CarrierType + var carrierCont modelshonory.CarrierType conErr := carrierCont.GetCont(map[string]interface{}{"`id`": requestData.Id}, "`name`") if conErr != nil { publicmethod.Result(107, conErr, c) return } if requestData.Name != carrierCont.Name { - var oldCarrierCont models.CarrierType + var oldCarrierCont modelshonory.CarrierType conErrOld := oldCarrierCont.GetCont(map[string]interface{}{"`name`": requestData.Name}, "`id`") if conErrOld == nil { publicmethod.Result(103, err, c) @@ -111,7 +111,7 @@ func (a *ApiMethod) EidyCarrier(c *gin.Context) { publicmethod.Result(0, err, c) } -//编辑荣誉类型状态 +// 编辑荣誉类型状态 func (a *ApiMethod) EidyCarrierState(c *gin.Context) { var requestData publicmethod.PublicState c.ShouldBindJSON(&requestData) @@ -127,7 +127,7 @@ func (a *ApiMethod) EidyCarrierState(c *gin.Context) { } where := publicmethod.MapOut[string]() where["id"] = requestData.Id - var carrierTypeCont models.CarrierType + var carrierTypeCont modelshonory.CarrierType judgeErr := carrierTypeCont.GetCont(where, "`id`") if judgeErr != nil { publicmethod.Result(107, judgeErr, c) diff --git a/api/version1/honoraryArchives/honors.go b/api/version1/honoraryArchives/honors.go index 1e46c3a..ffb5f11 100644 --- a/api/version1/honoraryArchives/honors.go +++ b/api/version1/honoraryArchives/honors.go @@ -3,7 +3,7 @@ package honoraryArchives import ( "fmt" "key_performance_indicators/middleware/snowflake" - "key_performance_indicators/models" + "key_performance_indicators/models/modelshonory" "key_performance_indicators/overall" "key_performance_indicators/overall/publicmethod" "strconv" @@ -13,12 +13,12 @@ import ( "gorm.io/gorm" ) -//荣誉列表 +// 荣誉列表 func (a *ApiMethod) HonorList(c *gin.Context) { var requestData honorListKey c.ShouldBindJSON(&requestData) - var honorsList []models.HonoraryArchives - gormDb := overall.CONSTANT_DB_MANAGE_ARCHIVES.Model(&models.HonoraryArchives{}).Where("state BETWEEN ? AND ?", 1, 2) + var honorsList []modelshonory.HonoraryArchives + gormDb := overall.CONSTANT_DB_MANAGE_ARCHIVES.Model(&modelshonory.HonoraryArchives{}).Where("state BETWEEN ? AND ?", 1, 2) if requestData.Name != "" { gormDb = gormDb.Where("`name` LIKE ?", "%"+requestData.Name+"%") } @@ -61,7 +61,7 @@ func (a *ApiMethod) HonorList(c *gin.Context) { publicmethod.ResultList(0, requestData.Page, requestData.PageSize, total, int64(len(honorsList)), honorsList, c) } -//添加荣誉 +// 添加荣誉 func (a *ApiMethod) AddHonorCont(c *gin.Context) { var requestData addHonorCont c.ShouldBindJSON(&requestData) @@ -80,7 +80,7 @@ func (a *ApiMethod) AddHonorCont(c *gin.Context) { } else { uuId = snowflakeId.GetId() } - var honorCont models.HonoraryArchives + var honorCont modelshonory.HonoraryArchives honorCont.Id = uuId honorCont.Name = requestData.Name //荣誉名称"` honorCont.IssuingUnit = requestData.IssuingAgency //发放单位"` @@ -108,9 +108,9 @@ func (a *ApiMethod) AddHonorCont(c *gin.Context) { honorCont.Time = time.Now().Unix() //创建时间"` honorCont.State = 1 //状态(1:启用;2:禁用;3:删除)"` if len(requestData.ImgUrl) > 0 { - var imgList []models.PhotosGallery + var imgList []modelshonory.PhotosGallery for _, v := range requestData.ImgUrl { - var imgCont models.PhotosGallery + var imgCont modelshonory.PhotosGallery imgCont.Url = v.Url //图片地址"` imgCont.ImgPath = v.Imgpath //物理地址"` imgCont.Name = v.Name //文档名称"` @@ -147,7 +147,7 @@ func (a *ApiMethod) AddHonorCont(c *gin.Context) { } } -//编辑荣誉 +// 编辑荣誉 func (a *ApiMethod) EidyHonorCont(c *gin.Context) { var requestData eidtHonorCont c.ShouldBindJSON(&requestData) @@ -162,7 +162,7 @@ func (a *ApiMethod) EidyHonorCont(c *gin.Context) { where := publicmethod.MapOut[string]() where["id"] = requestData.Id //原信息 - var honContOld models.HonoraryArchives + var honContOld modelshonory.HonoraryArchives err := honContOld.GetCont(where) if err != nil { publicmethod.Result(107, err, c) @@ -213,7 +213,7 @@ func (a *ApiMethod) EidyHonorCont(c *gin.Context) { if requestData.Remark != "" && requestData.Remark != honContOld.Contet { saveData["contet"] = requestData.Remark } - var imgUrlListNoId []models.PhotosGallery + var imgUrlListNoId []modelshonory.PhotosGallery var pldImgId []int64 if len(requestData.ImgUrl) > 0 { for _, v := range requestData.ImgUrl { @@ -223,7 +223,7 @@ func (a *ApiMethod) EidyHonorCont(c *gin.Context) { pldImgId = append(pldImgId, oldIdInt) } } else { - var imgCont models.PhotosGallery + var imgCont modelshonory.PhotosGallery imgCont.Url = v.Url //图片地址"` imgCont.ImgPath = v.Imgpath //物理地址"` imgCont.Name = v.Name //文档名称"` @@ -238,7 +238,7 @@ func (a *ApiMethod) EidyHonorCont(c *gin.Context) { } if len(imgUrlListNoId) > 0 { - var imgList models.PhotosGallery + var imgList modelshonory.PhotosGallery saveErr := overall.CONSTANT_DB_MANAGE_ARCHIVES.Transaction(func(tx *gorm.DB) error { if len(pldImgId) > 0 { if err := tx.Not(map[string]interface{}{"`id`": pldImgId}).Where(map[string]interface{}{"`ascription_id`": requestData.Id, "`ascription_data_sheet`": "honorary_archives"}).Delete(&imgList).Error; err != nil { @@ -252,7 +252,7 @@ func (a *ApiMethod) EidyHonorCont(c *gin.Context) { saveData["time"] = time.Now().Unix() - if err := tx.Model(&models.HonoraryArchives{}).Where(where).Updates(&saveData).Error; err != nil { + if err := tx.Model(&modelshonory.HonoraryArchives{}).Where(where).Updates(&saveData).Error; err != nil { // 返回任何错误都会回滚事务 return err } @@ -274,7 +274,7 @@ func (a *ApiMethod) EidyHonorCont(c *gin.Context) { saveData["time"] = time.Now().Unix() saveErr := honContOld.EiteCont(where, saveData) if saveErr == nil { - var imgList models.PhotosGallery + var imgList modelshonory.PhotosGallery if len(pldImgId) > 0 { overall.CONSTANT_DB_MANAGE_ARCHIVES.Not(map[string]interface{}{"`id`": pldImgId, "`ascription_id`": requestData.Id, "`ascription_data_sheet`": "honorary_archives"}).Delete(&imgList) } else { @@ -287,7 +287,7 @@ func (a *ApiMethod) EidyHonorCont(c *gin.Context) { } } -//编辑状态 +// 编辑状态 func (a *ApiMethod) EidyHonorContState(c *gin.Context) { var requestData publicmethod.PublicState c.ShouldBindJSON(&requestData) @@ -303,7 +303,7 @@ func (a *ApiMethod) EidyHonorContState(c *gin.Context) { } where := publicmethod.MapOut[string]() where["id"] = requestData.Id - var carrierTypeCont models.HonoraryArchives + var carrierTypeCont modelshonory.HonoraryArchives judgeErr := carrierTypeCont.GetCont(where, "`id`") if judgeErr != nil { publicmethod.Result(107, judgeErr, c) diff --git a/api/version1/postseting/postpc/scheme.go b/api/version1/postseting/postpc/scheme.go new file mode 100644 index 0000000..5b159bc --- /dev/null +++ b/api/version1/postseting/postpc/scheme.go @@ -0,0 +1,111 @@ +package postpc + +import ( + "fmt" + "key_performance_indicators/models/modelshr" + "key_performance_indicators/models/modelskpi" + "key_performance_indicators/overall" + "key_performance_indicators/overall/publicmethod" + "sort" + "strconv" + + "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) //标准分 + 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:指标 +*/ +func getPostDimeTarWeight(orgid, postid, dimensionid, targetid int64, hierarchy int) int64 { + if hierarchy == 0 { + hierarchy = 2 + } + var ddpwCont modelskpi.DepartDimePostWeight + if hierarchy == 1 { + ddpwCont.GetCont(map[string]interface{}{"orgid": orgid, "postid": postid, "dimension": dimensionid, "hierarchy": 1}, "`weight`") + } else { + ddpwCont.GetCont(map[string]interface{}{"orgid": orgid, "postid": postid, "dimension": dimensionid, "target": targetid, "hierarchy": 2}, "`weight`") + } + return ddpwCont.Weight +} diff --git a/api/version1/postseting/postpc/type.go b/api/version1/postseting/postpc/type.go new file mode 100644 index 0000000..953fffc --- /dev/null +++ b/api/version1/postseting/postpc/type.go @@ -0,0 +1,52 @@ +package postpc + +import ( + "key_performance_indicators/overall/publicmethod" + "sync" + + "github.com/gin-gonic/gin" +) + +type ApiMethod struct{} + +// 协程设置 +var syncSeting = 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 postAboutDimeTar struct { + publicmethod.PublicId + publicmethod.PublicName //维度名称 + Sort int `json:"sort"` //排序 + Child []postAboutTarget `json:"child"` //指标列表 +} diff --git a/api/version1/postseting/postweb/type.go b/api/version1/postseting/postweb/type.go new file mode 100644 index 0000000..0557579 --- /dev/null +++ b/api/version1/postseting/postweb/type.go @@ -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) +} diff --git a/apirouter/entry.go b/apirouter/entry.go index f1bbc6c..ffa065b 100644 --- a/apirouter/entry.go +++ b/apirouter/entry.go @@ -3,17 +3,21 @@ package apirouter import ( "key_performance_indicators/apirouter/apishiyan" "key_performance_indicators/apirouter/empower" + "key_performance_indicators/apirouter/v1/departmentseting" honorsRoute "key_performance_indicators/apirouter/v1/honorsRoute" + "key_performance_indicators/apirouter/v1/postseting" "key_performance_indicators/apirouter/verifyLogin" // "key_performance_indicators/v1" ) -//路由结构 +// 路由结构 type RouterGroup struct { EmpowerRouter empower.EmpowerApiRouter VerifyLogin verifyLogin.ApiRouter ShiyanApi apishiyan.ApiRouter HonorsSouteRouter honorsRoute.ApiRouter + PostRouter postseting.ApiRouter + DepartmentRouter departmentseting.ApiRouter } var RouterGroupEntry = new(RouterGroup) diff --git a/apirouter/v1/departmentseting/pc.go b/apirouter/v1/departmentseting/pc.go new file mode 100644 index 0000000..8763cb2 --- /dev/null +++ b/apirouter/v1/departmentseting/pc.go @@ -0,0 +1,22 @@ +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) //获取部门定性考核部门关联列表 + } +} diff --git a/apirouter/v1/departmentseting/type.go b/apirouter/v1/departmentseting/type.go new file mode 100644 index 0000000..a52ad9b --- /dev/null +++ b/apirouter/v1/departmentseting/type.go @@ -0,0 +1,4 @@ +package departmentseting + +//部门考核 +type ApiRouter struct{} diff --git a/apirouter/v1/departmentseting/web.go b/apirouter/v1/departmentseting/web.go new file mode 100644 index 0000000..04b9728 --- /dev/null +++ b/apirouter/v1/departmentseting/web.go @@ -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) //入口 + + } +} diff --git a/apirouter/v1/postseting/pc.go b/apirouter/v1/postseting/pc.go new file mode 100644 index 0000000..b44db95 --- /dev/null +++ b/apirouter/v1/postseting/pc.go @@ -0,0 +1,20 @@ +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) //获取岗位相关指标 + + } +} diff --git a/apirouter/v1/postseting/type.go b/apirouter/v1/postseting/type.go new file mode 100644 index 0000000..1e3f2a6 --- /dev/null +++ b/apirouter/v1/postseting/type.go @@ -0,0 +1,4 @@ +package postseting + +//岗位考核 +type ApiRouter struct{} diff --git a/apirouter/v1/postseting/web.go b/apirouter/v1/postseting/web.go new file mode 100644 index 0000000..6c6dcf2 --- /dev/null +++ b/apirouter/v1/postseting/web.go @@ -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) //入口 + } +} diff --git a/config/configDatabase/database.yaml b/config/configDatabase/database.yaml index f57cc03..b643cfd 100644 --- a/config/configDatabase/database.yaml +++ b/config/configDatabase/database.yaml @@ -33,7 +33,7 @@ hrdatabase: charset: 'utf8mb4' #数据库编码方式 parseTime: 'True' #是否自动转换时间 loc: 'Local' #时区 - name: 'human_resources_jindie' #数据库名称 + name: 'hr_new' #数据库名称 username: 'root' #数据库用户民 password: 'root' #数据库密码 max_idle_conns: 100 #最大空闲数量 @@ -156,7 +156,7 @@ kpiDate: charset: 'utf8mb4' #数据库编码方式 parseTime: 'True' #是否自动转换时间 loc: 'Local' #时区 - name: 'performanceappraisal' #数据库名称 + name: 'perform' #数据库名称 username: 'root' #数据库用户民 password: 'root' #数据库密码 max_idle_conns: 100 #最大空闲数量 diff --git a/identification/interceptor/authentication.go b/identification/interceptor/authentication.go index e70810a..dd6d5b5 100644 --- a/identification/interceptor/authentication.go +++ b/identification/interceptor/authentication.go @@ -3,7 +3,7 @@ package interceptor import ( "fmt" "key_performance_indicators/middleware/grocerystore" - "key_performance_indicators/models" + "key_performance_indicators/models/modelshr" "key_performance_indicators/overall" "key_performance_indicators/overall/publicmethod" @@ -11,7 +11,7 @@ import ( "github.com/mitchellh/mapstructure" ) -//身份验证器 +// 身份验证器 func IdentificationToken() gin.HandlerFunc { return func(c *gin.Context) { userToken := c.Request.Header.Get("token") @@ -61,7 +61,7 @@ func IdentificationToken() gin.HandlerFunc { passWordMd5.Md5EncryptionInit(validator.PassWord) passWordMd5Str := passWordMd5.Md5EncryptionAlgorithm() - var empowerUser models.EmpowerUser + var empowerUser modelshr.EmpowerUser userErr := empowerUser.GetCont(map[string]interface{}{"userkey": validator.UserKey, "password": passWordMd5Str}, "verification_code") if userErr != nil { publicmethod.Result(2000, userErr, c) diff --git a/identification/interceptor/identity.go b/identification/interceptor/identity.go index d2d88f1..bdd1176 100644 --- a/identification/interceptor/identity.go +++ b/identification/interceptor/identity.go @@ -10,13 +10,13 @@ import ( "github.com/gin-gonic/gin" ) -//验证用户是否登录 +// 验证用户是否登录 func AuthenticateUser() gin.HandlerFunc { return func(c *gin.Context) { userKey := c.Request.Header.Get("user-key") userToken := c.Request.Header.Get("user-token") userAgent := c.Request.Header.Get("User-Agent") - + // fmt.Printf("userKey---------->%v----------userToken---------->%v--------userAgent---------->%v\n", userKey, userToken, userAgent) if userKey == "" || userToken == "" || userAgent == "" { response.FailWithDetailed(gin.H{"reload": false, "code": 300}, "未登录或非法访问", c) c.Abort() @@ -106,7 +106,7 @@ func AuthenticateUser() gin.HandlerFunc { } } -//验证用户是否具备权限 +// 验证用户是否具备权限 func VerifyUrl() gin.HandlerFunc { return func(c *gin.Context) { systemClass := c.Request.Header.Get("system-class") diff --git a/initialization/route/initRoute.go b/initialization/route/initRoute.go index 8cfe284..0c6a8d8 100644 --- a/initialization/route/initRoute.go +++ b/initialization/route/initRoute.go @@ -7,7 +7,7 @@ import ( "github.com/gin-gonic/gin" ) -//初始化主路由 +// 初始化主路由 func InitialRouter() *gin.Engine { var router = gin.Default() @@ -46,8 +46,18 @@ func InitialRouter() *gin.Engine { VerifyIdentity.Use(interceptor.AuthenticateUser()).Use(interceptor.VerifyUrl()) { //v1版本接口 - version1Api := apirouter.RouterGroupEntry.HonorsSouteRouter - version1Api.RouterGroup(VerifyIdentity) + + //荣誉墙 + version1HonorsApi := apirouter.RouterGroupEntry.HonorsSouteRouter + version1HonorsApi.RouterGroup(VerifyIdentity) + //岗位考核 + postRouterApi := apirouter.RouterGroupEntry.PostRouter + postRouterApi.RouterGroupPc(VerifyIdentity) //pc端 + postRouterApi.RouterGroupWeb(VerifyIdentity) //web端 + //部门考核 + departmentRouterApi := apirouter.RouterGroupEntry.DepartmentRouter + departmentRouterApi.RouterGroupPc(VerifyIdentity) //pc端 + departmentRouterApi.RouterGroupWeb(VerifyIdentity) //web端 } //Token身份验证 VerifyIdentityToken := router.Group("") diff --git a/key_performance_indicators.exe b/key_performance_indicators.exe new file mode 100644 index 0000000..7423a07 Binary files /dev/null and b/key_performance_indicators.exe differ diff --git a/models/carrier_type.go b/models/modelshonory/carrier_type.go similarity index 92% rename from models/carrier_type.go rename to models/modelshonory/carrier_type.go index bccec69..e98c0a0 100644 --- a/models/carrier_type.go +++ b/models/modelshonory/carrier_type.go @@ -1,11 +1,11 @@ -package models +package modelshonory import ( "key_performance_indicators/overall" "strings" ) -//载体类型 +// 载体类型 type CarrierType struct { Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:ID"` Name string `json:"name" gorm:"column:name;type:varchar(255) unsigned;default:'';not null;comment:荣誉名称"` @@ -17,13 +17,13 @@ func (CarrierType *CarrierType) TableName() string { return "carrier_type" } -//编辑载体类型内容 +// 编辑载体类型内容 func (cont *CarrierType) EiteCont(whereMap interface{}, saveData interface{}) (err error) { err = overall.CONSTANT_DB_MANAGE_ARCHIVES.Model(&cont).Where(whereMap).Updates(saveData).Error return } -//获取载体类型内容 +// 获取载体类型内容 func (cont *CarrierType) GetCont(whereMap interface{}, field ...string) (err error) { gormDb := overall.CONSTANT_DB_MANAGE_ARCHIVES.Model(&cont) if len(field) > 0 { @@ -35,7 +35,7 @@ func (cont *CarrierType) GetCont(whereMap interface{}, field ...string) (err err return } -//删除内容 +// 删除内容 func (cont *CarrierType) DelCont(whereMap interface{}) (err error) { err = overall.CONSTANT_DB_MANAGE_ARCHIVES.Where(whereMap).Delete(&cont).Error return diff --git a/models/honorary_archives.go b/models/modelshonory/honorary_archives.go similarity index 95% rename from models/honorary_archives.go rename to models/modelshonory/honorary_archives.go index 7072e06..ee57dc4 100644 --- a/models/honorary_archives.go +++ b/models/modelshonory/honorary_archives.go @@ -1,11 +1,11 @@ -package models +package modelshonory import ( "key_performance_indicators/overall" "strings" ) -//荣誉档案 +// 荣誉档案 type HonoraryArchives struct { Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:ID"` Name string `json:"name" gorm:"column:name;type:varchar(255) unsigned;default:'';not null;comment:荣誉名称"` @@ -24,13 +24,13 @@ func (HonoraryArchives *HonoraryArchives) TableName() string { return "honorary_archives" } -//编辑荣誉档案内容 +// 编辑荣誉档案内容 func (cont *HonoraryArchives) EiteCont(whereMap interface{}, saveData interface{}) (err error) { err = overall.CONSTANT_DB_MANAGE_ARCHIVES.Model(&cont).Where(whereMap).Updates(saveData).Error return } -//获取荣誉档案内容 +// 获取荣誉档案内容 func (cont *HonoraryArchives) GetCont(whereMap interface{}, field ...string) (err error) { gormDb := overall.CONSTANT_DB_MANAGE_ARCHIVES.Model(&cont) if len(field) > 0 { @@ -42,7 +42,7 @@ func (cont *HonoraryArchives) GetCont(whereMap interface{}, field ...string) (er return } -//删除内容 +// 删除内容 func (cont *HonoraryArchives) DelCont(whereMap interface{}) (err error) { err = overall.CONSTANT_DB_MANAGE_ARCHIVES.Where(whereMap).Delete(&cont).Error return diff --git a/models/photos_gallery.go b/models/modelshonory/photos_gallery.go similarity index 95% rename from models/photos_gallery.go rename to models/modelshonory/photos_gallery.go index 224cdba..c1d55a3 100644 --- a/models/photos_gallery.go +++ b/models/modelshonory/photos_gallery.go @@ -1,11 +1,11 @@ -package models +package modelshonory import ( "key_performance_indicators/overall" "strings" ) -//图片库 +// 图片库 type PhotosGallery struct { 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:图片地址"` @@ -22,13 +22,13 @@ func (PhotosGallery *PhotosGallery) TableName() string { return "photos_gallery" } -//编辑图片库内容 +// 编辑图片库内容 func (cont *PhotosGallery) EiteCont(whereMap interface{}, saveData interface{}) (err error) { err = overall.CONSTANT_DB_MANAGE_ARCHIVES.Model(&cont).Where(whereMap).Updates(saveData).Error return } -//获取图片库内容 +// 获取图片库内容 func (cont *PhotosGallery) GetCont(whereMap interface{}, field ...string) (err error) { gormDb := overall.CONSTANT_DB_MANAGE_ARCHIVES.Model(&cont) if len(field) > 0 { @@ -40,7 +40,7 @@ func (cont *PhotosGallery) GetCont(whereMap interface{}, field ...string) (err e return } -//删除内容 +// 删除内容 func (cont *PhotosGallery) DelCont(whereMap interface{}) (err error) { err = overall.CONSTANT_DB_MANAGE_ARCHIVES.Where(whereMap).Delete(&cont).Error return diff --git a/models/administrative_organization.go b/models/modelshr/administrative_organization.go similarity index 95% rename from models/administrative_organization.go rename to models/modelshr/administrative_organization.go index 64913ce..e073af7 100644 --- a/models/administrative_organization.go +++ b/models/modelshr/administrative_organization.go @@ -1,11 +1,11 @@ -package models +package modelshr import ( "key_performance_indicators/overall" "strings" ) -//行政组织 +// 行政组织 type AdministrativeOrganization struct { Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` Number string `json:"number" gorm:"column:number;type:varchar(50) unsigned;default:'';not null;comment:行政编码"` @@ -26,13 +26,13 @@ func (AdministrativeOrganization *AdministrativeOrganization) TableName() string return "administrative_organization" } -//编辑行政组织内容 +// 编辑行政组织内容 func (cont *AdministrativeOrganization) EiteCont(whereMap interface{}, saveData interface{}) (err error) { err = overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Updates(saveData).Error return } -//获取行政组织内容 +// 获取行政组织内容 func (cont *AdministrativeOrganization) GetCont(whereMap interface{}, field ...string) (err error) { gormDb := overall.CONSTANT_DB_HR.Model(&cont) if len(field) > 0 { @@ -44,13 +44,13 @@ func (cont *AdministrativeOrganization) GetCont(whereMap interface{}, field ...s return } -//根据条件获取总数 +// 根据条件获取总数 func (cont *AdministrativeOrganization) CountCont(whereMap interface{}) (countId int64) { overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Count(&countId) return } -//读取全部信息 +// 读取全部信息 func (cont *AdministrativeOrganization) ContMap(whereMap interface{}) (countAry []AdministrativeOrganization) { overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Find(&countAry) return diff --git a/models/administrative_organization_type.go b/models/modelshr/administrative_organization_type.go similarity index 94% rename from models/administrative_organization_type.go rename to models/modelshr/administrative_organization_type.go index c0851f5..07a5901 100644 --- a/models/administrative_organization_type.go +++ b/models/modelshr/administrative_organization_type.go @@ -1,11 +1,11 @@ -package models +package modelshr import ( "key_performance_indicators/overall" "strings" ) -//行政组织类型 +// 行政组织类型 type AdministrativeOrganizationType struct { Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` Name string `json:"name" gorm:"column:name;type:varchar(255) unsigned;default:'';not null;comment:类型名称"` @@ -19,13 +19,13 @@ func (AdministrativeOrganizationType *AdministrativeOrganizationType) TableName( return "administrative_organization_type" } -//编辑职务分类内容 +// 编辑职务分类内容 func (cont *AdministrativeOrganizationType) EiteCont(whereMap map[string]interface{}, saveData map[string]interface{}) (err error) { err = overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Updates(saveData).Error return } -//获取详细内容 +// 获取详细内容 func (cont *AdministrativeOrganizationType) GetCont(whereMap map[string]interface{}, field ...string) (err error) { gormDb := overall.CONSTANT_DB_HR.Model(&cont) if len(field) > 0 { diff --git a/models/double_worker.go b/models/modelshr/double_worker.go similarity index 95% rename from models/double_worker.go rename to models/modelshr/double_worker.go index 4f15268..9d13a93 100644 --- a/models/double_worker.go +++ b/models/modelshr/double_worker.go @@ -1,11 +1,11 @@ -package models +package modelshr import ( "key_performance_indicators/overall" "strings" ) -//双职工 +// 双职工 type DoubleWorker 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:员工工号;index"` @@ -23,13 +23,13 @@ func (DoubleWorker *DoubleWorker) TableName() string { return "double_worker" } -//编辑双职工内容 +// 编辑双职工内容 func (DoubleWorker *DoubleWorker) EiteCont(whereMap interface{}, saveData interface{}) (err error) { err = overall.CONSTANT_DB_HR.Model(&DoubleWorker).Where(whereMap).Updates(saveData).Error return } -//获取双职工内容 +// 获取双职工内容 func (cont *DoubleWorker) GetCont(whereMap interface{}, field ...string) (err error) { gormDb := overall.CONSTANT_DB_HR.Model(&cont) if len(field) > 0 { diff --git a/models/duties.go b/models/modelshr/duties.go similarity index 95% rename from models/duties.go rename to models/modelshr/duties.go index 8735bcb..8d3bfbf 100644 --- a/models/duties.go +++ b/models/modelshr/duties.go @@ -1,11 +1,11 @@ -package models +package modelshr import ( "key_performance_indicators/overall" "strings" ) -//职务 +// 职务 type Duties struct { Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` Name string `json:"name" gorm:"column:name;type:varchar(255) unsigned;default:'';not null;comment:职务名称"` @@ -22,13 +22,13 @@ func (Duties *Duties) TableName() string { return "duties" } -//编辑职务分类内容 +// 编辑职务分类内容 func (Duties *Duties) EiteCont(whereMap map[string]interface{}, saveData map[string]interface{}) (err error) { err = overall.CONSTANT_DB_HR.Model(&Duties).Where(whereMap).Updates(saveData).Error return } -//获取详细内容 +// 获取详细内容 func (cont *Duties) GetCont(whereMap interface{}, field ...string) (err error) { gormDb := overall.CONSTANT_DB_HR.Model(&cont) if len(field) > 0 { diff --git a/models/duties_class_leve.go b/models/modelshr/duties_class_leve.go similarity index 95% rename from models/duties_class_leve.go rename to models/modelshr/duties_class_leve.go index 1f04e17..407386f 100644 --- a/models/duties_class_leve.go +++ b/models/modelshr/duties_class_leve.go @@ -1,11 +1,11 @@ -package models +package modelshr import ( "key_performance_indicators/overall" "strings" ) -//职务信息及类别、等级视图 +// 职务信息及类别、等级视图 type DutiesClassLeve struct { Id int64 `json:"id" gorm:"primaryKey;column:d_id;type:bigint(20) unsigned;not null;comment:Id;index"` Name string `json:"name" gorm:"column:d_name;type:varchar(255) unsigned;default:'';not null;comment:职务名称"` @@ -24,7 +24,7 @@ func (DutiesClassLeve *DutiesClassLeve) TableName() string { return "duties_class_leve" } -//获取详细内容 +// 获取详细内容 func (cont *DutiesClassLeve) GetCont(whereMap interface{}, field ...string) (err error) { gormDb := overall.CONSTANT_DB_HR.Model(&cont) if len(field) > 0 { diff --git a/models/emergency_contact.go b/models/modelshr/emergency_contact.go similarity index 94% rename from models/emergency_contact.go rename to models/modelshr/emergency_contact.go index fed3dc1..efe6d25 100644 --- a/models/emergency_contact.go +++ b/models/modelshr/emergency_contact.go @@ -1,11 +1,11 @@ -package models +package modelshr import ( "key_performance_indicators/overall" "strings" ) -//紧急联系人 +// 紧急联系人 type EmergencyContact struct { Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:ID"` Number string `json:"number" gorm:"primaryKey;column:number;type:varchar(30) unsigned;not null;comment:员工工号;index"` @@ -21,13 +21,13 @@ func (EmergencyContact *EmergencyContact) TableName() string { return "emergency_contact" } -//编辑职务分类内容 +// 编辑职务分类内容 func (EmergencyContact *EmergencyContact) EiteCont(whereMap interface{}, saveData interface{}) (err error) { err = overall.CONSTANT_DB_HR.Model(&EmergencyContact).Where(whereMap).Updates(saveData).Error return } -//获取行政组织内容 +// 获取行政组织内容 func (cont *EmergencyContact) GetCont(whereMap interface{}, field ...string) (err error) { gormDb := overall.CONSTANT_DB_HR.Model(&cont) if len(field) > 0 { @@ -39,7 +39,7 @@ func (cont *EmergencyContact) GetCont(whereMap interface{}, field ...string) (er return } -//根据条件获取总数 +// 根据条件获取总数 func (cont *EmergencyContact) CountCont(whereMap interface{}) (countId int64) { overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Count(&countId) return diff --git a/models/empoweruser.go b/models/modelshr/empoweruser.go similarity index 94% rename from models/empoweruser.go rename to models/modelshr/empoweruser.go index c513d89..41c7b37 100644 --- a/models/empoweruser.go +++ b/models/modelshr/empoweruser.go @@ -1,11 +1,11 @@ -package models +package modelshr import ( "key_performance_indicators/overall" "strings" ) -//授权账户 +// 授权账户 type EmpowerUser struct { Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` UserKey string `json:"userkey" gorm:"column:userkey;type:varchar(255) unsigned;not null;comment:账户"` @@ -21,13 +21,13 @@ func (Position *EmpowerUser) TableName() string { return "empoweruser" } -//编辑职务分类内容 +// 编辑职务分类内容 func (cont *EmpowerUser) EiteCont(whereMap interface{}, saveData map[string]interface{}) (err error) { err = overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Updates(saveData).Error return } -//获取行政组织内容 +// 获取行政组织内容 func (cont *EmpowerUser) GetCont(whereMap interface{}, field ...string) (err error) { gormDb := overall.CONSTANT_DB_HR.Model(&cont) if len(field) > 0 { @@ -39,7 +39,7 @@ func (cont *EmpowerUser) GetCont(whereMap interface{}, field ...string) (err err return } -//根据条件获取总数 +// 根据条件获取总数 func (cont *EmpowerUser) CountCont(whereMap interface{}) (countId int64) { overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Count(&countId) return diff --git a/models/family_members.go b/models/modelshr/family_members.go similarity index 96% rename from models/family_members.go rename to models/modelshr/family_members.go index b42e9a8..73a42fd 100644 --- a/models/family_members.go +++ b/models/modelshr/family_members.go @@ -1,11 +1,11 @@ -package models +package modelshr import ( "key_performance_indicators/overall" "strings" ) -//员工家属 +// 员工家属 type FamilyMembers 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:员工工号"` @@ -27,13 +27,13 @@ func (FamilyMembers *FamilyMembers) TableName() string { return "family_members" } -//编辑员工家属内容 +// 编辑员工家属内容 func (FamilyMembers *FamilyMembers) EiteCont(whereMap interface{}, saveData interface{}) (err error) { err = overall.CONSTANT_DB_HR.Model(&FamilyMembers).Where(whereMap).Updates(saveData).Error return } -//获取员工家属内容 +// 获取员工家属内容 func (cont *FamilyMembers) GetCont(whereMap interface{}, field ...string) (err error) { gormDb := overall.CONSTANT_DB_HR.Model(&cont) if len(field) > 0 { diff --git a/models/inside_work_history.go b/models/modelshr/inside_work_history.go similarity index 96% rename from models/inside_work_history.go rename to models/modelshr/inside_work_history.go index 0690ca6..b6ee2ab 100644 --- a/models/inside_work_history.go +++ b/models/modelshr/inside_work_history.go @@ -1,11 +1,11 @@ -package models +package modelshr import ( "key_performance_indicators/overall" "strings" ) -//集团内部工作经历 +// 集团内部工作经历 type InsideWorkHistory struct { Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` Key int64 `json:"key" gorm:"column:key;type:bigint(20) unsigned;default:0;not null;comment:员工识别符"` @@ -29,13 +29,13 @@ func (InsideWorkHistory *InsideWorkHistory) TableName() string { return "inside_work_history" } -//编辑集团内部工作经历内容 +// 编辑集团内部工作经历内容 func (cont *InsideWorkHistory) EditCont(whereMap map[string]interface{}, saveData map[string]interface{}) (err error) { err = overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Updates(saveData).Error return } -//获取详细内容 +// 获取详细内容 func (cont *InsideWorkHistory) GetCont(whereMap interface{}, field ...string) (err error) { gormDb := overall.CONSTANT_DB_HR.Model(&cont) if len(field) > 0 { diff --git a/models/inside_work_view.go b/models/modelshr/inside_work_view.go similarity index 98% rename from models/inside_work_view.go rename to models/modelshr/inside_work_view.go index 7d4ef32..7d56a25 100644 --- a/models/inside_work_view.go +++ b/models/modelshr/inside_work_view.go @@ -1,4 +1,4 @@ -package models +package modelshr import ( "key_performance_indicators/overall" @@ -26,7 +26,7 @@ func (InsideWorkView *InsideWorkView) TableName() string { return "inside_work_view" } -//获取详细内容 +// 获取详细内容 func (cont *InsideWorkView) GetCont(whereMap interface{}, field ...string) (err error) { gormDb := overall.CONSTANT_DB_HR.Model(&cont) if len(field) > 0 { diff --git a/models/job_class.go b/models/modelshr/job_class.go similarity index 94% rename from models/job_class.go rename to models/modelshr/job_class.go index d107378..b660997 100644 --- a/models/job_class.go +++ b/models/modelshr/job_class.go @@ -1,11 +1,11 @@ -package models +package modelshr import ( "key_performance_indicators/overall" "strings" ) -//职务分类 +// 职务分类 type JobClass struct { Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` Name string `json:"name" gorm:"column:name;type:varchar(255) unsigned;default:'';not null;comment:职务分类名称"` @@ -19,13 +19,13 @@ func (JobClass *JobClass) TableName() string { return "job_class" } -//编辑职务分类内容 +// 编辑职务分类内容 func (JobClass *JobClass) EiteJobClassCont(whereMap map[string]interface{}, saveData map[string]interface{}) (err error) { err = overall.CONSTANT_DB_HR.Model(&JobClass).Where(whereMap).Updates(saveData).Error return } -//获取详细内容 +// 获取详细内容 func (cont *JobClass) GetCont(whereMap interface{}, field ...string) (err error) { gormDb := overall.CONSTANT_DB_HR.Model(&cont) if len(field) > 0 { diff --git a/models/kingdee_log.go b/models/modelshr/kingdee_log.go similarity index 92% rename from models/kingdee_log.go rename to models/modelshr/kingdee_log.go index 3e4a813..721560f 100644 --- a/models/kingdee_log.go +++ b/models/modelshr/kingdee_log.go @@ -1,11 +1,11 @@ -package models +package modelshr import ( "key_performance_indicators/overall" "strings" ) -//金蝶对照记录 +// 金蝶对照记录 type KingdeeLog struct { Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` Number string `json:"number" gorm:"column:number;type:varchar(255) unsigned;default:'';not null;comment:工号"` @@ -17,13 +17,13 @@ func (KingdeeLog *KingdeeLog) TableName() string { return "kingdee_log" } -//编辑职务分类内容 +// 编辑职务分类内容 func (KingdeeLog *KingdeeLog) EidtCont(whereMap map[string]interface{}, saveData map[string]interface{}) (err error) { err = overall.CONSTANT_DB_HR.Model(&KingdeeLog).Where(whereMap).Updates(saveData).Error return } -//获取详细内容 +// 获取详细内容 func (cont *KingdeeLog) GetCont(whereMap interface{}, field ...string) (err error) { gormDb := overall.CONSTANT_DB_HR.Model(&cont) if len(field) > 0 { diff --git a/models/man_cont.go b/models/modelshr/man_cont.go similarity index 99% rename from models/man_cont.go rename to models/modelshr/man_cont.go index d79c804..e1b5edb 100644 --- a/models/man_cont.go +++ b/models/modelshr/man_cont.go @@ -1,4 +1,4 @@ -package models +package modelshr import ( "key_performance_indicators/overall" @@ -63,7 +63,7 @@ func (ManCont *ManCont) TableName() string { return "man_cont" } -//获取职务分类内容 +// 获取职务分类内容 func (cont *ManCont) GetCont(whereMap interface{}, field ...string) (err error) { gormDb := overall.CONSTANT_DB_HR.Model(&cont) if len(field) > 0 { diff --git a/models/org_cont_type.go b/models/modelshr/org_cont_type.go similarity index 94% rename from models/org_cont_type.go rename to models/modelshr/org_cont_type.go index dd6d561..46e7e81 100644 --- a/models/org_cont_type.go +++ b/models/modelshr/org_cont_type.go @@ -1,11 +1,11 @@ -package models +package modelshr import ( "key_performance_indicators/overall" "strings" ) -//职务信息及类别、等级视图 +// 职务信息及类别、等级视图 type OrgContType struct { Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` Number string `json:"number" gorm:"column:number;type:varchar(50) unsigned;default:'';not null;comment:行政编码"` @@ -21,7 +21,7 @@ func (OrgContType *OrgContType) TableName() string { return "org_cont_type" } -//获取详细内容 +// 获取详细内容 func (cont *OrgContType) GetCont(whereMap interface{}, field ...string) (err error) { gormDb := overall.CONSTANT_DB_HR.Model(&cont) if len(field) > 0 { diff --git a/models/personarchives.go b/models/modelshr/personarchives.go similarity index 98% rename from models/personarchives.go rename to models/modelshr/personarchives.go index cc80f2f..ab26426 100644 --- a/models/personarchives.go +++ b/models/modelshr/personarchives.go @@ -1,11 +1,11 @@ -package models +package modelshr import ( "key_performance_indicators/overall" "strings" ) -//员工档案(主) +// 员工档案(主) type PersonArchives 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:员工工号"` @@ -42,13 +42,13 @@ func (PersonArchives *PersonArchives) TableName() string { return "person_archives" } -//编辑员工档案 +// 编辑员工档案 func (PersonArchives *PersonArchives) EiteCont(whereMap interface{}, saveData interface{}) (err error) { err = overall.CONSTANT_DB_HR.Model(&PersonArchives).Where(whereMap).Updates(saveData).Error return } -//获取员工档案 +// 获取员工档案 func (cont *PersonArchives) GetCont(whereMap interface{}, field ...string) (err error) { gormDb := overall.CONSTANT_DB_HR.Model(&cont) if len(field) > 0 { diff --git a/models/personnel.go b/models/modelshr/personnel.go similarity index 97% rename from models/personnel.go rename to models/modelshr/personnel.go index f1ce272..0fbd37e 100644 --- a/models/personnel.go +++ b/models/modelshr/personnel.go @@ -1,11 +1,11 @@ -package models +package modelshr import ( "key_performance_indicators/overall" "strings" ) -//员工档案(主) +// 员工档案(主) type Personnel 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:员工工号"` @@ -35,13 +35,13 @@ func (Personnel *Personnel) TableName() string { return "personnel" } -//编辑员工档案 +// 编辑员工档案 func (Personnel *Personnel) EiteCont(whereMap interface{}, saveData interface{}) (err error) { err = overall.CONSTANT_DB_HR.Model(&Personnel).Where(whereMap).Updates(saveData).Error return } -//获取员工档案 +// 获取员工档案 func (cont *Personnel) GetCont(whereMap interface{}, field ...string) (err error) { gormDb := overall.CONSTANT_DB_HR.Model(&cont) if len(field) > 0 { diff --git a/models/personnel_change_record.go b/models/modelshr/personnel_change_record.go similarity index 99% rename from models/personnel_change_record.go rename to models/modelshr/personnel_change_record.go index 9ec46f9..8c9a084 100644 --- a/models/personnel_change_record.go +++ b/models/modelshr/personnel_change_record.go @@ -1,4 +1,4 @@ -package models +package modelshr import "key_performance_indicators/overall" diff --git a/models/personnel_content.go b/models/modelshr/personnel_content.go similarity index 98% rename from models/personnel_content.go rename to models/modelshr/personnel_content.go index afed964..0ac6713 100644 --- a/models/personnel_content.go +++ b/models/modelshr/personnel_content.go @@ -1,4 +1,4 @@ -package models +package modelshr import ( "key_performance_indicators/overall" @@ -48,13 +48,13 @@ func (PersonnelContent *PersonnelContent) TableName() string { return "personnel_content" } -//编辑职务分类内容 +// 编辑职务分类内容 func (PersonnelContent *PersonnelContent) EiteCont(whereMap interface{}, saveData interface{}) (err error) { err = overall.CONSTANT_DB_HR.Model(&PersonnelContent).Where(whereMap).Updates(saveData).Error return } -//获取职务分类内容 +// 获取职务分类内容 func (cont *PersonnelContent) GetCont(whereMap interface{}, field ...string) (err error) { gormDb := overall.CONSTANT_DB_HR.Model(&cont) if len(field) > 0 { diff --git a/models/personnel_education.go b/models/modelshr/personnel_education.go similarity index 97% rename from models/personnel_education.go rename to models/modelshr/personnel_education.go index 7ef997e..0ee4084 100644 --- a/models/personnel_education.go +++ b/models/modelshr/personnel_education.go @@ -1,4 +1,4 @@ -package models +package modelshr import ( "key_performance_indicators/overall" @@ -29,13 +29,13 @@ func (PersonnelEducation *PersonnelEducation) TableName() string { return "personnel_education" } -//编辑教育经历内容 +// 编辑教育经历内容 func (PersonnelEducation *PersonnelEducation) EiteCont(whereMap interface{}, saveData interface{}) (err error) { err = overall.CONSTANT_DB_HR.Model(&PersonnelEducation).Where(whereMap).Updates(saveData).Error return } -//获取教育经历内容 +// 获取教育经历内容 func (cont *PersonnelEducation) GetCont(whereMap interface{}, field ...string) (err error) { gormDb := overall.CONSTANT_DB_HR.Model(&cont) if len(field) > 0 { diff --git a/models/position.go b/models/modelshr/position.go similarity index 95% rename from models/position.go rename to models/modelshr/position.go index ce3b549..aada05e 100644 --- a/models/position.go +++ b/models/modelshr/position.go @@ -1,11 +1,11 @@ -package models +package modelshr import ( "key_performance_indicators/overall" "strings" ) -//职位(岗位) +// 职位(岗位) type Position struct { Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` Number string `json:"number" gorm:"column:number;type:varchar(50) unsigned;default:'';not null;comment:职位编码"` @@ -27,13 +27,13 @@ func (Position *Position) TableName() string { return "position" } -//编辑职务分类内容 +// 编辑职务分类内容 func (cont *Position) EiteCont(whereMap interface{}, saveData map[string]interface{}) (err error) { err = overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Updates(saveData).Error return } -//获取行政组织内容 +// 获取行政组织内容 func (cont *Position) GetCont(whereMap interface{}, field ...string) (err error) { gormDb := overall.CONSTANT_DB_HR.Model(&cont) if len(field) > 0 { @@ -45,7 +45,7 @@ func (cont *Position) GetCont(whereMap interface{}, field ...string) (err error) return } -//根据条件获取总数 +// 根据条件获取总数 func (cont *Position) CountCont(whereMap interface{}) (countId int64) { overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Count(&countId) return diff --git a/models/position_level.go b/models/modelshr/position_level.go similarity index 98% rename from models/position_level.go rename to models/modelshr/position_level.go index c691108..506f11c 100644 --- a/models/position_level.go +++ b/models/modelshr/position_level.go @@ -1,4 +1,4 @@ -package models +package modelshr import "key_performance_indicators/overall" diff --git a/models/post_duties_job.go b/models/modelshr/post_duties_job.go similarity index 98% rename from models/post_duties_job.go rename to models/modelshr/post_duties_job.go index be7d677..7e31d21 100644 --- a/models/post_duties_job.go +++ b/models/modelshr/post_duties_job.go @@ -1,4 +1,4 @@ -package models +package modelshr import ( "key_performance_indicators/overall" @@ -31,7 +31,7 @@ func (PostDutiesJob *PostDutiesJob) TableName() string { return "post_duties_job" } -//获取详细内容 +// 获取详细内容 func (cont *PostDutiesJob) GetCont(whereMap interface{}, field ...string) (err error) { gormDb := overall.CONSTANT_DB_HR.Model(&cont) if len(field) > 0 { diff --git a/models/teamgroup.go b/models/modelshr/teamgroup.go similarity index 94% rename from models/teamgroup.go rename to models/modelshr/teamgroup.go index f05c3b9..06b56d5 100644 --- a/models/teamgroup.go +++ b/models/modelshr/teamgroup.go @@ -1,11 +1,11 @@ -package models +package modelshr import ( "key_performance_indicators/overall" "strings" ) -//班组 +// 班组 type TeamGroup struct { Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` Name string `json:"name" gorm:"column:name;type:varchar(255) unsigned;default:'';not null;comment:班组名称"` @@ -17,13 +17,13 @@ func (TeamGroup *TeamGroup) TableName() string { return "teamgroup" } -//编辑班组内容 +// 编辑班组内容 func (TeamGroup *TeamGroup) EiteTeamGroupCont(whereMap map[string]interface{}, saveData map[string]interface{}) (err error) { err = overall.CONSTANT_DB_HR.Model(&TeamGroup).Where(whereMap).Updates(saveData).Error return } -//获取详细内容 +// 获取详细内容 func (cont *TeamGroup) GetCont(whereMap interface{}, field ...string) (err error) { gormDb := overall.CONSTANT_DB_HR.Model(&cont) if len(field) > 0 { diff --git a/models/work_history.go b/models/modelshr/work_history.go similarity index 95% rename from models/work_history.go rename to models/modelshr/work_history.go index 159451e..5357a59 100644 --- a/models/work_history.go +++ b/models/modelshr/work_history.go @@ -1,11 +1,11 @@ -package models +package modelshr import ( "key_performance_indicators/overall" "strings" ) -//工作履历 +// 工作履历 type WorkHistory struct { Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` Number string `json:"number" gorm:"column:number;type:varchar(50) unsigned;default:'';not null;comment:工号"` @@ -26,13 +26,13 @@ func (WorkHistory *WorkHistory) TableName() string { return "work_history" } -//编辑职务分类内容 +// 编辑职务分类内容 func (cont *WorkHistory) EiteCont(whereMap interface{}, saveData map[string]interface{}) (err error) { err = overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Updates(saveData).Error return } -//获取行政组织内容 +// 获取行政组织内容 func (cont *WorkHistory) GetCont(whereMap interface{}, field ...string) (err error) { gormDb := overall.CONSTANT_DB_HR.Model(&cont) if len(field) > 0 { @@ -44,7 +44,7 @@ func (cont *WorkHistory) GetCont(whereMap interface{}, field ...string) (err err return } -//根据条件获取总数 +// 根据条件获取总数 func (cont *WorkHistory) CountCont(whereMap interface{}) (countId int64) { overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Count(&countId) return diff --git a/models/modelskpi/depart_dime_post_weight.go b/models/modelskpi/depart_dime_post_weight.go new file mode 100644 index 0000000..72036f8 --- /dev/null +++ b/models/modelskpi/depart_dime_post_weight.go @@ -0,0 +1,64 @@ +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:指标"` +} + +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 +} diff --git a/models/modelskpi/detailed_target.go b/models/modelskpi/detailed_target.go new file mode 100644 index 0000000..356f298 --- /dev/null +++ b/models/modelskpi/detailed_target.go @@ -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 +} diff --git a/models/modelskpi/dutyclass.go b/models/modelskpi/dutyclass.go new file mode 100644 index 0000000..3dcefb4 --- /dev/null +++ b/models/modelskpi/dutyclass.go @@ -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 +} diff --git a/models/modelskpi/evaluationtarget.go b/models/modelskpi/evaluationtarget.go new file mode 100644 index 0000000..b3852f6 --- /dev/null +++ b/models/modelskpi/evaluationtarget.go @@ -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 +} diff --git a/models/modelskpi/post_target.go b/models/modelskpi/post_target.go new file mode 100644 index 0000000..43265e6 --- /dev/null +++ b/models/modelskpi/post_target.go @@ -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 int64 `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 +} diff --git a/models/modelskpi/target_department.go b/models/modelskpi/target_department.go new file mode 100644 index 0000000..5e73545 --- /dev/null +++ b/models/modelskpi/target_department.go @@ -0,0 +1,65 @@ +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"` + 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"` + ReportPerson string `json:"reportperson" gorm:"column:report_person;type:longtext;comment:上报人"` + 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:写入时间"` +} + +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 +} diff --git a/models/menu_operation.go b/models/modelsschool/menu_operation.go similarity index 95% rename from models/menu_operation.go rename to models/modelsschool/menu_operation.go index 369eadb..bc3dcd4 100644 --- a/models/menu_operation.go +++ b/models/modelsschool/menu_operation.go @@ -1,4 +1,4 @@ -package models +package modelsschool //菜单功能 type MenuOperation struct { diff --git a/models/step_role_group.go b/models/modelsschool/step_role_group.go similarity index 98% rename from models/step_role_group.go rename to models/modelsschool/step_role_group.go index 7196554..54dd410 100644 --- a/models/step_role_group.go +++ b/models/modelsschool/step_role_group.go @@ -1,4 +1,4 @@ -package models +package modelsschool import "key_performance_indicators/overall" diff --git a/models/system_nenu.go b/models/modelsschool/system_nenu.go similarity index 94% rename from models/system_nenu.go rename to models/modelsschool/system_nenu.go index 04315e7..be33325 100644 --- a/models/system_nenu.go +++ b/models/modelsschool/system_nenu.go @@ -1,11 +1,11 @@ -package models +package modelsschool import ( "key_performance_indicators/overall" "strings" ) -//菜单 +// 菜单 type SystemMenu struct { Id int64 `json:"id" gorm:"primaryKey;column:m_id;type:bigint(20) unsigned;not null;comment:ID"` Title string `json:"title" gorm:"column:m_title;type:varchar(255);not null;comment:菜单名称"` @@ -22,19 +22,19 @@ func (SystemMenu *SystemMenu) TableName() string { return "system_menu" } -//菜单管理 +// 菜单管理 type SystemMenuOperation struct { SystemMenu MenuPermit []MenuOperation `json:"menupermit"` } -//根据条件获取总数 +// 根据条件获取总数 func (cont *SystemMenu) CountCont(whereMap map[string]interface{}) (countId int64) { overall.CONSTANT_DB_Master.Model(&cont).Where(whereMap).Count(&countId) return } -//获取行政组织内容 +// 获取行政组织内容 func (cont *SystemMenu) GetCont(whereMap map[string]interface{}, field ...string) (err error) { gormDb := overall.CONSTANT_DB_Master.Model(&cont) if len(field) > 0 { diff --git a/models/system_role.go b/models/modelsschool/system_role.go similarity index 98% rename from models/system_role.go rename to models/modelsschool/system_role.go index 493e7d0..7db4331 100644 --- a/models/system_role.go +++ b/models/modelsschool/system_role.go @@ -1,4 +1,4 @@ -package models +package modelsschool import "key_performance_indicators/overall" diff --git a/models/system_user.go b/models/modelsschool/system_user.go similarity index 98% rename from models/system_user.go rename to models/modelsschool/system_user.go index deca05b..3a8a172 100644 --- a/models/system_user.go +++ b/models/modelsschool/system_user.go @@ -1,4 +1,4 @@ -package models +package modelsschool import "key_performance_indicators/overall" diff --git a/models/system_user_attribute.go b/models/modelsschool/system_user_attribute.go similarity index 98% rename from models/system_user_attribute.go rename to models/modelsschool/system_user_attribute.go index 969b3c3..d915475 100644 --- a/models/system_user_attribute.go +++ b/models/modelsschool/system_user_attribute.go @@ -1,4 +1,4 @@ -package models +package modelsschool import "key_performance_indicators/overall" diff --git a/models/wechatUsers.go b/models/modelswechat/wechatUsers.go similarity index 99% rename from models/wechatUsers.go rename to models/modelswechat/wechatUsers.go index 85b6a4a..a1a1058 100644 --- a/models/wechatUsers.go +++ b/models/modelswechat/wechatUsers.go @@ -1,4 +1,4 @@ -package models +package modelswechat //企业微信人员架构 type WechatUsers struct { diff --git a/overall/publicmethod/formatOutput.go b/overall/publicmethod/formatOutput.go index 2018f13..e2f5d67 100644 --- a/overall/publicmethod/formatOutput.go +++ b/overall/publicmethod/formatOutput.go @@ -4,14 +4,14 @@ import ( "encoding/json" "errors" "fmt" - "key_performance_indicators/models" + "key_performance_indicators/models/modelshr" "key_performance_indicators/overall" "net/http" "github.com/gin-gonic/gin" ) -//格式化输出 +// 格式化输出 func Result(code int, data interface{}, c *gin.Context, msgAry ...string) { var msg string if _, isTrue := ErrorCodeMsg[code]; isTrue { @@ -45,8 +45,8 @@ func ResultList(code, page, pageSize int, total, count int64, data interface{}, return } -//登录信息转换 -func LoginMyCont(c *gin.Context) (myCont models.ManCont, err error) { +// 登录信息转换 +func LoginMyCont(c *gin.Context) (myCont modelshr.ManCont, err error) { context, exi := c.Get(overall.MyContJwt) if exi != true { err = errors.New("对不起!你没有该功能的操作权限!1") diff --git a/overall/publicmethod/technique.go b/overall/publicmethod/technique.go index 97336e5..d0c8d85 100644 --- a/overall/publicmethod/technique.go +++ b/overall/publicmethod/technique.go @@ -9,7 +9,7 @@ import ( "errors" "fmt" "key_performance_indicators/middleware/grocerystore" - "key_performance_indicators/models" + "key_performance_indicators/models/modelshr" "key_performance_indicators/overall" "math" "math/big" @@ -21,8 +21,8 @@ import ( "gorm.io/gorm" ) -//全局函数处理 -//编号,纯数字 +// 全局函数处理 +// 编号,纯数字 func TableNumber(class ...string) (number int64) { result, _ := rand.Int(rand.Reader, big.NewInt(8999)) numberTeam := result.Int64() + 1000 @@ -36,7 +36,7 @@ func TableNumber(class ...string) (number int64) { return } -//初始化map(泛型) +// 初始化map(泛型) func MapOut[T GenericityVariable]() (data map[T]interface{}) { data = make(map[T]interface{}) //必可不少,分配内存 return data @@ -118,7 +118,7 @@ func DateToTimeStamp(dataStr string) (timeStamp int64, isTrue bool) { return } -//数据库查询翻页 +// 数据库查询翻页 func LimitPage(page, pageSize int) (offSet int) { if page < 1 { page = 1 @@ -130,7 +130,7 @@ func LimitPage(page, pageSize int) (offSet int) { return } -//中文首字母大写 +// 中文首字母大写 func ChineseFirstWordCapitalize(wordStr string) (firstWord string) { pinYinSub := pinyin.NewArgs() rows := pinyin.Pinyin(wordStr, pinYinSub) @@ -144,13 +144,12 @@ func ChineseFirstWordCapitalize(wordStr string) (firstWord string) { return } -// ZeroFillByStr -// @Description: 字符串补零 -// @param str :需要操作的字符串 -// @param resultLen 结果字符串的长度 -// @param reverse true 为前置补零,false 为后置补零 -// @return string -// +// ZeroFillByStr +// @Description: 字符串补零 +// @param str :需要操作的字符串 +// @param resultLen 结果字符串的长度 +// @param reverse true 为前置补零,false 为后置补零 +// @return string func ZeroFillByStr(str string, resultLen int, reverse bool) string { if len(str) > resultLen || resultLen <= 0 { return str @@ -272,13 +271,13 @@ func (m *Md5Encryption) Md5EncryptionAlgorithmFj() (md5Val string, outlog []stri return } -//初始化程序 +// 初始化程序 func (m *Md5Encryption) Md5EncryptionInit(code string) { m.AppKey = overall.CONSTANT_CONFIG.Appsetup.AppKey m.Code = code } -//sha1算法 +// sha1算法 func Sha1Encryption(str string) string { sha1 := sha1.New() sha1.Write([]byte(str)) @@ -306,7 +305,7 @@ func GetFutureMonthTime(timeStamp int64, futureTime, class int) (dateStr int64) return } -//判断字符串是否在切片中 泛型 +// 判断字符串是否在切片中 泛型 func IsInTrue[T GenericityVariable](key T, keyAry []T) (isTrue bool) { isTrue = false for _, v := range keyAry { @@ -317,7 +316,7 @@ func IsInTrue[T GenericityVariable](key T, keyAry []T) (isTrue bool) { return } -//获取两个切片得差集 +// 获取两个切片得差集 func DifferenceSet[T GenericityVariable](one, two []T) []T { var three []T temp := map[T]struct{}{} @@ -367,8 +366,8 @@ func StringToInt64(val interface{}) (int64, error) { return 0, nil } -//获取人员TokenRedis 信息 -func GetUserRedisToken(number string) (manCont models.ManCont, err error) { +// 获取人员TokenRedis 信息 +func GetUserRedisToken(number string) (manCont modelshr.ManCont, err error) { redisMyContKey := fmt.Sprintf("ScanCode:Authentication:UserCont_%v_%v", overall.CONSTANT_CONFIG.RedisPrefixStr.Alias, number) redisClient := grocerystore.RunRedis(overall.CONSTANT_REDIS5) useMap, isTrue := redisClient.HashGetAll(redisMyContKey) @@ -381,8 +380,8 @@ func GetUserRedisToken(number string) (manCont models.ManCont, err error) { return } -//获取人员Redis信息 -func GetUserRedisCont(number string) (manCont models.ManCont, err error) { +// 获取人员Redis信息 +func GetUserRedisCont(number string) (manCont modelshr.ManCont, err error) { redisMyContKey := fmt.Sprintf("ScanCode:Authentication:UserCont_%v_%v", overall.CONSTANT_CONFIG.RedisPrefixStr.Alias, number) redisClient := grocerystore.RunRedis(overall.CONSTANT_REDIS5) useMap, isTrue := redisClient.HashGetAll(redisMyContKey) @@ -397,8 +396,8 @@ func GetUserRedisCont(number string) (manCont models.ManCont, err error) { return } -//获取人员Redis信息返回指针 -func GetUserRedisContPointer(number string) (manCont models.ManCont, err error) { +// 获取人员Redis信息返回指针 +func GetUserRedisContPointer(number string) (manCont modelshr.ManCont, err error) { redisMyContKey := fmt.Sprintf("ScanCode:Authentication:UserCont_%v_%v", overall.CONSTANT_CONFIG.RedisPrefixStr.Alias, number) redisClient := grocerystore.RunRedis(overall.CONSTANT_REDIS5) useMap, isTrue := redisClient.HashGetAll(redisMyContKey) @@ -475,7 +474,7 @@ func MapToStruct(mapString map[string]string, structInterface interface{}, tag s return } -//翻页设置 +// 翻页设置 func PageTurningSettings(gormDb *gorm.DB, page, pageSize int) *gorm.DB { if page < 0 { page = 1 diff --git a/overall/publicmethod/type.go b/overall/publicmethod/type.go index 962375a..149d417 100644 --- a/overall/publicmethod/type.go +++ b/overall/publicmethod/type.go @@ -23,6 +23,11 @@ type PublicId struct { Id string `json:"id"` } +//通用name结构体 +type PublicName struct { + Name string `json:"name"` +} + //通用编辑状态结构体 type PublicState struct { PublicId