| | |
| | | package com.stylefeng.guns.modular.api; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.stylefeng.guns.modular.system.model.City; |
| | | import com.stylefeng.guns.modular.system.model.CityCopy; |
| | | import com.stylefeng.guns.modular.system.service.ICityCopyService; |
| | | import com.stylefeng.guns.modular.system.service.IOpenCityBusinessService; |
| | | import com.stylefeng.guns.modular.system.service.IOpenCityService; |
| | | import com.stylefeng.guns.modular.system.service.IUserInfoService; |
| | |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | |
| | | |
| | | @Autowired |
| | | private IUserInfoService userInfoService; |
| | | |
| | | @Resource |
| | | private ICityCopyService cityCopyService; |
| | | |
| | | |
| | | |
| | |
| | | }) |
| | | public ResultUtil openCity(Double lat, Double lnt, Integer language){ |
| | | try { |
| | | String s = openCityService.openCity(lat, lnt, language); |
| | | City city = openCityService.openCity(lat, lnt, language); |
| | | if(null == city){ |
| | | return ResultUtil.error(""); |
| | | } |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("name", s); |
| | | map.put("name", language == 1 ? city.getChineseName() : language == 2 ? city.getEnglishName() : city.getFrenchName()); |
| | | map.put("content", language == 1 ? city.getCountryChineseName() : language == 2 ? city.getCountryEnglishName() : city.getCountryFrenchName()); |
| | | return ResultUtil.success(map); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/getCity") |
| | | @ApiOperation(value = "获取省市联动【1.0】", tags = {"用户端-首页"}) |
| | | public ResultUtil<List<CityCopy>> getCity(Integer pid){ |
| | | List<CityCopy> pid1 = cityCopyService.selectList(new EntityWrapper<CityCopy>().eq("pid", pid)); |
| | | return ResultUtil.success(pid1); |
| | | } |
| | | } |