19 changed files with 4489 additions and 99 deletions
@ -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) |
||||
|
*/ |
||||
File diff suppressed because it is too large
@ -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) |
||||
|
} |
||||
@ -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 |
||||
|
} |
||||
Loading…
Reference in new issue