Browse Source

更改models文档结构。

pull/4/head
超级管理员 3 years ago
parent
commit
f955e503a4
  1. 49
      README.md
  2. 9
      api/base/loginVerify/login.go
  3. 6
      api/base/loginVerify/type.go
  4. 4
      api/empower/authorize/empower.go
  5. 220
      api/version1/departmentseting/departmentpc/qualitativekpi.go
  6. 44
      api/version1/departmentseting/departmentpc/type.go
  7. 16
      api/version1/departmentseting/departmentweb/type.go
  8. 12
      api/version1/entry.go
  9. 14
      api/version1/honoraryArchives/carriertype.go
  10. 26
      api/version1/honoraryArchives/honors.go
  11. 111
      api/version1/postseting/postpc/scheme.go
  12. 52
      api/version1/postseting/postpc/type.go
  13. 16
      api/version1/postseting/postweb/type.go
  14. 4
      apirouter/entry.go
  15. 22
      apirouter/v1/departmentseting/pc.go
  16. 4
      apirouter/v1/departmentseting/type.go
  17. 19
      apirouter/v1/departmentseting/web.go
  18. 20
      apirouter/v1/postseting/pc.go
  19. 4
      apirouter/v1/postseting/type.go
  20. 18
      apirouter/v1/postseting/web.go
  21. 4
      config/configDatabase/database.yaml
  22. 4
      identification/interceptor/authentication.go
  23. 2
      identification/interceptor/identity.go
  24. 14
      initialization/route/initRoute.go
  25. BIN
      key_performance_indicators.exe
  26. 2
      models/modelshonory/carrier_type.go
  27. 2
      models/modelshonory/honorary_archives.go
  28. 2
      models/modelshonory/photos_gallery.go
  29. 2
      models/modelshr/administrative_organization.go
  30. 2
      models/modelshr/administrative_organization_type.go
  31. 2
      models/modelshr/double_worker.go
  32. 2
      models/modelshr/duties.go
  33. 2
      models/modelshr/duties_class_leve.go
  34. 2
      models/modelshr/emergency_contact.go
  35. 2
      models/modelshr/empoweruser.go
  36. 2
      models/modelshr/family_members.go
  37. 2
      models/modelshr/inside_work_history.go
  38. 2
      models/modelshr/inside_work_view.go
  39. 2
      models/modelshr/job_class.go
  40. 2
      models/modelshr/kingdee_log.go
  41. 2
      models/modelshr/man_cont.go
  42. 2
      models/modelshr/org_cont_type.go
  43. 2
      models/modelshr/personarchives.go
  44. 2
      models/modelshr/personnel.go
  45. 2
      models/modelshr/personnel_change_record.go
  46. 2
      models/modelshr/personnel_content.go
  47. 2
      models/modelshr/personnel_education.go
  48. 2
      models/modelshr/position.go
  49. 2
      models/modelshr/position_level.go
  50. 2
      models/modelshr/post_duties_job.go
  51. 2
      models/modelshr/teamgroup.go
  52. 2
      models/modelshr/work_history.go
  53. 64
      models/modelskpi/depart_dime_post_weight.go
  54. 73
      models/modelskpi/detailed_target.go
  55. 62
      models/modelskpi/dutyclass.go
  56. 71
      models/modelskpi/evaluationtarget.go
  57. 72
      models/modelskpi/post_target.go
  58. 65
      models/modelskpi/target_department.go
  59. 2
      models/modelsschool/menu_operation.go
  60. 2
      models/modelsschool/step_role_group.go
  61. 2
      models/modelsschool/system_nenu.go
  62. 2
      models/modelsschool/system_role.go
  63. 2
      models/modelsschool/system_user.go
  64. 2
      models/modelsschool/system_user_attribute.go
  65. 2
      models/modelswechat/wechatUsers.go
  66. 4
      overall/publicmethod/formatOutput.go
  67. 9
      overall/publicmethod/technique.go
  68. 5
      overall/publicmethod/type.go

49
README.md

@ -54,3 +54,52 @@
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
```

9
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 {
@ -153,7 +154,7 @@ func (a *ApiMethod) ScanCodeLogin(c *gin.Context) {
// 获取权限点位
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

6
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"
@ -33,6 +33,6 @@ type Login struct {
// 原知行学院管理员表
type OldSchollAdmin struct {
models.SystemUser
models.SystemUserAttribute
modelsschool.SystemUser
modelsschool.SystemUserAttribute
}

4
api/empower/authorize/empower.go

@ -2,13 +2,13 @@ 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"
)
@ -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)

220
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)
}

44
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"` //是否为主部门
}

