Browse Source

添加岗位指标细则完成

v1_dev_2
超级管理员 3 years ago
parent
commit
22c7def3ea
  1. 298
      api/shiyan/maptostruct/department.go
  2. 1102
      api/version1/departmentseting/departmentpc/departtarget.go
  3. 634
      api/version1/departmentseting/departmentpc/detailscont.go
  4. 189
      api/version1/departmentseting/departmentpc/qualitativekpi.go
  5. 141
      api/version1/departmentseting/departmentpc/rulesmatrix.go
  6. 124
      api/version1/departmentseting/departmentpc/type.go
  7. 2
      api/version1/empower/system_license.go
  8. 889
      api/version1/postseting/postpc/details.go
  9. 520
      api/version1/postseting/postpc/targetpost.go
  10. 85
      api/version1/postseting/postpc/teshutype.go
  11. 486
      api/version1/postseting/postpc/teshuxuqiu.go
  12. 48
      api/version1/postseting/postpc/type.go
  13. 3
      apirouter/apishiyan/maptostruct.go
  14. 26
      apirouter/v1/departmentseting/pc.go
  15. 23
      apirouter/v1/postseting/pc.go
  16. 8
      models/modelshr/personarchives.go
  17. 4
      models/modelskpi/post_sun_target.go
  18. 2
      models/modelskpi/post_target_details.go
  19. 4
      overall/publicmethod/technique.go

298
api/shiyan/maptostruct/department.go

@ -0,0 +1,298 @@
package maptostruct
import (
"key_performance_indicators/models/modelshr"
"key_performance_indicators/models/modelskpi"
"key_performance_indicators/overall"
"key_performance_indicators/overall/publicmethod"
"strconv"
"strings"
"time"
"github.com/gin-gonic/gin"
)
// 验证指标关联部门与指标关联提报人数据
func (a *ApiMethod) CorrectingDepartAndMan(c *gin.Context) {
var targetList []modelskpi.EvaluationTarget
err := overall.CONSTANT_DB_KPI.Find(&targetList).Error
if err != nil {
publicmethod.Result(1, err, c, "没有数据")
return
}
for _, v := range targetList {
handDepartment(v)
}
}
// 处理部门指标,提报人关联关系
func handDepartment(targetCont modelskpi.EvaluationTarget) {
//提报部门关联关系
if targetCont.RelevantDepartments != "" {
orgIdStr := strings.Split(targetCont.RelevantDepartments, ",")
if len(orgIdStr) > 0 {
for _, ov := range orgIdStr {
handDepartmentTarget(targetCont.Dimension, targetCont.Id, 0, 0, 0, 1, 1, targetCont.Type, ov)
}
}
}
//提报人与指标关联关系
if targetCont.Report != "" {
reportKey := strings.Split(targetCont.Report, ",")
if len(reportKey) > 0 {
for _, rv := range reportKey {
handPeopleTarget(targetCont, rv)
}
}
}
}
/*
*
@ 作者: 秦东
@ 时间: 2023-02-07 11:05:21
@ 功能: 编辑部门字表关联关系
@ 参数
#dimensionId 纬度
#targetId 指标
#targetSunId 栏目
#targetBylaws 指标细则
#typeInt 类型1指标2子目标3细则
#orgId 行政组织
#postId 岗位
#class 1定性考核2定量考核
#level 级别1部门级2岗位级
@ 返回值
#err
@ 方法原型
#handDepartmentTarget(dimensionId, targetId, targetSunId, targetBylaws, postId int64, typeInt, level, class int, orgId string) (err error)
*/
func handDepartmentTarget(dimensionId, targetId, targetSunId, targetBylaws, postId int64, typeInt, level, class int, orgId string) (err error) {
var tarDepartCont modelskpi.TargetDepartment
err = tarDepartCont.GetCont(map[string]interface{}{"`target_id`": targetId, "`department_id`": orgId, "`target_sun_id`": targetSunId, "`target_bylaws`": targetBylaws, "`type`": typeInt, "`post_id`": postId, "`level`": level})
if err != nil {
var addCont modelskpi.TargetDepartment
addCont.Dimension = dimensionId //维度"`
addCont.TargetId = targetId //指标ID"`
addCont.TargetSunId = targetSunId //子目标"`
addCont.TargetBylaws = targetBylaws //指标细则"`
addCont.Type = typeInt //类型(1:指标;2:子目标;3:细则)"`
orgIdInt, _ := strconv.ParseInt(orgId, 10, 64)
addCont.DepartmentId = orgIdInt //部门ID"`
addCont.PostId = postId //岗位ID"`
addCont.State = 1 //状态(1:启用;2:禁用;3:删除)"`
addCont.Time = time.Now().Unix() //写入时间"`
addCont.Class = class //1:定性考核;2:定量考核"`
addCont.Level = 1 //:级别(1:部门级;2:岗位级)"`
err = overall.CONSTANT_DB_KPI.Create(&addCont).Error
} else {
editCont := publicmethod.MapOut[string]()
if tarDepartCont.State != 1 {
editCont["`state`"] = 1
}
if tarDepartCont.Class != class {
editCont["`class`"] = class
}
if tarDepartCont.Dimension != dimensionId {
editCont["`dimension_id`"] = dimensionId
}
// fmt.Printf("遍布------------------->%v----------->%v\n", tarDepartCont.Dimension, dimensionId)
if len(editCont) > 0 {
editCont["`time`"] = time.Now().Unix()
err = overall.CONSTANT_DB_KPI.Model(&modelskpi.TargetDepartment{}).Where("`id` = ?", tarDepartCont.Id).Updates(&editCont).Error
}
}
return
}
// 编辑部门指标提报人逻辑关系
func handPeopleTarget(targetCont modelskpi.EvaluationTarget, manKey string) (err error) {
orgIdStr := strings.Split(targetCont.RelevantDepartments, ",")
if len(orgIdStr) > 0 {
for _, ov := range orgIdStr {
err = handTarReport(targetCont.Dimension, targetCont.Id, 0, 0, 0, 1, targetCont.Type, 1, ov, manKey)
}
}
return
}
/*
*
@ 作者: 秦东
@ 时间: 2023-02-07 11:29:53
@ 功能: 处理指标提交人
@ 参数
#dimensionId 纬度
#targetId 指标
#targetSunId 栏目
#targetBylaws 指标细则
#orgId 行政组织ID
#postId 岗位
#typeInt 类型1公司级2部门级
#manKey 提报人Key
#class 1定性考核2定量考核
#level 1指标2子目标3细则
@ 返回值
#err
@ 方法原型
#handTarReport(dimensionId, targetId, targetSunId, targetBylaws, postId int64, typeInt, class, level int, orgId, manKey string) (err error)
*/
func handTarReport(dimensionId, targetId, targetSunId, targetBylaws, postId int64, typeInt, class, level int, orgId, manKey string) (err error) {
var tarReportCont modelskpi.TargetReport
err = tarReportCont.GetCont(map[string]interface{}{"`target_id`": targetId, "`target_sun_id`": targetSunId, "`target_bylaws`": targetBylaws, "`department_id`": orgId, "`post_id`": postId, "`type`": typeInt, "`man_key`": manKey, "`type_level`": level})
var userCont modelshr.PersonArchives
userCont.GetCont(map[string]interface{}{"`key`": manKey}, "`maindeparment`")
if err != nil {
var addCont modelskpi.TargetReport
addCont.Dimension = dimensionId //维度"`
addCont.TargetId = targetId //指标ID"`
addCont.TargetSunId = targetSunId //子目标"`
addCont.TargetBylaws = targetBylaws //指标细则"`
orgIdInt, _ := strconv.ParseInt(orgId, 10, 64)
addCont.DepartmentId = orgIdInt //部门ID"`
addCont.PostId = postId //岗位ID"`
addCont.Type = typeInt //类型(1:公司级;2:部门级)"`
addCont.State = 1 //状态(1:启用;2:禁用;3:删除)"`
manKeyInt, _ := strconv.ParseInt(manKey, 10, 64)
addCont.ReportPerson = manKeyInt //上报人"`
addCont.ManDepartment = userCont.MainDeparment //提报人所在部门"`
addCont.Time = time.Now().Unix() //写入时间"`
addCont.Class = class //定性考核;2:定量考核"`
addCont.Level = level //类型(1:指标;2:子目标;3:细则)"`
err = overall.CONSTANT_DB_KPI.Create(&addCont).Error
} else {
editCont := publicmethod.MapOut[string]()
if tarReportCont.State != 1 {
editCont["`state`"] = 1
}
if tarReportCont.Class != class {
editCont["`class`"] = class
}
if tarReportCont.ManDepartment != userCont.MainDeparment {
editCont["`man_department`"] = userCont.MainDeparment
}
if tarReportCont.Dimension != dimensionId {
editCont["`dimension_id`"] = dimensionId
}
if len(editCont) > 0 {
editCont["`time`"] = time.Now().Unix()
err = overall.CONSTANT_DB_KPI.Model(&modelskpi.TargetReport{}).Where("`id` = ?", tarReportCont.Id).Updates(&editCont).Error
}
}
return
}
// 验证部门子栏目关联对照
func (a *ApiMethod) VerifDepartSonTarget(c *gin.Context) {
var qualTargetContList []modelskpi.QualitativeTarget
err := overall.CONSTANT_DB_KPI.Find(&qualTargetContList).Error
if err != nil || len(qualTargetContList) < 1 {
publicmethod.Result(1, err, c, "没有数据")
return
}
for _, v := range qualTargetContList {
if v.Depart != "" { //判断是否有关联部门
orgIdStr := strings.Split(v.Depart, ",") //转换程切片
if len(orgIdStr) > 0 {
var tarCont modelskpi.EvaluationTarget
tarCont.GetCont(map[string]interface{}{"`et_id`": v.ParentId}, "`et_dimension`", "`et_type`")
for _, ov := range orgIdStr { //循环处理栏目对照关系
handDepartmentTarget(tarCont.Dimension, v.ParentId, v.Id, 0, 0, 2, 1, tarCont.Type, ov)
}
}
}
}
publicmethod.Result(0, err, c)
}
// 验证部门指标细则关系对照
func (a *ApiMethod) VerifDepartDetasil(c *gin.Context) {
var detasilCont []modelskpi.DetailedTarget
err := overall.CONSTANT_DB_KPI.Find(&detasilCont).Error
if err != nil || len(detasilCont) < 1 {
publicmethod.Result(1, err, c, "没有数据")
return
}
for _, v := range detasilCont {
if v.Paretment != "" { //判断是否有关联部门
orgIdStr := strings.Split(v.Paretment, ",") //转换程切片
reportList := strings.Split(v.Reportary, ",") //转换程切片
if len(orgIdStr) > 0 {
var tarCont modelskpi.EvaluationTarget
tarCont.GetCont(map[string]interface{}{"`et_id`": v.ParentId}, "`et_dimension`", "`et_type`")
for _, ov := range orgIdStr { //循环处理栏目对照关系
handDepartmentTarget(tarCont.Dimension, v.ParentId, v.ParentIdSun, v.Id, 0, 3, 1, tarCont.Type, ov)
if len(reportList) > 0 {
syncSeting.Add(1)
go ChuLiTiBaoRenGuoDu(tarCont.Dimension, v.ParentId, v.ParentIdSun, v.Id, 0, 1, tarCont.Type, 3, ov, reportList)
}
}
}
}
}
syncSeting.Wait()
publicmethod.Result(0, err, c)
}
// 处理提报人过度
/*
#dimensionId 纬度
#targetId 指标
#targetSunId 栏目
#targetBylaws 指标细则
#orgId 行政组织ID
#postId 岗位
#typeInt 类型1公司级2部门级
#manKey 提报人Key
#class 1定性考核2定量考核
#level 1指标2子目标3细则
*/
func ChuLiTiBaoRenGuoDu(dimensionId, targetId, targetSunId, targetBylaws, postId int64, typeInt, class, level int, orgId string, manKey []string) {
defer syncSeting.Done()
for _, v := range manKey {
handTarReport(dimensionId, targetId, targetSunId, targetBylaws, postId, typeInt, class, level, orgId, v)
}
}
/*
*
@ 作者: 秦东
@ 时间: 2023-02-07 11:29:53
@ 功能: 处理指标提交人
@ 参数
#dimensionId 纬度
#targetId 指标
#targetSunId 栏目
#targetBylaws 指标细则
#orgId 行政组织ID
#postId 岗位
#typeInt 类型1公司级2部门级
#manKey 提报人Key
#class 1定性考核2定量考核
#level 1指标2子目标3细则
@ 返回值
#err
@ 方法原型
#handTarReport(dimensionId, targetId, targetSunId, targetBylaws, postId int64, typeInt, class, level int, orgId, manKey string) (err error)
*/

1102
api/version1/departmentseting/departmentpc/departtarget.go

File diff suppressed because it is too large

634
api/version1/departmentseting/departmentpc/detailscont.go

