Browse Source

修改删除指标

master
超级管理员 3 years ago
parent
commit
089f2ccd4a
  1. 13
      README.md
  2. 2
      api/base/loginVerify/login.go
  3. 51
      api/version1/departmentseting/departmentpc/qualitativekpi.go
  4. 255
      api/version1/postseting/postpc/scheme.go
  5. 33
      api/version1/postseting/postpc/type.go
  6. 167
      api/version1/postseting/postweb/posttarget.go
  7. 19
      api/version1/postseting/postweb/type.go
  8. 2
      apirouter/v1/departmentseting/pc.go
  9. 1
      apirouter/v1/postseting/pc.go
  10. 4
      apirouter/v1/postseting/web.go
  11. 58
      config/configDatabase/database.yaml
  12. 62
      models/modelskpi/post_sun_target.go
  13. 3
      models/modelskpi/qualitative_evaluation_scheme.go
  14. 83
      models/modelskpi/sheme_people.go

13
README.md

@ -131,9 +131,9 @@ 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`)))
```
@ -155,3 +155,12 @@ F:\goobject\src\key_performance_indicators\api\version1\departmentseting\departm
```
<span style="color:#D98719; font-size:20px;">
Time:2022-08-24 <br>
数据库增加考核项目与提报人关联视图
</span>
```
select `qes`.`id` AS `id`,`qes`.`version_number` AS `version_number`,`qes`.`company_id` AS `company_id`,`qes`.`department_id` AS `department_id`,`qes`.`org_id` AS `org_id`,`qes`.`post_id` AS `post_id`,`qes`.`title` AS `title`,`qes`.`dimension_id` AS `dimension_id`,`qes`.`target_id` AS `target_id`,`qes`.`son_target_id` AS `son_target_id`,`qes`.`details_id` AS `details_id`,`qes`.`attribute` AS `attribute`,`qes`.`min_score` AS `min_score`,`qes`.`max_score` AS `max_score`,`qes`.`scoring_method` AS `scoring_method`,`qes`.`state` AS `state`,`qes`.`addtime` AS `addtime`,`qes`.`eitetime` AS `eitetime`,`qes`.`censor_type` AS `censor_type`,`qes`.`source` AS `source`,`qes`.`run_state` AS `run_state`,`tr`.`type` AS `tr_type`,`tr`.`man_key` AS `man_key`,`tr`.`man_department` AS `man_department`,`tr`.`class` AS `tr_class`,`tr`.`type_level` AS `tr_level` from (`qualitative_evaluation_scheme` `qes` join `target_report` `tr` on(((`qes`.`dimension_id` = `tr`.`dimension_id`) and (`qes`.`target_id` = `tr`.`target_id`) and (`qes`.`son_target_id` = `tr`.`target_sun_id`) and (`qes`.`details_id` = `tr`.`target_bylaws`) and (`qes`.`post_id` = `tr`.`post_id`) and (`qes`.`org_id` = `tr`.`department_id`))))
```

2
api/base/loginVerify/login.go

@ -44,7 +44,7 @@ func (a *ApiMethod) ScanCodeLogin(c *gin.Context) {
// if oldErr == nil {
// //原知行学院管理员账号登录
// }
//新的登录认证方式
var userCont modelshr.ManCont
userErr := userCont.GetCont(map[string]interface{}{"number": requestData.Username, "password": md5TokenPwd})

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

@ -2277,3 +2277,54 @@ func (a *ApiMethod) DeparDetaileAboutPost(c *gin.Context) {
syncSeting.Wait()
publicmethod.Result(0, err, c)
}
// 删除子栏目
func (a *ApiMethod) DelTarget(c *gin.Context) {
var receivedValue publicmethod.PublicId
err := c.ShouldBindJSON(&receivedValue)
if err != nil {
publicmethod.Result(100, receivedValue, c)
return
}
if receivedValue.Id == "" {
publicmethod.Result(101, receivedValue, c)
return
}
where := publicmethod.MapOut[string]()
where["et_id"] = receivedValue.Id
var sonTargetCont modelskpi.EvaluationTarget
err = sonTargetCont.GetCont(where, "q_id")
if err != nil {
publicmethod.Result(107, err, c)
return
}
//预留判断该指标是否在使用中
delTime := time.Now().Unix()
//获取该指标下的所有子栏目
var sonTargetList []int64
overall.CONSTANT_DB_KPI.Model(&modelskpi.QualitativeTarget{}).Select("`q_id`").Where("`q_state` = 1 AND `q_parent_id` = ?", sonTargetCont.Id).Find(&sonTargetList)
if len(sonTargetList) > 0 {
for _, v := range sonTargetList {
//软删除所有此子栏目下的指标细则
syncSeting.Add(1)
go softDetaildeCont(sonTargetCont.Id, v, delTime)
//软删除所有此子栏目相关的联部门
syncSeting.Add(1)
go softDelTargetDepartment(map[string]interface{}{"target_id": sonTargetCont.Id, "target_sun_id": v, "`state`": 1}, delTime)
//软删除所有此子栏目相关联的提报人
syncSeting.Add(1)
go softDelTargetReport(map[string]interface{}{"`target_id`": sonTargetCont.Id, "`target_sun_id`": v, "`state`": 1}, delTime)
}
}
//软删除此指标
var delTargetSon modelskpi.EvaluationTarget
err = delTargetSon.EiteCont(map[string]interface{}{"`et_id`": sonTargetCont.Id}, map[string]interface{}{"`et_state`": 3, "`et_time`": delTime})
syncSeting.Wait()
if err != nil {
publicmethod.Result(106, err, c)
return
}
publicmethod.Result(0, err, c)
}

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

@ -34,7 +34,7 @@ func (a *ApiMethod) GetPostAboutTarget(c *gin.Context) {
//1、获取维度
var dimensionModels modelskpi.DutyClass
dimensionList, dimeErr := dimensionModels.ContMap(map[string]interface{}{"`state`": 1}, "`id`", "`title`", "`sort`")
fmt.Printf("dimensionList--->%v\n", dimensionList)
// fmt.Printf("dimensionList--->%v\n", dimensionList)
if dimeErr != nil || len(dimensionList) <= 0 {
publicmethod.Result(107, postContErr, c)
return
@ -69,7 +69,7 @@ func (p *postDimeTarSync) GetPostTargent(position modelshr.Position, dutyClass m
//获取相关指标
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)
// fmt.Printf("postTargetList---->%v\n", postTargetList)
if postTarErr == nil && len(postTargetList) > 0 {
var planCont postAboutDimeTar
planCont.Id = strconv.FormatInt(dutyClass.Id, 10)
@ -295,8 +295,8 @@ func (a *ApiMethod) SubmitPostScheme(c *gin.Context) {
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)
overall.CONSTANT_DB_KPI.Model(&modelskpi.PositionPlanVersio{}).Select("state").Where("`orgid` = ? AND `position` = ?", 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 {
@ -350,7 +350,7 @@ func (a *ApiMethod) SubmitPostScheme(c *gin.Context) {
//岗位指标处理
if len(receivedValue.PostChild) > 0 {
syncSeting.Add(1)
go postSchemeTarget(versionNumber, 1, judgeState, receivedValue.PostChild, companyId, departmentId, orderIdInt, postIdInt)
go postSchemeTargetPost(versionNumber, 1, judgeState, receivedValue.PostChild, companyId, departmentId, orderIdInt, postIdInt)
}
//引用部门指标处理
@ -374,6 +374,154 @@ func (a *ApiMethod) SubmitPostScheme(c *gin.Context) {
@orgid 行政组织
@postid 岗位
*/
func postSchemeTargetPost(versionNumber string, source, judgeState int, scheme []schemeStructure, companyId, departmentId, orgid, postid int64) {
defer syncSeting.Done()
timeData := time.Now().Unix()
var saveNewData []modelskpi.QualitativeEvaluationScheme //要新加的考核指标
var xizeXiecheng postShemeListCont
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 //判断是自动计分还是手动计分
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)
}
} else { //定性考核
//获取该指标的岗位指标子栏目
var postSonTarget []modelskpi.PostSonTarget
overall.CONSTANT_DB_KPI.Model(&modelskpi.PostSonTarget{}).Select("`id`,`parent_id`").Where("`state` = 1 AND `depart` = ? AND `depart_post` = ? AND `parent_id` = ?", orgid, postid, targetIdInt64).Find(&postSonTarget)
if len(postSonTarget) > 0 {
for _, son_v := range postSonTarget {
syncSetinges.Add(1)
go xizeXiecheng.eidtPostSchemeInfo(versionNumber, companyId, departmentId, orgid, postid, dimensionIdInt64, son_v.ParentId, son_v.Id, cv.State, scoringMethod, judgeState)
}
}
}
}
}
}
syncSetinges.Wait()
if len(saveNewData) > 0 {
overall.CONSTANT_DB_KPI.Create(&saveNewData)
}
}
/*
协程处理岗位方案定性指标细则内容
@versionNumber 方案版本号
@companyId 公司
@departmentId 部门
@orgid 行政组织
@postid 岗位
@dimensionId 维度
@targetId 指标
@sonTargetId 子栏目
@runState 运行状态1启用2禁用3观察
@scoringMethod 计分方式1自动2手动
@targetState 指标状态1启用2禁用3删除
*/
func (p *postShemeListCont) eidtPostSchemeInfo(versionNumber string, companyId, departmentId, orgid, postid, dimensionId, targetId, sonTargetId int64, runState, scoringMethod, targetState int) {
p.mutext.Lock()
defer p.mutext.Unlock()
timeData := time.Now().Unix()
//获取相关指标细则内容
var postTargetDetailsCont []modelskpi.PostTargetDetails
overall.CONSTANT_DB_KPI.Where("`state` = 1 AND `parentid` = ? AND `parentid_sun` = ? AND `paretment` = ? AND `paretment_post` = ?", targetId, sonTargetId, orgid, postid).Find(&postTargetDetailsCont)
if len(postTargetDetailsCont) > 0 {
for _, v := range postTargetDetailsCont {
var saveData modelskpi.QualitativeEvaluationScheme //方案内容结构体
saveData.VersionNumber = versionNumber //版本编号"`
saveData.CompanyId = companyId //归属公司"`
saveData.DepartmentId = departmentId //归属部门"`
saveData.OrgId = orgid //归属行政组织"`
saveData.PostId = postid //归属岗位"`
saveData.Title = v.Title //考核项名称"`
saveData.DimensionId = departmentId //维度"`
saveData.TargetId = targetId //指标"`
saveData.SonTargetId = sonTargetId //子栏目"`
saveData.DetailsId = v.Id //细则"`
saveData.Attribute = 1 //属性 1:定性考核;2:定量考核"`
saveData.MinScore = v.MinScore //最小分*100保存"`
saveData.MaxScore = v.MaxScore //最大分*100保存"`
saveData.ScoringMethod = scoringMethod //计分方式(1:自动;2:手动)"`
saveData.State = targetState //状态(1:启用;2:禁用;3:删除)"`
saveData.Addtime = timeData //添加时间"`
saveData.Eitetime = timeData //编辑时间"`
saveData.CensorType = "2" //检查方式(1:现场检查;2:资料检查;3:事件触发)"`
saveData.Source = 1 //来源(1:岗位;2:部门引用)"`
saveData.RunState = runState //运行状态(1:启用;2:禁用;3:观察)
saveData.Punishmode = v.Punishmode //处罚方式 1:扣分;2:现金处罚;3:扣分加现金
saveData.Maxmoney = v.Maxmoney //最高罚款
saveData.Minmoney = v.Minmoney //最低罚款
p.shememList = append(p.shememList, saveData)
}
}
syncSetinges.Done()
}
/*
部门引入指标写入
@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()
@ -677,9 +825,102 @@ func (a *ApiMethod) GetPostScheme(c *gin.Context) {
}
//获取维度
var schemeCont modelskpi.PositionPlanVersio
err = overall.CONSTANT_DB_KPI.Where("`id` = ?", receivedValue.Id).Find(&schemeCont).Error
errShe := overall.CONSTANT_DB_KPI.Where("`id` = ?", receivedValue.Id).First(&schemeCont).Error
if errShe != nil {
publicmethod.Result(107, errShe, c)
return
}
var outData outShemeVersionCont
outData.Id = strconv.FormatInt(schemeCont.Id, 10)
outData.OrgId = strconv.FormatInt(schemeCont.OrgId, 10) //行政组织ID
outData.PostId = strconv.FormatInt(schemeCont.Position, 10) //岗位
outData.Year = strconv.FormatInt(schemeCont.Year, 10) //年
//解析岗位指标放啊
var shemeInfo postScheme
jsonErr := json.Unmarshal([]byte(schemeCont.Content), &shemeInfo)
if jsonErr == nil {
outData.PostChild = shemeInfo.PostChild //岗位指标
outData.DepartmentChild = shemeInfo.DepartmentChild //引用部门指标
}
publicmethod.Result(0, outData, c)
}
// 获取复制岗位考核方案
func (a *ApiMethod) GetCopyShemeInfor(c *gin.Context) {
var receivedValue publicmethod.PublicId
err := c.ShouldBindJSON(&receivedValue)
if err != nil {
publicmethod.Result(107, err, c)
publicmethod.Result(100, err, c)
return
}
if receivedValue.Id == "" {
publicmethod.Result(101, err, c)
return
}
//获取维度
var schemeCont modelskpi.PositionPlanVersio
errShe := overall.CONSTANT_DB_KPI.Where("`id` = ?", receivedValue.Id).First(&schemeCont).Error
if errShe != nil {
publicmethod.Result(107, errShe, c)
return
}
//解析岗位指标放啊
var shemeInfo postScheme
jsonErr := json.Unmarshal([]byte(schemeCont.Content), &shemeInfo)
//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, jsonErr, c)
return
}
var shemePostList shemeSync
//未使用的维度
var notUsedDimensionId []int64
for _, v := range dimensionList {
idIsTrue := true //判断此维度是否已经使用
for _, pv := range shemeInfo.PostChild {
vIdStr := strconv.FormatInt(v.Id, 10)
if vIdStr == pv.Id {
idIsTrue = false
syncSeting.Add(1)
go shemePostList.postHandleSheme(schemeCont.OrgId, schemeCont.Position, v.Id, pv)
}
}
if idIsTrue == true { //未使用的维度,检查一下时候有需要考核的项目
if publicmethod.IsInTrue[int64](v.Id, notUsedDimensionId) == false {
notUsedDimensionId = append(notUsedDimensionId, v.Id)
}
}
}
syncSeting.Wait()
}
/*
协程处理已经生成的维度指标是否有新的内容
@orgid 行政组织ID
@postid 岗位ID
@dimensId 维度ID
@shemeInfo 考核项结构体
*/
func (s *shemeSync) postHandleSheme(orgid, postid, dimensId int64, shemeInfo schemeStructure) {
var targetPostList []schemeTargetStructure
var idIsTrue []string
for _, v := range shemeInfo.Child {
idIsTrue = append(idIsTrue, v.Id)
var targetCont schemeTargetStructure
targetCont.Id = v.Id
targetCont.Name = v.Title
targetCont.Content = "" //指标描述
targetCont.StandardScore = getPostDimeTarWeight(orgid, postid, dimensId, v.Id, 1, 1) //标准分
targetCont.Unit = v.Unit //单位
targetCont.IsTrue = 2 //是否允许修改 1:不允许;2:允许
targetCont.State = 1
targetPostList = append(targetPostList, targetCont)
}
}

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

