Browse Source

5月1号BUG收尾

qin_1
超级管理员 4 years ago
parent
commit
88bcd12e89
  1. 8
      gin_server_admin/README.md
  2. 9
      gin_server_admin/api/admin/dutyassess/assesstype.go
  3. 34
      gin_server_admin/api/admin/dutyassess/dutyes.go
  4. 126
      gin_server_admin/api/admin/dutyassess/dutyhandle.go
  5. 27
      gin_server_admin/api/admin/dutyassess/planversio.go
  6. 39
      gin_server_admin/api/admin/systemuser/systemmenu.go
  7. 48
      gin_server_admin/api/index/assessment/assesshandle.go
  8. 2
      gin_server_admin/api/index/enter.go
  9. 4
      gin_server_admin/api/index/evaluation/assessment.go
  10. 9
      gin_server_admin/api/index/evaluation/evaluation.go
  11. 26
      gin_server_admin/api/index/evaluation/flowsend.go
  12. 1
      gin_server_admin/api/index/evaluation/type.go
  13. 4
      gin_server_admin/api/index/statistics/enter.go
  14. 33
      gin_server_admin/api/index/statistics/programme.go
  15. 6
      gin_server_admin/api/statistics/enter.go
  16. 4
      gin_server_admin/api/statistics/nature/enter.go
  17. 60
      gin_server_admin/api/statistics/nature/statistics.go
  18. 965
      gin_server_admin/api/statistics/quantification/auxiliarycalculation.go
  19. 93
      gin_server_admin/api/statistics/quantification/enter.go
  20. 405
      gin_server_admin/api/statistics/quantification/quant.go
  21. 84
      gin_server_admin/api/statistics/quantification/shiyan.go
  22. 9
      gin_server_admin/api/v1/assessment/department_target.go
  23. 8
      gin_server_admin/api/v1/assessment/dutytype.go
  24. 42
      gin_server_admin/api/v1/assessment/target.go
  25. 2
      gin_server_admin/api/v1/staff/staffpeople.go
  26. 16
      gin_server_admin/api/web/jixiaokaohe/people.go
  27. 75
      gin_server_admin/commonus/publichaneld.go
  28. 12
      gin_server_admin/initialize/redis.go
  29. 5
      gin_server_admin/initialize/router.go
  30. 6
      gin_server_admin/middleware/myjwt.go
  31. 19
      gin_server_admin/model/assessmentmodel/dutyclass.go
  32. 2
      gin_server_admin/router/enter.go
  33. 3
      gin_server_admin/router/index/statisticsroute/enter.go
  34. 20
      gin_server_admin/router/index/statisticsroute/programme.go
  35. 8
      gin_server_admin/router/statisticsrouter/statistics.go
  36. 1
      gin_server_admin/utils/redishandel/myredis.go

8
gin_server_admin/README.md

@ -74,3 +74,11 @@ qualitative_target
rectification_measures rectification_measures
score_flow score_flow
target_weight target_weight
### 2022.04.30纪要
1、生成部门考核方案下来添加观察标
2、定量指标添加自动与手东干预
### 2022.05.01纪要
1、编写数据表统计信息

9
gin_server_admin/api/admin/dutyassess/assesstype.go

@ -297,6 +297,7 @@ type QualEvalSunList struct {
Content string `json:"content"` //指标说明 Content string `json:"content"` //指标说明
Unit string `json:"unit"` //单位 Unit string `json:"unit"` //单位
ReferenceScore string `json:"referencescore"` //标准分值 ReferenceScore string `json:"referencescore"` //标准分值
// Cycles string `json:"cycle"` //1:班;2:天;3:周;4:月;5:季度;6:年
Cycles int `json:"cycle"` //1:班;2:天;3:周;4:月;5:季度;6:年 Cycles int `json:"cycle"` //1:班;2:天;3:周;4:月;5:季度;6:年
CycleAttres int `json:"cycleattr"` //辅助计数 CycleAttres int `json:"cycleattr"` //辅助计数
DepartmentId string `json:"parentid"` //执行考核部门ID DepartmentId string `json:"parentid"` //执行考核部门ID
@ -340,6 +341,7 @@ type NewOutPutDetailedTarget struct {
Unit string `json:"unit"` //单位 Unit string `json:"unit"` //单位
Score string `json:"score"` //分值 Score string `json:"score"` //分值
AssId string `json:"assid"` AssId string `json:"assid"`
AddReduce int `json:"addreduce"` //1:减少;2:增加;3:无属性,现场确认加或减
} }
// //
@ -524,3 +526,10 @@ type EiteTargetContListSun struct {
CensorCont string `json:"censorcont"` //检查依据 CensorCont string `json:"censorcont"` //检查依据
CensorRate int `json:"censorrate"` //检查频次 CensorRate int `json:"censorrate"` //检查频次
} }
//定性考核列表
type dutyList struct {
Group int64 `json:"group" gorm:"column:group;type:bigint(20) unsigned;default:0;not null;comment:集团ID"`
TargetId int64 `json:"targetid" gorm:"column:targetid;type:bigint(20) unsigned;default:0;not null;comment:指标"`
SunTargetId int64 `json:"suntargetid" gorm:"column:suntargetid;type:bigint(20) unsigned;default:0;not null;comment:子栏目ID"`
}

34
gin_server_admin/api/admin/dutyassess/dutyes.go