@ -0,0 +1,634 @@
package departmentpc
import (
"key_performance_indicators/models/modelskpi"
"key_performance_indicators/overall"
"key_performance_indicators/overall/publicmethod"
"strconv"
"strings"
"time"
"github.com/gin-gonic/gin"
)
/*
*
@ 作者: 秦东
@ 时间: 2023-02-16 08:52:27
@ 功能: 新版添加部门指标细则
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func (a *ApiMethod) NewAddDepartDetails(c *gin.Context) {
var receivedValue NewDetailsCont
err := c.ShouldBindJSON(&receivedValue)
if err != nil {
publicmethod.Result(100, err, c)
return
}
if receivedValue.TargetId == "" {
publicmethod.Result(1, receivedValue, c, "未知指标!请指定该细则归属指标")
return
}
if receivedValue.TableName == "" {
publicmethod.Result(1, receivedValue, c, "未知栏目名称!请选择已有栏目或新输入一个栏目名称!")
return
}
if len(receivedValue.DetailsList) < 1 {
publicmethod.Result(1, receivedValue, c, "没有细则内容提交!请输入至少一条细则内容!")
return
}
writeIsTrue := false
//验证细则内容
for _, v := range receivedValue.DetailsList {
if v.Title == "" {
writeIsTrue = true
}
if v.Standard == "" {
writeIsTrue = true
} else {
scoreAry := strings.Split(v.Standard, "-")
if len(scoreAry) < 1 {
writeIsTrue = true
}
}
if v.Unit == "" {
writeIsTrue = true
}
if v.Types == 0 {
writeIsTrue = true
}
if len(v.InspeMethod) < 1 {
writeIsTrue = true
}
if len(v.Department) < 1 {
writeIsTrue = true
}
if len(v.Executor) < 1 {
writeIsTrue = true
}
}
if writeIsTrue {
publicmethod.Result(1, receivedValue, c, "至少一条考核细则内容填写不符合规范!请检查并补充完成后,重新提交!")
return
}
// tragetId, _ := strconv.ParseInt(receivedValue.TargetId, 10, 64)
//获取指标内容
var targetCont modelskpi.EvaluationTarget
err = targetCont.GetCont(map[string]interface{}{"`et_id`": receivedValue.TargetId})
if err != nil {
publicmethod.Result(1, err, c, "没有此指标!")
return
}
if len(receivedValue.TargetOrgList) < 1 {
receivedValue.TargetOrgList = GetTargetAboutDepart(targetCont)
}
var targetOrgIdList []string
for _, tov := range receivedValue.TargetOrgList {
if publicmethod.IsInTrue[string](tov.Key, targetOrgIdList) == false {
targetOrgIdList = append(targetOrgIdList, tov.Key)
}
}
//处理栏目数据
tableId, err := HandleTableCont(targetCont.Dimension, targetCont.Id, targetCont.Type, receivedValue.TableName, targetOrgIdList)
if err != nil {
publicmethod.Result(104, receivedValue, c)
return
}
// var insetContList []modelskpi.DetailedTarget
for _, v := range receivedValue.DetailsList {
var insetDeatilsCont modelskpi.DetailedTarget
insetDeatilsCont.Title = v.Title //指标细则"`
insetDeatilsCont.Content = v.Remarks //指标说明"`
insetDeatilsCont.ParentId = targetCont.Id //归属指标栏目"`
insetDeatilsCont.ParentIdSun = tableId //归属指标子栏目"`
insetDeatilsCont.State = 1 //状态(1:启用;2:禁用;3:删除)"`
insetDeatilsCont.AddTime = time.Now().Unix() //制定时间"`
insetDeatilsCont.MinScore, insetDeatilsCont.MaxScore = SplitCriteria(v.Standard) //最小分*100保存"`,最大分*100保存"`
insetDeatilsCont.Company = v.Unit //单位"`
insetDeatilsCont.AddReduce = v.Types //1:减少;2:增加;3:无属性,现场确认加或减"`
insetDeatilsCont.CensorType = strings.Join(v.InspeMethod, ",") //检查方式"`
insetDeatilsCont.CensorCont = v.Evidence //检查依据"`
insetDeatilsCont.CensorRate = v.Frequency //检查频次"`
insetDeatilsCont.Cycles = v.Cycle //1:班;2:天;3:周;4:月;5:季度;6:年"`
insetDeatilsCont.CycleAttres = 1 //辅助计数"`
insetDeatilsCont.Paretment = strings.Join(v.Department, ",") //接受考核的部门"`
insetDeatilsCont.Reportary = strings.Join(v.Executor, ",") //提报人"`
// insetContList = append(insetContList, insetDeatilsCont)
addErr := overall.CONSTANT_DB_KPI.Create(&insetDeatilsCont).Error
if addErr == nil {
syncSeting.Add(1)
go DepartAboutTarget(targetCont.Dimension, targetCont.Id, tableId, insetDeatilsCont.Id, v.Department, 3, targetCont.Type, 1)
syncSeting.Add(1)
go DepartAndReportAboutTarget(targetCont.Dimension, targetCont.Id, tableId, insetDeatilsCont.Id, v.Department, v.Executor, 1, targetCont.Type, 3)
}
}
syncSeting.Wait()
publicmethod.Result(0, err, c)
}
// 拆分指标细则考核标准
func SplitCriteria(detailsCriteria string) (minScore, maxScore int64) {
scoreAry := strings.Split(detailsCriteria, "-")
scoreLen := len(scoreAry)
if scoreLen > 0 {
if scoreLen == 1 {
maxScoreFloat, _ := strconv.ParseFloat(scoreAry[0], 64)
maxScore, _ = strconv.ParseInt(strconv.FormatFloat(maxScoreFloat*100, 'f', -1, 64), 10, 64)
minScore = 0
} else {
minScoreFloat, _ := strconv.ParseFloat(scoreAry[0], 64)
maxScoreFloat, _ := strconv.ParseFloat(scoreAry[scoreLen-1], 64)
minScore, _ = strconv.ParseInt(strconv.FormatFloat(minScoreFloat*100, 'f', -1, 64), 10, 64)
maxScore, _ = strconv.ParseInt(strconv.FormatFloat(maxScoreFloat*100, 'f', -1, 64), 10, 64)
}
}
return
}
/*
*
@ 作者: 秦东
@ 时间: 2023-02-16 10:06:59
@ 功能: 处理栏目数据
@ 参数
#dimensionId 维度
#tragetId 指标Id
#title 栏目名称
#targetOrgIdList 关联岗位
#class 属性1定性考核2定量考核
@ 返回值
#tableId 栏目ID
#err 状态数据
@ 方法原型
#HandleTableCont(dimensionId, tragetId int64, class int, title string, targetOrgIdList []string) (tableId int64, err error)
*/
func HandleTableCont(dimensionId, tragetId int64, class int, title string, targetOrgIdList []string) (tableId int64, err error) {
var tableCont modelskpi.QualitativeTarget
err = tableCont.GetCont(map[string]interface{}{"`q_title`": title, "`q_parent_id`": tragetId})
if err != nil {
//不存在就新增
var insetTableCont modelskpi.QualitativeTarget
insetTableCont.Title = title // 指标子栏目名称
insetTableCont.ParentId = tragetId //归属指标
insetTableCont.State = 1 //状态(1:启用;2:禁用;3:删除)
insetTableCont.AddTime = time.Now().Unix() //制定时间"`
insetTableCont.Depart = strings.Join(targetOrgIdList, ",") //关联部门"`
err = overall.CONSTANT_DB_KPI.Create(&insetTableCont).Error
tableId = insetTableCont.Id
syncSeting.Add(1)
go DepartAboutTarget(dimensionId, tragetId, insetTableCont.Id, 0, targetOrgIdList, 2, class, 1)
} else {
tableId = tableCont.Id
//存在就修改
editCont := publicmethod.MapOut[string]()
if tableCont.State != 1 {
editCont["q_state"] = 1
}
orgListStr := strings.Join(targetOrgIdList, ",")
if tableCont.Depart != orgListStr {
editCont["q_depart"] = orgListStr
syncSeting.Add(1)
go DepartAboutTarget(dimensionId, tragetId, tableCont.Id, 0, targetOrgIdList, 2, class, 1)
}
if len(editCont) > 0 {
editCont["q_time"] = time.Now().Unix()
var editTableCont modelskpi.QualitativeTarget
err = editTableCont.EiteCont(map[string]interface{}{"q_id": tableCont.Id}, editCont)
}
}
syncSeting.Wait()
return
}
/*
*
@ 作者: 秦东
@ 时间: 2023-02-16 14:01:48
@ 功能: 编辑指标细则状态
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func (a *ApiMethod) EditDetailsState(c *gin.Context) {
var receivedValue publicmethod.PublicState
c.ShouldBindJSON(&receivedValue)
// err := c.ShouldBindJSON(&receivedValue)
// if err != nil {
// publicmethod.Result(100, err, c)
// return
// }
if receivedValue.Id == "" {
publicmethod.Result(1, receivedValue, c, "未知指标细则!请确认后再提交处理!")
return
}
if receivedValue.State == 0 {
receivedValue.State = 1
}
if receivedValue.IsTrue == 0 {
receivedValue.IsTrue = 2
}
where := publicmethod.MapOut[string]()
where["dt_id"] = receivedValue.Id
var detailsCont modelskpi.DetailedTarget
err := detailsCont.GetCont(where, "dt_id", "dt_parentid", "dt_parentid_sun")
if err != nil {
publicmethod.Result(107, err, c)
return
}
softDel := 1
if receivedValue.State == 3 && receivedValue.IsTrue == 1 {
//强制删除
//判断该指标细则是否在使用中,使用中的只能软删除
var epIdList []int64
overall.CONSTANT_DB_KPI.Model(&modelskpi.EvaluationProcess{}).Select("`ep_id`").Where("FIND_IN_SET(?,`ep_detailedtarget`)", receivedValue.Id).Find(&epIdList)
if len(epIdList) > 0 {
softDel = 1
} else {
softDel = 2
}
}
delTime := time.Now().Unix()
var editDetailsInfo modelskpi.DetailedTarget
if softDel == 1 {
//软删除
editDetailsInfo.EiteCont(where, map[string]interface{}{"`dt_state`": receivedValue.State, "`dt_time`": delTime})
} else {
//硬删除
editDetailsInfo.DelCont(where)
}
syncSeting.Add(1)
go TarDepartState(detailsCont.ParentId, detailsCont.ParentIdSun, detailsCont.Id, receivedValue.State, softDel, 1, 3) // 处理关联部门
syncSeting.Add(1)
go TarAboutReport(detailsCont.ParentId, detailsCont.ParentIdSun, detailsCont.Id, receivedValue.State, softDel, 1, 3) // 处理相关提报人
syncSeting.Wait()
publicmethod.Result(0, err, c)
}
/*
*
@ 作者: 秦东
@ 时间: 2023-02-18 08:33:09
@ 功能: 编辑单一指标细则内容新版
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func (a *ApiMethod) EditDetailsCont(c *gin.Context) {
var receivedValue EditOneDetailsCont
c.ShouldBindJSON(&receivedValue)
if receivedValue.Id == "" {
publicmethod.Result(1, receivedValue, c, "未知指标细则!请确认后再提交处理!")
return
}
var minVal int64
var maxVal int64
if receivedValue.Standard == "" {
publicmethod.Result(1, receivedValue, c, "请输入考核标准!")
return
} else {
scoreAry := strings.Split(receivedValue.Standard, "-")
if len(scoreAry) < 1 {
publicmethod.Result(1, receivedValue, c, "您输入的考核标准不符合规范!(例:1或0.1或0.1-0.5等类型)")
return
} else {
scoreLen := len(scoreAry)
if scoreLen == 1 {
maxScoreFloat, _ := strconv.ParseFloat(scoreAry[0], 64)
maxVal, _ = strconv.ParseInt(strconv.FormatFloat(maxScoreFloat*100, 'f', -1, 64), 10, 64)
minVal = 0
} else {
minScoreFloat, _ := strconv.ParseFloat(scoreAry[0], 64)
maxScoreFloat, _ := strconv.ParseFloat(scoreAry[scoreLen-1], 64)
minVal, _ = strconv.ParseInt(strconv.FormatFloat(minScoreFloat*100, 'f', -1, 64), 10, 64)
maxVal, _ = strconv.ParseInt(strconv.FormatFloat(maxScoreFloat*100, 'f', -1, 64), 10, 64)
}
}
}
if receivedValue.Unit == "" {
publicmethod.Result(1, receivedValue, c, "请输入计量单位!")
return
}
if receivedValue.Types == 0 {
publicmethod.Result(1, receivedValue, c, "请选择操作类型!")
return
}
if len(receivedValue.InspeMethod) < 1 {
publicmethod.Result(1, receivedValue, c, "请选择检查方式!")
return
}
if len(receivedValue.Department) < 1 {
publicmethod.Result(1, receivedValue, c, "请选择接受考核部门!")
return
}
if len(receivedValue.Executor) < 1 {
publicmethod.Result(1, receivedValue, c, "请选择执行人")
return
}
where := publicmethod.MapOut[string]()
where["dt_id"] = receivedValue.Id
var detailsCont modelskpi.DetailedTarget
err := detailsCont.GetCont(where)
if err != nil {
publicmethod.Result(107, err, c)
return
}
var targetCont modelskpi.EvaluationTarget
err = targetCont.GetCont(map[string]interface{}{"`et_id`": detailsCont.ParentId}, "et_dimension", "et_type")
if err != nil {
publicmethod.Result(1, err, c, "没有此指标!")
return
}
editDateCont := publicmethod.MapOut[string]()
if receivedValue.Title != detailsCont.Title {
editDateCont["dt_title"] = receivedValue.Title
}
if minVal != detailsCont.MinScore {
editDateCont["dt_min_score"] = minVal
}
if maxVal != detailsCont.MaxScore {
editDateCont["dt_max_score"] = maxVal
}
if receivedValue.Unit != detailsCont.Company {
editDateCont["dt_company"] = receivedValue.Unit
}
if receivedValue.Types != detailsCont.AddReduce {
editDateCont["dt_add_reduce"] = receivedValue.Types
}
censorType := strings.Join(receivedValue.InspeMethod, ",")
if censorType != detailsCont.CensorType {
editDateCont["dt_censor_type"] = censorType
}
if receivedValue.Cycle != detailsCont.Cycles {
editDateCont["dt_cycle"] = receivedValue.Cycle
}
if receivedValue.Frequency != detailsCont.CensorRate {
editDateCont["dt_censor_rate"] = receivedValue.Frequency
}
if receivedValue.Evidence != detailsCont.CensorCont {
editDateCont["dt_censor_cont"] = receivedValue.Evidence
}
if receivedValue.Remarks != detailsCont.Content {
editDateCont["dt_content"] = receivedValue.Remarks
}
orgStr := strings.Join(receivedValue.Department, ",")
if orgStr != detailsCont.Paretment {
editDateCont["dt_paretment"] = orgStr
}
reportStr := strings.Join(receivedValue.Executor, ",")
if reportStr != detailsCont.Reportary {
editDateCont["reportary"] = reportStr
}
if len(editDateCont) > 0 {
editDateCont["dt_time"] = time.Now().Unix()
editDateCont["dt_state"] = 1
var editDetaCont modelskpi.DetailedTarget
errEdit := editDetaCont.EiteCont(where, editDateCont)
if errEdit != nil {
publicmethod.Result(107, err, c)
return
}
}
syncSeting.Add(1)
go DepartAboutTarget(targetCont.Dimension, detailsCont.ParentId, detailsCont.ParentIdSun, detailsCont.Id, receivedValue.Department, 3, targetCont.Type, 1)
syncSeting.Add(1)
go DepartAndReportAboutTarget(targetCont.Dimension, detailsCont.ParentId, detailsCont.ParentIdSun, detailsCont.Id, receivedValue.Department, receivedValue.Executor, 1, targetCont.Type, 3)
syncSeting.Wait()
publicmethod.Result(0, err, c)
}
/*
*
@ 作者: 秦东
@ 时间: 2023-02-18 13:00:31
@ 功能: 根据栏目添加细则
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func (a *ApiMethod) TableAddDetailses(c *gin.Context) {
var receivedValue TableAddDetaCont
err := c.ShouldBindJSON(&receivedValue)
if err != nil {
publicmethod.Result(100, err, c)
return
}
if receivedValue.TargetId == "" {
publicmethod.Result(1, receivedValue, c, "未知指标!请指定该细则归属指标")
return
}
if receivedValue.TableiId == "" {
publicmethod.Result(1, receivedValue, c, "未知栏目!请指定栏目!")
return
}
if len(receivedValue.DetailsList) < 1 {
publicmethod.Result(1, receivedValue, c, "没有细则内容提交!请输入至少一条细则内容!")
return
}
writeIsTrue := false
//验证细则内容
for _, v := range receivedValue.DetailsList {
if v.Title == "" {
writeIsTrue = true
}
if v.Standard == "" {
writeIsTrue = true
} else {
scoreAry := strings.Split(v.Standard, "-")
if len(scoreAry) < 1 {
writeIsTrue = true
}
}
if v.Unit == "" {
writeIsTrue = true
}
if v.Types == 0 {
writeIsTrue = true
}
if len(v.InspeMethod) < 1 {
writeIsTrue = true
}
if len(v.Department) < 1 {
writeIsTrue = true
}
if len(v.Executor) < 1 {
writeIsTrue = true
}
}
if writeIsTrue {
publicmethod.Result(1, receivedValue, c, "至少一条考核细则内容填写不符合规范!请检查并补充完成后,重新提交!")
return
}
// tragetId, _ := strconv.ParseInt(receivedValue.TargetId, 10, 64)
//获取指标内容
var targetCont modelskpi.EvaluationTarget
err = targetCont.GetCont(map[string]interface{}{"`et_id`": receivedValue.TargetId}, "`et_id`", "`et_type`", "`et_dimension`")
if err != nil {
publicmethod.Result(1, err, c, "没有此指标!")
return
}
//
var tableInfo modelskpi.QualitativeTarget
err = tableInfo.GetCont(map[string]interface{}{"`q_id`": receivedValue.TableiId}, "`q_id`", "`q_state`")
if err != nil {
publicmethod.Result(1, err, c, "没有此指标!")
return
}
if tableInfo.State != 1 {
var editTableInfo modelskpi.QualitativeTarget
editTableInfo.EiteCont(map[string]interface{}{"`q_id`": receivedValue.TableiId}, map[string]interface{}{"`q_state`": 1, "`q_time`": time.Now().Unix()})
}
for _, v := range receivedValue.DetailsList {
var insetDeatilsCont modelskpi.DetailedTarget
insetDeatilsCont.Title = v.Title //指标细则"`
insetDeatilsCont.Content = v.Remarks //指标说明"`
insetDeatilsCont.ParentId = targetCont.Id //归属指标栏目"`
insetDeatilsCont.ParentIdSun = tableInfo.Id //归属指标子栏目"`
insetDeatilsCont.State = 1 //状态(1:启用;2:禁用;3:删除)"`
insetDeatilsCont.AddTime = time.Now().Unix() //制定时间"`
insetDeatilsCont.MinScore, insetDeatilsCont.MaxScore = SplitCriteria(v.Standard) //最小分*100保存"`,最大分*100保存"`
insetDeatilsCont.Company = v.Unit //单位"`
insetDeatilsCont.AddReduce = v.Types //1:减少;2:增加;3:无属性,现场确认加或减"`
insetDeatilsCont.CensorType = strings.Join(v.InspeMethod, ",") //检查方式"`
insetDeatilsCont.CensorCont = v.Evidence //检查依据"`
insetDeatilsCont.CensorRate = v.Frequency //检查频次"`
insetDeatilsCont.Cycles = v.Cycle //1:班;2:天;3:周;4:月;5:季度;6:年"`
insetDeatilsCont.CycleAttres = 1 //辅助计数"`
insetDeatilsCont.Paretment = strings.Join(v.Department, ",") //接受考核的部门"`
insetDeatilsCont.Reportary = strings.Join(v.Executor, ",") //提报人"`
// insetContList = append(insetContList, insetDeatilsCont)
addErr := overall.CONSTANT_DB_KPI.Create(&insetDeatilsCont).Error
if addErr == nil {
syncSeting.Add(1)
go DepartAboutTarget(targetCont.Dimension, targetCont.Id, tableInfo.Id, insetDeatilsCont.Id, v.Department, 3, targetCont.Type, 1)
syncSeting.Add(1)
go DepartAndReportAboutTarget(targetCont.Dimension, targetCont.Id, tableInfo.Id, insetDeatilsCont.Id, v.Department, v.Executor, 1, targetCont.Type, 3)
}
}
syncSeting.Wait()
publicmethod.Result(0, err, c)
}
/*
*
@ 作者: 秦东
@ 时间: 2023-02-18 13:53:23
@ 功能: 修改栏目名称及关联岗位和提报人
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func (a *ApiMethod) EditTableContAndDepartOfMan(c *gin.Context) {
var receivedValue EditTableInfo
err := c.ShouldBindJSON(&receivedValue)
if err != nil {
publicmethod.Result(100, err, c)
return
}
if receivedValue.Id == "" {
publicmethod.Result(1, receivedValue, c, "未知指标!请指定该细则归属指标")
return
}
//获取栏目内容
var targetTableCont modelskpi.QualitativeTarget
err = targetTableCont.GetCont(map[string]interface{}{"`q_id`": receivedValue.Id})
if err != nil {
publicmethod.Result(1, err, c, "没有此栏目!")
return
}
//获取指标内容
var targetCont modelskpi.EvaluationTarget
err = targetCont.GetCont(map[string]interface{}{"`et_id`": targetTableCont.ParentId})
if err != nil {
publicmethod.Result(1, err, c, "没有此指标!")
return
}
editSaveData := publicmethod.MapOut[string]()
if receivedValue.Title != "" && receivedValue.Title != targetTableCont.Title {
editSaveData["q_title"] = receivedValue.Title
}
if len(receivedValue.Departmentint) > 0 {
departStr := strings.Join(receivedValue.Departmentint, ",")
if departStr != targetTableCont.Depart {
editSaveData["q_depart"] = departStr
}
syncSeting.Add(1)
go DepartAboutTarget(targetCont.Dimension, targetTableCont.ParentId, targetTableCont.Id, 0, receivedValue.Departmentint, 2, targetCont.Type, 1)
}
if len(receivedValue.UserList) > 0 {
syncSeting.Add(1)
go DepartAndReportAboutTarget(targetCont.Dimension, targetTableCont.ParentId, targetTableCont.Id, 0, receivedValue.Departmentint, receivedValue.UserList, 1, targetCont.Type, 2)
}
if len(editSaveData) > 0 {
editSaveData["q_time"] = time.Now().Unix()
var editTargetCont modelskpi.QualitativeTarget
editTargetCont.EiteCont(map[string]interface{}{"`q_id`": receivedValue.Id}, editSaveData)
}
//该栏目的所有细则
var bylawsId []int64
err = overall.CONSTANT_DB_KPI.Model(&modelskpi.DetailedTarget{}).Select("dt_id").Where("`dt_parentid` = ? AND `dt_parentid_sun` = ?", targetTableCont.ParentId, targetTableCont.Id).Find(&bylawsId).Error
if err == nil && len(bylawsId) > 0 {
for _, v := range bylawsId {
syncSeting.Add(1)
go DepartAboutTarget(targetCont.Dimension, targetTableCont.ParentId, targetTableCont.Id, v, receivedValue.Departmentint, 3, targetCont.Type, 1)
syncSeting.Add(1)
go DepartAndReportAboutTarget(targetCont.Dimension, targetTableCont.ParentId, targetTableCont.Id, v, receivedValue.Departmentint, receivedValue.UserList, 1, targetCont.Type, 3)
}
}
syncSeting.Wait()
publicmethod.Result(0, err, c)
}

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

@ -1130,8 +1130,8 @@ func (a *ApiMethod) GetDepartmentTragetContList(c *gin.Context) {
if receivedValue.ReportPerson != "" {
gormDb = gormDb.Joins("LEFT JOIN `target_report` `tr` on tr.target_id = dt.dt_parentid AND tr.target_sun_id = dt.dt_parentid_sun AND tr.target_bylaws = dt.dt_id").Where("tr.man_key = ?", receivedValue.ReportPerson)
}
if receivedValue.Cycle != 0 {
gormDb = gormDb.Where("dt.dt_cycle = ?", receivedValue.Cycle)
if receivedValue.Censorrate != 0 {
gormDb = gormDb.Where("dt.dt_cycle = ?", receivedValue.Censorrate)
}
if receivedValue.TargetSunId != "" {
gormDb = gormDb.Where("dt.dt_parentid_sun = ?", receivedValue.TargetSunId)
@ -1142,6 +1142,7 @@ func (a *ApiMethod) GetDepartmentTragetContList(c *gin.Context) {
publicmethod.Result(107, receivedValue, c)
return
}
// return
var total int64
totalErr := gormDb.Select("dt_id").Count(&total).Error
if totalErr != nil {
@ -1509,10 +1510,10 @@ func (a *ApiMethod) GetSonTargetCont(c *gin.Context) {
}
//获取关联部门
var targetAboutDepartnebt []int64
overall.CONSTANT_DB_KPI.Model(&modelskpi.TargetDepartment{}).Distinct("department_id").Where("`state` = 1 AND `level` = 1 AND `target_id` = ? AND `target_sun_id` = ?", sonTargetCont.ParentId, receivedValue.Id).Find(&targetAboutDepartnebt)
overall.CONSTANT_DB_KPI.Model(&modelskpi.TargetDepartment{}).Distinct("department_id").Where("`state` = 1 AND `type` = 2 AND `level` = 1 AND `target_bylaws` = 0 AND `target_id` = ? AND `target_sun_id` = ?", sonTargetCont.ParentId, receivedValue.Id).Find(&targetAboutDepartnebt)
//获取关联提报人
var targetAboutReport []int64
overall.CONSTANT_DB_KPI.Model(&modelskpi.TargetReport{}).Distinct("man_key").Where("`state` = 1 AND `type` = 1 AND `target_id` = ? AND `target_sun_id` = ?", sonTargetCont.ParentId, receivedValue.Id).Find(&targetAboutReport)
overall.CONSTANT_DB_KPI.Model(&modelskpi.TargetReport{}).Distinct("man_key").Where("`state` = 1 AND `type_level` = 2 AND `type` = 1 AND `target_bylaws` = 2 AND `target_id` = ? AND `target_sun_id` = ?", sonTargetCont.ParentId, receivedValue.Id).Find(&targetAboutReport)
//部门列表
var departContList []modelshr.AdministrativeOrganization
overall.CONSTANT_DB_HR.Model(&modelshr.AdministrativeOrganization{}).Select("`id`,`name`").Where("`id` IN ?", targetAboutDepartnebt).Find(&departContList)
@ -1634,26 +1635,27 @@ func (a *ApiMethod) GetOneDetailedTarget(c *gin.Context) {
outDataCont.Title = detailedTargetCont.Title //考核内容
outDataCont.Content = detailedTargetCont.Content //备注说明
outDataCont.Unit = detailedTargetCont.Company //单位
// outDataCont.Frequency = detailedTargetCont.CensorRate
biaoZhun := ""
if detailedTargetCont.MinScore != 0 {
biaoZhun = fmt.Sprintf("%v-%v", detailedTargetCont.MinScore, detailedTargetCont.MaxScore)
biaoZhun = fmt.Sprintf("%v-%v", float64(detailedTargetCont.MinScore)/100, float64(detailedTargetCont.MaxScore)/100)
} else {
biaoZhun = fmt.Sprintf("%v", detailedTargetCont.MaxScore)
}
outDataCont.ReferenceScore = biaoZhun //考核标准
outDataCont.Cycles = detailedTargetCont.Cycles //1:班;2:天;3:周;4:月;5:季度;6:年
outDataCont.CycleAttres = detailedTargetCont.CycleAttres //辅助计数
outDataCont.Operator, outDataCont.ReportManList, _ = getDetailedReport(detailedTargetCont.ParentId, detailedTargetCont.ParentIdSun, detailedTargetCont.Id, 1) //考核执行人
outDataCont.AddOrReduce = detailedTargetCont.AddReduce //操作类型 1:减少;2:增加;3:用户自定义
outDataCont.CensorType = strings.Split(detailedTargetCont.CensorType, ",") //检查方式(1:现场检查;2:资料检查;3:事件触发)
outDataCont.CensorCont = detailedTargetCont.CensorCont //客观证据
outDataCont.CensorRate = detailedTargetCont.CensorRate //检查频次
outDataCont.DepartmentList, _, _ = getDetailedDepartment(detailedTargetCont.ParentId, detailedTargetCont.ParentIdSun, detailedTargetCont.Id, 1) //接受考核的部门
biaoZhun = fmt.Sprintf("%v", float64(detailedTargetCont.MaxScore)/100)
}
outDataCont.ReferenceScore = biaoZhun //考核标准
outDataCont.Cycles = detailedTargetCont.Cycles //1:班;2:天;3:周;4:月;5:季度;6:年
outDataCont.CycleAttres = detailedTargetCont.CycleAttres //辅助计数
outDataCont.Operator, outDataCont.ReportManList, _ = getDetailedReport(detailedTargetCont.ParentId, detailedTargetCont.ParentIdSun, detailedTargetCont.Id, 1) //考核执行人
outDataCont.AddOrReduce = detailedTargetCont.AddReduce //操作类型 1:减少;2:增加;3:用户自定义
outDataCont.CensorType = strings.Split(detailedTargetCont.CensorType, ",") //检查方式(1:现场检查;2:资料检查;3:事件触发)
outDataCont.CensorCont = detailedTargetCont.CensorCont //客观证据
outDataCont.CensorRate = detailedTargetCont.CensorRate //检查频次
outDataCont.DepartmentList, outDataCont.DepartmentIdList, _, _ = getDetailedDepartment(detailedTargetCont.ParentId, detailedTargetCont.ParentIdSun, detailedTargetCont.Id, 1) //接受考核的部门
publicmethod.Result(0, outDataCont, c)
}
// 获取指标细则接受考核部门
func getDetailedDepartment(targetId, targetSunId, bylawsId int64, class int) (departmentStr []string, departmentInfo []departOutcome, err error) {
func getDetailedDepartment(targetId, targetSunId, bylawsId int64, class int) (departmentStr []string, departmentInt []int64, departmentInfo []departOutcome, err error) {
if class == 0 {
class = 1
}
@ -1684,6 +1686,7 @@ func getDetailedDepartment(targetId, targetSunId, bylawsId int64, class int) (de
departCont.Ispower = v.IsPower //是否为主部门
departmentStr = append(departmentStr, departIdStr)
departmentInfo = append(departmentInfo, departCont)
departmentInt = append(departmentInt, v.Id)
}
}
return
@ -1700,7 +1703,7 @@ func getDetailedReport(targetId, targetSunId, bylawsId int64, class int) (userKe
return
}
var userContList []modelshr.PersonArchives
gormDb := overall.CONSTANT_DB_HR.Model(&modelshr.PersonArchives{}).Select("`id`,`number`,`name`,`icon`,`company`,`maindeparment`")
gormDb := overall.CONSTANT_DB_HR.Model(&modelshr.PersonArchives{}).Select("`id`,`number`,`name`,`icon`,`company`,`maindeparment`,`key`")
if len(userKeyInt) > 1 {
gormDb = gormDb.Where("`key` IN ?", userKeyInt)
} else {
@ -1711,10 +1714,11 @@ func getDetailedReport(targetId, targetSunId, bylawsId int64, class int) (userKe
return
}
for _, v := range userContList {
userKeyStr := strconv.FormatInt(v.Id, 10)
userKeyStr := strconv.FormatInt(v.Key, 10)
if publicmethod.IsInTrue[string](userKeyStr, userKey) == false {
var userInfo printReportCont
userInfo.Id = userKeyStr
userInfo.Id = strconv.FormatInt(v.Id, 10)
userInfo.Key = userKeyStr
userInfo.Name = v.Name
var groupCont modelshr.AdministrativeOrganization
groupCont.GetCont(map[string]interface{}{"`id`": v.Company}, "`name`")
@ -1875,7 +1879,11 @@ func (a *ApiMethod) AddDepartmentTarget(c *gin.Context) {
receivedValue.Nature = 1
}
if receivedValue.Share == 0 {
receivedValue.Share = 1
if len(receivedValue.AcceptDepartmentId) > 0 {
receivedValue.Share = 2
} else {
receivedValue.Share = 1
}
} else {
if receivedValue.Share > 1 {
if len(receivedValue.AcceptDepartmentId) < 1 {
@ -2817,3 +2825,142 @@ func JudgeSunTargetAbout(targetId, sunTargetTitle string, saveData modelskpi.Qua
return
}
/*
*
@ 作者: 秦东
@ 时间: 2023-02-07 13:33:08
@ 功能: 部门指标列表
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func (a *ApiMethod) NewDepartmentTargetList(c *gin.Context) {
var receivedValue NewDepartTarList
c.ShouldBindJSON(&receivedValue)
if receivedValue.Page == 0 {
receivedValue.Page = 1
}
if receivedValue.PageSize == 0 {
receivedValue.PageSize = 15
}
var targetCont modelskpi.EvaluationTarget
// gormDb := overall.CONSTANT_DB_KPI.Table("? AS et", targetCont.TableName()).Where("et.`et_state` BETWEEN 1 AND 2")
gormDb := overall.CONSTANT_DB_KPI.Table(fmt.Sprintf("%s et", targetCont.TableName())).Where("et.`et_state` BETWEEN 1 AND 2")
if receivedValue.Name != "" {
gormDb = gormDb.Where("et.`et_title` LIKE ?", "%"+receivedValue.Name+"%")
}
if receivedValue.Dimension != "" {
gormDb = gormDb.Where("et.`et_dimension` = ?", receivedValue.Dimension)
}
if receivedValue.Attribute != "" {
gormDb = gormDb.Where("et.`et_type` = ?", receivedValue.Attribute)
}
if len(receivedValue.OrgIdList) > 0 {
// var tarDepartCont modelskpi.TargetDepartment
// gormDb = gormDb.Where("(?)", overall.CONSTANT_DB_KPI.Table(fmt.Sprintf("%s td", tarDepartCont.TableName())).Select("`id`").Where("et.et_dimension = td.dimension_id AND et.et_id = td.target_id AND td.target_sun_id = 0 AND td.target_bylaws = 0 AND td.`type` = 1 AND td.`post_id` = 0 AND td.state = 1 AND td.level = 1 AND td.`department_id` IN ?", receivedValue.OrgIdList).Limit(1))
gormDb = gormDb.Joins("JOIN target_department td ON et.et_id = td.target_id AND td.target_sun_id = 0 AND td.target_bylaws = 0 AND td.`type` = 1 AND td.`post_id` = 0 AND td.state = 1 AND td.level = 1 AND td.`department_id` IN ?", receivedValue.OrgIdList)
}
var total int64
gormDbTotal := gormDb.Distinct("et_id")
totalErr := gormDbTotal.Count(&total).Error
if totalErr != nil {
total = 0
}
var targetIdAry []int64
gormDb = gormDb.Distinct("et_id")
gormDb = publicmethod.PageTurningSettings(gormDb, receivedValue.Page, receivedValue.PageSize)
err := gormDb.Order("`et_id` DESC").Find(&targetIdAry).Error
if err != nil || len(targetIdAry) < 1 {
publicmethod.Result(105, err, c)
return
}
var departmentTargetList []modelskpi.EvaluationTarget
err = overall.CONSTANT_DB_KPI.Model(&modelskpi.EvaluationTarget{}).Where("et_id IN ?", targetIdAry).Order("`et_id` DESC").Find(&departmentTargetList).Error
if err != nil {
publicmethod.Result(105, err, c)
return
}
var targetList []printDepartmentTarget
for _, v := range departmentTargetList {
var targetCont printDepartmentTarget
targetCont.Id = v.Id
targetCont.Title = v.Title //指标名称"`
targetCont.Type = v.Type //1:定性考核;2:定量考核"`
targetCont.State = v.State //状态(1:启用;2:禁用;3:删除)"`
targetCont.AddTime = v.AddTime //制定时间"`
targetCont.Share = v.Share //1:共用;2:私用"`
targetCont.RelevantDepartments = v.RelevantDepartments //相关部门"`
targetCont.Dimension = v.Dimension //维度"`
targetCont.Key = v.Key //UUID"`
targetCont.Report = v.Report //上报人"`
targetCont.Uniteing = v.Uniteing //计量单位"`
targetCont.Cycles = v.Cycles //1:班;2:天;3:周;4:月;5:季度;6:年"`
targetCont.CycleAttres = v.CycleAttres //辅助计数"`
targetCont.VisibleRange = v.VisibleRange //可见范围"`
targetCont.VisibleRangeGroup = v.VisibleRangeGroup //可见范围(集团)"`
targetCont.ScoringMethod = v.ScoringMethod //计分方式(1:自动;2:手动)"`
targetCont.Relevantdepartmentsmap = GetTargetAboutDepart(v)
targetCont.Reportmap = GetTargetAboutReport(v)
targetCont.DimensionStr = strconv.FormatInt(v.Dimension, 10)
targetCont.KeyStr = strconv.FormatInt(v.Key, 10)
var dutyClassCont modelskpi.DutyClass
dutyClassCont.GetCont(map[string]interface{}{"`id`": v.Dimension}, "`title`")
targetCont.DimensionTitle = dutyClassCont.Title
targetList = append(targetList, targetCont)
}
publicmethod.ResultList(0, receivedValue.Page, receivedValue.PageSize, total, int64(len(targetList)), targetList, c)
}
// 获取相关部门信息
func GetTargetAboutDepart(targetCont modelskpi.EvaluationTarget) (orgList []publicWordKey) {
var orgId []int64
err := overall.CONSTANT_DB_KPI.Model(&modelskpi.TargetDepartment{}).Distinct("department_id").Where("`state` = 1 AND `dimension_id` = ? AND `target_id` = ? AND `target_sun_id` = 0 AND `target_bylaws` = 0 AND `type` = 1 AND `post_id` = 0 AND `level` = 1 AND `class` = ?", targetCont.Dimension, targetCont.Id, targetCont.Type).Find(&orgId).Error
if err == nil && len(orgId) > 0 {
var orgListCont []modelshr.AdministrativeOrganization
err := overall.CONSTANT_DB_HR.Model(&modelshr.AdministrativeOrganization{}).Select("`id`,`number`,`name`").Where("`state` = 1 AND `id` IN ?", orgId).Find(&orgListCont).Error
if err == nil {
for _, v := range orgListCont {
var orgCont publicWordKey
orgCont.Key = strconv.FormatInt(v.Id, 10)
orgCont.Number = v.Number
orgCont.Title = v.Name
orgList = append(orgList, orgCont)
}
}
}
return
}
// 获取相关提报人信息
func GetTargetAboutReport(targetCont modelskpi.EvaluationTarget) (orgList []publicWordKey) {
var userId []int64
err := overall.CONSTANT_DB_KPI.Model(&modelskpi.TargetReport{}).Distinct("man_key").Where("`state` = 1 AND `dimension_id` = ? AND `target_id` = ? AND `target_sun_id` = 0 AND `target_bylaws` = 0 AND `type` = 1 AND `post_id` = 0 AND `type_level` = 1 AND `class` = ?", targetCont.Dimension, targetCont.Id, targetCont.Type).Find(&userId).Error
if err == nil && len(userId) > 0 {
var orgListCont []modelshr.PersonArchives
err := overall.CONSTANT_DB_HR.Model(&modelshr.PersonArchives{}).Select("`id`,`number`,`name`,`key`").Where("`emp_type` BETWEEN 1 AND 10 AND `key` IN ?", userId).Find(&orgListCont).Error
if err == nil {
for _, v := range orgListCont {
var orgCont publicWordKey
orgCont.Key = strconv.FormatInt(v.Key, 10)
orgCont.Number = v.Number
orgCont.Title = v.Name
orgList = append(orgList, orgCont)
}
}
}
return
}

141
api/version1/departmentseting/departmentpc/rulesmatrix.go

@ -134,3 +134,144 @@ func GetRulesDepartment(target, sonTarget, bylaws int64, level int) (orgId []int
// fmt.Printf("orgId----------->%v----------->%v\n", orgId, snedId)
return
}
/*
*
@ 作者: 秦东
@ 时间: 2023-02-13 15:17:31
@ 功能: 获取指定指标下的细则列表
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func (a *ApiMethod) GetTargetDetailsList(c *gin.Context) {
var receivedValue GetTarDetails
c.ShouldBindJSON(&receivedValue)
if receivedValue.TargetId == 0 {
publicmethod.Result(1, receivedValue, c, "未获取到指标ID!")
return
}
var idList []int64
var detCont modelskpi.DetailedTarget
gormDb := overall.CONSTANT_DB_KPI.Table(fmt.Sprintf("%s dt", detCont.TableName())).Distinct("dt.dt_id").Where("dt.dt_state BETWEEN 1 AND 2 AND dt.dt_parentid = ?", receivedValue.TargetId)
if receivedValue.Cycle != 0 {
gormDb = gormDb.Where("dt.`dt_cycle` = ?", receivedValue.Cycle)
}
if len(receivedValue.TestMethod) > 0 {
var sqlOrStr string
for ti, tv := range receivedValue.TestMethod {
if ti == 0 {
// gormDb = gormDb.Where("FIND_IN_SET(?,`dt_censor_type`)", tv)
sqlOrStr = fmt.Sprintf("FIND_IN_SET(%v,`dt_censor_type`)", tv)
} else {
// gormDb = gormDb.Or("FIND_IN_SET(?,`dt_censor_type`)", tv)
sqlOrStr = fmt.Sprintf("%v OR FIND_IN_SET(%v,`dt_censor_type`)", sqlOrStr, tv)
}
}
gormDb = gormDb.Where(sqlOrStr)
}
if len(receivedValue.OrgList) > 0 {
gormDb = gormDb.Joins("LEFT JOIN `target_department` `td` on td.target_id = dt.dt_parentid AND td.target_sun_id = dt.dt_parentid_sun AND td.target_bylaws = dt.dt_id").Where("td.`type` = 3 AND td.`state` BETWEEN 1 AND 2 AND td.`level` = 1 AND td.department_id IN ?", receivedValue.OrgList)
}
err := gormDb.Find(&idList).Error
if err != nil || len(idList) < 1 {
publicmethod.Result(107, err, c)
return
}
var listCont []modelskpi.DetailedTarget
err = overall.CONSTANT_DB_KPI.Where("`dt_id` IN ?", idList).Order("dt_parentid desc, dt_parentid_sun").Find(&listCont).Error
if err != nil || len(listCont) < 1 {
publicmethod.Result(107, err, c)
return
}
var sendListCont []outputTargetDetails
jishuqi := 1
var lastSunTable int64
for _, v := range listCont {
var sendCont outputTargetDetails
sendCont.Id = v.Id
sendCont.Title = v.Title //指标细则"`
sendCont.Content = v.Content //指标说明"`
sendCont.ParentId = v.ParentId //归属指标栏目"`
if lastSunTable != v.ParentIdSun {
lastSunTable = v.ParentIdSun
jishuqi = 1
} else {
jishuqi = jishuqi + 1
}
sendCont.JiBuQi = jishuqi
sendCont.ParentIdSun = v.ParentIdSun //归属指标子栏目"`
sendCont.State = v.State //状态(1:启用;2:禁用;3:删除)"`
sendCont.AddTime = v.AddTime //制定时间"`
sendCont.MinScore = v.MinScore //最小分*100保存"`
sendCont.MaxScore = v.MaxScore //最大分*100保存"`
sendCont.Company = v.Company //单位"`
sendCont.AddReduce = v.AddReduce //1:减少;2:增加;3:无属性,现场确认加或减"`
sendCont.CensorType = v.CensorType //检查方式"`
sendCont.CensorCont = v.CensorCont //检查依据"`
sendCont.CensorRate = v.CensorRate //检查频次"`
sendCont.Cycles = v.Cycles //1:班;2:天;3:周;4:月;5:季度;6:年"`
sendCont.CycleAttres = v.CycleAttres //辅助计数"`
sendCont.Paretment = v.Paretment //接受考核的部门"`
sendCont.Reportary = v.Reportary //提报人"`
var sonTargetCont modelskpi.QualitativeTarget
sonTargetCont.GetCont(map[string]interface{}{"q_id": v.ParentIdSun}, "q_title")
sendCont.ColumnName = sonTargetCont.Title
if v.MinScore != 0 && v.MaxScore != 0 {
minScoreFloat64 := publicmethod.DecimalEs(float64(v.MinScore)/100, 2)
maxScoreFloat64 := publicmethod.DecimalEs(float64(v.MaxScore)/100, 2)
sendCont.Standard = fmt.Sprintf("%v-%v", minScoreFloat64, maxScoreFloat64)
} else if v.MinScore == 0 && v.MaxScore != 0 {
maxScoreFloat64 := publicmethod.DecimalEs(float64(v.MaxScore)/100, 2)
sendCont.Standard = fmt.Sprintf("%v", maxScoreFloat64)
} else if v.MinScore != 0 && v.MaxScore == 0 {
minScoreFloat64 := publicmethod.DecimalEs(float64(v.MinScore)/100, 2)
sendCont.Standard = fmt.Sprintf("%v", minScoreFloat64)
} else {
sendCont.Standard = "0"
}
sendListCont = append(sendListCont, sendCont)
}
publicmethod.Result(0, sendListCont, c)
}
/*
*
@ 作者: 秦东
@ 时间: 2023-02-15 11:38:24
@ 功能:
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func (a *ApiMethod) GetTargetColumnList(c *gin.Context) {
var receivedValue publicmethod.PublicId
err := c.ShouldBindJSON(&receivedValue)
if err != nil || receivedValue.Id == "" {
publicmethod.Result(100, receivedValue, c)
return
}
var columnContList []modelskpi.QualitativeTarget
err = overall.CONSTANT_DB_KPI.Where("`q_state` = 1 AND `q_parent_id` = ?", receivedValue.Id).Find(&columnContList).Error
if err != nil {
publicmethod.Result(107, err, c)
return
}
publicmethod.Result(0, columnContList, c)
}

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

@ -36,7 +36,11 @@ type departListQuery struct {
// 输出部门指标列表
type printDepartmentTarget struct {
modelskpi.EvaluationTarget
DimensionTitle string `json:"dimensiontitle"` //维度名称
DimensionTitle string `json:"dimensiontitle"` //维度名称
Relevantdepartmentsmap []publicWordKey `json:"relevantdepartmentsmap"` //关联部门
Reportmap []publicWordKey `json:"reportmap"` //提报人
DimensionStr string `json:"dimensionstr"` //维度
KeyStr string `json:"keystr"`
}
// 输出指标已经关联的部门
@ -102,10 +106,11 @@ type QualEvalSunList struct {
type getDepartTargetContType struct {
publicmethod.PagesTurn
TargetId string `json:"targetid"` //指标ID
DepartmentId string `json:"departmentid"` //部门ID
DepartmentId string `json:"departid"` //部门ID
ReportPerson string `json:"reportperson"` //上报人
Cycle int `json:"cycle"` //1:班;2:天;3:周;4:月;5:季度;6:年
TargetSunId string `json:"targetsunid"` //考核子栏目
// Cycle int `json:"cycle"` //1:班;2:天;3:周;4:月;5:季度;6:年
TargetSunId string `json:"targetsunid"` //考核子栏目
Censorrate int `json:"censorrate"` //周期1:班;2:天;3:周;4:月;5:季度;6:年
}
// 输出定性指标详细内容列表
@ -155,8 +160,9 @@ type outCont struct {
type NewOutPutDetailedTarget struct {
publicmethod.PublicId
QualEvalSunList
ReportManList []printReportCont `json:"reportmanlist"` //上报人
DepartmentList []string `json:"departmentlist"` //接受考核的部门
ReportManList []printReportCont `json:"reportmanlist"` //上报人
DepartmentList []string `json:"departmentlist"` //接受考核的部门
DepartmentIdList []int64 `json:"departmentidlist"` //接受考核的部门
}
// 修改单一指标细则内容提交参数
@ -196,7 +202,8 @@ type depTarAboutPost struct {
// 循环体
type LoopStruct struct {
publicmethod.PublicId
Child []LoopStruct `json:"child"`
Child []LoopStruct `json:"child"`
ChildCopy []string `json:"childcopy"`
}
// 定性指标细则与部门矩阵参数
@ -359,3 +366,106 @@ type QualEvalArrt struct {
Id string `json:"id"`
Name string `json:"name"`
}
// 新版部门指标列表
type NewDepartTarList struct {
publicmethod.PagesTurn
publicmethod.PublicName //指标名称
Dimension string `json:"dimension"` //维度
Attribute string `json:"attribute"` //性质 1:定性指标;2:定量指标
OrgIdList []string `json:"orgidlist"` //行政组织列表
}
// 通用指端
type publicWordKey struct {
Key string `json:"key"`
Number string `json:"number"`
Title string `json:"title"`
}
// 部门指标关联岗位
type depTarAboutPostEs struct {
publicmethod.PublicId
OrgList []LoopStructEs `json:"orglist"`
}
// 循环体
type LoopStructEs struct {
Id string `json:"id"`
Name string `json:"name"`
Number string `json:"number"`
Child []LoopStructEs `json:"child"`
ChildCopy []string `json:"childcopy"`
}
// 根据指标获取指标细则
type GetTarDetails struct {
TargetId int64 `json:"targetid"`
OrgList []int64 `json:"orglist` //行政组织
TestMethod []string `json:"testmethod"` //检查方式(1:现场检查;2:资料检查;3:事件触发)
Cycle int `json:"cycle"` //1:班;2:天;3:周;4:月;5:季度;6:年;7:半年
}
// 考核细则输出
type outputTargetDetails struct {
modelskpi.DetailedTarget
ColumnName string `json:"columnname"`
Standard string `json:"standard"` //考核标准
JiBuQi int `json:"jibuqi"` //记不起
}
/*
新版指标细则处理过程相关切片
*/
type NewDetailsCont struct {
TargetId string `json:"targetid"` //指标ID
TableName string `json:"tablename"` //栏目名称
TargetOrgList []publicWordKey `json:"targetorglist"` //指标行政组织
DetailsList []DetailsListCont `json:"detailslist"` //细则列表
}
// 细则结构体
type DetailsListCont struct {
Title string `json:"title"` //考核内容
Standard string `json:"standard"` //考核标准
Unit string `json:"unit"` //单位
Types int `json:"types"` //操作类型(1:减分;2:加分;3:加减分)
InspeMethod []string `json:"inspemethod"` //检查方式(1:现场检查;2:资料审查;3:事件触发)
Cycle int `json:"cycle"` //检查周期1:班;2:天;3:周;4:月;5:季度;6:年;7:半年
Frequency int `json:"frequency"` //检查频率
Evidence string `json:"evidence"` //检查依据
Remarks string `json:"remarks"` //备注说明
Department []string `json:"department"` //被考核部门
Executor []string `json:"executor"` //执行人
}
// 统一关联数据基本信息
type UnifiedRelation struct {
DimensionId int64 `json:"dimensionid"`
TargetId int64 `json:"targetid"`
TableId int64 `json:"tableid"`
DibylawsId int64 `json:"bylawsid"`
Department []string `json:"department"` //被考核部门
Executor []string `json:"executor"` //执行人
}
// 编辑单一指标细则内容
type EditOneDetailsCont struct {
publicmethod.PublicId
DetailsListCont
}
// 根据栏目添加细则
type TableAddDetaCont struct {
TargetId string `json:"targetid"` //指标id
TableiId string `json:"tableid"` //栏目Id
DetailsList []DetailsListCont `detailslist` //细则列表
}
// 修改栏目信息
type EditTableInfo struct {
publicmethod.PublicId
Title string `json:"title"` //栏目名称
Departmentint []string `json:"departmentint"` //关联部门
UserList []string `json:"userlist"` //执行人
}

