Browse Source

优化协程

qin_1
超级管理员 4 years ago
parent
commit
475bdb6ded
  1. 39
      gin_server_admin/api/admin/dutyassess/assesstype.go
  2. 223
      gin_server_admin/api/admin/dutyassess/dutyes.go
  3. 187
      gin_server_admin/api/admin/dutyassess/dutyhandle.go
  4. 44
      gin_server_admin/api/index/statistics/enter.go
  5. 20
      gin_server_admin/api/index/statistics/programme.go
  6. 2
      gin_server_admin/router/index/statisticsroute/programme.go

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

@ -533,3 +533,42 @@ type dutyList struct {
TargetId int64 `json:"targetid" gorm:"column:targetid;type:bigint(20) unsigned;default:0;not null;comment:指标"` 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"` SunTargetId int64 `json:"suntargetid" gorm:"column:suntargetid;type:bigint(20) unsigned;default:0;not null;comment:子栏目ID"`
} }
//定性考核方案新输出
type dutyOutNew struct {
Group string `json:"group"`
Dimension string `json:"dimension"` //维度ID
Dimensionname string `json:"dimensionname"` //维度名称
Target string `json:"target"` //指标ID
Targetname string `json:"targetname"` //指标名称
Departmentid []string `json:"departmentid"` //部门ID
Departmentmap []DepartmentAryType `json:"departmentmap"` //部门明细
UserList []string `json:"userlist"` //执行人列表
UserListAry []QualEvalArrt `json:"userlistary"` //执行人列表
Cycles int `json:"cycle"` //1:班;2:天;3:周;4:月;5:季度;6:年"`
CycleAttres int `json:"cycleattr"` //辅助计数"`
}
//查看定性考核列表新型输出
type scanDutyOutList struct {
Id string `json:"id"`
Group string `json:"group"`
Dimension string `json:"dimension"` //维度ID
Target string `json:"target"` //指标ID
Targetname string `json:"targetname"` //指标名称
TargetSun string `json:"targetsun"` //栏目ID
TargetSunName string `json:"targetsunname"` //栏目名称
Detailedtarget string `json:"detailedtarget"` //指标详情ID
Detailedtargetname string `json:"detailedtargetname"` //指标详情名称
DetailedTargetContent string `json:"detailedtargetcontent"` //指标详情内容
Score string `json:"scoreing"` //考核标准
Cycledettar string `json:"cycledettar"` //1:班;2:天;3:周;4:月;5:季度;6:年
Cycleattrdettar string `json:"cycleattrdettar"` //辅助计数
CensorType []string `json:"censortype"` //检查方式(1:现场检查;2:资料检查;3:事件触发)
CensorCont string `json:"censorcont"` //检查依据
CensorRate string `json:"censorrate"` //检查频次
DutyAssessId string `json:"dutyassessid"` //定性考核ID
Unit string `json:"unit"` //单位"`
DepartIdMap []string `json:"departidmap"` //子栏目部门
DepartNameMap []string `json:"departnamemap"` //子栏目部门
}

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