@ -75,12 +75,17 @@ func JudgeDetailsCopyEs(ascription, departStr string, sunTargetId int64, detaile
eiteCont["dt_title"] = detailedTarget.Title eiteCont["dt_title"] = detailedTarget.Title
eiteCont["dt_content"] = detailedTarget.Content eiteCont["dt_content"] = detailedTarget.Content
eiteCont["dt_company"] = detailedTarget.Unit eiteCont["dt_company"] = detailedTarget.Unit
if detailedTarget.AddOrReduce > 0 {
eiteCont["dt_add_reduce"] = detailedTarget.AddOrReduce eiteCont["dt_add_reduce"] = detailedTarget.AddOrReduce
}
eiteCont["dt_time"] = time.Now().Unix() eiteCont["dt_time"] = time.Now().Unix()
if detailedTarget.Cycles != 0 { // if detailedTarget.Cycles != 0 {
// eiteCont["dt_cycle"] = detailedTarget.Cycles
// }
// if detailedTarget.Cycles != "" {
eiteCont["dt_cycle"] = detailedTarget.Cycles eiteCont["dt_cycle"] = detailedTarget.Cycles
} // }
if detailedTarget.CycleAttres != 0 { if detailedTarget.CycleAttres != 0 {
eiteCont["dt_cycleattr"] = detailedTarget.CycleAttres eiteCont["dt_cycleattr"] = detailedTarget.CycleAttres
} }
@ -116,12 +121,18 @@ func JudgeDetailsCopyEs(ascription, departStr string, sunTargetId int64, detaile
} }
eiteCont["dt_content"] = detailedTarget.Content eiteCont["dt_content"] = detailedTarget.Content
eiteCont["dt_company"] = detailedTarget.Unit eiteCont["dt_company"] = detailedTarget.Unit
if detailedTarget.AddOrReduce > 0 {
eiteCont["dt_add_reduce"] = detailedTarget.AddOrReduce eiteCont["dt_add_reduce"] = detailedTarget.AddOrReduce
}
eiteCont["dt_time"] = time.Now().Unix() eiteCont["dt_time"] = time.Now().Unix()
if detailedTarget.Cycles != 0 { // if detailedTarget.Cycles != "" {
// eiteCont["dt_cycle"] = detailedTarget.Cycles
// }
// if detailedTarget.Cycles != 0 {
eiteCont["dt_cycle"] = detailedTarget.Cycles eiteCont["dt_cycle"] = detailedTarget.Cycles
} // }
if detailedTarget.CycleAttres != 0 { if detailedTarget.CycleAttres != 0 {
eiteCont["dt_cycleattr"] = detailedTarget.CycleAttres eiteCont["dt_cycleattr"] = detailedTarget.CycleAttres
} }
@ -188,13 +199,26 @@ func JudgeDetailsCopyEs(ascription, departStr string, sunTargetId int64, detaile
tarEvlWhe := commonus.MapOut() tarEvlWhe := commonus.MapOut()
tarEvlWhe["et_id"] = ascriptionId tarEvlWhe["et_id"] = ascriptionId
targetInfoCont.GetCont(tarEvlWhe, "et_cycle", "et_cycleattr") targetInfoCont.GetCont(tarEvlWhe, "et_cycle", "et_cycleattr")
// intCycles, _ := strconv.Atoi(detailedTarget.Cycles)
// if intCycles > 0 {
// saveColumEs.Cycles = intCycles
// } else {
// if targetInfoCont.Cycles > 1 {
// saveColumEs.Cycles = targetInfoCont.Cycles
// } else {
// saveColumEs.Cycles = 4
// }
// }
if detailedTarget.Cycles > 0 { if detailedTarget.Cycles > 0 {
saveColumEs.Cycles = detailedTarget.Cycles saveColumEs.Cycles = detailedTarget.Cycles
} else { } else {
if targetInfoCont.Cycles > 1 { if targetInfoCont.Cycles > 1 {
saveColumEs.Cycles = targetInfoCont.Cycles saveColumEs.Cycles = targetInfoCont.Cycles
} else { } else {
saveColumEs.Cycles = 4 saveColumEs.Cycles = 0
} }
} }

126
gin_server_admin/api/admin/dutyassess/dutyhandle.go

@ -482,7 +482,8 @@ func (d *DutyAssessApi) EiteSunTargetName(c *gin.Context) {
} }
eiteAssContDeite["dt_censor_cont"] = requestData.CensorCont eiteAssContDeite["dt_censor_cont"] = requestData.CensorCont
if requestData.CensorRate > 0 { if requestData.CensorRate > 0 {
eiteAssContDeite["dt_censor_rate"] = requestData.CensorRate // eiteAssContDeite["dt_censor_rate"] = requestData.CensorRate
eiteAssContDeite["dt_cycle"] = requestData.CensorRate
} }
if len(requestData.DepartmentMap) > 0 { if len(requestData.DepartmentMap) > 0 {
eiteAssContDeite["dt_paretment"] = strings.Join(requestData.DepartmentMap, ",") eiteAssContDeite["dt_paretment"] = strings.Join(requestData.DepartmentMap, ",")
@ -582,8 +583,8 @@ func (d *DutyAssessApi) AddDutyRelation(c *gin.Context) {
var requestData AddQualEval var requestData AddQualEval
err := c.ShouldBindJSON(&requestData) err := c.ShouldBindJSON(&requestData)
if err != nil { if err != nil {
response.Result(101, err, "数据获取失败!", c) // response.Result(101, err, "数据获取失败!", c)
return // return
} }
if requestData.Group == "" { if requestData.Group == "" {
response.Result(102, err, "请选择归属集团", c) response.Result(102, err, "请选择归属集团", c)
@ -644,6 +645,7 @@ func (d *DutyAssessApi) AddDutyRelation(c *gin.Context) {
global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.DetailedTarget{}).Select("`dt_id`").Where("`dt_state` = 1 AND `dt_parentid` = ? AND `dt_parentid_sun` = ?", requestData.Target, sunTargetCont.Id).Find(&oldId) global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.DetailedTarget{}).Select("`dt_id`").Where("`dt_state` = 1 AND `dt_parentid` = ? AND `dt_parentid_sun` = ?", requestData.Target, sunTargetCont.Id).Find(&oldId)
//遍历指标细则 //遍历指标细则
var targetContList []DutyAssEssTarget var targetContList []DutyAssEssTarget
var newAddId []int64 var newAddId []int64
for _, v := range requestData.EvaluationList { for _, v := range requestData.EvaluationList {
// detailedTargetInfo, dtiIsTrue := commonus.JudgeDetails(requestData.Target, v.Title, v.Content, v.DetailedTarget, sunTargetCont.Id) // detailedTargetInfo, dtiIsTrue := commonus.JudgeDetails(requestData.Target, v.Title, v.Content, v.DetailedTarget, sunTargetCont.Id)
@ -730,34 +732,43 @@ func (d *DutyAssessApi) AddDutyRelation(c *gin.Context) {
} }
if judgeARTErr == nil { if judgeARTErr == nil {
var eiteTarList []DutyAssEssTarget var eiteTarList []DutyAssEssTarget
// var eiteId []int64 // var eiteId []int64
if arTaegetInfo.Content != "" && arTaegetInfo.Content != "null" { if arTaegetInfo.Content != "" && arTaegetInfo.Content != "null" {
var tarList []DutyAssEssTarget var tarList []DutyAssEssTarget
jsonErr := json.Unmarshal([]byte(arTaegetInfo.Content), &tarList) jsonErr := json.Unmarshal([]byte(arTaegetInfo.Content), &tarList)
if jsonErr == nil { if jsonErr == nil {
if len(tarList) > len(targetContList) { // if len(tarList) > len(targetContList) {
for _, tl_v := range tarList { // for _, tl_v := range tarList {
tarInfo, tarInfoErr := JudgeDeiScor(tl_v.Id, targetContList) // tarInfo, tarInfoErr := JudgeDeiScor(tl_v.Id, targetContList)
if tarInfoErr == false { // if tarInfoErr == false {
eiteTarList = append(eiteTarList, tarInfo) // eiteTarList = append(eiteTarList, tarInfo)
} else { // } else {
eiteTarList = append(eiteTarList, tl_v) // eiteTarList = append(eiteTarList, tl_v)
} // }
} // }
} else { // } else {
// for _, ttl_v := range targetContList {
// tarInfo, tarInfoErr := JudgeDeiScor(ttl_v.Id, tarList)
// if tarInfoErr == true {
// eiteTarList = append(eiteTarList, tarInfo)
// } else {
// eiteTarList = append(eiteTarList, ttl_v)
// }
// }
// }
for _, ttl_v := range targetContList { for _, ttl_v := range targetContList {
tarInfo, tarInfoErr := JudgeDeiScor(ttl_v.Id, tarList)
if tarInfoErr == true {
eiteTarList = append(eiteTarList, tarInfo)
} else {
eiteTarList = append(eiteTarList, ttl_v) eiteTarList = append(eiteTarList, ttl_v)
} }
for _, tl_v := range tarList {
_, tarInfoErr := JudgeDeiScor(tl_v.Id, targetContList)
if tarInfoErr == false {
eiteTarList = append(eiteTarList, tl_v)
} }
} }
} }
} else { } else {
@ -789,7 +800,7 @@ func (d *DutyAssessApi) AddDutyRelation(c *gin.Context) {
eiteErr := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.Assesstarget{}).Where("`at_id` = ?", arTaegetInfo.Id).Updates(eiteCont).Error eiteErr := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.Assesstarget{}).Where("`at_id` = ?", arTaegetInfo.Id).Updates(eiteCont).Error
if eiteErr == nil { if eiteErr == nil {
response.Result(0, err, "处理成功!", c) response.Result(0, err, "处理成功!1", c)
} else { } else {
response.Result(107, err, "请添加测评详情!", c) response.Result(107, err, "请添加测评详情!", c)
} }
@ -807,7 +818,7 @@ func (d *DutyAssessApi) AddDutyRelation(c *gin.Context) {
arTaegetInfo.Time = time.Now().Unix() arTaegetInfo.Time = time.Now().Unix()
addErr := global.GVA_DB_Performanceappraisal.Create(&arTaegetInfo).Error addErr := global.GVA_DB_Performanceappraisal.Create(&arTaegetInfo).Error
if addErr == nil { if addErr == nil {
response.Result(0, err, "处理成功!", c) response.Result(0, err, "处理成功!2", c)
} else { } else {
response.Result(107, err, "请添加测评详情!", c) response.Result(107, err, "请添加测评详情!", c)
} }
@ -828,13 +839,19 @@ func JudgeDeiScor(id int64, listCont []DutyAssEssTarget) (cont DutyAssEssTarget,
//获取定性考核指标关系指定列表 //获取定性考核指标关系指定列表
func (d *DutyAssessApi) GetDutyRelationList(c *gin.Context) { func (d *DutyAssessApi) GetDutyRelationList(c *gin.Context) {
// var sunTargerIdAry []int64 // var targetAssessAry []assessmentmodel.Assesstarget
// errGroup := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.Assesstarget{}).Select("`group`,`targetid`,`suntargetid`").Group("`group`,`targetid`,`suntargetid`").Order("`group` ASC").Order("`targetid` ASC").Order("`suntargetid` ASC").Find(&sunTargerIdAry).Error // errGroup := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.Assesstarget{}).Select("`group`,`targetid`").Group("`group`,`targetid`").Order("`group` ASC").Order("`targetid` ASC").Find(&targetAssessAry).Error
// if errGroup != nil { // if errGroup != nil {
// response.Result(107, errGroup, "没有信息", c) // response.Result(107, errGroup, "没有信息", c)
// return // return
// } // }
// for _,v := range targetAssessAry{
// var sunIdList
// }
// response.Result(107, sunTargerIdAry, "没有信息", c)
// return
var list []assessmentmodel.Assesstarget var list []assessmentmodel.Assesstarget
err := global.GVA_DB_Performanceappraisal.Order("`group` ASC").Order("`targetid` ASC").Order("`suntargetid` ASC").Find(&list).Error err := global.GVA_DB_Performanceappraisal.Order("`group` ASC").Order("`targetid` ASC").Order("`suntargetid` ASC").Find(&list).Error
if err != nil { if err != nil {
@ -934,11 +951,14 @@ func (d *DutyAssessApi) LookDutyTargetInfo(c *gin.Context) {
// if requestData.DepartId != "" { // if requestData.DepartId != "" {
// goromDb = goromDb.Where("FIND_IN_SET(?,`qe_operator`)", requestData.DepartId) // goromDb = goromDb.Where("FIND_IN_SET(?,`qe_operator`)", requestData.DepartId)
// } // }
assErr := goromDb.Find(&assessInfoList).Error assErr := goromDb.Find(&assessInfoList).Error
if assErr != nil { if assErr != nil {
response.Result(105, assErr, "没有获取到数据!", c) response.Result(105, assErr, "没有获取到数据!", c)
return return
} }
// response.Result(104, assessInfoList, "参数错误!无法获取数据", c)
// return
var uotContAry []TargetContOutCont var uotContAry []TargetContOutCont
for _, v := range assessInfoList { for _, v := range assessInfoList {
var uotCont TargetContOutCont var uotCont TargetContOutCont
@ -992,7 +1012,7 @@ func (d *DutyAssessApi) LookDutyTargetInfo(c *gin.Context) {
// } else { // } else {
// isShow = true // isShow = true
// } // }
// fmt.Printf("isShow-------->%v-------->%v-------->%v---->%v\n", isShow, requestData.DepartId, sunTarDepartMap, v.SunTargetId) fmt.Printf("isShow-------->%v-------->%v-------->%v---->%v\n", isShow, requestData.DepartId, sunTarDepartMap, v.SunTargetId)
if isShow == true { if isShow == true {
uotCont.TargetSunName = info.Title uotCont.TargetSunName = info.Title
//拆解指标详情 //拆解指标详情
@ -1046,7 +1066,7 @@ func (d *DutyAssessApi) LookDutyTargetInfo(c *gin.Context) {
} }
} }
fmt.Printf("isShowTar-------->%v---->%v---->%v\n", isShowTar, requestData.DepartId, dtCont) fmt.Printf("isShowTar------isShowTar-->%v--requestData-->%v--DepartId-->%v--dtCont-->%v\n", isShowTar, requestData, requestData.DepartId, dtCont)
if isShowTar == true { if isShowTar == true {
uotCont.DetailedTargetName = dtCont.Title uotCont.DetailedTargetName = dtCont.Title
uotCont.Content = dtCont.Content uotCont.Content = dtCont.Content
@ -1146,6 +1166,12 @@ func (d *DutyAssessApi) NewDelTarGet(c *gin.Context) {
response.Result(105, err, "你当前要删除的项目已经使用!请不要删除!以免造成正在进行的审批统计产生数据误差!", c) response.Result(105, err, "你当前要删除的项目已经使用!请不要删除!以免造成正在进行的审批统计产生数据误差!", c)
return return
} }
var oldAssEssData []assessmentmodel.Assesstarget
global.GVA_DB_Performanceappraisal.Where("`group` = ? AND `dimension` = ? AND `targetid` = ?", requestData.Group, requestData.Dimension, requestData.TargetId).Find(&oldAssEssData)
if len(oldAssEssData) > 0 {
assessAttbar(oldAssEssData)
}
// response.Result(0, oldAssEssData, "删除成功!", c)
delErr := global.GVA_DB_Performanceappraisal.Where("`group` = ? AND `dimension` = ? AND `targetid` = ?", requestData.Group, requestData.Dimension, requestData.TargetId).Delete(&assessmentmodel.Assesstarget{}).Error delErr := global.GVA_DB_Performanceappraisal.Where("`group` = ? AND `dimension` = ? AND `targetid` = ?", requestData.Group, requestData.Dimension, requestData.TargetId).Delete(&assessmentmodel.Assesstarget{}).Error
if delErr != nil { if delErr != nil {
response.Result(106, delErr, "删除失败!", c) response.Result(106, delErr, "删除失败!", c)
@ -1154,6 +1180,53 @@ func (d *DutyAssessApi) NewDelTarGet(c *gin.Context) {
response.Result(0, delErr, "删除成功!", c) response.Result(0, delErr, "删除成功!", c)
} }
//执行附属软删除
func assessAttbar(oldAssEssData []assessmentmodel.Assesstarget) {
var targetId []int64
var targetSunId []int64
var detaredTargetSunId []int64
for _, v := range oldAssEssData {
if commonus.IsItTrue(v.TargetId, targetId) == false {
targetId = append(targetId, v.TargetId)
}
if commonus.IsItTrue(v.SunTargetId, targetSunId) == false {
targetSunId = append(targetSunId, v.SunTargetId)
}
var duyEssTarget []DutyAssEssTarget
duyTarJsonErr := json.Unmarshal([]byte(v.Content), &duyEssTarget)
if duyTarJsonErr == nil {
if len(duyEssTarget) > 0 {
for _, dv := range duyEssTarget {
if commonus.IsItTrue(dv.Id, detaredTargetSunId) == false {
detaredTargetSunId = append(detaredTargetSunId, dv.Id)
}
}
}
}
}
// if len(targetId) > 0 {
// saveTarData := commonus.MapOut()
// saveTarData["et_state"] = 3
// saveTarData["et_time"] = time.Now().Unix()
// global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.EvaluationTarget{}).Where("`et_id` IN ?", targetId).Updates(&saveTarData)
// }
if len(targetSunId) > 0 {
saveSunTarData := commonus.MapOut()
saveSunTarData["q_state"] = 3
saveSunTarData["q_time"] = time.Now().Unix()
global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeTarget{}).Where("`q_id` IN ?", targetSunId).Updates(&saveSunTarData)
}
if len(detaredTargetSunId) > 0 {
saveTarData := commonus.MapOut()
saveTarData["dt_time"] = time.Now().Unix()
saveTarData["dt_state"] = 3
global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.DetailedTarget{}).Where("`dt_id` IN ?", detaredTargetSunId).Updates(&saveTarData)
}
// panic(detaredTargetSunId)
}
//获取被修改指标细则的详情 //获取被修改指标细则的详情
func (d *DutyAssessApi) GetNewEiteDetailedTarget(c *gin.Context) { func (d *DutyAssessApi) GetNewEiteDetailedTarget(c *gin.Context) {
var requestData GetDeitalTarCont var requestData GetDeitalTarCont
@ -1199,6 +1272,8 @@ func (d *DutyAssessApi) GetNewEiteDetailedTarget(c *gin.Context) {
outPutCont.CensorType = cenType outPutCont.CensorType = cenType
outPutCont.CensorCont = cont.CensorCont outPutCont.CensorCont = cont.CensorCont
outPutCont.CensorRate = cont.CensorRate outPutCont.CensorRate = cont.CensorRate
outPutCont.AddReduce = cont.AddReduce
//单位 //单位
outPutCont.Unit = cont.Company outPutCont.Unit = cont.Company
if cont.MinScore > 0 && cont.MaxScore > 0 { if cont.MinScore > 0 && cont.MaxScore > 0 {
@ -1315,6 +1390,7 @@ func (d *DutyAssessApi) NewEiteDetailedTarget(c *gin.Context) {
detailedTarget.Content = requestData.DetailedTargetContent //`json:"content"` //指标说明 detailedTarget.Content = requestData.DetailedTargetContent //`json:"content"` //指标说明
detailedTarget.Unit = requestData.Unit //`json:"unit"` //单位 detailedTarget.Unit = requestData.Unit //`json:"unit"` //单位
detailedTarget.ReferenceScore = requestData.Score //`json:"referencescore"` //标准分值 detailedTarget.ReferenceScore = requestData.Score //`json:"referencescore"` //标准分值
// detailedTarget.Cycles = fmt.Sprintf("%v", requestData.Cycles) //`json:"cycle"` //1:班;2:天;3:周;4:月;5:季度;6:年
detailedTarget.Cycles = requestData.Cycles //`json:"cycle"` //1:班;2:天;3:周;4:月;5:季度;6:年 detailedTarget.Cycles = requestData.Cycles //`json:"cycle"` //1:班;2:天;3:周;4:月;5:季度;6:年
detailedTarget.CycleAttres = requestData.CycleAttres // `json:"cycleattr"` //辅助计数 detailedTarget.CycleAttres = requestData.CycleAttres // `json:"cycleattr"` //辅助计数
// detailedTarget.DepartmentId =requestData. `json:"parentid"` //执行考核部门ID // detailedTarget.DepartmentId =requestData. `json:"parentid"` //执行考核部门ID

27
gin_server_admin/api/admin/dutyassess/planversio.go

@ -167,6 +167,12 @@ func (d *DutyAssessApi) AddDepartDutyVersio(c *gin.Context) {
savePlanVersio.State = judgeState savePlanVersio.State = judgeState
savePlanVersio.AddTime = todyTime savePlanVersio.AddTime = todyTime
savePlanVersio.EiteTime = todyTime savePlanVersio.EiteTime = todyTime
if len(requestData.Child) > 0 {
planJsonCont, planJsonErr := json.Marshal(requestData.Child)
if planJsonErr == nil {
savePlanVersio.Content = string(planJsonCont)
}
}
// response.Result(0, savePlanVersio, "添加成功!", c) // response.Result(0, savePlanVersio, "添加成功!", c)
// return // return
@ -174,7 +180,7 @@ func (d *DutyAssessApi) AddDepartDutyVersio(c *gin.Context) {
for _, v := range requestData.Child { //维度 for _, v := range requestData.Child { //维度
commonus.AddWeight(requestData.Group, v.Id, requestData.DepartmentId, "", int64(v.ZhiFraction), 1) //添加维度权重 commonus.AddWeight(requestData.Group, v.Id, requestData.DepartmentId, "", int64(v.ZhiFraction), 1) //添加维度权重
for _, tar_v := range v.Child { //指标 for _, tar_v := range v.Child { //指标
if tar_v.Status == 1 { if tar_v.Status == 1 || tar_v.Status == 3 {
targetId, _ := strconv.ParseInt(tar_v.Id, 10, 64) //指标ID转换 targetId, _ := strconv.ParseInt(tar_v.Id, 10, 64) //指标ID转换
evalTarCont, evalTarContErr := commonus.GetTargetInfo(targetId) //获取指标内容 evalTarCont, evalTarContErr := commonus.GetTargetInfo(targetId) //获取指标内容
if evalTarContErr == true { if evalTarContErr == true {
@ -246,16 +252,22 @@ func (d *DutyAssessApi) AddDepartDutyVersio(c *gin.Context) {
detailedListErr := json.Unmarshal([]byte(ass_v.Content), &detailedList) detailedListErr := json.Unmarshal([]byte(ass_v.Content), &detailedList)
if detailedListErr == nil { if detailedListErr == nil {
for _, det_v := range detailedList { for _, det_v := range detailedList {
var deparmentStr string
deErr := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.DetailedTarget{}).Select("`dt_paretment`").Where("`dt_id` = ? AND (FIND_IN_SET(?,`dt_paretment`) OR `dt_paretment` = '')", det_v.Id, departId).First(&deparmentStr).Error
if deErr == nil {
if deparmentStr != "" {
guoDuCont.DetailedTarget = det_v.Id guoDuCont.DetailedTarget = det_v.Id
guoDuCont.Operator = det_v.Operator guoDuCont.Operator = det_v.Operator
guoDu = append(guoDu, guoDuCont) guoDu = append(guoDu, guoDuCont)
fmt.Printf("Targer---6---->%v---->%v---->%v\n", ass_v.TargetId, ass_v.SunTargetId, det_v.Id) }
}
fmt.Printf("Targer---7---->%v---->%v---->%v---->%v---->%v\n", det_v.Id, departId, deparmentStr, guoDu, deErr)
} }
} else { } else {
guoDu = append(guoDu, guoDuCont) // guoDu = append(guoDu, guoDuCont)
} }
} else { } else {
guoDu = append(guoDu, guoDuCont) // guoDu = append(guoDu, guoDuCont)
} }
} }
@ -334,6 +346,10 @@ func (d *DutyAssessApi) AddDepartDutyVersio(c *gin.Context) {
} }
} }
} }
// saveDataJsonmww, _ := json.Marshal(saveDataAry)
// fmt.Printf("Targer---19---->%v\n", string(saveDataJsonmww))
// panic(saveDataAry)
if len(saveDataAry) > 0 { if len(saveDataAry) > 0 {
affairDb := global.GVA_DB_Performanceappraisal.Begin() affairDb := global.GVA_DB_Performanceappraisal.Begin()
@ -526,7 +542,8 @@ func (d *DutyAssessApi) OnOffDepartDutyVersio(c *gin.Context) {
eiteOtherData := commonus.MapOut() eiteOtherData := commonus.MapOut()
eiteOtherData["state"] = 2 eiteOtherData["state"] = 2
eiteOtherData["eitetime"] = time.Now().Unix() eiteOtherData["eitetime"] = time.Now().Unix()
global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.PlanVersio{}).Where("`group` = ? AND `department` = ? AND `yeares` = ?", ContInfo.Group, ContInfo.Department, ContInfo.Year).Updates(eiteOtherData) // global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.PlanVersio{}).Where("`group` = ? AND `department` = ? AND `yeares` = ?", ContInfo.Group, ContInfo.Department, ContInfo.Year).Updates(eiteOtherData)
global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.PlanVersio{}).Where("`group` = ? AND `department` = ?", ContInfo.Group, ContInfo.Department).Updates(eiteOtherData)
} }
eiteData := commonus.MapOut() eiteData := commonus.MapOut()

39
gin_server_admin/api/admin/systemuser/systemmenu.go

@ -101,7 +101,8 @@ func (s *SysTemMenuApi) GetMenuList(c *gin.Context) {
//添加菜单 //添加菜单
func (s *SysTemMenuApi) AddMenu(c *gin.Context) { func (s *SysTemMenuApi) AddMenu(c *gin.Context) {
isTrue, userCont := commonus.AdminClientIdentity() // isTrue, userCont := commonus.AdminClientIdentity()
isTrue, userCont := commonus.ClientIdentity()
if isTrue != true { if isTrue != true {
response.Result(101, isTrue, "您的身份令牌已经失效!请重新登录获取身份令牌!", c) response.Result(101, isTrue, "您的身份令牌已经失效!请重新登录获取身份令牌!", c)
return return
@ -128,17 +129,17 @@ func (s *SysTemMenuApi) AddMenu(c *gin.Context) {
// response.Result(105, isTrue, "您的身份令牌已经失效!请重新登录获取身份令牌!", c) // response.Result(105, isTrue, "您的身份令牌已经失效!请重新登录获取身份令牌!", c)
// return // return
// } // }
var menuCont systemuser.SystemMenu // var menuCont systemuser.SystemMenu
judgeErr := global.GVA_DB_Master.Model(&systemuser.SystemMenu{}).Select("m_id").Where("`m_title` = ?", requestData.Title).First(&menuCont).Error // judgeErr := global.GVA_DB_Master.Model(&systemuser.SystemMenu{}).Select("m_id").Where("`m_title` = ?", requestData.Title).First(&menuCont).Error
if judgeErr == nil { // if judgeErr == nil {
response.Result(106, isTrue, "该菜单名称已经存在!请不要重复添加!", c) // response.Result(106, isTrue, "该菜单名称已经存在!请不要重复添加!", c)
return // return
} // }
judgeUrlErr := global.GVA_DB_Master.Model(&systemuser.SystemMenu{}).Select("m_id").Where("`m_url` = ?", requestData.MenuUrl).First(&menuCont).Error // judgeUrlErr := global.GVA_DB_Master.Model(&systemuser.SystemMenu{}).Select("m_id").Where("`m_url` = ?", requestData.MenuUrl).First(&menuCont).Error
if judgeUrlErr == nil { // if judgeUrlErr == nil {
response.Result(107, isTrue, "该菜单URL已经存在!请不要重复添加!", c) // response.Result(107, isTrue, "该菜单URL已经存在!请不要重复添加!", c)
return // return
} // }
var saveMenu systemuser.SystemMenu var saveMenu systemuser.SystemMenu
saveMenu.Title = requestData.Title saveMenu.Title = requestData.Title
saveMenu.State = 1 saveMenu.State = 1
@ -146,7 +147,7 @@ func (s *SysTemMenuApi) AddMenu(c *gin.Context) {
saveMenu.ApiUrl = requestData.MenuUrl saveMenu.ApiUrl = requestData.MenuUrl
saveMenu.Time = time.Now().Unix() saveMenu.Time = time.Now().Unix()
saveMenu.EiteTime = time.Now().Unix() saveMenu.EiteTime = time.Now().Unix()
userKey, userKeyErr := strconv.ParseInt(userCont.UserKey, 10, 64) userKey, userKeyErr := strconv.ParseInt(userCont.Key, 10, 64)
if userKeyErr == nil { if userKeyErr == nil {
saveMenu.UserId = userKey saveMenu.UserId = userKey
} }
@ -161,7 +162,8 @@ func (s *SysTemMenuApi) AddMenu(c *gin.Context) {
//修改菜单 //修改菜单
func (s *SysTemMenuApi) EiteMenu(c *gin.Context) { func (s *SysTemMenuApi) EiteMenu(c *gin.Context) {
isTrue, _ := commonus.AdminClientIdentity() // isTrue, _ := commonus.AdminClientIdentity()
isTrue, _ := commonus.ClientIdentity()
if isTrue != true { if isTrue != true {
response.Result(101, isTrue, "您的身份令牌已经失效!请重新登录获取身份令牌!", c) response.Result(101, isTrue, "您的身份令牌已经失效!请重新登录获取身份令牌!", c)
return return
@ -229,7 +231,8 @@ func eiteAssEssInfoCont(saveId int64, saveData map[string]interface{}) (menuErr
//菜单删除 //菜单删除
func (s *SysTemMenuApi) DelMenu(c *gin.Context) { func (s *SysTemMenuApi) DelMenu(c *gin.Context) {
isTrue, _ := commonus.AdminClientIdentity() // isTrue, _ := commonus.AdminClientIdentity()
isTrue, _ := commonus.ClientIdentity()
if isTrue != true { if isTrue != true {
response.Result(101, isTrue, "您的身份令牌已经失效!请重新登录获取身份令牌!", c) response.Result(101, isTrue, "您的身份令牌已经失效!请重新登录获取身份令牌!", c)
return return
@ -285,7 +288,8 @@ func (s *SysTemMenuApi) DelMenu(c *gin.Context) {
//添加菜单操作 //添加菜单操作
func (s *SysTemMenuApi) AddMenuOperation(c *gin.Context) { func (s *SysTemMenuApi) AddMenuOperation(c *gin.Context) {
isTrue, _ := commonus.AdminClientIdentity() // isTrue, _ := commonus.AdminClientIdentity()
isTrue, _ := commonus.ClientIdentity()
if isTrue != true { if isTrue != true {
response.Result(101, isTrue, "您的身份令牌已经失效!请重新登录获取身份令牌!", c) response.Result(101, isTrue, "您的身份令牌已经失效!请重新登录获取身份令牌!", c)
return return
@ -331,7 +335,8 @@ func (s *SysTemMenuApi) AddMenuOperation(c *gin.Context) {
//删除菜单操作 //删除菜单操作
func (s *SysTemMenuApi) DelMenuOperation(c *gin.Context) { func (s *SysTemMenuApi) DelMenuOperation(c *gin.Context) {
isTrue, _ := commonus.AdminClientIdentity() // isTrue, _ := commonus.AdminClientIdentity()
isTrue, _ := commonus.ClientIdentity()
if isTrue != true { if isTrue != true {
response.Result(101, isTrue, "您的身份令牌已经失效!请重新登录获取身份令牌!", c) response.Result(101, isTrue, "您的身份令牌已经失效!请重新登录获取身份令牌!", c)
return return

48
gin_server_admin/api/index/assessment/assesshandle.go

@ -28,6 +28,54 @@ func (a *Assessment) Index(c *gin.Context) {
//扫码登录回传 //扫码登录回传
func (a *Assessment) ScanCode(c *gin.Context) { func (a *Assessment) ScanCode(c *gin.Context) {
var requestData scanCodeStr
err := c.ShouldBindJSON(&requestData)
if err != nil {
response.Result(101, err, "参数错误!请重新提交!", c)
return
}
var redisAdminInfo commonus.ScanCodeLogin
redisClient := redishandel.RunRedis()
redisClient.SetRedisDb(5)
redisKey := fmt.Sprintf("ScanCode:Authentication:LoginApi_%v_%v", global.GVA_CONFIG.RedisPrefix.Alias, requestData.UserKey)
tokenInfo, isTrue := redisClient.HashGetAll(redisKey)
if isTrue != true {
outData := commonus.MapOut()
outData["redisKey"] = redisKey
outData["tokenInfo"] = tokenInfo
outData["isTrue"] = isTrue
response.Result(102, outData, "验证失败!不允许登录!", c)
return
}
identityErr := mapstructure.Decode(tokenInfo, &redisAdminInfo)
if identityErr != nil {
response.Result(103222, redisKey, "验证失败!不允许登录!", c)
return
}
if requestData.UserToken != redisAdminInfo.UserToken {
yanzheng := commonus.MapOut()
yanzheng["User"] = redisAdminInfo
yanzheng["redisKey"] = redisKey
yanzheng["UserToken"] = requestData.UserToken
yanzheng["RedisUserToken"] = redisAdminInfo.UserToken
response.Result(104, yanzheng, "验证失败!不允许登录!", c)
return
}
sendData := commonus.MapOut()
sendData["key"] = redisAdminInfo.UserKey
sendData["token"] = redisAdminInfo.UserToken
sendData["userinfo"] = redisAdminInfo
var jurisDiction []int64
json.Unmarshal([]byte(redisAdminInfo.Jurisdiction), &jurisDiction)
sendData["Jurisdiction"] = jurisDiction
var menuOper []int64
json.Unmarshal([]byte(redisAdminInfo.MenuOper), &menuOper)
sendData["MenuOper"] = menuOper
response.Result(0, sendData, "用户端获取成功", c)
}
func (a *Assessment) ScanCodeOld(c *gin.Context) {
var requestData scanCodeStr var requestData scanCodeStr
err := c.ShouldBindJSON(&requestData) err := c.ShouldBindJSON(&requestData)
if err != nil { if err != nil {

2
gin_server_admin/api/index/enter.go

@ -4,12 +4,14 @@ import (
"github.com/flipped-aurora/gin-vue-admin/server/api/index/assessment" "github.com/flipped-aurora/gin-vue-admin/server/api/index/assessment"
"github.com/flipped-aurora/gin-vue-admin/server/api/index/evaluation" "github.com/flipped-aurora/gin-vue-admin/server/api/index/evaluation"
"github.com/flipped-aurora/gin-vue-admin/server/api/index/examineandapprove" "github.com/flipped-aurora/gin-vue-admin/server/api/index/examineandapprove"
"github.com/flipped-aurora/gin-vue-admin/server/api/index/statistics"
) )
type ApiGroup struct { type ApiGroup struct {
AssessMentApi assessment.ApiGroup AssessMentApi assessment.ApiGroup
ExamApproveApi examineandapprove.ApiGroup ExamApproveApi examineandapprove.ApiGroup
EvaluationApi evaluation.ApiGroup EvaluationApi evaluation.ApiGroup
StatisticsApi statistics.ApiGroup
} }
var ApiGroupApp = new(ApiGroup) var ApiGroupApp = new(ApiGroup)

4
gin_server_admin/api/index/evaluation/assessment.go

@ -1,6 +1,7 @@
package evaluation package evaluation
import ( import (
"encoding/json"
"fmt" "fmt"
"strconv" "strconv"
@ -18,12 +19,15 @@ func (e *EvaluationInterface) NewQualitative(c *gin.Context) {
response.Result(101, isTrue, "您的身份令牌已经失效!请重新登录获取身份令牌!", c) response.Result(101, isTrue, "您的身份令牌已经失效!请重新登录获取身份令牌!", c)
return return
} }
var requestData NewQualType var requestData NewQualType
err := c.ShouldBindJSON(&requestData) err := c.ShouldBindJSON(&requestData)
if err != nil { if err != nil {
// response.Result(102, err, "数据获取失败!", c) // response.Result(102, err, "数据获取失败!", c)
// return // return
} }
userContJson, _ := json.Marshal(userCont)
fmt.Printf("userCont----------------->%v\n", string(userContJson))
var qualEvaList []NewQualOutList var qualEvaList []NewQualOutList
gormDb := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Select("DISTINCT qe_group,qe_accept_evaluation,qe_dimension,qe_target,et_title").Joins("left join evaluationtarget on evaluationtarget.et_id = qualitative_evaluation.qe_target").Where("`qe_type` = 1 AND `qe_state` = 1 AND FIND_IN_SET(?,`qe_operator`)", userCont.Key) gormDb := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Select("DISTINCT qe_group,qe_accept_evaluation,qe_dimension,qe_target,et_title").Joins("left join evaluationtarget on evaluationtarget.et_id = qualitative_evaluation.qe_target").Where("`qe_type` = 1 AND `qe_state` = 1 AND FIND_IN_SET(?,`qe_operator`)", userCont.Key)
if requestData.Group != "" { if requestData.Group != "" {

9
gin_server_admin/api/index/evaluation/evaluation.go

@ -965,11 +965,20 @@ func (e *EvaluationInterface) AddFlowRationLog(c *gin.Context) {
flowLog.Key = keyNumber flowLog.Key = keyNumber
flowLog.Time = time.Now().Unix() flowLog.Time = time.Now().Unix()
flowLog.EiteTime = time.Now().Unix() flowLog.EiteTime = time.Now().Unix()
if requestData.Addtime != "" {
timeOccurrence := commonus.DateToTimeStamp(requestData.Addtime) //发生时间
flowLog.Year = commonus.ComputingTime(timeOccurrence, 1)
flowLog.Quarter = commonus.ComputingTime(timeOccurrence, 2)
flowLog.Month = commonus.ComputingTime(timeOccurrence, 3)
flowLog.Week = commonus.ComputingTime(timeOccurrence, 4)
flowLog.ToDay = commonus.ComputingTime(timeOccurrence, 5)
} else {
flowLog.Year = commonus.ComputingTime(operationTime, 1) flowLog.Year = commonus.ComputingTime(operationTime, 1)
flowLog.Quarter = commonus.ComputingTime(operationTime, 2) flowLog.Quarter = commonus.ComputingTime(operationTime, 2)
flowLog.Month = commonus.ComputingTime(operationTime, 3) flowLog.Month = commonus.ComputingTime(operationTime, 3)
flowLog.Week = commonus.ComputingTime(operationTime, 4) flowLog.Week = commonus.ComputingTime(operationTime, 4)
flowLog.ToDay = commonus.ComputingTime(operationTime, 5) flowLog.ToDay = commonus.ComputingTime(operationTime, 5)
}
flowLog.EvaluationDepartment = departmentId flowLog.EvaluationDepartment = departmentId
flowLog.EvaluationUser = userKey flowLog.EvaluationUser = userKey

26
gin_server_admin/api/index/evaluation/flowsend.go

@ -58,6 +58,15 @@ func (e *EvaluationInterface) PlusOrMinusPoints(c *gin.Context) {
response.Result(107, requestData, "请您输入要操作的分数,谢谢!", c) response.Result(107, requestData, "请您输入要操作的分数,谢谢!", c)
return return
} }
tijaoFenshu := commonus.GetDuyCycle(requestData.Score, 100)
if tijaoFenshu > programme.MaxScore {
response.Result(107, requestData, fmt.Sprintf("您提交的分数操作允许提交的最大值(最大值:%v)!", float64(programme.MaxScore)/100), c)
return
}
if tijaoFenshu < programme.MinScore {
response.Result(107, requestData, fmt.Sprintf("您提交的分数操作允许提交的最大值(最小值:%v)!", float64(programme.MinScore)/100), c)
return
}
case 1: case 1:
//获取分数 //获取分数
requestData.Score = strconv.FormatInt(programme.MaxScore, 10) requestData.Score = strconv.FormatInt(programme.MaxScore, 10)
@ -92,7 +101,10 @@ func (e *EvaluationInterface) PlusOrMinusPoints(c *gin.Context) {
addScore.Time = operationTime addScore.Time = operationTime
addScore.EiteTime = operationTime addScore.EiteTime = operationTime
addScore.Count = countFrequency //发生次数 addScore.Count = countFrequency //发生次数
addScore.HappenTime = commonus.DateToTimeStamp(requestData.Addtime) //发生时间
timeOccurrence := commonus.DateToTimeStamp(requestData.Addtime) //发生时间
addScore.HappenTime = timeOccurrence
// addScore.HappenTime = commonus.DateToTimeStamp(requestData.Addtime) //发生时间
departmentId, departmentIdErr := strconv.ParseInt(userCont.Deparment, 10, 64) departmentId, departmentIdErr := strconv.ParseInt(userCont.Deparment, 10, 64)
if departmentIdErr == nil { if departmentIdErr == nil {
addScore.EvaluationDepartment = departmentId //测评部门 addScore.EvaluationDepartment = departmentId //测评部门
@ -106,10 +118,14 @@ func (e *EvaluationInterface) PlusOrMinusPoints(c *gin.Context) {
addScore.EvaluationGroup = userGroup //测评集团 addScore.EvaluationGroup = userGroup //测评集团
} }
//获取拆分时间节 //获取拆分时间节
addScore.Year = commonus.ComputingTime(operationTime, 1) addScore.Year = commonus.ComputingTime(timeOccurrence, 1)
addScore.Quarter = commonus.ComputingTime(operationTime, 2) addScore.Quarter = commonus.ComputingTime(timeOccurrence, 2)
addScore.Month = commonus.ComputingTime(operationTime, 3) addScore.Month = commonus.ComputingTime(timeOccurrence, 3)
addScore.Week = commonus.ComputingTime(operationTime, 4) addScore.Week = commonus.ComputingTime(timeOccurrence, 4)
// addScore.Year = commonus.ComputingTime(operationTime, 1)
// addScore.Quarter = commonus.ComputingTime(operationTime, 2)
// addScore.Month = commonus.ComputingTime(operationTime, 3)
// addScore.Week = commonus.ComputingTime(operationTime, 4)
if len(requestData.Enclosure) > 0 { if len(requestData.Enclosure) > 0 {
enclosure, enclosureErr := json.Marshal(requestData.Enclosure) enclosure, enclosureErr := json.Marshal(requestData.Enclosure)
if enclosureErr == nil { if enclosureErr == nil {

1
gin_server_admin/api/index/evaluation/type.go

@ -120,6 +120,7 @@ type CorrectiveMeasuresType struct {
type AddRationFlowLog struct { type AddRationFlowLog struct {
GroupId string `json:"groupid"` GroupId string `json:"groupid"`
DepartmentID string `json:"departmentid"` DepartmentID string `json:"departmentid"`
Addtime string `json:"time"` //检查时间
List []RationLogList `json:"list"` List []RationLogList `json:"list"`
} }

4
gin_server_admin/api/index/statistics/enter.go

@ -0,0 +1,4 @@
package statistics
//统计
type ApiGroup struct{}

33
gin_server_admin/api/index/statistics/programme.go

@ -0,0 +1,33 @@
package statistics
import (
"strconv"
"github.com/flipped-aurora/gin-vue-admin/server/commonus"
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
"github.com/gin-gonic/gin"
)
//考核入口
func (a *ApiGroup) Index(c *gin.Context) {
outPut := commonus.MapOut()
response.Result(0, outPut, "方案数据表格获取成功", c)
}
//方案数据表格统计
func (a *ApiGroup) PlanVersioStatistics(c *gin.Context) {
var requestData commonus.SetIds
err := c.ShouldBindJSON(&requestData)
if err != nil {
response.Result(101, err, "参数错误!请重新提交!", c)
return
}
if requestData.Id == 0 && requestData.OutId == "" {
response.Result(102, err, "参数错误!请重新提交!", c)
return
}
if requestData.OutId != "" && requestData.Id == 0 {
idInt, _ := strconv.ParseInt(requestData.OutId, 10, 64)
requestData.Id = idInt
}
}

6
gin_server_admin/api/statistics/enter.go

@ -1,9 +1,13 @@
package statistics package statistics
import "github.com/flipped-aurora/gin-vue-admin/server/api/statistics/nature" import (
"github.com/flipped-aurora/gin-vue-admin/server/api/statistics/nature"
"github.com/flipped-aurora/gin-vue-admin/server/api/statistics/quantification"
)
type ApiGroup struct { type ApiGroup struct {
NatureApi nature.ApiGroup NatureApi nature.ApiGroup
QuantApi quantification.ApiGroup
} }
var ApiGroupApp = new(ApiGroup) var ApiGroupApp = new(ApiGroup)

4
gin_server_admin/api/statistics/nature/enter.go

@ -12,14 +12,14 @@ type natureParameter struct {
TargetId []string `json:"targetid"` //指标 TargetId []string `json:"targetid"` //指标
Org []string `json:"org"` //行政组织 Org []string `json:"org"` //行政组织
Year []string `json:"year"` //年 Year []string `json:"year"` //年
TimeAttribute []TimeAttributeMap `json:"timeattribute"` //时间辅助 TimeAttribute TimeAttributeMap `json:"timeattribute"` //时间辅助
AccMethod []int `json:"accmethod"` //核算方式 1:合计值;2:平均值 AccMethod []int `json:"accmethod"` //核算方式 1:合计值;2:平均值
} }
//时间属性 //时间属性
type TimeAttributeMap struct { type TimeAttributeMap struct {
Class int `json:"class"` //0:全年;1:半年;2:季度;3:月度 Class int `json:"class"` //0:全年;1:半年;2:季度;3:月度
Time []int `json:"time"` //class->0(0),class->1(1:上半年,2:下半年),class->2(1:第一季度,2:第二季度,3:第三季度,4:第四季度),class->3(1:1月....12:12月) Time []int `json:"time"` //class->0(0),Time->1(1:上半年,2:下半年),class->2(1:第一季度,2:第二季度,3:第三季度,4:第四季度),class->3(1:1月....12:12月)
} }
//组织架构 //组织架构

60
gin_server_admin/api/statistics/nature/statistics.go

@ -214,8 +214,64 @@ func (a *ApiGroup) NatureStatistics(c *gin.Context) {
return return
} }
if len(requestData.TargetId) < 1 { if len(requestData.TargetId) < 1 {
response.Result(102, err, "未获取到指标", c) response.Result(103, err, "未获取到指标", c)
return return
} }
// var scoreFlow [] for _, v := range requestData.TargetId {
calculationEvaluation(v, requestData)
}
}
//计算指标相关数值
func calculationEvaluation(taskId string, dataAry natureParameter) (err error) {
var scorFlowList []assessmentmodel.ScoreFlow
gormDb := global.GVA_DB_Performanceappraisal.Where("`sf_evaluation_plan` = ?", taskId)
if len(dataAry.Year) > 0 {
gormDb = gormDb.Where("`sf_year` IN ?", dataAry.Year)
switch dataAry.TimeAttribute.Class {
case 1:
var monthAry []int
for _, v := range dataAry.TimeAttribute.Time {
if v == 1 {
for i := 1; i < 7; i++ {
monthAry = append(monthAry, i)
}
}
if v == 2 {
for j := 7; j < 13; j++ {
monthAry = append(monthAry, j)
}
}
}
if len(monthAry) > 0 {
gormDb = gormDb.Where("`sf_month` IN ?", monthAry)
}
case 2:
var quarterAry []int
for _, v := range dataAry.TimeAttribute.Time {
quarterAry = append(quarterAry, v)
}
if len(quarterAry) > 0 {
gormDb = gormDb.Where("`sf_quarter` IN ?", quarterAry)
}
case 3:
var monthAry []int
for _, v := range dataAry.TimeAttribute.Time {
monthAry = append(monthAry, v)
}
if len(monthAry) > 0 {
gormDb = gormDb.Where("`sf_month` IN ?", monthAry)
}
default:
}
}
if len(dataAry.Org) > 0 {
gormDb = gormDb.Where("`sf_duty_department` IN ?", dataAry.Org)
}
err = gormDb.Find(&scorFlowList).Error
if err != nil {
return
}
return
} }

965
gin_server_admin/api/statistics/quantification/auxiliarycalculation.go

@ -0,0 +1,965 @@
package quantification
import (
"fmt"
"strconv"
"time"
"github.com/flipped-aurora/gin-vue-admin/server/commonus"
"github.com/flipped-aurora/gin-vue-admin/server/global"
"github.com/flipped-aurora/gin-vue-admin/server/model/assessmentmodel"
)
//获取总值
func AuxiliaryCalculationSum(where interface{}) (sumScore float64) {
gormDb := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.FlowLogData{}).Joins("left join flow_log as fl on fl.fl_key = flow_log_data.fld_flow_log").Where(where)
gormDb.Pluck("COALESCE(SUM(fld_score), 0) as rescore", &sumScore)
return
}
//获取总数
func AuxiliaryCalculationCount(where interface{}) (sumScore float64) {
gormDb := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.FlowLogData{}).Joins("left join flow_log as fl on fl.fl_key = flow_log_data.fld_flow_log").Where(where)
gormDb.Pluck("COALESCE(COUNT(fld_id), 0) as countid", &sumScore) //获取总数
return
}
//计算总值和平均值
func AverageOfSum(where interface{}, class ...int) (sumScore float64, averageScore float64) {
sumScore = AuxiliaryCalculationSum(where) / 100
if len(class) > 0 {
countPage := AuxiliaryCalculationCount(where)
if countPage > 0 {
averageScore = sumScore / countPage
}
}
if sumScore != 0 {
sumScore = commonus.Decimal(sumScore)
}
if averageScore != 0 {
averageScore = commonus.Decimal(averageScore)
}
return
}
//时间推算
/*
@dataAry 接收的界定参数
*/
func EstimatedTime(dataAry natureParameter) (timeFrame []TimeFrame) {
if len(dataAry.Year) > 0 {
switch dataAry.TimeAttribute.Class {
case 1:
for _, yearV := range dataAry.Year {
if len(dataAry.TimeAttribute.Time) > 0 {
for _, banYearVal := range dataAry.TimeAttribute.Time {
if banYearVal == 1 {
var timeFrameInfo TimeFrame
timeFrameInfo.XLine = fmt.Sprintf("%v上半年", yearV)
timeFrameInfo.Class = 1
timeFrameInfo.YearName = yearV
timeFrameInfo.Where = []int{1, 2, 3, 4, 5, 6}
timeFrame = append(timeFrame, timeFrameInfo)
}
if banYearVal == 2 {
var timeFrameInfo TimeFrame
timeFrameInfo.XLine = fmt.Sprintf("%v下半年", yearV)
timeFrameInfo.Class = 1
timeFrameInfo.YearName = yearV
timeFrameInfo.Where = []int{7, 8, 9, 10, 11, 12}
timeFrame = append(timeFrame, timeFrameInfo)
}
}
} else {
var timeFrameInfo TimeFrame
timeFrameInfo.XLine = fmt.Sprintf("%v上半年", yearV)
timeFrameInfo.Class = 1
timeFrameInfo.YearName = yearV
timeFrameInfo.Where = []int{1, 2, 3, 4, 5, 6}
timeFrame = append(timeFrame, timeFrameInfo)
var timeFrameInfoXia TimeFrame
timeFrameInfoXia.XLine = fmt.Sprintf("%v下半年", yearV)
timeFrameInfoXia.Class = 1
timeFrameInfoXia.YearName = yearV
timeFrameInfoXia.Where = []int{7, 8, 9, 10, 11, 12}
timeFrame = append(timeFrame, timeFrameInfoXia)
}
}
case 2:
if len(dataAry.TimeAttribute.Time) > 0 && len(dataAry.TimeAttribute.Time) < 5 {
for _, quarV := range dataAry.TimeAttribute.Time {
var timeFrameInfo TimeFrame
timeFrameInfo.XLine = fmt.Sprintf("%v季度", quarV)
timeFrameInfo.Class = 2
timeFrameInfo.YearName = fmt.Sprintf("%v", quarV)
timeFrameInfo.Where = append(timeFrameInfo.Where, quarV)
timeFrame = append(timeFrame, timeFrameInfo)
}
} else {
for i := 1; i < 5; i++ {
var timeFrameInfo TimeFrame
timeFrameInfo.XLine = fmt.Sprintf("%v季度", i)
timeFrameInfo.Class = 2
timeFrameInfo.YearName = fmt.Sprintf("%v", i)
timeFrameInfo.Where = append(timeFrameInfo.Where, i)
timeFrame = append(timeFrame, timeFrameInfo)
}
}
case 3:
if len(dataAry.TimeAttribute.Time) > 0 {
for _, monthV := range dataAry.TimeAttribute.Time {
var timeFrameInfo TimeFrame
timeFrameInfo.XLine = fmt.Sprintf("%v月", monthV)
timeFrameInfo.Class = 3
timeFrameInfo.YearName = fmt.Sprintf("%v", monthV)
timeFrameInfo.Where = append(timeFrameInfo.Where, monthV)
timeFrame = append(timeFrame, timeFrameInfo)
}
} else {
for i := 1; i < 13; i++ {
var timeFrameInfo TimeFrame
timeFrameInfo.XLine = fmt.Sprintf("%v月", i)
timeFrameInfo.Class = 3
timeFrameInfo.YearName = fmt.Sprintf("%v", i)
timeFrameInfo.Where = append(timeFrameInfo.Where, i)
timeFrame = append(timeFrame, timeFrameInfo)
}
}
default:
for _, yv := range dataAry.Year {
var timeFrameInfo TimeFrame
timeFrameInfo.XLine = fmt.Sprintf("%v年", yv)
timeFrameInfo.Class = 0
yearInt, _ := strconv.Atoi(yv)
timeFrameInfo.Where = append(timeFrameInfo.Where, yearInt)
timeFrame = append(timeFrame, timeFrameInfo)
}
}
} else {
dangQianTime := time.Now().Unix()
dangQianYear := commonus.TimeStampToDate(dangQianTime, 11)
var timeFrameInfo TimeFrame
timeFrameInfo.XLine = fmt.Sprintf("%v年", dangQianYear)
timeFrameInfo.Class = 0
yearInt, _ := strconv.Atoi(dangQianYear)
timeFrameInfo.Where = append(timeFrameInfo.Where, yearInt)
timeFrame = append(timeFrame, timeFrameInfo)
}
return
}
//时间维度统计计算
/*
@taskId 执行中的考核方案ID
@dataAry 接收的界定参数
*/
func TimeDimensionStatistics(taskId string, dataAry natureParameter) (outputData GraphicStatistics, outErr bool) {
outErr = true
var normName string = ""
if len(dataAry.TargetId) > 1 {
//当同时查询多个指标时启用 获取指标名称
var qualEvalCont assessmentmodel.QualitativeEvaluation
qualEvaWhe := commonus.MapOut()
qualEvaWhe["qe_id"] = taskId
qualEvalCont.GetCont(qualEvaWhe, "qe_target")
taskCont, taskErr := commonus.GetTargetInfo(qualEvalCont.Target)
if taskErr == true {
normName = taskCont.Title
outErr = taskErr
} else {
// outErr = error.Error("此考核项目没有数据!")
outErr = taskErr
return
}
}
//以时间维度,获取X坐标轴
timeFrame := EstimatedTime(dataAry)
//统计方式
statisticalMethod := 3
if len(dataAry.AccMethod) == 1 {
if commonus.IsItTrueInt(1, dataAry.AccMethod) == true {
statisticalMethod = 1
} else {
statisticalMethod = 2
}
}
// fmt.Printf("timeFrame--------->%v\n", timeFrame)
// return
//根据时间维度进行统计
for _, tfv := range timeFrame {
switch tfv.Class {
case 1:
// fmt.Sprintf("KKKKK--------->%v\n", tfv.XLine)
if commonus.IsItTrueString(tfv.XLine, outputData.XLine) == false {
outputData.XLine = append(outputData.XLine, tfv.XLine)
}
monthStr := "("
for twi, twv := range tfv.Where {
if twi != 0 {
monthStr = fmt.Sprintf("%v,%v", monthStr, twv)
} else {
monthStr = fmt.Sprintf("%v%v", monthStr, twv)
}
}
monthStr = fmt.Sprintf("%v)", monthStr)
wherStr := fmt.Sprintf("fld_evaluation_id = %v AND `fl_year` = %v AND `fl_month` IN %v", taskId, tfv.YearName, monthStr)
if len(dataAry.Org) > 0 {
//存在组织结构
_, orgList := getGroupOrg(dataAry.Org)
if len(orgList) > 0 {
for _, orgv := range orgList {
if orgv.Level <= 2 {
wherStr = fmt.Sprintf("%v AND `fl_duty_group` = %v", wherStr, orgv.Id)
} else {
wherStr = fmt.Sprintf("%v AND `fl_duty_department` = %v", wherStr, orgv.Id)
}
switch statisticalMethod {
case 1:
//合计
sumScore, _ := AverageOfSum(wherStr)
normNameTotal := fmt.Sprintf("%v %v总值", orgv.Name, normName)
if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false {
outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal)
var seriesInfo series
seriesInfo.Name = normNameTotal
seriesInfo.Data = append(seriesInfo.Data, sumScore)
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo)
} else {
for cdi, cdv := range outputData.CylindricalData {
if cdv.Name == normNameTotal {
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore)
}
}
}
case 2:
_, averageScore := AverageOfSum(wherStr, 1)
normNameAverage := fmt.Sprintf("%v %v平均值", orgv.Name, normName)
if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false {
outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage)
var seriesInfoAverage series
seriesInfoAverage.Name = normNameAverage
seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore)
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage)
} else {
for cdi, cdv := range outputData.CylindricalData {
if cdv.Name == normNameAverage {
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore)
}
}
}
default:
//合计与平均
sumScore, averageScore := AverageOfSum(wherStr, 1)
normNameTotal := fmt.Sprintf("%v %v总值", orgv.Name, normName)
if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false {
outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal)
var seriesInfo series
seriesInfo.Name = normNameTotal
seriesInfo.Data = append(seriesInfo.Data, sumScore)
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo)
} else {
for cdi, cdv := range outputData.CylindricalData {
if cdv.Name == normNameTotal {
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore)
}
}
}
normNameAverage := fmt.Sprintf("%v %v平均值", orgv.Name, normName)
if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false {
outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage)
var seriesInfoAverage series
seriesInfoAverage.Name = normNameAverage
seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore)
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage)
} else {
for cdi, cdv := range outputData.CylindricalData {
if cdv.Name == normNameAverage {
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore)
}
}
}
}
}
}
} else {
//不存在行政组织
switch statisticalMethod {
case 1:
//合计
sumScore, _ := AverageOfSum(wherStr)
normNameTotal := fmt.Sprintf("%v总值", normName)
if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false {
outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal)
var seriesInfo series
seriesInfo.Name = normNameTotal
seriesInfo.Data = append(seriesInfo.Data, sumScore)
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo)
} else {
for cdi, cdv := range outputData.CylindricalData {
if cdv.Name == normNameTotal {
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore)
}
}
}
case 2:
_, averageScore := AverageOfSum(wherStr, 1)
normNameAverage := fmt.Sprintf("%v平均值", normName)
if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false {
outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage)
var seriesInfoAverage series
seriesInfoAverage.Name = normNameAverage
seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore)
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage)
} else {
for cdi, cdv := range outputData.CylindricalData {
if cdv.Name == normNameAverage {
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore)
}
}
}
default:
//合计与平均
sumScore, averageScore := AverageOfSum(wherStr, 1)
normNameTotal := fmt.Sprintf("%v总值", normName)
if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false {
outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal)
var seriesInfo series
seriesInfo.Name = normNameTotal
seriesInfo.Data = append(seriesInfo.Data, sumScore)
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo)
} else {
for cdi, cdv := range outputData.CylindricalData {
if cdv.Name == normNameTotal {
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore)
}
}
}
normNameAverage := fmt.Sprintf("%v平均值", normName)
if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false {
outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage)
var seriesInfoAverage series
seriesInfoAverage.Name = normNameAverage
seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore)
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage)
} else {
for cdi, cdv := range outputData.CylindricalData {
if cdv.Name == normNameAverage {
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore)
}
}
}
}
}
if len(dataAry.AccMethod) > 0 {
if commonus.IsItTrueInt(1, dataAry.AccMethod) == true && commonus.IsItTrueInt(2, dataAry.AccMethod) == true {
//合计与平均
sumScore, averageScore := AverageOfSum(wherStr, 1)
normNameTotal := fmt.Sprintf("%v总值", normName)
if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false {
outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal)
var seriesInfo series
seriesInfo.Name = normNameTotal
seriesInfo.Data = append(seriesInfo.Data, sumScore)
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo)
} else {
for cdi, cdv := range outputData.CylindricalData {
if cdv.Name == normNameTotal {
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore)
}
}
}
normNameAverage := fmt.Sprintf("%v平均值", normName)
if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false {
outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage)
var seriesInfoAverage series
seriesInfoAverage.Name = normNameAverage
seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore)
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage)
} else {
for cdi, cdv := range outputData.CylindricalData {
if cdv.Name == normNameAverage {
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore)
}
}
}
} else if commonus.IsItTrueInt(1, dataAry.AccMethod) == true {
//合计
sumScore, _ := AverageOfSum(wherStr)
normNameTotal := fmt.Sprintf("%v总值", normName)
if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false {
outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal)
var seriesInfo series
seriesInfo.Name = normNameTotal
seriesInfo.Data = append(seriesInfo.Data, sumScore)
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo)
} else {
for cdi, cdv := range outputData.CylindricalData {
if cdv.Name == normNameTotal {
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore)
}
}
}
} else if commonus.IsItTrueInt(2, dataAry.AccMethod) == true {
_, averageScore := AverageOfSum(wherStr, 1)
normNameAverage := fmt.Sprintf("%v平均值", normName)
if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false {
outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage)
var seriesInfoAverage series
seriesInfoAverage.Name = normNameAverage
seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore)
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage)
} else {
for cdi, cdv := range outputData.CylindricalData {
if cdv.Name == normNameAverage {
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore)
}
}
}
}
} else {
//合计与平均
sumScore, averageScore := AverageOfSum(wherStr, 1)
normNameTotal := fmt.Sprintf("%v总值", normName)
if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false {
outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal)
var seriesInfo series
seriesInfo.Name = normNameTotal
seriesInfo.Data = append(seriesInfo.Data, sumScore)
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo)
} else {
for cdi, cdv := range outputData.CylindricalData {
if cdv.Name == normNameTotal {
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore)
}
}
}
normNameAverage := fmt.Sprintf("%v平均值", normName)
if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false {
outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage)
var seriesInfoAverage series
seriesInfoAverage.Name = normNameAverage
seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore)
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage)
} else {
for cdi, cdv := range outputData.CylindricalData {
if cdv.Name == normNameAverage {
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore)
}
}
}
}
case 2:
//季度
if commonus.IsItTrueString(tfv.XLine, outputData.XLine) == false {
outputData.XLine = append(outputData.XLine, tfv.XLine)
}
for _, yearVal := range dataAry.Year {
wherStr := fmt.Sprintf("fld_evaluation_id = %v AND `fl_year` = %v AND `fl_quarter` = %v", taskId, yearVal, tfv.YearName)
// fmt.Printf("%v季度\n", yearVal)
if len(dataAry.Org) > 0 {
//存在组织结构
_, orgList := getGroupOrg(dataAry.Org)
if len(orgList) > 0 {
for _, orgv := range orgList {
if orgv.Level <= 2 {
wherStr = fmt.Sprintf("%v AND `fl_duty_group` = %v", wherStr, orgv.Id)
} else {
wherStr = fmt.Sprintf("%v AND `fl_duty_department` = %v", wherStr, orgv.Id)
}
switch statisticalMethod {
case 1:
//合计
sumScore, _ := AverageOfSum(wherStr)
normNameTotal := fmt.Sprintf("%v %v总值", orgv.Name, normName)
if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false {
outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal)
var seriesInfo series
seriesInfo.Name = normNameTotal
seriesInfo.Data = append(seriesInfo.Data, sumScore)
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo)
} else {
for cdi, cdv := range outputData.CylindricalData {
if cdv.Name == normNameTotal {
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore)
}
}
}
case 2:
_, averageScore := AverageOfSum(wherStr, 1)
normNameAverage := fmt.Sprintf("%v %v平均值", orgv.Name, normName)
if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false {
outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage)
var seriesInfoAverage series
seriesInfoAverage.Name = normNameAverage
seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore)
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage)
} else {
for cdi, cdv := range outputData.CylindricalData {
if cdv.Name == normNameAverage {
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore)
}
}
}
default:
//合计与平均
sumScore, averageScore := AverageOfSum(wherStr, 1)
normNameTotal := fmt.Sprintf("%v %v总值", orgv.Name, normName)
if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false {
outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal)
var seriesInfo series
seriesInfo.Name = normNameTotal
seriesInfo.Data = append(seriesInfo.Data, sumScore)
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo)
} else {
for cdi, cdv := range outputData.CylindricalData {
if cdv.Name == normNameTotal {
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore)
}
}
}
normNameAverage := fmt.Sprintf("%v %v平均值", orgv.Name, normName)
if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false {
outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage)
var seriesInfoAverage series
seriesInfoAverage.Name = normNameAverage
seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore)
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage)
} else {
for cdi, cdv := range outputData.CylindricalData {
if cdv.Name == normNameAverage {
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore)
}
}
}
}
}
}
} else {
//不存在行政组织
switch statisticalMethod {
case 1:
//合计
sumScore, _ := AverageOfSum(wherStr)
normNameTotal := fmt.Sprintf("%v总值", normName)
if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false {
outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal)
var seriesInfo series
seriesInfo.Name = normNameTotal
seriesInfo.Data = append(seriesInfo.Data, sumScore)
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo)
} else {
for cdi, cdv := range outputData.CylindricalData {
if cdv.Name == normNameTotal {
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore)
}
}
}
case 2:
_, averageScore := AverageOfSum(wherStr, 1)
normNameAverage := fmt.Sprintf("%v平均值", normName)
if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false {
outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage)
var seriesInfoAverage series
seriesInfoAverage.Name = normNameAverage
seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore)
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage)
} else {
for cdi, cdv := range outputData.CylindricalData {
if cdv.Name == normNameAverage {
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore)
}
}
}
default:
//合计与平均
sumScore, averageScore := AverageOfSum(wherStr, 1)
normNameTotal := fmt.Sprintf("%v总值", normName)
if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false {
outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal)
var seriesInfo series
seriesInfo.Name = normNameTotal
seriesInfo.Data = append(seriesInfo.Data, sumScore)
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo)
} else {
for cdi, cdv := range outputData.CylindricalData {
if cdv.Name == normNameTotal {
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore)
}
}
}
normNameAverage := fmt.Sprintf("%v平均值", normName)
if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false {
outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage)
var seriesInfoAverage series
seriesInfoAverage.Name = normNameAverage
seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore)
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage)
} else {
for cdi, cdv := range outputData.CylindricalData {
if cdv.Name == normNameAverage {
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore)
}
}
}
}
}
}
case 3:
//月
if commonus.IsItTrueString(tfv.XLine, outputData.XLine) == false {
outputData.XLine = append(outputData.XLine, tfv.XLine)
}
for _, yearVal := range dataAry.Year {
wherStr := fmt.Sprintf("fld_evaluation_id = %v AND `fl_year` = %v AND `fl_month` = %v", taskId, yearVal, tfv.YearName)
if len(dataAry.Org) > 0 {
//存在组织结构
_, orgList := getGroupOrg(dataAry.Org)
if len(orgList) > 0 {
for _, orgv := range orgList {
if orgv.Level <= 2 {
wherStr = fmt.Sprintf("%v AND `fl_duty_group` = %v", wherStr, orgv.Id)
} else {
wherStr = fmt.Sprintf("%v AND `fl_duty_department` = %v", wherStr, orgv.Id)
}
switch statisticalMethod {
case 1:
//合计
sumScore, _ := AverageOfSum(wherStr)
normNameTotal := fmt.Sprintf("%v %v总值", orgv.Name, normName)
if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false {
outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal)
var seriesInfo series
seriesInfo.Name = normNameTotal
seriesInfo.Data = append(seriesInfo.Data, sumScore)
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo)
} else {
for cdi, cdv := range outputData.CylindricalData {
if cdv.Name == normNameTotal {
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore)
}
}
}
case 2:
_, averageScore := AverageOfSum(wherStr, 1)
normNameAverage := fmt.Sprintf("%v %v平均值", orgv.Name, normName)
if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false {
outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage)
var seriesInfoAverage series
seriesInfoAverage.Name = normNameAverage
seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore)
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage)
} else {
for cdi, cdv := range outputData.CylindricalData {
if cdv.Name == normNameAverage {
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore)
}
}
}
default:
//合计与平均
sumScore, averageScore := AverageOfSum(wherStr, 1)
normNameTotal := fmt.Sprintf("%v %v总值", orgv.Name, normName)
if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false {
outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal)
var seriesInfo series
seriesInfo.Name = normNameTotal
seriesInfo.Data = append(seriesInfo.Data, sumScore)
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo)
} else {
for cdi, cdv := range outputData.CylindricalData {
if cdv.Name == normNameTotal {
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore)
}
}
}
normNameAverage := fmt.Sprintf("%v %v平均值", orgv.Name, normName)
if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false {
outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage)
var seriesInfoAverage series
seriesInfoAverage.Name = normNameAverage
seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore)
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage)
} else {
for cdi, cdv := range outputData.CylindricalData {
if cdv.Name == normNameAverage {
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore)
}
}
}
}
}
}
} else {
//不存在行政组织
switch statisticalMethod {
case 1:
//合计
sumScore, _ := AverageOfSum(wherStr)
normNameTotal := fmt.Sprintf("%v总值", normName)
if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false {
outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal)
var seriesInfo series
seriesInfo.Name = normNameTotal
seriesInfo.Data = append(seriesInfo.Data, sumScore)
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo)
} else {
for cdi, cdv := range outputData.CylindricalData {
if cdv.Name == normNameTotal {
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore)
}
}
}
case 2:
_, averageScore := AverageOfSum(wherStr, 1)
normNameAverage := fmt.Sprintf("%v平均值", normName)
if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false {
outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage)
var seriesInfoAverage series
seriesInfoAverage.Name = normNameAverage
seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore)
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage)
} else {
for cdi, cdv := range outputData.CylindricalData {
if cdv.Name == normNameAverage {
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore)
}
}
}
default:
//合计与平均
sumScore, averageScore := AverageOfSum(wherStr, 1)
normNameTotal := fmt.Sprintf("%v总值", normName)
if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false {
outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal)
var seriesInfo series
seriesInfo.Name = normNameTotal
seriesInfo.Data = append(seriesInfo.Data, sumScore)
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo)
} else {
for cdi, cdv := range outputData.CylindricalData {
if cdv.Name == normNameTotal {
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore)
}
}
}
normNameAverage := fmt.Sprintf("%v平均值", normName)
if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false {
outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage)
var seriesInfoAverage series
seriesInfoAverage.Name = normNameAverage
seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore)
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage)
} else {
for cdi, cdv := range outputData.CylindricalData {
if cdv.Name == normNameAverage {
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore)
}
}
}
}
}
}
default:
//全年
if commonus.IsItTrueString(tfv.XLine, outputData.XLine) == false {
outputData.XLine = append(outputData.XLine, tfv.XLine)
}
for _, tfwv := range tfv.Where {
wherStr := fmt.Sprintf("fld_evaluation_id = %v AND `fl_year` = %v", taskId, tfwv)
if len(dataAry.Org) > 0 {
//存在组织结构
_, orgList := getGroupOrg(dataAry.Org)
if len(orgList) > 0 {
for _, orgv := range orgList {
if orgv.Level <= 2 {
wherStr = fmt.Sprintf("%v AND `fl_duty_group` = %v", wherStr, orgv.Id)
} else {
wherStr = fmt.Sprintf("%v AND `fl_duty_department` = %v", wherStr, orgv.Id)
}
switch statisticalMethod {
case 1:
//合计
sumScore, _ := AverageOfSum(wherStr)
normNameTotal := fmt.Sprintf("%v %v总值", orgv.Name, normName)
if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false {
outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal)
var seriesInfo series
seriesInfo.Name = normNameTotal
seriesInfo.Data = append(seriesInfo.Data, sumScore)
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo)
} else {
for cdi, cdv := range outputData.CylindricalData {
if cdv.Name == normNameTotal {
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore)
}
}
}
case 2:
_, averageScore := AverageOfSum(wherStr, 1)
normNameAverage := fmt.Sprintf("%v %v平均值", orgv.Name, normName)
if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false {
outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage)
var seriesInfoAverage series
seriesInfoAverage.Name = normNameAverage
seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore)
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage)
} else {
for cdi, cdv := range outputData.CylindricalData {
if cdv.Name == normNameAverage {
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore)
}
}
}
default:
//合计与平均
sumScore, averageScore := AverageOfSum(wherStr, 1)
normNameTotal := fmt.Sprintf("%v %v总值", orgv.Name, normName)
if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false {
outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal)
var seriesInfo series
seriesInfo.Name = normNameTotal
seriesInfo.Data = append(seriesInfo.Data, sumScore)
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo)
} else {
for cdi, cdv := range outputData.CylindricalData {
if cdv.Name == normNameTotal {
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore)
}
}
}
normNameAverage := fmt.Sprintf("%v %v平均值", orgv.Name, normName)
if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false {
outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage)
var seriesInfoAverage series
seriesInfoAverage.Name = normNameAverage
seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore)
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage)
} else {
for cdi, cdv := range outputData.CylindricalData {
if cdv.Name == normNameAverage {
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore)
}
}
}
}
}
}
} else {
//不存在行政组织
switch statisticalMethod {
case 1:
//合计
sumScore, _ := AverageOfSum(wherStr)
normNameTotal := fmt.Sprintf("%v总值", normName)
if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false {
outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal)
var seriesInfo series
seriesInfo.Name = normNameTotal
seriesInfo.Data = append(seriesInfo.Data, sumScore)
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo)
} else {
for cdi, cdv := range outputData.CylindricalData {
if cdv.Name == normNameTotal {
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore)
}
}
}
case 2:
_, averageScore := AverageOfSum(wherStr, 1)
normNameAverage := fmt.Sprintf("%v平均值", normName)
if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false {
outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage)
var seriesInfoAverage series
seriesInfoAverage.Name = normNameAverage
seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore)
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage)
} else {
for cdi, cdv := range outputData.CylindricalData {
if cdv.Name == normNameAverage {
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore)
}
}
}
default:
//合计与平均
sumScore, averageScore := AverageOfSum(wherStr, 1)
normNameTotal := fmt.Sprintf("%v总值", normName)
if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false {
outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal)
var seriesInfo series
seriesInfo.Name = normNameTotal
seriesInfo.Data = append(seriesInfo.Data, sumScore)
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo)
} else {
for cdi, cdv := range outputData.CylindricalData {
if cdv.Name == normNameTotal {
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore)
}
}
}
normNameAverage := fmt.Sprintf("%v平均值", normName)
if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false {
outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage)
var seriesInfoAverage series
seriesInfoAverage.Name = normNameAverage
seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore)
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage)
} else {
for cdi, cdv := range outputData.CylindricalData {
if cdv.Name == normNameAverage {
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore)
}
}
}
}
}
}
}
}
// fmt.Println(normName)
return
}
//行政维度统计计算
/*
@taskId 执行中的考核方案ID
@dataAry 接收的界定参数
*/
func OrgDimensionStatistics(taskId string, dataAry natureParameter) (outputData GraphicStatistics, outErr bool) {
//获取时间参数
// timeFrame := EstimatedTime(dataAry)
orgAry, orgList := getGroupOrg(dataAry.Org)
fmt.Printf("orgAry====>%v\n", orgAry)
fmt.Printf("orgList-====>%v\n", orgList)
return
}

