| | |
| | | "basic.com/valib/logger.git" |
| | | "ruleModelEngine/cache" |
| | | "ruleModelEngine/db" |
| | | "time" |
| | | ) |
| | | |
| | | func UnderageClimbingToRooftop(taskPerson db.TaskPerson) bool { |
| | | if taskPerson.Floor == "" { |
| | | return false |
| | | } |
| | | age, err := db.GetAgeById(taskPerson.DocumentNumber) |
| | | if err != nil { |
| | | logger.Error("GetAgeById: ", err) |
| | |
| | | } |
| | | return false |
| | | } |
| | | func ClimbingFloorsIllegally(taskPerson db.TaskPerson) bool { |
| | | |
| | | return true |
| | | func ClimbingFloorsIllegally(taskPerson db.TaskPerson, hours int, times int) bool { |
| | | layout := "2006-01-02 15:04:05" |
| | | picDate, err := time.Parse(layout, taskPerson.PicDate) |
| | | startTime := picDate.Add(time.Duration(-hours) * time.Hour).Format(layout) |
| | | floors, err := db.QueryCheckDataByDocumentNumber(taskPerson.DocumentNumber, startTime, taskPerson.PicDate) |
| | | if err != nil { |
| | | logger.Error("QueryCheckDataByDocumentNumber: ", err) |
| | | return false |
| | | } |
| | | if floors >= times { |
| | | return true |
| | | } |
| | | return false |
| | | } |
| | | func EnteringButNotLeaving(taskPerson db.TaskPerson) bool { |
| | | |
| | | return true |
| | | func EnteringButNotLeaving(docNumber string, communityId string, cameraIds []string, days int) bool { |
| | | total, err := db.QueryTimesByDocNumberDays(docNumber, communityId, cameraIds, days-1) |
| | | if err != nil { |
| | | logger.Error("QueryTimesByDocNumberDays err: ", err) |
| | | } |
| | | if total == 0 { |
| | | return true |
| | | } |
| | | |
| | | return false |
| | | } |
| | | |
| | | func registeredAddressNotMatchActualResidence(taskPerson db.TaskPerson) bool { |
| | | return true |
| | | idCard := db.GetIdCardById(taskPerson.DocumentNumber) |
| | | if idCard == "" { |
| | | return false |
| | | } |
| | | |
| | | if _, ok := cache.PublicHouse[taskPerson.CommunityId]; !ok { |
| | | return false |
| | | } |
| | | |
| | | // 有身份证号, 小区属于公租房, 公租房登记身份证号没有该条记录, 返回true |
| | | personStatus := db.GetDBPersonStatus(taskPerson.DocumentNumber, taskPerson.CommunityId) |
| | | logger.Debugf("Actual residence get person id:%s status: %s", taskPerson.DocumentNumber, personStatus) |
| | | if personStatus == "resident" || personStatus == "permanent_resident" { |
| | | if _, ok := cache.PublicHouse[taskPerson.CommunityId][idCard]; !ok { |
| | | // 控制程序运行期间只输出一次报警 |
| | | if _, ok := cache.PublicHouseAlarmCache[idCard]; ok { |
| | | return false |
| | | } else { |
| | | cache.PublicHouseAlarmCache[idCard] = struct{}{} |
| | | return true |
| | | } |
| | | } |
| | | } |
| | | |
| | | return false |
| | | } |