From 4235ac56464f144b5ba1b49c0920dbb90ca52c12 Mon Sep 17 00:00:00 2001 From: herenshan112 Date: Sat, 27 Aug 2022 11:14:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B2=97=E4=BD=8D=E8=A2=AB=E8=80=83=E6=A0=B8?= =?UTF-8?q?=E4=BA=BA=E5=AE=9A=E6=80=A7=E6=8C=87=E6=A0=87=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/version1/honoraryArchives/honors.go | 9 ++ api/version1/honoraryArchives/type.go | 4 +- api/version1/postseting/postweb/posttarget.go | 86 ++++++++++++++++++- api/version1/postseting/postweb/type.go | 18 +++- apirouter/v1/postseting/web.go | 7 +- models/modelskpi/sheme_people.go | 4 + 6 files changed, 118 insertions(+), 10 deletions(-) diff --git a/api/version1/honoraryArchives/honors.go b/api/version1/honoraryArchives/honors.go index 9a50522..1c75bb5 100644 --- a/api/version1/honoraryArchives/honors.go +++ b/api/version1/honoraryArchives/honors.go @@ -399,5 +399,14 @@ func (a *ApiMethod) GetHonorsCont(c *gin.Context) { outData.Userid = carrierTypeCont.Userid //归属人员"` outData.Time = carrierTypeCont.Time //创建时间"` outData.State = carrierTypeCont.State //状态(1:启用;2:禁用;3:删除)"` + + if carrierTypeCont.AwardTime != 0 { + outData.AwardTimeStr = publicmethod.UnixTimeToDay(carrierTypeCont.AwardTime, 14) + } + if carrierTypeCont.AwardTime != 0 { + outData.TermOfValidityStr = publicmethod.UnixTimeToDay(carrierTypeCont.TermOfValidity, 14) + } else { + outData.TermOfValidityStr = "永久" + } publicmethod.Result(0, outData, c) } diff --git a/api/version1/honoraryArchives/type.go b/api/version1/honoraryArchives/type.go index db8324d..680f2d9 100644 --- a/api/version1/honoraryArchives/type.go +++ b/api/version1/honoraryArchives/type.go @@ -81,5 +81,7 @@ type honorslist struct { // 查询荣誉详情输出 type lookHonorsCont struct { modelshonory.HonoraryArchives - ImgUrl []modelshonory.PhotosGallery `json:"imgurl"` //图片集 + AwardTimeStr string `json:"awardtimestr"` //获奖时间 + TermOfValidityStr string `json:"termvaliditytr"` //获奖时间 + ImgUrl []modelshonory.PhotosGallery `json:"imgurl"` //图片集 } diff --git a/api/version1/postseting/postweb/posttarget.go b/api/version1/postseting/postweb/posttarget.go index cb1f019..989888a 100644 --- a/api/version1/postseting/postweb/posttarget.go +++ b/api/version1/postseting/postweb/posttarget.go @@ -1,11 +1,13 @@ package postweb import ( + "fmt" "key_performance_indicators/models/modelshr" "key_performance_indicators/models/modelskpi" "key_performance_indicators/overall" "key_performance_indicators/overall/publicmethod" "strconv" + "strings" "github.com/gin-gonic/gin" ) @@ -92,7 +94,7 @@ func (a *ApiMethod) GetPostNature(c *gin.Context) { //获取被考核人本岗位的考核项目 var itemList []modelskpi.ShemePeople - err = overall.CONSTANT_DB_KPI.Where("`state` = 1 AND `attribute` = 1 AND `run_state` <> 2 AND `org_id` = ? AND `post_id` = ? AND `man_key` = ?", userCont.MainDeparment, userCont.Position, context.Key).Find(&itemList).Error + err = overall.CONSTANT_DB_KPI.Where("`state` IN (1,3) AND `type` = 2 AND `attribute` = 1 AND `run_state` <> 2 AND `org_id` = ? AND `post_id` = ? AND `man_key` = ?", userCont.MainDeparment, userCont.Position, context.Key).Find(&itemList).Error if err != nil || len(itemList) < 1 { publicmethod.Result(107, err, c) return @@ -147,7 +149,7 @@ func (a *ApiMethod) GetPostRation(c *gin.Context) { //获取被考核人本岗位的考核项目 var itemList []modelskpi.ShemePeople - err = overall.CONSTANT_DB_KPI.Where("`state` = 1 AND `attribute` = 2 AND `run_state` <> 2 AND `org_id` = ? AND `post_id` = ? AND `man_key` = ?", userCont.MainDeparment, userCont.Position, context.Key).Find(&itemList).Error + err = overall.CONSTANT_DB_KPI.Where("`state` IN (1,3) AND `type` = 2 AND `attribute` = 2 AND `run_state` <> 2 AND `org_id` = ? AND `post_id` = ? AND `man_key` = ?", userCont.MainDeparment, userCont.Position, context.Key).Find(&itemList).Error if err != nil || len(itemList) < 1 { publicmethod.Result(107, err, c) return @@ -181,6 +183,10 @@ func (a *ApiMethod) GetPostDeimensoInfo(c *gin.Context) { publicmethod.Result(101, receivedValue, c) return } + if receivedValue.DimensionId == "" { + publicmethod.Result(101, receivedValue, c) + return + } if receivedValue.TargetId == "" { publicmethod.Result(101, receivedValue, c) return @@ -197,9 +203,81 @@ func (a *ApiMethod) GetPostDeimensoInfo(c *gin.Context) { //获取被考核人本岗位的考核项目 var itemList []modelskpi.ShemePeople - err = overall.CONSTANT_DB_KPI.Where("`state` = 1 AND `attribute` = 2 AND `run_state` <> 2 AND `org_id` = ? AND `post_id` = ? AND `man_key` = ?", userCont.MainDeparment, userCont.Position, context.Key).Find(&itemList).Error - if err != nil || len(itemList) < 1 { + gormDb := overall.CONSTANT_DB_KPI.Where("`state` IN (1,3) AND `type` = 2 AND `attribute` = 1 AND `run_state` <> 2 AND `dimension_id` = ? AND `target_id` = ? AND `org_id` = ? AND `post_id` = ? AND `man_key` = ?", receivedValue.DimensionId, receivedValue.TargetId, userCont.MainDeparment, userCont.Position, context.Key) + gormDb = publicmethod.PageTurningSettings(gormDb, receivedValue.Page, receivedValue.PageSize) + errGorm := gormDb.Order("`son_target_id` DESC").Find(&itemList).Error + var total int64 + totalErr := gormDb.Count(&total).Error + if totalErr != nil { + total = 0 + } + if errGorm != nil || len(itemList) < 1 { publicmethod.Result(107, err, c) return } + var outList []outNatureDimeCont + for _, v := range itemList { + var outCont outNatureDimeCont + outCont.Id = v.Id + outCont.VersionNumber = v.VersionNumber // 版本编号"` + outCont.CompanyId = v.CompanyId // 归属公司"` + outCont.DepartmentId = v.DepartmentId // 归属部门"` + outCont.OrgId = v.OrgId // 归属行政组织"` + outCont.PostId = v.PostId // 归属岗位"` + outCont.Title = v.Title //考核项名称"` + outCont.DimensionId = v.DimensionId //维度"` + outCont.TargetId = v.TargetId // 指标"` + outCont.SonTargetId = v.SonTargetId //子栏目"` + outCont.DetailsId = v.DetailsId //细则"` + outCont.Attribute = v.Attribute // 属性 1:定性考核;2:定量考核"` + outCont.MinScore = v.MinScore // 最小分*100保存"` + outCont.MaxScore = v.MaxScore //最大分*100保存"` + outCont.ScoringMethod = v.ScoringMethod //计分方式(1:自动;2:手动)"` + outCont.State = v.State //状态(1:启用;2:禁用;3:删除)"` + outCont.Addtime = v.Addtime //添加时间"` + outCont.Eitetime = v.Eitetime // 编辑时间"` + outCont.CensorType = v.CensorType //检查方式(1:现场检查;2:资料检查;3:事件触发)"` + outCont.Source = v.Source //来源(1:岗位;2:部门引用)"` + outCont.RunState = v.RunState //运行状态(1:启用;2:禁用;3:观察)"` + + outCont.Type = v.Type //类型(1:公司级;2:部门级)"` + outCont.ReportPerson = v.ReportPerson //上报人"` + outCont.ManDepartment = v.ManDepartment //提报人所在部门"` + outCont.Class = v.Class //1:定性考核;2:定量考核"` + outCont.Level = v.Level //类型(1:指标;2:子目标;3:细则)"` + outCont.Punishmode = v.Punishmode //处罚方式 1:扣分;2:现金处罚;3:扣分加现金 + outCont.Maxmoney = v.Maxmoney //最高罚款 + outCont.Minmoney = v.Minmoney //最低罚款 + if v.CensorType != "" { + outCont.CensorTypeAry = strings.Split(v.CensorType, ",") + } + if v.DetailsId != 0 { + //获取指标信息 + if v.Source == 1 { //岗位 + var targetCont modelskpi.PostTargetDetails + targetCont.GetCont(map[string]interface{}{"`id`": v.DetailsId}, "content", "add_reduce", "censor_cont") + outCont.Context = targetCont.Content //指标说明"` + outCont.AddReduce = targetCont.AddReduce //1:减少;2:增加;3:无属性,现场确认加或减"` + outCont.CensorCont = targetCont.CensorCont //检查依据"` + } else { //部门 + var departTarDeta modelskpi.DetailedTarget + departTarDeta.GetCont(map[string]interface{}{"`dt_id`": v.DetailsId}, "`dt_add_reduce`") + outCont.Context = departTarDeta.Content //指标说明"` + outCont.AddReduce = departTarDeta.AddReduce //1:减少;2:增加;3:无属性,现场确认加或减"` + outCont.CensorCont = departTarDeta.CensorCont //检查依据"` + } + } + if v.MinScore != 0 { + outCont.ScoreStr = fmt.Sprintf("%v-%v", v.MinScore, v.MaxScore) + } else { + outCont.ScoreStr = fmt.Sprintf("%v", v.MaxScore) + } + if v.Minmoney != 0 { + outCont.MoneyStr = fmt.Sprintf("%v-%v", v.Minmoney, v.Maxmoney) + } else { + outCont.MoneyStr = fmt.Sprintf("%v", v.Maxmoney) + } + outList = append(outList, outCont) + } + publicmethod.ResultList(0, receivedValue.Page, receivedValue.PageSize, total, int64(len(outList)), outList, c) } diff --git a/api/version1/postseting/postweb/type.go b/api/version1/postseting/postweb/type.go index ada3beb..c902c98 100644 --- a/api/version1/postseting/postweb/type.go +++ b/api/version1/postseting/postweb/type.go @@ -1,6 +1,7 @@ package postweb import ( + "key_performance_indicators/models/modelskpi" "key_performance_indicators/overall/publicmethod" "github.com/gin-gonic/gin" @@ -40,6 +41,19 @@ type outPostRation struct { // 获取指定人的定性考核细则列表 type getNatureDimeList struct { - UserKey string `json:"userkey"` - TargetId string `json:"targetid"` + publicmethod.PagesTurn + UserKey string `json:"userkey"` + DimensionId string `json:"dimensionid"` //维度 + TargetId string `json:"targetid"` +} + +// 输出定性考核细则内容 +type outNatureDimeCont struct { + modelskpi.ShemePeople + CensorTypeAry []string `json:"censortypeary"` + Context string `json:"content"` //指标说明 + AddReduce int `json:"addreduce"` //1:减少;2:增加;3:无属性,现场确认加或减 + CensorCont string `json:"censorcont"` //检查依据 + ScoreStr string `json:"scorestr"` //基础考核标准 + MoneyStr string `json:"moneystr"` //现金 } diff --git a/apirouter/v1/postseting/web.go b/apirouter/v1/postseting/web.go index e2e9611..a54818b 100644 --- a/apirouter/v1/postseting/web.go +++ b/apirouter/v1/postseting/web.go @@ -15,8 +15,9 @@ func (a *ApiRouter) RouterGroupWeb(router *gin.RouterGroup) { apiRouter.GET("", methodBinding.Index) //入口 apiRouter.POST("", methodBinding.Index) //入口 - apiRouter.POST("getposttarget", methodBinding.GetPostTarget) //获取指定人要考核的项目列表 - apiRouter.POST("getpostnature", methodBinding.GetPostNature) //定性指标列表 - apiRouter.POST("getpostration", methodBinding.GetPostRation) //定量指标列表 + apiRouter.POST("getposttarget", methodBinding.GetPostTarget) //获取指定人要考核的项目列表 + apiRouter.POST("getpostnature", methodBinding.GetPostNature) //定性指标列表 + apiRouter.POST("getpostration", methodBinding.GetPostRation) //定量指标列表 + apiRouter.POST("get_post_deimenso_info", methodBinding.GetPostDeimensoInfo) //获取岗位定性考核指标细则列表 } } diff --git a/models/modelskpi/sheme_people.go b/models/modelskpi/sheme_people.go index 16ae373..bb5ff1b 100644 --- a/models/modelskpi/sheme_people.go +++ b/models/modelskpi/sheme_people.go @@ -35,6 +35,10 @@ type ShemePeople struct { ManDepartment int64 `json:"mandepartment" gorm:"column:man_department;type:bigint(20) unsigned;default:0;not null;comment:提报人所在部门"` Class int `json:"class" gorm:"column:tr_class;type:tinyint(1) unsigned;default:1;not null;comment:1:定性考核;2:定量考核"` Level int `json:"level" gorm:"column:tr_level;type:tinyint(1) unsigned;default:1;not null;comment:类型(1:指标;2:子目标;3:细则)"` + + Punishmode int `json:"punishmode" gorm:"column:punishmode;type:tinyint(1) unsigned;default:1;not null;comment:处罚方式 1:扣分;2:现金处罚;3:扣分加现金"` + Maxmoney int64 `json:"maxmoney" gorm:"column:maxmoney;type:bigint(20) unsigned;default:0;not null;comment:最高罚款"` + Minmoney int64 `json:"minmoney" gorm:"column:minmoney;type:bigint(20) unsigned;default:0;not null;comment:最低罚款"` } func (ShemePeople *ShemePeople) TableName() string {