93
gin_server_admin/api/statistics/quantification/enter.go

@ -0,0 +1,93 @@
package quantification
import (
"github.com/flipped-aurora/gin-vue-admin/server/commonus"
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
"github.com/flipped-aurora/gin-vue-admin/server/model/hrsystem"
"github.com/gin-gonic/gin"
)
type ApiGroup struct{}
//入口
func (a *ApiGroup) Index(c *gin.Context) {
outPut := commonus.MapOut()
response.Result(0, outPut, "手机量化考核入口", c)
}
//获取指标ID
type getTargetId[T any] struct {
TargetId []T `json:"targetid"` //指标
}
//定性考核查询参数
type natureParameter struct {
TargetId []string `json:"targetid"` //指标
Org []string `json:"org"` //行政组织
Year []string `json:"year"` //年
TimeAttribute TimeAttributeMap `json:"timeattribute"` //时间辅助
AccMethod []int `json:"accmethod"` //核算方式 1:合计值;2:平均值
AnalysisAngle int `json:"analysisangle"` //分析维度 1:行政组织;2:时间
}
//时间属性
type TimeAttributeMap struct {
Class int `json:"class"` //0:全年;1:半年;2:季度;3:月度
Time []int `json:"time"` //class->0(0),Time->1(1:上半年,2:下半年),class->2(1:第一季度,2:第二季度,3:第三季度,4:第四季度),class->3(1:1月....12:12月)
}
//组织架构
type orgModels struct {
Id string `json:"id"`
Name string `json:"name"`
Level int64 `json:level`
}
type orgModelsAry struct {
orgModels
Child []orgModels `json:"child"`
}
//查询指标数据流水
type flowLogDataList struct {
Id int64 `json:"id" gorm:"primaryKey;column:fld_id;type:bigint(20) unsigned;not null;comment:Id;index"`
EvaluationPlan int64 `json:"evaluationplan" gorm:"column:fld_evaluation_id;type:bigint(20) unsigned;default:0;not null;comment:考核方案项目ID"`
Key int64 `json:"key" gorm:"column:fld_flow_log;type:bigint(20) unsigned;default:0;not null;comment:识别标志"`
Score int64 `json:"score" gorm:"column:fld_score;type:bigint(20) unsigned;default:0;not null;comment:数据"`
EvaluationPlanFlow string `json:"evaluationplanflow" gorm:"column:fl_evaluation_id;type:mediumtext unsigned;default:0;not null;comment:考核方案项目ID"`
KeyFlow int64 `json:"keyflow" gorm:"column:fl_key;type:bigint(20) unsigned;default:0;not null;comment:识别标志"`
Year int64 `json:"year" gorm:"column:fl_year;type:int(7) unsigned;default:0;not null;comment:年分"`
Quarter int64 `json:"quarter" gorm:"column:fl_quarter;type:int(2) unsigned;default:0;not null;comment:季度"`
Month int64 `json:"month" gorm:"column:fl_month;type:int(2) unsigned;default:0;not null;comment:月"`
Week int64 `json:"week" gorm:"column:fl_week;type:int(5) unsigned;default:0;not null;comment:周"`
ToDay int64 `json:"today" gorm:"column:fl_day;type:int(5) unsigned;default:0;not null;comment:天"`
DutyGroup int64 `json:"dutygroup" gorm:"column:fl_duty_group;type:bigint(20) unsigned;default:0;not null;comment:职责集团"`
DutyDepartment int64 `json:"dutydepartment" gorm:"column:fl_duty_department;type:bigint(20) unsigned;default:0;not null;comment:职责部门"`
}
type OutGovCont struct {
hrsystem.AdministrativeOrganization
ClassName string `json:"classname" gorm:"column:classname;type:varchar(255) unsigned;default:'';not null;comment:行政组织分类名称"`
Level int64 `json:"level" gorm:"column:level;type:int(5) unsigned;default:1;not null;comment:级别"`
}
//时间维度构造
type TimeFrame struct {
XLine string `json:"xline"`
YearName string `json:"yearname"`
Class int `json:"class"`
Where []int `json:"where"`
}
//时间维度输出构造
type GraphicStatistics struct {
XLine []string `json:"xAxis"` //x轴维度
Cylindrical []string `json:"legend"` //柱形体名称集合
CylindricalData []series `json:"series"` //柱形体数值集合
}
//数值结构体
type series struct {
Name string `json:"name"` //柱形体名称
Data []float64 `json:"data"` //对应X轴点位数值
}

