From 3737ab3dd0cc753be986638316c96cb3114601e4 Mon Sep 17 00:00:00 2001 From: zhangzengfei <zhangzengfei@smartai.com> Date: 星期日, 29 九月 2024 16:20:46 +0800 Subject: [PATCH] fix db column --- data/prepare.go | 27 ++++++++++++++++----------- 1 files changed, 16 insertions(+), 11 deletions(-) diff --git a/data/prepare.go b/data/prepare.go index 600949c..86d24cc 100644 --- a/data/prepare.go +++ b/data/prepare.go @@ -3,6 +3,7 @@ import ( "fmt" "regexp" + "ruleModelEngine/config" "ruleModelEngine/db" "strings" "time" @@ -120,10 +121,11 @@ //濡傛灉鏄紝 鎻愬墠璁剧疆濂藉鐢ㄥ湴鍧� floor1Address = detail.CaptureAddress floor1Address = detail.CaptureAddress } - if matchFlagNoF && floor1Address != "" { + if matchFlagNoF && floor1Address == "" { //濡傛灉鏄紝 鎻愬墠璁剧疆濂藉鐢ㄥ湴鍧� floor1Address = detail.CaptureAddress floor1Address = detail.CaptureAddress } + //fmt.Println("now floor1Address:", floor1Address,"\tnow detail CaptureAddress",detail.CaptureAddress) //鍒ゆ柇鏃ユ湡鏍囨槸鍚︽弧瓒虫潯浠� 鍒ゆ柇鏃ユ湡鏍囨槸鍚︿负绌猴紝鑻ヤ负绌鸿〃绀烘槸绗竴涓厓绱狅紝鍒濆鍖栨棩鏈熼澏鏍� if pointDate == "" { //鍒濆鍖栨棩鏈熼澏鏍囦负褰撳墠鏃ユ湡 @@ -132,7 +134,7 @@ pointAddress[detail.CaptureAddress]++ //鑻ヤ负鏈�鍚庝竴鏉″垯璁$畻鍗曟棩甯哥敤鍦板潃 if index == len(captureDetail)-1 { - fmt.Println("澶勭悊鍓峱ointAddress琛細", pointAddress) + //fmt.Println("澶勭悊鍓峱ointAddress琛細", pointAddress) //杩欎唬琛ㄤ粎鏈変竴鏉℃暟鎹紝灏嗕細鐩存帴鎶婂綋鍓嶅湴鍧�鍔犲叆dateAddress 鏃ユ湡姹囨�诲崟鏃ュ父鐢ㄥ湴鍧�琛ㄥ唴 涓嬫柟continue浼氱洿鎺ョ粨鏉熷惊鐜� //鍚﹀垯浼氬垵濮嬪寲pointDate鍜宲ointAddress dateAddress[pointDate] = detail.CaptureAddress @@ -145,7 +147,7 @@ pointAddress[detail.CaptureAddress]++ //鑻ヤ负鏈�鍚庝竴鏉″垯璁$畻鍗曟棩甯哥敤鍦板潃 if index == len(captureDetail)-1 { - fmt.Println("澶勭悊鍓峱ointAddress琛細", pointAddress) + //fmt.Println("澶勭悊鍓峱ointAddress琛細", pointAddress) //璁$畻鍗曟棩甯哥敤鍦板潃 鑻ュ湴鍧�鍐呴兘涓�1F鎴栬�呯┖鍦板潃锛屼細杩斿洖绌哄湴鍧� dateAddress[pointDate] = getfrAddress(pointAddress) continue @@ -157,7 +159,7 @@ //鎶婂綋鍓嶆渶鍚庝竴鏉″姞鍏� pointAddress闈舵爣鍦板潃 pointAddress[detail.CaptureAddress]++ // - fmt.Println("澶勭悊鍓峱ointAddress琛細", pointAddress) + //fmt.Println("澶勭悊鍓峱ointAddress琛細", pointAddress) //璁$畻鍗曟棩甯哥敤鍦板潃 鑻ュ湴鍧�鍐呴兘涓�1F鎴栬�呯┖鍦板潃锛屼細杩斿洖绌哄湴鍧� dateAddress[pointDate] = getfrAddress(pointAddress) continue @@ -169,11 +171,11 @@ pointAddress = make(map[string]int, 0) } } - fmt.Println("鎶撴媿鍦板潃寰呭鐞嗙粨鏋勮〃锛�", dateAddress) - fmt.Println("dareAddress len: ", len(dateAddress)) - //鍒ゆ柇鎶撴媿鐨勯潪1妤奸潪绌虹殑澶╂暟鍗犳瘮鎬诲ぉ鏁� - if float64(len(dateAddress))/float64(len(captureDays))*100 >= 50 { - fmt.Println("闈�1妤奸潪绌烘姄鎷嶅崰姣�: ", float64(len(dateAddress))/float64(len(captureDays))*100) + //fmt.Println("鎶撴媿鍦板潃寰呭鐞嗙粨鏋勮〃锛�", dateAddress) + //fmt.Println("dareAddress len: ", len(dateAddress)) + //鍒ゆ柇鎶撴媿鐨勯潪1妤奸潪绌洪潪鍦颁笅鐨勫ぉ鏁板崰姣旀�诲ぉ鏁� + if float64(len(dateAddress))/float64(len(captureDays))*100 >= float64(config.Api.CapAddrDaysThreshold) { + //fmt.Println("闈�1妤奸潪绌烘姄鎷嶅崰姣�: ", float64(len(dateAddress))/float64(len(captureDays))*100) //鍒濆鍖栧湴鍧�鍒楄〃锛屾寜鍦板潃璁℃暟 addressCount := make(map[string]int) //閬嶅巻涔嬪墠姹囨�荤殑鍗曟棩甯哥敤鍦板潃鍒楄〃 @@ -193,12 +195,12 @@ } //fmt.Println("in address: ", inAddressCounts) //fmt.Println("out address: ", outAddressCounts) - fmt.Println("final address: ", frequentAddress) + //fmt.Println("final address: ", frequentAddress) return frequentAddress } // processData 鍑芥暟澶勭悊鏁版嵁锛屾牴鎹姹傝繃婊ゆ帀鏁版嵁骞舵牴鎹鍒欐洿鏂扮姸鎬� -func ProcessData(captureInfos []db.CaptureInfo, personStatus []*db.PersonStatus, ruleInfos []db.PersonnelStatusRule, communityID string) []db.PersonStatus { +func ProcessData(captureInfos []db.CaptureInfo, personStatus []*db.PersonStatus, ruleInfos []db.PersonnelStatusRule, statusNo map[string]int, communityID string) []db.PersonStatus { filteredInfos := make([]db.PersonStatus, 0) // 鏋勫缓蹇�熸煡鎵剧储寮曪紝鏂逛究鏌ユ壘瀵瑰簲鐨勪汉鍛樼姸鎬佸拰瑙勫垯 @@ -228,6 +230,9 @@ //} // 鏇存柊杩囨护鍚庣殑淇℃伅鍒楄〃 //fmt.Println("LastAppearanceTime: ", person.LastAppearanceTime) + if statusNo[person.Status] > statusNo[info.Status] { + continue + } filteredInfos = append(filteredInfos, db.PersonStatus{CommunityID: communityID, DocumentNumber: info.DocumentNumber, Status: info.Status, FrequentAddress: info.FrequentAddress, LastAppearanceStatusTime: person.LastAppearanceTime}) } -- Gitblit v1.8.0