@ -1,6 +1,7 @@
package dutyassess package dutyassess
import ( import (
"encoding/json"
"fmt" "fmt"
"strconv" "strconv"
"strings" "strings"
@ -9,6 +10,9 @@ import (
"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/assessmentmodel" "github.com/flipped-aurora/gin-vue-admin/server/model/assessmentmodel"
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
"github.com/gin-gonic/gin"
"github.com/mitchellh/mapstructure"
) )
//判断考核细则是否存在(新规则) //判断考核细则是否存在(新规则)
@ -259,3 +263,222 @@ func JudgeDetailsCopyEs(ascription, departStr string, sunTargetId int64, detaile
content = saveColumEs content = saveColumEs
return return
} }
//解析考核关系
/*
@group 集团
@dimeId 维度
@target 指标
*/
func jieXiDutyList(group, dimeId, target int64) (departIdAry []string, departAry []DepartmentAryType, userIdContStr []string, userContAry []QualEvalArrt) {
var targetAssessAry []assessmentmodel.Assesstarget
errGroup := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.Assesstarget{}).Select("`departmentmap`,`content`").Where("`group` = ? AND `dimension`= ? AND `targetid` = ?", group, dimeId, target).Find(&targetAssessAry).Error
if errGroup != nil {
return
}
// var departIdAry []int64
// var departAry []DepartmentAryType
// var userIdCont []int64
// var userIdContStr []string
// var userContAry []QualEvalArrt
// DutyAssEssTarget
for _, v := range targetAssessAry {
// var huiXianDepartId []int64
// jsonDepartErr := json.Unmarshal([]byte(v.Departmentmap), &huiXianDepartId)
huiXianDepartId := strings.Split(v.Departmentmap, ",")
// fmt.Printf("jsonDepartErr----->%v\n", jsonDepartErr)
// if jsonDepartErr == nil {
if len(huiXianDepartId) > 0 {
// 获取集团信息
for _, derv := range huiXianDepartId {
if commonus.IsItTrueString(derv, departIdAry) == false {
where := commonus.MapOut()
where["id"] = derv
orgCont, orgErr := commonus.GetNewOrgCont(where, "id", "name")
if orgErr == nil {
departIdAry = append(departIdAry, derv)
var departcont DepartmentAryType
departcont.Parentname = orgCont.Name
departcont.Parentid = derv
departAry = append(departAry, departcont)
}
}
}
}
var huiXianUser []DutyAssEssTarget
jsonUsertErr := json.Unmarshal([]byte(v.Content), &huiXianUser)
if jsonUsertErr == nil {
//获取人员信息
for _, usv := range huiXianUser {
for _, uskeyv := range usv.Operator {
if commonus.IsItTrueString(uskeyv, userIdContStr) == false {
userWher := commonus.MapOut()
userWher["key"] = uskeyv
usCont, usErr := commonus.GetNewHrPeopleInfo(userWher)
if usErr == true {
userIdContStr = append(userIdContStr, uskeyv)
var userCont QualEvalArrt
userCont.Id = uskeyv
userCont.Name = usCont.Name
userCont.Icon = usCont.Icon
where := commonus.MapOut()
where["id"] = usCont.Company
orgCont, _ := commonus.GetNewOrgCont(where, "id", "name", "abbreviation")
userCont.GroupName = orgCont.Name
if orgCont.Abbreviation != "" {
userCont.GroupName = orgCont.Abbreviation
}
whereDepart := commonus.MapOut()
whereDepart["id"] = usCont.Deparment
orgContDepart, _ := commonus.GetNewOrgCont(whereDepart, "id", "name")
userCont.DepartmentName = orgContDepart.Name
userCont.Number = usCont.Number
userContAry = append(userContAry, userCont)
}
}
}
}
}
}
// syncProcess.Wait()
return
}
//查看定性考核项目详情(New)
func (d *DutyAssessApi) LookDutyTargetInfo(c *gin.Context) {
var requestData LookTargetContList
err := c.ShouldBindJSON(&requestData)
if err != nil {
response.Result(101, err, "数据获取失败!", c)
return
}
if requestData.Group == "" {
response.Result(102, err, "参数错误!无法获取数据", c)
return
}
if requestData.Dimension == "" {
response.Result(103, err, "参数错误!无法获取数据", c)
return
}
if requestData.TargetId == "" {
response.Result(104, err, "参数错误!无法获取数据", c)
return
}
var assessInfoList []assessmentmodel.Assesstarget
goromDb := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.Assesstarget{})
goromDb = goromDb.Where("`group` = ? AND `dimension` = ? AND `targetid` = ?", requestData.Group, requestData.Dimension, requestData.TargetId)
assErr := goromDb.Find(&assessInfoList).Error
if assErr != nil {
response.Result(105, assErr, "没有获取到数据!", c)
return
}
var xieCheng dataLockStatistics
for _, v := range assessInfoList {
syncProcess.Add(1)
go xieCheng.jieXieZiLanMu(v.Id, v.SunTargetId, v.Content, requestData)
}
syncProcess.Wait()
readDingXingDataMap, _ := xieCheng.readMyDayData()
var outList []scanDutyOutList
mapstructure.Decode(readDingXingDataMap, &outList)
response.Result(0, outList, "获取成功!", c)
}
//解析相关指标
func (d *dataLockStatistics) jieXieZiLanMu(dutyAssessId, sunTargetId int64, sunCont string, selectData LookTargetContList) {
d.mutext.Lock()
defer d.mutext.Unlock()
var huiXianUser []DutyAssEssTarget
jsonUsertErr := json.Unmarshal([]byte(sunCont), &huiXianUser)
if jsonUsertErr != nil {
return
}
if len(huiXianUser) < 1 {
return
}
var detailId []int64
for _, v := range huiXianUser {
if commonus.IsItTrue(v.Id, detailId) == false {
detailId = append(detailId, v.Id)
}
}
if len(detailId) < 1 {
return
}
var detailedList []assessmentmodel.DetailedTarget
gormDb := global.GVA_DB_Performanceappraisal.Where("`dt_state` = 1 AND `dt_id` IN ?", detailId)
if selectData.DepartId != "" {
gormDb = gormDb.Where("FIND_IN_SET(?,`dt_paretment`)", selectData.DepartId)
}
if selectData.CensorRate != 0 {
gormDb = gormDb.Where("dt_cycle = ?", selectData.CensorRate)
}
if selectData.CensorCont != "" {
gormDb = gormDb.Where("dt_censor_cont LIKE ?", "%"+selectData.CensorCont+"%")
}
if len(selectData.CensorType) > 0 {
if commonus.IsItTrueString("1", selectData.CensorType) == true && commonus.IsItTrueString("2", selectData.CensorType) == true {
gormDb = gormDb.Where("FIND_IN_SET(1,`dt_censor_type`) OR FIND_IN_SET(2,`dt_censor_type`)")
} else if commonus.IsItTrueString("1", selectData.CensorType) == true {
gormDb = gormDb.Where("FIND_IN_SET(1,`dt_censor_type`)")
} else {
gormDb = gormDb.Where("FIND_IN_SET(2,`dt_censor_type`)")
}
}
detaErr := gormDb.Find(&detailedList).Error
if detaErr != nil {
return
}
for _, v := range detailedList {
detaildMap := commonus.MapOut()
detaildMap["id"] = strconv.FormatInt(v.Id, 10)
detaildMap["group"] = selectData.Group
//维度
detaildMap["dimension"] = selectData.Dimension
//指标
targetInfo, _ := commonus.GetTargetInfo(v.ParentId)
detaildMap["target"] = strconv.FormatInt(v.ParentId, 10)
detaildMap["targetname"] = targetInfo.Title
//栏目
targetSunInfo, _ := commonus.GetQualitativeTargetInfo(v.ParentIdSun)
detaildMap["targetsun"] = strconv.FormatInt(v.ParentIdSun, 10)
detaildMap["targetsunname"] = targetSunInfo.Title
detaildMap["departidmap"] = strings.Split(targetSunInfo.Depart, ",")
// _, DepartmentAry := commonus.GetNewOrgList(strings.Split(targetSunInfo.Depart, ","))
var depNameMap []string
// for _, sep_v := range DepartmentAry {
// depNameMap = append(depNameMap, sep_v.Parentname)
// }
detaildMap["departnamemap"] = strings.Join(depNameMap, ",")
detaildMap["detailedtarget"] = strconv.FormatInt(v.Id, 10)
detaildMap["detailedtargetname"] = v.Title
detaildMap["detailedtargetcontent"] = v.Content
if v.MinScore > 0 && v.MaxScore > 0 {
detaildMap["score"] = fmt.Sprintf("%v-%v", float64(v.MinScore)/100, float64(v.MaxScore)/100)
} else if v.MinScore > 0 && v.MaxScore <= 0 {
detaildMap["score"] = fmt.Sprintf("%v", float64(v.MinScore)/100)
} else if v.MinScore <= 0 && v.MaxScore > 0 {
detaildMap["score"] = fmt.Sprintf("%v", float64(v.MaxScore)/100)
} else {
detaildMap["score"] = "0"
}
detaildMap["cycledettar"] = fmt.Sprintf("%v", v.Cycles)
detaildMap["cycleattrdettar"] = fmt.Sprintf("%v", v.CycleAttres)
detaildMap["censortype"] = strings.Split(v.CensorType, ",")
detaildMap["censorcont"] = v.CensorCont
detaildMap["censorrate"] = fmt.Sprintf("%v", v.CensorRate)
detaildMap["dutyassessid"] = strconv.FormatInt(dutyAssessId, 10)
detaildMap["unit"] = v.Company
d.dataMap = append(d.dataMap, detaildMap)
}
syncProcess.Done()
}

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

