| | |
| | | return nil |
| | | } |
| | | for _,s := range spaceList { |
| | | isMine := false |
| | | if _,exist := myPlateNosMap[s.PlateNos]; exist { |
| | | isMine = true |
| | | } |
| | | |
| | | pi := models.PosInfo { |
| | | SpaceNo: s.SpaceNo, |
| | | PosNo: "", |
| | | State: s.State, |
| | | IsMine: isMine, |
| | | } |
| | | if s.PlateNo != "" { |
| | | pi.PlateNo = s.PlateNo |
| | | } else if s.PlateNos != "" { |
| | | pi.PlateNo = s.PlateNos |
| | | } |
| | | isMine := false |
| | | if _,exist := myPlateNosMap[pi.PlateNo]; exist { |
| | | isMine = true |
| | | } |
| | | pi.IsMine = isMine |
| | | if v,ok := models.SpaceNo2Pos[s.SpaceNo];ok { |
| | | pi.PosNo = v |
| | | } |
| | |
| | | return list |
| | | } |
| | | |
| | | func SyncHikPerson() int { |
| | | syncCount := 0 |
| | | sv := NewCarService() |
| | | hikPersons := sv.GetHikPersonList() |
| | | if hikPersons != nil && len(hikPersons) >0 { |
| | | var u models.User |
| | | idMap := u.GetAllMap() |
| | | hikPM := make(map[string]string) |
| | | for _,hp := range hikPersons { |
| | | hikPM[hp.PersonId] = hp.PhoneNo |
| | | if sp,ok := idMap[hp.PersonId];ok { |
| | | if sp.PhoneNum != hp.PhoneNo { |
| | | u.UpdatePhoneNum(hp.PhoneNo, hp.PersonId) |
| | | syncCount++ |
| | | } |
| | | } |
| | | } |
| | | for k,_ := range idMap { |
| | | if _,in := hikPM[k];!in { |
| | | u.Delete(k) |
| | | syncCount++ |
| | | } |
| | | } |
| | | |
| | | } |
| | | return syncCount |
| | | } |
| | | |
| | | func (sv *CarService) getHikPageResult(url string, reqBody map[string]interface{}) *vo.HikPageResult { |
| | | fmt.Println(url, reqBody) |
| | | result := sv.hikUtil.Post(url, reqBody) |
| | |
| | | reqBody := map[string]interface{} { |
| | | "pageNo": 1, |
| | | "pageSize": 1000, |
| | | "personIds": personId, |
| | | } |
| | | if personId != "" { |
| | | reqBody["personIds"] = personId |
| | | } |
| | | pageResult := sv.getHikPageResult(url, reqBody) |
| | | if pageResult ==nil { |
| | | fmt.Println("GetVehicleListByPerson pageResult is nil") |
| | | return nil |
| | | } |
| | | |
| | |
| | | var list []HikVehicle |
| | | if err = json.Unmarshal(b, &list);err == nil { |
| | | return list |
| | | } else { |
| | | fmt.Println("unmarshal err:", err) |
| | | } |
| | | } |
| | | |