2
api/version1/empower/system_license.go

@ -25,7 +25,7 @@ func (a *ApiMethod) ObtainAuthorization(c *gin.Context) {
publicmethod.Result(1, err, c, "未知身份!不可授权!")
return
}
// jsonStr, _ := json.Marshal(receivedValue)
// jsonStr, _ := json.Marshal(context)
// fmt.Printf("jsonStr------>%v\n", string(jsonStr))
// menuIdAry, menuUrl, err := publicmethod.GetPostPower(context.AdminOrg, context.Position, receivedValue.System)
_, pointId, operation, _ := publicmethod.GetNewAccredit(receivedValue.System, context.Role, context.Key, context.AdminOrg, context.Position)

889
api/version1/postseting/postpc/details.go

@ -0,0 +1,889 @@
package postpc
import (
"fmt"
"key_performance_indicators/api/version1/departmentseting/departmentpc"
"key_performance_indicators/models/modelshr"
"key_performance_indicators/models/modelskpi"
"key_performance_indicators/overall"
"key_performance_indicators/overall/publicmethod"
"strconv"
"strings"
"time"
"github.com/gin-gonic/gin"
)
/*
*
@ 作者: 秦东
@ 时间: 2023-02-20 08:46:24
@ 功能: 根据指标获取细则列表
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func (a *ApiMethod) GetDetailsList(c *gin.Context) {
var receivedValue GetPostDetails
c.ShouldBindJSON(&receivedValue)
if receivedValue.TargetId == "" {
publicmethod.Result(1, receivedValue, c, "未知指标!请指定!")
return
}
var idList []int64
var detCont modelskpi.PostTargetDetails
gormDb := overall.CONSTANT_DB_KPI.Table(fmt.Sprintf("%s dt", detCont.TableName())).Distinct("dt.id").Where("dt.state BETWEEN 1 AND 2 AND dt.parentid = ?", receivedValue.TargetId)
if receivedValue.Cycle != 0 {
gormDb = gormDb.Where("dt.`cycle` = ?", receivedValue.Cycle)
}
if len(receivedValue.Inspect) > 0 {
var sqlOrStr string
for ti, tv := range receivedValue.Inspect {
if ti == 0 {
// gormDb = gormDb.Where("FIND_IN_SET(?,`dt_censor_type`)", tv)
sqlOrStr = fmt.Sprintf("FIND_IN_SET(%v,dt.`censor_type`)", tv)
} else {
// gormDb = gormDb.Or("FIND_IN_SET(?,`dt_censor_type`)", tv)
sqlOrStr = fmt.Sprintf("%v OR FIND_IN_SET(%v,dt.`censor_type`)", sqlOrStr, tv)
}
}
gormDb = gormDb.Where(sqlOrStr)
}
if len(receivedValue.PostList) > 0 {
gormDb = gormDb.Joins("LEFT JOIN `target_department` `td` on td.target_id = dt.parentid AND td.target_sun_id = dt.parentid_sun AND td.target_bylaws = dt.id").Where("td.`type` = 3 AND td.`state` BETWEEN 1 AND 2 AND td.`level` = 2 AND td.post_id IN ?", receivedValue.PostList)
}
err := gormDb.Find(&idList).Error
if err != nil || len(idList) < 1 {
publicmethod.Result(107, err, c)
return
}
var listCont []modelskpi.PostTargetDetails
err = overall.CONSTANT_DB_KPI.Where("`id` IN ?", idList).Order("parentid desc, parentid_sun").Find(&listCont).Error
if err != nil || len(listCont) < 1 {
publicmethod.Result(107, err, c)
return
}
var sendContList []OutPostDetailsCont
var lastSunTable int64
jishuqi := 1
for _, v := range listCont {
var sendCont OutPostDetailsCont
sendCont.Id = v.Id
sendCont.Title = v.Title //指标细则"`
sendCont.Content = v.Content //指标说明"`
sendCont.ParentId = v.ParentId //归属指标栏目"`
if lastSunTable != v.ParentIdSun {
lastSunTable = v.ParentIdSun
jishuqi = 1
} else {
jishuqi = jishuqi + 1
}
sendCont.JiBuQi = jishuqi
sendCont.ParentIdSun = v.ParentIdSun //归属指标子栏目"`
sendCont.State = v.State //状态(1:启用;2:禁用;3:删除)"`
sendCont.AddTime = v.AddTime //制定时间"`
sendCont.MinScore = v.MinScore //(最小分*100保存"`
sendCont.MaxScore = v.MaxScore //(最大分*100保存"`
sendCont.Company = v.Company //单位"`
sendCont.AddReduce = v.AddReduce //1:减少;2:增加;3:无属性,现场确认加或减"`
sendCont.CensorType = v.CensorType //检查方式"`
sendCont.CensorCont = v.CensorCont //检查依据"`
sendCont.CensorRate = v.CensorRate //检查频次"`
sendCont.Cycles = v.Cycles //1:班;2:天;3:周;4:月;5:季度;6:年"`
sendCont.CycleAttres = v.CycleAttres //辅助计数"`
sendCont.Paretment = v.Paretment //接受考核的部门"`
sendCont.ParetmentPost = v.ParetmentPost //接受考核的部门岗位"`
sendCont.Reportary = v.Reportary //提报人"`
sendCont.Punishmode = v.Punishmode //(处罚方式 1:扣分;2:现金处罚;3:扣分加现金"`
sendCont.Maxmoney = v.Maxmoney //最高罚款"`
sendCont.Minmoney = v.Minmoney //最低罚款"`
if v.MinScore != 0 && v.MaxScore != 0 {
sendCont.Standard = fmt.Sprintf("%v-%v", float64(v.MinScore)/100, float64(v.MaxScore)/100)
} else if v.MinScore == 0 && v.MaxScore != 0 {
sendCont.Standard = fmt.Sprintf("%v", float64(v.MaxScore)/100)
} else if v.MinScore != 0 && v.MaxScore == 0 {
sendCont.Standard = fmt.Sprintf("%v", float64(v.MinScore)/100)
} else {
sendCont.Standard = ""
}
if v.Minmoney != 0 && v.Maxmoney != 0 {
sendCont.Forfeit = fmt.Sprintf("%v-%v元", float64(v.Minmoney)/100, float64(v.Maxmoney)/100)
} else if v.Minmoney == 0 && v.Maxmoney != 0 {
sendCont.Forfeit = fmt.Sprintf("%v元", float64(v.Maxmoney)/100)
} else if v.Minmoney != 0 && v.Maxmoney == 0 {
sendCont.Forfeit = fmt.Sprintf("%v元", float64(v.Minmoney)/100)
} else {
sendCont.Forfeit = ""
}
var sonTargetCont modelskpi.PostSonTarget
sonTargetCont.GetCont(map[string]interface{}{"id": v.ParentIdSun}, "title")
sendCont.ColumnName = sonTargetCont.Title
sendContList = append(sendContList, sendCont)
}
publicmethod.Result(0, sendContList, c)
}
/*
*
@ 作者: 秦东
@ 时间: 2023-02-20 14:37:30
@ 功能: 获取岗位指标关联部门相关岗位及提报人(新版)
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func (a *ApiMethod) GetNewTargetAboutDepartToPostMan(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 postTargetCont modelskpi.PostTarget
err = postTargetCont.GetCont(map[string]interface{}{"`id`": receivedValue.Id})
if err != nil {
publicmethod.Result(107, err, c)
return
}
//获取指标关联的岗位
// var postId []int64
// err = overall.CONSTANT_DB_KPI.Model(&modelskpi.TargetDepartment{}).Distinct("`post_id`").Where("`state` = 1 AND `type` = 1 AND `level` = 2 AND `target_id` = ? AND `target_sun_id` = 0 AND `target_bylaws` = 0", postTargetCont.Id).Find(&postId).Error
// if err != nil && len(postId) < 1 {
// publicmethod.Result(107, err, c)
// return
// }
// var orgId []int64
// err = overall.CONSTANT_DB_KPI.Model(&modelskpi.TargetDepartment{}).Distinct("`department_id`").Where("`state` = 1 AND `type` = 1 AND `level` = 2 AND `target_id` = ? AND `target_sun_id` = 0 AND `target_bylaws` = 0", postTargetCont.Id).Find(&orgId).Error
// if err != nil && len(orgId) < 1 {
// publicmethod.Result(107, err, c)
// return
// }
var sendCont OutTargetDepatPostMan
var tarDepatContList []modelskpi.TargetDepartment
err = overall.CONSTANT_DB_KPI.Model(&modelskpi.TargetDepartment{}).Select("`department_id`,`post_id`").Where("`state` = 1 AND `type` = 1 AND `level` = 2 AND `target_id` = ? AND `target_sun_id` = 0 AND `target_bylaws` = 0", postTargetCont.Id).Find(&tarDepatContList).Error
if err != nil && len(tarDepatContList) < 1 {
publicmethod.Result(107, err, c)
return
}
for _, v := range tarDepatContList {
orgIdstr := strconv.FormatInt(v.DepartmentId, 10)
if publicmethod.IsInTrue[string](orgIdstr, sendCont.OrgId) == false {
sendCont.OrgId = append(sendCont.OrgId, orgIdstr)
}
postIdstr := strconv.FormatInt(v.PostId, 10)
if publicmethod.IsInTrue[string](postIdstr, sendCont.PostId) == false {
sendCont.PostId = append(sendCont.PostId, postIdstr)
}
var orgPostInfo OrgPostCont
orgPostInfo.Id = postIdstr
var postInfo modelshr.Position
postInfo.GetCont(map[string]interface{}{"`id`": v.PostId}, "`name`")
_, _, departmentId, sunDepartId, workShopId := publicmethod.GetOrgStructure(v.DepartmentId)
fmt.Printf("%v------->%v------->%v\n", departmentId, sunDepartId, workShopId)
if departmentId != 0 && sunDepartId != 0 && workShopId != 0 {
if departmentId != workShopId && sunDepartId != workShopId && departmentId != sunDepartId {
orgPostInfo.Name = fmt.Sprintf("%v/%v/%v/%v", getOrgCont(departmentId), getOrgCont(sunDepartId), getOrgCont(workShopId), postInfo.Name)
} else if departmentId != workShopId && sunDepartId != workShopId && departmentId == sunDepartId {
orgPostInfo.Name = fmt.Sprintf("%v/%v/%v", getOrgCont(departmentId), getOrgCont(sunDepartId), postInfo.Name)
} else {
orgPostInfo.Name = fmt.Sprintf("%v/%v", getOrgCont(departmentId), postInfo.Name)
}
} else if departmentId != 0 && sunDepartId != 0 && workShopId == 0 {
if departmentId != sunDepartId {
orgPostInfo.Name = fmt.Sprintf("%v/%v/%v", getOrgCont(departmentId), getOrgCont(sunDepartId), postInfo.Name)
} else {
orgPostInfo.Name = fmt.Sprintf("%v/%v", getOrgCont(departmentId), postInfo.Name)
}
} else {
orgPostInfo.Name = fmt.Sprintf("%v/%v", getOrgCont(departmentId), postInfo.Name)
}
orgPostInfo.KeyList, orgPostInfo.Child = GetReportAndAllDepartMan(postTargetCont.Id, 0, 0, 0, v.PostId, departmentId, 2, 1)
sendCont.OrgAndPostList = append(sendCont.OrgAndPostList, orgPostInfo)
}
publicmethod.Result(0, sendCont, c)
}
//获取提报人及本部门所有人
/*
#targetId 指标
#tableId 栏目
#detailsId 细则
#departId 行政组织
#postId 岗位
#mainDepart 主部门
#types 类型1公司级2部门级
#levels 1指标2子目标3细则
*/
func GetReportAndAllDepartMan(targetId, tableId, detailsId, departId, postId, mainDepart int64, types, levels int) (repostKey []string, departMan *[]OrgPostCont) {
gormDb := overall.CONSTANT_DB_KPI.Model(&modelskpi.TargetReport{}).Distinct("`man_key`").Where("`state` = 1 AND `target_id` = ? AND `target_sun_id` = ? AND `target_bylaws` = ?", targetId, tableId, detailsId)
if departId != 0 {
gormDb = gormDb.Where("department_id = ?", departId)
}
if postId != 0 {
gormDb = gormDb.Where("post_id = ?", postId)
}
err := gormDb.Find(&repostKey).Error
if err != nil {
}
var allOrgId []int64
allOrgId = publicmethod.GetDepartmentSun(mainDepart, allOrgId)
if publicmethod.IsInTrue[int64](mainDepart, allOrgId) == false {
allOrgId = append(allOrgId, mainDepart)
}
var manContList []modelshr.PersonArchives
err = overall.CONSTANT_DB_HR.Model(&modelshr.PersonArchives{}).Select("`id`,`number`,`name`,`key`").Where("`emp_type` BETWEEN 1 AND 10 AND `admin_org` IN ?", allOrgId).Find(&manContList).Error
if err == nil {
var allPeople []OrgPostCont
for _, v := range manContList {
var manCont OrgPostCont
manCont.Id = strconv.FormatInt(v.Key, 10)
manCont.Number = v.Number
manCont.Name = v.Name
allPeople = append(allPeople, manCont)
}
departMan = &allPeople
}
// fmt.Printf("allOrgId------------------->%v\n", manContList)
return
}
// 获取行政组织信息
func getOrgCont(id int64) (orgCont string) {
var orgInfo modelshr.AdministrativeOrganization
orgInfo.GetCont(map[string]interface{}{"`id`": id})
orgCont = orgInfo.Name
return
}
/*
*
@ 作者: 秦东
@ 时间: 2023-02-20 16:29:27
@ 功能: 根据指标获取岗位指标栏目
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func (a *ApiMethod) TableBasePostTarget(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 postTargetCont modelskpi.PostTarget
err = postTargetCont.GetCont(map[string]interface{}{"`id`": receivedValue.Id}, "`id`", "`title`")
if err != nil {
publicmethod.Result(107, err, c)
return
}
// var tableId []int64
// var detCont modelskpi.PostSonTarget
// err = overall.CONSTANT_DB_KPI..Table(fmt.Sprintf("%s dt", detCont.TableName())).Distinct("dt.`id`")
var postTableContList []modelskpi.PostSonTarget
err = overall.CONSTANT_DB_KPI.Where("`state` = 1 AND `parent_id` = ?", receivedValue.Id).Find(&postTableContList).Error
if err != nil {
publicmethod.Result(107, err, c)
return
}
publicmethod.Result(0, postTableContList, c)
}
/*
*
@ 作者: 秦东
@ 时间: 2023-02-21 13:36:36
@ 功能: 根据指标添加细则列表
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func (a *ApiMethod) AddDetailsList(c *gin.Context) {
var receivedValue AddPostDetails
c.ShouldBindJSON(&receivedValue)
if receivedValue.TargetId == "" {
publicmethod.Result(101, receivedValue, c)
return
}
if receivedValue.TableName == "" {
publicmethod.Result(1, receivedValue, c, "未知栏目!请选择或输入栏目!")
return
}
iswrite := true
if len(receivedValue.DetailsList) < 1 {
publicmethod.Result(1, receivedValue, c, "至少要有一条细则!")
return
} else {
for _, v := range receivedValue.DetailsList {
if v.Title == "" {
iswrite = false
break
}
switch v.PunishType {
case 2:
if v.CashStandard == "" {
iswrite = false
break
} else {
testInt := strings.Split(v.CashStandard, "-")
testLen := len(testInt)
_, oenErr := strconv.ParseFloat(testInt[0], 10)
if oenErr != nil {
iswrite = false
break
} else {
if testLen > 1 {
_, twoErr := strconv.ParseFloat(testInt[testLen-1], 10)
if twoErr != nil {
iswrite = false
break
}
}
}
}
case 3:
if v.CashStandard == "" || v.Standard == "" {
iswrite = false
break
} else {
testInt := strings.Split(v.CashStandard, "-")
testLen := len(testInt)
_, oenErr := strconv.ParseFloat(testInt[0], 10)
if oenErr != nil {
iswrite = false
break
} else {
if testLen > 1 {
_, twoErr := strconv.ParseFloat(testInt[testLen-1], 10)
if twoErr != nil {
iswrite = false
break
}
}
}
testIntTwo := strings.Split(v.Standard, "-")
testLenTwo := len(testIntTwo)
_, oenErrTwo := strconv.ParseFloat(testIntTwo[0], 10)
if oenErrTwo != nil {
iswrite = false
break
} else {
if testLenTwo > 1 {
_, twoErr := strconv.ParseFloat(testIntTwo[testLenTwo-1], 10)
if twoErr != nil {
iswrite = false
break
}
}
}
}
default:
if v.Standard == "" {
iswrite = false
break
} else {
testInt := strings.Split(v.Standard, "-")
testLen := len(testInt)
_, oenErr := strconv.ParseFloat(testInt[0], 10)
if oenErr != nil {
iswrite = false
break
} else {
if testLen > 1 {
_, twoErr := strconv.ParseFloat(testInt[testLen-1], 10)
if twoErr != nil {
iswrite = false
break
}
}
}
}
}
if len(v.Inspemethod) < 1 {
iswrite = false
break
}
}
}
if !iswrite {
publicmethod.Result(1, receivedValue, c, "至少有一条细则内容填写不规范!请检查!")
return
}
var targetCont modelskpi.PostTarget
err := targetCont.GetCont(map[string]interface{}{"`id`": receivedValue.TargetId})
if err != nil {
publicmethod.Result(1, receivedValue, c, "指标不存在!不允许添加细则内容!")
return
}
orgList, postList, manList, orgPost, orgPostMan := GetTargetBaseDepartMan(targetCont.Id)
tableId, err := EditPostTableCont(targetCont.Id, receivedValue.TableName)
if err != nil {
publicmethod.Result(1, receivedValue, c, "没有栏目信息!栏目添加失败!请重新提交!")
return
}
var tableDepartList []string
var tablePostList []string
var tableDepartPost []OrgAndPostCont
var tableDepartPostMan []OrgAndPostManCont
//处理岗位细则内容
for _, v := range receivedValue.DetailsList {
var targetDetailsInfo modelskpi.PostTargetDetails
targetDetailsInfo.Title = v.Title //指标细则"`
targetDetailsInfo.Content = v.Remarks //指标说明"`
targetDetailsInfo.ParentId = targetCont.Id //归属指标栏目"`
targetDetailsInfo.ParentIdSun = tableId //归属指标子栏目"`
targetDetailsInfo.State = 1 //状态(1:启用;2:禁用;3:删除)"`
targetDetailsInfo.AddTime = time.Now().Unix() //制定时间"`
targetDetailsInfo.MinScore, targetDetailsInfo.MaxScore = departmentpc.SplitCriteria(v.Standard) //最小分*100保存"` && 最大分*100保存"`
targetDetailsInfo.Company = v.Unit //单位"`
targetDetailsInfo.AddReduce = v.Types //1:减少;2:增加;3:无属性,现场确认加或减"`
targetDetailsInfo.CensorType = strings.Join(v.Inspemethod, ",") //检查方式"`
targetDetailsInfo.CensorCont = v.Evidence //检查依据"`
targetDetailsInfo.CensorRate = v.Frequency //检查频次"`
targetDetailsInfo.Cycles = v.Cycle //1:班;2:天;3:周;4:月;5:季度;6:年"`
targetDetailsInfo.CycleAttres = 1 //辅助计数"`
if len(v.PostandExport) > 0 {
orgList, postList, manList, orgPost, orgPostMan = HandleOrgOfPostReportRelation(v.PostandExport)
// orgListJson, _ := json.Marshal(orgList)
// postListJson, _ := json.Marshal(postList)
// manListJson, _ := json.Marshal(manList)
// orgPostJson, _ := json.Marshal(orgPost)
// orgPostManJson, _ := json.Marshal(orgPostMan)
// fmt.Printf("明细表关联关系--->%v--->%v--->%v--->%v--->%v\n", string(orgListJson), string(postListJson), string(manListJson), string(orgPostJson), string(orgPostManJson))
}
targetDetailsInfo.Paretment = strings.Join(orgList, ",") //接受考核的部门"`
targetDetailsInfo.ParetmentPost = strings.Join(postList, ",") //接受考核的部门岗位"`
targetDetailsInfo.Reportary = strings.Join(manList, ",") //提报人"`
targetDetailsInfo.Punishmode = v.PunishType //处罚方式 1:扣分;2:现金处罚;3:扣分加现金"`
targetDetailsInfo.Minmoney, targetDetailsInfo.Maxmoney = departmentpc.SplitCriteria(v.CashStandard) //最高罚款"`&& 最低罚款"`
addErr := overall.CONSTANT_DB_KPI.Create(&targetDetailsInfo).Error //添加指标
if addErr == nil {
syncSeting.Add(1)
go PostDetailsBaseOrgPost(targetCont.Dimension, targetCont.Id, tableId, targetDetailsInfo.Id, targetCont.Type, 3, 2, orgPost)
syncSeting.Add(1)
go PostDetailsBaseOrgPostMan(targetCont.Dimension, targetCont.Id, tableId, targetDetailsInfo.Id, targetCont.Type, 3, 2, orgPostMan)
}
//处理指标关联数据
for _, ov := range orgList {
if publicmethod.IsInTrue[string](ov, tableDepartList) == false {
tableDepartList = append(tableDepartList, ov)
}
}
for _, pv := range postList {
if publicmethod.IsInTrue[string](pv, tablePostList) == false {
tablePostList = append(tablePostList, pv)
}
}
for _, opv := range orgPost {
if JudgeDeparPost(opv, tableDepartPost) == false {
tableDepartPost = append(tableDepartPost, opv)
}
}
for _, opvm := range orgPostMan {
if JudgeDeparPostMan(opvm, tableDepartPostMan) == false {
tableDepartPostMan = append(tableDepartPostMan, opvm)
}
}
}
// one, _ := json.Marshal(tableDepartList)
// two, _ := json.Marshal(tablePostList)
// three, _ := json.Marshal(tableDepartPost)
// four, _ := json.Marshal(tableDepartPostMan)
// fmt.Printf("栏目明细表关联关系--->%v--->%v--->%v--->%v\n", string(one), string(two), string(three), string(four))
editTabelInfo := publicmethod.MapOut[string]()
tableDepartStr := strings.Join(tableDepartList, ",")
editTabelInfo["`depart`"] = tableDepartStr
tablePostStr := strings.Join(tablePostList, ",")
editTabelInfo["`depart_post`"] = tablePostStr
editTabelInfo["`time`"] = time.Now().Unix()
var editTableCont modelskpi.PostSonTarget
editTableCont.EiteCont(map[string]interface{}{"`id`": tableId}, editTabelInfo)
syncSeting.Add(1)
go PostDetailsBaseOrgPost(targetCont.Dimension, targetCont.Id, tableId, 0, targetCont.Type, 2, 2, tableDepartPost)
syncSeting.Add(1)
go PostDetailsBaseOrgPostMan(targetCont.Dimension, targetCont.Id, tableId, 0, targetCont.Type, 2, 2, tableDepartPostMan)
syncSeting.Wait()
publicmethod.Result(0, receivedValue, c)
}
/*
*
@ 作者: 秦东
@ 时间: 2023-02-22 09:41:43
@ 功能: 岗位指标细则关联行政组织及岗位提报人
@ 参数
#
@ 返回值
#dimensionId 维度
#targetId 指标
#tableId 栏目
#bylawsId 细则
#types 类型1指标2子目标3细则
#class 属性1定性考核2定量考核
#level 级别1部门级2岗位级
#orgPostManList 行政组织与岗位提报人组合
@ 方法原型
#
*/
func PostDetailsBaseOrgPostMan(dimensionId, targetId, tableId, bylawsId int64, class, types, level int, orgPostManList []OrgAndPostManCont) {
defer syncSeting.Done()
if types == 0 {
types = 3
}
if class == 0 {
class = 1
}
if level == 0 {
level = 2
}
var orgManList []ReportAry
for _, opmv := range orgPostManList {
if len(orgManList) < 1 {
var orgMAnCont ReportAry
orgMAnCont.OrgId = opmv.OrgId
orgMAnCont.PostId = opmv.PostId
orgMAnCont.ManKey = append(orgMAnCont.ManKey, opmv.ManKey)
orgManList = append(orgManList, orgMAnCont)
} else {
isCunz := true
for i, omlv := range orgManList {
if omlv.OrgId == opmv.OrgId && omlv.PostId == opmv.PostId {
if publicmethod.IsInTrue[int64](opmv.ManKey, orgManList[i].ManKey) == false {
orgManList[i].ManKey = append(orgManList[i].ManKey, opmv.ManKey)
}
isCunz = false
}
}
if isCunz {
var orgMAnCont ReportAry
orgMAnCont.OrgId = opmv.OrgId
orgMAnCont.PostId = opmv.PostId
orgMAnCont.ManKey = append(orgMAnCont.ManKey, opmv.ManKey)
orgManList = append(orgManList, orgMAnCont)
}
}
}
// orgManListJson, _ := json.Marshal(orgManList)
// fmt.Printf("岗位指标细则关联行政组织及岗位提报人------>%v\n", string(orgManListJson))
//将不属于该指标细则的部门岗位提报人至禁用
otherSaveData := publicmethod.MapOut[string]()
otherSaveData["`state`"] = 2
otherSaveData["`time`"] = time.Now().Unix()
for _, val := range orgManList {
overall.CONSTANT_DB_KPI.Model(&modelskpi.TargetReport{}).Where("`level` = ? AND `target_id` = ? AND `target_sun_id` = ? AND `target_bylaws` = ? AND `type` = ? AND `department_id` = ? AND `post_id` = ?", types, targetId, targetId, bylawsId, level, val.OrgId, val.PostId).Not(map[string]interface{}{"man_key": val.ManKey}).Updates(&otherSaveData)
}
//处理指标细则提报人问题
for _, v := range orgPostManList {
//获取评价人部门
var manCont modelshr.PersonArchives
manCont.GetCont(map[string]interface{}{"`key`": v.ManKey}, "`maindeparment`")
var tarDepartCont modelskpi.TargetReport
saveErr := tarDepartCont.GetCont(map[string]interface{}{"`level`": types, "`type`": level, "`target_id`": targetId, "`target_sun_id`": tableId, "`target_bylaws`": bylawsId, "`department_id`": v.OrgId, "`post_id`": v.PostId, "`man_key`": v.ManKey}, "`id`", "`state`")
if saveErr == nil {
if tarDepartCont.State != 1 {
tarDepartCont.EiteCont(map[string]interface{}{"`id`": tarDepartCont.Id}, map[string]interface{}{"`state`": 1, "`man_department`": manCont.MainDeparment, "`time`": time.Now().Unix()})
}
} else {
var tarReportContAdd modelskpi.TargetReport
tarReportContAdd.Dimension = dimensionId //维度
tarReportContAdd.TargetId = targetId //指标ID"`
tarReportContAdd.TargetSunId = targetId //子目标"`
tarReportContAdd.TargetBylaws = bylawsId //指标细则"`
tarReportContAdd.DepartmentId = v.OrgId //部门ID"`
tarReportContAdd.PostId = v.PostId //岗位ID"`
tarReportContAdd.Type = level //类型(1:公司级;2:部门级)"`
tarReportContAdd.State = 1 //状态(1:启用;2:禁用;3:删除)"`
tarReportContAdd.ReportPerson = v.ManKey //上报人"`
tarReportContAdd.ManDepartment = manCont.MainDeparment //提报人所在部门"`
tarReportContAdd.Time = time.Now().Unix() //写入时间"`
tarReportContAdd.Class = class //1:定性考核;2:定量考核"`
tarReportContAdd.Level = types //1:指标;2:子目标;3:细则
overall.CONSTANT_DB_KPI.Create(&tarReportContAdd)
}
}
}
/*
*
@ 作者: 秦东
@ 时间: 2023-02-22 08:51:56
@ 功能: 岗位指标细则关联行政组织及岗位
@ 参数
#dimensionId 维度
#targetId 指标
#tableId 栏目
#bylawsId 细则
#types 类型1指标2子目标3细则
#class 属性1定性考核2定量考核
#level 级别1部门级2岗位级
#orgPostList 行政组织与岗位组合
@ 返回值
#
@ 方法原型
#
*/
func PostDetailsBaseOrgPost(dimensionId, targetId, tableId, bylawsId int64, class, types, level int, orgPostList []OrgAndPostCont) {
defer syncSeting.Done()
if types == 0 {
types = 3
}
if class == 0 {
class = 1
}
if level == 0 {
level = 2
}
orgPostMap := map[int64][]int64{}
for _, ov := range orgPostList {
orgPostMap[ov.OrgId] = append(orgPostMap[ov.OrgId], ov.PostId)
}
//将不属于该指标细则的部门至禁用
otherSaveData := publicmethod.MapOut[string]()
otherSaveData["`state`"] = 2
otherSaveData["`time`"] = time.Now().Unix()
for key, val := range orgPostMap {
overall.CONSTANT_DB_KPI.Model(&modelskpi.TargetDepartment{}).Where("`level` = ? AND `target_id` = ? AND `target_sun_id` = ? AND `target_bylaws` = ? AND `type` = ? AND `department_id` = ?", level, targetId, targetId, bylawsId, types, key).Not(map[string]interface{}{"post_id": val}).Updates(&otherSaveData)
}
//处理新的关联数据
for _, v := range orgPostList {
var tarDepartCont modelskpi.TargetDepartment
saveErr := tarDepartCont.GetCont(map[string]interface{}{"`level`": level, "`type`": types, "`target_id`": targetId, "`target_sun_id`": tableId, "`target_bylaws`": bylawsId, "`department_id`": v.OrgId, "`post_id`": v.PostId}, "`id`", "`state`")
if saveErr == nil {
if tarDepartCont.State != 1 {
tarDepartCont.EiteCont(map[string]interface{}{"`id`": tarDepartCont.Id}, map[string]interface{}{"`state`": 1, "`time`": time.Now().Unix()})
}
} else {
var addTarDepartCont modelskpi.TargetDepartment
addTarDepartCont.Dimension = dimensionId
addTarDepartCont.TargetId = targetId //指标ID"`
addTarDepartCont.TargetSunId = tableId //子目标"`
addTarDepartCont.TargetBylaws = bylawsId //指标细则"`
addTarDepartCont.Type = types //类型(1:指标;2:子目标;3:细则)"`
addTarDepartCont.DepartmentId = v.OrgId //部门ID"`
addTarDepartCont.PostId = v.PostId //岗位ID"`
addTarDepartCont.State = 1 //状态(1:启用;2:禁用;3:删除)"`
addTarDepartCont.Time = time.Now().Unix() //写入时间"`
addTarDepartCont.Class = class //1:定性考核;2:定量考核"`
addTarDepartCont.Level = level //级别(1:部门级;2:岗位级)"`
overall.CONSTANT_DB_KPI.Create(&addTarDepartCont)
}
}
}
// 判断岗位是否已经存在
func JudgeDeparPostMan(orgPostMan OrgAndPostManCont, tableDepartPost []OrgAndPostManCont) (isTrue bool) {
isTrue = false
for _, v := range tableDepartPost {
if orgPostMan.OrgId == v.OrgId && orgPostMan.PostId == v.PostId && orgPostMan.ManKey == v.ManKey {
isTrue = true
return
}
}
return
}
func JudgeDeparPost(orgPost OrgAndPostCont, tableDepartPost []OrgAndPostCont) (isTrue bool) {
isTrue = false
for _, v := range tableDepartPost {
if orgPost.OrgId == v.OrgId && orgPost.PostId == v.PostId {
isTrue = true
return
}
}
return
}
// 获取岗位指标关联得岗位及提报人
/*
#targetId 指标
*/
func GetTargetBaseDepartMan(targetId int64) (orgList, postList, manList []string, orgPost []OrgAndPostCont, orgPostMan []OrgAndPostManCont) {
//获取指标关联行政组织及岗位
var targetDepartList []modelskpi.TargetDepartment
err := overall.CONSTANT_DB_KPI.Model(&modelskpi.TargetDepartment{}).Select("`department_id`,`post_id`").Where("`state` = 1 AND `type` = 1 AND `level` = 2 AND `target_sun_id` = 0 AND `target_bylaws` = 0 AND `target_id` = ?", targetId).Find(&targetDepartList).Error
if err != nil {
for _, v := range targetDepartList {
var orgPostCont OrgAndPostCont
orgPostCont.OrgId = v.DepartmentId
orgPostCont.PostId = v.PostId
orgPost = append(orgPost, orgPostCont)
orgStr := strconv.FormatInt(v.DepartmentId, 10)
if publicmethod.IsInTrue[string](orgStr, orgList) == false {
orgList = append(orgList, orgStr)
}
postStr := strconv.FormatInt(v.PostId, 10)
if publicmethod.IsInTrue[string](postStr, postList) == false {
postList = append(postList, postStr)
}
}
}
//获取指标关联岗位提报人
var targetReportList []modelskpi.TargetReport
err = overall.CONSTANT_DB_KPI.Model(&modelskpi.TargetReport{}).Select("`department_id`,`post_id`,`man_key`").Where("`state` = 1 AND `type_level` = 1 AND `type` = 2 AND `target_sun_id` = 0 AND `target_bylaws` = 0 AND `target_id` = ?", targetId).Find(&targetReportList).Error
if err != nil {
for _, v := range targetReportList {
var orgPostManCont OrgAndPostManCont
orgPostManCont.OrgId = v.DepartmentId
orgPostManCont.PostId = v.PostId
orgPostManCont.ManKey = v.ReportPerson
orgPostMan = append(orgPostMan, orgPostManCont)
manStr := strconv.FormatInt(v.ReportPerson, 10)
if publicmethod.IsInTrue[string](manStr, manList) == false {
manList = append(manList, manStr)
}
}
}
return
}
// 处理指标细则行政组织与岗位及提报人关系
func HandleOrgOfPostReportRelation(orgPostManList []OrgPostCont) (orgList, postList, manList []string, orgPost []OrgAndPostCont, orgPostMan []OrgAndPostManCont) {
if len(orgPostManList) < 1 {
return
}
for _, v := range orgPostManList {
if publicmethod.IsInTrue[string](v.Id, postList) == false {
var orgPostCont OrgAndPostCont //该细则关联得岗位关系
postList = append(postList, v.Id)
var postCont modelshr.Position
postCont.GetCont(map[string]interface{}{"`id`": v.Id}, "`id`", "administrative_organization")
orgPostCont.PostId = postCont.Id
orgPostCont.OrgId = postCont.AdministrativeOrganization
orgStr := strconv.FormatInt(postCont.AdministrativeOrganization, 10)
if publicmethod.IsInTrue[string](orgStr, orgList) == false {
orgList = append(orgList, orgStr)
}
if len(v.KeyList) > 0 {
for _, kv := range v.KeyList {
if publicmethod.IsInTrue[string](kv, manList) == false {
manList = append(manList, kv)
}
var orgPostManCont OrgAndPostManCont
orgPostManCont.PostId = postCont.Id
orgPostManCont.OrgId = postCont.AdministrativeOrganization
kvInt, _ := strconv.ParseInt(kv, 10, 64)
orgPostManCont.ManKey = kvInt
orgPostMan = append(orgPostMan, orgPostManCont)
}
}
orgPost = append(orgPost, orgPostCont)
}
}
return
}
/*
*
@ 作者: 秦东
@ 时间: 2023-02-21 15:12:46
@ 功能: 处理岗位指标数据
@ 参数
#targetId 指标ID
#title 栏目名称
@ 返回值
#tableId 栏目Id
#err 处理状态
@ 方法原型
#
*/
func EditPostTableCont(targetId int64, title string) (tableId int64, err error) {
var tableCont modelskpi.PostSonTarget
err = tableCont.GetCont(map[string]interface{}{"`title`": title, "`parent_id`": targetId})
if err != nil {
var sunTargetCont modelskpi.PostSonTarget
sunTargetCont.Title = title //标题"`
sunTargetCont.ParentId = targetId //归属指标"`
sunTargetCont.Time = time.Now().Unix() //创建时间"`
sunTargetCont.State = 1 //状态(1:启用;2:禁用;3:删除)"`
err = overall.CONSTANT_DB_KPI.Create(&sunTargetCont).Error
tableId = sunTargetCont.Id
} else {
tableId = tableCont.Id
editCont := publicmethod.MapOut[string]()
if tableCont.State != 1 {
editCont["state"] = 1
}
if len(editCont) > 0 {
editCont["time"] = time.Now().Unix()
var editInfo modelskpi.PostSonTarget
err = editInfo.EiteCont(map[string]interface{}{"`id`": tableCont.Id}, editCont)
}
}
return
}