16
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)
}

12
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
PostPcApi postpc.ApiMethod
PostWebApi postweb.ApiMethod
DeparmentPcApi departmentpc.ApiMethod
DeparmentWebApi departmentweb.ApiMethod
}
var AppApiEntry = new(ApiEntry)

14
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"
@ -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+"%")
}
@ -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 {
@ -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)
@ -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)

26
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"
@ -17,8 +17,8 @@ import (
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+"%")
}
@ -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 //文档名称"`
@ -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 {
@ -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)

111
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
}

52
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"` //指标列表
}

16
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)
}

4
apirouter/entry.go

@ -3,7 +3,9 @@ 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"
)
@ -14,6 +16,8 @@ type RouterGroup struct {
VerifyLogin verifyLogin.ApiRouter
ShiyanApi apishiyan.ApiRouter
HonorsSouteRouter honorsRoute.ApiRouter
PostRouter postseting.ApiRouter
DepartmentRouter departmentseting.ApiRouter
}
var RouterGroupEntry = new(RouterGroup)

22
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) //获取部门定性考核部门关联列表
}
}

4
apirouter/v1/departmentseting/type.go

@ -0,0 +1,4 @@
package departmentseting
//部门考核
type ApiRouter struct{}

19
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) //入口
}
}

20
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) //获取岗位相关指标
}
}

4
apirouter/v1/postseting/type.go

@ -0,0 +1,4 @@
package postseting
//岗位考核
type ApiRouter struct{}

18
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) //入口
}
}

4
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 #最大空闲数量

4
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"
@ -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)

2
identification/interceptor/identity.go

