Browse Source

校正部门考核数据

master
超级管理员 3 years ago
parent
commit
ab71b506d1
  1. 65
      api/index/statistics/enter.go
  2. 25
      api/index/statistics/newstatistics.go
  3. 589
      api/index/statistics/queryresults.go
  4. 41
      api/statistics/quantification/enter.go
  5. 82
      api/statistics/quantification/summary_details.go
  6. 71
      api/v1/positionkpi/entry.go
  7. 39
      api/v1/positionkpi/posttarget.go
  8. 583
      api/v1/positionkpi/posttargetcont.go
  9. 70
      api/v1/shiyan/shiyan.go
  10. 18
      commonus/wechatapp.go
  11. 51
      model/assessmentmodel/dutyclass.go
  12. 14
      model/assessmentmodel/post_target_details.go
  13. 7
      router/index/statisticsroute/programme.go
  14. 24
      router/postrouter/post_target.go
  15. 2
      router/shiyan/sys_shiyan.go

65
api/index/statistics/enter.go

@ -6,55 +6,74 @@ import (
"github.com/flipped-aurora/gin-vue-admin/server/model/assessmentmodel"
)
//统计
// 统计
type ApiGroup struct{}
//协程设置
// 协程设置
var syncProcess = sync.WaitGroup{}
var syncProcessDepartTarget = sync.WaitGroup{} //获取指标相关参数
//数据计量统计(表格统计)
// 数据计量统计(表格统计)
type tablePlanVersionStic struct {
TableScore []TableScoreList
mutext sync.RWMutex
}
//读取锁数据
// 读取锁数据
func (t *tablePlanVersionStic) readMyDayData() []TableScoreList {
t.mutext.RLock()
defer t.mutext.RUnlock()
return t.TableScore
}
//成绩表
// 成绩表
type TranscriptTableData struct {
ScoreStatistics []TranscriptTableDateList
Defen []defenfenxi
mutext sync.RWMutex
}
//读取成绩表锁数据
// 读取成绩表锁数据
func (t *TranscriptTableData) readTranscriptData() []TranscriptTableDateList {
t.mutext.RLock()
defer t.mutext.RUnlock()
return t.ScoreStatistics
}
//数据锁统计
// 数据锁统计
type dataLockStatistics struct {
outData []TargetContOutCont
mutext sync.RWMutex
}
//读取锁数据
// 读取锁数据
func (d *dataLockStatistics) readMyDayData() []TargetContOutCont {
d.mutext.RLock()
defer d.mutext.RUnlock()
return d.outData
}
//考核方案版本列表查询
// 计算部门每月成绩分数
type countEveryDepartmentMonthScore struct {
outData []everyDepartmentScore
mutext sync.RWMutex
}
// 部门月分数
type everyDepartmentScore struct {
MonthVal int64 `json:"monthval"`
Score float64 `json:"score"`
}
// 读取锁数据
func (c *countEveryDepartmentMonthScore) readMyDayData() []everyDepartmentScore {
c.mutext.RLock()
defer c.mutext.RUnlock()
return c.outData
}
// 考核方案版本列表查询
type DutyPlanVersio struct {
Group string `json:"group"` //归属集团
DeaprtId string `json:"deaprtid"` //部门ID
@ -73,7 +92,7 @@ type PlanVersioMingXi struct {
Month int `json:"month"` //月
}
//考核方案版本列表查询输出
// 考核方案版本列表查询输出
type DutyPlanVersioOut struct {
assessmentmodel.PlanVersio
GroupName string `json:"groupname"` //归属集团
@ -81,7 +100,7 @@ type DutyPlanVersioOut struct {
Time string `json:"time"`
}
//方案回显
// 方案回显
type AddDutyNewCont struct {
Id string `json:"id"` //维度ID
Name string `json:"name"`
@ -90,7 +109,7 @@ type AddDutyNewCont struct {
Child []EvaluPross `json:"child"` //考核细则
}
//指标
// 指标
type EvaluPross struct {
Id string `json:"id"` //维度ID
Name string `json:"name"`
@ -105,7 +124,7 @@ type EvaluPross struct {
Status int `json:"status"`
}
//统计表格输出
// 统计表格输出
type StaticsOut struct {
Id string `json:"id"` //维度ID
Key string `json:"name"`
@ -140,7 +159,7 @@ type OrgStaticsDepary struct {
Child []ProgrammeStatisticsCallBack `json:"child"` //考核细则
}
//方案统计回显
// 方案统计回显
type ProgrammeStatisticsCallBack struct {
Id string `json:"id"` //维度ID
Name string `json:"name"`
@ -148,7 +167,7 @@ type ProgrammeStatisticsCallBack struct {
Child []EvaluProssCall `json:"child"` //考核细则
}
//指标
// 指标
type EvaluProssCall struct {
Id string `json:"id"` //指标ID
Name string `json:"name"` //指标名称
@ -161,7 +180,7 @@ type EvaluProssCall struct {
TimeData []float64 `json:"timedata"` //统计结果
}
//考核方案细则列表输出
// 考核方案细则列表输出
type TargetContOutCont struct {
Id string `json:"id"`
Type int `json:"type"`
@ -207,7 +226,7 @@ type ScoreListAry struct {
Achievement []float64 `json:"achievement"` //达成率
}
//协程表格统计
// 协程表格统计
type TableScoreList struct {
Counter int `json:"counter"` //计数器
ScoreList
@ -223,7 +242,7 @@ type banNian struct {
Month []int `json:"month"`
}
//定量流水全奖值、零奖值、封顶值
// 定量流水全奖值、零奖值、封顶值
type FlowLogAllZreo struct {
Id string `json:"id"`
TargetId string `json:"targetid"` //指标ID`
@ -241,7 +260,7 @@ type FlowDataLogList struct {
EvaluationDepartment int64 `json:"evaluationdepartment" gorm:"column:fl_evaluation_department;type:bigint(20) unsigned;default:0;not null;comment:测评部门"`
}
//绩效考核成绩表
// 绩效考核成绩表
type TranscriptTable struct {
Group string `json:"group"`
Department string `json:"department"`
@ -249,7 +268,7 @@ type TranscriptTable struct {
Month []int `json:"month"`
}
//绩效考核成绩表结果
// 绩效考核成绩表结果
type TranscriptTableDateList struct {
DepartmentId string `json:"departmentid"`
Department string `json:"department"`
@ -267,7 +286,7 @@ type TranscriptTableDateList struct {
L float64 `json:"L"`
}
//图标维度输出
// 图标维度输出
type TranscriptTableDateListChars struct {
XLine []string `json:"xline"`
Cylindrical []string `json:"cylindrical"`
@ -279,7 +298,7 @@ type YlineData struct {
Data []float64 `json:"data"`
}
//计算得分性质
// 计算得分性质
type defenfenxi struct {
Title string `json:"title"`
TimeClass string `json:"timeclass"`
@ -288,7 +307,7 @@ type defenfenxi struct {
State int `json:"state"`
}
//行政组织级统计
// 行政组织级统计
type orgShierTongji struct {
A []float64 `json:"a"`
B []float64 `json:"b"`

25
api/index/statistics/newstatistics.go

@ -216,18 +216,18 @@ func (a *ApiGroup) DepartmentTranscript(c *gin.Context) {
var orgAry []hrsystem.AdministrativeOrganization
for _, ov := range orgList {
orgAry = append(orgAry, ov)
// if ov.Id == 281 || ov.Id == 280 {
var ovlist []hrsystem.AdministrativeOrganization
ovErr := global.GVA_DB_HrDataBase.Where("state = 1").Where("ispower = 1 AND superior = ?", ov.Id).Find(&ovlist).Error
if ovErr == nil {
for _, ovl := range ovlist {
// orgList = append(orgList, ovl)
orgAry = append(orgAry, ovl)
if ov.Id == 280 {
var ovlist []hrsystem.AdministrativeOrganization
ovErr := global.GVA_DB_HrDataBase.Where("state = 1").Where("ispower = 1 AND superior = ?", ov.Id).Find(&ovlist).Error
if ovErr == nil {
for _, ovl := range ovlist {
// orgList = append(orgList, ovl)
orgAry = append(orgAry, ovl)
}
}
// } else {
// orgAry = append(orgAry, ov)
}
// } else {
// orgAry = append(orgAry, ov)
// }
}
currentYear := commonus.ComputingTime(time.Now().Unix(), 1)
@ -244,6 +244,7 @@ func (a *ApiGroup) DepartmentTranscript(c *gin.Context) {
}
syncProcess.Wait()
readStatisticsData := deaprtmenTranscript.readTranscriptData()
// fmt.Printf("readStatisticsData------>%v\n", readStatisticsData)
var AScore float64 = 0
var BScore float64 = 0
var CScore float64 = 0
@ -526,7 +527,7 @@ func kjsd(name string, yZhoue []YlineData) bool {
return false
}
//统计月度成绩
// 统计月度成绩
func (t *TranscriptTableData) StatisticalResults(group string, orgCont hrsystem.AdministrativeOrganization, year int64) {
t.mutext.Lock()
defer t.mutext.Unlock()
@ -543,6 +544,8 @@ func (t *TranscriptTableData) StatisticalResults(group string, orgCont hrsystem.
var planVersion assessmentmodel.PlanVersio
err := global.GVA_DB_Performanceappraisal.Where("state = 1 AND department = ?", orgCont.Id).First(&planVersion).Error
// fmt.Printf("planVersion------------>%v\n", planVersion)
// return
if err == nil {
var planVersioInfo []AddDutyNewCont
jsonErr := json.Unmarshal([]byte(planVersion.Content), &planVersioInfo)

589
api/index/statistics/queryresults.go

@ -0,0 +1,589 @@
package statistics
import (
"encoding/json"
"fmt"
"strconv"
"time"
"github.com/flipped-aurora/gin-vue-admin/server/api/statistics/quantification"
"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) Queryresults(c *gin.Context) {
isTrue, userCont := commonus.ClientIdentity()
if isTrue != true {
response.Result(101, isTrue, "您的身份令牌已经失效!请重新登录获取身份令牌!", c)
return
}
var requestData TranscriptTable
c.ShouldBindJSON(&requestData)
//获取当前访问人的公司组织架构
var orgList []hrsystem.AdministrativeOrganization
gromDb := global.GVA_DB_HrDataBase.Model(&hrsystem.AdministrativeOrganization{}).Where("ispower = 1 AND state = 1 AND organization_type > 2")
if requestData.Group != "" {
gromDb = gromDb.Where("superior = ?", requestData.Group)
} else {
gromDb = gromDb.Where("superior = ?", userCont.Company)
}
if requestData.Department != "" {
gromDb = gromDb.Where("`id` = ?", requestData.Department)
}
err := gromDb.Find(&orgList).Error
if err != nil {
response.Result(102, err, "没有查询到数据", c)
return
}
if len(orgList) <= 0 {
response.Result(103, err, "没有查询到数据", c)
return
}
var orgAry []hrsystem.AdministrativeOrganization
for _, ov := range orgList {
sunOrgList, orgSunErr := getSunOrgList(ov.Id)
if orgSunErr == nil && len(sunOrgList) > 0 {
for _, sv := range sunOrgList {
orgAry = append(orgAry, sv)
}
} else {
orgAry = append(orgAry, ov)
}
}
//计算要查询的年份
currentYear := commonus.ComputingTime(time.Now().Unix(), 1)
todayYear := currentYear
if requestData.Year != "" {
yearInt64, _ := strconv.ParseInt(requestData.Year, 10, 64)
currentYear = yearInt64
}
//计算月
var monthTody []int64
if len(requestData.Month) < 1 {
if currentYear == todayYear {
monthTodyIng := commonus.ComputingTime(time.Now().Unix(), 3)
var montInt64 int64
for montInt64 = 1; montInt64 <= monthTodyIng; montInt64++ {
monthTody = append(monthTody, montInt64)
}
} else {
var montInt64All int64
for montInt64All = 1; montInt64All <= 12; montInt64All++ {
monthTody = append(monthTody, montInt64All)
}
}
} else {
for _, mmv := range requestData.Month {
monthTody = append(monthTody, int64(mmv))
}
}
//保证月份不为负数
if len(monthTody) < 1 {
monthTody = append(monthTody, 1)
}
/*
设定协程
遍历行政组织并发计算
*/
var deaprtmenTranscript TranscriptTableData
for _, v := range orgAry {
syncProcess.Add(1)
go deaprtmenTranscript.StaticticsDepartmentResult(userCont.Company, v, currentYear, monthTody)
}
syncProcess.Wait() //等待所有协程完毕
readStatisticsData := deaprtmenTranscript.readTranscriptData() //读取通道数据
fmt.Printf("readStatisticsData----------->%v\n", readStatisticsData)
var AScore float64 = 0
var BScore float64 = 0
var CScore float64 = 0
var DScore float64 = 0
var EScore float64 = 0
var FScore float64 = 0
var GScore float64 = 0
var HScore float64 = 0
var IScore float64 = 0
var JScore float64 = 0
var KScore float64 = 0
var LScore float64 = 0
jiBuQi := 0
var echarsList TranscriptTableDateListChars
var echarsListOrg TranscriptTableDateListChars
if len(requestData.Month) > 0 {
var monthAry []int
for i := 1; i <= 12; i++ {
if commonus.IsInTrue[int](i, requestData.Month) == true && commonus.IsInTrue[string](fmt.Sprintf("%v月", i), echarsList.XLine) == false {
echarsList.XLine = append(echarsList.XLine, fmt.Sprintf("%v月", i))
monthAry = append(monthAry, i)
echarsListOrg.Cylindrical = append(echarsListOrg.Cylindrical, fmt.Sprintf("%v月", i))
}
}
} else {
echarsList.XLine = append(echarsList.XLine, "1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月")
}
var orgFen orgShierTongji
// var dfgfd []YlineData
for _, readv := range readStatisticsData {
AScore = AScore + readv.A
BScore = BScore + readv.B
CScore = CScore + readv.C
DScore = DScore + readv.D
EScore = EScore + readv.E
FScore = FScore + readv.F
GScore = GScore + readv.G
HScore = HScore + readv.H
IScore = IScore + readv.I
JScore = JScore + readv.J
KScore = KScore + readv.K
LScore = LScore + readv.L
jiBuQi++
echarsList.Cylindrical = append(echarsList.Cylindrical, readv.Department)
echarsListOrg.XLine = append(echarsListOrg.XLine, readv.Department)
var cyLineAry_1 YlineData
cyLineAry_1.Name = readv.Department
// var yZhoue YlineData
if readv.A == -10000 {
readv.A = 0
}
if readv.B == -10000 {
readv.B = 0
}
if readv.C == -10000 {
readv.C = 0
}
if readv.D == -10000 {
readv.D = 0
}
if readv.E == -10000 {
readv.E = 0
}
if readv.F == -10000 {
readv.F = 0
}
if readv.G == -10000 {
readv.G = 0
}
if readv.H == -10000 {
readv.H = 0
}
if readv.I == -10000 {
readv.I = 0
}
if readv.J == -10000 {
readv.J = 0
}
if readv.K == -10000 {
readv.K = 0
}
if readv.L == -10000 {
readv.L = 0
}
if len(requestData.Month) > 0 {
if commonus.IsInTrue[int](1, requestData.Month) == true {
// echarsList.XLine = append(echarsList.XLine, fmt.Sprintf("%v月", 1))
cyLineAry_1.Data = append(cyLineAry_1.Data, readv.A)
}
if commonus.IsInTrue[int](2, requestData.Month) == true {
// echarsList.XLine = append(echarsList.XLine, fmt.Sprintf("%v月", 2))
cyLineAry_1.Data = append(cyLineAry_1.Data, readv.B)
}
if commonus.IsInTrue[int](3, requestData.Month) == true {
// echarsList.XLine = append(echarsList.XLine, fmt.Sprintf("%v月", 3))
cyLineAry_1.Data = append(cyLineAry_1.Data, readv.C)
}
if commonus.IsInTrue[int](4, requestData.Month) == true {
// echarsList.XLine = append(echarsList.XLine, fmt.Sprintf("%v月", 4))
cyLineAry_1.Data = append(cyLineAry_1.Data, readv.D)
}
if commonus.IsInTrue[int](5, requestData.Month) == true {
// echarsList.XLine = append(echarsList.XLine, fmt.Sprintf("%v月", 5))
cyLineAry_1.Data = append(cyLineAry_1.Data, readv.E)
}
if commonus.IsInTrue[int](6, requestData.Month) == true {
// echarsList.XLine = append(echarsList.XLine, fmt.Sprintf("%v月", 6))
cyLineAry_1.Data = append(cyLineAry_1.Data, readv.F)
}
if commonus.IsInTrue[int](7, requestData.Month) == true {
// echarsList.XLine = append(echarsList.XLine, fmt.Sprintf("%v月", 7))
cyLineAry_1.Data = append(cyLineAry_1.Data, readv.G)
}
if commonus.IsInTrue[int](8, requestData.Month) == true {
// echarsList.XLine = append(echarsList.XLine, fmt.Sprintf("%v月", 8))
cyLineAry_1.Data = append(cyLineAry_1.Data, readv.H)
}
if commonus.IsInTrue[int](9, requestData.Month) == true {
// echarsList.XLine = append(echarsList.XLine, fmt.Sprintf("%v月", 9))
cyLineAry_1.Data = append(cyLineAry_1.Data, readv.I)
}
if commonus.IsInTrue[int](10, requestData.Month) == true {
// echarsList.XLine = append(echarsList.XLine, fmt.Sprintf("%v月", 10))
cyLineAry_1.Data = append(cyLineAry_1.Data, readv.J)
}
if commonus.IsInTrue[int](11, requestData.Month) == true {
// echarsList.XLine = append(echarsList.XLine, fmt.Sprintf("%v月", 11))
cyLineAry_1.Data = append(cyLineAry_1.Data, readv.K)
}
if commonus.IsInTrue[int](12, requestData.Month) == true {
// echarsList.XLine = append(echarsList.XLine, fmt.Sprintf("%v月", 12))
cyLineAry_1.Data = append(cyLineAry_1.Data, readv.L)
}
} else {
cyLineAry_1.Data = append(cyLineAry_1.Data, readv.A, readv.B, readv.C, readv.D, readv.E, readv.F, readv.G, readv.H, readv.I, readv.J, readv.K, readv.L)
// cyLineAry_2.Data = append(cyLineAry_1.Data, readv.A, readv.B, readv.C, readv.D, readv.E, readv.F, readv.G, readv.H, readv.I, readv.J, readv.K, readv.L)
}
orgFen.A = append(orgFen.A, readv.A)
orgFen.B = append(orgFen.B, readv.B)
orgFen.C = append(orgFen.C, readv.C)
orgFen.D = append(orgFen.D, readv.D)
orgFen.E = append(orgFen.E, readv.E)
orgFen.F = append(orgFen.F, readv.F)
orgFen.G = append(orgFen.G, readv.G)
orgFen.H = append(orgFen.H, readv.H)
orgFen.I = append(orgFen.I, readv.I)
orgFen.J = append(orgFen.J, readv.J)
orgFen.K = append(orgFen.K, readv.K)
orgFen.L = append(orgFen.L, readv.L)
echarsList.YLine = append(echarsList.YLine, cyLineAry_1)
// echarsListOrg.YLine = append(echarsListOrg.YLine, cyLineAry_2)
}
if jiBuQi > 0 {
var pingJunFen TranscriptTableDateList
pingJunFen.DepartmentId = "0"
pingJunFen.Department = "平均分"
pingJunFen.A = commonus.Decimal(AScore / float64(jiBuQi))
pingJunFen.B = commonus.Decimal(BScore / float64(jiBuQi))
pingJunFen.C = commonus.Decimal(CScore / float64(jiBuQi))
pingJunFen.D = commonus.Decimal(DScore / float64(jiBuQi))
pingJunFen.E = commonus.Decimal(EScore / float64(jiBuQi))
pingJunFen.F = commonus.Decimal(FScore / float64(jiBuQi))
pingJunFen.G = commonus.Decimal(GScore / float64(jiBuQi))
pingJunFen.H = commonus.Decimal(HScore / float64(jiBuQi))
pingJunFen.I = commonus.Decimal(IScore / float64(jiBuQi))
pingJunFen.J = commonus.Decimal(JScore / float64(jiBuQi))
pingJunFen.K = commonus.Decimal(KScore / float64(jiBuQi))
pingJunFen.L = commonus.Decimal(LScore / float64(jiBuQi))
readStatisticsData = append(readStatisticsData, pingJunFen)
}
var monthInt []int
if len(requestData.Month) <= 0 {
for dkj := 1; dkj <= 12; dkj++ {
monthInt = append(monthInt, dkj)
}
} else {
monthInt = requestData.Month
}
for _, mvv := range monthInt {
switch mvv {
case 1:
var cyLineAry_2 YlineData
cyLineAry_2.Name = "1月"
cyLineAry_2.Data = orgFen.A
echarsListOrg.YLine = append(echarsListOrg.YLine, cyLineAry_2)
case 2:
var cyLineAry_2 YlineData
cyLineAry_2.Name = "2月"
cyLineAry_2.Data = orgFen.B
echarsListOrg.YLine = append(echarsListOrg.YLine, cyLineAry_2)
case 3:
var cyLineAry_2 YlineData
cyLineAry_2.Name = "3月"
cyLineAry_2.Data = orgFen.C
echarsListOrg.YLine = append(echarsListOrg.YLine, cyLineAry_2)
case 4:
var cyLineAry_2 YlineData
cyLineAry_2.Name = "4月"
cyLineAry_2.Data = orgFen.D
echarsListOrg.YLine = append(echarsListOrg.YLine, cyLineAry_2)
case 5:
var cyLineAry_2 YlineData
cyLineAry_2.Name = "5月"
cyLineAry_2.Data = orgFen.E
echarsListOrg.YLine = append(echarsListOrg.YLine, cyLineAry_2)
case 6:
var cyLineAry_2 YlineData
cyLineAry_2.Name = "6月"
cyLineAry_2.Data = orgFen.F
echarsListOrg.YLine = append(echarsListOrg.YLine, cyLineAry_2)
case 7:
var cyLineAry_2 YlineData
cyLineAry_2.Name = "7月"
cyLineAry_2.Data = orgFen.G
echarsListOrg.YLine = append(echarsListOrg.YLine, cyLineAry_2)
case 8:
var cyLineAry_2 YlineData
cyLineAry_2.Name = "8月"
cyLineAry_2.Data = orgFen.H
echarsListOrg.YLine = append(echarsListOrg.YLine, cyLineAry_2)
case 9:
var cyLineAry_2 YlineData
cyLineAry_2.Name = "9月"
cyLineAry_2.Data = orgFen.I
echarsListOrg.YLine = append(echarsListOrg.YLine, cyLineAry_2)
case 10:
var cyLineAry_2 YlineData
cyLineAry_2.Name = "10月"
cyLineAry_2.Data = orgFen.G
echarsListOrg.YLine = append(echarsListOrg.YLine, cyLineAry_2)
case 11:
var cyLineAry_2 YlineData
cyLineAry_2.Name = "11月"
cyLineAry_2.Data = orgFen.K
echarsListOrg.YLine = append(echarsListOrg.YLine, cyLineAry_2)
case 12:
var cyLineAry_2 YlineData
cyLineAry_2.Name = "12月"
cyLineAry_2.Data = orgFen.L
echarsListOrg.YLine = append(echarsListOrg.YLine, cyLineAry_2)
}
}
outData := commonus.MapOut()
outData["readStatisticsData"] = readStatisticsData
outData["echarsList"] = echarsList
outData["echarsListOrg"] = echarsListOrg
response.Result(0, outData, "查询完成", c)
}
// 获取下级行政组织是否有主行政部门
func getSunOrgList(orgId int64) (orgList []hrsystem.AdministrativeOrganization, ovErr error) {
ovErr = global.GVA_DB_HrDataBase.Where("state = 1").Where("ispower = 1 AND superior = ?", orgId).Find(&orgList).Error
return
}
/*
统计部门月度成绩
@group 集团
@orgCont 行政组织相关信息
@year 查询的年份
@month 查询月份边界
*/
func (t *TranscriptTableData) StaticticsDepartmentResult(group string, orgCont hrsystem.AdministrativeOrganization, year int64, month []int64) {
/*
锁操作
*/
t.mutext.Lock()
defer t.mutext.Unlock()
groupId, _ := strconv.ParseInt(group, 10, 64)
//获取要计算部门当前执行的考核方案表
var planVersionInfo assessmentmodel.PlanVersio
err := global.GVA_DB_Performanceappraisal.Where("state = 1 AND department = ?", orgCont.Id).First(&planVersionInfo).Error
if err == nil {
//将考核方案解析
var planVersioInfo []AddDutyNewCont
jsonErr := json.Unmarshal([]byte(planVersionInfo.Content), &planVersioInfo)
if jsonErr == nil {
var pingJunFen TranscriptTableDateList
pingJunFen.DepartmentId = strconv.FormatInt(orgCont.Id, 10)
pingJunFen.Department = orgCont.Name
// var i int64
var everyMonthScore countEveryDepartmentMonthScore
// for i = 1; i <= month; i++ {
// syncProcessDepartTarget.Add(1)
// //按月份计算
// go everyMonthScore.everyMonthCalculate(groupId, orgCont.Id, year, i, planVersioInfo)
// }
for _, v := range month {
syncProcessDepartTarget.Add(1)
//按月份计算
go everyMonthScore.everyMonthCalculate(groupId, orgCont.Id, year, v, planVersioInfo)
}
syncProcessDepartTarget.Wait()
everyMonthScoreList := everyMonthScore.readMyDayData()
for _, emslv := range everyMonthScoreList {
fmt.Printf("emslv---->%v\n", emslv)
switch emslv.MonthVal {
case 1:
pingJunFen.A = emslv.Score
case 2:
pingJunFen.B = emslv.Score
case 3:
pingJunFen.C = emslv.Score
case 4:
pingJunFen.D = emslv.Score
case 5:
pingJunFen.E = emslv.Score
case 6:
pingJunFen.F = emslv.Score
case 7:
pingJunFen.G = emslv.Score
case 8:
pingJunFen.H = emslv.Score
case 9:
pingJunFen.I = emslv.Score
case 10:
pingJunFen.J = emslv.Score
case 11:
pingJunFen.K = emslv.Score
case 12:
pingJunFen.L = emslv.Score
default:
}
}
var monthIsFalse int64
for monthIsFalse = 1; monthIsFalse <= 12; monthIsFalse++ {
if commonus.IsInTrue[int64](monthIsFalse, month) == false {
switch monthIsFalse {
case 1:
pingJunFen.A = -10000
case 2:
pingJunFen.B = -10000
case 3:
pingJunFen.C = -10000
case 4:
pingJunFen.D = -10000
case 5:
pingJunFen.E = -10000
case 6:
pingJunFen.F = -10000
case 7:
pingJunFen.G = -10000
case 8:
pingJunFen.H = -10000
case 9:
pingJunFen.I = -10000
case 10:
pingJunFen.J = -10000
case 11:
pingJunFen.K = -10000
case 12:
pingJunFen.L = -10000
default:
}
}
}
// if month < 12 {
// beginLostMonth := month + 1
// for ; beginLostMonth <= 12; beginLostMonth++ {
// switch beginLostMonth {
// case 1:
// pingJunFen.A = -10000
// case 2:
// pingJunFen.B = -10000
// case 3:
// pingJunFen.C = -10000
// case 4:
// pingJunFen.D = -10000
// case 5:
// pingJunFen.E = -10000
// case 6:
// pingJunFen.F = -10000
// case 7:
// pingJunFen.G = -10000
// case 8:
// pingJunFen.H = -10000
// case 9:
// pingJunFen.I = -10000
// case 10:
// pingJunFen.J = -10000
// case 11:
// pingJunFen.K = -10000
// case 12:
// pingJunFen.L = -10000
// default:
// }
// }
// }
fmt.Printf("month---->%v\n", pingJunFen)
t.ScoreStatistics = append(t.ScoreStatistics, pingJunFen)
}
}
syncProcess.Done() //结束本协程
}
/*
按月份统计部门总成绩
@groupId 集团ID
@orgId 行政组织ID
@year
@month
@planVersion 部门当前执行的考核版本
*/
func (c *countEveryDepartmentMonthScore) everyMonthCalculate(groupId, orgId, year, month int64, planVersion []AddDutyNewCont) {
/*
锁操作
*/
c.mutext.Lock()
defer c.mutext.Unlock()
var weiDuScore float64 = 0 //维度分值
var zhiBiaoScore float64 = 0 //指标标准分值
var sumScore float64 = 0 //计算得分
for _, v := range planVersion { //维度
weiDuScore = weiDuScore + float64(v.ZhiFraction)
for _, sv := range v.Child { //指标
zhiBiaoScore = zhiBiaoScore + float64(sv.ReferenceScore)
if sv.Status == 3 {
sumScore = sumScore + float64(sv.ReferenceScore)
} else {
if sv.Status == 1 && sv.Status != 3 { //判断指标是否启用并且不是观察指标
var targetInfo assessmentmodel.EvaluationTarget
targetInfo.GetCont(map[string]interface{}{"et_id": sv.Id}, "et_type,et_cycle")
if sv.Cycles == 0 { //判断统计方式
sv.Cycles = targetInfo.Cycles
}
if targetInfo.Type == 1 { //定性考核
countScore, _ := quantification.DingXingMonthSum(groupId, orgId, sv.ReferenceScore, year, month, sv.Id, sv.Cycles, sv.Status)
sumScore = sumScore + countScore
} else { //定量考核
countScores, _ := quantification.DingLiangMonthSum(groupId, orgId, sv.ReferenceScore, year, month, sv.Id, sv.Cycles, sv.Status)
sumScore = sumScore + countScores
}
// switch sv.Cycles {
// case 5: //季度统计
// case 6: //年统计
// case 7: //半年统计
// default: //月度统计
// if targetInfo.Type == 1 { //定性考核
// countScore, _ := quantification.DingXingMonthSum(groupId, orgId, sv.ReferenceScore, year, month, sv.Id, sv.Cycles, sv.Status)
// sumScore = sumScore + countScore
// } else { //定量考核
// countScores, _ := quantification.DingLiangMonthSum(groupId, orgId, sv.ReferenceScore, year, month, sv.Id, sv.Cycles, sv.Status)
// sumScore = sumScore + countScores
// }
// }
}
}
}
}
var everyMonthScoreInfo everyDepartmentScore
everyMonthScoreInfo.MonthVal = month
everyMonthScoreInfo.Score = commonus.Decimal(sumScore)
c.outData = append(c.outData, everyMonthScoreInfo)
syncProcessDepartTarget.Done() //结束本协程
}

41
api/statistics/quantification/enter.go

@ -11,35 +11,35 @@ import (
type ApiGroup struct{}
//协程设置
// 协程设置
var synergeticProcess = sync.WaitGroup{}
//数据锁统计
// 数据锁统计
type dataLockStatistics struct {
YearTime []string
OrgMap []orgModelsAry
mutext sync.RWMutex
}
//读取锁数据
// 读取锁数据
func (d *dataLockStatistics) readDataLock() ([]orgModelsAry, []string) {
d.mutext.RLock()
defer d.mutext.RUnlock()
return d.OrgMap, d.YearTime
}
//入口
// 入口
func (a *ApiGroup) Index(c *gin.Context) {
outPut := commonus.MapOut()
response.Result(0, outPut, "手机量化考核入口", c)
}
//获取指标ID
// 获取指标ID
type getTargetId[T any] struct {
TargetId []T `json:"targetid"` //指标
}
//定性考核查询参数
// 定性考核查询参数
type natureParameter struct {
TargetId []string `json:"targetid"` //指标
Org []string `json:"org"` //行政组织
@ -49,13 +49,13 @@ type natureParameter struct {
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"` //组织ID
Pid string `jsonL:"pid"` //上级
@ -68,7 +68,7 @@ type orgModelsAry struct {
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"`
@ -92,7 +92,7 @@ type OutGovCont struct {
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"`
@ -100,14 +100,14 @@ type TimeFrame struct {
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轴点位数值
@ -125,7 +125,7 @@ type AddDutyNewCont struct {
Child []EvaluPross `json:"child"` //考核细则
}
//指标
// 指标
type EvaluPross struct {
Id string `json:"id"` //维度ID
Name string `json:"name"`
@ -140,14 +140,14 @@ type EvaluPross struct {
Status int `json:"status"`
}
//查询成绩表月份明细
// 查询成绩表月份明细
type detailedResults struct {
Department string `json:"department"` //部门
Year int64 `json:"year"` //年
Months int `json:"month"` //月份
}
//输出程序月份详情表
// 输出程序月份详情表
type detailedResultsList struct {
GroupId string `json:"group"` //集团Id
GroupName string `json:"groupname"` //集团名称
@ -168,7 +168,7 @@ type detailedResultsList struct {
Score float64 `json:"score"` //得分
}
//定量流水全奖值、零奖值、封顶值
// 定量流水全奖值、零奖值、封顶值
type FlowLogAllZreo struct {
Id string `json:"id"`
TargetId string `json:"targetid"` //指标ID`
@ -177,7 +177,7 @@ type FlowLogAllZreo struct {
Capping float64 `json:"capping"` //封顶值"`
}
//查询成绩表月份明细历史
// 查询成绩表月份明细历史
type detailedResultsLog struct {
TargetId string `json:"targetid"` //指标ID
Department string `json:"department"` //部门
@ -185,7 +185,7 @@ type detailedResultsLog struct {
Months int `json:"month"` //月份
}
//定量考核基础参数
// 定量考核基础参数
type dingLiangKaoHe struct {
Zeroprize float64 `json:"zeroprize"` //零奖值"`
Allprize float64 `json:"allprize"` //全奖值"`
@ -193,14 +193,17 @@ type dingLiangKaoHe struct {
Actual float64 `json:"actual"` //实际值
CompletionRate float64 `json:"completionrate"` //达成率
Score float64 `json:"score"` //得分
MtOrAt int `json:"mtorat"` //手动还是自动
Cont string `json:"count"` //说明
}
//定性记录列表
// 定性记录列表
type dingXingLogScoreList struct {
AddOrSubtract int `json:"addorsubtract"`
Score float64 `json:"score"`
Time string `json:"time"`
EvalUserCont []EvalUserContStruct `json:"evalusercont"`
Cont string `json:"count"` //说明
}
type EvalUserContStruct struct {

82
api/statistics/quantification/summary_details.go

@ -15,7 +15,7 @@ import (
"github.com/gin-gonic/gin"
)
//汇总详情
// 汇总详情
func (a *ApiGroup) SummaryDetails(c *gin.Context) {
var requestData detailedResults
err := c.ShouldBindJSON(&requestData)
@ -38,7 +38,7 @@ func (a *ApiGroup) SummaryDetails(c *gin.Context) {
}
//获取部门版本
var planVersion assessmentmodel.PlanVersio
pvErr := global.GVA_DB_Performanceappraisal.Where("department = ? AND state = 1", requestData.Department).First(&planVersion).Error
pvErr := global.GVA_DB_Performanceappraisal.Where("department = ? AND state = 1", requestData.Department).Order("department desc").First(&planVersion).Error
if pvErr != nil {
response.Result(103, err, "没有查询到数据!", c)
return
@ -58,7 +58,7 @@ func (a *ApiGroup) SummaryDetails(c *gin.Context) {
var lookStatistics []detailedResultsList
for _, v := range planVersionCont { //维度
for _, cv := range v.Child { //指标
// if cv.Id == "18" {
// if cv.Id == "50" {
var statisCont detailedResultsList
statisCont.GroupId = strconv.FormatInt(planVersion.Group, 10) //集团Id
var groupCont hrsystem.AdministrativeOrganization
@ -80,10 +80,10 @@ func (a *ApiGroup) SummaryDetails(c *gin.Context) {
targetErr := evalTargetCont.GetCont(map[string]interface{}{"`et_id`": cv.Id}, "et_type")
if targetErr == nil {
if evalTargetCont.Type == 1 {
statisCont.Score, statisCont.ExecutiveDepartment = dingXingMonthSum(planVersion.Group, planVersion.Department, cv.ReferenceScore, requestData.Year, int64(requestData.Months), cv.Id, cv.Cycles, cv.Status)
statisCont.Score, statisCont.ExecutiveDepartment = DingXingMonthSum(planVersion.Group, planVersion.Department, cv.ReferenceScore, requestData.Year, int64(requestData.Months), cv.Id, cv.Cycles, cv.Status)
sumScore = sumScore + statisCont.Score
} else {
statisCont.Score, statisCont.ExecutiveDepartment = dingLiangMonthSum(planVersion.Group, planVersion.Department, cv.ReferenceScore, requestData.Year, int64(requestData.Months), cv.Id, cv.Cycles, cv.Status)
statisCont.Score, statisCont.ExecutiveDepartment = DingLiangMonthSum(planVersion.Group, planVersion.Department, cv.ReferenceScore, requestData.Year, int64(requestData.Months), cv.Id, cv.Cycles, cv.Status)
sumScore = sumScore + statisCont.Score
}
@ -111,8 +111,18 @@ func (a *ApiGroup) SummaryDetails(c *gin.Context) {
response.Result(0, lookStatistics, "查询成功", c)
}
//定性月份分值合计
func dingXingMonthSum(groupId, departmentId, weight, year, month int64, targetId string, cycs, status int) (score float64, EvalDepartment []string) {
// 定性月份分值合计
/*
@groupId 集团
@departmentId 部门
@weight 权重
@year
@month
@targetId 指标ID
@cycs 12345季度6
@status 1启用2禁用3观察
*/
func DingXingMonthSum(groupId, departmentId, weight, year, month int64, targetId string, cycs, status int) (score float64, EvalDepartment []string) {
//获取减分
var minusPoints float64 = 0
@ -167,11 +177,25 @@ func dingXingMonthSum(groupId, departmentId, weight, year, month int64, targetId
return
}
//获取定量考核分值
func dingLiangMonthSum(groupId, departmentId, weight, year, month int64, targetId string, cycs, status int) (score float64, EvalDepartment []string) {
// 获取定量考核分值
/*
@groupId 集团
@departmentId 部门
@weight 权重
@year
@month
@targetId 指标ID
@cycs 12345季度6
@status 1启用2禁用3观察
*/
func DingLiangMonthSum(groupId, departmentId, weight, year, month int64, targetId string, cycs, status int) (score float64, EvalDepartment []string) {
var flowDataLog []assessmentmodel.FlowDataLogType
err := global.GVA_DB_Performanceappraisal.Where("`group` = ? AND `department` = ? AND `year` = ? AND `month` = ? AND `targetid` = ?", groupId, departmentId, year, month, targetId).Find(&flowDataLog).Error
if err != nil {
fmt.Printf("err ------flowDataLog------>%v------>%v\n", err, flowDataLog)
if err != nil || len(flowDataLog) < 1 {
score = float64(weight)
return
}
var sumScore float64 = 0
@ -345,7 +369,7 @@ func analysisReward(targetId, rewardCont string, targetScore, settlementScore fl
return
}
//汇总历史记录表
// 汇总历史记录表
func (a *ApiGroup) SummaryDetailsLiangLog(c *gin.Context) {
var requestData detailedResultsLog
err := c.ShouldBindJSON(&requestData)
@ -377,15 +401,23 @@ func (a *ApiGroup) SummaryDetailsLiangLog(c *gin.Context) {
// response.Result(103, err, "没有查询到数据!", c)
// return
// }
var list []dingLiangKaoHe
//获取定量考核数据列表
var flowDataLog []assessmentmodel.FlowDataLogType
flowErr := global.GVA_DB_Performanceappraisal.Where("`department` = ? AND `targetid` = ? AND `year` = ? AND `month` = ?", requestData.Department, requestData.TargetId, requestData.Year, requestData.Months).Find(&flowDataLog).Error
if flowErr != nil {
response.Result(104, err, "没有查询到数据!", c)
return
//获取部门现行考核版本
var departPlanVersion assessmentmodel.PlanVersio
dpvErr := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.PlanVersio{}).Where("`state` = 1 AND `department` = ?", requestData.Department).First(&departPlanVersion).Error
if dpvErr == nil {
} else {
response.Result(104, err, "没有查询到数据!", c)
return
}
}
var list []dingLiangKaoHe
for _, v := range flowDataLog {
_, targetScore, status, cycle, _ := getPlanVersion(v.Edition, strconv.FormatInt(v.TargetId, 10))
var listCont dingLiangKaoHe
@ -393,11 +425,15 @@ func (a *ApiGroup) SummaryDetailsLiangLog(c *gin.Context) {
if v.ScoringMethod == 1 {
listCont.Actual = float64(v.Score)
settlementScore = float64(v.Score)
listCont.Score, listCont.Allprize, listCont.Zeroprize, listCont.Capping, listCont.CompletionRate = analysisReward(strconv.FormatInt(v.TargetId, 10), v.Baseline, targetScore, settlementScore)
} else {
listCont.Actual = float64(v.ScoringScore)
settlementScore = float64(v.ScoringScore)
// settlementScore = float64(v.ScoringScore)
_, listCont.Allprize, listCont.Zeroprize, listCont.Capping, listCont.CompletionRate = analysisReward(strconv.FormatInt(v.TargetId, 10), v.Baseline, targetScore, settlementScore)
listCont.Score = float64(v.ScoringScore)
}
listCont.MtOrAt = v.ScoringMethod
listCont.Cont = v.Content
//获取定量流水全奖、零奖、封顶值
/*
@targetId 指标ID
@ -412,7 +448,7 @@ func (a *ApiGroup) SummaryDetailsLiangLog(c *gin.Context) {
@achievement 达成率
*/
// func analysisReward(targetId, rewardCont string, targetScore, settlementScore float64) (scoreVal, allPrize, zeroPrize, CappingVal, achievement float64)
listCont.Score, listCont.Allprize, listCont.Zeroprize, listCont.Capping, listCont.CompletionRate = analysisReward(strconv.FormatInt(v.TargetId, 10), v.Baseline, targetScore, settlementScore)
if status == 3 {
listCont.Score = targetScore
}
@ -437,7 +473,7 @@ func (a *ApiGroup) SummaryDetailsLiangLog(c *gin.Context) {
response.Result(0, list, "查询完成!", c)
}
//获取版本信息
// 获取版本信息
func getPlanVersion(key, targetId string) (dimeScore, targetScore float64, status, cycle, cycleattr int) {
var planVersionCont assessmentmodel.PlanVersio
err := global.GVA_DB_Performanceappraisal.Where("`key` = ?", key).First(&planVersionCont).Error
@ -467,7 +503,7 @@ func getPlanVersion(key, targetId string) (dimeScore, targetScore float64, statu
return
}
//汇总历史记录表定性
// 汇总历史记录表定性
func (a *ApiGroup) SummaryDetailsXingLog(c *gin.Context) {
var requestData detailedResultsLog
err := c.ShouldBindJSON(&requestData)
@ -516,14 +552,14 @@ func (a *ApiGroup) SummaryDetailsXingLog(c *gin.Context) {
myCong.GetCont(map[string]interface{}{"`key`": v.EvaluationUser}, "`name`")
evalUser.UserName = myCong.Name
}
flowScoreCont.Cont = v.Reason
flowScoreCont.EvalUserCont = append(flowScoreCont.EvalUserCont, evalUser)
flowScoreList = append(flowScoreList, flowScoreCont)
}
response.Result(0, flowScoreList, "没有数据", c)
}
//定性月份分值合计
// 定性月份分值合计
func dingXingMonthSumNew(departmentId, year, month int64, targetId string) (score float64, EvalDepartment []string) {
var banBenHao []string
@ -548,7 +584,7 @@ func dingXingMonthSumNew(departmentId, year, month int64, targetId string) (scor
return
}
//获取定性考核
// 获取定性考核
func getDingXingKaoHe(departmentId, year, month int64, targetId, banBenNeiRong, editionCont string) (scoreAll float64, EvalDepartment []string) {
//获取减分
var minusPoints float64 = 0

71
api/v1/positionkpi/entry.go

@ -11,7 +11,7 @@ type ApiGroup struct {
type ApiMethod struct{}
//添加岗位指标
// 添加岗位指标
type addPostTarget struct {
Title string `json:"title"` //名称
Type int `json:"type"` //1:定性考核;2:定量考核
@ -27,20 +27,20 @@ type addPostTarget struct {
VisibleGroup []string `json:"visibleGroup"` //可见范围(集团)
}
//编辑岗位指标
// 编辑岗位指标
type editPostTargetCont struct {
idType
addPostTarget
}
//编辑状态
// 编辑状态
type editState struct {
idType
State int `json:"state"`
IsTrue int `json:"istrue"` //1:强制删除;非1:软删除
}
//岗位指标列表
// 岗位指标列表
type postTargetList struct {
commonus.PageSetLimt
Title string `json:"title"` //名称
@ -52,7 +52,7 @@ type postTargetList struct {
Report string `json:"report"` //提报人
}
//岗位考核输出
// 岗位考核输出
type outPostTargetList struct {
assessmentmodel.PostTarget
DimensionName string `json:"dimensionname"` //维度
@ -61,31 +61,31 @@ type outPostTargetList struct {
ReportAry []reportUser `json:"reportary"` //提报人
}
//Id&name
// Id&name
type idAndName struct {
idType
Name string `json:"name"`
}
//提交人
// 提交人
type reportUser struct {
idAndName
Icon string `json:"icon"`
Number string `json:"number"`
}
//Id
// Id
type idType struct {
Id string `json:"id"`
}
//输出岗位指标关联的岗位及行政组织
// 输出岗位指标关联的岗位及行政组织
type postTargetDepart struct {
DepartmentId string `json:"departmentid"`
PostList []idAndName `json:"postlist"`
}
//添加岗位指标细则
// 添加岗位指标细则
type addPostContTarget struct {
TargetId string `json:"targetid"` //指标
DepartmentId string `json:"departmentid"` //行政组织
@ -94,7 +94,7 @@ type addPostContTarget struct {
List []postContList `json:"list"` //指标细则
}
//岗位指标细则
// 岗位指标细则
type postContList struct {
Title string `json:"title"` //考核内容
ReferenceScore string `json:"referencescore"` //考核标准
@ -106,9 +106,11 @@ type postContList struct {
Evidence string `json:"evidence"` //客观证据
Explain string `json:"explain"` //备注说明
ReportAry []string `json:"reportary"` //提报人
PunishMode int `json:"punishmode"` //处罚方式 1:扣分;2:现金处罚;3:扣分加现金
CashStandard string `json:"cashstandard"` //现金标准
}
//查看岗位定性考核细则列表
// 查看岗位定性考核细则列表
type lookPostTargetDeta struct {
commonus.PageSetLimt
Title string `json:"title"` //名称
@ -119,7 +121,7 @@ type lookPostTargetDeta struct {
Cycle int `json:"cycle"` //1:班;2:天;3:周;4:月;5:季度;6:年
}
//获取定性考核指标关联的岗位
// 获取定性考核指标关联的岗位
type getTargetPost struct {
idType
DepartmentId string `json:"departmentid"` //行政组织
@ -131,8 +133,49 @@ type departmentmap struct {
Parentname string `json:"parentname"`
}
//修改指定岗位指标被考核部门数据
// 修改指定岗位指标被考核部门数据
type editTargetPostData struct {
idType
PostId []string `json:"postid"`
}
// 输出岗位子栏目
type sunPostTergetCont struct {
assessmentmodel.PostSunTarget
DepartmentId string `json:"departmentid"` //行政组织
PostId []string `json:"postid"`
Departmentmap []departmentmap `json:"departmentmap"`
}
// 获取修改定性考核子栏目的参数
type getDingXingSunTaget struct {
idType
Title string `json:"title"`
DepartmentId string `json:"departmentid"` //行政组织
PostId []string `json:"postid"` //岗位
ReportAry []string `json:"reportary"` //提报人
}
// 单一添加定性考核详细细则
type oneAddDetails struct {
SunTargetId string `json:"suntargetid"` //栏目id
postContList
PostId []string `json:"postid"` //岗位
}
// 输出定性考核细则内容
type outDetailsCont struct {
assessmentmodel.PostTargetDetails
ScoreStandard string `json:"scorestandard"` //考核标准
InspMethod []string `json:"inspmethod"` //检查方式(1:现场检查;2:资料检查;3:事件触发)
PostAry []idAndName `json:"postary"` //岗位
ReportAry []reportUser `json:"reportary"` //提报人
CashStandard string `json:"cashstandard"` //现金标准
}
// 修改指标细则
type editPostDetails struct {
Id string `json:"id"` //栏目id
postContList
PostId []string `json:"postid"` //岗位
}

39
api/v1/positionkpi/posttarget.go

@ -13,14 +13,14 @@ import (
"github.com/gin-gonic/gin"
)
//岗位指标操作
//入口
// 岗位指标操作
// 入口
func (a *ApiMethod) Index(c *gin.Context) {
outPut := commonus.MapOut()
response.Result(0, outPut, "角色管理入口获取成功", c)
}
//添加岗位指标
// 添加岗位指标
func (a *ApiMethod) AddPostTarget(c *gin.Context) {
var requestData addPostTarget
c.ShouldBindJSON(&requestData)
@ -84,7 +84,7 @@ func (a *ApiMethod) AddPostTarget(c *gin.Context) {
response.Result(0, saveData, "数据写入成功!", c)
}
//编辑岗位指标
// 编辑岗位指标
func (a *ApiMethod) EditPostTarget(c *gin.Context) {
var requestData editPostTargetCont
c.ShouldBindJSON(&requestData)
@ -170,7 +170,7 @@ func (a *ApiMethod) EditPostTarget(c *gin.Context) {
}
}
//编辑岗位指标状态
// 编辑岗位指标状态
func (a *ApiMethod) EditState(c *gin.Context) {
var requestData editState
c.ShouldBindJSON(&requestData)
@ -215,10 +215,35 @@ func (a *ApiMethod) EditState(c *gin.Context) {
}
}
}
if postTargetCont.Type == 1 {
if requestData.State != 3 {
eidtDingXing(postTargetCont.Id, requestData.State)
} else {
if requestData.IsTrue == 1 {
var postSunTargetInfo assessmentmodel.PostSunTarget
postSunTargetInfo.DelCont(map[string]interface{}{"`parent_id`": postTargetCont.Id})
var postDetailsInfo assessmentmodel.PostTargetDetails
postDetailsInfo.DelCont(map[string]interface{}{"`parent_id`": postTargetCont.Id})
} else {
eidtDingXing(postTargetCont.Id, requestData.State)
}
}
}
response.Result(0, saveData, "数据编辑成功!", c)
}
//岗位指标列表
// 编辑定性考核关联项目
/*
*/
func eidtDingXing(postTarKey int64, delVal int) {
var postSunTargetInfo assessmentmodel.PostSunTarget
postSunTargetInfo.EditCont(map[string]interface{}{"`parent_id`": postTarKey}, map[string]interface{}{"`state`": delVal, "`time`": time.Now().Unix()})
var postDetailsInfo assessmentmodel.PostTargetDetails
postDetailsInfo.EditCont(map[string]interface{}{"`parentid`": postTarKey}, map[string]interface{}{"`state`": delVal, "`time`": time.Now().Unix()})
}
// 岗位指标列表
func (a *ApiMethod) PostTargetList(c *gin.Context) {
var requestData postTargetList
c.ShouldBindJSON(&requestData)
@ -312,5 +337,3 @@ func (a *ApiMethod) PostTargetList(c *gin.Context) {
printData := commonus.OutPutList(total, int64(countSum), requestData.Page, requestData.PageSize, postTargetListAry)
response.Result(0, printData, "查询成功!", c)
}
//

583
api/v1/positionkpi/posttargetcont.go

@ -172,6 +172,26 @@ func (a *ApiMethod) AddPostTargetCont(c *gin.Context) {
maxScoreInt = 0
}
var minMoney int64 //罚款或奖励最高金额
var maxMoney int64 //罚款或奖励最新金额
moneyAry := strings.Split(lv.CashStandard, "-")
moneyAryLen := len(moneyAry)
if moneyAryLen > 0 {
if moneyAryLen == 1 {
maxMoneyEs, _ := strconv.ParseFloat(moneyAry[0], 64)
maxMoney, _ = strconv.ParseInt(strconv.FormatFloat(maxMoneyEs*100, 'f', -1, 64), 10, 64)
minMoney = 0
} else {
maxMoneyEs, _ := strconv.ParseFloat(moneyAry[moneyAryLen-1], 64)
maxMoney, _ = strconv.ParseInt(strconv.FormatFloat(maxMoneyEs*100, 'f', -1, 64), 10, 64)
minMoneyEs, _ := strconv.ParseFloat(moneyAry[0], 64)
minMoney, _ = strconv.ParseInt(strconv.FormatFloat(minMoneyEs*100, 'f', -1, 64), 10, 64)
}
} else {
minMoney = 0
maxMoney = 0
}
var saveCont assessmentmodel.PostTargetDetails
saveCont.Title = lv.Title //指标细则"`
saveCont.Content = lv.Explain //备注说明"`
@ -190,6 +210,12 @@ func (a *ApiMethod) AddPostTargetCont(c *gin.Context) {
saveCont.CycleAttres = lv.CycleAttr //辅助计数"`
saveCont.Paretment = deartmentIdInt //接受考核的部门"`
saveCont.ParetmentPost = strings.Join(requestData.PostId, ",") //接受考核的部门岗位"`
saveCont.Reportary = strings.Join(lv.ReportAry, ",") //接受考核的部门岗位"`
saveCont.Punishmode = lv.PunishMode //处罚或奖励方式 1:分数;2:现金;3:分数加现金
saveCont.Minmoney = minMoney //最高罚款*100保存"`
saveCont.Maxmoney = maxMoney //最低罚款*100保存"`
saveData = append(saveData, saveCont)
}
if len(saveData) < 1 {
@ -282,7 +308,7 @@ func (a *ApiMethod) PostTargetSunList(c *gin.Context) {
total = 0
}
err := gormDb.Order("`id` desc").Limit(requestData.PageSize).Offset(commonus.CalculatePages(requestData.Page, requestData.PageSize)).Find(&postDetails).Error
err := gormDb.Order("`parentid_sun` asc").Order("`id` desc").Limit(requestData.PageSize).Offset(commonus.CalculatePages(requestData.Page, requestData.PageSize)).Find(&postDetails).Error
if err != nil {
response.Result(103, err.Error(), "没有数据!", c)
return
@ -338,15 +364,560 @@ func (a *ApiMethod) EditPostTargetQual(c *gin.Context) {
return
}
if requestData.Id == "" {
response.Result(100, err, "您的请求数据不合法", c)
response.Result(101, err, "您的请求数据不合法", c)
return
}
if len(requestData.PostId) < 1 {
response.Result(100, err, "请指定要关联的岗位", c)
response.Result(102, err, "请指定要关联的岗位", c)
return
}
postAryStr := strings.Join(requestData.PostId, ",")
where := commonus.MapOut()
where["`id`"] = requestData.Id
var postTargetInfo assessmentmodel.PostTarget
postTarErr := postTargetInfo.EditCont(where, map[string]interface{}{"departments_post": postAryStr})
if postTarErr == nil {
var sunPostTerget assessmentmodel.PostSunTarget
sunPostTerget.EditCont(map[string]interface{}{"parent_id": requestData.Id}, map[string]interface{}{"depart_post": postAryStr})
var postTarDeta assessmentmodel.PostTargetDetails
postTarDeta.EditCont(map[string]interface{}{"parentid": requestData.Id}, map[string]interface{}{"paretment_post": postAryStr})
} else {
response.Result(103, err, "修改失败!", c)
return
}
response.Result(0, err, "修改完成", c)
}
// 获取子栏目内容
func (a *ApiMethod) GetSunTargetInfo(c *gin.Context) {
var requestData idType
err := c.ShouldBindJSON(&requestData)
if err != nil {
response.Result(100, err, "数据格式不正确!", c)
return
}
// postAryStr := strings.Join(, ",")
// where := commonus.MapOut()
// where["`id`"] = requestData.Id
if requestData.Id == "" {
response.Result(101, err, "您的请求数据不合法", c)
return
}
var sunTargetCont sunPostTergetCont
getErr := sunTargetCont.GetCont(map[string]interface{}{"`id`": requestData.Id})
if getErr != nil {
response.Result(102, err, "此栏目不存在!请检查数据!", c)
return
}
sunTargetCont.DepartmentId = strconv.FormatInt(sunTargetCont.Depart, 10)
sunTargetCont.PostId = strings.Split(sunTargetCont.DepartPost, ",")
var reporManList []string
manListErr := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.PostTargetDetails{}).Select("`reportary` ").Where("`parentid` = ? AND `parentid_sun` = ? AND `paretment` = ?").First(&reporManList).Error
if manListErr == nil {
var manList []string
if len(reporManList) > 0 {
for _, v := range reporManList {
detMan := strings.Split(v, ",")
if len(detMan) > 0 {
for _, mv := range detMan {
if commonus.IsInTrue[string](mv, manList) == false {
manList = append(manList, mv)
}
}
}
}
}
if len(manList) > 0 {
var manContList []hrsystem.PersonArchives
manErr := global.GVA_DB_HrDataBase.Model(&hrsystem.PersonArchives{}).Select("`key`,`name`").Where("`key` IN ?", manList).Find(&manContList).Error
if manErr == nil {
for _, mcv := range manContList {
var manInfo departmentmap
manInfo.Parentid = strconv.FormatInt(mcv.Key, 10)
manInfo.Parentname = mcv.Name
sunTargetCont.Departmentmap = append(sunTargetCont.Departmentmap, manInfo)
}
}
}
}
response.Result(102, sunTargetCont, "此栏目不存在!请检查数据!", c)
}
// 编辑定性考核子栏目
func (a *ApiMethod) EidtSunTargetPost(c *gin.Context) {
var requestData getDingXingSunTaget
c.ShouldBindJSON(&requestData)
if requestData.Id == "" || requestData.DepartmentId == "" || requestData.Title == "" {
response.Result(101, requestData, "您的请求数据不合法", c)
return
}
if len(requestData.PostId) < 1 {
response.Result(101, requestData, "请选择关联岗位", c)
return
}
if len(requestData.ReportAry) < 1 {
response.Result(101, requestData, "请选择关联上报人", c)
return
}
where := commonus.MapOut()
where["`id`"] = requestData.Id
var sunTarCont assessmentmodel.PostSunTarget
err := sunTarCont.GetCont(where)
if err != nil {
response.Result(101, requestData, "没有该子栏目!", c)
return
}
saveData := commonus.MapOut()
if requestData.Title != sunTarCont.Title {
saveData["title"] = requestData.Title
}
saveData["depart"] = requestData.DepartmentId
saveData["depart_post"] = strings.Join(requestData.PostId, ",")
saveData["time"] = time.Now().Unix()
saveErr := sunTarCont.EditCont(where, saveData)
if saveErr != nil {
response.Result(101, saveErr, "编辑失败!", c)
return
}
detaWher := commonus.MapOut()
detaWher["parentid"] = sunTarCont.ParentId
detaWher["parentid_sun"] = sunTarCont.Id
detaWher["paretment"] = sunTarCont.Depart
saveDetaCont := commonus.MapOut()
saveDetaCont["paretment_post"] = strings.Join(requestData.PostId, ",")
saveDetaCont["reportary"] = strings.Join(requestData.ReportAry, ",")
saveDetaCont["time"] = time.Now().Unix()
var saveDetaInfo assessmentmodel.PostTargetDetails
saveDetaInfo.EditCont(detaWher, saveDetaCont)
response.Result(0, saveErr, "编辑成功!", c)
}
// 删除指标
func (a *ApiMethod) DelSunTarget(c *gin.Context) {
var requestData editState
err := c.ShouldBindJSON(&requestData)
if err != nil {
response.Result(100, err, "数据格式不正确!", c)
return
}
if requestData.Id == "" {
response.Result(101, requestData, "您的请求数据不合法", c)
return
}
if requestData.State == 0 {
requestData.State = 1
}
if requestData.IsTrue == 0 {
requestData.IsTrue = 2
}
where := commonus.MapOut()
where["`id`"] = requestData.Id
var sunTarCont assessmentmodel.PostSunTarget
sunErr := sunTarCont.GetCont(where)
if sunErr != nil {
response.Result(101, sunErr, "没有查询到数据!", c)
return
}
if requestData.State != 3 {
eidtDingXing(sunTarCont.Id, requestData.State)
} else {
if requestData.IsTrue != 1 {
eidtDingXing(sunTarCont.Id, requestData.State)
} else {
var postSunTargetInfo assessmentmodel.PostSunTarget
postSunTargetInfo.DelCont(map[string]interface{}{"`parent_id`": sunTarCont.Id})
var postDetailsInfo assessmentmodel.PostTargetDetails
postDetailsInfo.DelCont(map[string]interface{}{"`parent_id`": sunTarCont.Id})
}
}
}
// 添加单条定性指标细则
func (a *ApiMethod) AddPostDetaCont(c *gin.Context) {
var requestData oneAddDetails
c.ShouldBindJSON(&requestData)
if requestData.SunTargetId == "" {
response.Result(101, requestData, "您的请求数据不合法", c)
return
}
var sunTarCont assessmentmodel.PostSunTarget
sunErr := sunTarCont.GetCont(map[string]interface{}{"`id`": requestData.SunTargetId}, "`parent_id`", "`depart`", "`depart_post`")
if sunErr != nil {
response.Result(101, requestData, "您的请求数据不合法", c)
return
}
if requestData.Title == "" {
response.Result(101, requestData, "请输入细则名称", c)
return
}
switch requestData.PunishMode {
case 2:
if requestData.CashStandard == "" {
response.Result(101, requestData, "请输入考核现金标准", c)
return
}
case 3:
if requestData.ReferenceScore == "" {
response.Result(101, requestData, "请输入考核标准", c)
return
}
if requestData.CashStandard == "" {
response.Result(101, requestData, "请输入考核现金标准", c)
return
}
if requestData.Unit == "" {
response.Result(101, requestData, "请输入考核单位", c)
return
}
default:
requestData.PunishMode = 1
if requestData.ReferenceScore == "" {
response.Result(101, requestData, "请输入考核标准", c)
return
}
if requestData.Unit == "" {
response.Result(101, requestData, "请输入考核单位", c)
return
}
}
if requestData.Class == 0 {
requestData.Class = 1
}
if len(requestData.Inspect) < 1 {
requestData.Inspect = append(requestData.Inspect, "1")
}
if requestData.Cycle == 0 {
requestData.Cycle = 4
}
if requestData.CycleAttr == 0 {
requestData.CycleAttr = 1
}
var tarGerCont assessmentmodel.PostTarget
tarGerCont.GetCont(map[string]interface{}{"`id`": sunTarCont.ParentId})
var tiBaoRen string
if len(requestData.ReportAry) < 1 {
if tarGerCont.Report == "" {
response.Result(101, requestData, "请选择提报人!", c)
return
}
tiBaoRen = tarGerCont.Report
} else {
tiBaoRen = strings.Join(requestData.ReportAry, ",")
}
var minScoreInt int64
var maxScoreInt int64
scoreAry := strings.Split(requestData.ReferenceScore, "-")
scoreLen := len(scoreAry)
// fmt.Printf("ScoreAry:%v----------->%v------------>%v------------>%v\n", ReferenceScore, scoreLen, scoreAry[0], scoreAry)
if scoreLen > 0 {
if scoreLen == 1 {
maxScore, _ := strconv.ParseFloat(scoreAry[0], 64)
// zhhh := maxScore * 100
// zhuanStr := strconv.FormatFloat(zhhh, 'f', -1, 64)
maxScoreInt, _ = strconv.ParseInt(strconv.FormatFloat(maxScore*100, 'f', -1, 64), 10, 64)
minScoreInt = 0
} else {
minScore, _ := strconv.ParseFloat(scoreAry[0], 64)
maxScore, _ := strconv.ParseFloat(scoreAry[scoreLen-1], 64)
minScoreInt, _ = strconv.ParseInt(strconv.FormatFloat(minScore*100, 'f', -1, 64), 10, 64)
maxScoreInt, _ = strconv.ParseInt(strconv.FormatFloat(maxScore*100, 'f', -1, 64), 10, 64)
}
} else {
minScoreInt = 0
maxScoreInt = 0
}
var minMoney int64 //罚款或奖励最高金额
var maxMoney int64 //罚款或奖励最新金额
moneyAry := strings.Split(requestData.CashStandard, "-")
moneyAryLen := len(moneyAry)
if moneyAryLen > 0 {
if moneyAryLen == 1 {
maxMoneyEs, _ := strconv.ParseFloat(moneyAry[0], 64)
maxMoney, _ = strconv.ParseInt(strconv.FormatFloat(maxMoneyEs*100, 'f', -1, 64), 10, 64)
minMoney = 0
} else {
maxMoneyEs, _ := strconv.ParseFloat(moneyAry[moneyAryLen-1], 64)
maxMoney, _ = strconv.ParseInt(strconv.FormatFloat(maxMoneyEs*100, 'f', -1, 64), 10, 64)
minMoneyEs, _ := strconv.ParseFloat(moneyAry[0], 64)
minMoney, _ = strconv.ParseInt(strconv.FormatFloat(minMoneyEs*100, 'f', -1, 64), 10, 64)
}
} else {
minMoney = 0
maxMoney = 0
}
var saveCont assessmentmodel.PostTargetDetails
saveCont.Title = requestData.Title //指标细则"`
saveCont.Content = requestData.Explain //备注说明"`
saveCont.ParentId = sunTarCont.ParentId //归属指标栏目"`
saveCont.ParentIdSun = sunTarCont.Id //归属指标子栏目"`
saveCont.State = 1 //状态(1:启用;2:禁用;3:删除)"`
saveCont.AddTime = time.Now().Unix() //制定时间"`
saveCont.MinScore = minScoreInt //最小分*100保存"`
saveCont.MaxScore = maxScoreInt //最大分*100保存"`
saveCont.Company = requestData.Unit //单位"`
saveCont.AddReduce = requestData.Class //1:减少;2:增加;3:无属性,现场确认加或减"`
saveCont.CensorType = strings.Join(requestData.Inspect, ",") //检查方式"`
saveCont.CensorCont = requestData.Evidence //客观证据"`
saveCont.CensorRate = requestData.Cycle //检查频次"`
saveCont.Cycles = requestData.CycleAttr //1:班;2:天;3:周;4:月;5:季度;6:年"`
saveCont.CycleAttres = requestData.CycleAttr //辅助计数"`
saveCont.Paretment = sunTarCont.Depart //接受考核的部门"`
saveCont.ParetmentPost = strings.Join(requestData.PostId, ",") //接受考核的部门岗位"`
saveCont.Reportary = tiBaoRen //提报人"`
saveCont.Punishmode = requestData.PunishMode //处罚或奖励方式 1:分数;2:现金;3:分数加现金
saveCont.Minmoney = minMoney //最高罚款*100保存"`
saveCont.Maxmoney = maxMoney //最低罚款*100保存"`
saveErr := global.GVA_DB_Performanceappraisal.Create(&saveCont).Error
if saveErr != nil {
response.Result(101, saveErr, "数据写入失败!请重新写入!", c)
return
}
response.Result(0, saveErr, "数据写入成功!", c)
}
// 获取指标细则内容
func (a *ApiMethod) GetDetailsCont(c *gin.Context) {
var requestData idType
err := c.ShouldBindJSON(&requestData)
if err != nil {
response.Result(100, err, "数据格式不正确!", c)
return
}
if requestData.Id == "" {
response.Result(101, err, "您的请求数据不合法", c)
return
}
var detaCont outDetailsCont
detaErr := detaCont.GetCont(map[string]interface{}{"`id`": requestData.Id})
if detaErr != nil {
response.Result(101, detaErr, "该指标细则不存在!", c)
return
}
if detaCont.MinScore != 0 {
detaCont.ScoreStandard = fmt.Sprintf("%v-%v", commonus.DecimalEs(float64(detaCont.MinScore)/100, 2), commonus.DecimalEs(float64(detaCont.MaxScore)/100, 2))
} else {
detaCont.ScoreStandard = fmt.Sprintf("%v", commonus.DecimalEs(float64(detaCont.MaxScore)/100, 2))
}
if detaCont.Minmoney != 0 {
detaCont.CashStandard = fmt.Sprintf("%v-%v", commonus.DecimalEs(float64(detaCont.Minmoney)/100, 2), commonus.DecimalEs(float64(detaCont.Maxmoney)/100, 2))
} else {
detaCont.CashStandard = fmt.Sprintf("%v", commonus.DecimalEs(float64(detaCont.Maxmoney)/100, 2))
}
detaCont.InspMethod = strings.Split(detaCont.CensorType, ",")
//关联岗位
postAry := strings.Split(detaCont.ParetmentPost, ",")
var inAryPost []string
if len(postAry) > 0 {
for _, pv := range postAry {
if commonus.IsInTrue[string](pv, inAryPost) == false {
inAryPost = append(inAryPost, pv)
var postCont hrsystem.Position
postConErr := postCont.GetCont(map[string]interface{}{"`id`": pv}, "`name`")
if postConErr == nil {
var postContL idAndName
postContL.Id = pv
postContL.Name = postCont.Name
detaCont.PostAry = append(detaCont.PostAry, postContL)
}
}
}
}
//提报人
repalyMan := strings.Split(detaCont.Reportary, ",")
var reply []string
if len(repalyMan) > 0 {
for _, mv := range repalyMan {
if commonus.IsInTrue[string](mv, reply) == false {
reply = append(reply, mv)
var manCont hrsystem.PersonArchives
manErr := manCont.GetCont(map[string]interface{}{"`key`": mv}, "`name`", "`icon`", `number`)
if manErr == nil {
var reporContMan reportUser
reporContMan.Id = mv
reporContMan.Name = manCont.Name
reporContMan.Icon = manCont.Icon
reporContMan.Number = manCont.Number
detaCont.ReportAry = append(detaCont.ReportAry, reporContMan)
}
}
}
}
response.Result(0, detaCont, "数据获取成功!", c)
}
// 修改定性考核指标细则
func (a *ApiMethod) EditDeatilsCont(c *gin.Context) {
var requestData editPostDetails
c.ShouldBindJSON(&requestData)
if requestData.Id == "" {
response.Result(101, requestData, "您的请求数据不合法", c)
return
}
where := commonus.MapOut()
where["`id`"] = requestData.Id
var detaCont assessmentmodel.PostTargetDetails
detaErr := detaCont.GetCont(where)
if detaErr != nil {
response.Result(101, detaErr, "该指标细则不存在!", c)
return
}
saveData := commonus.MapOut()
if requestData.Title != "" && requestData.Title != detaCont.Title {
saveData["title"] = requestData.Title
}
if requestData.ReferenceScore != "" {
referStr := ""
if detaCont.MinScore != 0 {
referStr = fmt.Sprintf("%v-%v", commonus.DecimalEs(float64(detaCont.MinScore)/100, 2), commonus.DecimalEs(float64(detaCont.MaxScore)/100, 2))
} else {
referStr = fmt.Sprintf("%v", commonus.DecimalEs(float64(detaCont.MaxScore)/100, 2))
}
if requestData.ReferenceScore != referStr {
scoreAry := strings.Split(requestData.ReferenceScore, "-")
scoreLen := len(scoreAry)
if scoreLen > 0 {
if scoreLen == 1 {
maxScore, _ := strconv.ParseFloat(scoreAry[0], 64)
saveData["max_score"], _ = strconv.ParseInt(strconv.FormatFloat(maxScore*100, 'f', -1, 64), 10, 64)
saveData["min_score"] = 0
} else {
minScore, _ := strconv.ParseFloat(scoreAry[0], 64)
maxScore, _ := strconv.ParseFloat(scoreAry[scoreLen-1], 64)
saveData["min_score"], _ = strconv.ParseInt(strconv.FormatFloat(minScore*100, 'f', -1, 64), 10, 64)
saveData["max_score"], _ = strconv.ParseInt(strconv.FormatFloat(maxScore*100, 'f', -1, 64), 10, 64)
}
} else {
saveData["min_score"] = 0
saveData["max_score"] = 0
}
}
}
if requestData.Unit != "" && requestData.Unit != detaCont.Company {
saveData["company"] = requestData.Unit
}
if requestData.Class != 0 && requestData.Class != detaCont.AddReduce {
saveData["add_reduce"] = requestData.Class
}
if len(requestData.Inspect) > 0 {
insStr := strings.Join(requestData.Inspect, ",")
if insStr != detaCont.CensorType {
saveData["censor_type"] = insStr
}
}
if requestData.Cycle != 0 && requestData.Cycle != detaCont.Cycles {
saveData["cycle"] = requestData.Cycle
}
if requestData.CycleAttr != 0 && requestData.CycleAttr != detaCont.CycleAttres {
saveData["cycleattr"] = requestData.CycleAttr
}
if requestData.Evidence != "" && requestData.Evidence != detaCont.Company {
saveData["censor_cont"] = requestData.Evidence
}
if requestData.Explain != "" && requestData.Explain != detaCont.Company {
saveData["Content"] = requestData.Explain
}
if len(requestData.ReportAry) > 0 {
repInsStr := strings.Join(requestData.ReportAry, ",")
if repInsStr != detaCont.CensorType {
saveData["reportary"] = repInsStr
}
}
if requestData.PunishMode != 0 && requestData.PunishMode != detaCont.Punishmode {
saveData["punishmode"] = requestData.PunishMode
}
if requestData.CashStandard != "" {
referMoneryStr := ""
if detaCont.MinScore != 0 {
referMoneryStr = fmt.Sprintf("%v-%v", commonus.DecimalEs(float64(detaCont.MinScore)/100, 2), commonus.DecimalEs(float64(detaCont.MaxScore)/100, 2))
} else {
referMoneryStr = fmt.Sprintf("%v", commonus.DecimalEs(float64(detaCont.MaxScore)/100, 2))
}
if requestData.CashStandard != referMoneryStr {
moneyAry := strings.Split(requestData.CashStandard, "-")
moneyAryLen := len(moneyAry)
if moneyAryLen > 0 {
if moneyAryLen == 1 {
maxMoneyEs, _ := strconv.ParseFloat(moneyAry[0], 64)
saveData["maxmoney"], _ = strconv.ParseInt(strconv.FormatFloat(maxMoneyEs*100, 'f', -1, 64), 10, 64)
saveData["minmoney"] = 0
} else {
maxMoneyEs, _ := strconv.ParseFloat(moneyAry[moneyAryLen-1], 64)
saveData["maxmoney"], _ = strconv.ParseInt(strconv.FormatFloat(maxMoneyEs*100, 'f', -1, 64), 10, 64)
minMoneyEs, _ := strconv.ParseFloat(moneyAry[0], 64)
saveData["minmoney"], _ = strconv.ParseInt(strconv.FormatFloat(minMoneyEs*100, 'f', -1, 64), 10, 64)
}
} else {
saveData["maxmoney"] = 0
saveData["minmoney"] = 0
}
}
}
if len(saveData) > 0 {
saveData["time"] = time.Now().Unix()
saveErr := detaCont.EditCont(where, saveData)
if saveErr != nil {
response.Result(101, saveErr, "编辑失败!", c)
return
}
}
response.Result(0, saveData, "编辑成功!", c)
}
// 删除指标细则
func (a *ApiMethod) EidtPostTarDetailsStrte(c *gin.Context) {
var requestData editState
c.ShouldBindJSON(&requestData)
if requestData.Id == "" {
response.Result(100, requestData, "请输入指标名称!", c)
return
}
if requestData.State == 0 {
requestData.State = 1
}
if requestData.IsTrue == 0 {
requestData.IsTrue = 2
}
where := commonus.MapOut()
where["`id`"] = requestData.Id
var detaCont assessmentmodel.PostTargetDetails
detaErr := detaCont.GetCont(where)
if detaErr != nil {
response.Result(101, detaErr, "该指标细则不存在!", c)
return
}
if requestData.State != 3 {
saveData := commonus.MapOut()
saveData["state"] = requestData.State
saveData["time"] = time.Now().Unix()
saveErr := detaCont.EditCont(where, saveData)
if saveErr != nil {
response.Result(101, saveErr, "编辑失败!", c)
return
}
} else {
if requestData.IsTrue != 1 {
saveData := commonus.MapOut()
saveData["state"] = requestData.State
saveData["time"] = time.Now().Unix()
saveErr := detaCont.EditCont(where, saveData)
if saveErr != nil {
response.Result(101, saveErr, "编辑失败!", c)
return
}
} else {
saveErr := detaCont.DelCont(where)
if saveErr != nil {
response.Result(101, saveErr, "编辑失败!", c)
return
}
}
}
response.Result(0, detaCont, "编辑成功!", c)
}

70
api/v1/shiyan/shiyan.go

@ -2972,4 +2972,74 @@ func (s *ShiyanApi) DelFlowDataUser(c *gin.Context) {
//定性审核
global.GVA_DB_Performanceappraisal.Where("sf_evaluation_user = ?", requestData.Id).Delete(&assessmentmodel.ScoreFlow{})
response.Result(0, requestData, "处理完毕", c)
//判断定量考核有无后续数据
var flowKeyAll []int64
allErr := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.FlowLog{}).Select("`fl_key`").Find(&flowKeyAll).Error
if allErr == nil {
for _, v := range flowKeyAll {
var flowData assessmentmodel.FlowLogData
delErr := global.GVA_DB_Performanceappraisal.Where("fld_flow_log = ?", v).First(&flowData).Error
if delErr != nil {
global.GVA_DB_Performanceappraisal.Where("fl_key = ?", v).Delete(&assessmentmodel.FlowLog{})
}
}
}
}
// 查看定量考核是否有审批流程
func (s *ShiyanApi) DingLiangPass(c *gin.Context) {
var flowKey []int64
flErr := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.FlowLog{}).Select("`fl_key`").Find(&flowKey).Error
if flErr != nil {
response.Result(1000, flErr, "没有数据", c)
return
}
if len(flowKey) < 1 {
response.Result(10001, flErr, "没有数据", c)
return
}
var errVal []int64
for _, v := range flowKey {
var evalProCont assessmentmodel.EvaluationProcess
evalErr := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.EvaluationProcess{}).Select("`ep_id`").Where("ep_order_key = ?", v).First(&evalProCont).Error
if evalErr != nil {
if commonus.IsInTrue[int64](v, errVal) == false {
errVal = append(errVal, v)
}
}
}
if len(errVal) > 0 {
global.GVA_DB_Performanceappraisal.Where("fld_flow_log IN ?", errVal).Delete(&assessmentmodel.FlowLogData{})
global.GVA_DB_Performanceappraisal.Where("fl_key IN ?", errVal).Delete(&assessmentmodel.FlowLog{})
}
response.Result(0, errVal, "处理完成", c)
}
// 定性考核没有审批流的数据
func (s *ShiyanApi) DingXingPass(c *gin.Context) {
var flowKey []int64
flErr := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.ScoreFlow{}).Select("`sf_key`").Find(&flowKey).Error
if flErr != nil {
response.Result(1000, flErr, "没有数据", c)
return
}
if len(flowKey) < 1 {
response.Result(10001, flErr, "没有数据", c)
return
}
var errVal []int64
for _, v := range flowKey {
var evalProCont assessmentmodel.EvaluationProcess
evalErr := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.EvaluationProcess{}).Select("`ep_id`").Where("ep_order_key = ?", v).First(&evalProCont).Error
if evalErr != nil {
if commonus.IsInTrue[int64](v, errVal) == false {
errVal = append(errVal, v)
}
}
}
if len(errVal) > 0 {
global.GVA_DB_Performanceappraisal.Where("sf_key IN ?", errVal).Delete(&assessmentmodel.ScoreFlow{})
}
response.Result(0, errVal, "处理完成", c)
}

18
commonus/wechatapp.go

@ -11,7 +11,7 @@ import (
"github.com/mitchellh/mapstructure"
)
//获取企业微信token
// 获取企业微信token
func GetWechatTokenType(types string) (tokenInfo string, redisClient *redishandel.RedisStoreType, err error) {
redisClient = redishandel.RunRedis()
isTrue := false
@ -58,7 +58,7 @@ func GetWechatTokenType(types string) (tokenInfo string, redisClient *redishande
return
}
//获取企业微信token
// 获取企业微信token
func GetWechatToken() (tokenInfo string, redisClient *redishandel.RedisStoreType, err error) {
redisClient = redishandel.RunRedis()
isTrue, tokenInfo := redisClient.Get("workWeChatToken_" + global.GVA_CONFIG.RedisPrefix.Alias)
@ -166,7 +166,7 @@ func GetDepartment(dePartMentId int) (departmentlist *[]DePartMentInfo, isTrue b
return departmentlist, true
}
//获取企业微信部门列表
// 获取企业微信部门列表
func GetWechatFramework(id int64) (callBackList []byte, isTrue bool) {
isTrue = false
ton, _, err := GetWechatToken()
@ -188,7 +188,7 @@ func GetWechatFramework(id int64) (callBackList []byte, isTrue bool) {
return
}
//获取单个部门信息
// 获取单个部门信息
func GetOneDePartMent(dePartMentId int) (departmentlist *DePartMentInfo, isTrue bool) {
isTrue = false
_, redisClient, err := GetWechatToken()
@ -368,7 +368,7 @@ func DelDepartment(id int64) bool {
return isTrue
}
//获取读取成员(单个)
// 获取读取成员(单个)
func GetOneAddressBookMember(userId string) (userInfoByte []byte, msg string, isTrue bool) {
isTrue = false
if userId == "" {
@ -395,7 +395,7 @@ func GetOneAddressBookMember(userId string) (userInfoByte []byte, msg string, is
return
}
//获取部门成员详情
// 获取部门成员详情
func GetDepartmentUserList(dePartMentId int) (userInfoByte []byte, msg string, isTrue bool) {
isTrue = false
if dePartMentId == 0 {
@ -504,7 +504,7 @@ func GetRunHealthReportJobids(page int, pageSize int64) (dateAry []string, isTru
return
}
//获取指定的健康上报任务详情
// 获取指定的健康上报任务详情
func GetReportJobInfo(jobid, date string) (ca *CallBackReportJobInfo, isTrue bool, kk, msg string) {
isTrue = false
@ -535,7 +535,7 @@ func GetReportJobInfo(jobid, date string) (ca *CallBackReportJobInfo, isTrue boo
kk = string(addDePartMent)
var sendCallBackDate CallBackReportJobInfo
err = json.Unmarshal(addDePartMent, &sendCallBackDate)
// fmt.Printf("json23 ===>%v------>%v\n", sendCallBackDate, string(addDePartMent))
fmt.Printf("json23 ===>%v===>%v===>%v------>%v\n", getWechatApiUrl, string(sendJsonData), sendCallBackDate, string(addDePartMent))
if sendCallBackDate.Errcode == 0 {
isTrue = true
}
@ -544,7 +544,7 @@ func GetReportJobInfo(jobid, date string) (ca *CallBackReportJobInfo, isTrue boo
return
}
//获取用户填写答案
// 获取用户填写答案
func GetUserWriteAnswer(jobid, date string, page int, pageSize int64) (btyDate []byte, r *ReportAnswerResult, isTrue bool, msg string) {
isTrue = false
if jobid == "" {

51
model/assessmentmodel/dutyclass.go

@ -6,7 +6,7 @@ import (
"github.com/flipped-aurora/gin-vue-admin/server/global"
)
//考核维度
// 考核维度
type DutyClass struct {
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id"`
Title string `json:"title" gorm:"column:title;type:varchar(255);comment:考核维度名称"`
@ -21,7 +21,7 @@ func (DutyClass *DutyClass) TableName() string {
return "dutyclass"
}
//获取详细内容
// 获取详细内容
func (cont *DutyClass) GetCont(whereMap interface{}, field ...string) (err error) {
gormDb := global.GVA_DB_Performanceappraisal.Model(&cont)
if len(field) > 0 {
@ -33,7 +33,7 @@ func (cont *DutyClass) GetCont(whereMap interface{}, field ...string) (err error
return
}
//履职考核表
// 履职考核表
type DepartDuty struct {
Id int64 `json:"id" gorm:"primaryKey;column:de_id;type:bigint(20) unsigned;not null;comment:Id"`
Title string `json:"title" gorm:"column:de_title;type:varchar(255);comment:考核名称"`
@ -51,7 +51,7 @@ func (DepartDuty *DepartDuty) TableName() string {
return "departduty"
}
//考核细则
// 考核细则
type DutyContent struct {
Id int64 `json:"id" gorm:"primaryKey;column:dc_id;type:bigint(20) unsigned;not null;comment:Id"`
Title string `json:"title" gorm:"column:dc_title;type:text;comment:具体职责"`
@ -72,7 +72,7 @@ func (DutyContent *DutyContent) TableName() string {
return "dutycontent"
}
//考核项目
// 考核项目
type AssessMentitems struct {
Id int64 `json:"id" gorm:"primaryKey;column:ai_id;type:bigint(20) unsigned;not null;comment:Id"`
Title string `json:"title" gorm:"column:ai_title;type:varchar(255);comment:考核类别"`
@ -92,7 +92,7 @@ func (AssessMentitems *AssessMentitems) TableName() string {
return "assessmentitems"
}
//考核项目与类别
// 考核项目与类别
type AssessClass struct {
AssessMentitems
ClassTitle string `json:"classTitle" gorm:"column:title;type:varchar(255);comment:职责类别名称"`
@ -102,7 +102,7 @@ type AssessClass struct {
ClassState int `json:"classState" gorm:"column:state;type:tinyint(1) unsigned;default:1;not null;comment:状态"`
}
//评分记录
// 评分记录
type Departscore struct {
Id int64 `json:"id" gorm:"primaryKey;column:s_id;type:bigint(20) unsigned;not null;comment:Id"`
ClassId int64 `json:"classID" gorm:"column:s_class;type:bigint(20) unsigned;default:0;not null;comment:考核分类"`
@ -126,7 +126,7 @@ func (Departscore *Departscore) TableName() string {
return "departscore"
}
//评分记录附表
// 评分记录附表
type Departscores struct {
Id int64 `json:"id" gorm:"primaryKey;column:s_id;type:bigint(20) unsigned;not null;comment:Id"`
ClassId int64 `json:"classID" gorm:"column:s_class;type:bigint(20) unsigned;default:0;not null;comment:考核分类"`
@ -149,7 +149,7 @@ func (Departscores *Departscores) TableName() string {
return "departscores"
}
//考核记录
// 考核记录
type AssessmentLog struct {
Id int64 `json:"id" gorm:"primaryKey;column:al_id;type:bigint(20) unsigned;not null;comment:Id"`
Title string `json:"title" gorm:"column:al_title;type:varchar(255);comment:考核标题"`
@ -186,7 +186,7 @@ func (AssessmentLog *AssessmentLogIng) TableName() string {
return "assessment_loging"
}
//考核方案
// 考核方案
type EvaluationScheme struct {
Id int64 `json:"id" gorm:"primaryKey;column:es_id;type:bigint(20) unsigned;not null;comment:Id"`
Title string `json:"title" gorm:"column:es_title;type:varchar(255);comment:方案名称"`
@ -206,7 +206,7 @@ func (EvaluationScheme *EvaluationScheme) TableName() string {
return "evaluationscheme"
}
//测评指标
// 测评指标
type EvaluationTarget struct {
Id int64 `json:"id" gorm:"primaryKey;column:et_id;type:bigint(20) unsigned;not null;comment:Id;index"`
Title string `json:"title" gorm:"column:et_title;type:varchar(255);comment:指标名称"`
@ -240,7 +240,7 @@ func (e *EvaluationTarget) GetCont(whereAry interface{}, filed ...string) error
return err
}
//定性测评指标子栏目
// 定性测评指标子栏目
type QualitativeTarget struct {
Id int64 `json:"id" gorm:"primaryKey;column:q_id;type:bigint(20) unsigned;not null;comment:Id;index"`
Title string `json:"title" gorm:"column:q_title;type:varchar(255);comment:指标子栏目名称"`
@ -254,7 +254,7 @@ func (QualitativeTarget *QualitativeTarget) TableName() string {
return "qualitative_target"
}
//指标细则
// 指标细则
type DetailedTarget struct {
Id int64 `json:"id" gorm:"primaryKey;column:dt_id;type:bigint(20) unsigned;not null;comment:Id;index"`
Title string `json:"title" gorm:"column:dt_title;type:text;comment:指标细则"`
@ -279,7 +279,7 @@ func (DetailedTarget *DetailedTarget) TableName() string {
return "detailed_target"
}
//性质考核方案
// 性质考核方案
type QualitativeEvaluationScheme struct {
Id int64 `json:"id" gorm:"primaryKey;column:qes_id;type:bigint(20) unsigned;not null;comment:Id;index"`
Title string `json:"title" gorm:"column:qes_title;type:text;comment:方案名称"`
@ -294,7 +294,7 @@ func (QualitativeEvaluationScheme *QualitativeEvaluationScheme) TableName() stri
return "qualitative_evaluation_scheme"
}
//性质考核方案明细
// 性质考核方案明细
type QualitativeEvaluation struct {
Id int64 `json:"id" gorm:"primaryKey;column:qe_id;type:bigint(20) unsigned;not null;comment:Id;index"`
Title string `json:"title" gorm:"column:qe_title;type:text;comment:考核名称"`
@ -385,7 +385,7 @@ func (q *QualitativeEvaluationView) GetCont(whereMap interface{}, field ...strin
return
}
//性质考核方案
// 性质考核方案
type DepartmentDimension struct {
Id int64 `json:"id" gorm:"primaryKey;column:dd_id;type:bigint(20) unsigned;not null;comment:Id;index"`
Key int64 `json:"key" gorm:"column:dd_type;type:bigint(20) unsigned;default:0;not null;comment:1:定性考核;2:定量考核"`
@ -400,7 +400,7 @@ func (DepartmentDimension *DepartmentDimension) TableName() string {
return "department_dimension"
}
//性质考核方案
// 性质考核方案
type DepartmentDimensionWeight struct {
Id int64 `json:"id" gorm:"primaryKey;column:ddw_id;type:bigint(20) unsigned;not null;comment:Id;index"`
Type int64 `json:"type" gorm:"column:ddw_type;type:bigint(20) unsigned;default:0;not null;comment:1:定性考核;2:定量考核"`
@ -417,7 +417,7 @@ func (DepartmentDimensionWeight *DepartmentDimensionWeight) TableName() string {
return "department_dimension_weight"
}
//定量考核数据表
// 定量考核数据表
type FlowLog struct {
Id int64 `json:"id" gorm:"primaryKey;column:fl_id;type:bigint(20) unsigned;not null;comment:Id;index"`
EvaluationPlan string `json:"evaluationplan" gorm:"column:fl_evaluation_id;type:mediumtext unsigned;default:0;not null;comment:考核方案项目ID"`
@ -446,7 +446,7 @@ func (FlowLog *FlowLog) TableName() string {
return "flow_log"
}
//定量考核数据流
// 定量考核数据流
type FlowLogData 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"`
@ -470,7 +470,7 @@ func (FlowLogData *FlowLogData) TableName() string {
return "flow_log_data"
}
//定量考核目标设定
// 定量考核目标设定
type QuantitativeConfig struct {
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"`
DepartmentId int64 `json:"departmentid" gorm:"column:departmentid;type:bigint(20) unsigned;default:0;not null;comment:部门ID"`
@ -516,7 +516,7 @@ func (QuantitativeConfigView *QuantitativeConfigView) TableName() string {
return "quantitative_config_view"
}
//定性考核指标关系指定
// 定性考核指标关系指定
type Assesstarget struct {
Id int64 `json:"id" gorm:"primaryKey;column:at_id;type:bigint(20) unsigned;not null;comment:Id;index"`
Group int64 `json:"group" gorm:"column:group;type:bigint(20) unsigned;default:0;not null;comment:集团ID"`
@ -533,7 +533,7 @@ func (Assesstarget *Assesstarget) TableName() string {
return "assesstarget"
}
//考核方案版本管理
// 考核方案版本管理
type PlanVersio struct {
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"`
Group int64 `json:"group" gorm:"column:group;type:bigint(20) unsigned;default:0;not null;comment:集团ID"`
@ -551,7 +551,7 @@ func (PlanVersio *PlanVersio) TableName() string {
return "plan_versio"
}
//考核方案版本管理
// 考核方案版本管理
type PositionPlanVersio struct {
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"`
Group int64 `json:"group" gorm:"column:group;type:bigint(20) unsigned;default:0;not null;comment:归属集团"`
@ -570,7 +570,7 @@ func (PositionPlanVersio *PositionPlanVersio) TableName() string {
return "position_plan_version"
}
//审批流程视图
// 审批流程视图
type EvalProcess struct {
EvaluationProcess
ClassTitle string `json:"class_title" gorm:"column:class_title;type:varchar(255);comment:指标名称"`
@ -584,7 +584,7 @@ func (EvalProcess *EvalProcess) TableName() string {
return "evalprocess"
}
//定量柳树视图
// 定量柳树视图
type FlowDataLogType struct {
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"`
Key int64 `json:"key" gorm:"column:key;type:bigint(20) unsigned;default:0;not null;comment:识别标志"`
@ -602,6 +602,7 @@ type FlowDataLogType struct {
ToDay int64 `json:"today" gorm:"column:today;type:int(5) unsigned;default:0;not null;comment:天"`
TargetId int64 `json:"targetid" gorm:"column:targetid;type:bigint(20) unsigned;default:0;not null;comment:指标ID"`
Edition string `json:"edition" gorm:"column:edition;type:longtext;comment:版本号 "`
Content string `json:"content" gorm:"column:content;type:longtext;comment:评测内容 "`
}
func (FlowDataLogType *FlowDataLogType) TableName() string {

14
model/assessmentmodel/post_target_details.go

@ -6,14 +6,14 @@ import (
"github.com/flipped-aurora/gin-vue-admin/server/global"
)
//指标细则
// 指标细则
type PostTargetDetails struct {
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"`
Title string `json:"title" gorm:"column:title;type:text;comment:指标细则"`
Content string `json:"content" gorm:"column:content;type:text;comment:指标说明"`
ParentId int64 `json:"parentid" gorm:"column:parentid;type:bigint(20) unsigned;default:0;not null;comment:归属指标栏目"`
ParentIdSun int64 `json:"parentidsun" gorm:"column:parentid_sun;type:bigint(20) unsigned;default:0;not null;comment:归属指标子栏目"`
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:tinyint(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"`
AddTime int64 `json:"addtime" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:制定时间"`
MinScore int64 `json:"minscore" gorm:"column:min_score;type:bigint(20) unsigned;default:0;not null;comment:最小分*100保存"`
MaxScore int64 `json:"maxscore" gorm:"column:max_score;type:bigint(20) unsigned;default:0;not null;comment:最大分*100保存"`
@ -26,20 +26,24 @@ type PostTargetDetails struct {
CycleAttres int `json:"cycleattr" gorm:"column:cycleattr;type:int(9) unsigned;default:1;not null;comment:辅助计数"`
Paretment int64 `json:"paretment" gorm:"column:paretment;type:bigint(20);comment:接受考核的部门"`
ParetmentPost string `json:"paretmentpost" gorm:"column:paretment_post;type:longtext;comment:接受考核的部门岗位"`
Reportary string `json:"reportary" gorm:"column:reportary;type:longtext;comment:提报人"`
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 (PostTargetDetails *PostTargetDetails) TableName() string {
return "post_target_details"
}
//编辑职务分类内容
// 编辑职务分类内容
func (cont *PostTargetDetails) EditCont(whereMap map[string]interface{}, saveData map[string]interface{}) (err error) {
err = global.GVA_DB_Performanceappraisal.Model(&cont).Where(whereMap).Updates(saveData).Error
return
}
//获取详细内容
// 获取详细内容
func (cont *PostTargetDetails) GetCont(whereMap interface{}, field ...string) (err error) {
gormDb := global.GVA_DB_Performanceappraisal.Model(&cont)
if len(field) > 0 {
@ -51,7 +55,7 @@ func (cont *PostTargetDetails) GetCont(whereMap interface{}, field ...string) (e
return
}
//删除内容
// 删除内容
func (cont *PostTargetDetails) DelCont(whereMap interface{}) (err error) {
err = global.GVA_DB_Performanceappraisal.Where(whereMap).Delete(&cont).Error
return

7
router/index/statisticsroute/programme.go

@ -5,7 +5,7 @@ import (
"github.com/gin-gonic/gin"
)
//统计
// 统计
func (s *StatisticsRoute) InitRouter(Router *gin.RouterGroup) {
shiyanCodeRouter := Router.Group("ststic")
var authorityApi = v2.ApiGroupApp.StatisticsApi
@ -19,6 +19,9 @@ func (s *StatisticsRoute) InitRouter(Router *gin.RouterGroup) {
shiyanCodeRouter.POST("departperappdatastatistics", authorityApi.DepartPerAppDataStatistics) //绩效考核数据统计
shiyanCodeRouter.POST("getplanversionvalid", authorityApi.GetPlanVersionValid) //绩效考核数据统计(改版)
shiyanCodeRouter.POST("departmenttranscript", authorityApi.DepartmentTranscript) //成绩表查询
// shiyanCodeRouter.POST("departmenttranscript", authorityApi.DepartmentTranscript) //成绩表查询
// shiyanCodeRouter.POST("queryresults", authorityApi.Queryresults) //成绩表查询(新)
shiyanCodeRouter.POST("departmenttranscript", authorityApi.Queryresults) //成绩表查询
shiyanCodeRouter.POST("queryresults", authorityApi.DepartmentTranscript) //成绩表查询(新)
}
}

24
router/postrouter/post_target.go

@ -5,10 +5,10 @@ import (
"github.com/gin-gonic/gin"
)
//岗位指标
// 岗位指标
type PostTargetKpiRouter struct{}
//路由绑定
// 路由绑定
func (p *PostTargetKpiRouter) InitRouter(Router *gin.RouterGroup) {
routerApi := Router.Group("postkpi")
var apiRouter = v1.ApiGroupApp.PositionKpiApi.ApiMethod
@ -22,8 +22,22 @@ func (p *PostTargetKpiRouter) InitRouter(Router *gin.RouterGroup) {
/*
岗位定性指标
*/
routerApi.POST("targetorglist", apiRouter.TargetOrgList) //获取指标关联的岗位
routerApi.POST("addposttargetcont", apiRouter.AddPostTargetCont) //添加岗位细则
routerApi.POST("posttargetsunlist", apiRouter.PostTargetSunList) //岗位定性考核列表
routerApi.POST("targetorglist", apiRouter.TargetOrgList) //获取指标关联的岗位
routerApi.POST("addposttargetcont", apiRouter.AddPostTargetCont) //添加岗位细则
routerApi.POST("posttargetsunlist", apiRouter.PostTargetSunList) //岗位定性考核列表
routerApi.POST("editposttargetaual", apiRouter.EditPostTargetQual) //修改定性指标关联岗位
/*
岗位定性指标子栏目
*/
routerApi.POST("getsuntargetinfo", apiRouter.GetSunTargetInfo) //获取子栏目内容
routerApi.POST("eidtsuntargetpost", apiRouter.EidtSunTargetPost) //编辑定性考核子栏目
routerApi.POST("delsuntarget", apiRouter.DelSunTarget) //删除定性考核指标子栏目
/*
定性指标细则
*/
routerApi.POST("addpostdetacont", apiRouter.AddPostDetaCont) //添加单条定性指标细则
routerApi.POST("getdetailscont", apiRouter.GetDetailsCont) //获取指标细则内容
routerApi.POST("editdeatilscont", apiRouter.EditDeatilsCont) //修改定性考核指标细则
routerApi.POST("eidtposttardetailsstrte", apiRouter.EidtPostTarDetailsStrte) //删除定性考核指标细则
}
}

2
router/shiyan/sys_shiyan.go

@ -55,5 +55,7 @@ func (s *ShiyanRouter) InitShiyanRouter(Router *gin.RouterGroup) {
shiyanCodeRouter.POST("correctingorg", authorityApi.CorrectingOrg) //校正行政组织
shiyanCodeRouter.POST("delflowdatauser", authorityApi.DelFlowDataUser) //删除人员提交数据
shiyanCodeRouter.POST("dingliangpass", authorityApi.DingLiangPass) //处理定量没有审批流的数据
shiyanCodeRouter.POST("dingxingpass", authorityApi.DingXingPass) //定性考核没有审批流的数据
}
}

Loading…
Cancel
Save