北斗定位
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

79 lines
2.1KB

  1. package com.telpo.dipperposition.service.impl;
  2. import com.telpo.dipperposition.entity.mongo.IpProvinceEntity;
  3. import com.telpo.dipperposition.entity.mongo.ProvinceInfoEntity;
  4. import com.telpo.dipperposition.mapper.IpProvinceMapper;
  5. import com.telpo.dipperposition.mapper.ProvinceInfoMapper;
  6. import com.telpo.dipperposition.service.IProvinceInfoService;
  7. import lombok.extern.slf4j.Slf4j;
  8. import org.apache.commons.lang3.ObjectUtils;
  9. import org.springframework.beans.factory.annotation.Autowired;
  10. import org.springframework.stereotype.Service;
  11. import java.util.List;
  12. /**
  13. * @program: DataPushServer
  14. * @description: 推送记录服务接口实现类
  15. * @author: linwl
  16. * @create: 2020-07-20 11:09
  17. */
  18. @Slf4j
  19. @Service
  20. public class ProvinceInfoServiceImpl implements IProvinceInfoService {
  21. @Autowired
  22. private ProvinceInfoMapper provinceInfoMapper;
  23. @Override
  24. public boolean saveProvinceInfo(ProvinceInfoEntity entity) {
  25. return false;
  26. }
  27. @Override
  28. public boolean updateProvinceInfoEntity(ProvinceInfoEntity query, ProvinceInfoEntity update) {
  29. return false;
  30. }
  31. @Override
  32. public boolean romveById(String id) {
  33. provinceInfoMapper.deleteIpById(id);
  34. return false;
  35. }
  36. @Override
  37. public ProvinceInfoEntity getProvinceInfo(String provicne) {
  38. try {
  39. ProvinceInfoEntity query = new ProvinceInfoEntity();
  40. query.setProvince(provicne);
  41. List<ProvinceInfoEntity> records = provinceInfoMapper.queryIpList(query);
  42. if (ObjectUtils.isNotEmpty(records)) {
  43. return records.get(0);
  44. } else {
  45. return null;
  46. }
  47. } catch (Exception e) {
  48. log.error("获取省份异常:", e);
  49. return null;
  50. }
  51. }
  52. @Override
  53. public List<ProvinceInfoEntity> getProvinceInfoEntitys() {
  54. try {
  55. ProvinceInfoEntity query = new ProvinceInfoEntity();
  56. List<ProvinceInfoEntity> records = provinceInfoMapper.queryIpList(query);
  57. if (ObjectUtils.isNotEmpty(records)) {
  58. return records;
  59. } else {
  60. return null;
  61. }
  62. } catch (Exception e) {
  63. log.error("获取IP省份异常:", e);
  64. return null;
  65. }
  66. }
  67. }