@ -839,95 +839,116 @@ func JudgeDeiScor(id int64, listCont []DutyAssEssTarget) (cont DutyAssEssTarget,
//获取定性考核指标关系指定列表 //获取定性考核指标关系指定列表
func (d *DutyAssessApi) GetDutyRelationList(c *gin.Context) { func (d *DutyAssessApi) GetDutyRelationList(c *gin.Context) {
// var targetAssessAry []assessmentmodel.Assesstarget var targetAssessAry []assessmentmodel.Assesstarget
// errGroup := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.Assesstarget{}).Select("`group`,`targetid`").Group("`group`,`targetid`").Order("`group` ASC").Order("`targetid` ASC").Find(&targetAssessAry).Error errGroup := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.Assesstarget{}).Select("`group`,`dimension`,`targetid`").Group("`group`,`dimension`,`targetid`").Order("`group` ASC").Order("`dimension` 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
// } }
var outContList []dutyOutNew
// for _,v := range targetAssessAry{ for _, v := range targetAssessAry {
// var sunIdList var tarContMap assessmentmodel.EvaluationTarget
// } tarErr := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.EvaluationTarget{}).Select("`et_title`,`et_cycle`,`et_cycleattr`").Where("`et_id` = ?", v.TargetId).First(&tarContMap).Error
if tarErr == nil {
// response.Result(107, sunTargerIdAry, "没有信息", c) var outInfo dutyOutNew
// return outInfo.Group = strconv.FormatInt(v.Group, 10)
var list []assessmentmodel.Assesstarget //维度信息
err := global.GVA_DB_Performanceappraisal.Order("`group` ASC").Order("`targetid` ASC").Order("`suntargetid` ASC").Find(&list).Error dutyClassCont, _ := commonus.GetDutyClassInfo(v.Dimension)
if err != nil { outInfo.Dimension = strconv.FormatInt(v.Dimension, 10)
response.Result(107, err, "没有信息", c) outInfo.Dimensionname = dutyClassCont.Title
return
} //指标信息
var outList []OutDutyListes outInfo.Target = strconv.FormatInt(v.TargetId, 10)
for _, v := range list { tarCont, _ := commonus.GetTargetInfo(v.TargetId)
var outCont OutDutyListes outInfo.Targetname = tarCont.Title
outInfo.Cycles = tarCont.Cycles //1:班;2:天;3:周;4:月;5:季度;6:年"`
outCont.Id = strconv.FormatInt(v.Id, 10) outInfo.CycleAttres = tarCont.CycleAttres //辅助计数"`
outCont.Group = strconv.FormatInt(v.Group, 10)
//指标信息 outInfo.Departmentid, outInfo.Departmentmap, outInfo.UserList, outInfo.UserListAry = jieXiDutyList(v.Group, v.Dimension, v.TargetId)
outCont.Target = strconv.FormatInt(v.TargetId, 10)
tarCont, _ := commonus.GetTargetInfo(v.TargetId) outContList = append(outContList, outInfo)
outCont.TargetName = tarCont.Title
//维度信息
dutyClassCont, _ := commonus.GetDutyClassInfo(tarCont.Dimension)
outCont.Dimension = strconv.FormatInt(tarCont.Dimension, 10)
outCont.DimensionName = dutyClassCont.Title
outCont.Content = "" //指标说明
outCont.Unit = tarCont.Uniteing //单位"`
outCont.ReferenceScore = 0 //标准分值"`
outCont.Cycles = tarCont.Cycles //1:班;2:天;3:周;4:月;5:季度;6:年"`
outCont.CycleAttres = tarCont.CycleAttres //辅助计数"`
outCont.State = 1
// outCont.DepartmentId, outCont.DepartmentAry = commonus.GetBranchDepartAry(strings.Split(v.Departmentmap, ","))
outCont.DepartmentId, outCont.DepartmentAry = commonus.GetNewOrgList(strings.Split(v.Departmentmap, ","))
shenPiRen := strings.Split(tarCont.Report, ",")
outCont.UserList = shenPiRen
for _, v := range shenPiRen {
// usCont, usErr := commonus.GetWorkUser(v)
userWher := commonus.MapOut()
userWher["key"] = v
usCont, usErr := commonus.GetNewHrPeopleInfo(userWher)
// GetWorkUser
if usErr == true {
var userCont QualEvalArrt
userCont.Id = v
userCont.Name = usCont.Name
userCont.Icon = usCont.Icon
where := commonus.MapOut()
// where["id"] = usCont.Group
where["id"] = usCont.Company
orgCont, _ := commonus.GetNewOrgCont(where, "id", "name", "abbreviation")
userCont.GroupName = orgCont.Name
if orgCont.Abbreviation != "" {
userCont.GroupName = orgCont.Abbreviation
}
whereDepart := commonus.MapOut()
// whereDepart["id"] = usCont.DepartmentId
whereDepart["id"] = usCont.Deparment
orgContDepart, _ := commonus.GetNewOrgCont(whereDepart, "id", "name")
userCont.DepartmentName = orgContDepart.Name
// _, groupInfo := commonus.GetGroupCont(usCont.Group)
// userCont.GroupName = groupInfo.Name
// _, bfInfo := commonus.GetBranchFactory(usCont.DepartmentId)
// userCont.DepartmentName = bfInfo.Name
userCont.Number = usCont.Number
outCont.UserListAry = append(outCont.UserListAry, userCont)
}
} }
outList = append(outList, outCont)
} }
response.Result(0, outList, "查询完成!", c)
response.Result(0, outContList, "查询完成!", c)
return
// var list []assessmentmodel.Assesstarget
// err := global.GVA_DB_Performanceappraisal.Order("`group` ASC").Order("`targetid` ASC").Order("`suntargetid` ASC").Find(&list).Error
// if err != nil {
// response.Result(107, err, "没有信息", c)
// return
// }
// var outList []OutDutyListes
// for _, v := range list {
// var outCont OutDutyListes
// outCont.Id = strconv.FormatInt(v.Id, 10)
// outCont.Group = strconv.FormatInt(v.Group, 10)
// //指标信息
// outCont.Target = strconv.FormatInt(v.TargetId, 10)
// tarCont, _ := commonus.GetTargetInfo(v.TargetId)
// outCont.TargetName = tarCont.Title
// //维度信息
// dutyClassCont, _ := commonus.GetDutyClassInfo(tarCont.Dimension)
// outCont.Dimension = strconv.FormatInt(tarCont.Dimension, 10)
// outCont.DimensionName = dutyClassCont.Title
// outCont.Content = "" //指标说明
// outCont.Unit = tarCont.Uniteing //单位"`
// outCont.ReferenceScore = 0 //标准分值"`
// outCont.Cycles = tarCont.Cycles //1:班;2:天;3:周;4:月;5:季度;6:年"`
// outCont.CycleAttres = tarCont.CycleAttres //辅助计数"`
// outCont.State = 1
// // outCont.DepartmentId, outCont.DepartmentAry = commonus.GetBranchDepartAry(strings.Split(v.Departmentmap, ","))
// outCont.DepartmentId, outCont.DepartmentAry = commonus.GetNewOrgList(strings.Split(v.Departmentmap, ","))
// shenPiRen := strings.Split(tarCont.Report, ",")
// outCont.UserList = shenPiRen
// for _, v := range shenPiRen {
// // usCont, usErr := commonus.GetWorkUser(v)
// userWher := commonus.MapOut()
// userWher["key"] = v
// usCont, usErr := commonus.GetNewHrPeopleInfo(userWher)
// // GetWorkUser
// if usErr == true {
// var userCont QualEvalArrt
// userCont.Id = v
// userCont.Name = usCont.Name
// userCont.Icon = usCont.Icon
// where := commonus.MapOut()
// // where["id"] = usCont.Group
// where["id"] = usCont.Company
// orgCont, _ := commonus.GetNewOrgCont(where, "id", "name", "abbreviation")
// userCont.GroupName = orgCont.Name
// if orgCont.Abbreviation != "" {
// userCont.GroupName = orgCont.Abbreviation
// }
// whereDepart := commonus.MapOut()
// // whereDepart["id"] = usCont.DepartmentId
// whereDepart["id"] = usCont.Deparment
// orgContDepart, _ := commonus.GetNewOrgCont(whereDepart, "id", "name")
// userCont.DepartmentName = orgContDepart.Name
// // _, groupInfo := commonus.GetGroupCont(usCont.Group)
// // userCont.GroupName = groupInfo.Name
// // _, bfInfo := commonus.GetBranchFactory(usCont.DepartmentId)
// // userCont.DepartmentName = bfInfo.Name
// userCont.Number = usCont.Number
// outCont.UserListAry = append(outCont.UserListAry, userCont)
// }
// }
// outList = append(outList, outCont)
// }
// response.Result(0, outList, "查询完成!", c)
} }
//查看定性考核项目详情 //查看定性考核项目详情
func (d *DutyAssessApi) LookDutyTargetInfo(c *gin.Context) { func (d *DutyAssessApi) LookDutyTargetInfoOld(c *gin.Context) {
var requestData LookTargetContList var requestData LookTargetContList
err := c.ShouldBindJSON(&requestData) err := c.ShouldBindJSON(&requestData)
if err != nil { if err != nil {

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

@ -1,4 +1,48 @@
package statistics package statistics
import "github.com/flipped-aurora/gin-vue-admin/server/model/assessmentmodel"
//统计 //统计
type ApiGroup struct{} type ApiGroup struct{}
//考核方案版本列表查询
type DutyPlanVersio struct {
Group string `json:"group"` //归属集团
DeaprtId string `json:"deaprtid"` //部门ID
Year string `json:"year"` //年度
Versio string `json:"versio"` //版本
VersioNum string `json:"versionum"` //编号
State int `json:"state"` //状态
}
//考核方案版本列表查询输出
type DutyPlanVersioOut struct {
assessmentmodel.PlanVersio
GroupName string `json:"groupname"` //归属集团
DeaprtName string `json:"deaprtname"` //部门ID
Time string `json:"time"`
}
//方案回显
type AddDutyNewCont struct {
Id string `json:"id"` //维度ID
Name string `json:"name"`
// Order int64 `json:"ordering"`
ZhiFraction int `json:"zhiFraction"`
Child []EvaluPross `json:"child"` //考核细则
}
//指标
type EvaluPross struct {
Id string `json:"id"` //维度ID
Name string `json:"name"`
Content string `json:"content"` //指标说明
Unit string `json:"unit"` //单位"`
ReferenceScore int64 `json:"referencescore"` //标准分值"`
Cycles int `json:"cycle"` //1:班;2:天;3:周;4:月;5:季度;6:年"`
CycleAttres int `json:"cycleattr"` //辅助计数"`
State int `json:"state"`
Score int64 `json:"score"` //分数
QualEvalId string `json:"qeid"`
Status int `json:"status"`
}

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

@ -1,9 +1,11 @@
package statistics package statistics
import ( import (
"encoding/json"
"strconv" "strconv"
"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/model/common/response" "github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
@ -30,4 +32,22 @@ func (a *ApiGroup) PlanVersioStatistics(c *gin.Context) {
idInt, _ := strconv.ParseInt(requestData.OutId, 10, 64) idInt, _ := strconv.ParseInt(requestData.OutId, 10, 64)
requestData.Id = idInt requestData.Id = idInt
} }
var planVersioCont DutyPlanVersioOut
contErr := global.GVA_DB_Performanceappraisal.Where("`id` = ?", requestData.Id).First(&planVersioCont).Error
if contErr != nil {
response.Result(103, contErr, "没有查询到数据", c)
return
}
var planInfo []AddDutyNewCont
jsonErr := json.Unmarshal([]byte(planVersioCont.Content), &planInfo)
if jsonErr != nil {
response.Result(104, contErr, "没有查询到数据", c)
return
}
outCont := commonus.MapOut()
outCont["planInfo"] = planInfo
outCont["jsonErr"] = jsonErr
outCont["Content"] = planVersioCont.Content
response.Result(0, outCont, "获取成功", c)
} }

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

@ -15,6 +15,6 @@ func (s *StatisticsRoute) InitRouter(Router *gin.RouterGroup) {
shiyanCodeRouter.GET("", authorityApi.Index) shiyanCodeRouter.GET("", authorityApi.Index)
shiyanCodeRouter.GET("/", authorityApi.Index) shiyanCodeRouter.GET("/", authorityApi.Index)
shiyanCodeRouter.POST("getconfig", authorityApi.PlanVersioStatistics) //方案数据表格同居 shiyanCodeRouter.POST("planversiostatistics", authorityApi.PlanVersioStatistics) //方案数据表格统计
} }
} }

Loading…
Cancel
Save