|
|
|
|
package maptostruct
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"fmt"
|
|
|
|
|
"key_performance_indicators/api/workflow/currency_recipe"
|
|
|
|
|
"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()
|
|
|
|
|
if len(manKey) > 0 {
|
|
|
|
|
for _, v := range manKey {
|
|
|
|
|
handTarReport(dimensionId, targetId, targetSunId, targetBylaws, postId, typeInt, class, level, orgId, v)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
func ChuLiTiBaoRenGuoDuss(dimensionId, targetId, targetSunId, targetBylaws, postId int64, typeInt, class, level int, orgId string, manKey []string) {
|
|
|
|
|
if len(manKey) > 0 {
|
|
|
|
|
for _, v := range manKey {
|
|
|
|
|
handTarReport(dimensionId, targetId, targetSunId, targetBylaws, postId, typeInt, class, level, orgId, v)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
*
|
|
|
|
|
@ 作者: 秦东
|
|
|
|
|
@ 时间: 2023-03-17 14:00:49
|
|
|
|
|
@ 功能: 校正被考核部门
|
|
|
|
|
@ 参数
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
@ 返回值
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
@ 方法原型
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
*/
|
|
|
|
|
func (a *ApiMethod) XiangzhengBeikaoBumen(c *gin.Context) {
|
|
|
|
|
var receivedValue XiaoZengTime
|
|
|
|
|
err := c.ShouldBindJSON(&receivedValue)
|
|
|
|
|
if err != nil {
|
|
|
|
|
publicmethod.Result(100, err, c)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if receivedValue.DateTime == "" {
|
|
|
|
|
publicmethod.Result(100, err, c)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
tayTime := time.Now().Unix()
|
|
|
|
|
currentYears := publicmethod.UnixTimeToDay(tayTime, 16)
|
|
|
|
|
currentMonths := publicmethod.UnixTimeToDay(tayTime, 17)
|
|
|
|
|
if receivedValue.DateTime != "" {
|
|
|
|
|
var dayTime publicmethod.DateTimeTotimes
|
|
|
|
|
dayTime.BaisStrToTime(receivedValue.DateTime)
|
|
|
|
|
if dayTime.Years != "" {
|
|
|
|
|
currentYears = dayTime.Years
|
|
|
|
|
}
|
|
|
|
|
if dayTime.Months != "" {
|
|
|
|
|
currentMonths = dayTime.Months
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
riQiStr := fmt.Sprintf("%v-%v", currentYears, currentMonths)
|
|
|
|
|
startTime, endTime := publicmethod.GetAppointMonthStarAndEndTime(riQiStr)
|
|
|
|
|
var evalProcess []modelskpi.EvaluationProcess
|
|
|
|
|
err = overall.CONSTANT_DB_KPI.Where("`ep_happen_time` BETWEEN ? AND ?", startTime, endTime).Find(&evalProcess).Error
|
|
|
|
|
if err != nil || len(evalProcess) < 1 {
|
|
|
|
|
publicmethod.Result(107, err, c)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
for _, v := range evalProcess {
|
|
|
|
|
if v.TypeClass == 1 {
|
|
|
|
|
//定性
|
|
|
|
|
HuiGaiDingXing(v.OrderKey)
|
|
|
|
|
} else {
|
|
|
|
|
//定量
|
|
|
|
|
HuiGaiDingLiang(v.OrderKey)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
publicmethod.Result(0, err, c)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 回改定量考核部门
|
|
|
|
|
func HuiGaiDingLiang(key int64) {
|
|
|
|
|
var scoreFlowCont modelskpi.FlowLog
|
|
|
|
|
err := scoreFlowCont.GetCont(map[string]interface{}{"`fl_key`": key}, "`fl_duty_department`")
|
|
|
|
|
if err == nil {
|
|
|
|
|
if scoreFlowCont.DutyDepartment != 0 {
|
|
|
|
|
var evalProCont modelskpi.EvaluationProcess
|
|
|
|
|
evalProCont.EiteCont(map[string]interface{}{"`ep_order_key`": key}, map[string]interface{}{"`ep_accept_department`": scoreFlowCont.DutyDepartment})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 回改定性考核部门
|
|
|
|
|
func HuiGaiDingXing(key int64) {
|
|
|
|
|
var scoreFlowCont modelskpi.ScoreFlow
|
|
|
|
|
err := scoreFlowCont.GetCont(map[string]interface{}{"`sf_key`": key}, "`sf_duty_department`")
|
|
|
|
|
if err == nil {
|
|
|
|
|
if scoreFlowCont.DutyDepartment != 0 {
|
|
|
|
|
var evalProCont modelskpi.EvaluationProcess
|
|
|
|
|
evalProCont.EiteCont(map[string]interface{}{"`ep_order_key`": key}, map[string]interface{}{"`ep_accept_department`": scoreFlowCont.DutyDepartment})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 验证工作流
|
|
|
|
|
func (a *ApiMethod) TestAndVerifyWorkflow(c *gin.Context) {
|
|
|
|
|
var receivedValue publicmethod.PublicId
|
|
|
|
|
c.ShouldBindJSON(&receivedValue)
|
|
|
|
|
//自定义判断
|
|
|
|
|
var zdyPd []currency_recipe.CustomFields
|
|
|
|
|
var zdyPdOne currency_recipe.CustomFields
|
|
|
|
|
zdyPdOne.WordField = "attribute"
|
|
|
|
|
zdyPdOne.LeftVal = "1"
|
|
|
|
|
zdyPd = append(zdyPd, zdyPdOne)
|
|
|
|
|
|
|
|
|
|
var zdyPdTwo currency_recipe.CustomFields
|
|
|
|
|
zdyPdTwo.WordField = "correct"
|
|
|
|
|
zdyPdTwo.LeftVal = "1"
|
|
|
|
|
zdyPd = append(zdyPd, zdyPdTwo)
|
|
|
|
|
//条件设定
|
|
|
|
|
var tijiao1 currency_recipe.JudgingCondition
|
|
|
|
|
tijiao1.Class = 1
|
|
|
|
|
tijiao1.MyCustom = zdyPd
|
|
|
|
|
|
|
|
|
|
var workflowInfo currency_recipe.WorkflowEngine
|
|
|
|
|
workflowInfo.JudCond = append(workflowInfo.JudCond, tijiao1)
|
|
|
|
|
// workflowInfo.VersionId = "1"
|
|
|
|
|
jieguo := workflowInfo.InitWorkflow(receivedValue.Id, "", "16047344045376832", "103").SendData()
|
|
|
|
|
|
|
|
|
|
if jieguo.IsTrue != true {
|
|
|
|
|
publicmethod.Result(1000, jieguo, c)
|
|
|
|
|
} else {
|
|
|
|
|
publicmethod.Result(0, jieguo, c)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
*
|
|
|
|
|
@ 作者: 秦东
|
|
|
|
|
@ 时间: 2023-05-10 15:09:21
|
|
|
|
|
@ 功能: 校正指标细则关联关系
|
|
|
|
|
@ 参数
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
@ 返回值
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
@ 方法原型
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
*/
|
|
|
|
|
func (a *ApiMethod) XiaoZhengBumenBylaws(c *gin.Context) {
|
|
|
|
|
var detasilCont []modelskpi.DetailedTarget
|
|
|
|
|
// err := overall.CONSTANT_DB_KPI.Where("`dt_id` = 806").Find(&detasilCont).Error
|
|
|
|
|
err := overall.CONSTANT_DB_KPI.Find(&detasilCont).Error
|
|
|
|
|
if err != nil || len(detasilCont) < 1 {
|
|
|
|
|
publicmethod.Result(1, err, c, "没有数据")
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
var fenZhu []modelskpi.DetailedTarget
|
|
|
|
|
jbq := 0
|
|
|
|
|
for i, v := range detasilCont {
|
|
|
|
|
|
|
|
|
|
if (i+1)%300 == 0 {
|
|
|
|
|
jbq++
|
|
|
|
|
fenZhu = append(fenZhu, v)
|
|
|
|
|
fmt.Printf("满100分组---->%v---->%v---->%v---->%v\n", i, jbq, len(fenZhu), (i+1)%100)
|
|
|
|
|
syncSetings.Add(1)
|
|
|
|
|
go XiaoZhengCont(fenZhu)
|
|
|
|
|
var newFenzu []modelskpi.DetailedTarget
|
|
|
|
|
fenZhu = newFenzu
|
|
|
|
|
} else {
|
|
|
|
|
fenZhu = append(fenZhu, v)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if len(fenZhu) > 0 {
|
|
|
|
|
syncSetings.Add(1)
|
|
|
|
|
go XiaoZhengCont(fenZhu)
|
|
|
|
|
jbq++
|
|
|
|
|
fmt.Printf("还有剩余得---->%v---->%v\n", jbq, len(fenZhu))
|
|
|
|
|
}
|
|
|
|
|
syncSetings.Wait()
|
|
|
|
|
publicmethod.Result(0, jbq, c)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
*
|
|
|
|
|
@ 作者: 秦东
|
|
|
|
|
@ 时间: 2023-05-10 15:15:38
|
|
|
|
|
@ 功能: 部门细则校正操作
|
|
|
|
|
@ 参数
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
@ 返回值
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
@ 方法原型
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
*/
|
|
|
|
|
func XiaoZhengCont(bylawsList []modelskpi.DetailedTarget) {
|
|
|
|
|
defer syncSetings.Done()
|
|
|
|
|
if len(bylawsList) > 0 {
|
|
|
|
|
for _, v := range bylawsList {
|
|
|
|
|
//获取指标内容
|
|
|
|
|
var tarCont modelskpi.EvaluationTarget
|
|
|
|
|
tarCont.GetCont(map[string]interface{}{"`et_id`": v.ParentId}, "`et_dimension`", "`et_type`", "`et_relevant_departments`", "`et_report`")
|
|
|
|
|
orgIdStr := strings.Split(v.Paretment, ",") //关联部门
|
|
|
|
|
reportList := strings.Split(v.Reportary, ",") //关联提报人
|
|
|
|
|
if v.Paretment != "" && v.Reportary != "" {
|
|
|
|
|
fmt.Printf("人员信息----1----》%v----》%v----》%v\n", reportList, v.Reportary, len(reportList))
|
|
|
|
|
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)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if v.Paretment != "" && v.Reportary == "" && tarCont.Report != "" {
|
|
|
|
|
reportDepartList := strings.Split(tarCont.Report, ",") //关联提报人
|
|
|
|
|
fmt.Printf("人员信息----2----》%v\n", reportDepartList)
|
|
|
|
|
for _, ov := range orgIdStr { //循环处理栏目对照关系
|
|
|
|
|
handDepartmentTarget(tarCont.Dimension, v.ParentId, v.ParentIdSun, v.Id, 0, 3, 1, tarCont.Type, ov)
|
|
|
|
|
syncSeting.Add(1)
|
|
|
|
|
go ChuLiTiBaoRenGuoDu(tarCont.Dimension, v.ParentId, v.ParentIdSun, v.Id, 0, 1, tarCont.Type, 3, ov, reportDepartList)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if v.Paretment == "" && v.Reportary != "" && tarCont.RelevantDepartments != "" {
|
|
|
|
|
orgDepartIdStr := strings.Split(tarCont.RelevantDepartments, ",") //关联部门
|
|
|
|
|
fmt.Printf("人员信息----3----》%v\n", reportList)
|
|
|
|
|
for _, ov := range orgDepartIdStr { //循环处理栏目对照关系
|
|
|
|
|
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()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
*
|
|
|
|
|
@ 作者: 秦东
|
|
|
|
|
@ 时间: 2023-05-15 08:19:52
|
|
|
|
|
@ 功能: 校正方案提报人
|
|
|
|
|
@ 参数
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
@ 返回值
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
@ 方法原型
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
*/
|
|
|
|
|
func (a *ApiMethod) XiaoZhengFangAn(c *gin.Context) {
|
|
|
|
|
var shemeList []modelskpi.QualitativeEvaluation
|
|
|
|
|
err := overall.CONSTANT_DB_KPI.Where("qe_state = 1").Find(&shemeList).Error
|
|
|
|
|
if err != nil || len(shemeList) <= 0 {
|
|
|
|
|
publicmethod.Result(1, err, c, "没有数据")
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
var fenZhu []modelskpi.QualitativeEvaluation
|
|
|
|
|
jbq := 0
|
|
|
|
|
for i, v := range shemeList {
|
|
|
|
|
|
|
|
|
|
if (i+1)%1000 == 0 {
|
|
|
|
|
jbq++
|
|
|
|
|
fenZhu = append(fenZhu, v)
|
|
|
|
|
fmt.Printf("满1000分组---->%v---->%v---->%v---->%v\n", i, jbq, len(fenZhu), (i+1)%100)
|
|
|
|
|
syncSetings.Add(1)
|
|
|
|
|
go XiaoZhengSchemeData(fenZhu)
|
|
|
|
|
var newFenzu []modelskpi.QualitativeEvaluation
|
|
|
|
|
fenZhu = newFenzu
|
|
|
|
|
} else {
|
|
|
|
|
fenZhu = append(fenZhu, v)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if len(fenZhu) > 0 {
|
|
|
|
|
syncSetings.Add(1)
|
|
|
|
|
go XiaoZhengSchemeData(fenZhu)
|
|
|
|
|
jbq++
|
|
|
|
|
fmt.Printf("还有剩余得---->%v---->%v\n", jbq, len(fenZhu))
|
|
|
|
|
}
|
|
|
|
|
syncSetings.Wait()
|
|
|
|
|
publicmethod.Result(0, fenZhu, c)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 校正方案数据
|
|
|
|
|
func XiaoZhengSchemeData(shemeList []modelskpi.QualitativeEvaluation) {
|
|
|
|
|
defer syncSetings.Done()
|
|
|
|
|
if len(shemeList) > 0 {
|
|
|
|
|
for _, v := range shemeList {
|
|
|
|
|
//获取指标内容
|
|
|
|
|
var tarCont modelskpi.EvaluationTarget
|
|
|
|
|
tarCont.GetCont(map[string]interface{}{"`et_id`": v.Target}, "`et_dimension`", "`et_type`", "`et_relevant_departments`", "`et_report`")
|
|
|
|
|
accDepart := strconv.FormatInt(v.AcceptEvaluation, 10)
|
|
|
|
|
handDepartmentTarget(tarCont.Dimension, v.Target, v.TargetSun, v.DetailedTarget, 0, 3, 1, v.Type, accDepart)
|
|
|
|
|
if v.Operator != "" {
|
|
|
|
|
reportList := strings.Split(v.Operator, ",") //关联提报人
|
|
|
|
|
// ChuLiTiBaoRenGuoDuss(tarCont.Dimension, v.Target, v.TargetSun, v.DetailedTarget, 0, 1, v.Type, 3, accDepart, reportList)
|
|
|
|
|
syncSeting.Add(1)
|
|
|
|
|
go ChuLiTiBaoRenGuoDu(tarCont.Dimension, v.Target, v.TargetSun, v.DetailedTarget, 0, 1, v.Type, 3, accDepart, reportList)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
syncSeting.Wait()
|
|
|
|
|
}
|