405
gin_server_admin/api/statistics/quantification/quant.go

@ -0,0 +1,405 @@
package quantification
import (
"fmt"
"strconv"
"github.com/flipped-aurora/gin-vue-admin/server/commonus"
"github.com/flipped-aurora/gin-vue-admin/server/global"
"github.com/flipped-aurora/gin-vue-admin/server/model/assessmentmodel"
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
"github.com/flipped-aurora/gin-vue-admin/server/model/hrsystem"
"github.com/gin-gonic/gin"
)
//量化考核图标
func (a *ApiGroup) GetQuantEChartOrgAndYear(c *gin.Context) {
isTrue, _ := commonus.ClientIdentity()
if isTrue != true {
response.Result(101, isTrue, "您的身份令牌已经失效!请重新登录获取身份令牌!", c)
return
}
var requestData getTargetId[string]
err := c.ShouldBindJSON(&requestData)
if err != nil {
response.Result(102, err, "数据获取失败!", c)
return
}
if len(requestData.TargetId) < 1 {
response.Result(102, err, "未获取到指标", c)
return
}
var accDepart []string
var yearTime []string
var orgMap []orgModelsAry
for _, v := range requestData.TargetId {
var flowLogList []assessmentmodel.FlowLog
floLogErr := global.GVA_DB_Performanceappraisal.Where("FIND_IN_SET(?,`fl_evaluation_id`)", v).Find(&flowLogList).Error
if floLogErr == nil {
for _, fv := range flowLogList {
fvDepartId := strconv.FormatInt(fv.DutyDepartment, 10)
if commonus.IsItTrueString(fvDepartId, accDepart) == false {
accDepart = append(accDepart, fvDepartId)
}
yearStr := strconv.FormatInt(int64(fv.Year), 10)
if commonus.IsItTrueString(yearStr, yearTime) == false {
yearTime = append(yearTime, yearStr)
}
//判断组织架构是否有数据
if len(orgMap) > 0 {
for oi, ov := range orgMap {
//判断公司是否已经存在
if ov.Id == strconv.FormatInt(fv.DutyGroup, 10) {
//判断是否有分厂数据
if len(ov.Child) > 0 {
isYes := true
for _, dv := range ov.Child {
if dv.Id == strconv.FormatInt(fv.DutyDepartment, 10) {
isYes = false //该部门分厂已经存在
}
}
if isYes == true {
//该部门分厂不存在是添加
//写入部门
whereDepart := commonus.MapOut()
whereDepart["id"] = fv.DutyDepartment
orgDepartCont, orgDepartErr := commonus.GetNewOrgCont(whereDepart, "name")
if orgDepartErr == nil {
var orgDepartMapCont orgModels
orgDepartMapCont.Id = strconv.FormatInt(fv.DutyDepartment, 10)
orgDepartMapCont.Name = orgDepartCont.Name
orgMap[oi].Child = append(orgMap[oi].Child, orgDepartMapCont)
}
}
} else {
//没有分厂数据,根据上级数据进行新增
if fv.DutyDepartment != 0 {
//写入部门
whereDepart := commonus.MapOut()
whereDepart["id"] = fv.DutyDepartment
orgDepartCont, orgDepartErr := commonus.GetNewOrgCont(whereDepart, "name")
if orgDepartErr == nil {
var orgDepartMapCont orgModels
orgDepartMapCont.Id = strconv.FormatInt(fv.DutyDepartment, 10)
orgDepartMapCont.Name = orgDepartCont.Name
orgMap[oi].Child = append(orgMap[oi].Child, orgDepartMapCont)
}
}
}
} else {
if fv.DutyGroup != 0 {
//写入集团信息
where := commonus.MapOut()
where["id"] = fv.DutyGroup
orgGroupCont, orgGroupErr := commonus.GetNewOrgCont(where, "name")
if orgGroupErr == nil {
var orgMapCont orgModelsAry
orgMapCont.Id = strconv.FormatInt(fv.DutyGroup, 10)
orgMapCont.Name = orgGroupCont.Name
if fv.DutyDepartment != 0 {
//写入部门
whereDepart := commonus.MapOut()
whereDepart["id"] = fv.DutyDepartment
orgDepartCont, orgDepartErr := commonus.GetNewOrgCont(whereDepart, "name")
if orgDepartErr == nil {
var orgDepartMapCont orgModels
orgDepartMapCont.Id = strconv.FormatInt(fv.DutyDepartment, 10)
orgDepartMapCont.Name = orgDepartCont.Name
orgMapCont.Child = append(orgMapCont.Child, orgDepartMapCont)
}
}
orgMap = append(orgMap, orgMapCont)
}
}
}
}
} else {
//没有数据的时候根据数值进行新增
if fv.DutyGroup != 0 {
//写入集团信息
where := commonus.MapOut()
where["id"] = fv.DutyGroup
orgGroupCont, orgGroupErr := commonus.GetNewOrgCont(where, "name")
if orgGroupErr == nil {
var orgMapCont orgModelsAry
orgMapCont.Id = strconv.FormatInt(fv.DutyGroup, 10)
orgMapCont.Name = orgGroupCont.Name
if fv.DutyDepartment != 0 {
//写入部门
whereDepart := commonus.MapOut()
whereDepart["id"] = fv.DutyDepartment
orgDepartCont, orgDepartErr := commonus.GetNewOrgCont(whereDepart, "name")
if orgDepartErr == nil {
var orgDepartMapCont orgModels
orgDepartMapCont.Id = strconv.FormatInt(fv.DutyDepartment, 10)
orgDepartMapCont.Name = orgDepartCont.Name
orgMapCont.Child = append(orgMapCont.Child, orgDepartMapCont)
}
}
orgMap = append(orgMap, orgMapCont)
}
}
}
}
}
}
outMap := commonus.MapOut()
outMap["grouplist"] = orgMap
outMap["timelist"] = yearTime
response.Result(0, outMap, "数据获取失败!", c)
}
//量化考核图标
func (a *ApiGroup) QuantEChart(c *gin.Context) {
isTrue, _ := commonus.ClientIdentity()
if isTrue != true {
response.Result(101, isTrue, "您的身份令牌已经失效!请重新登录获取身份令牌!", c)
return
}
var requestData natureParameter
c.ShouldBindJSON(&requestData)
// err := c.ShouldBindJSON(&requestData)
// if err != nil {
// response.Result(102, err, "数据获取失败!", c)
// return
// }
if len(requestData.TargetId) < 1 {
response.Result(103, requestData, "未获取到指标", c)
return
}
if requestData.AnalysisAngle == 0 {
requestData.AnalysisAngle = 1
}
outMap := commonus.MapOut()
var graphicStatistics GraphicStatistics
for _, v := range requestData.TargetId {
// var qualEvalCont assessmentmodel.QualitativeEvaluation
// qualEvaWhe := commonus.MapOut()
// qualEvaWhe["qe_id"] = v
// qualEvalCont.GetCont(qualEvaWhe, "qe_target")
// calculationEvaluation(qualEvalCont.Target, requestData)
// calculationEvaluation(v, requestData)
// kjs, kjddd := calculationEvaluation(v, requestData)
// jsonStr, jsonEr := json.Marshal(kjs)
// fmt.Printf("task------------>%v----->%v----->%v\n", string(jsonStr), jsonEr, kjddd)
// outMap["TimeDimension_"+v] = TimeDimension(v, requestData)
if requestData.AnalysisAngle == 1 {
getStatistics, gstErr := OrgDimensionStatistics(v, requestData)
outMap["TimeDimension_"+v] = getStatistics
if gstErr == true {
}
} else {
//时间维度
getStatistics, gstErr := TimeDimensionStatistics(v, requestData)
outMap["TimeDimension_"+v] = getStatistics
if gstErr == true {
for _, gsv := range getStatistics.XLine {
if commonus.IsItTrueString(gsv, graphicStatistics.XLine) == false {
graphicStatistics.XLine = append(graphicStatistics.XLine, gsv)
}
}
for _, cilv := range getStatistics.Cylindrical {
if commonus.IsItTrueString(cilv, graphicStatistics.Cylindrical) == false {
graphicStatistics.Cylindrical = append(graphicStatistics.Cylindrical, cilv)
for _, cdv := range getStatistics.CylindricalData {
if cdv.Name == cilv {
graphicStatistics.CylindricalData = append(graphicStatistics.CylindricalData, cdv)
}
}
}
}
}
}
// getStatistics, gstErr := TimeDimensionStatistics(v, requestData)
// fmt.Println(gstErr)
}
outMap["graphicStatistics"] = graphicStatistics
response.Result(0, graphicStatistics, "图形数据", c)
}
//获取行政组织
func getGroupOrg(orgAry []string) (orgMap []orgModelsAry, orgWherList []orgModels) {
var govMap []OutGovCont
orgErr := global.GVA_DB_HrDataBase.Model(&hrsystem.AdministrativeOrganization{}).Select("administrative_organization.*,aot.name as classname,aot.level").Joins("left join administrative_organization_type as aot on aot.id = administrative_organization.organization_type").Where("administrative_organization.`state` = 1 AND administrative_organization.id IN ?", orgAry).Find(&govMap).Error
if orgErr != nil {
return
}
// fmt.Printf("%v\n", govMap)
for _, v := range govMap {
if len(orgMap) > 0 {
if v.Level > 2 {
groupId, groupIsTrue := commonus.GetNewHrOrg(v.Id)
if groupIsTrue == true {
newAdd := true
for gii, gvv := range orgMap {
if gvv.Id == strconv.FormatInt(groupId, 10) {
newAdd = false
for _, sgv := range orgMap[gii].Child {
if sgv.Id != strconv.FormatInt(v.Id, 10) {
var orgSun orgModels
orgSun.Id = strconv.FormatInt(v.Id, 10)
orgSun.Name = v.Name
orgSun.Level = v.Level
if v.Abbreviation != "" {
orgSun.Name = v.Abbreviation
}
orgMap[gii].Child = append(orgMap[gii].Child, orgSun)
}
}
}
}
if newAdd == true {
where := commonus.MapOut()
where["id"] = groupId
orgGroupCont, orgGroupErr := commonus.GetNewOrgCont(where, "name", "organization_type")
if orgGroupErr == nil {
var groupInfo orgModelsAry
groupInfo.Id = strconv.FormatInt(groupId, 10)
groupInfo.Name = orgGroupCont.Name
if orgGroupCont.Abbreviation != "" {
groupInfo.Name = orgGroupCont.Abbreviation
}
var aotModel hrsystem.AdministrativeOrganizationType
where := commonus.MapOut()
where["id"] = orgGroupCont.OrganizationType
aotModel.GetCont(where, "level")
groupInfo.Level = aotModel.Level
var orgSun orgModels
orgSun.Id = strconv.FormatInt(v.Id, 10)
orgSun.Name = v.Name
if v.Abbreviation != "" {
orgSun.Name = v.Abbreviation
}
orgSun.Level = v.Level
groupInfo.Child = append(groupInfo.Child, orgSun)
orgMap = append(orgMap, groupInfo)
}
}
}
} else {
for _, gv := range orgMap {
if gv.Id != strconv.FormatInt(v.Id, 10) {
var groupInfo orgModelsAry
groupInfo.Id = strconv.FormatInt(v.Id, 10)
groupInfo.Name = v.Name
if v.Abbreviation != "" {
groupInfo.Name = v.Abbreviation
}
groupInfo.Level = v.Level
orgMap = append(orgMap, groupInfo)
}
}
}
} else {
if v.Level > 2 {
groupId, groupIsTrue := commonus.GetNewHrOrg(v.Id)
if groupIsTrue == true {
where := commonus.MapOut()
where["id"] = groupId
orgGroupCont, orgGroupErr := commonus.GetNewOrgCont(where, "name", "abbreviation", "organization_type")
if orgGroupErr == nil {
var groupInfo orgModelsAry
groupInfo.Id = strconv.FormatInt(groupId, 10)
groupInfo.Name = orgGroupCont.Name
if orgGroupCont.Abbreviation != "" {
groupInfo.Name = orgGroupCont.Abbreviation
}
var aotModel hrsystem.AdministrativeOrganizationType
where := commonus.MapOut()
where["id"] = orgGroupCont.OrganizationType
aotModel.GetCont(where, "level")
groupInfo.Level = aotModel.Level
var orgSun orgModels
orgSun.Id = strconv.FormatInt(v.Id, 10)
orgSun.Name = v.Name
if v.Abbreviation != "" {
orgSun.Name = v.Abbreviation
}
orgSun.Level = v.Level
groupInfo.Child = append(groupInfo.Child, orgSun)
orgMap = append(orgMap, groupInfo)
}
}
} else {
var groupInfo orgModelsAry
groupInfo.Id = strconv.FormatInt(v.Id, 10)
groupInfo.Name = v.Name
if v.Abbreviation != "" {
groupInfo.Name = v.Abbreviation
}
groupInfo.Level = v.Level
orgMap = append(orgMap, groupInfo)
}
}
}
if len(orgMap) > 0 {
for _, ov := range orgMap {
if len(orgWherList) > 0 {
isInGroup := true //界定是否写入
for _, olv := range orgWherList {
if ov.Id == olv.Id {
isInGroup = false
}
}
if isInGroup == true {
var orgList orgModels
orgList.Id = ov.Id
orgList.Name = ov.Name
orgList.Level = ov.Level
orgWherList = append(orgWherList, orgList)
}
} else {
var orgList orgModels
orgList.Id = ov.Id
orgList.Name = ov.Name
orgList.Level = ov.Level
orgWherList = append(orgWherList, orgList)
}
//判断是否有下级菜单
if len(ov.Child) > 0 {
for _, ocv := range ov.Child {
if len(orgWherList) > 0 {
isIn := true //界定是否写入
for _, olv := range orgWherList {
if ocv.Id == olv.Id {
isIn = false
}
}
if isIn == true {
var orgList orgModels
orgList.Id = ocv.Id
orgList.Name = fmt.Sprintf("%v%v", ov.Name, ocv.Name)
orgList.Level = ocv.Level
orgWherList = append(orgWherList, orgList)
}
} else {
var orgList orgModels
orgList.Id = ocv.Id
orgList.Name = fmt.Sprintf("%v%v", ov.Name, ocv.Name)
orgList.Level = ocv.Level
orgWherList = append(orgWherList, orgList)
}
}
}
}
}
return
}