@ -16,7 +16,7 @@ func AuthenticateUser() gin.HandlerFunc {
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()

14
initialization/route/initRoute.go

@ -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("")

BIN
key_performance_indicators.exe

Binary file not shown.

2
models/carrier_type.go → models/modelshonory/carrier_type.go

@ -1,4 +1,4 @@
package models
package modelshonory
import (
"key_performance_indicators/overall"

2
models/honorary_archives.go → models/modelshonory/honorary_archives.go

@ -1,4 +1,4 @@
package models
package modelshonory
import (
"key_performance_indicators/overall"

2
models/photos_gallery.go → models/modelshonory/photos_gallery.go

@ -1,4 +1,4 @@
package models
package modelshonory
import (
"key_performance_indicators/overall"

2
models/administrative_organization.go → models/modelshr/administrative_organization.go

@ -1,4 +1,4 @@
package models
package modelshr
import (
"key_performance_indicators/overall"

2
models/administrative_organization_type.go → models/modelshr/administrative_organization_type.go

@ -1,4 +1,4 @@
package models
package modelshr
import (
"key_performance_indicators/overall"

2
models/double_worker.go → models/modelshr/double_worker.go

@ -1,4 +1,4 @@
package models
package modelshr
import (
"key_performance_indicators/overall"

2
models/duties.go → models/modelshr/duties.go

@ -1,4 +1,4 @@
package models
package modelshr
import (
"key_performance_indicators/overall"

2
models/duties_class_leve.go → models/modelshr/duties_class_leve.go

@ -1,4 +1,4 @@
package models
package modelshr
import (
"key_performance_indicators/overall"

2
models/emergency_contact.go → models/modelshr/emergency_contact.go

@ -1,4 +1,4 @@
package models
package modelshr
import (
"key_performance_indicators/overall"

2
models/empoweruser.go → models/modelshr/empoweruser.go

@ -1,4 +1,4 @@
package models
package modelshr
import (
"key_performance_indicators/overall"

2
models/family_members.go → models/modelshr/family_members.go

@ -1,4 +1,4 @@
package models
package modelshr
import (
"key_performance_indicators/overall"

2
models/inside_work_history.go → models/modelshr/inside_work_history.go

@ -1,4 +1,4 @@
package models
package modelshr
import (
"key_performance_indicators/overall"

2
models/inside_work_view.go → models/modelshr/inside_work_view.go

@ -1,4 +1,4 @@
package models
package modelshr
import (
"key_performance_indicators/overall"

2
models/job_class.go → models/modelshr/job_class.go

@ -1,4 +1,4 @@
package models
package modelshr
import (
"key_performance_indicators/overall"

2
models/kingdee_log.go → models/modelshr/kingdee_log.go

@ -1,4 +1,4 @@
package models
package modelshr
import (
"key_performance_indicators/overall"

2
models/man_cont.go → models/modelshr/man_cont.go

@ -1,4 +1,4 @@
package models
package modelshr
import (
"key_performance_indicators/overall"

2
models/org_cont_type.go → models/modelshr/org_cont_type.go

@ -1,4 +1,4 @@
package models
package modelshr
import (
"key_performance_indicators/overall"

2
models/personarchives.go → models/modelshr/personarchives.go

@ -1,4 +1,4 @@
package models
package modelshr
import (
"key_performance_indicators/overall"

2
models/personnel.go → models/modelshr/personnel.go

@ -1,4 +1,4 @@
package models
package modelshr
import (
"key_performance_indicators/overall"

2
models/personnel_change_record.go → models/modelshr/personnel_change_record.go

@ -1,4 +1,4 @@
package models
package modelshr
import "key_performance_indicators/overall"

2
models/personnel_content.go → models/modelshr/personnel_content.go

@ -1,4 +1,4 @@
package models
package modelshr
import (
"key_performance_indicators/overall"

2
models/personnel_education.go → models/modelshr/personnel_education.go

@ -1,4 +1,4 @@
package models
package modelshr
import (
"key_performance_indicators/overall"

2
models/position.go → models/modelshr/position.go

@ -1,4 +1,4 @@
package models
package modelshr
import (
"key_performance_indicators/overall"

2
models/position_level.go → models/modelshr/position_level.go

@ -1,4 +1,4 @@
package models
package modelshr
import "key_performance_indicators/overall"

2
models/post_duties_job.go → models/modelshr/post_duties_job.go

@ -1,4 +1,4 @@
package models
package modelshr
import (
"key_performance_indicators/overall"

2
models/teamgroup.go → models/modelshr/teamgroup.go

@ -1,4 +1,4 @@
package models
package modelshr
import (
"key_performance_indicators/overall"

2
models/work_history.go → models/modelshr/work_history.go

@ -1,4 +1,4 @@
package models
package modelshr
import (
"key_performance_indicators/overall"

64
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
}

73
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
}

62
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
}

71
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
}

72
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
}

65
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
}

2
models/menu_operation.go → models/modelsschool/menu_operation.go

@ -1,4 +1,4 @@
package models
package modelsschool
//菜单功能
type MenuOperation struct {

2
models/step_role_group.go → models/modelsschool/step_role_group.go

@ -1,4 +1,4 @@
package models
package modelsschool
import "key_performance_indicators/overall"

2
models/system_nenu.go → models/modelsschool/system_nenu.go

@ -1,4 +1,4 @@
package models
package modelsschool
import (
"key_performance_indicators/overall"

2
models/system_role.go → models/modelsschool/system_role.go

@ -1,4 +1,4 @@
package models
package modelsschool
import "key_performance_indicators/overall"

2
models/system_user.go → models/modelsschool/system_user.go

@ -1,4 +1,4 @@
package models
package modelsschool
import "key_performance_indicators/overall"

2
models/system_user_attribute.go → models/modelsschool/system_user_attribute.go

@ -1,4 +1,4 @@
package models
package modelsschool
import "key_performance_indicators/overall"

2
models/wechatUsers.go → models/modelswechat/wechatUsers.go

@ -1,4 +1,4 @@
package models
package modelswechat
//企业微信人员架构
type WechatUsers struct {

4
overall/publicmethod/formatOutput.go

@ -4,7 +4,7 @@ import (
"encoding/json"
"errors"
"fmt"
"key_performance_indicators/models"
"key_performance_indicators/models/modelshr"
"key_performance_indicators/overall"
"net/http"
@ -46,7 +46,7 @@ func ResultList(code, page, pageSize int, total, count int64, data interface{},
}
// 登录信息转换
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")

9
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"
@ -150,7 +150,6 @@ func ChineseFirstWordCapitalize(wordStr string) (firstWord string) {
// @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
@ -368,7 +367,7 @@ func StringToInt64(val interface{}) (int64, error) {
}
// 获取人员TokenRedis 信息
func GetUserRedisToken(number string) (manCont models.ManCont, err error) {
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)
@ -382,7 +381,7 @@ func GetUserRedisToken(number string) (manCont models.ManCont, err error) {
}
// 获取人员Redis信息
func GetUserRedisCont(number string) (manCont models.ManCont, err error) {
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)
@ -398,7 +397,7 @@ func GetUserRedisCont(number string) (manCont models.ManCont, err error) {
}
// 获取人员Redis信息返回指针
func GetUserRedisContPointer(number string) (manCont models.ManCont, err error) {
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)

5
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

Loading…
Cancel
Save