You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.3 KiB
49 lines
1.3 KiB
|
3 years ago
|
package commonus
|
||
|
|
|
||
|
|
import (
|
||
|
|
"fmt"
|
||
|
|
"math/rand"
|
||
|
|
"strconv"
|
||
|
|
"time"
|
||
|
|
|
||
|
|
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||
|
|
"github.com/flipped-aurora/gin-vue-admin/server/model/assessmentmodel"
|
||
|
|
"github.com/shopspring/decimal"
|
||
|
|
)
|
||
|
|
|
||
|
|
//float精度运算
|
||
|
|
func FloatAccuracyOperation(floatVal float64) (res float64) {
|
||
|
|
num, _ := strconv.ParseFloat(fmt.Sprintf("%.8f", floatVal), 64)
|
||
|
|
fmt.Println(num)
|
||
|
|
|
||
|
|
decimalValue := decimal.NewFromFloat(num)
|
||
|
|
decimalValue = decimalValue.Mul(decimal.NewFromInt(100))
|
||
|
|
|
||
|
|
res, _ = decimalValue.Float64()
|
||
|
|
return
|
||
|
|
}
|
||
|
|
|
||
|
|
//获取编号
|
||
|
|
func GetFileNumber() (num int64) {
|
||
|
|
randVal := rand.Intn(1000)
|
||
|
|
timeVal := time.Now().Unix()
|
||
|
|
num, _ = strconv.ParseInt(strconv.FormatInt(timeVal, 10)+strconv.Itoa(randVal), 10, 64)
|
||
|
|
return
|
||
|
|
}
|
||
|
|
|
||
|
|
//获取 定量考核目标设定
|
||
|
|
/*
|
||
|
|
@group 集团
|
||
|
|
@depart 部门
|
||
|
|
@dimen 维度
|
||
|
|
@target 指标
|
||
|
|
@year 年份
|
||
|
|
@timecopy 参考值
|
||
|
|
*/
|
||
|
|
func GetDingLiangMuBiao(group, depart, dimen, target, year, timecopy int64) (qualConfig assessmentmodel.QuantitativeConfig, err error) {
|
||
|
|
gormDb := global.GVA_DB_Performanceappraisal.Where("`group` = ? AND `departmentid` = ? AND `dimension` = ? AND `target` = ? AND `year` = ?", group, depart, dimen, target, year)
|
||
|
|
gormDb = gormDb.Where("timecopy = ?", timecopy)
|
||
|
|
err = gormDb.First(&qualConfig).Error
|
||
|
|
return
|
||
|
|
}
|