84
gin_server_admin/api/statistics/quantification/shiyan.go

@ -0,0 +1,84 @@
package quantification
import (
"fmt"
"github.com/flipped-aurora/gin-vue-admin/server/commonus"
)
//维度计算
/*
@normName 标准名称
@wherStr 查询条件
@calculationMethod 计算方式 12平均值3和与平均值
*/
func DimensionCalculation(normName, wherStr string, calculationMethod int, oldStatistics GraphicStatistics) (outputData GraphicStatistics) {
switch calculationMethod {
case 1: //计算
sumScore, _ := AverageOfSum(wherStr)
normNameTotal := fmt.Sprintf("%v总值", normName)
if commonus.IsItTrueString(normNameTotal, oldStatistics.Cylindrical) == false {
outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal)
var seriesInfo series
seriesInfo.Name = normNameTotal
seriesInfo.Data = append(seriesInfo.Data, sumScore)
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo)
} else {
for cdi, cdv := range outputData.CylindricalData {
if cdv.Name == normNameTotal {
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore)
}
}
}
case 2:
_, averageScore := AverageOfSum(wherStr, 1)
normNameAverage := fmt.Sprintf("%v平均值", normName)
if commonus.IsItTrueString(normNameAverage, oldStatistics.Cylindrical) == false {
outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage)
var seriesInfoAverage series
seriesInfoAverage.Name = normNameAverage
seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore)
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage)
} else {
for cdi, cdv := range outputData.CylindricalData {
if cdv.Name == normNameAverage {
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore)
}
}
}
case 3:
//合计与平均
sumScore, averageScore := AverageOfSum(wherStr, 1)
normNameTotal := fmt.Sprintf("%v总值", normName)
if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false {
outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal)
var seriesInfo series
seriesInfo.Name = normNameTotal
seriesInfo.Data = append(seriesInfo.Data, sumScore)
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo)
} else {
for cdi, cdv := range outputData.CylindricalData {
if cdv.Name == normNameTotal {
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore)
}
}
}
normNameAverage := fmt.Sprintf("%v平均值", normName)
if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false {
outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage)
var seriesInfoAverage series
seriesInfoAverage.Name = normNameAverage
seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore)
outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage)
} else {
for cdi, cdv := range outputData.CylindricalData {
if cdv.Name == normNameAverage {
outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore)
}
}
}
}
return
}