520
api/version1/postseting/postpc/targetpost.go

@ -53,21 +53,61 @@ func (a *ApiMethod) GetPostTarget(c *gin.Context) {
sendData.ScoringMethod = postTargetCont.ScoringMethod //计分方式(1:自动;2:手动)"`
sendData.VisibleRange = postTargetCont.VisibleRange //可见范围"`
sendData.VisibleGroup = postTargetCont.VisibleGroup //可见范围(集团)"`
_, sendData.RelevantPostsMan, _ = getTargetAboutPost(postTargetCont.ReleDepart, postTargetCont.Dimension, postTargetCont.Id, 2)
sendData.OtherPostTarget, sendData.PostName, _ = getOrgOfPostReport(postTargetCont.Dimension, postTargetCont.Id, 0, 0, postTargetCont.State, 1, 2)
// _, sendData.RelevantPostsMan, _ = getTargetAboutPost(postTargetCont.ReleDepart, postTargetCont.Dimension, postTargetCont.Id, 2)
publicmethod.Result(0, sendData, c)
}
/*
获取行政组织及岗位提报人
#dimensionId 维度
#targetId 指标
#sunTargetId 栏目
#targetBylawsId 细则
#state 状态
#typeInt 类型1指标2子目标3细则
#level 级别1部门级2岗位级
*/
func getOrgOfPostReport(dimensionId, targetId, sunTargetId, targetBylawsId int64, state, typeInt, level int) (postPeopleList []OtherPostTargetCont, postName string, err error) {
var tarDepartList []modelskpi.TargetDepartment
err = overall.CONSTANT_DB_KPI.Model(&modelskpi.TargetDepartment{}).Select("`department_id`,`post_id`").Where("`state` = ? AND `level` = ? AND `dimension_id` = ? AND `target_id` = ? AND `target_sun_id` = ? AND `target_bylaws` = ?", state, level, dimensionId, targetId, sunTargetId, targetBylawsId).Find(&tarDepartList).Error
var postIsAry []int64
if err == nil && len(tarDepartList) > 0 {
var postId int64
for _, v := range tarDepartList {
if publicmethod.IsInTrue[int64](v.PostId, postIsAry) == false {
postIsAry = append(postIsAry, v.PostId)
var postPeopleCont OtherPostTargetCont
postPeopleCont.OrgId = v.DepartmentId
postPeopleCont.PostId = v.PostId
_, postPeopleCont.Operator, _ = getTargetAboutPostMan(v.DepartmentId, v.PostId, dimensionId, targetId, level, typeInt)
postPeopleList = append(postPeopleList, postPeopleCont)
postId = v.PostId
}
}
if postId != 0 {
var postCont modelshr.Position
postCont.GetCont(map[string]interface{}{"`id`": postId}, "`name`")
postName = postCont.Name
}
}
return
}
/*
获取岗位指标相关岗位
@departmentId 部门Id
@dimensionId 维度
@targetId 指标
@level 级别1部门级2岗位级
@typeInt 级别1部门级2岗位级
@level 1指标2子目标3细则
func getTargetAboutPost(departmentId, dimensionId, targetId int64, level int) (postId []int64, postPeopleList []postPeople, err error)
*/
func getTargetAboutPost(departmentId, dimensionId, targetId int64, level int) (postId []int64, postPeopleList []postPeople, err error) {
func getTargetAboutPost(departmentId, dimensionId, targetId int64, typeInt, level int) (postId []int64, postPeopleList []postPeople, err error) {
err = overall.CONSTANT_DB_KPI.Model(&modelskpi.TargetDepartment{}).Distinct("`post_id`").Where("`state` = 1 AND `level` = ? AND `department_id` = ? AND `dimension_id` = ? AND `target_id` = ?", level, departmentId, dimensionId, targetId).Find(&postId).Error
err = overall.CONSTANT_DB_KPI.Model(&modelskpi.TargetDepartment{}).Distinct("`post_id`").Where("`state` = 1 AND `type` = ? AND `level` = ? AND `department_id` = ? AND `dimension_id` = ? AND `target_id` = ?", level, typeInt, departmentId, dimensionId, targetId).Find(&postId).Error
if len(postId) > 0 {
for i := 0; i < len(postId); i++ {
var postmanCont postPeople
@ -75,7 +115,7 @@ func getTargetAboutPost(departmentId, dimensionId, targetId int64, level int) (p
var postCont modelshr.Position
postCont.GetCont(map[string]interface{}{"`id`": postId[i]}, "`name`")
postmanCont.Name = postCont.Name
_, postmanCont.Operator, _ = getTargetAboutPostMan(departmentId, postId[i], dimensionId, targetId, level)
_, postmanCont.Operator, _ = getTargetAboutPostMan(departmentId, postId[i], dimensionId, targetId, typeInt, level)
postPeopleList = append(postPeopleList, postmanCont)
}
}
@ -88,10 +128,11 @@ func getTargetAboutPost(departmentId, dimensionId, targetId int64, level int) (p
@postid 岗位
@dimensionId 维度
@targetId 指标
@level 级别1部门级2岗位级
@type 级别1部门级2岗位级
@level 1指标2子目标3细则
*/
func getTargetAboutPostMan(departmentId, postid, dimensionId, targetId int64, level int) (peopleId []int64, postPeople []string, err error) {
err = overall.CONSTANT_DB_KPI.Model(&modelskpi.TargetReport{}).Distinct("`man_key`").Where("`state` = 1 AND `type` = ? AND `department_id` = ? AND `post_id` = ? AND `dimension_id` = ? AND `target_id` = ?", level, departmentId, postid, dimensionId, targetId).Find(&peopleId).Error
func getTargetAboutPostMan(departmentId, postid, dimensionId, targetId int64, typeInt, level int) (peopleId []int64, postPeople []string, err error) {
err = overall.CONSTANT_DB_KPI.Model(&modelskpi.TargetReport{}).Distinct("`man_key`").Where("`state` = 1 AND `type` = ? AND `type_level` = ? AND `department_id` = ? AND `post_id` = ? AND `dimension_id` = ? AND `target_id` = ?", typeInt, level, departmentId, postid, dimensionId, targetId).Find(&peopleId).Error
if len(peopleId) > 0 {
for i := 0; i < len(peopleId); i++ {
postPeople = append(postPeople, strconv.FormatInt(peopleId[i], 10))
@ -418,7 +459,7 @@ func (a *ApiMethod) GetTargetAboutDepartToPostMan(c *gin.Context) {
publicmethod.Result(107, err, c)
return
}
_, outData, _ := getTargetAboutPost(postTargetCont.ReleDepart, postTargetCont.Dimension, postTargetCont.Id, 2)
_, outData, _ := getTargetAboutPost(postTargetCont.ReleDepart, postTargetCont.Dimension, postTargetCont.Id, 2, 1)
publicmethod.Result(0, outData, c)
}
@ -470,7 +511,7 @@ func (a *ApiMethod) AddPostTargetCont(c *gin.Context) {
//获取指标信息
var getTargetCont modelskpi.PostTarget
getTargetCont.GetCont(map[string]interface{}{"`id`": receivedValue.TargetId})
_, postPeople, _ := getTargetAboutPost(deartmentIdInt, getTargetCont.Dimension, getTargetCont.Id, 2)
_, postPeople, _ := getTargetAboutPost(deartmentIdInt, getTargetCont.Dimension, getTargetCont.Id, 2, 3)
//指标子栏目
var sunTargetCont modelskpi.PostSonTarget
@ -482,7 +523,7 @@ func (a *ApiMethod) AddPostTargetCont(c *gin.Context) {
sunTargetCont.Time = time.Now().Unix() //创建时间"`
sunTargetCont.State = 1 //状态(1:启用;2:禁用;3:删除)"`
sunTargetCont.Depart = deartmentIdInt //关联部门"`
sunTargetCont.Depart = receivedValue.DepartmentId //关联部门"`
sunTargetCont.DepartPost = strings.Join(receivedValue.PostId, ",")
sunTargetErr := overall.CONSTANT_DB_KPI.Create(&sunTargetCont).Error
if sunTargetErr != nil {
@ -560,22 +601,22 @@ func (a *ApiMethod) AddPostTargetCont(c *gin.Context) {
}
var saveCont modelskpi.PostTargetDetails
saveCont.Title = lv.Title //指标细则"`
saveCont.Content = lv.Explain //备注说明"`
saveCont.ParentId = targetSunIdInt //归属指标栏目"`
saveCont.ParentIdSun = sunTargetCont.Id //归属指标子栏目"`
saveCont.State = 1 //状态(1:启用;2:禁用;3:删除)"`
saveCont.AddTime = time.Now().Unix() //制定时间"`
saveCont.MinScore = minScoreInt //最小分*100保存"`
saveCont.MaxScore = maxScoreInt //最大分*100保存"`
saveCont.Company = lv.Unit //单位"`
saveCont.AddReduce = lv.Class //1:减少;2:增加;3:无属性,现场确认加或减"`
saveCont.CensorType = strings.Join(lv.Inspect, ",") //检查方式"`
saveCont.CensorCont = lv.Evidence //客观证据"`
saveCont.CensorRate = lv.Frequency //检查频次"`
saveCont.Cycles = lv.Cycle //1:班;2:天;3:周;4:月;5:季度;6:年"`
saveCont.CycleAttres = lv.CycleAttr //辅助计数"`
saveCont.Paretment = deartmentIdInt //接受考核的部门"`
saveCont.Title = lv.Title //指标细则"`
saveCont.Content = lv.Explain //备注说明"`
saveCont.ParentId = targetSunIdInt //归属指标栏目"`
saveCont.ParentIdSun = sunTargetCont.Id //归属指标子栏目"`
saveCont.State = 1 //状态(1:启用;2:禁用;3:删除)"`
saveCont.AddTime = time.Now().Unix() //制定时间"`
saveCont.MinScore = minScoreInt //最小分*100保存"`
saveCont.MaxScore = maxScoreInt //最大分*100保存"`
saveCont.Company = lv.Unit //单位"`
saveCont.AddReduce = lv.Class //1:减少;2:增加;3:无属性,现场确认加或减"`
saveCont.CensorType = strings.Join(lv.Inspect, ",") //检查方式"`
saveCont.CensorCont = lv.Evidence //客观证据"`
saveCont.CensorRate = lv.Frequency //检查频次"`
saveCont.Cycles = lv.Cycle //1:班;2:天;3:周;4:月;5:季度;6:年"`
saveCont.CycleAttres = lv.CycleAttr //辅助计数"`
saveCont.Paretment = strconv.FormatInt(deartmentIdInt, 10) //接受考核的部门"`
// saveCont.ParetmentPost = strings.Join(requestData.PostId, ",") //接受考核的部门岗位"`
// saveCont.Reportary = strings.Join(lv.ReportAry, ",") //接受考核的部门岗位"`
@ -648,8 +689,9 @@ func addDetaonsCont(saveCont modelskpi.PostTargetDetails, postMan, targetPostMan
fmt.Printf("postMan------->%v--------targetPostMan------->%v--------departAny------->%v--------peopletAny------->%v\n", postMan, targetPostMan, departAny, peopletAny)
//关联部门岗位
if len(departAny) > 0 {
paretmentIdInt, _ := strconv.ParseInt(saveCont.Paretment, 10, 64)
syncSetinges.Add(1)
go EditTargetTableDimenAboutPostOfDepart(dimensionId, saveCont.ParentId, saveCont.ParentIdSun, saveCont.Id, saveCont.Paretment, departAny, 2, 1)
go EditTargetTableDimenAboutPostOfDepart(dimensionId, saveCont.ParentId, saveCont.ParentIdSun, saveCont.Id, paretmentIdInt, departAny, 2, 1)
}
//关联考核岗位和提报人
@ -664,8 +706,9 @@ func addDetaonsCont(saveCont modelskpi.PostTargetDetails, postMan, targetPostMan
}
}
postid, _ := strconv.ParseInt(dv.Id, 10, 64)
paretmentIdInts, _ := strconv.ParseInt(saveCont.Paretment, 10, 64)
syncSetinges.Add(1)
go DepartAboutPostTargetReport(dimensionId, saveCont.ParentId, saveCont.ParentIdSun, saveCont.Id, saveCont.Paretment, postid, operatorList, 2, 1)
go DepartAboutPostTargetReport(dimensionId, saveCont.ParentId, saveCont.ParentIdSun, saveCont.Id, paretmentIdInts, postid, operatorList, 2, 1)
}
syncSetinges.Wait()
@ -887,7 +930,8 @@ func (a *ApiMethod) EditSonTargetCont(c *gin.Context) {
postTarCont.GetCont(map[string]interface{}{"`id`": sonTarCont.ParentId}, "`dimension`")
if len(receivedValue.PostOfOperator) > 0 {
syncSeting.Add(1)
go postSonTargetAboutOrder(postTarCont.Dimension, sonTarCont.Depart, sonTarCont.ParentId, sonTarCont.Id, receivedValue.PostOfOperator)
departInt, _ := strconv.ParseInt(sonTarCont.Depart, 10, 64)
go postSonTargetAboutOrder(postTarCont.Dimension, departInt, sonTarCont.ParentId, sonTarCont.Id, receivedValue.PostOfOperator)
}
syncSeting.Wait()
@ -1165,7 +1209,8 @@ func (a *ApiMethod) AddOneTargetD(c *gin.Context) {
saveCont.CensorRate = receivedValue.Frequency //检查频次"`
saveCont.Cycles = receivedValue.Cycle //1:班;2:天;3:周;4:月;5:季度;6:年"`
saveCont.CycleAttres = receivedValue.CycleAttr //辅助计数"`
saveCont.Paretment = sonTarCont.Depart //接受考核的部门"`
// saveCont.Paretment = strconv.FormatInt(sonTarCont.Depart, 10) //接受考核的部门"`
saveCont.Paretment = sonTarCont.Depart
// saveCont.ParetmentPost = strings.Join(requestData.PostId, ",") //接受考核的部门岗位"`
// saveCont.Reportary = strings.Join(receivedValue.ReportAry, ",") //接受考核的部门岗位"`
saveCont.Punishmode = receivedValue.PunishMode //处罚或奖励方式 1:分数;2:现金;3:分数加现金
@ -1175,7 +1220,8 @@ func (a *ApiMethod) AddOneTargetD(c *gin.Context) {
//获取指标信息
var getTargetCont modelskpi.PostTarget
getTargetCont.GetCont(map[string]interface{}{"`id`": sonTarCont.ParentId})
_, postPeople, _ := getTargetSonAboutPost(sonTarCont.Depart, getTargetCont.Dimension, getTargetCont.Id, sonTarCont.Id, 2)
departInt, _ := strconv.ParseInt(sonTarCont.Depart, 10, 64)
_, postPeople, _ := getTargetSonAboutPost(departInt, getTargetCont.Dimension, getTargetCont.Id, sonTarCont.Id, 2)
syncSeting.Add(1)
go addDetaonsCont(saveCont, receivedValue.RelevantPostsMan, postPeople, getTargetCont.Dimension)
@ -1225,7 +1271,7 @@ func getTargetSonAboutPost(departmentId, dimensionId, targetId, sonTargetId int6
postmanCont.Name = postCont.Name
_, postmanCont.Operator, _ = getSonTargetAboutPostMan(departmentId, postId[i], dimensionId, targetId, sonTargetId, level)
if len(postmanCont.Operator) < 1 {
_, postmanCont.Operator, _ = getTargetAboutPostMan(departmentId, postId[i], dimensionId, targetId, level)
_, postmanCont.Operator, _ = getTargetAboutPostMan(departmentId, postId[i], dimensionId, targetId, level, 1)
}
postPeopleList = append(postPeopleList, postmanCont)
}
@ -1423,6 +1469,7 @@ func (a *ApiMethod) EditDeatilsCont(c *gin.Context) {
var postTarCont modelskpi.PostTarget
postTarCont.GetCont(map[string]interface{}{"`id`": detaCont.ParentId}, "`dimension`")
dimensionId := postTarCont.Dimension
paretmentIdInt, _ := strconv.ParseInt(detaCont.Paretment, 10, 64)
var departAny []string
for _, v := range receivedValue.RelevantPostsMan {
if publicmethod.IsInTrue[string](v.Id, departAny) == false {
@ -1431,13 +1478,13 @@ func (a *ApiMethod) EditDeatilsCont(c *gin.Context) {
postid, _ := strconv.ParseInt(v.Id, 10, 64)
if len(v.Operator) > 0 {
syncSetinges.Add(1)
go DepartAboutPostTargetReport(dimensionId, detaCont.ParentId, detaCont.ParentIdSun, detaCont.Id, detaCont.Paretment, postid, v.Operator, 2, 1)
go DepartAboutPostTargetReport(dimensionId, detaCont.ParentId, detaCont.ParentIdSun, detaCont.Id, paretmentIdInt, postid, v.Operator, 2, 1)
}
}
//关联部门岗位
if len(departAny) > 0 {
syncSetinges.Add(1)
go EditTargetTableDimenAboutPostOfDepart(dimensionId, detaCont.ParentId, detaCont.ParentIdSun, detaCont.Id, detaCont.Paretment, departAny, 2, 1)
go EditTargetTableDimenAboutPostOfDepart(dimensionId, detaCont.ParentId, detaCont.ParentIdSun, detaCont.Id, paretmentIdInt, departAny, 2, 1)
}
syncSetinges.Wait()
@ -1476,21 +1523,21 @@ func (a *ApiMethod) GetDetailsCont(c *gin.Context) {
} else {
sendData.CashStandard = fmt.Sprintf("%v", publicmethod.DecimalEs(float64(detaCont.Maxmoney)/100, 2))
}
paretmentIdInt, _ := strconv.ParseInt(detaCont.Paretment, 10, 64)
var postTarCont modelskpi.PostTarget
postTarCont.GetCont(map[string]interface{}{"`id`": detaCont.ParentId}, "`dimension`")
dimensionId := postTarCont.Dimension
sendData.Title = detaCont.Title
sendData.Unit = detaCont.Company //单位
sendData.Class = detaCont.AddReduce //1:减少;2:增加;3:无属性,现场确认加或减
sendData.Inspect = strings.Split(detaCont.CensorType, ",") //检查方式(1:现场检查;2:资料检查;3:事件触发)
sendData.Cycle = detaCont.Cycles //1:班;2:天;3:周;4:月;5:季度;6:年
sendData.CycleAttr = detaCont.CycleAttres //辅助计数
sendData.Frequency = detaCont.CensorRate //频次
sendData.Evidence = detaCont.CensorCont //客观证据
sendData.Explain = detaCont.Content //备注说明
_, sendData.RelevantPostsMan, _ = getTargetAboutPostDeta(detaCont.Paretment, dimensionId, detaCont.ParentId, detaCont.ParentIdSun, detaCont.Id, 2) //相关岗位与提报人
sendData.PunishMode = detaCont.Punishmode //处罚方式 1:扣分;2:现金处罚;3:扣分加现金
sendData.Unit = detaCont.Company //单位
sendData.Class = detaCont.AddReduce //1:减少;2:增加;3:无属性,现场确认加或减
sendData.Inspect = strings.Split(detaCont.CensorType, ",") //检查方式(1:现场检查;2:资料检查;3:事件触发)
sendData.Cycle = detaCont.Cycles //1:班;2:天;3:周;4:月;5:季度;6:年
sendData.CycleAttr = detaCont.CycleAttres //辅助计数
sendData.Frequency = detaCont.CensorRate //频次
sendData.Evidence = detaCont.CensorCont //客观证据
sendData.Explain = detaCont.Content //备注说明
_, sendData.RelevantPostsMan, _ = getTargetAboutPostDeta(paretmentIdInt, dimensionId, detaCont.ParentId, detaCont.ParentIdSun, detaCont.Id, 2) //相关岗位与提报人
sendData.PunishMode = detaCont.Punishmode //处罚方式 1:扣分;2:现金处罚;3:扣分加现金
publicmethod.Result(0, sendData, c)
}
@ -1537,3 +1584,384 @@ func getTargetAboutPostDetalMan(departmentId, postid, dimensionId, targetId, son
}
return
}
/*
*
@ 作者: 秦东
@ 时间: 2023-02-10 11:00:59
@ 功能: 获取岗位指标列表
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func (a *ApiMethod) GetPostTargetList(c *gin.Context) {
var receivedValue GetPostTargetContList
c.ShouldBindJSON(&receivedValue)
if receivedValue.PageSize == 0 {
receivedValue.PageSize = 20
}
if receivedValue.Page == 0 {
receivedValue.Page = 1
}
var postTargetCont modelskpi.PostTarget
gormDb := overall.CONSTANT_DB_KPI.Table(fmt.Sprintf("%s pt", postTargetCont.TableName())).Where("pt.`state` BETWEEN 1 AND 2")
if receivedValue.Title != "" {
gormDb = gormDb.Where("pt.`title` LIKE ?", "%"+receivedValue.Title+"%")
}
if receivedValue.Dimension != "" {
gormDb = gormDb.Where("pt.`dimension` = ?", receivedValue.Dimension)
}
if receivedValue.Attribute != 0 {
gormDb = gormDb.Where("pt.`type` = ?", receivedValue.Attribute)
}
if len(receivedValue.PostIdList) > 0 {
gormDb = gormDb.Joins("JOIN target_department td ON pt.`id` = td.`target_id` AND td.`target_sun_id` = 0 AND td.`target_bylaws` = 0 AND td.`type` = 1 AND td.`state` BETWEEN 1 AND 2 AND td.`level` = 2 AND td.`post_id` IN ?", receivedValue.PostIdList)
}
var total int64
gormDbTotal := gormDb.Distinct("pt.id")
totalErr := gormDbTotal.Count(&total).Error
if totalErr != nil {
total = 0
}
var targetIdAry []int64
gormDb = gormDb.Distinct("pt.id")
gormDb = publicmethod.PageTurningSettings(gormDb, receivedValue.Page, receivedValue.PageSize)
err := gormDb.Order("pt.`id` DESC").Find(&targetIdAry).Error
if err != nil || len(targetIdAry) < 1 {
publicmethod.Result(105, err, c)
return
}
//获取指标信息列表
var postTargetList []modelskpi.PostTarget
err = overall.CONSTANT_DB_KPI.Model(&modelskpi.PostTarget{}).Where("`id` IN ?", targetIdAry).Order("`id` DESC").Find(&postTargetList).Error
if err != nil {
publicmethod.Result(105, err, c)
return
}
var sendPostTargetContList []outPostTargetList
for _, v := range postTargetList {
var postTargetCont outPostTargetList
postTargetCont.Id = v.Id
postTargetCont.Title = v.Title //标题"`
postTargetCont.Type = v.Type //定性考核;2:定量考核"`
postTargetCont.State = v.State //状态(1:启用;2:禁用;3:删除)"`
postTargetCont.Time = v.Time //创建时间"`
postTargetCont.Share = v.Share //共用;2:私用"`
postTargetCont.ReleDepart = v.ReleDepart //相关部门"`
postTargetCont.DepartmentsPost = v.DepartmentsPost //相关岗位"`
postTargetCont.Dimension = v.Dimension //维度"`
postTargetCont.Key = v.Key //UUID"`
postTargetCont.Report = v.Report //上报人"`
postTargetCont.Unit = v.Unit //单位"`
postTargetCont.Cycle = v.Cycle //1:班;2:天;3:周;4:月;5:季度;6:年"`
postTargetCont.Cycleattr = v.Cycleattr //n辅助计数"`
postTargetCont.ScoringMethod = v.ScoringMethod //计分方式(1:自动;2:手动)"`
postTargetCont.VisibleRange = v.VisibleRange //可见范围"`
postTargetCont.VisibleGroup = v.VisibleGroup //可见范围(集团)"`
var dimCont modelskpi.DutyClass
dimCont.GetCont(map[string]interface{}{"`id`": v.Dimension}, "`title`")
postTargetCont.DimensionName = dimCont.Title
postTargetCont.PostAry = getSubimtPost(v.Id, 0, 0, 1, 2)
postTargetCont.ReportAry = getSubimtPostReport(v.Id, 0, 0, 2, 1)
sendPostTargetContList = append(sendPostTargetContList, postTargetCont)
}
publicmethod.ResultList(0, receivedValue.Page, receivedValue.PageSize, total, int64(len(sendPostTargetContList)), sendPostTargetContList, c)
}
// 获取提报岗位
/*
#targetId 指标Id
#sunTargetId 栏目Id
#targetBylawsId 细则Id
#typeInt 类型1指标2子目标3细则
#level 级别1部门级2岗位级
*/
func getSubimtPost(targetId, sunTargetId, targetBylawsId int64, typeInt, level int) (postTargetListCont []idAndName) {
var postIdList []int64
err := overall.CONSTANT_DB_KPI.Model(&modelskpi.TargetDepartment{}).Distinct("`post_id`").Where("`state` = 1 AND `target_id` = ? AND `target_sun_id` = ? AND `target_bylaws` = ? AND `type` = ? AND `level` = ?", targetId, sunTargetId, targetBylawsId, typeInt, level).Find(&postIdList).Error
if err != nil {
return
}
if len(postIdList) > 0 {
for _, v := range postIdList {
var postTarInfo modelshr.Position
errPost := postTarInfo.GetCont(map[string]interface{}{"`id`": v}, "`name`")
if errPost == nil {
var contInfo idAndName
contInfo.Id = strconv.FormatInt(v, 10)
contInfo.Name = postTarInfo.Name
postTargetListCont = append(postTargetListCont, contInfo)
}
}
}
return
}
// 获取岗位指标提报人
/*
#targetId 指标Id
#sunTargetId 栏目Id
#targetBylawsId 细则Id
#typeInt 级别1部门级2岗位级
#level 类型1指标2子目标3细则
*/
func getSubimtPostReport(targetId, sunTargetId, targetBylawsId int64, typeInt, level int) (manContList []UserContList) {
var userKey []int64
err := overall.CONSTANT_DB_KPI.Model(&modelskpi.TargetReport{}).Distinct("`man_key`").Where("`state` = 1 AND `target_id` = ? AND `target_sun_id` = ? AND `target_bylaws` = ? AND `type` = ? AND `type_level` = ?", targetId, sunTargetId, targetBylawsId, typeInt, level).Find(&userKey).Error
if err != nil {
return
}
if len(userKey) > 0 {
for _, v := range userKey {
var postTarInfo modelshr.PersonArchives
errPost := postTarInfo.GetCont(map[string]interface{}{"`key`": v}, "`number`", "`name`", "`icon`", "`icon_photo`")
if errPost == nil {
var contInfo UserContList
contInfo.Id = strconv.FormatInt(v, 10)
contInfo.Name = postTarInfo.Name
contInfo.Icon = postTarInfo.Icon
contInfo.IconImg = postTarInfo.IconPhoto
manContList = append(manContList, contInfo)
}
}
}
return
}
/*
*
@ 作者: 秦东
@ 时间: 2023-02-10 14:45:00
@ 功能: 设置岗位指标状态
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func (a *ApiMethod) SetPostTargetState(c *gin.Context) {
var receivedValue publicmethod.PublicState
c.ShouldBindJSON(&receivedValue)
if receivedValue.Id == "" {
publicmethod.Result(101, receivedValue, c, "参数错误!!")
return
}
if receivedValue.State == 0 {
receivedValue.State = 1
}
if receivedValue.IsTrue == 0 {
receivedValue.IsTrue = 2
}
where := publicmethod.MapOut[string]()
where["id"] = receivedValue.Id
var targetCont modelskpi.PostTarget
err := targetCont.GetCont(where, "id")
if err != nil {
publicmethod.Result(107, err, c)
return
}
softDel := 1
if receivedValue.State == 3 && receivedValue.IsTrue == 1 {
//强制删除
//判断该指标是否在使用中,使用中的只能软删除
var epIdList []int64
overall.CONSTANT_DB_KPI.Model(&modelskpi.PostWorkflowOrders{}).Select("`id`").Where("FIND_IN_SET(?,`target`)", receivedValue.Id).Find(&epIdList)
if len(epIdList) > 0 {
softDel = 1
} else {
softDel = 2
}
}
var editTargetState modelskpi.PostTarget
if softDel == 1 {
//软删除
editTargetState.EiteCont(where, map[string]interface{}{"`state`": receivedValue.State, "`time`": time.Now().Unix()})
} else {
//硬删除
editTargetState.DelCont(where)
}
syncSeting.Add(1)
go SunPostTargetState(targetCont.Id, receivedValue.State, softDel) //处理目标
syncSeting.Add(1)
go PostTargetDatailedState(targetCont.Id, 0, receivedValue.State, softDel) // 处理细则
syncSeting.Add(1)
go PostTarDepartState(targetCont.Id, 0, 0, receivedValue.State, softDel, 2, 1) // 处理关联部门
syncSeting.Add(1)
go PostTarAboutReport(targetCont.Id, 0, 0, receivedValue.State, softDel, 2, 1) // 处理相关提报人
syncSeting.Wait()
publicmethod.Result(0, err, c)
}
//处理相关提报人
/*
#parentId 指标ID
#sunID 栏目
#bylawsId 细则
#state 状态
#isTrue 1软删非1硬删除
#level 1:部门级2岗位级
#typeInt 1指标2子目标3细则
*/
func PostTarAboutReport(parentId, sunID, bylawsId int64, state, isTrue, level, typeInt int) {
defer syncSeting.Done()
if state == 0 {
state = 1
}
if isTrue == 0 {
isTrue = 1
}
if level == 0 {
level = 1
}
wheAry := publicmethod.MapOut[string]()
wheAry["type"] = level
wheAry["type_level"] = typeInt
if parentId != 0 {
wheAry["target_id"] = parentId
}
if sunID != 0 {
wheAry["target_sun_id"] = sunID
}
if bylawsId != 0 {
wheAry["target_bylaws"] = bylawsId
}
var tarDataCont modelskpi.TargetReport
if isTrue == 1 {
//软删除
if state != 1 {
tarDataCont.EiteCont(wheAry, map[string]interface{}{"`state`": state, "`time`": time.Now().Unix()})
} else {
overall.CONSTANT_DB_KPI.Model(&modelskpi.TargetReport{}).Where("`state` BETWEEN 1 AND 2").Where(wheAry).Updates(map[string]interface{}{"`state`": state, "`time`": time.Now().Unix()})
}
} else {
tarDataCont.DelCont(wheAry)
}
}
// 处理关联部门
/*
#parentId 指标ID
#sunID 栏目
#bylawsId 细则
#state 状态
#isTrue 1软删非1硬删除
#level 1:部门级2岗位级
#typeInt 1指标2子目标3细则
*/
func PostTarDepartState(parentId, sunID, bylawsId int64, state, isTrue, level, typeInt int) {
defer syncSeting.Done()
if state == 0 {
state = 1
}
if isTrue == 0 {
isTrue = 1
}
wheAry := publicmethod.MapOut[string]()
wheAry["level"] = level
wheAry["type"] = typeInt
if parentId != 0 {
wheAry["target_id"] = parentId
}
if sunID != 0 {
wheAry["target_sun_id"] = sunID
}
if bylawsId != 0 {
wheAry["target_bylaws"] = bylawsId
}
var tarDataCont modelskpi.TargetDepartment
if isTrue == 1 {
//软删除
if state != 1 {
tarDataCont.EiteCont(wheAry, map[string]interface{}{"`state`": state, "`time`": time.Now().Unix()})
} else {
overall.CONSTANT_DB_KPI.Model(&modelskpi.TargetDepartment{}).Where("`state` BETWEEN 1 AND 2").Where(wheAry).Updates(map[string]interface{}{"`state`": state, "`time`": time.Now().Unix()})
}
} else {
tarDataCont.DelCont(wheAry)
}
}
// 处理细则
/*
#ParentId 指标ID
#SunID 栏目
#state 状态
#isTrue 1软删非1硬删除
*/
func PostTargetDatailedState(ParentId, SunID int64, state, isTrue int) {
defer syncSeting.Done()
if state == 0 {
state = 1
}
if isTrue == 0 {
isTrue = 1
}
wheAry := publicmethod.MapOut[string]()
if ParentId != 0 {
wheAry["parentid"] = ParentId
}
if SunID != 0 {
wheAry["parentid_sun"] = SunID
}
var tarDataCont modelskpi.PostTargetDetails
if isTrue == 1 {
//软删除
if state != 1 {
tarDataCont.EiteCont(wheAry, map[string]interface{}{"`state`": state, "`time`": time.Now().Unix()})
} else {
overall.CONSTANT_DB_KPI.Model(&modelskpi.PostTargetDetails{}).Where("`state` BETWEEN 1 AND 2").Where(wheAry).Updates(map[string]interface{}{"`state`": state, "`time`": time.Now().Unix()})
}
} else {
tarDataCont.DelCont(wheAry)
}
}
// 处理目标
/*
#ParentId 指标ID
#state 状态
#isTrue 1软删非1硬删除
*/
func SunPostTargetState(ParentId int64, state, isTrue int) {
defer syncSeting.Done()
if state == 0 {
state = 1
}
if isTrue == 0 {
isTrue = 1
}
var sunTargetCont modelskpi.PostSonTarget
if isTrue == 1 {
//软删除
if state != 1 {
sunTargetCont.EiteCont(map[string]interface{}{"`parent_id`": ParentId}, map[string]interface{}{"`state`": state, "`time`": time.Now().Unix()})
} else {
overall.CONSTANT_DB_KPI.Model(&modelskpi.PostSonTarget{}).Where("`state` BETWEEN 1 AND 2 AND `parent_id` = ?", ParentId).Updates(map[string]interface{}{"`state`": state, "`time`": time.Now().Unix()})
}
} else {
sunTargetCont.DelCont(map[string]interface{}{"`parent_id`": ParentId})
}
}

85
api/version1/postseting/postpc/teshutype.go

@ -1,14 +1,17 @@
package postpc
import "key_performance_indicators/overall/publicmethod"
import (
"key_performance_indicators/models/modelskpi"
"key_performance_indicators/overall/publicmethod"
)
//搜索行政组织岗位
// 搜索行政组织岗位
type SearchOrgPost struct {
OrgId string `json:"orgid"`
publicmethod.PublicName
}
//输出行政组织岗位
// 输出行政组织岗位
type SendSearPost struct {
OrgId []int64 `json:"orgid"` //行政组织ID
PostId int64 `json:"postid"` //岗位ID
@ -20,7 +23,7 @@ type PostListCont struct {
Name string `json:"name"`
}
//部门与岗位和提报人关系
// 部门与岗位和提报人关系
type OrgPostPeople struct {
OrgId int64 `json:"orgid"`
PostPeople []PostPeopleList `json:"postpeople"`
@ -30,3 +33,77 @@ type PostPeopleList struct {
PostId int64 `json:"postid"`
PeopleList []string `json:"peoplelist"`
}
// 获取岗位指标细则
type GetPostDetails struct {
TargetId string `json:"targetid"`
Inspect []string `json:"inspect"` //检查方式(1:现场检查;2:资料检查;3:事件触发)
Cycle int `json:"cycle"` //1:班;2:天;3:周;4:月;5:季度;6:年
PostList []string `json:"postlist"` //岗位
}
// 输出岗位细则
type OutPostDetailsCont struct {
modelskpi.PostTargetDetails
ColumnName string `json:"columnName"` //栏目名称
Standard string `json:"standard"` //考核标准
Forfeit string `json:"forfeit"` //罚金
JiBuQi int `json:"jibuqi"` //记不起
}
// 输出指标关联的部门和岗位
type OutTargetDepatPostMan struct {
OrgId []string `json:"orgid"` //行政组织id
PostId []string `json:"postid"` //岗位ID
OrgAndPostList []OrgPostCont `json:"organdpostlist"` //行政组织与岗位列表
}
// 行政组织与岗位结构体
type OrgPostCont struct {
publicmethod.PublicId
publicmethod.PublicName
Number string `json:"number"`
KeyList []string `json:"keylist"` //已选择标识
Child *[]OrgPostCont `json:"child"`
}
// 根据指标添加岗位细则
type AddPostDetails struct {
TargetId string `json:"targetid"` //指标Id
TableName string `json:"tablename"` //栏目名称
DetailsList []DetailsCont `json:"detailslist"` //岗位细则列表
}
// 岗位细则结构体
type DetailsCont struct {
Title string `json:"title"` //考核内容
PunishType int `json:"punishtype"` //1:分数;2:现金;3:分数加现金
Standard string `json:"standard"` //考核标准
Unit string `json:"unit"` //计量单位
CashStandard string `json:"cashstandard"` //现金考核标准
Types int `json:"types"` //操作种类1:加分;2:减分;3:加减分
Inspemethod []string `json:"inspemethod"` //检查方式
Cycle int `json:"cycle"` //周期
Frequency int `json:"frequency"` //检查频次
Evidence string `json:"evidence"` //客观证据
Remarks string `json:"remarks"` //备注说明
PostandExport []OrgPostCont `json:"postandexport"` //相关岗位及提报人
}
// 行政组织与岗位
type OrgAndPostCont struct {
OrgId int64 `json:"orgid"`
PostId int64 `json:"postid"`
}
// 行政组织与岗位与提报人
type OrgAndPostManCont struct {
OrgAndPostCont
ManKey int64 `json:"mankey"`
}
// 提报人组合
type ReportAry struct {
OrgAndPostCont
ManKey []int64 `json:"mankey"`
}

486
api/version1/postseting/postpc/teshuxuqiu.go

@ -171,6 +171,58 @@ func (a *ApiMethod) GetOrgAry(c *gin.Context) {
publicmethod.Result(0, orgAry, c)
}
/*
*
@ 作者: 秦东
@ 时间: 2023-02-12 09:03:40
@ 功能: 获取行政组织级联数组和岗位
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func (a *ApiMethod) GetOrgAndPostAry(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(1, err, c, "参数错误!")
return
}
idInt, _ := strconv.ParseInt(receivedValue.Id, 10, 64)
_, _, minDer, sunDer, workId := publicmethod.GetOrgStructure(idInt)
var orgAry []int64
if minDer != 0 && publicmethod.IsInTrue[int64](minDer, orgAry) == false {
orgAry = append(orgAry, minDer)
}
if sunDer != 0 && publicmethod.IsInTrue[int64](sunDer, orgAry) == false {
orgAry = append(orgAry, sunDer)
}
if workId != 0 && publicmethod.IsInTrue[int64](workId, orgAry) == false {
orgAry = append(orgAry, workId)
}
if idInt != 0 && publicmethod.IsInTrue[int64](idInt, orgAry) == false {
orgAry = append(orgAry, idInt)
}
//获取相关岗位
var postContList []modelshr.Position
overall.CONSTANT_DB_HR.Where("`state` = 1 AND administrative_organization = ?", idInt).Find(&postContList)
sendData := publicmethod.MapOut[string]()
sendData["orglist"] = orgAry
sendData["postlist"] = postContList
publicmethod.Result(0, sendData, c)
}
/*
*
@ 作者: 秦东
@ -368,3 +420,437 @@ func HandlingRelations(orgPostPeo []OtherPostTargetCont) (orgHandPost []OrgPostP
}
return
}
/*
*
@ 作者: 秦东
@ 时间: 2023-02-12 13:17:05
@ 功能:
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func (a *ApiMethod) NewAddPostTargetCont(c *gin.Context) {
var receivedValue NewAddPostTargetInfo
c.ShouldBindJSON(&receivedValue)
if receivedValue.Title == "" {
publicmethod.Result(1, receivedValue, c, "请输入指标名称!")
return
}
if receivedValue.Type == 0 {
receivedValue.Type = 2
}
if receivedValue.ScoringMethod == 0 {
receivedValue.ScoringMethod = 1
}
var postIdList []string
var reportList []string
if len(receivedValue.OtherPostTarget) < 1 {
publicmethod.Result(1, receivedValue, c, "请选择该指标归属岗位!")
return
} else {
for _, v := range receivedValue.OtherPostTarget {
if v.OrgId == 0 || v.PostId == 0 || len(v.Operator) < 1 {
publicmethod.Result(1, receivedValue, c, "关联岗位与提报人员信息不全!请补充")
return
}
postIdStr := strconv.FormatInt(v.PostId, 10)
if publicmethod.IsInTrue[string](postIdStr, postIdList) == false {
postIdList = append(postIdList, postIdStr)
}
if len(v.Operator) > 0 {
for _, ov := range v.Operator {
if publicmethod.IsInTrue[string](ov, reportList) == false {
reportList = append(reportList, ov)
}
}
}
}
}
if receivedValue.Dimension == "" {
publicmethod.Result(1, receivedValue, c, "请选择指标归属维度!")
return
}
if receivedValue.Unit == "" {
publicmethod.Result(1, receivedValue, c, "请输入该指标计算单位!")
return
}
if receivedValue.Cycle == 0 {
receivedValue.Cycle = 1
}
if receivedValue.CycleAttr == 0 {
receivedValue.CycleAttr = 1
}
var saveData modelskpi.PostTarget
saveData.Title = receivedValue.Title //标题"`
saveData.Type = receivedValue.Type //1:定性考核;2:定量考核"`
saveData.State = 1 //状态(1:启用;2:禁用;3:删除)"`
saveData.Time = time.Now().Unix() //创建时间"`
saveData.Share = 2 //1:共用;2:私用"`
dimensionId, _ := strconv.ParseInt(receivedValue.Dimension, 10, 64)
saveData.Dimension = dimensionId //维度"`
saveData.Key = publicmethod.GetUUid(1) //UUID"`
saveData.Unit = receivedValue.Unit //单位"`
saveData.Cycle = receivedValue.Cycle //1:班;2:天;3:周;4:月;5:季度;6:年"`
saveData.Cycleattr = receivedValue.CycleAttr //辅助计数"`
saveData.ScoringMethod = receivedValue.ScoringMethod //计分方式(1:自动;2:手动)"`
saveData.VisibleRange = strings.Join(receivedValue.VisibleRange, ",") //可见范围"`
saveData.VisibleGroup = strings.Join(receivedValue.VisibleGroup, ",") //可见范围(集团)"`
saveData.DepartmentsPost = strings.Join(postIdList, ",")
saveData.Report = strings.Join(reportList, ",")
err := overall.CONSTANT_DB_KPI.Create(&saveData).Error
if err != nil {
publicmethod.Result(104, receivedValue, c)
return
}
for _, v := range receivedValue.OtherPostTarget {
syncSeting.Add(1)
go DepartTargetAboutPost(dimensionId, saveData.Id, 0, 0, v.OrgId, v.PostId, 1, receivedValue.Type, 2)
var peopleListId []int64
for _, pv := range v.Operator {
peoId, _ := strconv.ParseInt(pv, 10, 64)
if publicmethod.IsInTrue[int64](peoId, peopleListId) == false {
peopleListId = append(peopleListId, peoId)
}
syncSeting.Add(1)
go BeparTargetAboutPostMan(dimensionId, saveData.Id, 0, 0, v.OrgId, v.PostId, peoId, 2, receivedValue.Type, 1)
}
if len(peopleListId) > 0 {
syncSeting.Add(1)
go ClearTargetDepartAboutPostMan(dimensionId, saveData.Id, 0, 0, v.OrgId, v.PostId, peopleListId, 2, receivedValue.Type, 1)
}
}
syncSeting.Wait()
publicmethod.Result(0, err, c)
}
/*
*
@ 作者: 秦东
@ 时间: 2023-02-09 13:35:06
@ 功能: 部门指标关联岗位
@ 参数
#dimensionId 维度
#targetId 指标
#targetSunId 栏目
#targetBylaws 细则
#departmentId 部门
#postId 岗位
#typeInt 类型1指标2子目标3细则
#class 属性1定性考核2定量考核
#level 级别1部门级2岗位级
@ 返回值
#
@ 方法原型
#func DepartTargetAboutPost(dimensionId, targetId, targetSunId, targetBylaws, departmentId, postId int64, typeInt, class, level int)
*/
func DepartTargetAboutPost(dimensionId, targetId, targetSunId, targetBylaws, departmentId, postId int64, typeInt, class, level int) {
defer syncSeting.Done()
if typeInt == 0 {
typeInt = 1
}
if class == 0 {
class = 1
}
if level == 0 {
level = 1
}
var targetDeparCont modelskpi.TargetDepartment
err := targetDeparCont.GetCont(map[string]interface{}{"`level`": level, "`type`": typeInt, "`target_id`": targetId, "`target_sun_id`": targetSunId, "`target_bylaws`": targetBylaws, "`department_id`": departmentId, "`post_id`": postId})
if err != nil {
//不存在新增
var tarDepartCont modelskpi.TargetDepartment
tarDepartCont.Dimension = dimensionId
tarDepartCont.TargetId = targetId //指标ID"`
tarDepartCont.TargetSunId = targetSunId //子目标"`
tarDepartCont.TargetBylaws = targetBylaws //指标细则"`
tarDepartCont.Type = typeInt //类型(1:指标;2:子目标;3:细则)"`
tarDepartCont.DepartmentId = departmentId //部门ID"`
tarDepartCont.PostId = postId //岗位ID"`
tarDepartCont.State = 1 //状态(1:启用;2:禁用;3:删除)"`
tarDepartCont.Time = time.Now().Unix() //写入时间"`
tarDepartCont.Class = class //1:定性考核;2:定量考核"`
tarDepartCont.Level = level //级别(1:部门级;2:岗位级)"`
overall.CONSTANT_DB_KPI.Create(&tarDepartCont)
} else {
//存在修改状态
if targetDeparCont.State != 1 {
otherSaveData := publicmethod.MapOut[string]()
otherSaveData["`state`"] = 2
otherSaveData["`time`"] = time.Now().Unix()
var editTarDepartCont modelskpi.TargetDepartment
editTarDepartCont.EiteCont(map[string]interface{}{"`id`": targetDeparCont.Id}, otherSaveData)
}
}
}
/*
*
@ 作者: 秦东
@ 时间: 2023-02-09 14:09:41
@ 功能: 处理部门指标关联岗位提报人关系
@ 参数
#
@ 返回值
#dimensionId 维度
#targetId 指标
#targetSunId 栏目
#targetBylaws 细则
#departmentId 部门
#postId 岗位
#typeInt 类型1公司级2部门级
#manKey 用户Key
#class 属性1定性考核2定量考核
#typeLevel 级别1指标2子目标3细则
@ 方法原型
#func BeparTargetAboutPostMan(dimensionId, targetId, targetSunId, targetBylaws, departmentId, postId, manKey int64, typeInt, class, typeLevel int)
*/
func BeparTargetAboutPostMan(dimensionId, targetId, targetSunId, targetBylaws, departmentId, postId, manKey int64, typeInt, class, typeLevel int) {
defer syncSeting.Done()
if typeInt == 0 {
typeInt = 1
}
if class == 0 {
class = 1
}
if typeLevel == 0 {
typeLevel = 1
}
var manCont modelshr.PersonArchives
manCont.GetCont(map[string]interface{}{"`key`": manKey}, "`maindeparment`")
var targetReporCont modelskpi.TargetReport
err := targetReporCont.GetCont(map[string]interface{}{"`type_level`": typeLevel, "`type`": typeInt, "`target_id`": targetId, "`target_sun_id`": targetSunId, "`target_bylaws`": targetBylaws, "`department_id`": departmentId, "`post_id`": postId, "man_key": manKey})
if err != nil {
//不存在,新增
var tarReportContAdd modelskpi.TargetReport
tarReportContAdd.Dimension = dimensionId //维度
tarReportContAdd.TargetId = targetId //指标ID"`
tarReportContAdd.TargetSunId = targetSunId //子目标"`
tarReportContAdd.TargetBylaws = targetBylaws //指标细则"`
tarReportContAdd.DepartmentId = departmentId //部门ID"`
tarReportContAdd.PostId = postId //岗位ID"`
tarReportContAdd.Type = typeInt //类型(1:公司级;2:部门级)"`
tarReportContAdd.State = 1 //状态(1:启用;2:禁用;3:删除)"`
tarReportContAdd.ReportPerson = manKey //上报人"`
tarReportContAdd.ManDepartment = manCont.MainDeparment //提报人所在部门"`
tarReportContAdd.Time = time.Now().Unix() //写入时间"`
tarReportContAdd.Class = class //1:定性考核;2:定量考核"`
tarReportContAdd.Level = typeLevel //1:指标;2:子目标;3:细则
overall.CONSTANT_DB_KPI.Create(&tarReportContAdd)
} else {
//存在编辑
if targetReporCont.State != 1 {
otherSaveData := publicmethod.MapOut[string]()
otherSaveData["`state`"] = 2
if manCont.MainDeparment != targetReporCont.ManDepartment {
otherSaveData["`man_department`"] = manCont.MainDeparment
}
otherSaveData["`time`"] = time.Now().Unix()
var editTarReportCont modelskpi.TargetReport
editTarReportCont.EiteCont(map[string]interface{}{"`id`": targetReporCont.Id}, otherSaveData)
}
}
}
/*
*
@ 作者: 秦东
@ 时间: 2023-02-09 13:55:26
@ 功能: 清理部门指标不在关联的岗位提报人
@ 参数
#dimensionId 维度
#targetId 指标
#targetSunId 栏目
#targetBylaws 细则
#departmentId 部门
#postId 岗位
#manKey 岗位
#typeInt 级别1部门级2岗位级
#class 属性1定性考核2定量考核
#level 类型1指标2子目标3细则
@ 返回值
#
@ 方法原型
#ClearTargetDepartAboutPostMan(dimensionId, targetId, targetSunId, targetBylaws, departmentId, postId int64, manKey []int64, typeInt, class, level int)
*/
func ClearTargetDepartAboutPostMan(dimensionId, targetId, targetSunId, targetBylaws, departmentId, postId int64, manKey []int64, typeInt, class, level int) {
defer syncSeting.Done()
if typeInt == 0 {
typeInt = 1
}
if class == 0 {
class = 1
}
if level == 0 {
level = 1
}
//将不属于该指标细则的部门至禁用
otherSaveData := publicmethod.MapOut[string]()
otherSaveData["`state`"] = 2
otherSaveData["`time`"] = time.Now().Unix()
overall.CONSTANT_DB_KPI.Model(&modelskpi.TargetReport{}).Where("`target_id` = ? AND `target_sun_id` = ? AND `target_bylaws` = ? AND `department_id` = ? AND `post_id` = ? AND `type` = ? AND `type_level` = ?", targetId, targetSunId, targetBylaws, departmentId, postId, typeInt, level).Not(map[string]interface{}{"man_key": manKey}).Updates(&otherSaveData)
}
/*
*
@ 作者: 秦东
@ 时间: 2023-02-12 16:08:11
@ 功能: 编辑岗位指标(新版)
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func (a *ApiMethod) NewEditPostTarget(c *gin.Context) {
var receivedValue NewEditPostTargetCont
c.ShouldBindJSON(&receivedValue)
if receivedValue.Id == "" {
publicmethod.Result(1, receivedValue, c, "参数错误!请重新提交!")
return
}
if receivedValue.Title == "" {
publicmethod.Result(1, receivedValue, c, "请输入指标名称!")
return
}
if receivedValue.Type == 0 {
receivedValue.Type = 2
}
if receivedValue.ScoringMethod == 0 {
receivedValue.ScoringMethod = 1
}
var postIdList []string
var reportList []string
if len(receivedValue.OtherPostTarget) < 1 {
publicmethod.Result(1, receivedValue, c, "请选择该指标归属岗位!")
return
} else {
for _, v := range receivedValue.OtherPostTarget {
if v.OrgId == 0 || v.PostId == 0 || len(v.Operator) < 1 {
publicmethod.Result(1, receivedValue, c, "关联岗位与提报人员信息不全!请补充")
return
}
postIdStr := strconv.FormatInt(v.PostId, 10)
if publicmethod.IsInTrue[string](postIdStr, postIdList) == false {
postIdList = append(postIdList, postIdStr)
}
if len(v.Operator) > 0 {
for _, ov := range v.Operator {
if publicmethod.IsInTrue[string](ov, reportList) == false {
reportList = append(reportList, ov)
}
}
}
}
}
if receivedValue.Dimension == "" {
publicmethod.Result(1, receivedValue, c, "请选择指标归属维度!")
return
}
if receivedValue.Unit == "" {
publicmethod.Result(1, receivedValue, c, "请输入该指标计算单位!")
return
}
if receivedValue.Cycle == 0 {
receivedValue.Cycle = 1
}
if receivedValue.CycleAttr == 0 {
receivedValue.CycleAttr = 1
}
wheAry := publicmethod.MapOut[string]()
wheAry["id"] = receivedValue.Id
var postTargetInfo modelskpi.PostTarget
err := postTargetInfo.GetCont(wheAry)
if err != nil {
publicmethod.Result(107, receivedValue, c)
return
}
editCont := publicmethod.MapOut[string]()
if receivedValue.Title != "" && postTargetInfo.Title != receivedValue.Title {
editCont["`title`"] = receivedValue.Title
}
if receivedValue.Type != postTargetInfo.Type {
editCont["`type`"] = receivedValue.Type
}
postStr := strings.Join(postIdList, ",")
if postStr != postTargetInfo.DepartmentsPost {
editCont["`departments_post`"] = postStr
}
reportStr := strings.Join(reportList, ",")
if reportStr != postTargetInfo.Report {
editCont["`report`"] = reportStr
}
if receivedValue.Dimension != "" {
dimensionInt, _ := strconv.ParseInt(receivedValue.Dimension, 10, 64)
if dimensionInt != postTargetInfo.Dimension {
editCont["`dimension`"] = dimensionInt
}
}
if receivedValue.Unit != "" && postTargetInfo.Unit != receivedValue.Unit {
editCont["`unit`"] = receivedValue.Unit
}
if receivedValue.Cycle != postTargetInfo.Cycle {
editCont["`cycle`"] = receivedValue.Cycle
}
if receivedValue.CycleAttr != postTargetInfo.Cycleattr {
editCont["`cycleattr`"] = receivedValue.CycleAttr
}
if len(editCont) > 0 {
editCont["`time`"] = time.Now().Unix()
editCont["`state`"] = 1
var editCont modelskpi.PostTarget
err = editCont.EiteCont(wheAry, editCont)
}
for _, v := range receivedValue.OtherPostTarget {
syncSeting.Add(1)
go DepartTargetAboutPost(postTargetInfo.Dimension, postTargetInfo.Id, 0, 0, v.OrgId, v.PostId, 1, postTargetInfo.Type, 2)
var peopleListId []int64
for _, pv := range v.Operator {
peoId, _ := strconv.ParseInt(pv, 10, 64)
if publicmethod.IsInTrue[int64](peoId, peopleListId) == false {
peopleListId = append(peopleListId, peoId)
}
syncSeting.Add(1)
go BeparTargetAboutPostMan(postTargetInfo.Dimension, postTargetInfo.Id, 0, 0, v.OrgId, v.PostId, peoId, 2, postTargetInfo.Type, 1)
}
if len(peopleListId) > 0 {
syncSeting.Add(1)
go ClearTargetDepartAboutPostMan(postTargetInfo.Dimension, postTargetInfo.Id, 0, 0, v.OrgId, v.PostId, peopleListId, 2, postTargetInfo.Type, 1)
}
}
syncSeting.Wait()
publicmethod.Result(0, err, c)
}

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

@ -159,8 +159,9 @@ type outShemeVersionCont struct {
// 岗位单一指标详细内容输出
type getPostOneTarget struct {
modelskpi.PostTarget
RelevantPostsMan []postPeople `json:"relevantpostsman"` //相关岗位
DimensionStr string `json:"dimensionstr" `
OtherPostTarget []OtherPostTargetCont `json:"otherposttarget"` //其他部门相关岗位提报
DimensionStr string `json:"dimensionstr" `
PostName string `json:"postname"`
}
// 岗位单一指标关联岗位及提报人
@ -266,8 +267,9 @@ type idAndName struct {
type UserContList struct {
idAndName
Icon string `json:"icon"`
Number string `json:"number"`
Icon string `json:"icon"`
Number string `json:"number"`
IconImg string `json:"iconimg"`
}
// 岗位细则设定提报人关联
@ -419,3 +421,41 @@ type newDelTargetManConfig struct {
Year int `json:"year"` //年度
UserKey string `json:"userkey"` //人员
}
// 获取岗位指标列表
type GetPostTargetContList struct {
publicmethod.PagesTurn
PostIdList []int64 `json:"postidlist"` //岗位列表
Title string `json:"title"` //指标名称
Dimension string `json:"dimension"` //维度
Attribute int `json:"attribute"` //属性:1:定性;2:定量
}
// 岗位考核输出
type outPostTargetList struct {
modelskpi.PostTarget
DimensionName string `json:"dimensionname"` //维度
DepartmentName string `json:"departmentname"` //部门
PostAry []idAndName `json:"postary"` //岗位
ReportAry []UserContList `json:"reportary"` //提报人
}
// 添加岗位指标新版
type NewAddPostTargetInfo struct {
Title string `json:"title"` //名称
Dimension string `json:"dimension"` //维度
Type int `json:"type"` //1:定性考核;2:定量考核
Unit string `json:"unit"` //单位
ScoringMethod int `json:"scoringMethod"` //计分方式(1:自动;2:手动)
Cycle int `json:"cycle"` //1:班;2:天;3:周;4:月;5:季度;6:年
CycleAttr int `json:"cycleattr"` //辅助计数
OtherPostTarget []OtherPostTargetCont `json:"otherposttarget"` //其他部门相关岗位提报
VisibleRange []string `json:"visibleRange"` //可见范围
VisibleGroup []string `json:"visibleGroup"` //可见范围(集团)
}
// 编辑岗位指标(新版)
type NewEditPostTargetCont struct {
publicmethod.PublicId
NewAddPostTargetInfo
}

3
apirouter/apishiyan/maptostruct.go

@ -26,5 +26,8 @@ func (a *ApiRouter) RouterGroup(router *gin.RouterGroup) {
apiRouter.GET("evalproctime", methodBinding.EvalProcTime) //审批流规制发生时间
apiRouter.POST("evalproctime", methodBinding.EvalProcTime) //审批流规制发生时间
apiRouter.POST("correcting_depart_man", methodBinding.CorrectingDepartAndMan) //验证指标关联部门与指标关联提报人数据
apiRouter.POST("verif_depart_sontarget", methodBinding.VerifDepartSonTarget) //验证部门子栏目关联对照
apiRouter.POST("verif_depart_detasil", methodBinding.VerifDepartDetasil) //验证部门指标细则关系对照
}
}

26
apirouter/v1/departmentseting/pc.go

@ -15,12 +15,19 @@ func (a *ApiRouter) RouterGroupPc(router *gin.RouterGroup) {
apiRouter.GET("", methodBinding.Index) //入口
apiRouter.POST("", methodBinding.Index) //入口
apiRouter.POST("new_depart_tar_list", methodBinding.NewDepartmentTargetList) //部门指标列表(新版)
apiRouter.POST("departmenttargetlist", methodBinding.DepartmentTargetList) //部门指标列表
apiRouter.POST("shiyan", methodBinding.Shiyan) //实验
apiRouter.POST("getdepartabouttarget", methodBinding.GetDepartAboutTarget) //获取部门定性考核部门关联列表
apiRouter.POST("gettargetreport", methodBinding.GetTargetReport) //获取部门指标相关执行人
apiRouter.POST("new_del_target", methodBinding.TargetChangeState) //指标改变状态(启用、禁用、软删除、硬删除)
apiRouter.POST("deltarget", methodBinding.DelTarget) //删除指标
apiRouter.POST("get_target_details_list", methodBinding.GetTargetDetailsList) //获取指定指标下的细则列表
apiRouter.POST("get_target_column_list", methodBinding.GetTargetColumnList) //获取指定指标下的栏目列表
apiRouter.POST("deltarget", methodBinding.DelTarget) //删除指标
apiRouter.POST("new_add_depart_details", methodBinding.NewAddDepartDetails) //新版添加部门指标细则
apiRouter.POST("addsuntargetdetailed", methodBinding.AddSunTargetDetailed) //添加定性考核子栏目及细则
apiRouter.POST("getdepartmenttragetcontlist", methodBinding.GetDepartmentTragetContList) //获取定性考核指标列表内容
@ -32,17 +39,28 @@ func (a *ApiRouter) RouterGroupPc(router *gin.RouterGroup) {
apiRouter.POST("getsontargetcont", methodBinding.GetSonTargetCont) //获取子栏目基础信息
apiRouter.POST("delsontarget", methodBinding.DelSonTarget) //删除子栏目
apiRouter.POST("table_add_detailses", methodBinding.TableAddDetailses) //根据栏目添加细则
apiRouter.POST("edit_table_depart_man", methodBinding.EditTableContAndDepartOfMan) //修改栏目名称及关联岗位和提报人
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("edit_details_state", methodBinding.EditDetailsState) //编辑指标细则状态
apiRouter.POST("edit_details_cont", methodBinding.EditDetailsCont) //编辑单一指标细则内容(新版)
apiRouter.POST("add_department_target", methodBinding.AddDepartmentTarget) //添加部门指标
apiRouter.POST("get_one_terget_info", methodBinding.GetOneTergetInfo) //获取单一指标详细内容
apiRouter.POST("edit_one_target", methodBinding.EditOneTarget) //编辑单一部门指标
apiRouter.POST("new_add_depar_target", methodBinding.NewAddDepartmentTarget) //添加部门指标(新版)
apiRouter.POST("new_edit_one_target", methodBinding.NewEditOneTarget) //编辑单一部门指标(新版)
apiRouter.POST("new_dep_tar_post", methodBinding.NewDeparmentTargetAboutPost) //指标关联岗位(新版)
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) //指标细则关联部门岗位
apiRouter.POST("get_target_relevant_post_Report", methodBinding.GetTargetRelevantPostOfReport) //获取部门指标关联的岗位及提报人
//部门指标与部门关系举证
apiRouter.POST("department_rules_matrix", methodBinding.DepartmentRulesMatrix) //定性指标细则与部门矩阵

23
apirouter/v1/postseting/pc.go

@ -49,12 +49,16 @@ func (a *ApiRouter) RouterGroupPc(router *gin.RouterGroup) {
apiRouter.POST("add_post_target_cont", methodBinding.AddPostTargetCont) //根据指标添加岗位细则
apiRouter.POST("edit_scheme_state_of_del", methodBinding.EditSchemeStateOfDel) //编辑方案版本状态或删除
apiRouter.POST("posttargetsunlist", methodBinding.PostTargetSunList) //根据指标获取岗位定性指标细则列表
apiRouter.POST("getnew_target_depart_postman", methodBinding.GetNewTargetAboutDepartToPostMan) //获取岗位指标关联部门相关岗位及提报人(新版)
/*
岗位定性指标子栏目
*/
apiRouter.POST("get_sun_target_info", methodBinding.GetSunTargetInfo) //获取岗位子栏目详情
apiRouter.POST("edit_son_target_cont", methodBinding.EditSonTargetCont) //编辑岗位子栏目内容
apiRouter.POST("del_son_target_cont", methodBinding.DelSonTargetCont) //删除子栏目
apiRouter.POST("get_sun_target_info", methodBinding.GetSunTargetInfo) //获取岗位子栏目详情
apiRouter.POST("edit_son_target_cont", methodBinding.EditSonTargetCont) //编辑岗位子栏目内容
apiRouter.POST("del_son_target_cont", methodBinding.DelSonTargetCont) //删除子栏目
apiRouter.POST("table_base_post_target", methodBinding.TableBasePostTarget) //根据指标获取岗位指标栏目
/*
定性指标细则
*/
@ -63,6 +67,9 @@ func (a *ApiRouter) RouterGroupPc(router *gin.RouterGroup) {
apiRouter.POST("editdeatilscont", methodBinding.EditDeatilsCont) //编辑定性指标细则内容
apiRouter.POST("getdetailscont", methodBinding.GetDetailsCont) //获取指标细则内容
apiRouter.POST("getdetailslist", methodBinding.GetDetailsList) //根据指标获取细则列表
apiRouter.POST("adddetailslist", methodBinding.AddDetailsList) //根据指标添加细则列表
/*
针对岗位指标特殊要求API
*/
@ -70,5 +77,15 @@ func (a *ApiRouter) RouterGroupPc(router *gin.RouterGroup) {
apiRouter.POST("get_orgary", methodBinding.GetOrgAry) //获取行政组织级联数组
apiRouter.POST("new_add_posttarget", methodBinding.NewAddPostTarget) //添加岗位指标(新)
apiRouter.POST("addposttargetcont", methodBinding.NewAddPostTargetCont) //添加岗位指标(新改版)
apiRouter.POST("neweditposttarget", methodBinding.NewEditPostTarget) //编辑岗位指标(新版)
apiRouter.POST("get_organdpost_ary", methodBinding.GetOrgAndPostAry) //获取行政组织级联数组和岗位
/*
岗位指标
*/
apiRouter.POST("get_posttarget_list", methodBinding.GetPostTargetList) //获取岗位指标列表
apiRouter.POST("set_posttarget_state", methodBinding.SetPostTargetState) //设置岗位指标状态
}
}

8
models/modelshr/personarchives.go

@ -32,10 +32,10 @@ type PersonArchives struct {
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:角色"`
EmpTypeName string `json:"emptypename" gorm:"column:emp_type_name;type:varchar(255) unsigned;default:'';not null;comment:用工关系中文"`
HireClassName string `json:"hireclassname" gorm:"column:hire_class_name;type:varchar(255) unsigned;default:'';not null;comment:雇佣类型中文"`
SunMainDeparment int64 `json:"sunmaindeparment" gorm:"column:sun_main_deparment;type:bigint(20) unsigned;default:0;not null;comment:主部门"`
EmpTypeName string `json:"emptypename" gorm:"column:emp_type_name;type:varchar(255) unsigned;default:'';not null;comment:用工关系中文"`
HireClassName string `json:"hireclassname" gorm:"column:hire_class_name;type:varchar(255) unsigned;default:'';not null;comment:雇佣类型中文"`
IconPhoto string `json:"iconphoto" gorm:"column:icon_photo;type:varchar(255) unsigned;default:'';not null;comment:头像"`
SunMainDeparment int64 `json:"sunmaindeparment" gorm:"column:sun_main_deparment;type:bigint(20) unsigned;default:0;not null;comment:主部门"`
}
func (PersonArchives *PersonArchives) TableName() string {

4
models/modelskpi/post_sun_target.go

@ -12,8 +12,8 @@ type PostSonTarget struct {
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:关联部门岗位"`
Depart string `json:"depart" gorm:"column:depart;type:longtext ;default:0;comment:关联部门"`
DepartPost string `json:"departpost" gorm:"column:depart_post;type:longtext ;default:'';comment:关联部门岗位"`
}
func (PostSonTarget *PostSonTarget) TableName() string {

2
models/modelskpi/post_target_details.go

@ -23,7 +23,7 @@ type PostTargetDetails struct {
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:接受考核的部门"`
Paretment string `json:"paretment" gorm:"column:paretment;type:longtext;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:扣分加现金"`

4
overall/publicmethod/technique.go

@ -1234,11 +1234,11 @@ func GetPostOfUsEmpowerCont(orgId, postId int64, systemName string) (sysPowerCon
#GetNewAccredit(systemName, roleId string, orgId, postId int64) (roleName, pointId, operation string, level int)
*/
func GetNewAccredit(systemName, roleId string, userKey, orgId, postId int64) (roleName, pointId, operation string, level int) {
fmt.Printf("jsonStr------>%v---->%v---->%v---->%v---->%v\n", systemName, roleId, userKey, orgId, postId)
fmt.Printf("jsonStr---1--->%v---->%v---->%v---->%v---->%v\n", systemName, roleId, userKey, orgId, postId)
redisFileKey := fmt.Sprintf("Licence:PowerLoginApi_%v_%v_%v_%v", systemName, userKey, orgId, postId)
redisClient := grocerystore.RunRedis(overall.CONSTANT_REDIS3)
userRedisToken, isTrue := redisClient.HashGetAll(redisFileKey)
fmt.Printf("jsonStr------>%v---->%v---->%v---->%v---->%v---->%v\n", systemName, roleId, userKey, orgId, postId, userRedisToken)
fmt.Printf("jsonStr---2--->%v---->%v---->%v---->%v---->%v---->%v\n", systemName, roleId, userKey, orgId, postId, userRedisToken)
if isTrue == false {
var pointIdAry []string

Loading…
Cancel
Save