|
|
@ -1,11 +1,13 @@ |
|
|
package departmentpc |
|
|
package departmentpc |
|
|
|
|
|
|
|
|
import ( |
|
|
import ( |
|
|
"encoding/json" |
|
|
|
|
|
"fmt" |
|
|
"fmt" |
|
|
|
|
|
"key_performance_indicators/models/modelshr" |
|
|
"key_performance_indicators/models/modelskpi" |
|
|
"key_performance_indicators/models/modelskpi" |
|
|
"key_performance_indicators/overall" |
|
|
"key_performance_indicators/overall" |
|
|
"key_performance_indicators/overall/publicmethod" |
|
|
"key_performance_indicators/overall/publicmethod" |
|
|
|
|
|
"strconv" |
|
|
|
|
|
"strings" |
|
|
|
|
|
|
|
|
"github.com/gin-gonic/gin" |
|
|
"github.com/gin-gonic/gin" |
|
|
) |
|
|
) |
|
|
@ -26,11 +28,18 @@ func (a *ApiMethod) DepartmentRulesMatrix(c *gin.Context) { |
|
|
publicmethod.Result(101, receivedValue, c) |
|
|
publicmethod.Result(101, receivedValue, c) |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
|
|
|
var zbz []matrixZhuBiaoZhoo |
|
|
//获取公司下的最小主责部门
|
|
|
//获取公司下的最小主责部门
|
|
|
organizationList := publicmethod.GetMinMainDutyDeparment(receivedValue.Company) |
|
|
organizationList := publicmethod.GetMinMainDutyDeparment(receivedValue.Company) |
|
|
var departmentList []int64 |
|
|
var departmentList []int64 |
|
|
for _, dv := range organizationList { |
|
|
for _, dv := range organizationList { |
|
|
if publicmethod.IsInTrue[int64](dv.Id, departmentList) == false { |
|
|
if publicmethod.IsInTrue[int64](dv.Id, departmentList) == false { |
|
|
|
|
|
var zbzCont matrixZhuBiaoZhoo |
|
|
|
|
|
var ordCont modelshr.AdministrativeOrganization |
|
|
|
|
|
ordCont.GetCont(map[string]interface{}{"`id`": dv.Id}, "`name`") |
|
|
|
|
|
zbzCont.Id = strconv.FormatInt(dv.Id, 10) |
|
|
|
|
|
zbzCont.Name = ordCont.Name |
|
|
|
|
|
zbz = append(zbz, zbzCont) |
|
|
departmentList = append(departmentList, dv.Id) |
|
|
departmentList = append(departmentList, dv.Id) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
@ -41,20 +50,69 @@ func (a *ApiMethod) DepartmentRulesMatrix(c *gin.Context) { |
|
|
publicmethod.Result(105, receivedValue, c) |
|
|
publicmethod.Result(105, receivedValue, c) |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
|
|
|
var sendDataList []rulesMatrixParaList |
|
|
for _, v := range targetList { |
|
|
for _, v := range targetList { |
|
|
|
|
|
var sendDataCont rulesMatrixParaList |
|
|
|
|
|
|
|
|
|
|
|
sendDataCont.Id = v.Id |
|
|
|
|
|
sendDataCont.Title = v.Title //指标细则"`
|
|
|
|
|
|
sendDataCont.Content = v.Content //指标说明"`
|
|
|
|
|
|
sendDataCont.ParentId = v.ParentId //归属指标栏目"`
|
|
|
|
|
|
sendDataCont.ParentIdSun = v.ParentIdSun //归属指标子栏目"`
|
|
|
|
|
|
sendDataCont.State = v.State //状态(1:启用;2:禁用;3:删除)"`
|
|
|
|
|
|
sendDataCont.AddTime = v.AddTime //制定时间"`
|
|
|
|
|
|
sendDataCont.MinScore = v.MinScore //最小分*100保存"`
|
|
|
|
|
|
sendDataCont.MaxScore = v.MaxScore //100保存"`
|
|
|
|
|
|
sendDataCont.Company = v.Company //单位"`
|
|
|
|
|
|
sendDataCont.AddReduce = v.AddReduce //1:减少;2:增加;3:无属性,现场确认加或减"`
|
|
|
|
|
|
sendDataCont.CensorType = v.CensorType //检查方式"`
|
|
|
|
|
|
sendDataCont.CensorCont = v.CensorCont //检查依据"`
|
|
|
|
|
|
sendDataCont.CensorRate = v.CensorRate //检查频次"`
|
|
|
|
|
|
sendDataCont.Cycles = v.Cycles //1:班;2:天;3:周;4:月;5:季度;6:年"`
|
|
|
|
|
|
sendDataCont.CycleAttres = v.CycleAttres //辅助计数"`
|
|
|
|
|
|
sendDataCont.Paretment = v.Paretment //接受考核的部门"`
|
|
|
|
|
|
sendDataCont.Reportary = v.Reportary //提报人"`
|
|
|
|
|
|
|
|
|
|
|
|
standardStr := "" |
|
|
|
|
|
if v.MinScore != 0 { |
|
|
|
|
|
standardStr = fmt.Sprintf("%v-%v", publicmethod.DecimalEs(float64(v.MinScore)/100, 2), publicmethod.DecimalEs(float64(v.MaxScore)/100, 2)) |
|
|
|
|
|
} else { |
|
|
|
|
|
standardStr = fmt.Sprintf("%v", publicmethod.DecimalEs(float64(v.MaxScore)/100, 2)) |
|
|
|
|
|
} |
|
|
|
|
|
sendDataCont.Standard = standardStr |
|
|
|
|
|
//子栏目信息
|
|
|
|
|
|
var sonTargetInfo modelskpi.QualitativeTarget |
|
|
|
|
|
sonTargetInfo.GetCont(map[string]interface{}{"`q_id`": v.ParentIdSun}, "q_title") |
|
|
|
|
|
sendDataCont.SonTargetName = sonTargetInfo.Title |
|
|
|
|
|
sendDataCont.CensorTypeList = strings.Split(v.CensorType, ",") |
|
|
|
|
|
|
|
|
relationOrg := GetRulesDepartment(v.ParentId, v.ParentIdSun, v.Id, 1) |
|
|
relationOrg := GetRulesDepartment(v.ParentId, v.ParentIdSun, v.Id, 1) |
|
|
for i := 0; i < len(departmentList); i++ { |
|
|
for i := 0; i < len(departmentList); i++ { |
|
|
|
|
|
// var matrDepart matrixDepartment
|
|
|
|
|
|
// matrDepart.Id = strconv.FormatInt(departmentList[i], 10)
|
|
|
|
|
|
// var ordCont modelshr.AdministrativeOrganization
|
|
|
|
|
|
// ordCont.GetCont(map[string]interface{}{"`id`": departmentList[i]}, "`name`")
|
|
|
|
|
|
// matrDepart.Name = ordCont.Name
|
|
|
if publicmethod.IsInTrue[int64](departmentList[i], relationOrg) == true { |
|
|
if publicmethod.IsInTrue[int64](departmentList[i], relationOrg) == true { |
|
|
fmt.Printf("relationOrg--------True------>%v------>%v\n", v.Id, departmentList[i]) |
|
|
// fmt.Printf("relationOrg--------True------>%v------>%v\n", v.Id, departmentList[i])
|
|
|
|
|
|
sendDataCont.IsTrue = append(sendDataCont.IsTrue, 1) |
|
|
|
|
|
// matrDepart.IsTrue = 1
|
|
|
} else { |
|
|
} else { |
|
|
fmt.Printf("relationOrg--------False------>%v------>%v\n", v.Id, departmentList[i]) |
|
|
// fmt.Printf("relationOrg--------False------>%v------>%v\n", v.Id, departmentList[i])
|
|
|
|
|
|
sendDataCont.IsTrue = append(sendDataCont.IsTrue, 0) |
|
|
|
|
|
// matrDepart.IsTrue = 0
|
|
|
} |
|
|
} |
|
|
|
|
|
// sendDataCont.DepartmentIsTrue = append(sendDataCont.DepartmentIsTrue, matrDepart)
|
|
|
} |
|
|
} |
|
|
|
|
|
sendDataList = append(sendDataList, sendDataCont) |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
sendMap := publicmethod.MapOut[string]() |
|
|
orgJson, _ := json.Marshal(organizationList) |
|
|
// orgJson, _ := json.Marshal(organizationList)
|
|
|
fmt.Printf("orgJson-------------->%v\n", string(orgJson)) |
|
|
// fmt.Printf("orgJson-------------->%v\n", string(orgJson))
|
|
|
|
|
|
sendMap["list"] = sendDataList |
|
|
|
|
|
sendMap["department"] = zbz |
|
|
|
|
|
publicmethod.Result(0, sendMap, c) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/* |
|
|
/* |
|
|
|