@ -1,6 +1,7 @@
package postpc
import (
"key_performance_indicators/models/modelskpi"
"key_performance_indicators/overall/publicmethod"
"sync"
@ -26,6 +27,32 @@ func (d *postDimeTarSync) readDataLock() []postAboutDimeTar {
return d.planList
}
// 方案内容协程操作
type shemeSync struct {
shememList []schemeStructure
mutext sync.RWMutex
}
// 读取岗位指标协程数据
func (s *shemeSync) readDataLock() []schemeStructure {
s.mutext.RLock()
defer s.mutext.RUnlock()
return s.shememList
}
// 岗位考核方案内容列表协程
type postShemeListCont struct {
shememList []modelskpi.QualitativeEvaluationScheme
mutext sync.RWMutex
}
// 读取岗位考核方案内容列表协程数据
func (p *postShemeListCont) readDataLock() []modelskpi.QualitativeEvaluationScheme {
p.mutext.RLock()
defer p.mutext.RUnlock()
return p.shememList
}
// 岗位考核PC端入口
func (a *ApiMethod) Index(c *gin.Context) {
outputCont := publicmethod.MapOut[string]()
@ -104,3 +131,9 @@ type postSchemeList struct {
publicmethod.PagesTurn
VersionNumber string `json:"versionnumber"` //版本号
}
// 输出考核方案详细内容
type outShemeVersionCont struct {
publicmethod.PublicId //id
postScheme
}

167
api/version1/postseting/postweb/posttarget.go

@ -0,0 +1,167 @@
package postweb
import (
"key_performance_indicators/models/modelshr"
"key_performance_indicators/models/modelskpi"
"key_performance_indicators/overall"
"key_performance_indicators/overall/publicmethod"
"strconv"
"github.com/gin-gonic/gin"
)
//岗位指标相关操作
// 获取指定人要考核的项目列表
func (a *ApiMethod) GetPostTarget(c *gin.Context) {
var receivedValue getPostManTargetList
err := c.ShouldBindJSON(&receivedValue)
if err != nil {
publicmethod.Result(100, err, c)
return
}
if receivedValue.Id == "" {
publicmethod.Result(101, receivedValue, c)
return
}
if receivedValue.Class == 0 {
receivedValue.Class = 1
}
//获取被考核人基本西悉尼
var userCont modelshr.PersonArchives
err = userCont.GetCont(map[string]interface{}{"`key`": receivedValue.Id}, "`company`", "`maindeparment`", "`admin_org`", "`position`")
if err != nil {
publicmethod.Result(107, err, c)
return
}
//获取登录人信息
context, _ := publicmethod.LoginMyCont(c)
var qualitSchemeList []modelskpi.QualitativeEvaluationScheme
err = overall.CONSTANT_DB_KPI.Raw("SELECT q.* FROM qualitative_evaluation_scheme q Where q.state = 1 AND `attribute` = ? AND q.target_id = some (SELECT target_id FROM target_report tr WHERE tr.type = 2 AND tr.department_id = ? AND tr.post_id = ? AND tr.man_key = ?)", receivedValue.Class, userCont.MainDeparment, userCont.Position, context.Key).Scan(&qualitSchemeList).Error
if err != nil || len(qualitSchemeList) < 1 {
publicmethod.Result(107, err, c)
return
}
var outDataAry []outPostManTargetList
for _, v := range qualitSchemeList {
// jsonStr, _ := json.Marshal(v)
// fmt.Printf("v----------->%v\n", string(jsonStr))
var outCont outPostManTargetList
outCont.Id = strconv.FormatInt(v.Id, 10)
outCont.Class = v.Attribute
outCont.Title = v.Title
if v.Attribute == 1 {
if v.Source == 1 { //岗位
var postTarDeta modelskpi.PostTargetDetails
postTarDeta.GetCont(map[string]interface{}{"`id`": v.DetailsId}, "`punishmode`")
outCont.AddReduce = postTarDeta.Punishmode
} else { //部门
var departTarDeta modelskpi.DetailedTarget
departTarDeta.GetCont(map[string]interface{}{"`dt_id`": v.DetailsId}, "`dt_add_reduce`")
outCont.AddReduce = departTarDeta.AddReduce
}
}
outDataAry = append(outDataAry, outCont)
}
publicmethod.Result(0, outDataAry, c)
}
// 定性指标列表
func (a *ApiMethod) GetPostNature(c *gin.Context) {
var receivedValue publicmethod.PublicId
err := c.ShouldBindJSON(&receivedValue)
if err != nil {
publicmethod.Result(100, err, c)
return
}
if receivedValue.Id == "" {
publicmethod.Result(101, receivedValue, c)
return
}
//获取被考核人基本信息
var userCont modelshr.PersonArchives
err = userCont.GetCont(map[string]interface{}{"`key`": receivedValue.Id}, "`company`", "`maindeparment`", "`admin_org`", "`position`")
if err != nil {
publicmethod.Result(107, err, c)
return
}
//获取登录人信息
context, _ := publicmethod.LoginMyCont(c)
//获取被考核人本岗位的考核项目
var itemList []modelskpi.ShemePeople
err = overall.CONSTANT_DB_KPI.Where("`state` = 1 AND `attribute` = 1 AND `run_state` <> 2 AND `org_id` = ? AND `post_id` = ? AND `man_key` = ?", userCont.MainDeparment, userCont.Position, context.Key).Find(&itemList).Error
if err != nil || len(itemList) < 1 {
publicmethod.Result(107, err, c)
return
}
var targetId []int64
//获取指标内容
var outDataAry []outPostManTargetList
for _, v := range itemList {
if publicmethod.IsInTrue[int64](v.TargetId, targetId) == false {
var outCont outPostManTargetList
outCont.Id = strconv.FormatInt(v.TargetId, 10)
outCont.Title = v.Title
outCont.Class = v.Attribute
if v.Source == 1 { //岗位
var postTarDeta modelskpi.PostTargetDetails
postTarDeta.GetCont(map[string]interface{}{"`id`": v.DetailsId}, "`punishmode`")
outCont.AddReduce = postTarDeta.Punishmode
} else { //部门
var departTarDeta modelskpi.DetailedTarget
departTarDeta.GetCont(map[string]interface{}{"`dt_id`": v.DetailsId}, "`dt_add_reduce`")
outCont.AddReduce = departTarDeta.AddReduce
}
outDataAry = append(outDataAry, outCont)
}
}
publicmethod.Result(0, outDataAry, c)
}
// 获取定量指标
func (a *ApiMethod) GetPostRation(c *gin.Context) {
var receivedValue publicmethod.PublicId
err := c.ShouldBindJSON(&receivedValue)
if err != nil {
publicmethod.Result(100, err, c)
return
}
if receivedValue.Id == "" {
publicmethod.Result(101, receivedValue, c)
return
}
//获取被考核人基本信息
var userCont modelshr.PersonArchives
err = userCont.GetCont(map[string]interface{}{"`key`": receivedValue.Id}, "`company`", "`maindeparment`", "`admin_org`", "`position`")
if err != nil {
publicmethod.Result(107, err, c)
return
}
//获取登录人信息
context, _ := publicmethod.LoginMyCont(c)
//获取被考核人本岗位的考核项目
var itemList []modelskpi.ShemePeople
err = overall.CONSTANT_DB_KPI.Where("`state` = 1 AND `attribute` = 2 AND `run_state` <> 2 AND `org_id` = ? AND `post_id` = ? AND `man_key` = ?", userCont.MainDeparment, userCont.Position, context.Key).Find(&itemList).Error
if err != nil || len(itemList) < 1 {
publicmethod.Result(107, err, c)
return
}
var targetId []int64
//获取指标内容
var outDataAry []outPostRation
for _, v := range itemList {
if publicmethod.IsInTrue[int64](v.TargetId, targetId) == false {
var outCont outPostRation
outCont.Id = strconv.FormatInt(v.TargetId, 10)
outCont.Name = v.Title
outDataAry = append(outDataAry, outCont)
}
}
publicmethod.Result(0, outDataAry, c)
}

19
api/version1/postseting/postweb/type.go

@ -14,3 +14,22 @@ func (a *ApiMethod) Index(c *gin.Context) {
outputCont["index"] = "岗位考核WEB端入口"
publicmethod.Result(0, outputCont, c)
}
// 获取指定人要考核的项目列表
type getPostManTargetList struct {
publicmethod.PublicId
Class int `json:"class"` //属性 1:定性考核;2:定量考核
}
// 输出定性指标指定人考核项目列表
type outPostManTargetList struct {
getPostManTargetList
Title string `json:"title"`
AddReduce int `json:"addreduce"` //1:减少;2:增加;3:无属性,现场确认加或减
}
// 输出定量考核项目
type outPostRation struct {
publicmethod.PublicId
publicmethod.PublicName
}

2
apirouter/v1/departmentseting/pc.go

@ -20,6 +20,8 @@ func (a *ApiRouter) RouterGroupPc(router *gin.RouterGroup) {
apiRouter.POST("getdepartabouttarget", methodBinding.GetDepartAboutTarget) //获取部门定性考核部门关联列表
apiRouter.POST("gettargetreport", methodBinding.GetTargetReport) //获取部门指标相关执行人
apiRouter.POST("deltarget", methodBinding.DelTarget) //删除指标
apiRouter.POST("addsuntargetdetailed", methodBinding.AddSunTargetDetailed) //添加定性考核子栏目及细则
apiRouter.POST("getdepartmenttragetcontlist", methodBinding.GetDepartmentTragetContList) //获取定性考核指标列表内容
apiRouter.POST("basissontargetadddetailed", methodBinding.BasisSonTargetAddDetailed) //根据指标栏目新增指标细则

1
apirouter/v1/postseting/pc.go

@ -17,5 +17,6 @@ func (a *ApiRouter) RouterGroupPc(router *gin.RouterGroup) {
apiRouter.POST("getpostabouttarget", methodBinding.GetPostAboutTarget) //获取岗位相关指标
apiRouter.POST("quote_department_target", methodBinding.QuoteDepartmentTarget) //引用指标部门指标
apiRouter.POST("submit_post_scheme", methodBinding.SubmitPostScheme) //提交岗位考核方案
apiRouter.POST("get_post_scheme", methodBinding.GetPostScheme) //获取岗位方案内容列表
}
}

4
apirouter/v1/postseting/web.go

@ -14,5 +14,9 @@ func (a *ApiRouter) RouterGroupWeb(router *gin.RouterGroup) {
{
apiRouter.GET("", methodBinding.Index) //入口
apiRouter.POST("", methodBinding.Index) //入口
apiRouter.POST("getposttarget", methodBinding.GetPostTarget) //获取指定人要考核的项目列表
apiRouter.POST("getpostnature", methodBinding.GetPostNature) //定性指标列表
apiRouter.POST("getpostration", methodBinding.GetPostRation) //定量指标列表
}
}

58
config/configDatabase/database.yaml

@ -8,8 +8,8 @@ master:
parseTime: 'True' #是否自动转换时间
loc: 'Local' #时区
name: 'hengxingaoke_tes' #数据库名称
username: 'hengxingaoke_tes' #数据库用户民
password: 'rjwi58B6zYCHMbGZ' #数据库密码
username: 'root' #数据库用户民
password: 'root' #数据库密码
max_idle_conns: 100 #最大空闲数量
max_open_conns: 1500 #最大打开数量
gorm_log: false #是否开启gorm日志
@ -21,8 +21,8 @@ wechat:
parseTime: 'True' #是否自动转换时间
loc: 'Local' #时区
name: 'wechatuser' #数据库名称
username: 'wechatuser' #数据库用户民
password: 'ESEYc527J5AAdfka' #数据库密码
username: 'root' #数据库用户民
password: 'root' #数据库密码
max_idle_conns: 100 #最大空闲数量
max_open_conns: 1500 #最大打开数量
gorm_log: false #是否开启gorm日志
@ -34,8 +34,8 @@ hrdatabase:
parseTime: 'True' #是否自动转换时间
loc: 'Local' #时区
name: 'hr_new' #数据库名称
username: 'hr_new' #数据库用户民
password: 'AnknKiXiXaxNrw78' #数据库密码
username: 'root' #数据库用户民
password: 'root' #数据库密码
max_idle_conns: 100 #最大空闲数量
max_open_conns: 1500 #最大打开数量
gorm_log: true #是否开启gorm日志
@ -47,8 +47,8 @@ fileBookDate:
parseTime: 'True' #是否自动转换时间
loc: 'Local' #时区
name: 'learn_message' #数据库名称
username: 'learn_message' #数据库用户民
password: '3bdd844687' #数据库密码
username: 'root' #数据库用户民
password: 'root' #数据库密码
max_idle_conns: 100 #最大空闲数量
max_open_conns: 1500 #最大打开数量
gorm_log: true #是否开启gorm日志
@ -60,8 +60,8 @@ errorSubjectDate:
parseTime: 'True' #是否自动转换时间
loc: 'Local' #时区
name: 'wrong_question_bank' #数据库名称
username: 'wrong_question_bank' #数据库用户民
password: '7f7ac6c8f5' #数据库密码
username: 'root' #数据库用户民
password: 'root' #数据库密码
max_idle_conns: 100 #最大空闲数量
max_open_conns: 1500 #最大打开数量
gorm_log: true #是否开启gorm日志
@ -73,8 +73,8 @@ myTestDate:
parseTime: 'True' #是否自动转换时间
loc: 'Local' #时区
name: 'selftestdatabase' #数据库名称
username: 'selftestdatabase' #数据库用户民
password: '6755319456' #数据库密码
username: 'root' #数据库用户民
password: 'root' #数据库密码
max_idle_conns: 100 #最大空闲数量
max_open_conns: 1500 #最大打开数量
gorm_log: true #是否开启gorm日志
@ -87,8 +87,8 @@ imageTextDate:
parseTime: 'True' #是否自动转换时间
loc: 'Local' #时区
name: 'readdocument' #数据库名称
username: 'readdocument' #数据库用户民
password: 'f2c943d2ab' #数据库密码
username: 'root' #数据库用户民
password: 'root' #数据库密码
max_idle_conns: 100 #最大空闲数量
max_open_conns: 1500 #最大打开数量
gorm_log: true #是否开启gorm日志
@ -101,8 +101,8 @@ scoringDetailsDate:
parseTime: 'True' #是否自动转换时间
loc: 'Local' #时区
name: 'league_table_data' #数据库名称
username: 'league_table_data' #数据库用户民
password: 'e0eb142add' #数据库密码
username: 'root' #数据库用户民
password: 'root' #数据库密码
max_idle_conns: 100 #最大空闲数量
max_open_conns: 1500 #最大打开数量
gorm_log: true #是否开启gorm日志
@ -115,8 +115,8 @@ questionsAnswersDate:
parseTime: 'True' #是否自动转换时间
loc: 'Local' #时区
name: 'ques_and_answers' #数据库名称
username: 'ques_and_answers' #数据库用户民
password: 'c8caf5d256' #数据库密码
username: 'root' #数据库用户民
password: 'root' #数据库密码
max_idle_conns: 100 #最大空闲数量
max_open_conns: 1500 #最大打开数量
gorm_log: true #是否开启gorm日志
@ -129,8 +129,8 @@ billboardDate:
parseTime: 'True' #是否自动转换时间
loc: 'Local' #时区
name: 'statisticsing' #数据库名称
username: 'statisticsing' #数据库用户民
password: '19c66cdb65' #数据库密码
username: 'root' #数据库用户民
password: 'root' #数据库密码
max_idle_conns: 100 #最大空闲数量
max_open_conns: 1500 #最大打开数量
gorm_log: true #是否开启gorm日志
@ -143,8 +143,8 @@ healthReportDate:
parseTime: 'True' #是否自动转换时间
loc: 'Local' #时区
name: 'location' #数据库名称
username: 'location' #数据库用户民
password: 'cf57497e02' #数据库密码
username: 'root' #数据库用户民
password: 'root' #数据库密码
max_idle_conns: 100 #最大空闲数量
max_open_conns: 1500 #最大打开数量
gorm_log: true #是否开启gorm日志
@ -157,8 +157,8 @@ kpiDate:
parseTime: 'True' #是否自动转换时间
loc: 'Local' #时区
name: 'perform' #数据库名称
username: 'perform' #数据库用户民
password: '7GCpac8TcAJX88yk' #数据库密码
username: 'root' #数据库用户民
password: 'root' #数据库密码
max_idle_conns: 100 #最大空闲数量
max_open_conns: 1500 #最大打开数量
gorm_log: true #是否开启gorm日志
@ -171,8 +171,8 @@ wechatCallBackLogDate:
parseTime: 'True' #是否自动转换时间
loc: 'Local' #时区
name: 'wechatlog' #数据库名称
username: 'wechatlog' #数据库用户民
password: '1b7fa92eed' #数据库密码
username: 'root' #数据库用户民
password: 'root' #数据库密码
max_idle_conns: 100 #最大空闲数量
max_open_conns: 1500 #最大打开数量
gorm_log: true #是否开启gorm日志
@ -185,8 +185,8 @@ managearchives:
parseTime: 'True' #是否自动转换时间
loc: 'Local' #时区
name: 'manage_archives' #数据库名称
username: 'manage_archives' #数据库用户民
password: '133ef6c58c' #数据库密码
username: 'root' #数据库用户民
password: 'root' #数据库密码
max_idle_conns: 100 #最大空闲数量
max_open_conns: 1500 #最大打开数量
gorm_log: true #是否开启gorm日志
gorm_log: true #是否开启gorm日志

62
models/modelskpi/post_sun_target.go

@ -0,0 +1,62 @@
package modelskpi
import (
"key_performance_indicators/overall"
"strings"
)
// 岗位定性指标子栏目
type PostSonTarget 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:标题"`
ParentId int64 `json:"parentid" gorm:"column:parent_id;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:创建时间"`
State int `json:"state" gorm:"column:state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"`
Depart int64 `json:"depart" gorm:"column:depart;type:bigint(20) ;default:0;comment:关联部门"`
DepartPost string `json:"departpost" gorm:"column:depart_post;type:mediumtext ;default:'';comment:关联部门岗位"`
}
func (PostSonTarget *PostSonTarget) TableName() string {
return "post_sun_target"
}
// 编辑内容
func (cont *PostSonTarget) EiteCont(whereMap interface{}, saveData interface{}) (err error) {
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error
return
}
// 获取内容
func (cont *PostSonTarget) 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 *PostSonTarget) CountCont(whereMap interface{}) (countId int64) {
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId)
return
}
// 读取全部信息
func (cont *PostSonTarget) ContMap(whereMap interface{}, field ...string) (countAry []PostSonTarget, 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 *PostSonTarget) DelCont(whereMap interface{}) (err error) {
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error
return
}

