Browse Source

Merge branch 'v1_dev'

# Conflicts:
#	README.md
#	api/version1/honoraryArchives/honors.go
#	apirouter/entry.go
#	models/modelshonory/photos_gallery.go
master
超级管理员 3 years ago
parent
commit
fbec427929
  1. 101
      README.md
  2. 13
      api/base/loginVerify/login.go
  3. 14
      api/base/loginVerify/type.go
  4. 8
      api/empower/authorize/empower.go
  5. 2279
      api/version1/departmentseting/departmentpc/qualitativekpi.go
  6. 200
      api/version1/departmentseting/departmentpc/type.go
  7. 16
      api/version1/departmentseting/departmentweb/type.go
  8. 14
      api/version1/entry.go
  9. 22
      api/version1/honoraryArchives/carriertype.go
  10. 36
      api/version1/honoraryArchives/honors.go
  11. 685
      api/version1/postseting/postpc/scheme.go
  12. 106
      api/version1/postseting/postpc/type.go
  13. 16
      api/version1/postseting/postweb/type.go
  14. 12
      apirouter/entry.go
  15. 45
      apirouter/v1/departmentseting/pc.go
  16. 4
      apirouter/v1/departmentseting/type.go
  17. 19
      apirouter/v1/departmentseting/web.go
  18. 21
      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. 6
      identification/interceptor/authentication.go
  23. 6
      identification/interceptor/identity.go
  24. 16
      initialization/route/initRoute.go
  25. BIN
      key_performance_indicators.exe
  26. 10
      models/modelshonory/carrier_type.go
  27. 10
      models/modelshonory/honorary_archives.go
  28. 13
      models/modelshonory/photos_gallery.go
  29. 21
      models/modelshr/administrative_organization.go
  30. 8
      models/modelshr/administrative_organization_type.go
  31. 8
      models/modelshr/double_worker.go
  32. 8
      models/modelshr/duties.go
  33. 6
      models/modelshr/duties_class_leve.go
  34. 10
      models/modelshr/emergency_contact.go
  35. 10
      models/modelshr/empoweruser.go
  36. 8
      models/modelshr/family_members.go
  37. 8
      models/modelshr/inside_work_history.go
  38. 4
      models/modelshr/inside_work_view.go
  39. 8
      models/modelshr/job_class.go
  40. 8
      models/modelshr/kingdee_log.go
  41. 4
      models/modelshr/man_cont.go
  42. 6
      models/modelshr/org_cont_type.go
  43. 8
      models/modelshr/personarchives.go
  44. 8
      models/modelshr/personnel.go
  45. 2
      models/modelshr/personnel_change_record.go
  46. 6
      models/modelshr/personnel_content.go
  47. 6
      models/modelshr/personnel_education.go
  48. 10
      models/modelshr/position.go
  49. 2
      models/modelshr/position_level.go
  50. 4
      models/modelshr/post_duties_job.go
  51. 8
      models/modelshr/teamgroup.go
  52. 82
      models/modelshr/user_post_duties.go
  53. 10
      models/modelshr/work_history.go
  54. 64
      models/modelskpi/assesstarget.go
  55. 65
      models/modelskpi/depart_dime_post_weight.go
  56. 73
      models/modelskpi/detailed_target.go
  57. 62
      models/modelskpi/dutyclass.go
  58. 71
      models/modelskpi/evaluationtarget.go
  59. 67
      models/modelskpi/position_plan_version.go
  60. 72
      models/modelskpi/post_target.go
  61. 77
      models/modelskpi/post_target_details.go
  62. 76
      models/modelskpi/qualitative_evaluation_scheme.go
  63. 75
      models/modelskpi/qualitative_target.go
  64. 70
      models/modelskpi/son_target_father.go
  65. 67
      models/modelskpi/target_department.go
  66. 69
      models/modelskpi/target_report.go
  67. 2
      models/modelsschool/menu_operation.go
  68. 2
      models/modelsschool/step_role_group.go
  69. 10
      models/modelsschool/system_nenu.go
  70. 2
      models/modelsschool/system_role.go
  71. 2
      models/modelsschool/system_user.go
  72. 2
      models/modelsschool/system_user_attribute.go
  73. 2
      models/modelswechat/wechatUsers.go
  74. 15
      overall/publicmethod/formatOutput.go
  75. 166
      overall/publicmethod/technique.go
  76. 5
      overall/publicmethod/type.go

101
README.md