9
gin_server_admin/api/v1/assessment/department_target.go

@ -97,6 +97,11 @@ func (d *DutyHandle) DepartmentTaskList(c *gin.Context) {
var requestData DelQualitative var requestData DelQualitative
c.ShouldBindJSON(&requestData) c.ShouldBindJSON(&requestData)
if requestData.VersionNumber == "" {
response.Result(101, requestData, "未知版本号码", c)
return
}
var qualitativeEvaluationAry []assessmentmodel.QualitativeEvaluation var qualitativeEvaluationAry []assessmentmodel.QualitativeEvaluation
gormDb := global.GVA_DB_Performanceappraisal.Select("qualitative_evaluation.*,dutyclass.sort") gormDb := global.GVA_DB_Performanceappraisal.Select("qualitative_evaluation.*,dutyclass.sort")
if requestData.Type != 0 { if requestData.Type != 0 {
@ -106,7 +111,7 @@ func (d *DutyHandle) DepartmentTaskList(c *gin.Context) {
gormDb = gormDb.Where("`qe_group` = ?", requestData.Group) gormDb = gormDb.Where("`qe_group` = ?", requestData.Group)
} }
// if requestData.DepartmentId != "" { // if requestData.DepartmentId != "" {
// gormDb = gormDb.Where("`qe_accept_evaluation` = ?", requestData.DepartmentId) gormDb = gormDb.Where("`qe_qual_eval_id` = ?", requestData.VersionNumber)
// } // }
if requestData.DepartmentId != "" { if requestData.DepartmentId != "" {
gormDb = gormDb.Where("`qe_accept_evaluation` = ?", requestData.DepartmentId) gormDb = gormDb.Where("`qe_accept_evaluation` = ?", requestData.DepartmentId)
@ -121,7 +126,7 @@ func (d *DutyHandle) DepartmentTaskList(c *gin.Context) {
if requestData.TargetSun != "" { if requestData.TargetSun != "" {
gormDb = gormDb.Where("`qe_target_sun` = ?", requestData.TargetSun) gormDb = gormDb.Where("`qe_target_sun` = ?", requestData.TargetSun)
} }
gormDb = gormDb.Where("`qe_state` = 1") // gormDb = gormDb.Where("`qe_state` = 1")
listTargetErr := gormDb.Joins("left join dutyclass on id = qe_dimension").Order("qe_group asc,qe_accept_evaluation asc,sort asc,qe_type asc,qe_target asc,qe_target_sun asc").Find(&qualitativeEvaluationAry).Error listTargetErr := gormDb.Joins("left join dutyclass on id = qe_dimension").Order("qe_group asc,qe_accept_evaluation asc,sort asc,qe_type asc,qe_target asc,qe_target_sun asc").Find(&qualitativeEvaluationAry).Error
if listTargetErr != nil || len(qualitativeEvaluationAry) < 1 { if listTargetErr != nil || len(qualitativeEvaluationAry) < 1 {

8
gin_server_admin/api/v1/assessment/dutytype.go

@ -295,6 +295,7 @@ type addTargetType struct {
CycleAttres int `json:"cycleattr"` //辅助计数 CycleAttres int `json:"cycleattr"` //辅助计数
VisibleRangeGroup []string `json:"visiblerangegroup"` //可见范围(集团) VisibleRangeGroup []string `json:"visiblerangegroup"` //可见范围(集团)
VisibleRangeDepart []string `json:"visiblerangedepart"` //可见范围(分厂) VisibleRangeDepart []string `json:"visiblerangedepart"` //可见范围(分厂)
ScoringMethod int `json:"scoringmethod"` //计分方式(1:自动;2:手动)
} }
//列表输出 //列表输出
@ -650,6 +651,7 @@ type DelQualitative struct {
TargetSun string `json:"targetsun"` //考核指标子栏目 TargetSun string `json:"targetsun"` //考核指标子栏目
Group string `json:"group"` //归属集团 Group string `json:"group"` //归属集团
DepartmentId string `json:"departmentid"` //接受考核部门 DepartmentId string `json:"departmentid"` //接受考核部门
VersionNumber string `json:"versionnumber"` //版本号码
} }
//根据条件获取组合指标新的输出模式 //根据条件获取组合指标新的输出模式
@ -767,3 +769,9 @@ type CycleAddedType struct {
Allprize int64 `json:"allprize"` //全奖值"` Allprize int64 `json:"allprize"` //全奖值"`
Capping int64 `json:"capping"` //封顶值"` Capping int64 `json:"capping"` //封顶值"`
} }
//添加 定性考核指标关系指定细则
type DutyAssEssTarget struct {
Id int64 `json:"id"`
Operator []string `json:"operator"` //考核执行人
}

42
gin_server_admin/api/v1/assessment/target.go

@ -1,6 +1,7 @@
package assessment package assessment
import ( import (
"encoding/json"
"fmt" "fmt"
"strconv" "strconv"
"strings" "strings"
@ -243,6 +244,9 @@ func (d *DutyHandle) AddTarget(c *gin.Context) {
if requestData.CycleAttres == 0 { if requestData.CycleAttres == 0 {
requestData.CycleAttres = 1 requestData.CycleAttres = 1
} }
if requestData.ScoringMethod == 0 {
requestData.ScoringMethod = 1
}
gormDb := global.GVA_DB_Performanceappraisal gormDb := global.GVA_DB_Performanceappraisal
gormDb = gormDb.Model(&assessmentmodel.EvaluationTarget{}).Select("et_title").Where("`et_title` = ? AND `et_type` = ?", requestData.Title, requestData.Type) gormDb = gormDb.Model(&assessmentmodel.EvaluationTarget{}).Select("et_title").Where("`et_title` = ? AND `et_type` = ?", requestData.Title, requestData.Type)
dimensionId, dimensionErr := strconv.ParseInt(requestData.Dimension, 10, 64) dimensionId, dimensionErr := strconv.ParseInt(requestData.Dimension, 10, 64)
@ -281,7 +285,7 @@ func (d *DutyHandle) AddTarget(c *gin.Context) {
if len(requestData.VisibleRangeDepart) > 0 { if len(requestData.VisibleRangeDepart) > 0 {
saveData.VisibleRange = strings.Join(requestData.VisibleRangeDepart, ",") saveData.VisibleRange = strings.Join(requestData.VisibleRangeDepart, ",")
} }
saveData.ScoringMethod = requestData.ScoringMethod
dutyInfoErr := global.GVA_DB_Performanceappraisal.Create(&saveData).Error dutyInfoErr := global.GVA_DB_Performanceappraisal.Create(&saveData).Error
if dutyInfoErr != nil { if dutyInfoErr != nil {
response.Result(106, saveData, "数据写入失败!", c) response.Result(106, saveData, "数据写入失败!", c)
@ -532,16 +536,52 @@ func (d *DutyHandle) EiteTarget(c *gin.Context) {
if len(requestData.VisibleRangeDepart) > 0 { if len(requestData.VisibleRangeDepart) > 0 {
saveData["et_visible_range"] = strings.Join(requestData.VisibleRangeDepart, ",") saveData["et_visible_range"] = strings.Join(requestData.VisibleRangeDepart, ",")
} }
if requestData.ScoringMethod != 0 {
saveData["et_scoring_method"] = requestData.ScoringMethod
}
saveData["et_time"] = time.Now().Unix() saveData["et_time"] = time.Now().Unix()
roleIsTrue, roleErr := eiteTargetInfoes(requestData.Id, saveData) roleIsTrue, roleErr := eiteTargetInfoes(requestData.Id, saveData)
if roleIsTrue != true { if roleIsTrue != true {
response.Result(106, roleErr, "编辑失败!", c) response.Result(106, roleErr, "编辑失败!", c)
} else { } else {
assTarEite := commonus.MapOut() assTarEite := commonus.MapOut()
assTarEite["departmentmap"] = saveData["et_relevant_departments"] assTarEite["departmentmap"] = saveData["et_relevant_departments"]
assTarEite["time"] = time.Now().Unix() assTarEite["time"] = time.Now().Unix()
global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.Assesstarget{}).Where("`targetid` = ?", requestData.Id).Updates(assTarEite) global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.Assesstarget{}).Where("`targetid` = ?", requestData.Id).Updates(assTarEite)
if len(requestData.Report) > 0 {
//获取原来的指标指定审批人
var assessInfo []assessmentmodel.Assesstarget
assessErr := global.GVA_DB_Performanceappraisal.Where("`targetid` = ?", requestData.Id).Find(&assessInfo).Error
if assessErr == nil {
for _, aev := range assessInfo {
var assUser []DutyAssEssTarget
assJsonErr := json.Unmarshal([]byte(aev.Content), &assUser)
if assJsonErr == nil {
var eiteAssUser []DutyAssEssTarget
for _, ajv := range assUser {
var eiteAssUserInfo DutyAssEssTarget
eiteAssUserInfo.Id = ajv.Id
eiteAssUserInfo.Operator = requestData.Report
eiteAssUser = append(eiteAssUser, eiteAssUserInfo)
}
assTarEiteCont := commonus.MapOut()
jsonAssUser, jsonAssUserErr := json.Marshal(eiteAssUser)
if jsonAssUserErr == nil {
assTarEiteCont["content"] = string(jsonAssUser)
assTarEiteCont["time"] = time.Now().Unix()
global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.Assesstarget{}).Where("`at_id` = ?", aev.Id).Updates(assTarEiteCont)
}
}
}
}
}
qualTarEite := commonus.MapOut() qualTarEite := commonus.MapOut()
qualTarEite["q_depart"] = saveData["et_relevant_departments"] qualTarEite["q_depart"] = saveData["et_relevant_departments"]
qualTarEite["q_time"] = time.Now().Unix() qualTarEite["q_time"] = time.Now().Unix()

2
gin_server_admin/api/v1/staff/staffpeople.go

@ -273,7 +273,7 @@ func HrUserInfor(number, pwd string) (isTrue bool, usUpdate OutScanCodeUserInfo)
usUpdate.Oldgroup = oldGroup // `json:"oldgroup"` usUpdate.Oldgroup = oldGroup // `json:"oldgroup"`
olddepart, _ := getOrgCont(ueInfo.Deparment) olddepart, _ := getOrgCont(ueInfo.Deparment)
usUpdate.Olddepartment = olddepart // `json:"olddepartment"` usUpdate.Olddepartment = olddepart // `json:"olddepartment"`
usUpdate.Key = strconv.FormatInt(ueInfo.Key, 10)
usUpdate.State = ueInfo.State usUpdate.State = ueInfo.State
usUpdate.Password = ueInfo.Password usUpdate.Password = ueInfo.Password
return return

16
gin_server_admin/api/web/jixiaokaohe/people.go

@ -1,6 +1,8 @@
package jixiaokaohe package jixiaokaohe
import ( import (
"fmt"
"github.com/flipped-aurora/gin-vue-admin/server/commonus" "github.com/flipped-aurora/gin-vue-admin/server/commonus"
"github.com/flipped-aurora/gin-vue-admin/server/global" "github.com/flipped-aurora/gin-vue-admin/server/global"
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response" "github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
@ -15,11 +17,23 @@ func (a *ApiGroup) MyContent(c *gin.Context) {
response.Result(101, isTrue, "您的身份令牌已经失效!请重新登录获取身份令牌!", c) response.Result(101, isTrue, "您的身份令牌已经失效!请重新登录获取身份令牌!", c)
return return
} }
fmt.Printf("userment----------->%v\n", userCont.Key)
if userCont.Key != "" {
var myInfo hrsystem.Personnel var myInfo hrsystem.Personnel
err := global.GVA_DB_HrDataBase.Where("key = ?", userCont.Key).First(&myInfo).Error err := global.GVA_DB_HrDataBase.Where("`key` = ?", userCont.Key).First(&myInfo).Error
if err != nil { if err != nil {
response.Result(102, err, "没有获取到数据!", c) response.Result(102, err, "没有获取到数据!", c)
return return
} }
response.Result(0, myInfo, "获取成功!", c) response.Result(0, myInfo, "获取成功!", c)
} else {
var myInfo hrsystem.Personnel
err := global.GVA_DB_HrDataBase.Where("`number` = ?", userCont.Number).First(&myInfo).Error
if err != nil {
response.Result(102, err, "没有获取到数据!", c)
return
}
response.Result(0, myInfo, "获取成功!", c)
}
} }

75
gin_server_admin/commonus/publichaneld.go

@ -64,6 +64,17 @@ func BubbleSort(slice []int64) []int64 {
return slice return slice
} }
func BubbleSortInt(slice []int) []int {
for n := 0; n <= len(slice); n++ {
for i := 1; i < len(slice)-n; i++ {
if slice[i] < slice[i-1] {
slice[i], slice[i-1] = slice[i-1], slice[i]
}
}
}
return slice
}
//编号,纯数字 //编号,纯数字
func TableNumber(class ...string) (number int64) { func TableNumber(class ...string) (number int64) {
result, _ := rand.Int(rand.Reader, big.NewInt(8999)) result, _ := rand.Int(rand.Reader, big.NewInt(8999))
@ -631,6 +642,7 @@ func ClientIdentity() (isTrue bool, redisUserInfo testpage.RedisUserInfo) {
// return // return
// } // }
redisClient := redishandel.RunRedis() redisClient := redishandel.RunRedis()
redisClient.SetRedisDb(5)
tokenInfo, isTrue := redisClient.HashGetAll("ScanCode:UserInfo:LoginUser_" + global.GVA_CONFIG.RedisPrefix.Alias + "_" + global.GVA_SCANCODE_USERNUMBER) tokenInfo, isTrue := redisClient.HashGetAll("ScanCode:UserInfo:LoginUser_" + global.GVA_CONFIG.RedisPrefix.Alias + "_" + global.GVA_SCANCODE_USERNUMBER)
if isTrue == true { if isTrue == true {
identityErr := mapstructure.Decode(tokenInfo, &redisUserInfo) identityErr := mapstructure.Decode(tokenInfo, &redisUserInfo)
@ -686,6 +698,34 @@ func getPeopleInfo() (redisUserInfo testpage.RedisUserInfo, isTrue bool) {
oldpostis, _ := getPositionCont(ueInfo.Position) oldpostis, _ := getPositionCont(ueInfo.Position)
redisUserInfo.Oldposition = oldpostis // `json:"oldposition"` redisUserInfo.Oldposition = oldpostis // `json:"oldposition"`
isTrue = true isTrue = true
redisClient := redishandel.RunRedis()
redisClient.SetRedisDb(5)
redisFileKey := fmt.Sprintf("ScanCode:UserInfo:LoginUser_%v_%v", global.GVA_CONFIG.RedisPrefix.Alias, global.GVA_SCANCODE_USERNUMBER)
redisClient.SetRedisTime(604800)
writeRedisData := map[string]interface{}{
"id": strconv.FormatInt(ueInfo.Id, 10),
"key": strconv.FormatInt(ueInfo.Key, 10),
"number": ueInfo.Number,
"name": ueInfo.Name,
"positionleveles": strconv.FormatInt(ueInfo.PositionLevel, 10),
"position": strconv.FormatInt(ueInfo.Position, 10),
"adminorg": strconv.FormatInt(ueInfo.AdminOrg, 10),
"company": strconv.FormatInt(ueInfo.Company, 10),
"emptype": fmt.Sprintf("%v", ueInfo.EmpType),
"deparment": ueInfo.Deparment,
"jobclass": strconv.FormatInt(ueInfo.JobClass, 10),
"positiongrade": strconv.FormatInt(ueInfo.PositionGrade, 10),
"role": ueInfo.Role,
"icon": ueInfo.Icon,
"wechat": wechatStr,
"jurisdiction": buttonStr,
"menuoper": menuStr,
"oldgroup": oldGroup,
"olddepartment": olddepart,
"oldposition": oldpostis,
}
redisClient.HashMsetAdd(redisFileKey, writeRedisData)
return return
} }
@ -2895,6 +2935,15 @@ func IsItTrue(id int64, idAry []int64) (isTrue bool) {
} }
return return
} }
func IsItTrueInt(id int, idAry []int) (isTrue bool) {
isTrue = false
for _, v := range idAry {
if v == id {
return true
}
}
return
}
func IsItTrueString(id string, idAry []string) (isTrue bool) { func IsItTrueString(id string, idAry []string) (isTrue bool) {
isTrue = false isTrue = false
@ -3011,13 +3060,27 @@ func JudgeColumn(ascription, columId, title, departMap string) (content assessme
if columId != "" { if columId != "" {
judgeIdErr := global.GVA_DB_Performanceappraisal.Where("`q_id` = ?", columId).First(&content).Error judgeIdErr := global.GVA_DB_Performanceappraisal.Where("`q_id` = ?", columId).First(&content).Error
if judgeIdErr == nil { if judgeIdErr == nil {
if content.State != 1 {
saveSunTarData := MapOut()
saveSunTarData["q_state"] = 1
saveSunTarData["q_time"] = time.Now().Unix()
global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeTarget{}).Where("`q_id` = ?", columId).Updates(&saveSunTarData)
}
isTrue = true isTrue = true
fmt.Printf("1\n")
return return
} }
} }
judgeErr := global.GVA_DB_Performanceappraisal.Where("`q_parent_id` = ? AND `q_title` = ?", ascription, title).First(&content).Error judgeErr := global.GVA_DB_Performanceappraisal.Where("`q_parent_id` = ? AND `q_title` = ?", ascription, title).First(&content).Error
if judgeErr == nil { if judgeErr == nil {
if content.State != 1 {
saveSunTarData := MapOut()
saveSunTarData["q_state"] = 1
saveSunTarData["q_time"] = time.Now().Unix()
global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeTarget{}).Where("`q_parent_id` = ? AND `q_title` = ?", ascription, title).Updates(&saveSunTarData)
}
isTrue = true isTrue = true
fmt.Printf("2\n")
return return
} }
ascriptionId, ascriptionErr := strconv.ParseInt(ascription, 10, 64) ascriptionId, ascriptionErr := strconv.ParseInt(ascription, 10, 64)
@ -3027,10 +3090,13 @@ func JudgeColumn(ascription, columId, title, departMap string) (content assessme
saveColum := assessmentmodel.QualitativeTarget{Title: title, ParentId: ascriptionId, State: 1, AddTime: time.Now().Unix(), Depart: departMap} saveColum := assessmentmodel.QualitativeTarget{Title: title, ParentId: ascriptionId, State: 1, AddTime: time.Now().Unix(), Depart: departMap}
addErr := global.GVA_DB_Performanceappraisal.Create(&saveColum).Error addErr := global.GVA_DB_Performanceappraisal.Create(&saveColum).Error
if addErr != nil { if addErr != nil {
fmt.Printf("3\n")
return return
} }
isTrue = true isTrue = true
content = saveColum content = saveColum
fmt.Printf("4\n")
// panic(content)
return return
} }
@ -3267,7 +3333,7 @@ func JudegDutyIsUse(group, dimension, target, target_sun, detailed int64) (isTru
isTrue = false isTrue = false
// var qeInfo []assessmentmodel.QualitativeEvaluation // var qeInfo []assessmentmodel.QualitativeEvaluation
var qeID []int64 var qeID []int64
gormDb := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Select("qe_id").Where("`State` = 1") gormDb := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Select("qe_id").Where("`qe_state` = 1")
if group != 0 { if group != 0 {
gormDb = gormDb.Where("`qe_group` = ?", group) gormDb = gormDb.Where("`qe_group` = ?", group)
} }
@ -3583,3 +3649,10 @@ func GetNewHrPeopleInfo(where interface{}, filed ...string) (ueInfo hrsystem.Per
isTrue = true isTrue = true
return return
} }
//浮点数保留两位小数
func Decimal(value float64) float64 {
value, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", value), 64)
return value
}

12
gin_server_admin/initialize/redis.go

@ -34,9 +34,9 @@ func WechatRedis() {
}) })
pong, err := client.Ping(context.Background()).Result() pong, err := client.Ping(context.Background()).Result()
if err != nil { if err != nil {
global.GVA_LOG.Error("企业微信Redis链接失败!, err:", zap.Any("err", err)) global.GVA_LOG.Error("企业微信Redis-->1链接失败!, err:", zap.Any("err", err))
} else { } else {
global.GVA_LOG.Info("企业微信Redis链接成功:", zap.String("pong", pong)) global.GVA_LOG.Info("企业微信Redis--->1链接成功:", zap.String("pong", pong))
global.GVA_REDIS_WeChat = client global.GVA_REDIS_WeChat = client
} }
} }
@ -50,9 +50,9 @@ func WechatRedis2() {
}) })
pong, err := client.Ping(context.Background()).Result() pong, err := client.Ping(context.Background()).Result()
if err != nil { if err != nil {
global.GVA_LOG.Error("企业微信Redis链接失败!, err:", zap.Any("err", err)) global.GVA_LOG.Error("企业微信Redis--->2链接失败!, err:", zap.Any("err", err))
} else { } else {
global.GVA_LOG.Info("企业微信Redis链接成功:", zap.String("pong", pong)) global.GVA_LOG.Info("企业微信Redis--->2链接成功:", zap.String("pong", pong))
global.GVA_REDIS_WeChat2 = client global.GVA_REDIS_WeChat2 = client
} }
} }
@ -66,9 +66,9 @@ func WechatRedis5() {
}) })
pong, err := client.Ping(context.Background()).Result() pong, err := client.Ping(context.Background()).Result()
if err != nil { if err != nil {
global.GVA_LOG.Error("企业微信Redis链接失败!, err:", zap.Any("err", err)) global.GVA_LOG.Error("企业微信Redis--->5链接失败!, err:", zap.Any("err", err))
} else { } else {
global.GVA_LOG.Info("企业微信Redis链接成功:", zap.String("pong", pong)) global.GVA_LOG.Info("企业微信Redis--->5链接成功:", zap.String("pong", pong))
global.GVA_REDIS_WeChat5 = client global.GVA_REDIS_WeChat5 = client
} }
} }