3
models/modelskpi/qualitative_evaluation_scheme.go

@ -28,6 +28,9 @@ type QualitativeEvaluationScheme struct {
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:观察)"`
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:最高罚款*100保存"`
Minmoney int64 `json:"minmoney" gorm:"column:minmoney;type:bigint(20) unsigned;default:0;not null;comment:最低罚款*100保存"`
}
func (QualitativeEvaluationScheme *QualitativeEvaluationScheme) TableName() string {

83
models/modelskpi/sheme_people.go

@ -0,0 +1,83 @@
package modelskpi
//岗位考核项目与提报人关联视图
import (
"key_performance_indicators/overall"
"strings"
)
// 岗位评估方案
type ShemePeople 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:观察)"`
Type int `json:"type" gorm:"column:tr_type;type:tinyint(1) unsigned;default:1;not null;comment:类型(1:公司级;2:部门级)"`
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:提报人所在部门"`
Class int `json:"class" gorm:"column:tr_class;type:tinyint(1) unsigned;default:1;not null;comment:1:定性考核;2:定量考核"`
Level int `json:"level" gorm:"column:tr_level;type:tinyint(1) unsigned;default:1;not null;comment:类型(1:指标;2:子目标;3:细则)"`
}
func (ShemePeople *ShemePeople) TableName() string {
return "sheme_people"
}
// 编辑内容
func (cont *ShemePeople) EiteCont(whereMap interface{}, saveData interface{}) (err error) {
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error
return
}
// 获取内容
func (cont *ShemePeople) 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 *ShemePeople) CountCont(whereMap interface{}) (countId int64) {
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId)
return
}
// 读取全部信息
func (cont *ShemePeople) ContMap(whereMap interface{}, field ...string) (countAry []ShemePeople, 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 *ShemePeople) DelCont(whereMap interface{}) (err error) {
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error
return
}
Loading…
Cancel
Save