@ -55,3 +55,104 @@
md5(md5(md5(CodeString)+md5(AppKey))+AppKey) md5(md5(md5(CodeString)+md5(AppKey))+AppKey)
``` ```
<<<<<<< HEAD
=======
## 开发日志
```
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
```
```
Time:2022-08-12
指标部门、岗位上报人对照表
CREATE TABLE `target_report` (
`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 COMMENT '子目标',
`target_bylaws` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '指标细则',
`department_id` bigint(20) unsigned DEFAULT '0' COMMENT '部门ID',
`post_id` bigint(20) unsigned DEFAULT '0' COMMENT '岗位ID',
`type` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '类型(1:公司级;2:部门级)',
`state` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '状态(1:启用;2:禁用;3:删除)',
`man_key` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '提报人ID',
`time` bigint(20) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COMMENT='指标、子栏目、细则部门、岗位上报人对照表';
```
```
Time:2022-08-16
创建子栏目关联指标视图 son_target_father
select `qt`.`q_id` AS `q_id`,`qt`.`q_title` AS `q_title`,`qt`.`q_parent_id` AS `q_parent_id`,`qt`.`q_state` AS `q_state`,`qt`.`q_time` AS `q_time`,`qt`.`q_depart` AS `q_depart`,`et`.`et_title` AS `et_title`,`et`.`et_type` AS `et_type`,`et`.`et_dimension` AS `et_dimension`,`et`.`et_key` AS `et_key`,`et`.`et_unit` AS `et_unit`,`et`.`et_cycle` AS `et_cycle`,`et`.`et_cycleattr` AS `et_cycleattr`,`et`.`et_scoring_method` AS `et_scoring_method` from (`qualitative_target` `qt` left join `evaluationtarget` `et` on((`qt`.`q_parent_id` = `et`.`et_id`)))
创建用户与职务、岗位关联视图 user_post_duties (HR数据库)
select `pc`.`mobilephone` AS `mobilephone`,`pc`.`gender` AS `gender`,`ps`.`name` AS `postname`,`ps`.`person_in_charge` AS `leading_cadre`,`ps`.`superior` AS `post_superior`,`ps`.`menu_permit` AS `menu_permit`,`ps`.`button_permit` AS `button_permit`,`pd`.`name` AS `duties_name`,`pa`.`id` AS `id`,`pa`.`number` AS `number`,`pa`.`name` AS `name`,`pa`.`icon` AS `icon`,`pa`.`company` AS `company`,`pa`.`maindeparment` AS `maindeparment`,`pa`.`admin_org` AS `admin_org`,`pa`.`position` AS `position`,`pa`.`job_id` AS `job_id`,`pa`.`job_leve` AS `job_leve`,`pa`.`wechat` AS `wechat`,`pa`.`work_wechat` AS `work_wechat`,`pa`.`is_admin` AS `is_admin`,`pa`.`key` AS `key`,`pa`.`role` AS `role`,`pa`.`password` AS `password`,`pa`.`sun_main_deparment` AS `sun_main_deparment`,`pa`.`teamid` AS `teamid` from (((`person_archives` `pa` join `personnel_content` `pc` on((`pa`.`key` = `pc`.`key`))) join `position` `ps` on((`pa`.`position` = `ps`.`id`))) join `duties` `pd` on((`pa`.`job_id` = `pd`.`id`)))
```
<span style="color:#FF0000; font-size:20px;">
Time:2022-08-16 <br>
埋坑(1) 待以后编写相应模块 PS:该问题解决后删除此记录
</span>
```
F:\goobject\src\key_performance_indicators\api\version1\departmentseting\departmentpc\qualitativekpi.go
函数 DelSonTarget
文件 第 1138 行
预留判断该指标是否在使用中
```
>>>>>>> v1_dev

13
api/base/loginVerify/login.go

@ -3,7 +3,8 @@ package loginVerify
import ( import (
"fmt" "fmt"
"key_performance_indicators/middleware/grocerystore" "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"
"key_performance_indicators/overall/publicmethod" "key_performance_indicators/overall/publicmethod"
@ -45,14 +46,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}) userErr := userCont.GetCont(map[string]interface{}{"number": requestData.Username, "password": md5TokenPwd})
if userErr != nil { if userErr != nil {
publicmethod.Result(2000, userErr, c) publicmethod.Result(2000, userErr, c)
return return
} }
if requestData.OpenId != "" { 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}) userInfo.EiteCont(map[string]interface{}{"id": userCont.Id}, map[string]interface{}{"work_wechat": requestData.OpenId})
} }
if userCont.State == 2 { if userCont.State == 2 {
@ -152,9 +153,9 @@ func (a *ApiMethod) ScanCodeLogin(c *gin.Context) {
publicmethod.Result(0, saveData, c) publicmethod.Result(0, saveData, c)
} }
//获取权限点位 // 获取权限点位
func getRoleSeat(roleId string) (menuStr, buttonStr string) { 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") err := roleInfo.GetCont(map[string]interface{}{"r_id": roleId}, "r_menu_oper", "r_jurisdiction")
if err != nil { if err != nil {
return return
@ -164,7 +165,7 @@ func getRoleSeat(roleId string) (menuStr, buttonStr string) {
return return
} }
//退出登录 // 退出登录
func (a *ApiMethod) SignOut(c *gin.Context) { func (a *ApiMethod) SignOut(c *gin.Context) {
userKey := c.Request.Header.Get("user-key") userKey := c.Request.Header.Get("user-key")
redisFileKey := fmt.Sprintf("ScanCode:Authentication:LoginApi_%v_%v", overall.CONSTANT_CONFIG.RedisPrefixStr.Alias, userKey) redisFileKey := fmt.Sprintf("ScanCode:Authentication:LoginApi_%v_%v", overall.CONSTANT_CONFIG.RedisPrefixStr.Alias, userKey)

14
api/base/loginVerify/type.go

@ -1,7 +1,7 @@
package loginVerify package loginVerify
import ( import (
"key_performance_indicators/models" "key_performance_indicators/models/modelsschool"
"key_performance_indicators/overall/publicmethod" "key_performance_indicators/overall/publicmethod"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
@ -9,20 +9,20 @@ import (
type ApiMethod struct{} type ApiMethod struct{}
//系统登录入口 // 系统登录入口
func (a *ApiMethod) Index(c *gin.Context) { func (a *ApiMethod) Index(c *gin.Context) {
outputCont := publicmethod.MapOut[string]() outputCont := publicmethod.MapOut[string]()
outputCont["index"] = "系统登录入口" outputCont["index"] = "系统登录入口"
publicmethod.Result(0, outputCont, c) publicmethod.Result(0, outputCont, c)
} }
//验证码输出 // 验证码输出
type SysCaptchaResponse struct { type SysCaptchaResponse struct {
CaptchaId string `json:"captchaid"` CaptchaId string `json:"captchaid"`
PicPath string `json:"picPath"` PicPath string `json:"picPath"`
} }
//登录相关 // 登录相关
type Login struct { type Login struct {
Username string `json:"username"` // 用户名 Username string `json:"username"` // 用户名
Password string `json:"password"` // 密码 Password string `json:"password"` // 密码
@ -31,8 +31,8 @@ type Login struct {
OpenId string `json:"openid"` //企业微信ID OpenId string `json:"openid"` //企业微信ID
} }
//原知行学院管理员表 // 原知行学院管理员表
type OldSchollAdmin struct { type OldSchollAdmin struct {
models.SystemUser modelsschool.SystemUser
models.SystemUserAttribute modelsschool.SystemUserAttribute
} }

8
api/empower/authorize/empower.go

@ -2,17 +2,17 @@ package authorize
import ( import (
"fmt" "fmt"
"key_performance_indicators/models/modelshr"
"key_performance_indicators/overall" "key_performance_indicators/overall"
"strconv" "strconv"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"key_performance_indicators/middleware/grocerystore" "key_performance_indicators/middleware/grocerystore"
"key_performance_indicators/models"
"key_performance_indicators/overall/publicmethod" "key_performance_indicators/overall/publicmethod"
) )
//授权 // 授权
func (e *EmpowerApi) GainToken(c *gin.Context) { func (e *EmpowerApi) GainToken(c *gin.Context) {
ContentType := c.Request.Header.Get("Content-Type") ContentType := c.Request.Header.Get("Content-Type")
Origin := c.Request.Header.Get("Origin") Origin := c.Request.Header.Get("Origin")
@ -38,7 +38,7 @@ func (e *EmpowerApi) GainToken(c *gin.Context) {
var passwordMd5 publicmethod.Md5Encryption var passwordMd5 publicmethod.Md5Encryption
passwordMd5.Md5EncryptionInit(requestData.Password) passwordMd5.Md5EncryptionInit(requestData.Password)
passwordMd5Str := passwordMd5.Md5EncryptionAlgorithm() passwordMd5Str := passwordMd5.Md5EncryptionAlgorithm()
var empowerUser models.EmpowerUser var empowerUser modelshr.EmpowerUser
userErr := empowerUser.GetCont(map[string]interface{}{"userkey": requestData.UserNumber, "password": passwordMd5Str}, "verification_code") userErr := empowerUser.GetCont(map[string]interface{}{"userkey": requestData.UserNumber, "password": passwordMd5Str}, "verification_code")
if userErr != nil { if userErr != nil {
publicmethod.Result(2000, passwordMd5Str, c) publicmethod.Result(2000, passwordMd5Str, c)
@ -124,7 +124,7 @@ func (e *EmpowerApi) GainToken(c *gin.Context) {
publicmethod.Result(0, sendToken, c) publicmethod.Result(0, sendToken, c)
} }
//加密验证 // 加密验证
func (e *EmpowerApi) Encryption(c *gin.Context) { func (e *EmpowerApi) Encryption(c *gin.Context) {
var requestData EncryptionData var requestData EncryptionData
err := c.ShouldBindJSON(&requestData) err := c.ShouldBindJSON(&requestData)

2279
api/version1/departmentseting/departmentpc/qualitativekpi.go

File diff suppressed because it is too large

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

@ -0,0 +1,200 @@
package departmentpc
import (
"key_performance_indicators/models/modelskpi"
"key_performance_indicators/overall/publicmethod"
"sync"
"github.com/gin-gonic/gin"
)
type ApiMethod struct{}
// 协程设置
var syncSeting = sync.WaitGroup{}
// 部门考核WEB端入口
func (a *ApiMethod) Index(c *gin.Context) {
outputCont := publicmethod.MapOut[string]()
outputCont["index"] = "部门考核PC端入口"
publicmethod.Result(0, outputCont, c)
}
// 查询部门考核列表
type departListQuery struct {
publicmethod.PagesTurn
Title string `json:"title"` //指标名称
Class int `json:"class"` //1:定性考核;2:定量考核
State int `json:"state"` //状态(1:启用;2:禁用;3:删除)
DepartmentId string `json:"departmentid"` //部门ID
DimensionId string `json:"dimensionid"` //维度ID
ReportPerson string `json:"reportperson"` //上报人
ScoringMethod int `json:"scoringmethod"` //计分方式(1:自动;2:手动)
Cycle int `json:"cycle"` //1:班;2:天;3:周;4:月;5:季度;6:年
}
// 输出部门指标列表
type printDepartmentTarget struct {
modelskpi.EvaluationTarget
DimensionTitle string `json:"dimensiontitle"` //维度名称
}
// 输出指标已经关联的部门
type departOutcome struct {
publicmethod.PublicId //部门id
publicmethod.PublicName //部门名称
Superior string `json:"superior"` //上级
Ispower int `json:"ispower"` //是否为主部门
}
// 转换提报人格式化
type zhuanHuanMan struct {
Id int64 `json:"id"`
Operator []string `json:"operator"`
}
// 获取相关提报人
type getAboutReportTarget struct {
TargetId string `json:"targetid"`
TargetSunId string `json:"targetsunid"`
TargetBylaws string `json:"targetbylaws"`
DepartmentId string `json:"departmentid"`
PostId string `json:"postid"`
}
// 输出上报人信息
type printReportCont struct {
Id string `json:"id"`
Key string `json:"key"`
Name string `json:"name"`
GroupName string `json:"groupname"`
DepartmentName string `json:"departmentname"`
Icon string `json:"icon"`
Number string `json:"number"`
}
// 添加 定性考核指标关系指定
type AddQualEval struct {
Group string `json:"group"` //归属集团
AcceptDepartmentId []string `json:"parentid"` //接受考核部门
Type int `json:"type"` //1:定性考核;2:定量考核
Target string `json:"target"` //考核指标
TargetSunTitle string `json:"targetsuntitle"` //考核指标子栏目
EvaluationList []QualEvalSunList `json:"evaluationlist"` //测评详情
}
// 定性考核内容
type QualEvalSunList struct {
Title string `json:"title"` //考核内容
Content string `json:"content"` //备注说明
Unit string `json:"unit"` //单位
ReferenceScore string `json:"referencescore"` //考核标准
Cycles int `json:"cycle"` //1:班;2:天;3:周;4:月;5:季度;6:年
CycleAttres int `json:"cycleattr"` //辅助计数
Operator []string `json:"userlist"` //考核执行人
AddOrReduce int `json:"addorreduce"` //操作类型 1:减少;2:增加;3:用户自定义
CensorType []string `json:"censortype"` //检查方式(1:现场检查;2:资料检查;3:事件触发)
CensorCont string `json:"censorcont"` //客观证据
CensorRate int `json:"censorrate"` //检查频次
}
// 获取定性考核指标列表查询参数
type getDepartTargetContType struct {
publicmethod.PagesTurn
TargetId string `json:"targetid"` //指标ID
DepartmentId string `json:"departmentid"` //部门ID
ReportPerson string `json:"reportperson"` //上报人
Cycle int `json:"cycle"` //1:班;2:天;3:周;4:月;5:季度;6:年
TargetSunId string `json:"targetsunid"` //考核子栏目
}
// 输出定性指标详细内容列表
type printDepartTargetCont struct {
modelskpi.DetailedTarget
Standard string `json:"standard"` //标准
CensorTypeList []string `json:"censortypelist"` //检查方式(1:现场检查;2:资料检查;3:事件触发)
SonTargetName string `json:"sontargetname"` //子栏目名称
}
// 根据指标栏目新增指标细则
type basisSonTargetAddDet struct {
publicmethod.PublicId
QualEvalSunList
}
// 根据指标和部门获取相关岗位
type bgdgp struct {
TargetId string `json:"targetid"` //指标
TargetSunId string `json:"targetsunid"` //子栏目
TargetBylaws string `json:"targetbylaws"` //细则
DepartmentId string `json:"departmentid"` //部门
Level int `json:"level"` //级别(1:部门级;2:岗位级)
}
// 根据指标、部门和岗位获取相关提交人
type btdgr struct {
bgdgp
PostId string `json:"postid"` //岗位
}
// 修改子栏目标题名称级考核关联部门及提报人
type editTarDepartReport struct {
TargetSunId string `json:"targetsunid"` //子栏目
Title string `json:"title"` //考核内容
AcceptDepartmentId []string `json:"acceptdepartmentid"` //接受考核部门
Operator []string `json:"userlist"` //考核执行人
}
// 输出
type outCont struct {
publicmethod.PublicId
publicmethod.PublicName
}
// 输出新版指标细则详细内容
type NewOutPutDetailedTarget struct {
publicmethod.PublicId
QualEvalSunList
ReportManList []printReportCont `json:"reportmanlist"` //上报人
DepartmentList []string `json:"departmentlist"` //接受考核的部门
}
// 修改单一指标细则内容提交参数
type editOneDetailedTargetInfo struct {
basisSonTargetAddDet
DepartmentList []string `json:"departmentlist"` //接受考核的部门
}
// 添加部门指标参数
type addTargetContDepart struct {
publicmethod.PublicName
Share int `json:"share"` //1:共用;2:私用
AcceptDepartmentId []string `json:"acceptdepartmentid"` //接受考核部门
Operator []string `json:"userlist"` //考核执行人
Dimension string `json:"dimension"` //维度
Nature int `json:"nature"` //性质 1:定性考核;2:定量考核
Unit string `json:"unit"` //单位
Cycles int `json:"cycle"` //1:班;2:天;3:周;4:月;5:季度;6:年
CycleAttres int `json:"cycleattr"` //辅助计数
ScoringMethod int `json:"scoringmethod"` //计分方式(1:自动;2:手动)'
VisibleRangeGroup []string `json:"visiblerangegroup"` //可见范围(集团)
VisibleRangeDepart []string `json:"visiblerangedepart"` //可见范围(分厂)
}
// 输出单一指标详细内容
type printOneTargetCont struct {
publicmethod.PublicId
addTargetContDepart
}
// 部门指标关联岗位
type depTarAboutPost struct {
publicmethod.PublicId
OrgList []LoopStruct `json:"orglist"`
}
// 循环体
type LoopStruct struct {
publicmethod.PublicId
Child []LoopStruct `json:"child"`
}

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

14
api/version1/entry.go

@ -1,9 +1,19 @@
package version1 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 { 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) var AppApiEntry = new(ApiEntry)

22
api/version1/honoraryArchives/carriertype.go

@ -1,7 +1,7 @@
package honoraryArchives package honoraryArchives
import ( import (
"key_performance_indicators/models" "key_performance_indicators/models/modelshonory"
"key_performance_indicators/overall" "key_performance_indicators/overall"
"key_performance_indicators/overall/publicmethod" "key_performance_indicators/overall/publicmethod"
"time" "time"
@ -11,7 +11,7 @@ import (
//档案载体 //档案载体
//列表 // 列表
func (a *ApiMethod) CarrierList(c *gin.Context) { func (a *ApiMethod) CarrierList(c *gin.Context) {
var requestData carrierListKey var requestData carrierListKey
errs := c.ShouldBindJSON(&requestData) errs := c.ShouldBindJSON(&requestData)
@ -19,8 +19,8 @@ func (a *ApiMethod) CarrierList(c *gin.Context) {
publicmethod.Result(100, errs, c) publicmethod.Result(100, errs, c)
return return
} }
var carrierList []models.CarrierType var carrierList []modelshonory.CarrierType
gormDb := overall.CONSTANT_DB_MANAGE_ARCHIVES.Model(&models.CarrierType{}).Where("`state` BETWEEN ? AND ?", 1, 2) gormDb := overall.CONSTANT_DB_MANAGE_ARCHIVES.Model(&modelshonory.CarrierType{}).Where("`state` BETWEEN ? AND ?", 1, 2)
if requestData.Name != "" { if requestData.Name != "" {
gormDb = gormDb.Where("`name` LIKE ?", "%"+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) publicmethod.ResultList(0, requestData.Page, requestData.PageSize, total, int64(len(carrierList)), carrierList, c)
} }
//添加载体类型 // 添加载体类型
func (a *ApiMethod) AddCarrier(c *gin.Context) { func (a *ApiMethod) AddCarrier(c *gin.Context) {
var requestData addCarrierCont var requestData addCarrierCont
err := c.ShouldBindJSON(&requestData) err := c.ShouldBindJSON(&requestData)
@ -50,7 +50,7 @@ func (a *ApiMethod) AddCarrier(c *gin.Context) {
publicmethod.Result(101, err, c) publicmethod.Result(101, err, c)
return return
} }
var carrierCont models.CarrierType var carrierCont modelshonory.CarrierType
juadgeErr := carrierCont.GetCont(map[string]interface{}{"`name`": requestData.Name}, "`id`") juadgeErr := carrierCont.GetCont(map[string]interface{}{"`name`": requestData.Name}, "`id`")
if juadgeErr == nil { if juadgeErr == nil {
if carrierCont.Id != 0 { if carrierCont.Id != 0 {
@ -68,7 +68,7 @@ func (a *ApiMethod) AddCarrier(c *gin.Context) {
} }
} }
//编辑荣誉类型 // 编辑荣誉类型
func (a *ApiMethod) EidyCarrier(c *gin.Context) { func (a *ApiMethod) EidyCarrier(c *gin.Context) {
var requestData eidyCarrierCont var requestData eidyCarrierCont
err := c.ShouldBindJSON(&requestData) err := c.ShouldBindJSON(&requestData)
@ -84,14 +84,14 @@ func (a *ApiMethod) EidyCarrier(c *gin.Context) {
publicmethod.Result(101, err, c) publicmethod.Result(101, err, c)
return return
} }
var carrierCont models.CarrierType var carrierCont modelshonory.CarrierType
conErr := carrierCont.GetCont(map[string]interface{}{"`id`": requestData.Id}, "`name`") conErr := carrierCont.GetCont(map[string]interface{}{"`id`": requestData.Id}, "`name`")
if conErr != nil { if conErr != nil {
publicmethod.Result(107, conErr, c) publicmethod.Result(107, conErr, c)
return return
} }
if requestData.Name != carrierCont.Name { if requestData.Name != carrierCont.Name {
var oldCarrierCont models.CarrierType var oldCarrierCont modelshonory.CarrierType
conErrOld := oldCarrierCont.GetCont(map[string]interface{}{"`name`": requestData.Name}, "`id`") conErrOld := oldCarrierCont.GetCont(map[string]interface{}{"`name`": requestData.Name}, "`id`")
if conErrOld == nil { if conErrOld == nil {
publicmethod.Result(103, err, c) publicmethod.Result(103, err, c)
@ -111,7 +111,7 @@ func (a *ApiMethod) EidyCarrier(c *gin.Context) {
publicmethod.Result(0, err, c) publicmethod.Result(0, err, c)
} }
//编辑荣誉类型状态 // 编辑荣誉类型状态
func (a *ApiMethod) EidyCarrierState(c *gin.Context) { func (a *ApiMethod) EidyCarrierState(c *gin.Context) {
var requestData publicmethod.PublicState var requestData publicmethod.PublicState
c.ShouldBindJSON(&requestData) c.ShouldBindJSON(&requestData)
@ -127,7 +127,7 @@ func (a *ApiMethod) EidyCarrierState(c *gin.Context) {
} }
where := publicmethod.MapOut[string]() where := publicmethod.MapOut[string]()
where["id"] = requestData.Id where["id"] = requestData.Id
var carrierTypeCont models.CarrierType var carrierTypeCont modelshonory.CarrierType
judgeErr := carrierTypeCont.GetCont(where, "`id`") judgeErr := carrierTypeCont.GetCont(where, "`id`")
if judgeErr != nil { if judgeErr != nil {
publicmethod.Result(107, judgeErr, c) publicmethod.Result(107, judgeErr, c)

36
api/version1/honoraryArchives/honors.go

@ -3,7 +3,7 @@ package honoraryArchives
import ( import (
"fmt" "fmt"
"key_performance_indicators/middleware/snowflake" "key_performance_indicators/middleware/snowflake"
"key_performance_indicators/models" "key_performance_indicators/models/modelshonory"
"key_performance_indicators/overall" "key_performance_indicators/overall"
"key_performance_indicators/overall/publicmethod" "key_performance_indicators/overall/publicmethod"
"strconv" "strconv"
@ -13,12 +13,12 @@ import (
"gorm.io/gorm" "gorm.io/gorm"
) )
//荣誉列表 // 荣誉列表
func (a *ApiMethod) HonorList(c *gin.Context) { func (a *ApiMethod) HonorList(c *gin.Context) {
var requestData honorListKey var requestData honorListKey
c.ShouldBindJSON(&requestData) c.ShouldBindJSON(&requestData)
var honorsList []models.HonoraryArchives var honorsList []modelshonory.HonoraryArchives
gormDb := overall.CONSTANT_DB_MANAGE_ARCHIVES.Model(&models.HonoraryArchives{}).Where("state BETWEEN ? AND ?", 1, 2) gormDb := overall.CONSTANT_DB_MANAGE_ARCHIVES.Model(&modelshonory.HonoraryArchives{}).Where("state BETWEEN ? AND ?", 1, 2)
if requestData.Name != "" { if requestData.Name != "" {
gormDb = gormDb.Where("`name` LIKE ?", "%"+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) publicmethod.ResultList(0, requestData.Page, requestData.PageSize, total, int64(len(honorsList)), honorsList, c)
} }
//添加荣誉 // 添加荣誉
func (a *ApiMethod) AddHonorCont(c *gin.Context) { func (a *ApiMethod) AddHonorCont(c *gin.Context) {
var requestData addHonorCont //添加荣誉字段 var requestData addHonorCont //添加荣誉字段
c.ShouldBindJSON(&requestData) c.ShouldBindJSON(&requestData)
@ -80,7 +80,7 @@ func (a *ApiMethod) AddHonorCont(c *gin.Context) {
} else { } else {
uuId = snowflakeId.GetId() uuId = snowflakeId.GetId()
} }
var honorCont models.HonoraryArchives var honorCont modelshonory.HonoraryArchives
honorCont.Id = uuId honorCont.Id = uuId
honorCont.Name = requestData.Name //荣誉名称"` honorCont.Name = requestData.Name //荣誉名称"`
honorCont.IssuingUnit = requestData.IssuingAgency //发放单位"` honorCont.IssuingUnit = requestData.IssuingAgency //发放单位"`
@ -108,9 +108,13 @@ func (a *ApiMethod) AddHonorCont(c *gin.Context) {
honorCont.Time = time.Now().Unix() //创建时间"` honorCont.Time = time.Now().Unix() //创建时间"`
honorCont.State = 1 //状态(1:启用;2:禁用;3:删除)"` honorCont.State = 1 //状态(1:启用;2:禁用;3:删除)"`
if len(requestData.ImgUrl) > 0 { if len(requestData.ImgUrl) > 0 {
<<<<<<< HEAD
var imgList []models.PhotosGallery //图片档案 var imgList []models.PhotosGallery //图片档案
=======
var imgList []modelshonory.PhotosGallery
>>>>>>> v1_dev
for _, v := range requestData.ImgUrl { for _, v := range requestData.ImgUrl {
var imgCont models.PhotosGallery var imgCont modelshonory.PhotosGallery
imgCont.Url = v.Url //图片地址"` imgCont.Url = v.Url //图片地址"`
imgCont.ImgPath = v.Imgpath //物理地址"` imgCont.ImgPath = v.Imgpath //物理地址"`
imgCont.Name = v.Name //文档名称"` imgCont.Name = v.Name //文档名称"`
@ -147,7 +151,7 @@ func (a *ApiMethod) AddHonorCont(c *gin.Context) {
} }
} }
//编辑荣誉 // 编辑荣誉
func (a *ApiMethod) EidyHonorCont(c *gin.Context) { func (a *ApiMethod) EidyHonorCont(c *gin.Context) {
var requestData eidtHonorCont var requestData eidtHonorCont
c.ShouldBindJSON(&requestData) c.ShouldBindJSON(&requestData)
@ -162,7 +166,7 @@ func (a *ApiMethod) EidyHonorCont(c *gin.Context) {
where := publicmethod.MapOut[string]() where := publicmethod.MapOut[string]()
where["id"] = requestData.Id where["id"] = requestData.Id
//原信息 //原信息
var honContOld models.HonoraryArchives var honContOld modelshonory.HonoraryArchives
err := honContOld.GetCont(where) err := honContOld.GetCont(where)
if err != nil { if err != nil {
publicmethod.Result(107, err, c) publicmethod.Result(107, err, c)
@ -213,7 +217,7 @@ func (a *ApiMethod) EidyHonorCont(c *gin.Context) {
if requestData.Remark != "" && requestData.Remark != honContOld.Contet { if requestData.Remark != "" && requestData.Remark != honContOld.Contet {
saveData["contet"] = requestData.Remark saveData["contet"] = requestData.Remark
} }
var imgUrlListNoId []models.PhotosGallery var imgUrlListNoId []modelshonory.PhotosGallery
var pldImgId []int64 var pldImgId []int64
if len(requestData.ImgUrl) > 0 { if len(requestData.ImgUrl) > 0 {
for _, v := range requestData.ImgUrl { for _, v := range requestData.ImgUrl {
@ -223,7 +227,7 @@ func (a *ApiMethod) EidyHonorCont(c *gin.Context) {
pldImgId = append(pldImgId, oldIdInt) pldImgId = append(pldImgId, oldIdInt)
} }
} else { } else {
var imgCont models.PhotosGallery var imgCont modelshonory.PhotosGallery
imgCont.Url = v.Url //图片地址"` imgCont.Url = v.Url //图片地址"`
imgCont.ImgPath = v.Imgpath //物理地址"` imgCont.ImgPath = v.Imgpath //物理地址"`
imgCont.Name = v.Name //文档名称"` imgCont.Name = v.Name //文档名称"`
@ -238,7 +242,7 @@ func (a *ApiMethod) EidyHonorCont(c *gin.Context) {
} }
if len(imgUrlListNoId) > 0 { if len(imgUrlListNoId) > 0 {
var imgList models.PhotosGallery var imgList modelshonory.PhotosGallery
saveErr := overall.CONSTANT_DB_MANAGE_ARCHIVES.Transaction(func(tx *gorm.DB) error { saveErr := overall.CONSTANT_DB_MANAGE_ARCHIVES.Transaction(func(tx *gorm.DB) error {
if len(pldImgId) > 0 { 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 { 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 +256,7 @@ func (a *ApiMethod) EidyHonorCont(c *gin.Context) {
saveData["time"] = time.Now().Unix() 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 return err
} }
@ -274,7 +278,7 @@ func (a *ApiMethod) EidyHonorCont(c *gin.Context) {
saveData["time"] = time.Now().Unix() saveData["time"] = time.Now().Unix()
saveErr := honContOld.EiteCont(where, saveData) saveErr := honContOld.EiteCont(where, saveData)
if saveErr == nil { if saveErr == nil {
var imgList models.PhotosGallery var imgList modelshonory.PhotosGallery
if len(pldImgId) > 0 { 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) overall.CONSTANT_DB_MANAGE_ARCHIVES.Not(map[string]interface{}{"`id`": pldImgId, "`ascription_id`": requestData.Id, "`ascription_data_sheet`": "honorary_archives"}).Delete(&imgList)
} else { } else {
@ -287,7 +291,7 @@ func (a *ApiMethod) EidyHonorCont(c *gin.Context) {
} }
} }
//编辑状态 // 编辑状态
func (a *ApiMethod) EidyHonorContState(c *gin.Context) { func (a *ApiMethod) EidyHonorContState(c *gin.Context) {
var requestData publicmethod.PublicState var requestData publicmethod.PublicState
c.ShouldBindJSON(&requestData) c.ShouldBindJSON(&requestData)
@ -303,7 +307,7 @@ func (a *ApiMethod) EidyHonorContState(c *gin.Context) {
} }
where := publicmethod.MapOut[string]() where := publicmethod.MapOut[string]()
where["id"] = requestData.Id where["id"] = requestData.Id
var carrierTypeCont models.HonoraryArchives var carrierTypeCont modelshonory.HonoraryArchives
judgeErr := carrierTypeCont.GetCont(where, "`id`") judgeErr := carrierTypeCont.GetCont(where, "`id`")
if judgeErr != nil { if judgeErr != nil {
publicmethod.Result(107, judgeErr, c) publicmethod.Result(107, judgeErr, c)

685
api/version1/postseting/postpc/scheme.go

@ -0,0 +1,685 @@
package postpc
import (
"encoding/json"
"fmt"
"key_performance_indicators/models/modelshr"
"key_performance_indicators/models/modelskpi"
"key_performance_indicators/overall"
"key_performance_indicators/overall/publicmethod"
"sort"
"strconv"
"strings"
"time"
"github.com/gin-gonic/gin"
)
// 获取岗位相关指标
func (a *ApiMethod) GetPostAboutTarget(c *gin.Context) {
var receivedValue publicmethod.PublicId
err := c.ShouldBindJSON(&receivedValue)
if err != nil {
publicmethod.Result(100, err, c)
return
}
//获取岗位相关信息
var postCont modelshr.Position
postContErr := postCont.GetCont(map[string]interface{}{"`id`": receivedValue.Id}, "`id`", "`duties`", "`administrative_organization`", "`superior`", "`department`")
if postContErr != nil {
publicmethod.Result(107, postContErr, c)
return
}
//根据维度生成方案列表
//1、获取维度
var dimensionModels modelskpi.DutyClass
dimensionList, dimeErr := dimensionModels.ContMap(map[string]interface{}{"`state`": 1}, "`id`", "`title`", "`sort`")
fmt.Printf("dimensionList--->%v\n", dimensionList)
if dimeErr != nil || len(dimensionList) <= 0 {
publicmethod.Result(107, postContErr, c)
return
}
//2、根据维度获取岗位相关指标
var postPlanSync postDimeTarSync
for _, v := range dimensionList {
syncSeting.Add(1)
go postPlanSync.GetPostTargent(postCont, v)
}
syncSeting.Wait()
planAry := postPlanSync.readDataLock() //读取线程通道数据
if len(planAry) < 1 {
publicmethod.Result(1, planAry, c, "该岗位没有设定专属指标!您可以从部门指标中引入!")
return
}
//根据维度序号排序
sort.Slice(planAry, func(i, j int) bool {
return planAry[i].Sort < planAry[j].Sort
})
publicmethod.Result(0, planAry, c)
}
// 获取岗位与维度相关的指标
/*
@position 岗位信息
@dutyClass 维度信息
*/
func (p *postDimeTarSync) GetPostTargent(position modelshr.Position, dutyClass modelskpi.DutyClass) {
p.mutext.Lock()
defer p.mutext.Unlock()
//获取相关指标
var postTargetList []modelskpi.PostTarget
postTarErr := overall.CONSTANT_DB_KPI.Model(&modelskpi.PostTarget{}).Where("`state` = 1 AND `dimension` = ? AND `rele_depart` = ? AND FIND_IN_SET(?,`departments_post`)", dutyClass.Id, position.AdministrativeOrganization, position.Id).Find(&postTargetList).Error
fmt.Printf("postTargetList---->%v\n", postTargetList)
if postTarErr == nil && len(postTargetList) > 0 {
var planCont postAboutDimeTar
planCont.Id = strconv.FormatInt(dutyClass.Id, 10)
planCont.Name = dutyClass.Title
planCont.Sort = dutyClass.Sort
for _, v := range postTargetList {
var targetCont postAboutTarget
targetCont.Id = strconv.FormatInt(v.Id, 10)
targetCont.Name = v.Title
targetCont.Content = "" //指标描述
targetCont.StandardScore = getPostDimeTarWeight(position.AdministrativeOrganization, position.Id, dutyClass.Id, v.Id, 1, 1) //标准分
targetCont.Unit = v.Unit //单位
targetCont.IsTrue = 2 //是否允许修改 1:不允许;2:允许
targetCont.State = 1 //状态 1:启用;2:禁用;3:观察
planCont.Child = append(planCont.Child, targetCont)
}
p.planList = append(p.planList, planCont)
}
syncSeting.Done()
}
/*
获取岗位考核指标或维度标准分
@orgid 行政组织
@postid 岗位
@dimensionid 维度
@targetid 指标
@hierarchy 1维度2指标
@isQuote 1不是引用2引用部门
getPostDimeTarWeight(orgid, postid, dimensionid, targetid int64, hierarchy, isQuote int)
*/
func getPostDimeTarWeight(orgid, postid, dimensionid, targetid int64, hierarchy, isQuote int) int64 {
if hierarchy == 0 {
hierarchy = 2
}
where := publicmethod.MapOut[string]()
where["orgid"] = orgid
where["postid"] = postid
where["dimension"] = dimensionid
var ddpwCont modelskpi.DepartDimePostWeight
if hierarchy == 1 {
where["hierarchy"] = 1
// ddpwCont.GetCont(map[string]interface{}{"orgid": orgid, "postid": postid, "dimension": dimensionid, "hierarchy": 1}, "`weight`")
ddpwCont.GetCont(where, "`weight`")
} else {
where["target"] = targetid
where["hierarchy"] = 2
// ddpwCont.GetCont(map[string]interface{}{"orgid": orgid, "postid": postid, "dimension": dimensionid, "target": targetid, "hierarchy": 2}, "`weight`")
ddpwCont.GetCont(where, "`weight`")
}
return ddpwCont.Weight
}
// 引用指标部门指标
func (a *ApiMethod) QuoteDepartmentTarget(c *gin.Context) {
var receivedValue publicmethod.PublicId
err := c.ShouldBindJSON(&receivedValue)
if err != nil {
publicmethod.Result(100, err, c)
return
}
if receivedValue.Id == "" {
publicmethod.Result(101, err, c)
return
}
//获取维度
var dimenId []int64
err = overall.CONSTANT_DB_KPI.Model(&modelskpi.TargetDepartment{}).Distinct("`dimension_id`").Where("`state` = 1 AND `level` = 2 AND `post_id` = ?", receivedValue.Id).Find(&dimenId).Error
if err != nil || len(dimenId) < 1 {
publicmethod.Result(107, err, c)
return
}
var targetlist postDimeTarSync
//获取指标列表
for _, v := range dimenId {
syncSeting.Add(1)
go targetlist.getPostQuoteDepartmentTarget(v, receivedValue.Id)
}
syncSeting.Wait()
planAry := targetlist.readDataLock() //读取线程通道数据
if len(planAry) < 1 {
publicmethod.Result(1, planAry, c, "该岗位没有设定部门指标引入项!")
return
}
//根据维度序号排序
sort.Slice(planAry, func(i, j int) bool {
return planAry[i].Sort < planAry[j].Sort
})
publicmethod.Result(0, planAry, c)
}
/*
获取岗位引入部门指标的列表
@dimensionId 维度
@postId 岗位
*/
func (p *postDimeTarSync) getPostQuoteDepartmentTarget(dimensionId int64, postId string) {
p.mutext.Lock()
defer p.mutext.Unlock()
var listCont postAboutDimeTar
//获取维度信息
var dimenCont modelskpi.DutyClass
dimenCont.GetCont(map[string]interface{}{"`id`": dimensionId}, "`title`", `sort`)
listCont.Id = strconv.FormatInt(dimensionId, 10)
listCont.Name = dimenCont.Title
listCont.Sort = dimenCont.Sort
//获取岗位信息
var postCont modelshr.Position
postCont.GetCont(map[string]interface{}{"`id`": postId}, "`id`", "`administrative_organization`")
var targetId []int64
overall.CONSTANT_DB_KPI.Model(&modelskpi.TargetDepartment{}).Distinct("`target_id`").Where("`state` = 1 AND `level` = 2 AND `dimension_id` = ? AND `post_id` = ?", dimensionId, postId).Find(&targetId)
if len(targetId) > 0 {
//获取指标信息
var targetList []modelskpi.EvaluationTarget
overall.CONSTANT_DB_KPI.Model(&modelskpi.EvaluationTarget{}).Where("`et_state` = 1 AND `et_id` IN ?", targetId).Find(&targetList)
if len(targetList) > 0 {
for _, v := range targetList {
var targetCont postAboutTarget
targetCont.Id = strconv.FormatInt(v.Id, 10)
targetCont.Name = v.Title
targetCont.Content = "" //指标描述
targetCont.StandardScore = getPostDimeTarWeight(postCont.AdministrativeOrganization, postCont.Id, dimensionId, v.Id, 2, 2) //标准分
targetCont.Unit = v.Uniteing //单位
targetCont.IsTrue = 2 //是否允许修改 1:不允许;2:允许
targetCont.State = 1 //状态 1:启用;2:禁用;3:观察
targetCont.Type = v.Type
if v.Type == 1 {
detaildList := getQuoteTargetDepartList(dimensionId, v.Id, postCont.Id)
if len(detaildList) > 0 {
targetCont.Child = detaildList
listCont.Child = append(listCont.Child, targetCont)
}
} else {
listCont.Child = append(listCont.Child, targetCont)
}
}
}
}
if len(listCont.Child) > 0 {
p.planList = append(p.planList, listCont)
}
jsonStr, _ := json.Marshal(listCont)
fmt.Printf("jsonStr------->%v\n", string(jsonStr))
syncSeting.Done()
}
// 获取部门引用关联指标细则
func getQuoteTargetDepartList(dimensionId, targetId, postId int64) (listCont []quoteDeatinDeparment) {
var detaildId []int64
overall.CONSTANT_DB_KPI.Model(&modelskpi.TargetDepartment{}).Distinct("`target_bylaws`").Where("`state` = 1 AND `level` = 2 AND `dimension_id` = ? AND `target_id` = ? AND `post_id` = ? AND `target_bylaws` <> 0", dimensionId, targetId, postId).Find(&detaildId)
if len(detaildId) < 1 {
return
}
var detaildList []modelskpi.DetailedTarget
overall.CONSTANT_DB_KPI.Model(&modelskpi.DetailedTarget{}).Select("`dt_id`,`dt_title`,`dt_content`,`dt_min_score`,`dt_max_score`").Where("`dt_state` = 1 AND `dt_id` IN ?", detaildId).Find(&detaildList)
if len(detaildList) < 1 {
return
}
for _, v := range detaildList {
var contList quoteDeatinDeparment
contList.Id = strconv.FormatInt(v.Id, 10)
contList.Name = v.Title
biaoZhun := ""
if v.MinScore != 0 {
biaoZhun = fmt.Sprintf("%v-%v", v.MinScore, v.MaxScore)
} else {
biaoZhun = fmt.Sprintf("%v", v.MaxScore)
}
contList.ReferenceScore = biaoZhun
listCont = append(listCont, contList)
}
fmt.Println("----------------->")
return
}
// 提交岗位考核方案
func (a *ApiMethod) SubmitPostScheme(c *gin.Context) {
var receivedValue postScheme
c.ShouldBindJSON(&receivedValue)
if receivedValue.OrgId == "" {
publicmethod.Result(101, receivedValue.OrgId, c, "请指定行政组织ID")
return
}
if receivedValue.PostId == "" {
publicmethod.Result(101, receivedValue.PostId, c, "请指定行政组织ID")
return
}
if receivedValue.Year == "" {
publicmethod.Result(101, receivedValue.Year, c, "请指定方案属于哪一年的?")
return
}
if len(receivedValue.PostChild) < 1 && len(receivedValue.DepartmentChild) < 1 {
publicmethod.Result(1, receivedValue, c, "考核项目不能为空!")
return
}
orderIdInt, _ := strconv.ParseInt(receivedValue.OrgId, 10, 64)
//根据行政组织Id获取集团信息,及部门信息
groupId, companyId, departmentId, sunDepartId, workShopId := publicmethod.GetOrgStructure(orderIdInt)
//获取公司首字母
var companyCont modelshr.AdministrativeOrganization
companyCont.GetCont(map[string]interface{}{"`id`": companyId}, "`name`", "`abbreviation`")
firstNameWord := companyCont.Abbreviation
if firstNameWord == "" {
firstNameWord = companyCont.Name
}
companyFirstWord := publicmethod.ChineseFirstWordCapitalize(firstNameWord) //公司首字母
//获取部门首字母
var departmentCont modelshr.AdministrativeOrganization
departmentCont.GetCont(map[string]interface{}{"`id`": departmentId}, "`name`", "`abbreviation`")
firstNameWordDepart := departmentCont.Abbreviation
if firstNameWordDepart == "" {
firstNameWordDepart = departmentCont.Name
}
departmentFirstWord := publicmethod.ChineseFirstWordCapitalize(firstNameWordDepart) //部门首字母
judgeState := 1 //方案初始状态
//判断该岗位是否有生成的考核方案
var versionState []int
overall.CONSTANT_DB_KPI.Model(&modelskpi.PositionPlanVersio{}).Select("state").Where("`group` = ? AND `department` = ? AND `orgid` = ? AND `position` = ?", companyId, departmentId, orderIdInt, receivedValue.PostId).Find(&versionState)
fmt.Printf("versionState----------->%v------------>%v\n", len(versionState), versionState)
if len(versionState) > 0 {
for _, s_v := range versionState {
if s_v == 1 {
judgeState = 2
}
}
}
var versioNum string //版本号
//判断年度是否存在版本
var sumVerson int64
judgeVersioNum := overall.CONSTANT_DB_KPI.Model(&modelskpi.PositionPlanVersio{}).Select("`id`").Where("`group` = ? AND `department` = ? AND `years` = ?", companyId, departmentId, receivedValue.Year).Pluck("COALESCE(COUNT(id), 0) as countid", &sumVerson).Error
if judgeVersioNum != nil {
versioNum = "0001"
} else {
if sumVerson == 0 {
versioNum = "0001"
} else {
sumVerson++
sumVersonStr := strconv.FormatInt(sumVerson, 10)
versioNum = publicmethod.ZeroFillByStr(sumVersonStr, 4, true)
}
}
todyTime := time.Now().Unix()
versionNumber := fmt.Sprintf("%v-%v-%v%v", companyFirstWord, departmentFirstWord, publicmethod.UnixTimeToDay(todyTime, 21), versioNum)
postIdInt, _ := strconv.ParseInt(receivedValue.PostId, 10, 64) //岗位id转成整形
yearInt, _ := strconv.ParseInt(receivedValue.Year, 10, 64)
jsonPlanCont, _ := json.Marshal(receivedValue)
//准备写入方案
var postPlanScheme modelskpi.PositionPlanVersio
postPlanScheme.Group = companyId //归属集团"`
postPlanScheme.Department = departmentId //归属部门"`
postPlanScheme.OrgId = orderIdInt //行政组织"`
postPlanScheme.Position = postIdInt //归属岗位"`
postPlanScheme.Key = versionNumber //编码"`
postPlanScheme.Versio = versioNum //版本号"`
postPlanScheme.Year = yearInt //年度"`
postPlanScheme.State = judgeState //状态(1:启用;2:禁用;3:删除)"`
postPlanScheme.AddTime = todyTime //创建时间"`
postPlanScheme.EiteTime = todyTime //修改时间"`
postPlanScheme.Content = string(jsonPlanCont) //版本内容"`
err := overall.CONSTANT_DB_KPI.Create(&postPlanScheme).Error
if err != nil {
publicmethod.Result(104, receivedValue.OrgId, c, "请检查您的数据格式!")
return
}
fmt.Printf("groupId-------->%v---->companyId-------->%v---->departmentId-------->%v---->sunDepartId-------->%v---->workShopId-------->%v---------versionNumber----------->%v---------judgeState----------->%v\n", groupId, companyId, departmentId, sunDepartId, workShopId, versionNumber, judgeState)
//岗位指标处理
if len(receivedValue.PostChild) > 0 {
syncSeting.Add(1)
go postSchemeTarget(versionNumber, 1, judgeState, receivedValue.PostChild, companyId, departmentId, orderIdInt, postIdInt)
}
//引用部门指标处理
if len(receivedValue.DepartmentChild) > 0 {
syncSeting.Add(1)
go postSchemeTarget(versionNumber, 2, judgeState, receivedValue.DepartmentChild, companyId, departmentId, orderIdInt, postIdInt)
}
syncSeting.Wait()
jsonCont, _ := json.Marshal(postPlanScheme)
publicmethod.Result(0, string(jsonCont), c)
}
/*
岗位指标写入
@versionNumber 方案版本号
@source 来源1岗位2部门引用
@judgeState 考核项状态
@scheme 方案结构体
@companyId 公司
@departmentId 部门
@orgid 行政组织
@postid 岗位
*/
func postSchemeTarget(versionNumber string, source, judgeState int, scheme []schemeStructure, companyId, departmentId, orgid, postid int64) {
defer syncSeting.Done()
timeData := time.Now().Unix()
var saveNewData []modelskpi.QualitativeEvaluationScheme
for _, v := range scheme { //解析维度
dimensionIdInt64, _ := strconv.ParseInt(v.Id, 10, 64) //转换维度ID
if len(v.Child) > 0 { //判断是否有指标
for _, cv := range v.Child { //解析指标
targetIdInt64, _ := strconv.ParseInt(cv.Id, 10, 64) //转换指标ID
var saveData modelskpi.QualitativeEvaluationScheme
scoringMethod := 1
//判断计分方式
if source != 1 { //来源于部门引用
var departTargetInfo modelskpi.EvaluationTarget
departTargetInfo.GetCont(map[string]interface{}{"`et_id`": targetIdInt64}, "`et_scoring_method`")
if departTargetInfo.ScoringMethod != 0 {
scoringMethod = departTargetInfo.ScoringMethod
}
} else { //来源于岗位考核
var departPostTargetInfo modelskpi.PostTarget
departPostTargetInfo.GetCont(map[string]interface{}{"`id`": targetIdInt64}, "`scoring_method`")
if departPostTargetInfo.ScoringMethod != 0 {
scoringMethod = departPostTargetInfo.ScoringMethod
}
}
if cv.Type != 1 { //定量考核
//判断该指标是否存在
whereLian := publicmethod.MapOut[string]()
whereLian["`version_number`"] = versionNumber
whereLian["`company_id`"] = companyId
whereLian["`department_id`"] = departmentId
whereLian["`org_id`"] = orgid
whereLian["`post_id`"] = postid
whereLian["`dimension_id`"] = dimensionIdInt64
whereLian["`target_id`"] = targetIdInt64
judgeLianErr := saveData.GetCont(whereLian, "`id`", "`state`")
if judgeLianErr == nil {
eidtTargetCont := publicmethod.MapOut[string]()
eidtTargetCont["`scoring_method`"] = scoringMethod
eidtTargetCont["`state`"] = judgeState
eidtTargetCont["`source`"] = source
eidtTargetCont["`run_state`"] = cv.State
eidtTargetCont["`eitetime`"] = timeData
saveData.EiteCont(map[string]interface{}{"`id`": saveData.Id}, eidtTargetCont)
} else { //不存在需要新增
saveData.VersionNumber = versionNumber //版本编号"`
saveData.CompanyId = companyId //归属公司"`
saveData.DepartmentId = departmentId //归属部门"`
saveData.OrgId = orgid //归属行政组织"`
saveData.PostId = postid //归属岗位"`
saveData.Title = cv.Name //考核项名称"`
saveData.DimensionId = dimensionIdInt64 //维度"`
saveData.TargetId = targetIdInt64 //指标"`
saveData.SonTargetId = 0 //子栏目"`
saveData.DetailsId = 0 //细则"`
saveData.Attribute = cv.Type //属性 1:定性考核;2:定量考核"`
saveData.MinScore = 0 //最小分*100保存"`
saveData.MaxScore = 0 //最大分*100保存"`
saveData.ScoringMethod = scoringMethod //计分方式(1:自动;2:手动)"`
saveData.State = judgeState //状态(1:启用;2:禁用;3:删除)"`
saveData.Addtime = timeData //添加时间"`
saveData.Eitetime = timeData //编辑时间"`
saveData.CensorType = "2" //检查方式(1:现场检查;2:资料检查;3:事件触发)"`
saveData.Source = source //来源(1:岗位;2:部门引用)"`
saveData.RunState = cv.State //运行状态(1:启用;2:禁用;3:观察)
saveNewData = append(saveNewData, saveData)
}
if source != 1 { //来源于部门引用
// fmt.Printf("启用人员管理--1--->%v--->%v--->%v--->%v\n", source, targetIdInt64, len(cv.Operator), cv.Operator)
if len(cv.Operator) > 0 {
// fmt.Printf("启用人员管理--2--->%v\n", targetIdInt64)
syncSetinges.Add(1)
go DepartAboutPostTargetReport(dimensionIdInt64, targetIdInt64, 0, 0, orgid, postid, cv.Operator, 2, cv.Type)
}
}
} else { //定性考核
if len(cv.Child) > 0 { //判断是否有定性考核项目
for _, cvt := range cv.Child {
var sonTargetIdInt64 int64 = 0
var detailsIdInt64 int64 = 0
//获取细则内容
if source != 1 { //来源于部门引用
var depatrDeatCont modelskpi.DetailedTarget
depatrDeatCont.GetCont(map[string]interface{}{"`dt_id`": cvt.Id})
sonTargetIdInt64 = depatrDeatCont.ParentIdSun
detailsIdInt64 = depatrDeatCont.Id
} else { //来源于岗位考核
var depatrDeatCont modelskpi.PostTargetDetails
depatrDeatCont.GetCont(map[string]interface{}{"`id`": cvt.Id})
sonTargetIdInt64 = depatrDeatCont.ParentIdSun
detailsIdInt64 = depatrDeatCont.Id
}
//判断该细则是否存在
whereLian := publicmethod.MapOut[string]()
whereLian["`version_number`"] = versionNumber
whereLian["`company_id`"] = companyId
whereLian["`department_id`"] = departmentId
whereLian["`org_id`"] = orgid
whereLian["`post_id`"] = postid
whereLian["`dimension_id`"] = dimensionIdInt64
whereLian["`target_id`"] = targetIdInt64
whereLian["`son_target_id`"] = sonTargetIdInt64
whereLian["`details_id`"] = detailsIdInt64
judgeLianErr := saveData.GetCont(whereLian, "`id`", "`state`")
if judgeLianErr == nil {
eidtTargetCont := publicmethod.MapOut[string]()
eidtTargetCont["`scoring_method`"] = scoringMethod
eidtTargetCont["`state`"] = judgeState
eidtTargetCont["`source`"] = source
eidtTargetCont["`run_state`"] = cv.State
eidtTargetCont["`eitetime`"] = timeData
saveData.EiteCont(map[string]interface{}{"`id`": saveData.Id}, eidtTargetCont)
} else { //不存在需要新增
var minScoreInt int64 = 0
var maxScoreInt int64 = 0
scoreAry := strings.Split(cvt.ReferenceScore, "-")
scoreLen := len(scoreAry)
if scoreLen > 0 {
if scoreLen == 1 {
maxScore, _ := strconv.ParseFloat(scoreAry[0], 64)
maxScoreInt, _ = strconv.ParseInt(strconv.FormatFloat(maxScore*100, 'f', -1, 64), 10, 64)
minScoreInt = 0
} else {
minScore, _ := strconv.ParseFloat(scoreAry[0], 64)
maxScore, _ := strconv.ParseFloat(scoreAry[scoreLen-1], 64)
minScoreInt, _ = strconv.ParseInt(strconv.FormatFloat(minScore*100, 'f', -1, 64), 10, 64)
maxScoreInt, _ = strconv.ParseInt(strconv.FormatFloat(maxScore*100, 'f', -1, 64), 10, 64)
}
}
saveData.VersionNumber = versionNumber //版本编号"`
saveData.CompanyId = companyId //归属公司"`
saveData.DepartmentId = departmentId //归属部门"`
saveData.OrgId = orgid //归属行政组织"`
saveData.PostId = postid //归属岗位"`
saveData.Title = cv.Name //考核项名称"`
saveData.DimensionId = dimensionIdInt64 //维度"`
saveData.TargetId = targetIdInt64 //指标"`
saveData.SonTargetId = sonTargetIdInt64 //子栏目"`
saveData.DetailsId = detailsIdInt64 //细则"`
saveData.Attribute = cv.Type //属性 1:定性考核;2:定量考核"`
saveData.MinScore = minScoreInt //最小分*100保存"`
saveData.MaxScore = maxScoreInt //最大分*100保存"`
saveData.ScoringMethod = scoringMethod //计分方式(1:自动;2:手动)"`
saveData.State = judgeState //状态(1:启用;2:禁用;3:删除)"`
saveData.Addtime = timeData //添加时间"`
saveData.Eitetime = timeData //编辑时间"`
saveData.CensorType = "2" //检查方式(1:现场检查;2:资料检查;3:事件触发)"`
saveData.Source = source //来源(1:岗位;2:部门引用)"`
saveData.RunState = cv.State //运行状态(1:启用;2:禁用;3:观察)
saveNewData = append(saveNewData, saveData)
}
if source != 1 { //来源于部门引用
// fmt.Printf("启用人员管理--3--->%v--->%v--->%v--->%v\n", source, targetIdInt64, len(cv.Operator), cv.Operator)
if len(cvt.Operator) > 0 {
// fmt.Printf("启用人员管理--4--->%v--->%v\n", targetIdInt64, detailsIdInt64)
syncSetinges.Add(1)
go DepartAboutPostTargetReport(dimensionIdInt64, targetIdInt64, sonTargetIdInt64, detailsIdInt64, orgid, postid, cvt.Operator, 2, cv.Type)
}
}
}
}
}
}
}
}
if len(saveNewData) > 0 {
overall.CONSTANT_DB_KPI.Create(&saveNewData)
}
syncSetinges.Wait()
}
/*
协程处理
部门指标岗位提报人关联通用函数
@dimensionId 维度
@targetId 指标ID
@targetSunId 栏目ID
@bylawsId 指标细则
@departmentId 接受考核部门
@postId 岗位
@repart 提报人
@class 级别1部门级2岗位级
@nature 1定性考核2定量考核
func departAboutPostTargetReport(dimensionId, targetId, targetSunId, bylawsId, departmentId, postId int64, repart []loopStruct, class, nature int)
*/
func DepartAboutPostTargetReport(dimensionId, targetId, targetSunId, bylawsId, departmentId, postId int64, repart []string, class, nature int) {
defer syncSetinges.Done()
// fmt.Printf("启用人员管理----->%v\n", targetId)
//将不属于该指标细则的部门至禁用
otherSaveData := publicmethod.MapOut[string]()
otherSaveData["`state`"] = 2
otherSaveData["`time`"] = time.Now().Unix()
where := publicmethod.MapOut[string]()
where["`type`"] = class
if targetId != 0 {
where["`target_id`"] = targetId
}
if targetSunId != 0 {
where["`target_sun_id`"] = targetSunId
}
if bylawsId != 0 {
where["`target_bylaws`"] = bylawsId
}
if departmentId != 0 {
where["`department_id`"] = departmentId
}
if postId != 0 {
where["`post_id`"] = postId
}
if len(repart) < 1 {
overall.CONSTANT_DB_KPI.Model(&modelskpi.TargetReport{}).Where(where).Updates(&otherSaveData)
} else {
//获取关联的人员
var userKeyAbout []string
for _, v := range repart {
if publicmethod.IsInTrue[string](v, userKeyAbout) == false {
userKeyAbout = append(userKeyAbout, v)
//获取评价人部门
var manCont modelshr.PersonArchives
manCont.GetCont(map[string]interface{}{"`key`": v}, "`maindeparment`")
var tarReportCont modelskpi.TargetReport
trWhere := publicmethod.MapOut[string]()
trWhere["`man_key`"] = v
trWhere["`type`"] = class
if targetId != 0 {
trWhere["`target_id`"] = targetId
}
if targetSunId != 0 {
trWhere["`target_sun_id`"] = targetSunId
}
if bylawsId != 0 {
trWhere["`target_bylaws`"] = bylawsId
}
if departmentId != 0 {
trWhere["`department_id`"] = departmentId
}
if postId != 0 {
trWhere["`post_id`"] = postId
}
saveErr := tarReportCont.GetCont(trWhere, "`id`", "`state`")
if saveErr == nil {
if tarReportCont.State != 1 {
tarReportCont.EiteCont(map[string]interface{}{"`id`": tarReportCont.Id}, map[string]interface{}{"`state`": 1, "`dimension_id`": dimensionId, "`man_department`": manCont.MainDeparment, "`time`": time.Now().Unix()})
}
} else {
xiZe := 3
if targetId != 0 && targetSunId != 0 && bylawsId == 0 {
xiZe = 2
} else if targetId != 0 && targetSunId == 0 && bylawsId == 0 {
xiZe = 1
}
tarReportCont.Dimension = dimensionId
tarReportCont.TargetId = targetId //指标ID"`
tarReportCont.TargetSunId = targetSunId //子目标"`
tarReportCont.TargetBylaws = bylawsId //指标细则"`
tarReportCont.DepartmentId = departmentId //部门ID"`
tarReportCont.PostId = postId //岗位ID"`
tarReportCont.Type = class //类型(1:公司级;2:部门级)"`
tarReportCont.State = 1 //状态(1:启用;2:禁用;3:删除)"`
reportId, _ := strconv.ParseInt(v, 10, 64)
tarReportCont.ReportPerson = reportId //上报人"`
tarReportCont.ManDepartment = manCont.MainDeparment //提报人所在部门"`
tarReportCont.Time = time.Now().Unix() //写入时间"`
tarReportCont.Class = nature //1:定性考核;2:定量考核"`
tarReportCont.Level = xiZe //1:指标;2:子目标;3:细则
overall.CONSTANT_DB_KPI.Create(&tarReportCont)
}
}
}
//清除不需要提报的人员
// if len(userKeyAbout) > 0 {
// overall.CONSTANT_DB_KPI.Model(&modelskpi.TargetReport{}).Where(where).Not(map[string]interface{}{"man_key": userKeyAbout}).Updates(&otherSaveData)
// }
}
}
// 获取岗位方案内容列表
func (a *ApiMethod) GetPostScheme(c *gin.Context) {
var receivedValue publicmethod.PublicId
err := c.ShouldBindJSON(&receivedValue)
if err != nil {
publicmethod.Result(100, err, c)
return
}
if receivedValue.Id == "" {
publicmethod.Result(101, err, c)
return
}
//获取维度
var schemeCont modelskpi.PositionPlanVersio
err = overall.CONSTANT_DB_KPI.Where("`id` = ?", receivedValue.Id).Find(&schemeCont).Error
if err != nil {
publicmethod.Result(107, err, c)
return
}
}

106
api/version1/postseting/postpc/type.go

@ -0,0 +1,106 @@
package postpc
import (
"key_performance_indicators/overall/publicmethod"
"sync"
"github.com/gin-gonic/gin"
)
type ApiMethod struct{}
// 协程设置
var syncSeting = sync.WaitGroup{}
var syncSetinges = sync.WaitGroup{}
// 岗位指标协程操作
type postDimeTarSync struct {
planList []postAboutDimeTar
mutext sync.RWMutex
}
// 读取岗位指标协程数据
func (d *postDimeTarSync) readDataLock() []postAboutDimeTar {
d.mutext.RLock()
defer d.mutext.RUnlock()
return d.planList
}
// 岗位考核PC端入口
func (a *ApiMethod) Index(c *gin.Context) {
outputCont := publicmethod.MapOut[string]()
outputCont["index"] = "岗位考核PC端入口"
publicmethod.Result(0, outputCont, c)
}
// 获取岗位相关指标
type postAboutTarget struct {
publicmethod.PublicId
publicmethod.PublicName //指标名称
Content string `json:"content"` //指标描述
StandardScore int64 `json:"standardscore"` //标准分
Unit string `json:"unit"` //单位
IsTrue int `json:"istrue"` //是否允许修改 1:不允许;2:允许
State int `json:"state"` //状态 1:启用;2:禁用;3:观察
Type int `json:"type"` //1:定性考核;2:定量考核
Child []quoteDeatinDeparment `json:"child"` //指标细则列表
}
// 岗位相关维度指标列表
type postAboutDimeTar struct {
publicmethod.PublicId
publicmethod.PublicName //维度名称
Sort int `json:"sort"` //排序
Child []postAboutTarget `json:"child"` //指标列表
}
// 引用部门定性考核细则列表
type quoteDeatinDeparment struct {
publicmethod.PublicId
publicmethod.PublicName //细则
ReferenceScore string `json:"referencescore"` //考核标准
}
// 岗位考核方案
type postScheme struct {
OrgId string `json:"orgid"` //行政组织ID
PostId string `json:"postid"` //岗位
Year string `json:"year"` //年
PostChild []schemeStructure `json:"postchild"` //岗位指标
DepartmentChild []schemeStructure `json:"departmentchild"` //引用部门指标
}
// 方案结构体 维度
type schemeStructure struct {
publicmethod.PublicId //id
publicmethod.PublicName //名称
Score float64 `json:"score"` //分数
Child []schemeTargetStructure `json:"child"` //指标列表
}
// 方案中的指标
type schemeTargetStructure struct {
publicmethod.PublicId //id
publicmethod.PublicName //名称
Content string `json:"content"` //说明
Score float64 `json:"score"` //分数
State int `json:"state"` //状态:1:启用;2:禁用;3:观察
Type int `json:"type"` //1、定性指标;2、定量指标
Child []schemeDetailedStructure `json:"child"` //指标细则列表
Operator []string `json:"operator"` //考核执行人
}
// 方案中的定性指标细则
type schemeDetailedStructure struct {
publicmethod.PublicId //id
publicmethod.PublicName //名称
ReferenceScore string `json:"referencescore"` //考核标准
State int `json:"state"` //状态:1:启用;2:禁用;3:观察
Operator []string `json:"operator"` //考核执行人
}
// 岗位考核方案列表
type postSchemeList struct {
publicmethod.PagesTurn
VersionNumber string `json:"versionnumber"` //版本号
}

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

12
apirouter/entry.go

@ -3,19 +3,29 @@ package apirouter
import ( import (
"key_performance_indicators/apirouter/apishiyan" "key_performance_indicators/apirouter/apishiyan"
"key_performance_indicators/apirouter/empower" "key_performance_indicators/apirouter/empower"
<<<<<<< HEAD
mytest "key_performance_indicators/apirouter/myTest" mytest "key_performance_indicators/apirouter/myTest"
=======
"key_performance_indicators/apirouter/v1/departmentseting"
>>>>>>> v1_dev
honorsRoute "key_performance_indicators/apirouter/v1/honorsRoute" honorsRoute "key_performance_indicators/apirouter/v1/honorsRoute"
"key_performance_indicators/apirouter/v1/postseting"
"key_performance_indicators/apirouter/verifyLogin" "key_performance_indicators/apirouter/verifyLogin"
// "key_performance_indicators/v1" // "key_performance_indicators/v1"
) )
//路由结构 // 路由结构
type RouterGroup struct { type RouterGroup struct {
EmpowerRouter empower.EmpowerApiRouter EmpowerRouter empower.EmpowerApiRouter
VerifyLogin verifyLogin.ApiRouter VerifyLogin verifyLogin.ApiRouter
ShiyanApi apishiyan.ApiRouter ShiyanApi apishiyan.ApiRouter
HonorsSouteRouter honorsRoute.ApiRouter HonorsSouteRouter honorsRoute.ApiRouter
<<<<<<< HEAD
MyTest mytest.TestApi MyTest mytest.TestApi
=======
PostRouter postseting.ApiRouter
DepartmentRouter departmentseting.ApiRouter
>>>>>>> v1_dev
} }
var RouterGroupEntry = new(RouterGroup) var RouterGroupEntry = new(RouterGroup)

45
apirouter/v1/departmentseting/pc.go

@ -0,0 +1,45 @@
package departmentseting
import (
"key_performance_indicators/api/version1"
"github.com/gin-gonic/gin"
)
// 部门考核PC端
func (a *ApiRouter) RouterGroupPc(router *gin.RouterGroup) {
apiRouter := router.Group("department_pc")
var methodBinding = version1.AppApiEntry.DeparmentPcApi
{
apiRouter.GET("", methodBinding.Index) //入口
apiRouter.POST("", methodBinding.Index) //入口
apiRouter.POST("departmenttargetlist", methodBinding.DepartmentTargetList) //部门指标列表
apiRouter.POST("shiyan", methodBinding.Shiyan) //实验
apiRouter.POST("getdepartabouttarget", methodBinding.GetDepartAboutTarget) //获取部门定性考核部门关联列表
apiRouter.POST("gettargetreport", methodBinding.GetTargetReport) //获取部门指标相关执行人
apiRouter.POST("addsuntargetdetailed", methodBinding.AddSunTargetDetailed) //添加定性考核子栏目及细则
apiRouter.POST("getdepartmenttragetcontlist", methodBinding.GetDepartmentTragetContList) //获取定性考核指标列表内容
apiRouter.POST("basissontargetadddetailed", methodBinding.BasisSonTargetAddDetailed) //根据指标栏目新增指标细则
apiRouter.POST("basistargetdearpetmentgetpost", methodBinding.BasisTargetDearpetmentGetPost) //根据指标和部门获取相关岗位
apiRouter.POST("basistaegetdeparmentreport", methodBinding.BasisTaegetDeparmentReport) //获取部门指标岗位提交人
apiRouter.POST("editsontargetdepartmentreport", methodBinding.EditSonTargetDepartmentReport) //修改子栏目标题名称级考核关联部门及提报人
apiRouter.POST("getsontargetcont", methodBinding.GetSonTargetCont) //获取子栏目基础信息
apiRouter.POST("delsontarget", methodBinding.DelSonTarget) //删除子栏目
apiRouter.POST("getonedetailedtarget", methodBinding.GetOneDetailedTarget) //获取单一指标细则内容
apiRouter.POST("edit_one_detailed_target", methodBinding.EditOneDetailedTarget) //编辑单一指标细则内容
apiRouter.POST("del_one_detailed_target", methodBinding.DelOneDetailedTarget) //删除单一指标细则
apiRouter.POST("add_department_target", methodBinding.AddDepartmentTarget) //添加部门指标
apiRouter.POST("get_one_terget_info", methodBinding.GetOneTergetInfo) //获取单一指标详细内容
apiRouter.POST("edit_one_target", methodBinding.EditOneTarget) //编辑单一部门指标
apiRouter.POST("deparment_target_about_post", methodBinding.DeparmentTargetAboutPost) //指标关联岗位
apiRouter.POST("depar_son_target_about_post", methodBinding.DeparSonTargetAboutPost) //子栏目关联部门岗位
apiRouter.POST("depar_detaile_about_post", methodBinding.DeparDetaileAboutPost) //指标细则关联部门岗位
}
}

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

21
apirouter/v1/postseting/pc.go

@ -0,0 +1,21 @@
package postseting
import (
"key_performance_indicators/api/version1"
"github.com/gin-gonic/gin"
)
// 岗位考核PC端
func (a *ApiRouter) RouterGroupPc(router *gin.RouterGroup) {
apiRouter := router.Group("postpc")
var methodBinding = version1.AppApiEntry.PostPcApi
{
apiRouter.GET("", methodBinding.Index) //入口
apiRouter.POST("", methodBinding.Index) //入口
apiRouter.POST("getpostabouttarget", methodBinding.GetPostAboutTarget) //获取岗位相关指标
apiRouter.POST("quote_department_target", methodBinding.QuoteDepartmentTarget) //引用指标部门指标
apiRouter.POST("submit_post_scheme", methodBinding.SubmitPostScheme) //提交岗位考核方案
}
}

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' #数据库编码方式 charset: 'utf8mb4' #数据库编码方式
parseTime: 'True' #是否自动转换时间 parseTime: 'True' #是否自动转换时间
loc: 'Local' #时区 loc: 'Local' #时区
name: 'human_resources_jindie' #数据库名称 name: 'hr_new' #数据库名称
username: 'root' #数据库用户民 username: 'root' #数据库用户民
password: 'root' #数据库密码 password: 'root' #数据库密码
max_idle_conns: 100 #最大空闲数量 max_idle_conns: 100 #最大空闲数量
@ -156,7 +156,7 @@ kpiDate:
charset: 'utf8mb4' #数据库编码方式 charset: 'utf8mb4' #数据库编码方式
parseTime: 'True' #是否自动转换时间 parseTime: 'True' #是否自动转换时间
loc: 'Local' #时区 loc: 'Local' #时区
name: 'performanceappraisal' #数据库名称 name: 'perform' #数据库名称
username: 'root' #数据库用户民 username: 'root' #数据库用户民
password: 'root' #数据库密码 password: 'root' #数据库密码
max_idle_conns: 100 #最大空闲数量 max_idle_conns: 100 #最大空闲数量

6
identification/interceptor/authentication.go

@ -3,7 +3,7 @@ package interceptor
import ( import (
"fmt" "fmt"
"key_performance_indicators/middleware/grocerystore" "key_performance_indicators/middleware/grocerystore"
"key_performance_indicators/models" "key_performance_indicators/models/modelshr"
"key_performance_indicators/overall" "key_performance_indicators/overall"
"key_performance_indicators/overall/publicmethod" "key_performance_indicators/overall/publicmethod"
@ -11,7 +11,7 @@ import (
"github.com/mitchellh/mapstructure" "github.com/mitchellh/mapstructure"
) )
//身份验证器 // 身份验证器
func IdentificationToken() gin.HandlerFunc { func IdentificationToken() gin.HandlerFunc {
return func(c *gin.Context) { return func(c *gin.Context) {
userToken := c.Request.Header.Get("token") userToken := c.Request.Header.Get("token")
@ -61,7 +61,7 @@ func IdentificationToken() gin.HandlerFunc {
passWordMd5.Md5EncryptionInit(validator.PassWord) passWordMd5.Md5EncryptionInit(validator.PassWord)
passWordMd5Str := passWordMd5.Md5EncryptionAlgorithm() passWordMd5Str := passWordMd5.Md5EncryptionAlgorithm()
var empowerUser models.EmpowerUser var empowerUser modelshr.EmpowerUser
userErr := empowerUser.GetCont(map[string]interface{}{"userkey": validator.UserKey, "password": passWordMd5Str}, "verification_code") userErr := empowerUser.GetCont(map[string]interface{}{"userkey": validator.UserKey, "password": passWordMd5Str}, "verification_code")
if userErr != nil { if userErr != nil {
publicmethod.Result(2000, userErr, c) publicmethod.Result(2000, userErr, c)

6
identification/interceptor/identity.go

@ -10,13 +10,13 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
//验证用户是否登录 // 验证用户是否登录
func AuthenticateUser() gin.HandlerFunc { func AuthenticateUser() gin.HandlerFunc {
return func(c *gin.Context) { return func(c *gin.Context) {
userKey := c.Request.Header.Get("user-key") userKey := c.Request.Header.Get("user-key")
userToken := c.Request.Header.Get("user-token") userToken := c.Request.Header.Get("user-token")
userAgent := c.Request.Header.Get("User-Agent") userAgent := c.Request.Header.Get("User-Agent")
// fmt.Printf("userKey---------->%v----------userToken---------->%v--------userAgent---------->%v\n", userKey, userToken, userAgent)
if userKey == "" || userToken == "" || userAgent == "" { if userKey == "" || userToken == "" || userAgent == "" {
response.FailWithDetailed(gin.H{"reload": false, "code": 300}, "未登录或非法访问", c) response.FailWithDetailed(gin.H{"reload": false, "code": 300}, "未登录或非法访问", c)
c.Abort() c.Abort()
@ -106,7 +106,7 @@ func AuthenticateUser() gin.HandlerFunc {
} }
} }
//验证用户是否具备权限 // 验证用户是否具备权限
func VerifyUrl() gin.HandlerFunc { func VerifyUrl() gin.HandlerFunc {
return func(c *gin.Context) { return func(c *gin.Context) {
systemClass := c.Request.Header.Get("system-class") systemClass := c.Request.Header.Get("system-class")

16
initialization/route/initRoute.go

@ -7,7 +7,7 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
//初始化主路由 // 初始化主路由
func InitialRouter() *gin.Engine { func InitialRouter() *gin.Engine {
var router = gin.Default() var router = gin.Default()
@ -53,8 +53,18 @@ func InitialRouter() *gin.Engine {
VerifyIdentity.Use(interceptor.AuthenticateUser()).Use(interceptor.VerifyUrl()) VerifyIdentity.Use(interceptor.AuthenticateUser()).Use(interceptor.VerifyUrl())
{ {
//v1版本接口 //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身份验证 //Token身份验证
VerifyIdentityToken := router.Group("") VerifyIdentityToken := router.Group("")

BIN
key_performance_indicators.exe

Binary file not shown.

10
models/carrier_type.go → models/modelshonory/carrier_type.go

@ -1,11 +1,11 @@
package models package modelshonory
import ( import (
"key_performance_indicators/overall" "key_performance_indicators/overall"
"strings" "strings"
) )
//载体类型 // 载体类型
type CarrierType struct { type CarrierType struct {
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:ID"` 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:荣誉名称"` 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" return "carrier_type"
} }
//编辑载体类型内容 // 编辑载体类型内容
func (cont *CarrierType) EiteCont(whereMap interface{}, saveData interface{}) (err error) { func (cont *CarrierType) EiteCont(whereMap interface{}, saveData interface{}) (err error) {
err = overall.CONSTANT_DB_MANAGE_ARCHIVES.Model(&cont).Where(whereMap).Updates(saveData).Error err = overall.CONSTANT_DB_MANAGE_ARCHIVES.Model(&cont).Where(whereMap).Updates(saveData).Error
return return
} }
//获取载体类型内容 // 获取载体类型内容
func (cont *CarrierType) GetCont(whereMap interface{}, field ...string) (err error) { func (cont *CarrierType) GetCont(whereMap interface{}, field ...string) (err error) {
gormDb := overall.CONSTANT_DB_MANAGE_ARCHIVES.Model(&cont) gormDb := overall.CONSTANT_DB_MANAGE_ARCHIVES.Model(&cont)
if len(field) > 0 { if len(field) > 0 {
@ -35,7 +35,7 @@ func (cont *CarrierType) GetCont(whereMap interface{}, field ...string) (err err
return return
} }
//删除内容 // 删除内容
func (cont *CarrierType) DelCont(whereMap interface{}) (err error) { func (cont *CarrierType) DelCont(whereMap interface{}) (err error) {
err = overall.CONSTANT_DB_MANAGE_ARCHIVES.Where(whereMap).Delete(&cont).Error err = overall.CONSTANT_DB_MANAGE_ARCHIVES.Where(whereMap).Delete(&cont).Error
return return

10
models/honorary_archives.go → models/modelshonory/honorary_archives.go

@ -1,11 +1,11 @@
package models package modelshonory
import ( import (
"key_performance_indicators/overall" "key_performance_indicators/overall"
"strings" "strings"
) )
//荣誉档案 // 荣誉档案
type HonoraryArchives struct { type HonoraryArchives struct {
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:ID"` 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:荣誉名称"` 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" return "honorary_archives"
} }
//编辑荣誉档案内容 // 编辑荣誉档案内容
func (cont *HonoraryArchives) EiteCont(whereMap interface{}, saveData interface{}) (err error) { func (cont *HonoraryArchives) EiteCont(whereMap interface{}, saveData interface{}) (err error) {
err = overall.CONSTANT_DB_MANAGE_ARCHIVES.Model(&cont).Where(whereMap).Updates(saveData).Error err = overall.CONSTANT_DB_MANAGE_ARCHIVES.Model(&cont).Where(whereMap).Updates(saveData).Error
return return
} }
//获取荣誉档案内容 // 获取荣誉档案内容
func (cont *HonoraryArchives) GetCont(whereMap interface{}, field ...string) (err error) { func (cont *HonoraryArchives) GetCont(whereMap interface{}, field ...string) (err error) {
gormDb := overall.CONSTANT_DB_MANAGE_ARCHIVES.Model(&cont) gormDb := overall.CONSTANT_DB_MANAGE_ARCHIVES.Model(&cont)
if len(field) > 0 { if len(field) > 0 {
@ -42,7 +42,7 @@ func (cont *HonoraryArchives) GetCont(whereMap interface{}, field ...string) (er
return return
} }
//删除内容 // 删除内容
func (cont *HonoraryArchives) DelCont(whereMap interface{}) (err error) { func (cont *HonoraryArchives) DelCont(whereMap interface{}) (err error) {
err = overall.CONSTANT_DB_MANAGE_ARCHIVES.Where(whereMap).Delete(&cont).Error err = overall.CONSTANT_DB_MANAGE_ARCHIVES.Where(whereMap).Delete(&cont).Error
return return

13
models/photos_gallery.go → models/modelshonory/photos_gallery.go

@ -1,12 +1,17 @@
package models package modelshonory
import ( import (
"key_performance_indicators/overall" "key_performance_indicators/overall"
"strings" "strings"
) )
<<<<<<< HEAD:models/photos_gallery.go
//图片库 //图片库
type PhotosGallery struct { type PhotosGallery struct {
=======
// 图片库
type PhotosGallery struct {
>>>>>>> v1_dev:models/modelshonory/photos_gallery.go
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:ID"` 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:图片地址"` Url string `json:"url" gorm:"column:url;type:varchar(255) unsigned;default:'';not null;comment:图片地址"`
ImgPath string `json:"imgpath" gorm:"column:img_path;type:varchar(255) unsigned;default:'';not null;comment:物理地址"` ImgPath string `json:"imgpath" gorm:"column:img_path;type:varchar(255) unsigned;default:'';not null;comment:物理地址"`
@ -22,13 +27,13 @@ func (PhotosGallery *PhotosGallery) TableName() string {
return "photos_gallery" return "photos_gallery"
} }
//编辑图片库内容 // 编辑图片库内容
func (cont *PhotosGallery) EiteCont(whereMap interface{}, saveData interface{}) (err error) { func (cont *PhotosGallery) EiteCont(whereMap interface{}, saveData interface{}) (err error) {
err = overall.CONSTANT_DB_MANAGE_ARCHIVES.Model(&cont).Where(whereMap).Updates(saveData).Error err = overall.CONSTANT_DB_MANAGE_ARCHIVES.Model(&cont).Where(whereMap).Updates(saveData).Error
return return
} }
//获取图片库内容 // 获取图片库内容
func (cont *PhotosGallery) GetCont(whereMap interface{}, field ...string) (err error) { func (cont *PhotosGallery) GetCont(whereMap interface{}, field ...string) (err error) {
gormDb := overall.CONSTANT_DB_MANAGE_ARCHIVES.Model(&cont) gormDb := overall.CONSTANT_DB_MANAGE_ARCHIVES.Model(&cont)
if len(field) > 0 { if len(field) > 0 {
@ -40,7 +45,7 @@ func (cont *PhotosGallery) GetCont(whereMap interface{}, field ...string) (err e
return return
} }
//删除内容 // 删除内容
func (cont *PhotosGallery) DelCont(whereMap interface{}) (err error) { func (cont *PhotosGallery) DelCont(whereMap interface{}) (err error) {
err = overall.CONSTANT_DB_MANAGE_ARCHIVES.Where(whereMap).Delete(&cont).Error err = overall.CONSTANT_DB_MANAGE_ARCHIVES.Where(whereMap).Delete(&cont).Error
return return

21
models/administrative_organization.go → models/modelshr/administrative_organization.go

@ -1,11 +1,11 @@
package models package modelshr
import ( import (
"key_performance_indicators/overall" "key_performance_indicators/overall"
"strings" "strings"
) )
//行政组织 // 行政组织
type AdministrativeOrganization struct { type AdministrativeOrganization struct {
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` 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:行政编码"` 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" return "administrative_organization"
} }
//编辑行政组织内容 // 编辑行政组织内容
func (cont *AdministrativeOrganization) EiteCont(whereMap interface{}, saveData interface{}) (err error) { func (cont *AdministrativeOrganization) EiteCont(whereMap interface{}, saveData interface{}) (err error) {
err = overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Updates(saveData).Error err = overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Updates(saveData).Error
return return
} }
//获取行政组织内容 // 获取行政组织内容
func (cont *AdministrativeOrganization) GetCont(whereMap interface{}, field ...string) (err error) { func (cont *AdministrativeOrganization) GetCont(whereMap interface{}, field ...string) (err error) {
gormDb := overall.CONSTANT_DB_HR.Model(&cont) gormDb := overall.CONSTANT_DB_HR.Model(&cont)
if len(field) > 0 { if len(field) > 0 {
@ -44,14 +44,19 @@ func (cont *AdministrativeOrganization) GetCont(whereMap interface{}, field ...s
return return
} }
//根据条件获取总数 // 根据条件获取总数
func (cont *AdministrativeOrganization) CountCont(whereMap interface{}) (countId int64) { func (cont *AdministrativeOrganization) CountCont(whereMap interface{}) (countId int64) {
overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Count(&countId) overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Count(&countId)
return return
} }
//读取全部信息 // 读取全部信息
func (cont *AdministrativeOrganization) ContMap(whereMap interface{}) (countAry []AdministrativeOrganization) { func (cont *AdministrativeOrganization) ContMap(whereMap interface{}, field ...string) (countAry []AdministrativeOrganization) {
overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Find(&countAry) gormDb := overall.CONSTANT_DB_HR.Model(&cont)
if len(field) > 0 {
fieldStr := strings.Join(field, ",")
gormDb = gormDb.Select(fieldStr)
}
gormDb.Where(whereMap).Find(&countAry)
return return
} }

8
models/administrative_organization_type.go → models/modelshr/administrative_organization_type.go

@ -1,11 +1,11 @@
package models package modelshr
import ( import (
"key_performance_indicators/overall" "key_performance_indicators/overall"
"strings" "strings"
) )
//行政组织类型 // 行政组织类型
type AdministrativeOrganizationType struct { type AdministrativeOrganizationType struct {
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` 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:类型名称"` 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" return "administrative_organization_type"
} }
//编辑职务分类内容 // 编辑职务分类内容
func (cont *AdministrativeOrganizationType) EiteCont(whereMap map[string]interface{}, saveData map[string]interface{}) (err error) { 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 err = overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Updates(saveData).Error
return return
} }
//获取详细内容 // 获取详细内容
func (cont *AdministrativeOrganizationType) GetCont(whereMap map[string]interface{}, field ...string) (err error) { func (cont *AdministrativeOrganizationType) GetCont(whereMap map[string]interface{}, field ...string) (err error) {
gormDb := overall.CONSTANT_DB_HR.Model(&cont) gormDb := overall.CONSTANT_DB_HR.Model(&cont)
if len(field) > 0 { if len(field) > 0 {

8
models/double_worker.go → models/modelshr/double_worker.go

@ -1,11 +1,11 @@
package models package modelshr
import ( import (
"key_performance_indicators/overall" "key_performance_indicators/overall"
"strings" "strings"
) )
//双职工 // 双职工
type DoubleWorker struct { type DoubleWorker struct {
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:ID"` 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"` 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" return "double_worker"
} }
//编辑双职工内容 // 编辑双职工内容
func (DoubleWorker *DoubleWorker) EiteCont(whereMap interface{}, saveData interface{}) (err error) { func (DoubleWorker *DoubleWorker) EiteCont(whereMap interface{}, saveData interface{}) (err error) {
err = overall.CONSTANT_DB_HR.Model(&DoubleWorker).Where(whereMap).Updates(saveData).Error err = overall.CONSTANT_DB_HR.Model(&DoubleWorker).Where(whereMap).Updates(saveData).Error
return return
} }
//获取双职工内容 // 获取双职工内容
func (cont *DoubleWorker) GetCont(whereMap interface{}, field ...string) (err error) { func (cont *DoubleWorker) GetCont(whereMap interface{}, field ...string) (err error) {
gormDb := overall.CONSTANT_DB_HR.Model(&cont) gormDb := overall.CONSTANT_DB_HR.Model(&cont)
if len(field) > 0 { if len(field) > 0 {

8
models/duties.go → models/modelshr/duties.go

@ -1,11 +1,11 @@
package models package modelshr
import ( import (
"key_performance_indicators/overall" "key_performance_indicators/overall"
"strings" "strings"
) )
//职务 // 职务
type Duties struct { type Duties struct {
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` 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:职务名称"` 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" return "duties"
} }
//编辑职务分类内容 // 编辑职务分类内容
func (Duties *Duties) EiteCont(whereMap map[string]interface{}, saveData map[string]interface{}) (err error) { 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 err = overall.CONSTANT_DB_HR.Model(&Duties).Where(whereMap).Updates(saveData).Error
return return
} }
//获取详细内容 // 获取详细内容
func (cont *Duties) GetCont(whereMap interface{}, field ...string) (err error) { func (cont *Duties) GetCont(whereMap interface{}, field ...string) (err error) {
gormDb := overall.CONSTANT_DB_HR.Model(&cont) gormDb := overall.CONSTANT_DB_HR.Model(&cont)
if len(field) > 0 { if len(field) > 0 {

6
models/duties_class_leve.go → models/modelshr/duties_class_leve.go

@ -1,11 +1,11 @@
package models package modelshr
import ( import (
"key_performance_indicators/overall" "key_performance_indicators/overall"
"strings" "strings"
) )
//职务信息及类别、等级视图 // 职务信息及类别、等级视图
type DutiesClassLeve struct { type DutiesClassLeve struct {
Id int64 `json:"id" gorm:"primaryKey;column:d_id;type:bigint(20) unsigned;not null;comment:Id;index"` 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:职务名称"` 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" return "duties_class_leve"
} }
//获取详细内容 // 获取详细内容
func (cont *DutiesClassLeve) GetCont(whereMap interface{}, field ...string) (err error) { func (cont *DutiesClassLeve) GetCont(whereMap interface{}, field ...string) (err error) {
gormDb := overall.CONSTANT_DB_HR.Model(&cont) gormDb := overall.CONSTANT_DB_HR.Model(&cont)
if len(field) > 0 { if len(field) > 0 {

10
models/emergency_contact.go → models/modelshr/emergency_contact.go

@ -1,11 +1,11 @@
package models package modelshr
import ( import (
"key_performance_indicators/overall" "key_performance_indicators/overall"
"strings" "strings"
) )
//紧急联系人 // 紧急联系人
type EmergencyContact struct { type EmergencyContact struct {
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:ID"` 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"` 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" return "emergency_contact"
} }
//编辑职务分类内容 // 编辑职务分类内容
func (EmergencyContact *EmergencyContact) EiteCont(whereMap interface{}, saveData interface{}) (err error) { func (EmergencyContact *EmergencyContact) EiteCont(whereMap interface{}, saveData interface{}) (err error) {
err = overall.CONSTANT_DB_HR.Model(&EmergencyContact).Where(whereMap).Updates(saveData).Error err = overall.CONSTANT_DB_HR.Model(&EmergencyContact).Where(whereMap).Updates(saveData).Error
return return
} }
//获取行政组织内容 // 获取行政组织内容
func (cont *EmergencyContact) GetCont(whereMap interface{}, field ...string) (err error) { func (cont *EmergencyContact) GetCont(whereMap interface{}, field ...string) (err error) {
gormDb := overall.CONSTANT_DB_HR.Model(&cont) gormDb := overall.CONSTANT_DB_HR.Model(&cont)
if len(field) > 0 { if len(field) > 0 {
@ -39,7 +39,7 @@ func (cont *EmergencyContact) GetCont(whereMap interface{}, field ...string) (er
return return
} }
//根据条件获取总数 // 根据条件获取总数
func (cont *EmergencyContact) CountCont(whereMap interface{}) (countId int64) { func (cont *EmergencyContact) CountCont(whereMap interface{}) (countId int64) {
overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Count(&countId) overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Count(&countId)
return return

10
models/empoweruser.go → models/modelshr/empoweruser.go

@ -1,11 +1,11 @@
package models package modelshr
import ( import (
"key_performance_indicators/overall" "key_performance_indicators/overall"
"strings" "strings"
) )
//授权账户 // 授权账户
type EmpowerUser struct { type EmpowerUser struct {
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` 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:账户"` 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" return "empoweruser"
} }
//编辑职务分类内容 // 编辑职务分类内容
func (cont *EmpowerUser) EiteCont(whereMap interface{}, saveData map[string]interface{}) (err error) { func (cont *EmpowerUser) EiteCont(whereMap interface{}, saveData map[string]interface{}) (err error) {
err = overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Updates(saveData).Error err = overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Updates(saveData).Error
return return
} }
//获取行政组织内容 // 获取行政组织内容
func (cont *EmpowerUser) GetCont(whereMap interface{}, field ...string) (err error) { func (cont *EmpowerUser) GetCont(whereMap interface{}, field ...string) (err error) {
gormDb := overall.CONSTANT_DB_HR.Model(&cont) gormDb := overall.CONSTANT_DB_HR.Model(&cont)
if len(field) > 0 { if len(field) > 0 {
@ -39,7 +39,7 @@ func (cont *EmpowerUser) GetCont(whereMap interface{}, field ...string) (err err
return return
} }
//根据条件获取总数 // 根据条件获取总数
func (cont *EmpowerUser) CountCont(whereMap interface{}) (countId int64) { func (cont *EmpowerUser) CountCont(whereMap interface{}) (countId int64) {
overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Count(&countId) overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Count(&countId)
return return

8
models/family_members.go → models/modelshr/family_members.go

@ -1,11 +1,11 @@
package models package modelshr
import ( import (
"key_performance_indicators/overall" "key_performance_indicators/overall"
"strings" "strings"
) )
//员工家属 // 员工家属
type FamilyMembers struct { type FamilyMembers struct {
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:ID"` 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:员工工号"` 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" return "family_members"
} }
//编辑员工家属内容 // 编辑员工家属内容
func (FamilyMembers *FamilyMembers) EiteCont(whereMap interface{}, saveData interface{}) (err error) { func (FamilyMembers *FamilyMembers) EiteCont(whereMap interface{}, saveData interface{}) (err error) {
err = overall.CONSTANT_DB_HR.Model(&FamilyMembers).Where(whereMap).Updates(saveData).Error err = overall.CONSTANT_DB_HR.Model(&FamilyMembers).Where(whereMap).Updates(saveData).Error
return return
} }
//获取员工家属内容 // 获取员工家属内容
func (cont *FamilyMembers) GetCont(whereMap interface{}, field ...string) (err error) { func (cont *FamilyMembers) GetCont(whereMap interface{}, field ...string) (err error) {
gormDb := overall.CONSTANT_DB_HR.Model(&cont) gormDb := overall.CONSTANT_DB_HR.Model(&cont)
if len(field) > 0 { if len(field) > 0 {

8
models/inside_work_history.go → models/modelshr/inside_work_history.go

@ -1,11 +1,11 @@
package models package modelshr
import ( import (
"key_performance_indicators/overall" "key_performance_indicators/overall"
"strings" "strings"
) )
//集团内部工作经历 // 集团内部工作经历
type InsideWorkHistory struct { type InsideWorkHistory struct {
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` 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:员工识别符"` 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" return "inside_work_history"
} }
//编辑集团内部工作经历内容 // 编辑集团内部工作经历内容
func (cont *InsideWorkHistory) EditCont(whereMap map[string]interface{}, saveData map[string]interface{}) (err error) { 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 err = overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Updates(saveData).Error
return return
} }
//获取详细内容 // 获取详细内容
func (cont *InsideWorkHistory) GetCont(whereMap interface{}, field ...string) (err error) { func (cont *InsideWorkHistory) GetCont(whereMap interface{}, field ...string) (err error) {
gormDb := overall.CONSTANT_DB_HR.Model(&cont) gormDb := overall.CONSTANT_DB_HR.Model(&cont)
if len(field) > 0 { if len(field) > 0 {

4
models/inside_work_view.go → models/modelshr/inside_work_view.go

@ -1,4 +1,4 @@
package models package modelshr
import ( import (
"key_performance_indicators/overall" "key_performance_indicators/overall"
@ -26,7 +26,7 @@ func (InsideWorkView *InsideWorkView) TableName() string {
return "inside_work_view" return "inside_work_view"
} }
//获取详细内容 // 获取详细内容
func (cont *InsideWorkView) GetCont(whereMap interface{}, field ...string) (err error) { func (cont *InsideWorkView) GetCont(whereMap interface{}, field ...string) (err error) {
gormDb := overall.CONSTANT_DB_HR.Model(&cont) gormDb := overall.CONSTANT_DB_HR.Model(&cont)
if len(field) > 0 { if len(field) > 0 {

8
models/job_class.go → models/modelshr/job_class.go

@ -1,11 +1,11 @@
package models package modelshr
import ( import (
"key_performance_indicators/overall" "key_performance_indicators/overall"
"strings" "strings"
) )
//职务分类 // 职务分类
type JobClass struct { type JobClass struct {
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` 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:职务分类名称"` 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" return "job_class"
} }
//编辑职务分类内容 // 编辑职务分类内容
func (JobClass *JobClass) EiteJobClassCont(whereMap map[string]interface{}, saveData map[string]interface{}) (err error) { 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 err = overall.CONSTANT_DB_HR.Model(&JobClass).Where(whereMap).Updates(saveData).Error
return return
} }
//获取详细内容 // 获取详细内容
func (cont *JobClass) GetCont(whereMap interface{}, field ...string) (err error) { func (cont *JobClass) GetCont(whereMap interface{}, field ...string) (err error) {
gormDb := overall.CONSTANT_DB_HR.Model(&cont) gormDb := overall.CONSTANT_DB_HR.Model(&cont)
if len(field) > 0 { if len(field) > 0 {

8
models/kingdee_log.go → models/modelshr/kingdee_log.go

@ -1,11 +1,11 @@
package models package modelshr
import ( import (
"key_performance_indicators/overall" "key_performance_indicators/overall"
"strings" "strings"
) )
//金蝶对照记录 // 金蝶对照记录
type KingdeeLog struct { type KingdeeLog struct {
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` 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:工号"` 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" return "kingdee_log"
} }
//编辑职务分类内容 // 编辑职务分类内容
func (KingdeeLog *KingdeeLog) EidtCont(whereMap map[string]interface{}, saveData map[string]interface{}) (err error) { 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 err = overall.CONSTANT_DB_HR.Model(&KingdeeLog).Where(whereMap).Updates(saveData).Error
return return
} }
//获取详细内容 // 获取详细内容
func (cont *KingdeeLog) GetCont(whereMap interface{}, field ...string) (err error) { func (cont *KingdeeLog) GetCont(whereMap interface{}, field ...string) (err error) {
gormDb := overall.CONSTANT_DB_HR.Model(&cont) gormDb := overall.CONSTANT_DB_HR.Model(&cont)
if len(field) > 0 { if len(field) > 0 {

4
models/man_cont.go → models/modelshr/man_cont.go

@ -1,4 +1,4 @@
package models package modelshr
import ( import (
"key_performance_indicators/overall" "key_performance_indicators/overall"
@ -63,7 +63,7 @@ func (ManCont *ManCont) TableName() string {
return "man_cont" return "man_cont"
} }
//获取职务分类内容 // 获取职务分类内容
func (cont *ManCont) GetCont(whereMap interface{}, field ...string) (err error) { func (cont *ManCont) GetCont(whereMap interface{}, field ...string) (err error) {
gormDb := overall.CONSTANT_DB_HR.Model(&cont) gormDb := overall.CONSTANT_DB_HR.Model(&cont)
if len(field) > 0 { if len(field) > 0 {

6
models/org_cont_type.go → models/modelshr/org_cont_type.go

@ -1,11 +1,11 @@
package models package modelshr
import ( import (
"key_performance_indicators/overall" "key_performance_indicators/overall"
"strings" "strings"
) )
//职务信息及类别、等级视图 // 职务信息及类别、等级视图
type OrgContType struct { type OrgContType struct {
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` 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:行政编码"` 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" return "org_cont_type"
} }
//获取详细内容 // 获取详细内容
func (cont *OrgContType) GetCont(whereMap interface{}, field ...string) (err error) { func (cont *OrgContType) GetCont(whereMap interface{}, field ...string) (err error) {
gormDb := overall.CONSTANT_DB_HR.Model(&cont) gormDb := overall.CONSTANT_DB_HR.Model(&cont)
if len(field) > 0 { if len(field) > 0 {

8
models/personarchives.go → models/modelshr/personarchives.go

@ -1,11 +1,11 @@
package models package modelshr
import ( import (
"key_performance_indicators/overall" "key_performance_indicators/overall"
"strings" "strings"
) )
//员工档案(主) // 员工档案(主)
type PersonArchives struct { type PersonArchives struct {
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:ID"` 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:员工工号"` 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" return "person_archives"
} }
//编辑员工档案 // 编辑员工档案
func (PersonArchives *PersonArchives) EiteCont(whereMap interface{}, saveData interface{}) (err error) { func (PersonArchives *PersonArchives) EiteCont(whereMap interface{}, saveData interface{}) (err error) {
err = overall.CONSTANT_DB_HR.Model(&PersonArchives).Where(whereMap).Updates(saveData).Error err = overall.CONSTANT_DB_HR.Model(&PersonArchives).Where(whereMap).Updates(saveData).Error
return return
} }
//获取员工档案 // 获取员工档案
func (cont *PersonArchives) GetCont(whereMap interface{}, field ...string) (err error) { func (cont *PersonArchives) GetCont(whereMap interface{}, field ...string) (err error) {
gormDb := overall.CONSTANT_DB_HR.Model(&cont) gormDb := overall.CONSTANT_DB_HR.Model(&cont)
if len(field) > 0 { if len(field) > 0 {

8
models/personnel.go → models/modelshr/personnel.go

@ -1,11 +1,11 @@
package models package modelshr
import ( import (
"key_performance_indicators/overall" "key_performance_indicators/overall"
"strings" "strings"
) )
//员工档案(主) // 员工档案(主)
type Personnel struct { type Personnel struct {
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:ID"` 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:员工工号"` 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" return "personnel"
} }
//编辑员工档案 // 编辑员工档案
func (Personnel *Personnel) EiteCont(whereMap interface{}, saveData interface{}) (err error) { func (Personnel *Personnel) EiteCont(whereMap interface{}, saveData interface{}) (err error) {
err = overall.CONSTANT_DB_HR.Model(&Personnel).Where(whereMap).Updates(saveData).Error err = overall.CONSTANT_DB_HR.Model(&Personnel).Where(whereMap).Updates(saveData).Error
return return
} }
//获取员工档案 // 获取员工档案
func (cont *Personnel) GetCont(whereMap interface{}, field ...string) (err error) { func (cont *Personnel) GetCont(whereMap interface{}, field ...string) (err error) {
gormDb := overall.CONSTANT_DB_HR.Model(&cont) gormDb := overall.CONSTANT_DB_HR.Model(&cont)
if len(field) > 0 { if len(field) > 0 {

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" import "key_performance_indicators/overall"

6
models/personnel_content.go → models/modelshr/personnel_content.go

@ -1,4 +1,4 @@
package models package modelshr
import ( import (
"key_performance_indicators/overall" "key_performance_indicators/overall"
@ -48,13 +48,13 @@ func (PersonnelContent *PersonnelContent) TableName() string {
return "personnel_content" return "personnel_content"
} }
//编辑职务分类内容 // 编辑职务分类内容
func (PersonnelContent *PersonnelContent) EiteCont(whereMap interface{}, saveData interface{}) (err error) { func (PersonnelContent *PersonnelContent) EiteCont(whereMap interface{}, saveData interface{}) (err error) {
err = overall.CONSTANT_DB_HR.Model(&PersonnelContent).Where(whereMap).Updates(saveData).Error err = overall.CONSTANT_DB_HR.Model(&PersonnelContent).Where(whereMap).Updates(saveData).Error
return return
} }
//获取职务分类内容 // 获取职务分类内容
func (cont *PersonnelContent) GetCont(whereMap interface{}, field ...string) (err error) { func (cont *PersonnelContent) GetCont(whereMap interface{}, field ...string) (err error) {
gormDb := overall.CONSTANT_DB_HR.Model(&cont) gormDb := overall.CONSTANT_DB_HR.Model(&cont)
if len(field) > 0 { if len(field) > 0 {

6
models/personnel_education.go → models/modelshr/personnel_education.go

@ -1,4 +1,4 @@
package models package modelshr
import ( import (
"key_performance_indicators/overall" "key_performance_indicators/overall"
@ -29,13 +29,13 @@ func (PersonnelEducation *PersonnelEducation) TableName() string {
return "personnel_education" return "personnel_education"
} }
//编辑教育经历内容 // 编辑教育经历内容
func (PersonnelEducation *PersonnelEducation) EiteCont(whereMap interface{}, saveData interface{}) (err error) { func (PersonnelEducation *PersonnelEducation) EiteCont(whereMap interface{}, saveData interface{}) (err error) {
err = overall.CONSTANT_DB_HR.Model(&PersonnelEducation).Where(whereMap).Updates(saveData).Error err = overall.CONSTANT_DB_HR.Model(&PersonnelEducation).Where(whereMap).Updates(saveData).Error
return return
} }
//获取教育经历内容 // 获取教育经历内容
func (cont *PersonnelEducation) GetCont(whereMap interface{}, field ...string) (err error) { func (cont *PersonnelEducation) GetCont(whereMap interface{}, field ...string) (err error) {
gormDb := overall.CONSTANT_DB_HR.Model(&cont) gormDb := overall.CONSTANT_DB_HR.Model(&cont)
if len(field) > 0 { if len(field) > 0 {

10
models/position.go → models/modelshr/position.go

@ -1,11 +1,11 @@
package models package modelshr
import ( import (
"key_performance_indicators/overall" "key_performance_indicators/overall"
"strings" "strings"
) )
//职位(岗位) // 职位(岗位)
type Position struct { type Position struct {
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` 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:职位编码"` 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" return "position"
} }
//编辑职务分类内容 // 编辑职务分类内容
func (cont *Position) EiteCont(whereMap interface{}, saveData map[string]interface{}) (err error) { func (cont *Position) EiteCont(whereMap interface{}, saveData map[string]interface{}) (err error) {
err = overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Updates(saveData).Error err = overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Updates(saveData).Error
return return
} }
//获取行政组织内容 // 获取行政组织内容
func (cont *Position) GetCont(whereMap interface{}, field ...string) (err error) { func (cont *Position) GetCont(whereMap interface{}, field ...string) (err error) {
gormDb := overall.CONSTANT_DB_HR.Model(&cont) gormDb := overall.CONSTANT_DB_HR.Model(&cont)
if len(field) > 0 { if len(field) > 0 {
@ -45,7 +45,7 @@ func (cont *Position) GetCont(whereMap interface{}, field ...string) (err error)
return return
} }
//根据条件获取总数 // 根据条件获取总数
func (cont *Position) CountCont(whereMap interface{}) (countId int64) { func (cont *Position) CountCont(whereMap interface{}) (countId int64) {
overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Count(&countId) overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Count(&countId)
return return

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

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

4
models/post_duties_job.go → models/modelshr/post_duties_job.go

@ -1,4 +1,4 @@
package models package modelshr
import ( import (
"key_performance_indicators/overall" "key_performance_indicators/overall"
@ -31,7 +31,7 @@ func (PostDutiesJob *PostDutiesJob) TableName() string {
return "post_duties_job" return "post_duties_job"
} }
//获取详细内容 // 获取详细内容
func (cont *PostDutiesJob) GetCont(whereMap interface{}, field ...string) (err error) { func (cont *PostDutiesJob) GetCont(whereMap interface{}, field ...string) (err error) {
gormDb := overall.CONSTANT_DB_HR.Model(&cont) gormDb := overall.CONSTANT_DB_HR.Model(&cont)
if len(field) > 0 { if len(field) > 0 {

8
models/teamgroup.go → models/modelshr/teamgroup.go

@ -1,11 +1,11 @@
package models package modelshr
import ( import (
"key_performance_indicators/overall" "key_performance_indicators/overall"
"strings" "strings"
) )
//班组 // 班组
type TeamGroup struct { type TeamGroup struct {
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` 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:班组名称"` 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" return "teamgroup"
} }
//编辑班组内容 // 编辑班组内容
func (TeamGroup *TeamGroup) EiteTeamGroupCont(whereMap map[string]interface{}, saveData map[string]interface{}) (err error) { 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 err = overall.CONSTANT_DB_HR.Model(&TeamGroup).Where(whereMap).Updates(saveData).Error
return return
} }
//获取详细内容 // 获取详细内容
func (cont *TeamGroup) GetCont(whereMap interface{}, field ...string) (err error) { func (cont *TeamGroup) GetCont(whereMap interface{}, field ...string) (err error) {
gormDb := overall.CONSTANT_DB_HR.Model(&cont) gormDb := overall.CONSTANT_DB_HR.Model(&cont)
if len(field) > 0 { if len(field) > 0 {

82
models/modelshr/user_post_duties.go

@ -0,0 +1,82 @@
package modelshr
import (
"key_performance_indicators/overall"
"strings"
)
type UserPostDuties struct {
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:ID"`
Number string `json:"number" gorm:"column:number;type:varchar(30) unsigned;not null;comment:员工工号"`
Name string `json:"name" gorm:"column:name;type:varchar(255) unsigned;default:'';not null;comment:姓名"`
Icon string `json:"icon" gorm:"column:icon;type:varchar(255) unsigned;default:'';not null;comment:头像"`
Company int64 `json:"company" gorm:"column:company;type:bigint(20) unsigned;default:0;not null;comment:入职公司"`
MainDeparment int64 `json:"maindeparment" gorm:"column:maindeparment;type:bigint(20) unsigned;default:0;not null;comment:主部门"`
AdminOrg int64 `json:"adminorg" gorm:"column:admin_org;type:bigint(20) unsigned;default:0;not null;comment:所属行政组织"`
TeamId int64 `json:"teamid" gorm:"column:teamid;type:bigint(20) unsigned;default:0;not null;comment:班组"`
Position int64 `json:"position" gorm:"column:position;type:bigint(20) unsigned;default:0;not null;comment:职位"`
JobId int64 `json:"jobid" gorm:"column:job_id;type:bigint(20) unsigned;default:0;not null;comment:职务"`
JobLeve int64 `json:"jobleve" gorm:"column:job_leve;type:bigint(20) unsigned;default:0;not null;comment:职务等级"`
Wechat string `json:"wechat" gorm:"column:wechat;type:varchar(255) unsigned;default:'';not null;comment:微信UserId"`
WorkWechat string `json:"workwechat" gorm:"column:work_wechat;type:varchar(255) unsigned;default:'';not null;comment:企业微信UserId"`
Key int64 `json:"key" gorm:"column:key;type:bigint(50) unsigned;default:0;not null;comment:key"`
IsAdmin int `json:"isadmin" gorm:"column:is_admin;type:tinyint(1) unsigned;default:1;not null;comment:是否为管理员(1:不是;2:分公司;3:集团管理员;4:超级管`
Password string `json:"password" gorm:"column:password;type:varchar(255) unsigned;default:'';not null;comment:密码"`
Role string `json:"role" gorm:"column:role;type:longtext;comment:角色"`
SunMainDeparment int64 `json:"sunmaindeparment" gorm:"column:sun_main_deparment;type:bigint(20) unsigned;default:0;not null;comment:主部门"`
Mobilephone string `json:"mobilephone" gorm:"column:mobilephone;type:varchar(50) unsigned;default:'';not null;comment:手机号码"`
Gender int `json:"gender" gorm:"column:gender;type:tinyint(1) unsigned;default:1;not null;comment:性别(1:男性;2:女性;3:中性)"`
PostName string `json:"postname" gorm:"column:postname;type:varchar(255) unsigned;default:'';not null;comment:职位名称"`
PersonInCharge int `json:"personincharge" gorm:"column:leading_cadre;type:int(1) unsigned;default:2;not null;comment:是否为本部门负责人(1:是;2:否)"`
Superior int64 `json:"superior" gorm:"column:post_superior;type:bigint(20) unsigned;default:0;not null;comment:上级ID"`
MenuPermit string `json:"menupermit" gorm:"column:menu_permit;type:longtext;comment:菜单许可证"`
ButtonPermit string `json:"buttonpermit" gorm:"column:button_permit;type:longtext;comment:按钮许可"`
DutiesName string `json:"dutiesname" gorm:"column:duties_name;type:varchar(255) unsigned;default:'';not null;comment:职务名称"`
}
func (UserPostDuties *UserPostDuties) TableName() string {
return "user_post_duties"
}
// 编辑内容
func (cont *UserPostDuties) EiteCont(whereMap interface{}, saveData interface{}) (err error) {
err = overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Updates(saveData).Error
return
}
// 获取内容
func (cont *UserPostDuties) GetCont(whereMap interface{}, field ...string) (err error) {
gormDb := overall.CONSTANT_DB_HR.Model(&cont)
if len(field) > 0 {
fieldStr := strings.Join(field, ",")
gormDb = gormDb.Select(fieldStr)
}
gormDb = gormDb.Where(whereMap)
err = gormDb.First(&cont).Error
return
}
// 根据条件获取总数
func (cont *UserPostDuties) CountCont(whereMap interface{}) (countId int64) {
overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Count(&countId)
return
}
// 读取全部信息
func (cont *UserPostDuties) ContMap(whereMap interface{}, field ...string) (countAry []UserPostDuties, err error) {
gormDb := overall.CONSTANT_DB_HR.Model(&cont)
if len(field) > 0 {
fieldStr := strings.Join(field, ",")
gormDb = gormDb.Select(fieldStr)
}
err = gormDb.Where(whereMap).Find(&countAry).Error
return
}
// 删除内容
func (cont *UserPostDuties) DelCont(whereMap interface{}) (err error) {
err = overall.CONSTANT_DB_HR.Where(whereMap).Delete(&cont).Error
return
}

10
models/work_history.go → models/modelshr/work_history.go

@ -1,11 +1,11 @@
package models package modelshr
import ( import (
"key_performance_indicators/overall" "key_performance_indicators/overall"
"strings" "strings"
) )
//工作履历 // 工作履历
type WorkHistory struct { type WorkHistory struct {
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` 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:工号"` 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" return "work_history"
} }
//编辑职务分类内容 // 编辑职务分类内容
func (cont *WorkHistory) EiteCont(whereMap interface{}, saveData map[string]interface{}) (err error) { func (cont *WorkHistory) EiteCont(whereMap interface{}, saveData map[string]interface{}) (err error) {
err = overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Updates(saveData).Error err = overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Updates(saveData).Error
return return
} }
//获取行政组织内容 // 获取行政组织内容
func (cont *WorkHistory) GetCont(whereMap interface{}, field ...string) (err error) { func (cont *WorkHistory) GetCont(whereMap interface{}, field ...string) (err error) {
gormDb := overall.CONSTANT_DB_HR.Model(&cont) gormDb := overall.CONSTANT_DB_HR.Model(&cont)
if len(field) > 0 { if len(field) > 0 {
@ -44,7 +44,7 @@ func (cont *WorkHistory) GetCont(whereMap interface{}, field ...string) (err err
return return
} }
//根据条件获取总数 // 根据条件获取总数
func (cont *WorkHistory) CountCont(whereMap interface{}) (countId int64) { func (cont *WorkHistory) CountCont(whereMap interface{}) (countId int64) {
overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Count(&countId) overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Count(&countId)
return return

64
models/modelskpi/assesstarget.go

@ -0,0 +1,64 @@
package modelskpi
import (
"key_performance_indicators/overall"
"strings"
)
// 定性考核指标关系指定
type Assesstarget struct {
Id int64 `json:"id" gorm:"primaryKey;column:at_id;type:bigint(20) unsigned;not null;comment:Id;index"`
Group int64 `json:"group" gorm:"column:group;type:bigint(20) unsigned;default:0;not null;comment:集团ID"`
Departmentmap string `json:"departmentmap" gorm:"column:departmentmap;type:mediumtext unsigned;default:0;comment:部门ID"`
TargetId int64 `json:"targetid" gorm:"column:targetid;type:bigint(20) unsigned;default:0;not null;comment:指标"`
SunTargetId int64 `json:"suntargetid" gorm:"column:suntargetid;type:bigint(20) unsigned;default:0;not null;comment:子栏目ID"`
Content string `json:"content" gorm:"column:content;type:longtext;comment:描述"`
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"`
State int `json:"state" gorm:"column:state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"`
Dimension int64 `json:"dimension" gorm:"column:dimension;type:bigint(20) unsigned;default:0;not null;comment:维度"`
}
func (Assesstarget *Assesstarget) TableName() string {
return "assesstarget"
}
// 编辑内容
func (cont *Assesstarget) EiteCont(whereMap interface{}, saveData interface{}) (err error) {
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error
return
}
// 获取内容
func (cont *Assesstarget) GetCont(whereMap interface{}, field ...string) (err error) {
gormDb := overall.CONSTANT_DB_KPI.Model(&cont)
if len(field) > 0 {
fieldStr := strings.Join(field, ",")
gormDb = gormDb.Select(fieldStr)
}
gormDb = gormDb.Where(whereMap)
err = gormDb.First(&cont).Error
return
}
// 根据条件获取总数
func (cont *Assesstarget) CountCont(whereMap interface{}) (countId int64) {
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId)
return
}
// 读取全部信息
func (cont *Assesstarget) ContMap(whereMap interface{}, field ...string) (countAry []Assesstarget, err error) {
gormDb := overall.CONSTANT_DB_KPI.Model(&cont)
if len(field) > 0 {
fieldStr := strings.Join(field, ",")
gormDb = gormDb.Select(fieldStr)
}
err = gormDb.Where(whereMap).Find(&countAry).Error
return
}
// 删除内容
func (cont *Assesstarget) DelCont(whereMap interface{}) (err error) {
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error
return
}

65
models/modelskpi/depart_dime_post_weight.go

@ -0,0 +1,65 @@
package modelskpi
import (
"key_performance_indicators/overall"
"strings"
)
// 部门考核指标权重
type DepartDimePostWeight struct {
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"`
Type int64 `json:"type" gorm:"column:type;type:bigint(20) unsigned;default:0;not null;comment:1:定性考核;2:定量考核"`
Orgid int64 `json:"orgid" gorm:"column:orgid;type:bigint(20) unsigned;default:0;not null;comment:行政组织"`
Postid int64 `json:"postid" gorm:"column:postid;type:bigint(20) unsigned;default:0;not null;comment:岗位"`
Dimension int64 `json:"dimension" gorm:"column:dimension;type:bigint(20) unsigned;default:0;not null;comment:考核维度"`
Target int64 `json:"target" gorm:"column:target;type:bigint(20) unsigned;default:0;not null;comment:指标"`
Weight int64 `json:"weight" gorm:"column:weight;type:int(6) unsigned;default:0;not null;comment:权重"`
Addtime int64 `json:"addtime" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:添加时间"`
Hierarchy int64 `json:"hierarchy" gorm:"column:hierarchy;type:bigint(20) unsigned;default:0;not null;comment:维度;2:指标"`
Quote int64 `json:"quote" gorm:"column:is_quote;type:bigint(20) unsigned;default:0;not null;comment:1:不是引用;2:引用部门"`
}
func (DepartDimePostWeight *DepartDimePostWeight) TableName() string {
return "depart_dime_post_weight"
}
// 编辑内容
func (cont *DepartDimePostWeight) EiteCont(whereMap interface{}, saveData interface{}) (err error) {
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error
return
}
// 获取内容
func (cont *DepartDimePostWeight) GetCont(whereMap interface{}, field ...string) (err error) {
gormDb := overall.CONSTANT_DB_KPI.Model(&cont)
if len(field) > 0 {
fieldStr := strings.Join(field, ",")
gormDb = gormDb.Select(fieldStr)
}
gormDb = gormDb.Where(whereMap)
err = gormDb.First(&cont).Error
return
}
// 根据条件获取总数
func (cont *DepartDimePostWeight) CountCont(whereMap interface{}) (countId int64) {
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId)
return
}
// 读取全部信息
func (cont *DepartDimePostWeight) ContMap(whereMap interface{}, field ...string) (countAry []DepartDimePostWeight, err error) {
gormDb := overall.CONSTANT_DB_KPI.Model(&cont)
if len(field) > 0 {
fieldStr := strings.Join(field, ",")
gormDb = gormDb.Select(fieldStr)
}
err = gormDb.Where(whereMap).Find(&countAry).Error
return
}
// 删除内容
func (cont *DepartDimePostWeight) DelCont(whereMap interface{}) (err error) {
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error
return
}

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
}

67
models/modelskpi/position_plan_version.go

@ -0,0 +1,67 @@
package modelskpi
import (
"key_performance_indicators/overall"
"strings"
)
// 岗位考核方案版本管理
type PositionPlanVersio struct {
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"`
Group int64 `json:"group" gorm:"column:group;type:bigint(20) unsigned;default:0;not null;comment:归属集团"`
Department int64 `json:"department" gorm:"column:department;type:bigint(20) unsigned;default:0;comment:归属部门"`
OrgId int64 `json:"orgid" gorm:"column:orgid;type:bigint(20) unsigned;default:0;comment:行政组织"`
Position int64 `json:"position" gorm:"column:position;type:bigint(20) unsigned;default:0;comment:归属岗位"`
Key string `json:"key" gorm:"column:key;type:varchar(200) unsigned;default:0;not null;comment:编码"`
Versio string `json:"versio" gorm:"column:version;type:varchar(20) unsigned;default:0;not null;comment:版本号"`
Year int64 `json:"year" gorm:"column:years;type:int(5) unsigned;default:0;not null;comment:年度"`
State int `json:"state" gorm:"column:state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"`
AddTime int64 `json:"addtime" gorm:"column:addtime;type:bigint(20) unsigned;default:0;not null;comment:创建时间"`
EiteTime int64 `json:"eitetime" gorm:"column:eitetime;type:bigint(20) unsigned;default:0;not null;comment:修改时间"`
Content string `json:"content" gorm:"column:content;type:longtext;comment:版本内容"`
}
func (PositionPlanVersio *PositionPlanVersio) TableName() string {
return "position_plan_version"
}
// 编辑内容
func (cont *PositionPlanVersio) EiteCont(whereMap interface{}, saveData interface{}) (err error) {
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error
return
}
// 获取内容
func (cont *PositionPlanVersio) GetCont(whereMap interface{}, field ...string) (err error) {
gormDb := overall.CONSTANT_DB_KPI.Model(&cont)
if len(field) > 0 {
fieldStr := strings.Join(field, ",")
gormDb = gormDb.Select(fieldStr)
}
gormDb = gormDb.Where(whereMap)
err = gormDb.First(&cont).Error
return
}
// 根据条件获取总数
func (cont *PositionPlanVersio) CountCont(whereMap interface{}) (countId int64) {
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId)
return
}
// 读取全部信息
func (cont *PositionPlanVersio) ContMap(whereMap interface{}, field ...string) (countAry []PositionPlanVersio, err error) {
gormDb := overall.CONSTANT_DB_KPI.Model(&cont)
if len(field) > 0 {
fieldStr := strings.Join(field, ",")
gormDb = gormDb.Select(fieldStr)
}
err = gormDb.Where(whereMap).Find(&countAry).Error
return
}
// 删除内容
func (cont *PositionPlanVersio) DelCont(whereMap interface{}) (err error) {
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error
return
}

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 int `json:"scoringmethod" gorm:"column:scoring_method;type:int(1) unsigned;default:0;not null;comment:计分方式(1:自动;2:手动)"`
VisibleRange string `json:"visiblerange" gorm:"column:visible_range;type:text ;default:'';comment:可见范围"`
VisibleGroup string `json:"visiblegroup" gorm:"column:visible_group;type:text ;default:'';comment:可见范围(集团)"`
}
func (PostTarget *PostTarget) TableName() string {
return "post_target"
}
// 编辑内容
func (cont *PostTarget) EiteCont(whereMap interface{}, saveData interface{}) (err error) {
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error
return
}
// 获取内容
func (cont *PostTarget) GetCont(whereMap interface{}, field ...string) (err error) {
gormDb := overall.CONSTANT_DB_KPI.Model(&cont)
if len(field) > 0 {
fieldStr := strings.Join(field, ",")
gormDb = gormDb.Select(fieldStr)
}
gormDb = gormDb.Where(whereMap)
err = gormDb.First(&cont).Error
return
}
// 根据条件获取总数
func (cont *PostTarget) CountCont(whereMap interface{}) (countId int64) {
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId)
return
}
// 读取全部信息
func (cont *PostTarget) ContMap(whereMap interface{}, field ...string) (countAry []PostTarget, err error) {
gormDb := overall.CONSTANT_DB_KPI.Model(&cont)
if len(field) > 0 {
fieldStr := strings.Join(field, ",")
gormDb = gormDb.Select(fieldStr)
}
err = gormDb.Where(whereMap).Find(&countAry).Error
return
}
// 删除内容
func (cont *PostTarget) DelCont(whereMap interface{}) (err error) {
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error
return
}

77
models/modelskpi/post_target_details.go

@ -0,0 +1,77 @@
package modelskpi
import (
"key_performance_indicators/overall"
"strings"
)
// 指标细则
type PostTargetDetails struct {
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"`
Title string `json:"title" gorm:"column:title;type:text;comment:指标细则"`
Content string `json:"content" gorm:"column:content;type:text;comment:指标说明"`
ParentId int64 `json:"parentid" gorm:"column:parentid;type:bigint(20) unsigned;default:0;not null;comment:归属指标栏目"`
ParentIdSun int64 `json:"parentidsun" gorm:"column:parentid_sun;type:bigint(20) unsigned;default:0;not null;comment:归属指标子栏目"`
State int `json:"state" gorm:"column:state;type:tinyint(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"`
AddTime int64 `json:"addtime" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:制定时间"`
MinScore int64 `json:"minscore" gorm:"column:min_score;type:bigint(20) unsigned;default:0;not null;comment:最小分*100保存"`
MaxScore int64 `json:"maxscore" gorm:"column:max_score;type:bigint(20) unsigned;default:0;not null;comment:最大分*100保存"`
Company string `json:"company" gorm:"column:company;type:varchar(20) unsigned;default:0;not null;comment:单位"`
AddReduce int `json:"addreduce" gorm:"column:add_reduce;type:int(1) unsigned;default:1;not null;comment:1:减少;2:增加;3:无属性,现场确认加或减"`
CensorType string `json:"censortype" gorm:"column:censor_type;type:text;comment:检查方式"`
CensorCont string `json:"censorcont" gorm:"column:censor_cont;type:longtext;comment:检查依据"`
CensorRate int `json:"censorrate" gorm:"column:censor_rate;type:int(5) unsigned;default:1;not null;comment:检查频次"`
Cycles int `json:"cycle" gorm:"column:cycle;type:tinyint(1) unsigned;default:1;not null;comment:1:班;2:天;3:周;4:月;5:季度;6:年"`
CycleAttres int `json:"cycleattr" gorm:"column:cycleattr;type:int(9) unsigned;default:1;not null;comment:辅助计数"`
Paretment int64 `json:"paretment" gorm:"column:paretment;type:bigint(20);comment:接受考核的部门"`
ParetmentPost string `json:"paretmentpost" gorm:"column:paretment_post;type:longtext;comment:接受考核的部门岗位"`
Reportary string `json:"reportary" gorm:"column:reportary;type:longtext;comment:提报人"`
Punishmode int `json:"punishmode" gorm:"column:punishmode;type:tinyint(1) unsigned;default:1;not null;comment:处罚方式 1:扣分;2:现金处罚;3:扣分加现金"`
Maxmoney int64 `json:"maxmoney" gorm:"column:maxmoney;type:bigint(20) unsigned;default:0;not null;comment:最高罚款"`
Minmoney int64 `json:"minmoney" gorm:"column:minmoney;type:bigint(20) unsigned;default:0;not null;comment:最低罚款"`
}
func (PostTargetDetails *PostTargetDetails) TableName() string {
return "post_target_details"
}
// 编辑内容
func (cont *PostTargetDetails) EiteCont(whereMap interface{}, saveData interface{}) (err error) {
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error
return
}
// 获取内容
func (cont *PostTargetDetails) GetCont(whereMap interface{}, field ...string) (err error) {
gormDb := overall.CONSTANT_DB_KPI.Model(&cont)
if len(field) > 0 {
fieldStr := strings.Join(field, ",")
gormDb = gormDb.Select(fieldStr)
}
gormDb = gormDb.Where(whereMap)
err = gormDb.First(&cont).Error
return
}
// 根据条件获取总数
func (cont *PostTargetDetails) CountCont(whereMap interface{}) (countId int64) {
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId)
return
}
// 读取全部信息
func (cont *PostTargetDetails) ContMap(whereMap interface{}, field ...string) (countAry []PostTargetDetails, err error) {
gormDb := overall.CONSTANT_DB_KPI.Model(&cont)
if len(field) > 0 {
fieldStr := strings.Join(field, ",")
gormDb = gormDb.Select(fieldStr)
}
err = gormDb.Where(whereMap).Order("sort ASC").Find(&countAry).Error
return
}
// 删除内容
func (cont *PostTargetDetails) DelCont(whereMap interface{}) (err error) {
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error
return
}

76
models/modelskpi/qualitative_evaluation_scheme.go

@ -0,0 +1,76 @@
package modelskpi
import (
"key_performance_indicators/overall"
"strings"
)
// 岗位评估方案
type QualitativeEvaluationScheme struct {
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"`
VersionNumber string `json:"versionnumber" gorm:"column:version_number;type:varchar(255) unsigned;not null;comment:版本编号"`
CompanyId int64 `json:"companyid" gorm:"column:company_id;type:bigint(20) unsigned;default:0;not null;comment:归属公司"`
DepartmentId int64 `json:"departmentid" gorm:"column:department_id;type:bigint(20) unsigned;default:0;not null;comment:归属部门"`
OrgId int64 `json:"orgid" gorm:"column:org_id;type:bigint(20) unsigned;default:0;not null;comment:归属行政组织"`
PostId int64 `json:"postid" gorm:"column:post_id;type:bigint(20) unsigned;default:0;not null;comment:归属岗位"`
Title string `json:"title" gorm:"column:title;type:varchar(255) ;default:'';comment:考核项名称"`
DimensionId int64 `json:"dimensionid" gorm:"column:dimension_id;type:bigint(20) unsigned;default:0;not null;comment:维度"`
TargetId int64 `json:"targetid" gorm:"column:target_id;type:bigint(20) unsigned;default:0;not null;comment:指标"`
SonTargetId int64 `json:"sontargetid" gorm:"column:son_target_id;type:bigint(20) unsigned;default:0;not null;comment:子栏目"`
DetailsId int64 `json:"detailsid" gorm:"column:details_id;type:bigint(20) unsigned;default:0;not null;comment:细则"`
Attribute int `json:"attribute" gorm:"column:attribute;type:tinyint(1) unsigned;default:1;not null;comment:属性 1:定性考核;2:定量考核"`
MinScore int64 `json:"minscore" gorm:"column:min_score;type:bigint(20) unsigned;default:0;not null;comment:最小分*100保存"`
MaxScore int64 `json:"maxscore" gorm:"column:max_score;type:bigint(20) unsigned;default:0;not null;comment:最大分*100保存"`
ScoringMethod int `json:"scoringmethod" gorm:"column:scoring_method;type:tinyint(1) unsigned;default:1;not null;comment:计分方式(1:自动;2:手动)"`
State int `json:"state" gorm:"column:state;type:tinyint(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"`
Addtime int64 `json:"addtime" gorm:"column:addtime;type:bigint(20) unsigned;default:0;not null;comment:添加时间"`
Eitetime int64 `json:"eitetime" gorm:"column:eitetime;type:bigint(20) unsigned;default:0;not null;comment:编辑时间"`
CensorType string `json:"censortype" gorm:"column:censor_type;type:tinytext;comment:检查方式(1:现场检查;2:资料检查;3:事件触发)"`
Source int `json:"source" gorm:"column:source;type:tinyint(1) unsigned;default:1;not null;comment:来源(1:岗位;2:部门引用)"`
RunState int `json:"run_state" gorm:"column:run_state;type:tinyint(1) unsigned;default:1;not null;comment:运行状态(1:启用;2:禁用;3:观察)"`
}
func (QualitativeEvaluationScheme *QualitativeEvaluationScheme) TableName() string {
return "qualitative_evaluation_scheme"
}
// 编辑内容
func (cont *QualitativeEvaluationScheme) EiteCont(whereMap interface{}, saveData interface{}) (err error) {
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error
return
}
// 获取内容
func (cont *QualitativeEvaluationScheme) GetCont(whereMap interface{}, field ...string) (err error) {
gormDb := overall.CONSTANT_DB_KPI.Model(&cont)
if len(field) > 0 {
fieldStr := strings.Join(field, ",")
gormDb = gormDb.Select(fieldStr)
}
gormDb = gormDb.Where(whereMap)
err = gormDb.First(&cont).Error
return
}
// 根据条件获取总数
func (cont *QualitativeEvaluationScheme) CountCont(whereMap interface{}) (countId int64) {
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId)
return
}
// 读取全部信息
func (cont *QualitativeEvaluationScheme) ContMap(whereMap interface{}, field ...string) (countAry []QualitativeEvaluationScheme, err error) {
gormDb := overall.CONSTANT_DB_KPI.Model(&cont)
if len(field) > 0 {
fieldStr := strings.Join(field, ",")
gormDb = gormDb.Select(fieldStr)
}
err = gormDb.Where(whereMap).Find(&countAry).Error
return
}
// 删除内容
func (cont *QualitativeEvaluationScheme) DelCont(whereMap interface{}) (err error) {
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error
return
}

75
models/modelskpi/qualitative_target.go

@ -0,0 +1,75 @@
package modelskpi
import (
"key_performance_indicators/overall"
"strings"
"time"
)
// 定性测评指标子栏目
type QualitativeTarget struct {
Id int64 `json:"id" gorm:"primaryKey;column:q_id;type:bigint(20) unsigned;not null;comment:Id;index"`
Title string `json:"title" gorm:"column:q_title;type:varchar(255);comment:指标子栏目名称"`
ParentId int64 `json:"parentid" gorm:"column:q_parent_id;type:bigint(20) unsigned;default:0;not null;comment:归属指标"`
State int `json:"state" gorm:"column:q_state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"`
AddTime int64 `json:"addTime" gorm:"column:q_time;type:bigint(20) unsigned;default:0;not null;comment:制定时间"`
Depart string `json:"depart" gorm:"column:q_depart;type:mediumtext;comment:关联部门"`
}
func (QualitativeTarget *QualitativeTarget) TableName() string {
return "qualitative_target"
}
// 编辑内容
func (cont *QualitativeTarget) EiteCont(whereMap interface{}, saveData interface{}) (err error) {
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error
return
}
// 获取内容
func (cont *QualitativeTarget) GetCont(whereMap interface{}, field ...string) (err error) {
gormDb := overall.CONSTANT_DB_KPI.Model(&cont)
if len(field) > 0 {
fieldStr := strings.Join(field, ",")
gormDb = gormDb.Select(fieldStr)
}
gormDb = gormDb.Where(whereMap)
err = gormDb.First(&cont).Error
return
}
// 根据条件获取总数
func (cont *QualitativeTarget) CountCont(whereMap interface{}) (countId int64) {
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId)
return
}
// 读取全部信息
func (cont *QualitativeTarget) ContMap(whereMap interface{}, field ...string) (countAry []QualitativeTarget, err error) {
gormDb := overall.CONSTANT_DB_KPI.Model(&cont)
if len(field) > 0 {
fieldStr := strings.Join(field, ",")
gormDb = gormDb.Select(fieldStr)
}
err = gormDb.Where(whereMap).Order("sort ASC").Find(&countAry).Error
return
}
// 删除内容
func (cont *QualitativeTarget) DelCont(whereMap interface{}) (err error) {
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error
return
}
// 判断子目标是否存在
func (cont *QualitativeTarget) JudgeIsTrue(whereMap interface{}, addCont QualitativeTarget) (err error) {
err = cont.GetCont(whereMap)
if err != nil {
err = overall.CONSTANT_DB_KPI.Create(&addCont).Error
} else {
if cont.State != 1 {
err = cont.EiteCont(map[string]interface{}{"`q_id`": cont.Id}, map[string]interface{}{"`q_state`": 1, "`q_time`": time.Now().Unix()})
}
}
return nil
}

70
models/modelskpi/son_target_father.go

@ -0,0 +1,70 @@
package modelskpi
import (
"key_performance_indicators/overall"
"strings"
)
// 子栏目关联指标视图
type SonTargetFather struct {
Id int64 `json:"id" gorm:"primaryKey;column:q_id;type:bigint(20) unsigned;not null;comment:Id;index"`
Title string `json:"title" gorm:"column:q_title;type:varchar(255);comment:指标子栏目名称"`
ParentId int64 `json:"parentid" gorm:"column:q_parent_id;type:bigint(20) unsigned;default:0;not null;comment:归属指标"`
State int `json:"state" gorm:"column:q_state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"`
AddTime int64 `json:"addTime" gorm:"column:q_time;type:bigint(20) unsigned;default:0;not null;comment:制定时间"`
Depart string `json:"depart" gorm:"column:q_depart;type:mediumtext;comment:关联部门"`
EtTitle string `json:"ettitle" gorm:"column:et_title;type:varchar(255);comment:指标名称"`
Type int `json:"type" gorm:"column:et_type;type:int(1) unsigned;default:1;not null;comment:1:定性考核;2:定量考核"`
Dimension int64 `json:"dimension" gorm:"column:et_dimension;type:bigint(20) unsigned;default:0;not null;comment:维度"`
Key int64 `json:"key" gorm:"column:et_key;type:bigint(20) unsigned;default:0;not null;comment:UUID"`
Uniteing string `json:"unites" gorm:"column:et_unit;type:varchar(255);comment:计量单位"`
Cycles int `json:"cycle" gorm:"column:et_cycle;type:tinyint(1) unsigned;default:1;not null;comment:1:班;2:天;3:周;4:月;5:季度;6:年"`
CycleAttres int `json:"cycleattr" gorm:"column:et_cycleattr;type:int(9) unsigned;default:1;not null;comment:辅助计数"`
ScoringMethod int `json:"scoringmethod" gorm:"column:et_scoring_method;type:tinyint(1) unsigned;default:1;not null;comment:计分方式(1:自动;2:手动)"`
}
func (SonTargetFather *SonTargetFather) TableName() string {
return "son_target_father"
}
// 编辑内容
func (cont *SonTargetFather) EiteCont(whereMap interface{}, saveData interface{}) (err error) {
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error
return
}
// 获取内容
func (cont *SonTargetFather) GetCont(whereMap interface{}, field ...string) (err error) {
gormDb := overall.CONSTANT_DB_KPI.Model(&cont)
if len(field) > 0 {
fieldStr := strings.Join(field, ",")
gormDb = gormDb.Select(fieldStr)
}
gormDb = gormDb.Where(whereMap)
err = gormDb.First(&cont).Error
return
}
// 根据条件获取总数
func (cont *SonTargetFather) CountCont(whereMap interface{}) (countId int64) {
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId)
return
}
// 读取全部信息
func (cont *SonTargetFather) ContMap(whereMap interface{}, field ...string) (countAry []SonTargetFather, err error) {
gormDb := overall.CONSTANT_DB_KPI.Model(&cont)
if len(field) > 0 {
fieldStr := strings.Join(field, ",")
gormDb = gormDb.Select(fieldStr)
}
err = gormDb.Where(whereMap).Order("sort ASC").Find(&countAry).Error
return
}
// 删除内容
func (cont *SonTargetFather) DelCont(whereMap interface{}) (err error) {
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error
return
}

67
models/modelskpi/target_department.go

@ -0,0 +1,67 @@
package modelskpi
import (
"key_performance_indicators/overall"
"strings"
)
// 指标、栏目、细则关联部门
type TargetDepartment struct {
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id"`
Dimension int64 `json:"dimension" gorm:"column:dimension_id;type:bigint(20) unsigned;default:0;not null;comment:维度"`
TargetId int64 `json:"targetid" gorm:"column:target_id;type:bigint(20) unsigned;default:0;not null;comment:指标ID"`
TargetSunId int64 `json:"targetsunid" gorm:"column:target_sun_id;type:bigint(20) unsigned;default:0;not null;comment:子目标"`
TargetBylaws int64 `json:"targetbylaws" gorm:"column:target_bylaws;type:bigint(20) unsigned;default:0;not null;comment:指标细则"`
Type int `json:"type" gorm:"column:type;type:tinyint(1) unsigned;default:1;not null;comment:类型(1:指标;2:子目标;3:细则)"`
DepartmentId int64 `json:"departmentid" gorm:"column:department_id;type:bigint(20) unsigned;default:0;not null;comment:部门ID"`
PostId int64 `json:"postid" gorm:"column:post_id;type:bigint(20) unsigned;default:0;not null;comment:岗位ID"`
State int `json:"state" gorm:"column:state;type:tinyint(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"`
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:写入时间"`
Class int `json:"class" gorm:"column:class;type:tinyint(1) unsigned;default:1;not null;comment:1:定性考核;2:定量考核"`
Level int `json:"level" gorm:"column:level;type:tinyint(1) unsigned;default:1;not null;comment:级别(1:部门级;2:岗位级)"`
}
func (TargetDepartment *TargetDepartment) TableName() string {
return "target_department"
}
// 编辑内容
func (cont *TargetDepartment) EiteCont(whereMap interface{}, saveData interface{}) (err error) {
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error
return
}
// 获取内容
func (cont *TargetDepartment) GetCont(whereMap interface{}, field ...string) (err error) {
gormDb := overall.CONSTANT_DB_KPI.Model(&cont)
if len(field) > 0 {
fieldStr := strings.Join(field, ",")
gormDb = gormDb.Select(fieldStr)
}
gormDb = gormDb.Where(whereMap)
err = gormDb.First(&cont).Error
return
}
// 根据条件获取总数
func (cont *TargetDepartment) CountCont(whereMap interface{}) (countId int64) {
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId)
return
}
// 读取全部信息
func (cont *TargetDepartment) ContMap(whereMap interface{}, field ...string) (countAry []TargetDepartment, err error) {
gormDb := overall.CONSTANT_DB_KPI.Model(&cont)
if len(field) > 0 {
fieldStr := strings.Join(field, ",")
gormDb = gormDb.Select(fieldStr)
}
err = gormDb.Where(whereMap).Order("sort ASC").Find(&countAry).Error
return
}
// 删除内容
func (cont *TargetDepartment) DelCont(whereMap interface{}) (err error) {
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error
return
}

69
models/modelskpi/target_report.go

@ -0,0 +1,69 @@
package modelskpi
import (
"key_performance_indicators/overall"
"strings"
)
// 指标部门、岗位上报人对照表
type TargetReport struct {
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id"`
Dimension int64 `json:"dimension" gorm:"column:dimension_id;type:bigint(20) unsigned;default:0;not null;comment:维度"`
TargetId int64 `json:"targetid" gorm:"column:target_id;type:bigint(20) unsigned;default:0;not null;comment:指标ID"`
TargetSunId int64 `json:"targetsunid" gorm:"column:target_sun_id;type:bigint(20) unsigned;default:0;not null;comment:子目标"`
TargetBylaws int64 `json:"targetbylaws" gorm:"column:target_bylaws;type:bigint(20) unsigned;default:0;not null;comment:指标细则"`
DepartmentId int64 `json:"departmentid" gorm:"column:department_id;type:bigint(20) unsigned;default:0;not null;comment:部门ID"`
PostId int64 `json:"postid" gorm:"column:post_id;type:bigint(20) unsigned;default:0;not null;comment:岗位ID"`
Type int `json:"type" gorm:"column:type;type:tinyint(1) unsigned;default:1;not null;comment:类型(1:公司级;2:部门级)"`
State int `json:"state" gorm:"column:state;type:tinyint(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"`
ReportPerson int64 `json:"reportperson" gorm:"column:man_key;type:bigint(20) unsigned;default:0;not null;comment:上报人"`
ManDepartment int64 `json:"mandepartment" gorm:"column:man_department;type:bigint(20) unsigned;default:0;not null;comment:提报人所在部门"`
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:写入时间"`
Class int `json:"class" gorm:"column:class;type:tinyint(1) unsigned;default:1;not null;comment:1:定性考核;2:定量考核"`
Level int `json:"level" gorm:"column:type_level;type:tinyint(1) unsigned;default:1;not null;comment:类型(1:指标;2:子目标;3:细则)"`
}
func (TargetReport *TargetReport) TableName() string {
return "target_report"
}
// 编辑内容
func (cont *TargetReport) EiteCont(whereMap interface{}, saveData interface{}) (err error) {
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error
return
}
// 获取内容
func (cont *TargetReport) GetCont(whereMap interface{}, field ...string) (err error) {
gormDb := overall.CONSTANT_DB_KPI.Model(&cont)
if len(field) > 0 {
fieldStr := strings.Join(field, ",")
gormDb = gormDb.Select(fieldStr)
}
gormDb = gormDb.Where(whereMap)
err = gormDb.First(&cont).Error
return
}
// 根据条件获取总数
func (cont *TargetReport) CountCont(whereMap interface{}) (countId int64) {
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId)
return
}
// 读取全部信息
func (cont *TargetReport) ContMap(whereMap interface{}, field ...string) (countAry []TargetReport, err error) {
gormDb := overall.CONSTANT_DB_KPI.Model(&cont)
if len(field) > 0 {
fieldStr := strings.Join(field, ",")
gormDb = gormDb.Select(fieldStr)
}
err = gormDb.Where(whereMap).Order("sort ASC").Find(&countAry).Error
return
}
// 删除内容
func (cont *TargetReport) DelCont(whereMap interface{}) (err error) {
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error
return
}

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

@ -1,4 +1,4 @@
package models package modelsschool
//菜单功能 //菜单功能
type MenuOperation struct { 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" import "key_performance_indicators/overall"

10
models/system_nenu.go → models/modelsschool/system_nenu.go

@ -1,11 +1,11 @@
package models package modelsschool
import ( import (
"key_performance_indicators/overall" "key_performance_indicators/overall"
"strings" "strings"
) )
//菜单 // 菜单
type SystemMenu struct { type SystemMenu struct {
Id int64 `json:"id" gorm:"primaryKey;column:m_id;type:bigint(20) unsigned;not null;comment:ID"` 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:菜单名称"` 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" return "system_menu"
} }
//菜单管理 // 菜单管理
type SystemMenuOperation struct { type SystemMenuOperation struct {
SystemMenu SystemMenu
MenuPermit []MenuOperation `json:"menupermit"` MenuPermit []MenuOperation `json:"menupermit"`
} }
//根据条件获取总数 // 根据条件获取总数
func (cont *SystemMenu) CountCont(whereMap map[string]interface{}) (countId int64) { func (cont *SystemMenu) CountCont(whereMap map[string]interface{}) (countId int64) {
overall.CONSTANT_DB_Master.Model(&cont).Where(whereMap).Count(&countId) overall.CONSTANT_DB_Master.Model(&cont).Where(whereMap).Count(&countId)
return return
} }
//获取行政组织内容 // 获取行政组织内容
func (cont *SystemMenu) GetCont(whereMap map[string]interface{}, field ...string) (err error) { func (cont *SystemMenu) GetCont(whereMap map[string]interface{}, field ...string) (err error) {
gormDb := overall.CONSTANT_DB_Master.Model(&cont) gormDb := overall.CONSTANT_DB_Master.Model(&cont)
if len(field) > 0 { if len(field) > 0 {

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

@ -1,4 +1,4 @@
package models package modelsschool
import "key_performance_indicators/overall" 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" 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" import "key_performance_indicators/overall"

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

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

15
overall/publicmethod/formatOutput.go

@ -4,14 +4,14 @@ import (
"encoding/json" "encoding/json"
"errors" "errors"
"fmt" "fmt"
"key_performance_indicators/models" "key_performance_indicators/models/modelshr"
"key_performance_indicators/overall" "key_performance_indicators/overall"
"net/http" "net/http"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
//格式化输出 // 格式化输出
func Result(code int, data interface{}, c *gin.Context, msgAry ...string) { func Result(code int, data interface{}, c *gin.Context, msgAry ...string) {
var msg string var msg string
if _, isTrue := ErrorCodeMsg[code]; isTrue { if _, isTrue := ErrorCodeMsg[code]; isTrue {
@ -19,7 +19,12 @@ func Result(code int, data interface{}, c *gin.Context, msgAry ...string) {
} }
if len(msgAry) > 0 { if len(msgAry) > 0 {
for _, v := range msgAry { for _, v := range msgAry {
msg = fmt.Sprintf("%v。%v", msg, v) if msg == "" {
msg = fmt.Sprintf("%v", v)
} else {
msg = fmt.Sprintf("%v。%v", msg, v)
}
} }
} }
c.JSON(http.StatusOK, Reply{code, msg, data}) //输出json格式数据 c.JSON(http.StatusOK, Reply{code, msg, data}) //输出json格式数据
@ -45,8 +50,8 @@ func ResultList(code, page, pageSize int, total, count int64, data interface{},
return 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) context, exi := c.Get(overall.MyContJwt)
if exi != true { if exi != true {
err = errors.New("对不起!你没有该功能的操作权限!1") err = errors.New("对不起!你没有该功能的操作权限!1")

166
overall/publicmethod/technique.go

@ -9,7 +9,7 @@ import (
"errors" "errors"
"fmt" "fmt"
"key_performance_indicators/middleware/grocerystore" "key_performance_indicators/middleware/grocerystore"
"key_performance_indicators/models" "key_performance_indicators/models/modelshr"
"key_performance_indicators/overall" "key_performance_indicators/overall"
"math" "math"
"math/big" "math/big"
@ -21,8 +21,8 @@ import (
"gorm.io/gorm" "gorm.io/gorm"
) )
//全局函数处理 // 全局函数处理
//编号,纯数字 // 编号,纯数字
func TableNumber(class ...string) (number int64) { func TableNumber(class ...string) (number int64) {
result, _ := rand.Int(rand.Reader, big.NewInt(8999)) result, _ := rand.Int(rand.Reader, big.NewInt(8999))
numberTeam := result.Int64() + 1000 numberTeam := result.Int64() + 1000
@ -36,7 +36,7 @@ func TableNumber(class ...string) (number int64) {
return return
} }
//初始化map(泛型) // 初始化map(泛型)
func MapOut[T GenericityVariable]() (data map[T]interface{}) { func MapOut[T GenericityVariable]() (data map[T]interface{}) {
data = make(map[T]interface{}) //必可不少,分配内存 data = make(map[T]interface{}) //必可不少,分配内存
return data return data
@ -118,7 +118,7 @@ func DateToTimeStamp(dataStr string) (timeStamp int64, isTrue bool) {
return return
} }
//数据库查询翻页 // 数据库查询翻页
func LimitPage(page, pageSize int) (offSet int) { func LimitPage(page, pageSize int) (offSet int) {
if page < 1 { if page < 1 {
page = 1 page = 1
@ -130,7 +130,7 @@ func LimitPage(page, pageSize int) (offSet int) {
return return
} }
//中文首字母大写 // 中文首字母大写
func ChineseFirstWordCapitalize(wordStr string) (firstWord string) { func ChineseFirstWordCapitalize(wordStr string) (firstWord string) {
pinYinSub := pinyin.NewArgs() pinYinSub := pinyin.NewArgs()
rows := pinyin.Pinyin(wordStr, pinYinSub) rows := pinyin.Pinyin(wordStr, pinYinSub)
@ -144,13 +144,12 @@ func ChineseFirstWordCapitalize(wordStr string) (firstWord string) {
return return
} }
// ZeroFillByStr // ZeroFillByStr
// @Description: 字符串补零 // @Description: 字符串补零
// @param str :需要操作的字符串 // @param str :需要操作的字符串
// @param resultLen 结果字符串的长度 // @param resultLen 结果字符串的长度
// @param reverse true 为前置补零,false 为后置补零 // @param reverse true 为前置补零,false 为后置补零
// @return string // @return string
//
func ZeroFillByStr(str string, resultLen int, reverse bool) string { func ZeroFillByStr(str string, resultLen int, reverse bool) string {
if len(str) > resultLen || resultLen <= 0 { if len(str) > resultLen || resultLen <= 0 {
return str return str
@ -272,13 +271,13 @@ func (m *Md5Encryption) Md5EncryptionAlgorithmFj() (md5Val string, outlog []stri
return return
} }
//初始化程序 // 初始化程序
func (m *Md5Encryption) Md5EncryptionInit(code string) { func (m *Md5Encryption) Md5EncryptionInit(code string) {
m.AppKey = overall.CONSTANT_CONFIG.Appsetup.AppKey m.AppKey = overall.CONSTANT_CONFIG.Appsetup.AppKey
m.Code = code m.Code = code
} }
//sha1算法 // sha1算法
func Sha1Encryption(str string) string { func Sha1Encryption(str string) string {
sha1 := sha1.New() sha1 := sha1.New()
sha1.Write([]byte(str)) sha1.Write([]byte(str))
@ -306,7 +305,7 @@ func GetFutureMonthTime(timeStamp int64, futureTime, class int) (dateStr int64)
return return
} }
//判断字符串是否在切片中 泛型 // 判断字符串是否在切片中 泛型
func IsInTrue[T GenericityVariable](key T, keyAry []T) (isTrue bool) { func IsInTrue[T GenericityVariable](key T, keyAry []T) (isTrue bool) {
isTrue = false isTrue = false
for _, v := range keyAry { for _, v := range keyAry {
@ -317,7 +316,7 @@ func IsInTrue[T GenericityVariable](key T, keyAry []T) (isTrue bool) {
return return
} }
//获取两个切片得差集 // 获取两个切片得差集
func DifferenceSet[T GenericityVariable](one, two []T) []T { func DifferenceSet[T GenericityVariable](one, two []T) []T {
var three []T var three []T
temp := map[T]struct{}{} temp := map[T]struct{}{}
@ -367,8 +366,8 @@ func StringToInt64(val interface{}) (int64, error) {
return 0, nil return 0, nil
} }
//获取人员TokenRedis 信息 // 获取人员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) redisMyContKey := fmt.Sprintf("ScanCode:Authentication:UserCont_%v_%v", overall.CONSTANT_CONFIG.RedisPrefixStr.Alias, number)
redisClient := grocerystore.RunRedis(overall.CONSTANT_REDIS5) redisClient := grocerystore.RunRedis(overall.CONSTANT_REDIS5)
useMap, isTrue := redisClient.HashGetAll(redisMyContKey) useMap, isTrue := redisClient.HashGetAll(redisMyContKey)
@ -381,8 +380,8 @@ func GetUserRedisToken(number string) (manCont models.ManCont, err error) {
return return
} }
//获取人员Redis信息 // 获取人员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) redisMyContKey := fmt.Sprintf("ScanCode:Authentication:UserCont_%v_%v", overall.CONSTANT_CONFIG.RedisPrefixStr.Alias, number)
redisClient := grocerystore.RunRedis(overall.CONSTANT_REDIS5) redisClient := grocerystore.RunRedis(overall.CONSTANT_REDIS5)
useMap, isTrue := redisClient.HashGetAll(redisMyContKey) useMap, isTrue := redisClient.HashGetAll(redisMyContKey)
@ -397,8 +396,8 @@ func GetUserRedisCont(number string) (manCont models.ManCont, err error) {
return return
} }
//获取人员Redis信息返回指针 // 获取人员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) redisMyContKey := fmt.Sprintf("ScanCode:Authentication:UserCont_%v_%v", overall.CONSTANT_CONFIG.RedisPrefixStr.Alias, number)
redisClient := grocerystore.RunRedis(overall.CONSTANT_REDIS5) redisClient := grocerystore.RunRedis(overall.CONSTANT_REDIS5)
useMap, isTrue := redisClient.HashGetAll(redisMyContKey) useMap, isTrue := redisClient.HashGetAll(redisMyContKey)
@ -475,7 +474,7 @@ func MapToStruct(mapString map[string]string, structInterface interface{}, tag s
return return
} }
//翻页设置 // 翻页设置
func PageTurningSettings(gormDb *gorm.DB, page, pageSize int) *gorm.DB { func PageTurningSettings(gormDb *gorm.DB, page, pageSize int) *gorm.DB {
if page < 0 { if page < 0 {
page = 1 page = 1
@ -486,3 +485,122 @@ func PageTurningSettings(gormDb *gorm.DB, page, pageSize int) *gorm.DB {
gormDb = gormDb.Limit(pageSize).Offset(LimitPage(page, pageSize)) gormDb = gormDb.Limit(pageSize).Offset(LimitPage(page, pageSize))
return gormDb return gormDb
} }
//浮点数保留小数
/*
@value 浮点数值
@weishu 要保留的小数位数
*/
func DecimalEs(value float64, weishu int) float64 {
switch weishu {
case 3:
value, _ = strconv.ParseFloat(fmt.Sprintf("%.3f", value), 64)
case 4:
value, _ = strconv.ParseFloat(fmt.Sprintf("%.4f", value), 64)
case 5:
value, _ = strconv.ParseFloat(fmt.Sprintf("%.5f", value), 64)
case 6:
value, _ = strconv.ParseFloat(fmt.Sprintf("%.6f", value), 64)
default:
value, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", value), 64)
}
return value
}
// 递归查找
func RecursionOrgLeve(superior int64, leve int64) (groupId int64) {
if leve == 0 {
leve = 1
}
var orgMap modelshr.OrgContType
err := orgMap.GetCont(map[string]interface{}{"`id`": superior, "`state`": 1}, "`id`", "`superior`", "`level`")
if err != nil {
return
}
if orgMap.Level <= leve {
groupId = orgMap.Id
return
} else {
groupId = RecursionOrgLeve(orgMap.Superior, leve)
}
return
}
// 获取集团、公司、部门、二级部门、工段
func GetOrgStructure(orgId int64) (groupId, companyId, departmentId, sunDepartId, workShopId int64) {
var orgContTypeInfo modelshr.OrgContType
err := orgContTypeInfo.GetCont(map[string]interface{}{"`id`": orgId})
if err != nil {
return
}
switch orgContTypeInfo.Level {
case 1:
groupId = orgContTypeInfo.Id
case 2:
groupId = RecursionOrgLeve(orgContTypeInfo.Superior, 1)
workShopId = orgContTypeInfo.Id
case 3:
groupId = RecursionOrgLeve(orgContTypeInfo.Superior, 2)
companyId = orgContTypeInfo.Id
case 4:
groupId = RecursionOrgLeve(orgContTypeInfo.Superior, 2)
companyId = RecursionOrgLeve(orgContTypeInfo.Superior, 3)
departmentId = orgContTypeInfo.Id
case 5:
groupId = RecursionOrgLeve(orgContTypeInfo.Superior, 2)
companyId = RecursionOrgLeve(orgContTypeInfo.Superior, 3)
departmentId = RecursionOrgLeve(orgContTypeInfo.Superior, 4)
sunDepartId = orgContTypeInfo.Id
case 6:
groupId = RecursionOrgLeve(orgContTypeInfo.Superior, 2)
companyId = RecursionOrgLeve(orgContTypeInfo.Superior, 3)
departmentId = RecursionOrgLeve(orgContTypeInfo.Superior, 4)
sunDepartId = RecursionOrgLeve(orgContTypeInfo.Superior, 5)
workShopId = orgContTypeInfo.Id
default:
groupId = orgContTypeInfo.Id
companyId = orgContTypeInfo.Id
workShopId = orgContTypeInfo.Id
}
return
}
// 获取指定行政组织id,所有子类
func GetDepartmentSun(superior int64, idary []int64) (orgIdAry []int64) {
var orgAry []modelshr.AdministrativeOrganization
err := overall.CONSTANT_DB_HR.Model(&modelshr.AdministrativeOrganization{}).Select("`id`").Where("`state` = 1 AND `superior` = ?", superior).Find(&orgAry).Error
if err != nil {
return
}
for _, v := range orgAry {
if IsInTrue[int64](v.Id, orgIdAry) == false {
orgIdAry = append(orgIdAry, v.Id)
GetDepartmentSun(v.Id, orgIdAry)
} else {
GetDepartmentSun(v.Id, orgIdAry)
}
}
return
}
// 获取集团或第一实权部门
func GetGroupOrDepartPower(parentId int64, departId ...int64) int64 {
var orgCont modelshr.AdministrativeOrganization
err := orgCont.GetCont(map[string]interface{}{"id": parentId}, "id", "organization_type", "superior", "ispower")
if err != nil {
return parentId
}
if len(departId) > 0 {
if orgCont.IsPower == 1 {
return orgCont.Id
}
return GetGroupOrDepartPower(orgCont.Superior, 1)
} else {
if orgCont.OrganizationType <= 2 {
return orgCont.Id
}
return GetGroupOrDepartPower(orgCont.Superior)
}
return orgCont.Id
}

5
overall/publicmethod/type.go

@ -23,6 +23,11 @@ type PublicId struct {
Id string `json:"id"` Id string `json:"id"`
} }
//通用name结构体
type PublicName struct {
Name string `json:"name"`
}
//通用编辑状态结构体 //通用编辑状态结构体
type PublicState struct { type PublicState struct {
PublicId PublicId

Loading…
Cancel
Save