Browse Source

dashborad 实时刷新

master
娄文智 2 years ago
parent
commit
ee9640fad0
1 changed files with 7 additions and 13 deletions
  1. +7
    -13
      services/pln/implments/CustOrder.Dashborad.impl.go

+ 7
- 13
services/pln/implments/CustOrder.Dashborad.impl.go View File

@ -1570,16 +1570,11 @@ func (impl *CustOrderServiceImplement) SelectPic3(user *global.User, DayModelHou
hourData, exist := displayHourProductMap[key] hourData, exist := displayHourProductMap[key]
if !exist { if !exist {
//判断是否是当前时间 //判断是否是当前时间
if headInfo != nil && headInfo.CurrentTempo != 0 {
if key != recordKey {
DashboardData3.CompleteNumber += 3600 / headInfo.CurrentTempo
} else {
nowCurrentTime, _ := time.ParseInLocation("2006-01-02 15:04", key, utils.TimezoneLocation)
lenTime := time.Now().Sub(nowCurrentTime).Minutes()
perTime := float64(lenTime / 60)
DashboardData3.CompleteNumber += utils.ValueToInt(float64(3600/headInfo.CurrentTempo)*perTime, 0)
}
if headInfo != nil && headInfo.CurrentTempo != 0 && key != recordKey {
DashboardData3.CompleteNumber += 3600 / headInfo.CurrentTempo
} }
glog.InfoExtln("目标达成率", "key", key)
glog.InfoExtln("目标达成率", "CompleteNumber", 3600/headInfo.CurrentTempo)
continue continue
} }
var hourPercent float64 var hourPercent float64
@ -1611,8 +1606,8 @@ func (impl *CustOrderServiceImplement) SelectPic3(user *global.User, DayModelHou
glog.InfoExtln("计算时间", "nowTime", nowTime) glog.InfoExtln("计算时间", "nowTime", nowTime)
lenSeconds := nowTime.Sub(currentTime).Seconds() lenSeconds := nowTime.Sub(currentTime).Seconds()
glog.InfoExtln("计算时间", "lenSeconds", lenSeconds) glog.InfoExtln("计算时间", "lenSeconds", lenSeconds)
nowKey := utils.TimeFormat(currentTime, "yyyy-MM-dd HH:00")
if headInfo != nil && headInfo.CurrentTempo > 0 && key == recordKey{
nowKey := utils.TimeFormat(currentTime, "yyyy-MM-dd HH:mm")
if headInfo != nil && headInfo.CurrentTempo > 0 && key == recordKey {
if nowKey > recordKey { if nowKey > recordKey {
hourPercent += lenSeconds / float64(headInfo.CurrentTempo) hourPercent += lenSeconds / float64(headInfo.CurrentTempo)
} }
@ -1632,10 +1627,9 @@ func (impl *CustOrderServiceImplement) SelectPic3(user *global.User, DayModelHou
jPHPercent = jPHPercent * (float64(hourAllUsedTime) / 3600) jPHPercent = jPHPercent * (float64(hourAllUsedTime) / 3600)
} }
glog.InfoExtln("目标达成率", "key", key) glog.InfoExtln("目标达成率", "key", key)
glog.InfoExtln("目标达成率", "jphVal", jphVal)
glog.InfoExtln("目标达成率", "jphVal", jphVal)
glog.InfoExtln("目标达成率", "hourPercent", hourPercent) glog.InfoExtln("目标达成率", "hourPercent", hourPercent)
glog.InfoExtln("目标达成率", "jPHPercent", jPHPercent) glog.InfoExtln("目标达成率", "jPHPercent", jPHPercent)
glog.InfoExtln("目标达成率", "CompleteNumber", utils.ValueToInt(utils.ValueToFloat(hourPercent, 0.0)*jPHPercent, 0))
jphMap[key] = jphVal jphMap[key] = jphVal
DashboardData3.CompleteNumber += utils.ValueToInt(utils.ValueToFloat(hourPercent, 0.0)*jPHPercent, 0) DashboardData3.CompleteNumber += utils.ValueToInt(utils.ValueToFloat(hourPercent, 0.0)*jPHPercent, 0)


Loading…
Cancel
Save