5
gin_server_admin/initialize/router.go

@ -67,6 +67,9 @@ func Routers() *gin.Engine {
statisAppRove := router.RouterGroupApp.StatisticsRouter //统计相关 statisAppRove := router.RouterGroupApp.StatisticsRouter //统计相关
//根据版本方案统计
planVersioStatis := router.RouterGroupApp.StatisticsVersion //前端审批相关
/** /**
企业微信相关 企业微信相关
*/ */
@ -170,6 +173,8 @@ func Routers() *gin.Engine {
webApiInit.InitRouter(MyCustomPrivateGroup) //手机的接口 webApiInit.InitRouter(MyCustomPrivateGroup) //手机的接口
statisAppRove.InitRouter(MyCustomPrivateGroup) //统计相关 statisAppRove.InitRouter(MyCustomPrivateGroup) //统计相关
planVersioStatis.InitRouter(MyCustomPrivateGroup) //根据激活版本统计
} }
//自定义后台登录 //自定义后台登录
MyCustomSystemGroup := Router.Group("") MyCustomSystemGroup := Router.Group("")

6
gin_server_admin/middleware/myjwt.go

@ -237,13 +237,13 @@ func ScanCodeLogin() gin.HandlerFunc {
var myCustomIdentify commonus.ScanCodeLogin var myCustomIdentify commonus.ScanCodeLogin
if isTrues != true { if isTrues != true {
response.FailWithDetailed(gin.H{"reload": true, "code": 102}, "您的帐户异地登陆或令牌失效", c) response.FailWithDetailed(gin.H{"reload": true, "code": 102, "key": redisFileKey, "tokenInfo": tokenInfo, "redisClient": redisClient}, "您的帐户异地登陆或令牌失效", c)
c.Abort() c.Abort()
return return
} else { } else {
tokenErr := mapstructure.Decode(tokenInfo, &myCustomIdentify) tokenErr := mapstructure.Decode(tokenInfo, &myCustomIdentify)
if tokenErr != nil { if tokenErr != nil {
response.FailWithDetailed(gin.H{"reload": true, "code": 103, "tokenErr": tokenErr}, "您的帐户异地登陆或令牌失效", c) response.FailWithDetailed(gin.H{"reload": true, "code": 103, "tokenErr": tokenErr}, "您的令牌失效", c)
c.Abort() c.Abort()
return return
} }
@ -260,7 +260,7 @@ func ScanCodeLogin() gin.HandlerFunc {
sha1Token := commonus.Sha1Encryption(sha1Str) sha1Token := commonus.Sha1Encryption(sha1Str)
// fmt.Printf("token=========>%v---->%v---->%v\n", md5Token, sha1Token, userAgent) // fmt.Printf("token=========>%v---->%v---->%v\n", md5Token, sha1Token, userAgent)
if sha1Token != userToken { if sha1Token != userToken {
response.FailWithDetailed(gin.H{"reload": true, "code": 104}, "授权已过期", c) response.FailWithDetailed(gin.H{"reload": true, "code": 104, "sha1Token": sha1Token, "userToken": userToken}, "授权已过期", c)
c.Abort() c.Abort()
return return
} }

19
gin_server_admin/model/assessmentmodel/dutyclass.go

@ -1,6 +1,10 @@
package assessmentmodel package assessmentmodel
import "github.com/flipped-aurora/gin-vue-admin/server/global" import (
"strings"
"github.com/flipped-aurora/gin-vue-admin/server/global"
)
//职责类别 //职责类别
type DutyClass struct { type DutyClass struct {
@ -189,6 +193,7 @@ type EvaluationTarget struct {
CycleAttres int `json:"cycleattr" gorm:"column:et_cycleattr;type:int(9) unsigned;default:1;not null;comment:辅助计数"` CycleAttres int `json:"cycleattr" gorm:"column:et_cycleattr;type:int(9) unsigned;default:1;not null;comment:辅助计数"`
VisibleRange string `json:"visiblerange" gorm:"column:et_visible_range;type:text;comment:可见范围"` VisibleRange string `json:"visiblerange" gorm:"column:et_visible_range;type:text;comment:可见范围"`
VisibleRangeGroup string `json:"visiblerangegroup" gorm:"column:et_visible_group;type:text;comment:可见范围(集团)"` VisibleRangeGroup string `json:"visiblerangegroup" gorm:"column:et_visible_group;type:text;comment:可见范围(集团)"`
ScoringMethod int `json:"scoringmethod" gorm:"column:et_scoring_method;type:tinyint(1) unsigned;default:1;not null;comment:计分方式(1:自动;2:手动)"`
} }
func (EvaluationTarget *EvaluationTarget) TableName() string { func (EvaluationTarget *EvaluationTarget) TableName() string {
@ -292,6 +297,16 @@ type QualitativeEvaluation struct {
func (QualitativeEvaluation *QualitativeEvaluation) TableName() string { func (QualitativeEvaluation *QualitativeEvaluation) TableName() string {
return "qualitative_evaluation" return "qualitative_evaluation"
} }
func (q *QualitativeEvaluation) GetCont(whereMap interface{}, field ...string) (err error) {
gormDb := global.GVA_DB_Performanceappraisal.Model(&q)
if len(field) > 0 {
fieldStr := strings.Join(field, ",")
gormDb = gormDb.Select(fieldStr)
}
gormDb = gormDb.Where(whereMap)
err = gormDb.First(&q).Error
return
}
//性质考核方案 //性质考核方案
type DepartmentDimension struct { type DepartmentDimension struct {
@ -418,6 +433,7 @@ type PlanVersio struct {
State int `json:"state" gorm:"column:state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` State int `json:"state" gorm:"column:state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"`
AddTime int64 `json:"addtime" gorm:"column:addtime;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` AddTime int64 `json:"addtime" gorm:"column:addtime;type:bigint(20) unsigned;default:0;not null;comment:创建时间"`
EiteTime int64 `json:"eitetime" gorm:"column:eitetime;type:bigint(20) unsigned;default:0;not null;comment:修改时间"` EiteTime int64 `json:"eitetime" gorm:"column:eitetime;type:bigint(20) unsigned;default:0;not null;comment:修改时间"`
Content string `json:"content" gorm:"column:content;type:longtext;comment:版本内容"`
} }
func (PlanVersio *PlanVersio) TableName() string { func (PlanVersio *PlanVersio) TableName() string {
@ -436,6 +452,7 @@ type PositionPlanVersio struct {
State int `json:"state" gorm:"column:state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` State int `json:"state" gorm:"column:state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"`
AddTime int64 `json:"addtime" gorm:"column:addtime;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` AddTime int64 `json:"addtime" gorm:"column:addtime;type:bigint(20) unsigned;default:0;not null;comment:创建时间"`
EiteTime int64 `json:"eitetime" gorm:"column:eitetime;type:bigint(20) unsigned;default:0;not null;comment:修改时间"` EiteTime int64 `json:"eitetime" gorm:"column:eitetime;type:bigint(20) unsigned;default:0;not null;comment:修改时间"`
Content string `json:"content" gorm:"column:content;type:longtext;comment:版本内容"`
} }
func (PositionPlanVersio *PositionPlanVersio) TableName() string { func (PositionPlanVersio *PositionPlanVersio) TableName() string {

2
gin_server_admin/router/enter.go

@ -8,6 +8,7 @@ import (
"github.com/flipped-aurora/gin-vue-admin/server/router/examrouter" "github.com/flipped-aurora/gin-vue-admin/server/router/examrouter"
"github.com/flipped-aurora/gin-vue-admin/server/router/examtestpage" "github.com/flipped-aurora/gin-vue-admin/server/router/examtestpage"
"github.com/flipped-aurora/gin-vue-admin/server/router/index/examapprove" "github.com/flipped-aurora/gin-vue-admin/server/router/index/examapprove"
"github.com/flipped-aurora/gin-vue-admin/server/router/index/statisticsroute"
"github.com/flipped-aurora/gin-vue-admin/server/router/publichandel" "github.com/flipped-aurora/gin-vue-admin/server/router/publichandel"
"github.com/flipped-aurora/gin-vue-admin/server/router/shiyan" "github.com/flipped-aurora/gin-vue-admin/server/router/shiyan"
"github.com/flipped-aurora/gin-vue-admin/server/router/staffrouter" "github.com/flipped-aurora/gin-vue-admin/server/router/staffrouter"
@ -38,6 +39,7 @@ type RouterGroup struct {
PublicApprove publichandel.RouterGroup PublicApprove publichandel.RouterGroup
WebApiRoute webrouter.WebRouter WebApiRoute webrouter.WebRouter
StatisticsRouter statisticsrouter.RouterGroup StatisticsRouter statisticsrouter.RouterGroup
StatisticsVersion statisticsroute.StatisticsRoute
} }
var RouterGroupApp = new(RouterGroup) var RouterGroupApp = new(RouterGroup)

3
gin_server_admin/router/index/statisticsroute/enter.go

@ -0,0 +1,3 @@
package statisticsroute
type StatisticsRoute struct{}

20
gin_server_admin/router/index/statisticsroute/programme.go

@ -0,0 +1,20 @@
package statisticsroute
import (
v2 "github.com/flipped-aurora/gin-vue-admin/server/api/index"
"github.com/gin-gonic/gin"
)
//统计
func (s *StatisticsRoute) InitRouter(Router *gin.RouterGroup) {
shiyanCodeRouter := Router.Group("ststic")
var authorityApi = v2.ApiGroupApp.StatisticsApi
{
shiyanCodeRouter.POST("", authorityApi.Index) // 入口
shiyanCodeRouter.POST("/", authorityApi.Index)
shiyanCodeRouter.GET("", authorityApi.Index)
shiyanCodeRouter.GET("/", authorityApi.Index)
shiyanCodeRouter.POST("getconfig", authorityApi.PlanVersioStatistics) //方案数据表格同居
}
}

8
gin_server_admin/router/statisticsrouter/statistics.go

@ -14,4 +14,12 @@ func (s *StatisticsRouter) InitRouter(Router *gin.RouterGroup) {
CodeRouter.POST("", initApiRouter.Index) // 首页 CodeRouter.POST("", initApiRouter.Index) // 首页
CodeRouter.POST("gettargetorgandyear", initApiRouter.GetTargetOrgAndYear) // 计算定性考核组织范围,及起止年份 CodeRouter.POST("gettargetorgandyear", initApiRouter.GetTargetOrgAndYear) // 计算定性考核组织范围,及起止年份
} }
QuantRouter := Router.Group("quant")
var initQuantApiRouter = statistics.ApiGroupApp.QuantApi
{
QuantRouter.POST("", initQuantApiRouter.Index) // 首页
QuantRouter.POST("getquantechartorgandyear", initQuantApiRouter.GetQuantEChartOrgAndYear) // 计算定量考核组织范围,及起止年份
QuantRouter.POST("quantechart", initQuantApiRouter.QuantEChart) // 计算定量考核数据
}
} }

1
gin_server_admin/utils/redishandel/myredis.go

@ -158,6 +158,7 @@ func (r *RedisStoreType) HashMsetAddAry(hashName string, hashVal []map[string]in
*/ */
func (r *RedisStoreType) HashGetAll(hashName string) (map[string]string, bool) { func (r *RedisStoreType) HashGetAll(hashName string) (map[string]string, bool) {
// rdb := RedisInit() // rdb := RedisInit()
// fmt.Printf("strKEy:===>%v\n", r.PreKey+hashName)
val, err := r.RedisDb.HGetAll(r.Context, r.PreKey+hashName).Result() val, err := r.RedisDb.HGetAll(r.Context, r.PreKey+hashName).Result()
if err != nil { if err != nil {
return val, false return val, false

Loading…
Cancel
Save