|  |  |  | 
|---|
|  |  |  | import org.springframework.data.redis.core.RedisTemplate; | 
|---|
|  |  |  | import org.springframework.stereotype.Service; | 
|---|
|  |  |  | import org.springframework.transaction.annotation.Transactional; | 
|---|
|  |  |  | import org.springframework.util.CollectionUtils; | 
|---|
|  |  |  | import org.springframework.util.ObjectUtils; | 
|---|
|  |  |  | import org.springframework.web.context.request.RequestContextHolder; | 
|---|
|  |  |  | import org.springframework.web.context.request.ServletRequestAttributes; | 
|---|
|  |  |  | 
|---|
|  |  |  | log.info(j+""); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | for (int i=cruiserInfo.size()-1;i>0;i--) { | 
|---|
|  |  |  | CruiserDTO cruiserDTO = cruiserInfo.get(i); | 
|---|
|  |  |  | Double flyLat = cruiserDTO.getFlyLat(); | 
|---|
|  |  |  | Double flyLon = cruiserDTO.getFlyLon(); | 
|---|
|  |  |  | for (ManageCoordinateDetail manageCoordinateDetail : manageCoordinateDetails) { | 
|---|
|  |  |  | String latitude = manageCoordinateDetail.getLatitude().toString(); | 
|---|
|  |  |  | String longitude = manageCoordinateDetail.getLongitude().toString(); | 
|---|
|  |  |  | //                    double lonDouble1 = Double.parseDouble(longitude); | 
|---|
|  |  |  | //                    double latDouble1 = Double.parseDouble(latitude); | 
|---|
|  |  |  | //                    if (lonDouble1==flyLon && flyLat==latDouble1 ){ | 
|---|
|  |  |  | if (longitude.equals(flyLon+"") && latitude.equals(flyLat+"")){ | 
|---|
|  |  |  | cruiserInfo.remove(i); | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | Map<String,Integer> map = new HashMap<>(manageCoordinateDetails.size()+50); | 
|---|
|  |  |  | manageCoordinateDetails.forEach(it->map.put(it.getLatitude()+"_"+it.getLongitude(),it.getId())); | 
|---|
|  |  |  | List<ManageCoordinateDetail> result = new ArrayList<>(); | 
|---|
|  |  |  | for (CruiserDTO cruiserDTO : cruiserInfo) { | 
|---|
|  |  |  | Double flyLat = cruiserDTO.getFlyLat(); | 
|---|
|  |  |  | Double flyLon = cruiserDTO.getFlyLon(); | 
|---|
|  |  |  | ManageCoordinateDetail rsDTO = new ManageCoordinateDetail(); | 
|---|
|  |  |  | rsDTO.setLatitude(flyLat); | 
|---|
|  |  |  | rsDTO.setLongitude(flyLon); | 
|---|
|  |  |  | rsDTO.setState("2"); | 
|---|
|  |  |  | rsDTO.setCreateTime(new Date()); | 
|---|
|  |  |  | rsDTO.setUpdateTime(new Date()); | 
|---|
|  |  |  | rsDTO.setCoordinateId(coordinateId); | 
|---|
|  |  |  | manageCoordinateDetailMapper.insert(rsDTO); | 
|---|
|  |  |  | j++; | 
|---|
|  |  |  | log.info(j+""); | 
|---|
|  |  |  | String fly = cruiserDTO.getFlyLat()+"_"+cruiserDTO.getFlyLon(); | 
|---|
|  |  |  | if(!map.containsKey(fly)){ | 
|---|
|  |  |  | ManageCoordinateDetail rsDTO = new ManageCoordinateDetail(); | 
|---|
|  |  |  | rsDTO.setLatitude(cruiserDTO.getFlyLat()); | 
|---|
|  |  |  | rsDTO.setLongitude(cruiserDTO.getFlyLon()); | 
|---|
|  |  |  | rsDTO.setState("2"); | 
|---|
|  |  |  | rsDTO.setCreateTime(new Date()); | 
|---|
|  |  |  | rsDTO.setUpdateTime(new Date()); | 
|---|
|  |  |  | rsDTO.setCoordinateId(coordinateId); | 
|---|
|  |  |  | result.add(rsDTO); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(!CollectionUtils.isEmpty(result)){ | 
|---|
|  |  |  | this.saveBatch(result); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return 200; | 
|---|